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 2010/03/11 13:25:32 UTC

svn commit: r921824 - in /incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main: java/org/apache/chemistry/tck/atompub/client/ java/org/apache/chemistry/tck/atompub/test/spec/ resources/org/apache/chemistry/tck/atompub/templates/

Author: dcaruana
Date: Thu Mar 11 12:25:31 2010
New Revision: 921824

URL: http://svn.apache.org/viewvc?rev=921824&view=rev
Log:
FIx CMIS-154: CMISClient.createRelationship - cmis:sourceId is not specified

Modified:
    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/test/spec/RelationshipsTest.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/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=921824&r1=921823&r2=921824&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 Thu Mar 11 12:25:31 2010
@@ -458,14 +458,15 @@ public class CMISClient {
         return entry;
     }
 
-    public Entry createRelationship(IRI parent, String type, String targetId) throws Exception {
-        return createRelationship(parent, type, targetId, "createrelationship.atomentry.xml");
+    public Entry createRelationship(IRI parent, String type, String sourceId, String targetId) throws Exception {
+        return createRelationship(parent, type, sourceId, targetId, "createrelationship.atomentry.xml");
     }
 
-    public Entry createRelationship(IRI parent, String type, String targetId, String atomEntryFile) throws Exception {
+    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("${RELTYPE}", type);
+        createFile = createFile.replace("${SOURCEID}", sourceId);
         createFile = createFile.replace("${TARGETID}", targetId);
         Request req = new PostRequest(parent.toString(), createFile, CMISConstants.MIMETYPE_ENTRY);
         Response res = executeRequest(req, 201);

Modified: incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/RelationshipsTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/RelationshipsTest.java?rev=921824&r1=921823&r2=921824&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/RelationshipsTest.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tck-atompub/src/main/java/org/apache/chemistry/tck/atompub/test/spec/RelationshipsTest.java Thu Mar 11 12:25:31 2010
@@ -100,18 +100,18 @@ public class RelationshipsTest extends T
         assertEquals(0, relsBefore.getEntries().size());
 
         // create relationship between source and target documents
+        CMISObject sourceObject = source.getExtension(CMISConstants.OBJECT);
+        assertNotNull(sourceObject);
+        String sourceId = sourceObject.getObjectId().getStringValue();
+        assertNotNull(sourceId);
         CMISObject targetObject = target.getExtension(CMISConstants.OBJECT);
         assertNotNull(targetObject);
         String targetId = targetObject.getObjectId().getStringValue();
         assertNotNull(targetId);
-        Entry rel = client.createRelationship(relsLink.getHref(), options.getRelationshipType(), targetId);
+        Entry rel = client.createRelationship(relsLink.getHref(), options.getRelationshipType(), sourceId, targetId);
         assertNotNull(rel);
 
         // check created relationship
-        CMISObject sourceObject = source.getExtension(CMISConstants.OBJECT);
-        assertNotNull(sourceObject);
-        String sourceId = sourceObject.getObjectId().getStringValue();
-        assertNotNull(sourceId);
         CMISObject relObject = rel.getExtension(CMISConstants.OBJECT);
         assertNotNull(relObject);
         assertEquals(options.getRelationshipType(), relObject.getObjectTypeId().getStringValue());
@@ -144,11 +144,15 @@ public class RelationshipsTest extends T
         assertNotNull(relsLink);
 
         // create relationship between source and target documents
+        CMISObject sourceObject = source.getExtension(CMISConstants.OBJECT);
+        assertNotNull(sourceObject);
+        String sourceId = sourceObject.getObjectId().getStringValue();
+        assertNotNull(sourceId);
         CMISObject targetObject = target.getExtension(CMISConstants.OBJECT);
         assertNotNull(targetObject);
         String targetId = targetObject.getObjectId().getStringValue();
         assertNotNull(targetId);
-        Entry rel = client.createRelationship(relsLink.getHref(), options.getRelationshipType(), targetId);
+        Entry rel = client.createRelationship(relsLink.getHref(), options.getRelationshipType(), sourceId, targetId);
         assertNotNull(rel);
 
         // get created relationship
@@ -182,11 +186,15 @@ public class RelationshipsTest extends T
         assertEquals(0, relsBefore.getEntries().size());
 
         // create relationship between source and target documents
+        CMISObject sourceObject = source.getExtension(CMISConstants.OBJECT);
+        assertNotNull(sourceObject);
+        String sourceId = sourceObject.getObjectId().getStringValue();
+        assertNotNull(sourceId);
         CMISObject targetObject = target.getExtension(CMISConstants.OBJECT);
         assertNotNull(targetObject);
         String targetId = targetObject.getObjectId().getStringValue();
         assertNotNull(targetId);
-        Entry rel = client.createRelationship(relsLink.getHref(), options.getRelationshipType(), targetId);
+        Entry rel = client.createRelationship(relsLink.getHref(), options.getRelationshipType(), sourceId, targetId);
         assertNotNull(rel);
 
         // check relationships for created item

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=921824&r1=921823&r2=921824&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 Thu Mar 11 12:25:31 2010
@@ -5,6 +5,9 @@
       <cmis:propertyId propertyDefinitionId="cmis:objectTypeId">
         <cmis:value>${RELTYPE}</cmis:value>
       </cmis:propertyId>
+      <cmis:propertyId propertyDefinitionId="cmis:sourceId">
+        <cmis:value>${SOURCEID}</cmis:value>
+      </cmis:propertyId>
       <cmis:propertyId propertyDefinitionId="cmis:targetId">
         <cmis:value>${TARGETID}</cmis:value>
       </cmis:propertyId>