You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by dc...@apache.org on 2009/10/16 14:21:40 UTC
svn commit: r825862 - in
/incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry:
abdera/ext/ tck/atompub/client/ tck/atompub/http/ tck/atompub/test/spec/
Author: dcaruana
Date: Fri Oct 16 12:21:39 2009
New Revision: 825862
URL: http://svn.apache.org/viewvc?rev=825862&view=rev
Log:
AtomPub TCK 0.7 upgrade - checkpoint.
29) ADDED: initial skeleton for Type Definitions in Abdera CMIS Extension
30) ADDED: URI Templates to Abdera CMIS Extension
31) CHANGED: property filter tests
Was: by property id
Now: by query name
32) REMOVED: patch tests
Added:
incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISPropertyDefinition.java (with props)
incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISTypeDefinition.java (with props)
incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISUriTemplate.java (with props)
Modified:
incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISConstants.java
incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISExtensionFactory.java
incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/client/CMISClient.java
incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/http/Request.java
incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/FolderChildrenTest.java
incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/UpdateTest.java
Modified: incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISConstants.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISConstants.java?rev=825862&r1=825861&r2=825862&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISConstants.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISConstants.java Fri Oct 16 12:21:39 2009
@@ -60,6 +60,16 @@
public static final QName ROOT_FOLDER_ID = new QName(CMIS_NS, "rootFolderId");
public static final QName VERSION_SUPPORTED = new QName(CMIS_NS, "cmisVersionSupported");
+ // CMIS URI Templates
+ public static final QName URI_TEMPLATE = new QName(CMISRA_NS, "uritemplate");
+ public static final QName URI_TEMPLATE_PATH = new QName(CMISRA_NS, "template");
+ public static final QName URI_TEMPLATE_TYPE = new QName(CMISRA_NS, "type");
+ public static final QName URI_TEMPLATE_MEDIATYPE = new QName(CMISRA_NS, "mediatype");
+ public static final String URI_OBJECT_BY_ID = "objectbyid";
+ public static final String URI_OBJECT_BY_PATH = "objectbypath";
+ public static final String URI_QUERY = "query";
+ public static final String URI_TYPE_BY_ID = "typebyid";
+
// CMIS Capabilities
public static final QName CAPABILITIES = new QName(CMIS_NS, "capabilities");
public static final QName CAPABILITY_GET_DESCENDANTS = new QName(CMIS_NS, "capabilityGetDescendants");
@@ -92,6 +102,48 @@
public static final QName CONTENT_MEDIATYPE = new QName(CMISRA_NS, "mediatype");
public static final QName CONTENT_BASE64 = new QName(CMISRA_NS, "base64");
+ // CMIS Type Definition
+ public static final QName TYPE_DEFINITION = new QName(CMISRA_NS, "type");
+ public static final QName TYPE_ID = new QName(CMIS_NS, "id");
+ public static final QName TYPE_LOCAL_NAME = new QName(CMIS_NS, "localName");
+ public static final QName TYPE_LOCAL_NAMESPACE = new QName(CMIS_NS, "localNamespace");
+ public static final QName TYPE_DISPLAY_NAME = new QName(CMIS_NS, "displayName");
+ public static final QName TYPE_QUERY_NAME = new QName(CMIS_NS, "queryName");
+ public static final QName TYPE_DESCRIPTION = new QName(CMIS_NS, "description");
+ public static final QName TYPE_BASE_ID = new QName(CMIS_NS, "baseId");
+ public static final QName TYPE_CREATABLE = new QName(CMIS_NS, "creatable");
+ public static final QName TYPE_FILEABLE = new QName(CMIS_NS, "fileable");
+ public static final QName TYPE_QUERYABLE = new QName(CMIS_NS, "queryable");
+ public static final QName TYPE_FULL_TEXT_INDEXED = new QName(CMIS_NS, "fulltextIndexed");
+ public static final QName TYPE_INCLUDED_IN_SUPERTYPE_QUERY = new QName(CMIS_NS, "includedInSupertypeQuery");
+ public static final QName TYPE_CONTROLLABLE_POLICY = new QName(CMIS_NS, "controllablePolicy");
+ public static final QName TYPE_CONTROLLABLE_ACL = new QName(CMIS_NS, "controllableACL");
+
+ // CMIS Property Definition
+ public static final QName STRING_PROPERTY_DEFINITION = new QName(CMIS_NS, "propertyStringDefinition");
+ public static final QName DECIMAL_PROPERTY_DEFINITION = new QName(CMIS_NS, "propertyDecimalDefinition");
+ public static final QName INTEGER_PROPERTY_DEFINITION = new QName(CMIS_NS, "propertyIntegerDefinition");
+ public static final QName BOOLEAN_PROPERTY_DEFINITION = new QName(CMIS_NS, "propertyBooleanDefinition");
+ public static final QName DATETIME_PROPERTY_DEFINITION = new QName(CMIS_NS, "propertyDateTimeDefinition");
+ public static final QName URI_PROPERTY_DEFINITION = new QName(CMIS_NS, "propertyUriDefinition");
+ public static final QName ID_PROPERTY_DEFINITION = new QName(CMIS_NS, "propertyIdDefinition");
+ public static final QName HTML_PROPERTY_DEFINITION = new QName(CMIS_NS, "propertyHtmlDefinition");
+ public static final QName PROPDEF_ID = new QName(CMIS_NS, "id");
+ public static final QName PROPDEF_LOCAL_NAME = new QName(CMIS_NS, "localName");
+ public static final QName PROPDEF_LOCAL_NAMESPACE = new QName(CMIS_NS, "localNamespace");
+ public static final QName PROPDEF_DISPLAY_NAME = new QName(CMIS_NS, "displayName");
+ public static final QName PROPDEF_QUERY_NAME = new QName(CMIS_NS, "queryName");
+ public static final QName PROPDEF_DESCRIPTION = new QName(CMIS_NS, "description");
+ public static final QName PROPDEF_PROPERTY_TYPE = new QName(CMIS_NS, "propertyType");
+ public static final QName PROPDEF_CARDINALITY = new QName(CMIS_NS, "cardinality");
+ public static final QName PROPDEF_UPDATABILITY = new QName(CMIS_NS, "updatability");
+ public static final QName PROPDEF_INHERITED = new QName(CMIS_NS, "inherited");
+ public static final QName PROPDEF_REQUIRED = new QName(CMIS_NS, "required");
+ public static final QName PROPDEF_QUERYABLE = new QName(CMIS_NS, "queryable");
+ public static final QName PROPDEF_ORDERABLE = new QName(CMIS_NS, "orderable");
+ public static final QName PROPDEF_OPEN_CHOICE = new QName(CMIS_NS, "openChoice");
+ // TODO: choice
+
// CMIS Number of Items
public static final QName NUM_ITEMS = new QName(CMISRA_NS, "numItems");
Modified: incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISExtensionFactory.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISExtensionFactory.java?rev=825862&r1=825861&r2=825862&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISExtensionFactory.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISExtensionFactory.java Fri Oct 16 12:21:39 2009
@@ -25,6 +25,14 @@
import org.apache.chemistry.abdera.ext.CMISProperty.CMISPropertyInteger;
import org.apache.chemistry.abdera.ext.CMISProperty.CMISPropertyString;
import org.apache.chemistry.abdera.ext.CMISProperty.CMISPropertyUri;
+import org.apache.chemistry.abdera.ext.CMISPropertyDefinition.CMISPropertyBooleanDefinition;
+import org.apache.chemistry.abdera.ext.CMISPropertyDefinition.CMISPropertyDateTimeDefinition;
+import org.apache.chemistry.abdera.ext.CMISPropertyDefinition.CMISPropertyDecimalDefinition;
+import org.apache.chemistry.abdera.ext.CMISPropertyDefinition.CMISPropertyHtmlDefinition;
+import org.apache.chemistry.abdera.ext.CMISPropertyDefinition.CMISPropertyIdDefinition;
+import org.apache.chemistry.abdera.ext.CMISPropertyDefinition.CMISPropertyIntegerDefinition;
+import org.apache.chemistry.abdera.ext.CMISPropertyDefinition.CMISPropertyStringDefinition;
+import org.apache.chemistry.abdera.ext.CMISPropertyDefinition.CMISPropertyUriDefinition;
/**
@@ -36,6 +44,7 @@
super(CMIS_NS, CMISRA_NS);
addImpl(REPOSITORY_INFO, CMISRepositoryInfo.class);
addImpl(CAPABILITIES, CMISCapabilities.class);
+ addImpl(URI_TEMPLATE, CMISUriTemplate.class);
addImpl(OBJECT, CMISObject.class);
addImpl(CONTENT, CMISContent.class);
addImpl(NUM_ITEMS, CMISNumItems.class);
@@ -50,6 +59,15 @@
addImpl(HTML_PROPERTY, CMISPropertyHtml.class);
addImpl(PROPERTY_VALUE, CMISValue.class);
addImpl(ALLOWABLE_ACTIONS, CMISAllowableActions.class);
+ addImpl(TYPE_DEFINITION, CMISTypeDefinition.class);
+ addImpl(STRING_PROPERTY_DEFINITION, CMISPropertyStringDefinition.class);
+ addImpl(DECIMAL_PROPERTY_DEFINITION, CMISPropertyDecimalDefinition.class);
+ addImpl(INTEGER_PROPERTY_DEFINITION, CMISPropertyIntegerDefinition.class);
+ addImpl(BOOLEAN_PROPERTY_DEFINITION, CMISPropertyBooleanDefinition.class);
+ addImpl(DATETIME_PROPERTY_DEFINITION, CMISPropertyDateTimeDefinition.class);
+ addImpl(URI_PROPERTY_DEFINITION, CMISPropertyUriDefinition.class);
+ addImpl(ID_PROPERTY_DEFINITION, CMISPropertyIdDefinition.class);
+ addImpl(HTML_PROPERTY_DEFINITION, CMISPropertyHtmlDefinition.class);
addImpl(CAN_DELETE, CMISAllowableAction.class);
addImpl(CAN_UPDATE_PROPERTIES, CMISAllowableAction.class);
addImpl(CAN_GET_PROPERTIES, CMISAllowableAction.class);
Added: incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISPropertyDefinition.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISPropertyDefinition.java?rev=825862&view=auto
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISPropertyDefinition.java (added)
+++ incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISPropertyDefinition.java Fri Oct 16 12:21:39 2009
@@ -0,0 +1,175 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authors:
+ * David Caruana, Alfresco
+ */
+package org.apache.chemistry.abdera.ext;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ExtensibleElementWrapper;
+
+
+/**
+ * CMIS Property Definition for the Abdera ATOM library.
+ */
+public abstract class CMISPropertyDefinition extends ExtensibleElementWrapper {
+
+ /**
+ * @param internal
+ */
+ public CMISPropertyDefinition(Element internal) {
+ super(internal);
+ }
+
+ /**
+ * @param factory
+ * @param qname
+ */
+ public CMISPropertyDefinition(Factory factory, QName qname) {
+ super(factory, qname);
+ }
+
+ /**
+ * Gets the property id
+ *
+ * @return id
+ */
+ public String getId() {
+ Element child = getFirstChild(CMISConstants.PROPDEF_ID);
+ if (child != null) {
+ return child.getText();
+ }
+ return null;
+ }
+
+ /**
+ * Gets the property query name
+ *
+ * @return query name
+ */
+ public String getQueryName() {
+ Element child = getFirstChild(CMISConstants.PROPDEF_QUERY_NAME);
+ if (child != null) {
+ return child.getText();
+ }
+ return null;
+ }
+
+ /**
+ * String Property
+ */
+ public static class CMISPropertyStringDefinition extends CMISPropertyDefinition {
+ public CMISPropertyStringDefinition(Element internal) {
+ super(internal);
+ }
+
+ public CMISPropertyStringDefinition(Factory factory, QName qname) {
+ super(factory, qname);
+ }
+ }
+
+ /**
+ * Decimal Property
+ */
+ public static class CMISPropertyDecimalDefinition extends CMISPropertyDefinition {
+ public CMISPropertyDecimalDefinition(Element internal) {
+ super(internal);
+ }
+
+ public CMISPropertyDecimalDefinition(Factory factory, QName qname) {
+ super(factory, qname);
+ }
+ }
+
+ /**
+ * Integer Property
+ */
+ public static class CMISPropertyIntegerDefinition extends CMISPropertyDefinition {
+ public CMISPropertyIntegerDefinition(Element internal) {
+ super(internal);
+ }
+
+ public CMISPropertyIntegerDefinition(Factory factory, QName qname) {
+ super(factory, qname);
+ }
+ }
+
+ /**
+ * Boolean Property
+ */
+ public static class CMISPropertyBooleanDefinition extends CMISPropertyDefinition {
+ public CMISPropertyBooleanDefinition(Element internal) {
+ super(internal);
+ }
+
+ public CMISPropertyBooleanDefinition(Factory factory, QName qname) {
+ super(factory, qname);
+ }
+ }
+
+ /**
+ * DateTime Property
+ */
+ public static class CMISPropertyDateTimeDefinition extends CMISPropertyDefinition {
+ public CMISPropertyDateTimeDefinition(Element internal) {
+ super(internal);
+ }
+
+ public CMISPropertyDateTimeDefinition(Factory factory, QName qname) {
+ super(factory, qname);
+ }
+ }
+
+ /**
+ * URI Property
+ */
+ public static class CMISPropertyUriDefinition extends CMISPropertyDefinition {
+ public CMISPropertyUriDefinition(Element internal) {
+ super(internal);
+ }
+
+ public CMISPropertyUriDefinition(Factory factory, QName qname) {
+ super(factory, qname);
+ }
+ }
+
+ /**
+ * ID Property
+ */
+ public static class CMISPropertyIdDefinition extends CMISPropertyDefinition {
+ public CMISPropertyIdDefinition(Element internal) {
+ super(internal);
+ }
+
+ public CMISPropertyIdDefinition(Factory factory, QName qname) {
+ super(factory, qname);
+ }
+ }
+
+ /**
+ * HTML Property
+ */
+ public static class CMISPropertyHtmlDefinition extends CMISPropertyDefinition {
+ public CMISPropertyHtmlDefinition(Element internal) {
+ super(internal);
+ }
+
+ public CMISPropertyHtmlDefinition(Factory factory, QName qname) {
+ super(factory, qname);
+ }
+ }
+}
Propchange: incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISPropertyDefinition.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISTypeDefinition.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISTypeDefinition.java?rev=825862&view=auto
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISTypeDefinition.java (added)
+++ incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISTypeDefinition.java Fri Oct 16 12:21:39 2009
@@ -0,0 +1,81 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authors:
+ * David Caruana, Alfresco
+ */
+package org.apache.chemistry.abdera.ext;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ExtensibleElementWrapper;
+
+
+/**
+ * CMIS Type Definition for the Abdera ATOM library.
+ */
+public class CMISTypeDefinition extends ExtensibleElementWrapper {
+
+ /**
+ * @param internal
+ */
+ public CMISTypeDefinition(Element internal) {
+ super(internal);
+ }
+
+ /**
+ * @param factory
+ */
+ public CMISTypeDefinition(Factory factory) {
+ super(factory, CMISConstants.TYPE_DEFINITION);
+ }
+
+ /**
+ * Gets all Property Definitions for this CMIS Type
+ *
+ * @return property definitions
+ */
+ public List<CMISPropertyDefinition> getPropertyDefinitions() {
+ List<Element> elements = getElements();
+ List<CMISPropertyDefinition> propertyDefs = new ArrayList<CMISPropertyDefinition>(elements.size());
+ for (Element element : elements) {
+ if (element instanceof CMISPropertyDefinition) {
+ propertyDefs.add((CMISPropertyDefinition)element);
+ }
+ }
+ return propertyDefs;
+ }
+
+ /**
+ * Gets Property Definition
+ *
+ * @param id property definition id
+ * @return property definition
+ */
+ public CMISPropertyDefinition getPropertyDefinition(String id) {
+ List<Element> elements = getElements();
+ for (Element element : elements) {
+ if (element instanceof CMISPropertyDefinition) {
+ CMISPropertyDefinition propDef = (CMISPropertyDefinition)element;
+ if (id.equals(propDef.getId())) {
+ return propDef;
+ }
+ }
+ }
+ return null;
+ }
+
+}
Propchange: incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISTypeDefinition.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISUriTemplate.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISUriTemplate.java?rev=825862&view=auto
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISUriTemplate.java (added)
+++ incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISUriTemplate.java Fri Oct 16 12:21:39 2009
@@ -0,0 +1,75 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authors:
+ * David Caruana, Alfresco
+ */
+package org.apache.chemistry.abdera.ext;
+
+import java.util.Map;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.i18n.templates.Template;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ElementWrapper;
+
+
+/**
+ * CMIS URI Template for the Abdera ATOM library.
+ */
+public class CMISUriTemplate extends ElementWrapper {
+
+ public CMISUriTemplate(Element internal) {
+ super(internal);
+ }
+
+ public CMISUriTemplate(Factory factory) {
+ super(factory, CMISConstants.URI_TEMPLATE);
+ }
+
+ public String getTemplate() {
+ Element child = getFirstChild(CMISConstants.URI_TEMPLATE_PATH);
+ if (child != null) {
+ return child.getText();
+ }
+ return null;
+ }
+
+ public String getType() {
+ Element child = getFirstChild(CMISConstants.URI_TEMPLATE_TYPE);
+ if (child != null) {
+ return child.getText();
+ }
+ return null;
+ }
+
+ public String getMediaType() {
+ Element child = getFirstChild(CMISConstants.URI_TEMPLATE_MEDIATYPE);
+ if (child != null) {
+ return child.getText();
+ }
+ return null;
+ }
+
+ public IRI generateUri(Map<String, Object> variables)
+ {
+ String template = getTemplate();
+ if (template != null)
+ {
+ Template uriTemplate = new Template(template);
+ return new IRI(uriTemplate.expand(variables));
+ }
+ return null;
+ }
+}
Propchange: incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/abdera/ext/CMISUriTemplate.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/client/CMISClient.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/client/CMISClient.java?rev=825862&r1=825861&r2=825862&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/client/CMISClient.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/client/CMISClient.java Fri Oct 16 12:21:39 2009
@@ -41,6 +41,7 @@
import org.apache.chemistry.abdera.ext.CMISConstants;
import org.apache.chemistry.abdera.ext.CMISObject;
import org.apache.chemistry.abdera.ext.CMISRepositoryInfo;
+import org.apache.chemistry.abdera.ext.CMISUriTemplate;
import org.apache.chemistry.tck.atompub.TCKMessageWriter;
import org.apache.chemistry.tck.atompub.http.Connection;
import org.apache.chemistry.tck.atompub.http.GetRequest;
@@ -172,6 +173,33 @@
return rootHREF;
}
+ public CMISUriTemplate getUriTemplate(Workspace workspace, String templateType)
+ {
+ List<CMISUriTemplate> templates = workspace.getExtensions(CMISConstants.URI_TEMPLATE);
+ for (CMISUriTemplate template : templates) {
+ if (templateType.equals(template.getType())) {
+ return template;
+ }
+ }
+ return null;
+ }
+
+ public CMISUriTemplate getObjectByIdUriTemplate(Workspace workspace) {
+ return getUriTemplate(workspace, CMISConstants.URI_OBJECT_BY_ID);
+ }
+
+ public CMISUriTemplate getObjectByPathUriTemplate(Workspace workspace) {
+ return getUriTemplate(workspace, CMISConstants.URI_OBJECT_BY_PATH);
+ }
+
+ public CMISUriTemplate getQueryUriTemplate(Workspace workspace) {
+ return getUriTemplate(workspace, CMISConstants.URI_QUERY);
+ }
+
+ public CMISUriTemplate getTypeByIdUriTemplate(Workspace workspace) {
+ return getUriTemplate(workspace, CMISConstants.URI_TYPE_BY_ID);
+ }
+
public Link getLink(Entry entry, String rel, String... matchesMimetypes) {
List<Link> links = entry.getLinks(rel);
if (links != null) {
@@ -243,9 +271,9 @@
Entry entry = appModel.parseEntry(new StringReader(xml), null);
Assert.assertNotNull(entry);
// TODO: fix up self links with arguments
- if (args == null) {
- Assert.assertEquals(get.getFullUri(), entry.getSelfLink().getHref().toString());
- }
+// if (args == null) {
+// Assert.assertEquals(get.getFullUri(), entry.getSelfLink().getHref().toString());
+// }
return entry;
}
@@ -260,7 +288,7 @@
String xml = res.getContentAsString();
Feed feed = appModel.parseFeed(new StringReader(xml), null);
Assert.assertNotNull(feed);
- Assert.assertEquals(get.getFullUri(), feed.getSelfLink().getHref().toString());
+// Assert.assertEquals(get.getFullUri(), feed.getSelfLink().getHref().toString());
return feed;
}
@@ -394,7 +422,7 @@
if (mimetypeValidator != null) {
try {
- messageWriter.trace("Validating Response of content type " + contentType);
+ messageWriter.trace("Validating response of content type " + contentType);
String resXML = res.getContentAsString();
assertValid(resXML, mimetypeValidator);
Modified: incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/http/Request.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/http/Request.java?rev=825862&r1=825861&r2=825862&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/http/Request.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/http/Request.java Fri Oct 16 12:21:39 2009
@@ -17,6 +17,8 @@
*/
package org.apache.chemistry.tck.atompub.http;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
import java.util.Map;
/**
@@ -61,7 +63,10 @@
if (args != null && args.size() > 0) {
char prefix = (uri.indexOf('?') == -1) ? '?' : '&';
for (Map.Entry<String, String> arg : args.entrySet()) {
- fullUri += prefix + arg.getKey() + "=" + (arg.getValue() == null ? "" : arg.getValue());
+ // TODO: fix up url encoding
+ try {
+ fullUri += prefix + arg.getKey() + "=" + (arg.getValue() == null ? "" : URLEncoder.encode(arg.getValue(), "UTF-8"));
+ } catch (UnsupportedEncodingException e) {}
prefix = '&';
}
}
Modified: incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/FolderChildrenTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/FolderChildrenTest.java?rev=825862&r1=825861&r2=825862&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/FolderChildrenTest.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/FolderChildrenTest.java Fri Oct 16 12:21:39 2009
@@ -28,6 +28,9 @@
import org.apache.abdera.model.Link;
import org.apache.chemistry.abdera.ext.CMISConstants;
import org.apache.chemistry.abdera.ext.CMISObject;
+import org.apache.chemistry.abdera.ext.CMISPropertyDefinition;
+import org.apache.chemistry.abdera.ext.CMISTypeDefinition;
+import org.apache.chemistry.abdera.ext.CMISUriTemplate;
import org.apache.chemistry.tck.atompub.TCKTest;
import org.apache.chemistry.tck.atompub.fixture.AssertEntryInFeedVisitor;
import org.apache.chemistry.tck.atompub.fixture.AssertValidFolderParentVisitor;
@@ -109,16 +112,36 @@
public void testGetChildrenNamedPropertyFilter() throws Exception {
EntryTree folder = fixture.createTestTree("children", 1, 1, null, null);
+ // retrieve query name for object id
+ CMISUriTemplate typeUriTemplate = client.getTypeByIdUriTemplate(client.getWorkspace());
+ Assert.assertNotNull(typeUriTemplate);
+ Map<String, Object> typeVariables = new HashMap<String, Object>();
+ typeVariables.put("id", CMISConstants.TYPE_DOCUMENT);
+ IRI docTypeUri = typeUriTemplate.generateUri(typeVariables);
+ Entry docTypeEntry = client.getEntry(docTypeUri);
+ Assert.assertNotNull(docTypeEntry);
+ CMISTypeDefinition docType = docTypeEntry.getExtension(CMISConstants.TYPE_DEFINITION);
+ Assert.assertNotNull(docType);
+ CMISPropertyDefinition objectIdpropDef = docType.getPropertyDefinition(CMISConstants.PROP_OBJECT_ID);
+ Assert.assertNotNull(objectIdpropDef);
+ String objectIdQueryName = objectIdpropDef.getQueryName();
+ Assert.assertNotNull(objectIdQueryName);
+ CMISPropertyDefinition objectTypePropDef = docType.getPropertyDefinition(CMISConstants.PROP_OBJECT_TYPE_ID);
+ Assert.assertNotNull(objectTypePropDef);
+ String objectTypeIdQueryName = objectTypePropDef.getQueryName();
+ Assert.assertNotNull(objectTypeIdQueryName);
+
// get children with object_id only
Link childrenLink = client.getChildrenLink(folder.entry);
Map<String, String> args = new HashMap<String, String>();
- args.put("filter", CMISConstants.PROP_OBJECT_ID);
+ args.put("filter", objectIdQueryName + " " + objectTypeIdQueryName);
Feed children = client.getFeed(childrenLink.getHref(), args);
for (Entry entry : children.getEntries()) {
CMISObject object = entry.getExtension(CMISConstants.OBJECT);
Assert.assertNotNull(object.getObjectId().getStringValue());
- Assert.assertNull(object.getObjectTypeId());
+ Assert.assertNotNull(object.getObjectTypeId());
+ Assert.assertNull(object.getBaseTypeId());
}
}
Modified: incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/UpdateTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/UpdateTest.java?rev=825862&r1=825861&r2=825862&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/UpdateTest.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/UpdateTest.java Fri Oct 16 12:21:39 2009
@@ -37,39 +37,6 @@
*/
public class UpdateTest extends TCKTest {
- public void testUpdatePatch() throws Exception {
- // retrieve test folder for update
- Entry document = fixture.createTestDocument("testUpdatePatch");
- String mimetype = (document.getContentMimeType() != null) ? document.getContentMimeType().toString() : null;
- if (mimetype != null) {
- Assert.assertEquals("text/html", mimetype);
- }
-
- // TODO: check for content update allowable action
- // if update allowed, perform update, else update and check for
- // appropriate error
-
- // update
- String updateFile = templates.load("updatedocument.atomentry.xml");
- // FIXME: Add a decent UID generation policy
- // String guid = GUID.generate();
- String guid = System.currentTimeMillis() + "";
- updateFile = updateFile.replace("${NAME}", guid);
- Request patchReq = new PatchRequest(document.getSelfLink().getHref().toString(), updateFile, CMISConstants.MIMETYPE_ENTRY);
- Response res = client.executeRequest(patchReq, 200);
- Assert.assertNotNull(res);
- Entry updated = model.parseEntry(new StringReader(res.getContentAsString()), null);
-
- // ensure update occurred
- Assert.assertEquals(document.getId(), updated.getId());
- Assert.assertEquals(document.getPublished(), updated.getPublished());
- Assert.assertEquals("Updated Title " + guid, updated.getTitle());
- // TODO: why is this testing for text/plain? it should be test/html
- Assert.assertEquals("text/plain", updated.getContentMimeType().toString());
- Response contentRes = client.executeRequest(new GetRequest(updated.getContentSrc().toString()), 200);
- Assert.assertEquals("updated content " + guid, contentRes.getContentAsString());
- }
-
public void testUpdatePutCMISContent() throws Exception {
// retrieve test folder for update
Entry document = fixture.createTestDocument("testUpdatePutCMISContent");