chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dcaru...@apache.org
Subject svn commit: r954796 - in /incubator/chemistry/trunk/chemistry/chemistry-tck-atompub: ./ src/main/java/org/apache/chemistry/tck/atompub/client/ src/main/java/org/apache/chemistry/tck/atompub/fixture/ src/main/java/org/apache/chemistry/tck/atompub/test/s...
Date Tue, 15 Jun 2010 10:33:54 GMT
Author: dcaruana
Date: Tue Jun 15 10:33:54 2010
New Revision: 954796

URL: http://svn.apache.org/viewvc?rev=954796&view=rev
Log:
Apply patch CMIS-215 for fixes:
- CMIS-192: Wrong assertNotNull ALLOWABLE_ACTIONS on created folder entry without includeAllowableActions
- CMIS-190: Atom title missing within createrelationship.atomentry.xml

Modified:
    incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/pom.xml
    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/fixture/ManageAccessControlListVisitor.java
    incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/VersionsTest.java
    incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/resources/org/apache/chemistry/tck/atompub/templates/createrelationship.atomentry.xml

Modified: incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/pom.xml
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/pom.xml?rev=954796&r1=954795&r2=954796&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/pom.xml (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/pom.xml Tue Jun 15 10:33:54
2010
@@ -259,6 +259,92 @@
             </build>
         </profile>
         <profile>
+            <id>xcmis</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <configuration>
+                            <systemProperties>
+                                <property>
+                                    <name>chemistry.tck.tests</name>
+                                    <value>*</value>
+                                </property>
+                                <property>
+                                    <name>chemistry.tck.serviceUrl</name>
+                                    <value>http://localhost:8080/xcmis/rest/cmisatom/cmis1</value>
+                                </property>
+                                <property>
+                                    <name>chemistry.tck.user</name>
+                                    <value>root</value>
+                                </property>
+                                <property>
+                                    <name>chemistry.tck.password</name>
+                                    <value>exo</value>
+                                </property>
+                                <property>
+                                    <name>chemistry.tck.validate</name>
+                                    <value>true</value>
+                                </property>
+                                <property>
+                                    <name>chemistry.tck.failOnValidationError</name>
+                                    <value>false</value>
+                                </property>
+                                <property>
+                                    <name>chemistry.tck.traceRequests</name>
+                                    <value>false</value>
+                                </property>
+                            </systemProperties>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>xcmis-inmemory</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <configuration>
+                            <systemProperties>
+                                <property>
+                                    <name>chemistry.tck.tests</name>
+                                    <value>*</value>
+                                </property>
+                                <property>
+                                    <name>chemistry.tck.serviceUrl</name>
+                                    <value>http://localhost:8080/xcmis/rest/cmisatom/cmis-inmem1</value>
+                                </property>
+                                <property>
+                                    <name>chemistry.tck.user</name>
+                                    <value>root</value>
+                                </property>
+                                <property>
+                                    <name>chemistry.tck.password</name>
+                                    <value>exo</value>
+                                </property>
+                                <property>
+                                    <name>chemistry.tck.validate</name>
+                                    <value>true</value>
+                                </property>
+                                <property>
+                                    <name>chemistry.tck.failOnValidationError</name>
+                                    <value>false</value>
+                                </property>
+                                <property>
+                                    <name>chemistry.tck.traceRequests</name>
+                                    <value>false</value>
+                                </property>
+                            </systemProperties>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
             <id>example</id>
             <build>
                 <plugins>
@@ -295,6 +381,18 @@
                                     <name>chemistry.tck.traceRequests</name>
                                     <value>false</value>
                                 </property>
+                                <property>
+                                    <name>chemistry.tck.type.folder</name>
+                                    <value>custom_folder</value>
+                                </property>
+                                <property>
+                                    <name>chemistry.tck.type.document</name>
+                                    <value>custom_document</value>
+                                </property>
+                                <property>
+                                    <name>chemistry.tck.type.relationship</name>
+                                    <value>custom_association</value>
+                                </property>
                             </systemProperties>
                         </configuration>
                     </plugin>

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=954796&r1=954795&r2=954796&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
Tue Jun 15 10:33:54 2010
@@ -17,21 +17,6 @@
  */
 package org.apache.chemistry.tck.atompub.client;
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.activation.MimeType;
-import javax.activation.MimeTypeParseException;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.validation.Validator;
-
 import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.model.Collection;
 import org.apache.abdera.model.Element;
@@ -61,6 +46,21 @@ import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.activation.MimeType;
+import javax.activation.MimeTypeParseException;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.validation.Validator;
+
 
 /**
  * Interact with CMIS Repository
@@ -108,19 +108,19 @@ public class CMISClient {
     public void setTrace(boolean trace) {
         this.traceConnection = trace;
     }
-    
+
     public void setDefaultDocumentType(String defaultDocumentType) {
         this.defaultDocumentType = defaultDocumentType;
     }
-    
+
     public void setDefaultFolderType(String defaultFolderType) {
         this.defaultFolderType = defaultFolderType;
     }
-    
+
     public void setDefaultRelationshipType(String defaultRelationshipType) {
         this.defaultRelationshipType = defaultRelationshipType;
     }
-    
+
     public String getUserId()
     {
         return this.userId;
@@ -243,7 +243,7 @@ public class CMISClient {
     public CMISUriTemplate getTypeByIdUriTemplate(Workspace workspace) {
         return getUriTemplate(workspace, CMISConstants.URI_TYPE_BY_ID);
     }
-    
+
     public Link getLink(Workspace workspace, String rel, String... matchesMimetypes)
     {
         List<Link> links = workspace.getExtensions(Constants.LINK);
@@ -296,7 +296,7 @@ public class CMISClient {
         }
         return null;
     }
-    
+
     public Link getLink(Entry entry, String rel, String... matchesMimetypes) {
         return getLink(entry.getLinks(rel), matchesMimetypes);
     }
@@ -320,14 +320,14 @@ public class CMISClient {
     public Link getFolderParentLink(Entry entry) {
         return getLink(entry, CMISConstants.REL_UP, CMISConstants.MIMETYPE_ENTRY);
     }
-    
+
     public List<Link> getRenditionLinks(Entry entry) {
         return entry.getLinks(CMISConstants.REL_ALTERNATE);
     }
-    
+
     public Link getChangesLink(Workspace workspace) {
         return getLink(workspace, CMISConstants.REL_CHANGES, CMISConstants.MIMETYPE_FEED);
-    }    
+    }
 
     public Entry getEntry(IRI href) throws Exception {
         return getEntry(href, null);
@@ -380,7 +380,7 @@ public class CMISClient {
         // Assert.assertEquals(name + " (summary)", entry.getSummary());
         CMISObject object = entry.getExtension(CMISConstants.OBJECT);
         Assert.assertEquals(CMISConstants.TYPE_FOLDER, object.getBaseTypeId().getStringValue());
-        String testFolderHREF = (String) res.getHeader("Location");
+        String testFolderHREF = res.getHeader("Location");
         Assert.assertNotNull(testFolderHREF);
         return entry;
     }
@@ -402,7 +402,7 @@ public class CMISClient {
             String contentType, String contentPath) throws Exception {
 
         type = (type == null) ? defaultDocumentType : type;
-        
+
         // If no preference is expressed, use the base64 template if binary
         // content has been supplied or the basic atom entry template otherwise
         String createFile = templates
@@ -454,7 +454,7 @@ public class CMISClient {
         }
         CMISObject object = entry.getExtension(CMISConstants.OBJECT);
         Assert.assertEquals(CMISConstants.TYPE_DOCUMENT, object.getBaseTypeId().getStringValue());
-        String testFileHREF = (String) res.getHeader("Location");
+        String testFileHREF = res.getHeader("Location");
         Assert.assertNotNull(testFileHREF);
         return entry;
     }
@@ -466,6 +466,7 @@ public class CMISClient {
     public Entry createRelationship(IRI parent, String type, String sourceId, String targetId,
String atomEntryFile) throws Exception {
         type = (type == null) ? defaultRelationshipType : type;
         String createFile = templates.load(atomEntryFile);
+        createFile = createFile.replace("${NAME}", sourceId + "_" +targetId);
         createFile = createFile.replace("${RELTYPE}", type);
         createFile = createFile.replace("${SOURCEID}", sourceId);
         createFile = createFile.replace("${TARGETID}", targetId);
@@ -478,7 +479,7 @@ public class CMISClient {
         CMISObject object = entry.getExtension(CMISConstants.OBJECT);
         Assert.assertEquals(CMISConstants.TYPE_RELATIONSHIP, object.getBaseTypeId().getStringValue());
         Assert.assertEquals(targetId, object.getTargetId().getStringValue());
-        String testFileHREF = (String) res.getHeader("Location");
+        String testFileHREF = res.getHeader("Location");
         Assert.assertNotNull(testFileHREF);
         return entry;
     }
@@ -602,7 +603,7 @@ public class CMISClient {
      * @throws IOException
      * @throws ParserConfigurationException
      */
-    private void assertValid(String xml, Validator validator) throws IOException, ParserConfigurationException
{
+    public void assertValid(String xml, Validator validator) throws IOException, ParserConfigurationException
{
         if (validate) {
             try {
                 Document document = cmisValidator.getDocumentBuilder().parse(new InputSource(new
StringReader(xml)));

Modified: incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/fixture/ManageAccessControlListVisitor.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/fixture/ManageAccessControlListVisitor.java?rev=954796&r1=954795&r2=954796&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/fixture/ManageAccessControlListVisitor.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/fixture/ManageAccessControlListVisitor.java
Tue Jun 15 10:33:54 2010
@@ -22,8 +22,6 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
-import javax.xml.transform.stream.StreamSource;
-
 import org.apache.abdera.model.Element;
 import org.apache.abdera.model.Entry;
 import org.apache.abdera.model.Link;
@@ -72,9 +70,7 @@ public class ManageAccessControlListVisi
 
         // Check whether apply ACL is an allowable action
         CMISAllowableActions objectAllowableActions = childObject.getExtension(CMISConstants.ALLOWABLE_ACTIONS);
-        Assert.assertNotNull(objectAllowableActions);
-        boolean canApplyACL = objectAllowableActions.isAllowed("canApplyACL");
-
+        boolean canApplyACL = (objectAllowableActions == null) ? true : objectAllowableActions.isAllowed("canApplyACL");
         // Check whether the typedef allows ACL management
         Link typeLink = entry.entry.getLink(CMISConstants.REL_DESCRIBED_BY);
         Assert.assertNotNull(typeLink);
@@ -141,7 +137,7 @@ public class ManageAccessControlListVisi
     /**
      * Gets the set of base types that we have not been able to handle, and thus
      * do not expect to show in the change log.
-     * 
+     *
      * @return the rejected types
      */
     public Set<String> getRejectedTypes() {
@@ -151,7 +147,7 @@ public class ManageAccessControlListVisi
     /**
      * Chooses a repository permission to add to an ACL for a given principal.
      * Tries to find one that would result in a new entry.
-     * 
+     *
      * @param repositoryPermissions
      *            the repository permissions. Permissions are removed as they
      *            are used
@@ -162,7 +158,7 @@ public class ManageAccessControlListVisi
      *            the current state of the ACL. Tries to avoid creating an ACE
      *            that is already present. The ace with the chosen permission is
      *            added to this set
-     * 
+     *
      * @return an ACE with the chosen permission or <code>null</code> if it was
      *         not possible to choose one< object>
      */
@@ -188,7 +184,7 @@ public class ManageAccessControlListVisi
     /**
      * Adds an ACE for the given principal and permission to the given ACL if it
      * does not already exist.
-     * 
+     *
      * @param principalId
      *            the principal id. If <code>null</code> the method returns
      *            immediately.
@@ -197,7 +193,7 @@ public class ManageAccessControlListVisi
      *            added to this set
      * @param permission
      *            the permission
-     * 
+     *
      * @return an ACE with the permission if it did not already exist in the ACL
      *         or <code>null</code> otherwise
      */
@@ -217,7 +213,7 @@ public class ManageAccessControlListVisi
 
     /**
      * Applies the given ACL using the CMIS API.
-     * 
+     *
      * @param accessControlListLink
      *            the access control list link
      * @param hashedACL
@@ -226,9 +222,9 @@ public class ManageAccessControlListVisi
      *            Minimum expected result status code
      * @param expectedStatusMax
      *            Maximum expected result status code
-     * 
+     *
      * @return the resulting access control list
-     * 
+     *
      * @throws Exception
      *             on error
      */
@@ -244,7 +240,7 @@ public class ManageAccessControlListVisi
         }
         buff.append("</cmis:acl>");
         String req = buff.toString();
-        client.getAppValidator().validate(new StreamSource(new StringReader(req)));
+        client.assertValid(req, client.getAppValidator());
         Request putReq = new PutRequest(accessControlListLink.getHref().toString(), req,
CMISConstants.MIMETYPE_CMISACL);
         Response aclRes = client.executeRequest(putReq, expectedStatusMin, expectedStatusMax);
         Assert.assertNotNull(aclRes);

Modified: incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/VersionsTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/VersionsTest.java?rev=954796&r1=954795&r2=954796&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/VersionsTest.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/VersionsTest.java
Tue Jun 15 10:33:54 2010
@@ -17,11 +17,6 @@
  */
 package org.apache.chemistry.tck.atompub.test.spec;
 
-import java.io.StringReader;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
 import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.model.Entry;
 import org.apache.abdera.model.Feed;
@@ -37,6 +32,11 @@ import org.apache.chemistry.tck.atompub.
 import org.apache.chemistry.tck.atompub.http.Response;
 import org.junit.Assert;
 
+import java.io.StringReader;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
 
 /**
  * CMIS Versions Tests
@@ -100,7 +100,7 @@ public class VersionsTest extends TCKTes
         CMISObject pwcObject = pwc.getExtension(CMISConstants.OBJECT);
         Assert.assertNotNull(pwcObject);
         Assert.assertTrue(pwcObject.isVersionSeriesCheckedOut().getBooleanValue());
-        Assert.assertEquals(docObject.getObjectId().getStringValue(), pwcObject.getVersionSeriesId().getStringValue());
+        Assert.assertEquals(docObject.getVersionSeriesId().getStringValue(), pwcObject.getVersionSeriesId().getStringValue());
         Assert.assertEquals(docObject.getVersionSeriesId().getStringValue(), pwcObject.getVersionSeriesId().getStringValue());
         Assert.assertEquals(pwcObject.getObjectId().getStringValue(), pwcObject.getVersionSeriesCheckedOutId().getStringValue());
         Assert.assertNotNull(pwcObject.getVersionSeriesCheckedOutBy().getStringValue());
@@ -114,7 +114,7 @@ public class VersionsTest extends TCKTes
         CMISObject pwcGetObject = pwc.getExtension(CMISConstants.OBJECT);
         Assert.assertNotNull(pwcGetObject);
         Assert.assertTrue(pwcGetObject.isVersionSeriesCheckedOut().getBooleanValue());
-        Assert.assertEquals(docObject.getObjectId().getStringValue(), pwcGetObject.getVersionSeriesId().getStringValue());
+        Assert.assertEquals(docObject.getVersionSeriesId().getStringValue(), pwcGetObject.getVersionSeriesId().getStringValue());
         Assert.assertEquals(pwcGetObject.getObjectId().getStringValue(), pwcGetObject.getVersionSeriesCheckedOutId().getStringValue());
         Assert.assertNotNull(pwcGetObject.getVersionSeriesCheckedOutBy().getStringValue());
 
@@ -256,7 +256,7 @@ public class VersionsTest extends TCKTes
         // updatedObject.getVersionSeriesId().getStringValue());
         Assert.assertNull(updatedObject.getVersionSeriesCheckedOutId().getStringValue());
         Assert.assertNull(updatedObject.getVersionSeriesCheckedOutBy().getStringValue());
-        
+
         // There is no guarantee that the object returned by checkin is the object against
which our checkin comment
         // was recorded, so let's get the 'latest major version'
         updatedDoc = client.getEntry(updatedDoc.getSelfLink().getHref(), Collections.singletonMap("returnVersion",
"latestmajor"));
@@ -338,12 +338,12 @@ public class VersionsTest extends TCKTes
         Assert.assertNotNull(allVersionsLink);
         Feed allVersions = client.getFeed(allVersionsLink.getHref());
         Assert.assertNotNull(allVersions);
-        
+
         // Remember the initial number of versions. This should be at least one, but may
vary across repositories that
         // may maintain a 'current' version in tandem with version history snapshots.
         int initialVersions = allVersions.getEntries().size();
         Assert.assertTrue(initialVersions > 0);
-        
+
         IRI checkedoutHREF = client.getCheckedOutCollection(client.getWorkspace());
         for (int i = 0; i < NUMBER_OF_VERSIONS; i++) {
             // checkout
@@ -394,7 +394,7 @@ public class VersionsTest extends TCKTes
             } else {
                 pastLatestMajor = versionObject.isLatestMajorVersion().getBooleanValue();
             }
-            
+
             if (versionIndex >= 0) {
                 // Validate non-initial versions have content
                 Response versionContentRes = client.executeRequest(new GetRequest(version.getContentSrc().toString()),

Modified: incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/resources/org/apache/chemistry/tck/atompub/templates/createrelationship.atomentry.xml
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/resources/org/apache/chemistry/tck/atompub/templates/createrelationship.atomentry.xml?rev=954796&r1=954795&r2=954796&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/resources/org/apache/chemistry/tck/atompub/templates/createrelationship.atomentry.xml
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/resources/org/apache/chemistry/tck/atompub/templates/createrelationship.atomentry.xml
Tue Jun 15 10:33:54 2010
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <entry xmlns="http://www.w3.org/2005/Atom" xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/"
xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/">
+  <title>${NAME}</title>
   <cmisra:object>
     <cmis:properties>
       <cmis:propertyId propertyDefinitionId="cmis:objectTypeId">
@@ -14,3 +15,4 @@
     </cmis:properties>
   </cmisra:object>
 </entry>
+</entry>



Mime
View raw message