Added: websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/control/ACLSmokeTest.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/control/ACLSmokeTest.html (added) +++ websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/control/ACLSmokeTest.html Tue Apr 3 05:28:19 2012 @@ -0,0 +1,143 @@ + + + + +ACLSmokeTest xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.tck.tests.control;
+20  
+21  import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.FAILURE;
+22  import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.SKIPPED;
+23  
+24  import java.util.ArrayList;
+25  import java.util.Collections;
+26  import java.util.List;
+27  import java.util.Map;
+28  
+29  import org.apache.chemistry.opencmis.client.api.Document;
+30  import org.apache.chemistry.opencmis.client.api.Folder;
+31  import org.apache.chemistry.opencmis.client.api.Session;
+32  import org.apache.chemistry.opencmis.commons.data.Ace;
+33  import org.apache.chemistry.opencmis.commons.data.Acl;
+34  import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
+35  import org.apache.chemistry.opencmis.commons.enums.CapabilityAcl;
+36  import org.apache.chemistry.opencmis.tck.CmisTestResult;
+37  import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTest;
+38  import org.apache.chemistry.opencmis.tck.impl.TestParameters;
+39  
+40  /**
+41   * Query smoke test.
+42   */
+43  public class ACLSmokeTest extends AbstractSessionTest {
+44  
+45      @Override
+46      public void init(Map<String, String> parameters) {
+47          super.init(parameters);
+48          setName("ACL Test");
+49          setDescription("Creates a document and checks its ACL.");
+50      }
+51  
+52      @Override
+53      public void run(Session session) {
+54          CmisTestResult f;
+55  
+56          if (supportsACLs(session)) {
+57              try {
+58                  // create folder and document
+59                  Folder testFolder = createTestFolder(session);
+60                  Document doc = createDocument(session, testFolder, "acltest.txt", "ACL test");
+61  
+62                  // check if there is an ACL
+63                  Acl acl = doc.getAcl();
+64  
+65                  f = createResult(FAILURE, "ACLs are supported but newly created document has no ACL!");
+66                  addResult(assertNotNull(acl, null, f));
+67  
+68                  // check basic permissions
+69                  Acl basicAcl = session.getAcl(doc, true);
+70  
+71                  f = createResult(FAILURE,
+72                          "ACLs are supported but repository does not return a basic ACL for the newly created document!");
+73                  addResult(assertNotNull(basicAcl, null, f));
+74  
+75                  if (basicAcl != null) {
+76                      addResult(checkACL(session, basicAcl, "Basic ACL"));
+77  
+78                      if (basicAcl.getAces() != null) {
+79                          for (Ace ace : basicAcl.getAces()) {
+80                              if (ace.getPermissions() != null) {
+81                                  for (String permission : ace.getPermissions()) {
+82                                      if (!"cmis:read".equals(permission) && !"cmis:write".equals(permission)
+83                                              && !"cmis:all".equals(permission)) {
+84                                          addResult(createResult(FAILURE, "ACE contains a non-basic permission: "
+85                                                  + permission));
+86                                      }
+87                                  }
+88                              }
+89                          }
+90                      }
+91                  }
+92  
+93                  // apply permission "cmis:read"
+94                  if (getAclCapability(session) == CapabilityAcl.MANAGE) {
+95                      String principal = getParameters().get(TestParameters.DEFAULT_ACL_PRINCIPAL);
+96                      if (principal == null) {
+97                          principal = TestParameters.DEFAULT_ACL_PRINCIPAL_VALUE;
+98                      }
+99  
+100                     List<Ace> aces = new ArrayList<Ace>();
+101                     aces.add(session.getObjectFactory().createAce(principal, Collections.singletonList("cmis:read")));
+102 
+103                     session.applyAcl(doc, aces, null, null);
+104                 }
+105 
+106                 deleteObject(doc);
+107             } finally {
+108                 deleteTestFolder();
+109             }
+110         } else {
+111             addResult(createResult(SKIPPED, "ACLs are not supported. Test Skipped!"));
+112         }
+113     }
+114 
+115     protected boolean supportsACLs(Session session) {
+116         CapabilityAcl aclCap = getAclCapability(session);
+117         return (aclCap != null) && (aclCap != CapabilityAcl.NONE);
+118     }
+119 
+120     protected CapabilityAcl getAclCapability(Session session) {
+121         RepositoryInfo repository = session.getRepositoryInfo();
+122 
+123         if (repository.getCapabilities().getAclCapability() == null) {
+124             return null;
+125         }
+126 
+127         return repository.getCapabilities().getAclCapability();
+128     }
+129 }
+
+
+ + Added: websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/control/ControlTestGroup.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/control/ControlTestGroup.html (added) +++ websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/control/ControlTestGroup.html Tue Apr 3 05:28:19 2012 @@ -0,0 +1,52 @@ + + + + +ControlTestGroup xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.tck.tests.control;
+20  
+21  import java.util.Map;
+22  
+23  import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTestGroup;
+24  
+25  /**
+26   * This test group contains ACL and policy tests.
+27   */
+28  public class ControlTestGroup extends AbstractSessionTestGroup {
+29      @Override
+30      public void init(Map<String, String> parameters) throws Exception {
+31          super.init(parameters);
+32  
+33          setName("Control Test Group");
+34          setDescription("ACL and Policy tests.");
+35  
+36          addTest(new ACLSmokeTest());
+37      }
+38  }
+
+
+ + Added: websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/control/package-frame.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/control/package-frame.html (added) +++ websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/control/package-frame.html Tue Apr 3 05:28:19 2012 @@ -0,0 +1,27 @@ + + + + + + OpenCMIS Test Compatibility Kit 0.7.0 Reference Package org.apache.chemistry.opencmis.tck.tests.control + + + + +

+ org.apache.chemistry.opencmis.tck.tests.control +

+ +

Classes

+ + + + + \ No newline at end of file Added: websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/control/package-summary.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/control/package-summary.html (added) +++ websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/control/package-summary.html Tue Apr 3 05:28:19 2012 @@ -0,0 +1,72 @@ + + + + + + OpenCMIS Test Compatibility Kit 0.7.0 Reference Package org.apache.chemistry.opencmis.tck.tests.control + + + +
+ +
+
+ +
+ +

Package org.apache.chemistry.opencmis.tck.tests.control

+ + + + + + + + + + + + + + + +
Class Summary
+ ACLSmokeTest +
+ ControlTestGroup +
+ +
+ +
+
+ +
+
+ Copyright © 2009-2012 The Apache Software Foundation. All Rights Reserved. + + \ No newline at end of file Added: websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/crud/CRUDTestGroup.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/crud/CRUDTestGroup.html (added) +++ websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/crud/CRUDTestGroup.html Tue Apr 3 05:28:19 2012 @@ -0,0 +1,60 @@ + + + + +CRUDTestGroup xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.tck.tests.crud;
+20  
+21  import java.util.Map;
+22  
+23  import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTestGroup;
+24  
+25  /**
+26   * This test group contains simple Create, Read, Update and Delete tests.
+27   */
+28  public class CRUDTestGroup extends AbstractSessionTestGroup {
+29      @Override
+30      public void init(Map<String, String> parameters) throws Exception {
+31          super.init(parameters);
+32  
+33          setName("CRUD Test Group");
+34          setDescription("Create, Read, Update, and Delete tests.");
+35  
+36          addTest(new CreateAndDeleteFolderTest());
+37          addTest(new CreateAndDeleteDocumentTest());
+38          addTest(new CreateBigDocument());
+39          addTest(new CreateAndDeleteRelationshipTest());
+40          addTest(new UpdateSmokeTest());
+41          addTest(new SetAndDeleteContentTest());
+42          addTest(new CopyTest());
+43          addTest(new MoveTest());
+44          addTest(new DeleteTreeTest());
+45      }
+46  }
+
+
+ + Added: websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/crud/CopyTest.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/crud/CopyTest.html (added) +++ websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/crud/CopyTest.html Tue Apr 3 05:28:19 2012 @@ -0,0 +1,114 @@ + + + + +CopyTest xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.tck.tests.crud;
+20  
+21  import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.FAILURE;
+22  import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.SKIPPED;
+23  
+24  import java.util.Map;
+25  
+26  import org.apache.chemistry.opencmis.client.api.Document;
+27  import org.apache.chemistry.opencmis.client.api.Folder;
+28  import org.apache.chemistry.opencmis.client.api.Session;
+29  import org.apache.chemistry.opencmis.commons.definitions.DocumentTypeDefinition;
+30  import org.apache.chemistry.opencmis.commons.enums.BindingType;
+31  import org.apache.chemistry.opencmis.commons.enums.VersioningState;
+32  import org.apache.chemistry.opencmis.tck.CmisTestResult;
+33  import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTest;
+34  
+35  /**
+36   * Copy test.
+37   */
+38  public class CopyTest extends AbstractSessionTest {
+39  
+40      @Override
+41      public void init(Map<String, String> parameters) {
+42          super.init(parameters);
+43          setName("Copy Test");
+44          setDescription("Creates two folders and a document and copies the document from one folder to the other. "
+45                  + " If the AtomPub binding is used, this test is skipped.");
+46      }
+47  
+48      @Override
+49      public void run(Session session) {
+50          if (getBinding() == BindingType.ATOMPUB) {
+51              addResult(createResult(SKIPPED,
+52                      "AtomPub binding does not support createDocumentFromSource(). Test Skipped!"));
+53              return;
+54          }
+55  
+56          CmisTestResult f;
+57  
+58          try {
+59              // create folders
+60              Folder testFolder = createTestFolder(session);
+61              Folder folder1 = createFolder(session, testFolder, "copyfolder1");
+62              Folder folder2 = createFolder(session, testFolder, "copyfolder2");
+63  
+64              // create document
+65              Document doc1 = createDocument(session, folder1, "copytestdoc.txt", "copy test");
+66  
+67              VersioningState versioningState = VersioningState.MAJOR;
+68              if (!((DocumentTypeDefinition) doc1.getType()).isVersionable()) {
+69                  versioningState = VersioningState.NONE;
+70              }
+71  
+72              // copy
+73              Document doc2 = doc1.copy(folder2, null, versioningState, null, null, null, SELECT_ALL_NO_CACHE_OC);
+74  
+75              if (doc2 == null) {
+76                  addResult(createResult(FAILURE, "Copied document is null!"));
+77              } else {
+78                  addResult(checkObject(session, doc2, getAllProperties(doc2),
+79                          "Copied document check. Id: + " + doc2.getName()));
+80  
+81                  f = createResult(FAILURE, "Content streams don't match!");
+82                  addResult(assertEquals(doc1.getContentStream(), doc2.getContentStream(), null, f));
+83              }
+84  
+85              int count1 = countFolderChildren(folder1);
+86              f = createResult(FAILURE, "Source folder should have exactly one child but has " + count1 + " children!");
+87              addResult(assertEquals(1, count1, null, f));
+88  
+89              int count2 = countFolderChildren(folder2);
+90              f = createResult(FAILURE, "Target folder should have exactly one child but has " + count2 + " children!");
+91              addResult(assertEquals(1, count2, null, f));
+92  
+93              deleteObject(doc2);
+94              deleteObject(doc1);
+95          } finally {
+96              // clean up
+97              deleteTestFolder();
+98          }
+99      }
+100 }
+
+
+ + Added: websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/crud/CreateAndDeleteDocumentTest.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/crud/CreateAndDeleteDocumentTest.html (added) +++ websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/crud/CreateAndDeleteDocumentTest.html Tue Apr 3 05:28:19 2012 @@ -0,0 +1,172 @@ + + + + +CreateAndDeleteDocumentTest xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.tck.tests.crud;
+20  
+21  import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.FAILURE;
+22  
+23  import java.io.IOException;
+24  import java.util.ArrayList;
+25  import java.util.HashMap;
+26  import java.util.List;
+27  import java.util.Map;
+28  
+29  import org.apache.chemistry.opencmis.client.api.CmisObject;
+30  import org.apache.chemistry.opencmis.client.api.Document;
+31  import org.apache.chemistry.opencmis.client.api.Folder;
+32  import org.apache.chemistry.opencmis.client.api.ItemIterable;
+33  import org.apache.chemistry.opencmis.client.api.Session;
+34  import org.apache.chemistry.opencmis.commons.data.ContentStream;
+35  import org.apache.chemistry.opencmis.tck.CmisTestResult;
+36  import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTest;
+37  
+38  /**
+39   * Simple document test.
+40   */
+41  public class CreateAndDeleteDocumentTest extends AbstractSessionTest {
+42  
+43      private static final String CONTENT = "TCK test content.";
+44  
+45      @Override
+46      public void init(Map<String, String> parameters) {
+47          super.init(parameters);
+48          setName("Create and Delete Document Test");
+49          setDescription("Creates a few documents, checks the newly created documents and their parent and finally deletes the created documents.");
+50      }
+51  
+52      @Override
+53      public void run(Session session) {
+54          CmisTestResult f;
+55  
+56          int numOfDocuments = 20;
+57  
+58          // create a test folder
+59          Folder testFolder = createTestFolder(session);
+60  
+61          try {
+62              Map<String, Document> documents = new HashMap<String, Document>();
+63  
+64              // create documents
+65              for (int i = 0; i < numOfDocuments; i++) {
+66                  Document newDocument = createDocument(session, testFolder, "doc" + i, CONTENT);
+67                  documents.put(newDocument.getId(), newDocument);
+68              }
+69  
+70              // simple children test
+71              addResult(checkChildren(session, testFolder, "Test folder children check"));
+72  
+73              // check if all documents are there
+74              ItemIterable<CmisObject> children = testFolder.getChildren(SELECT_ALL_NO_CACHE_OC);
+75              List<String> childrenIds = new ArrayList<String>();
+76              for (CmisObject child : children) {
+77                  if (child != null) {
+78                      childrenIds.add(child.getId());
+79                      Document document = documents.get(child.getId());
+80  
+81                      f = createResult(FAILURE, "Document and test folder child don't match! Id: " + child.getId());
+82                      addResult(assertShallowEquals(document, child, null, f));
+83                  }
+84              }
+85  
+86              f = createResult(FAILURE, "Number of created folders does not match the number of existing folders!");
+87              addResult(assertEquals(numOfDocuments, childrenIds.size(), null, f));
+88  
+89              for (Document document : documents.values()) {
+90                  if (!childrenIds.contains(document.getId())) {
+91                      addResult(createResult(FAILURE, "Created document not found in test folder children! Id: "
+92                              + document.getId()));
+93                  }
+94              }
+95  
+96              // check paging
+97              int pageSize = 5;
+98              CmisObject lastObject = null;
+99  
+100             int count = 0;
+101             ItemIterable<CmisObject> page1 = testFolder.getChildren(SELECT_ALL_NO_CACHE_OC_ORDER_BY_NAME).getPage(
+102                     pageSize);
+103             for (CmisObject child : page1) {
+104                 count++;
+105                 lastObject = child;
+106             }
+107 
+108             f = createResult(FAILURE, "Returned number of children doesn't match the page size!");
+109             addResult(assertEquals(pageSize, count, null, f));
+110 
+111             count = 0;
+112             ItemIterable<CmisObject> page2 = testFolder.getChildren(SELECT_ALL_NO_CACHE_OC_ORDER_BY_NAME)
+113                     .skipTo(pageSize - 1).getPage(pageSize);
+114             for (CmisObject child : page2) {
+115                 count++;
+116 
+117                 if (count == 1) {
+118                     f = createResult(FAILURE,
+119                             "Last object of the first page doesn't match the first object of the second page.");
+120                     addResult(assertEquals(lastObject.getId(), child.getId(), null, f));
+121                 }
+122             }
+123 
+124             f = createResult(FAILURE, "Returned number of children doesn't match the page size!");
+125             addResult(assertEquals(pageSize, count, null, f));
+126 
+127             // check content
+128             for (Document document : documents.values()) {
+129                 ContentStream contentStream = document.getContentStream();
+130                 if (contentStream == null || contentStream.getStream() == null) {
+131                     addResult(createResult(FAILURE, "Document has no content! Id: " + document.getId()));
+132                     continue;
+133                 } else {
+134                     try {
+135                         contentStream.getStream().close();
+136                     } catch (IOException e) {
+137                     }
+138                 }
+139 
+140                 // TODO: content checks
+141             }
+142 
+143             // delete all documents
+144             for (Document document : documents.values()) {
+145                 document.delete(true);
+146 
+147                 f = createResult(FAILURE,
+148                         "Document should not exist anymore but it is still there! Id: " + document.getId());
+149                 addResult(assertIsFalse(exists(document), null, f));
+150             }
+151         } finally {
+152             // delete the test folder
+153             deleteTestFolder();
+154         }
+155 
+156         addResult(createInfoResult("Tested the creation and deletion of " + numOfDocuments + " documents."));
+157     }
+158 }
+
+
+ + Added: websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/crud/CreateAndDeleteFolderTest.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/crud/CreateAndDeleteFolderTest.html (added) +++ websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/crud/CreateAndDeleteFolderTest.html Tue Apr 3 05:28:19 2012 @@ -0,0 +1,121 @@ + + + + +CreateAndDeleteFolderTest xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.tck.tests.crud;
+20  
+21  import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.FAILURE;
+22  
+23  import java.util.ArrayList;
+24  import java.util.HashMap;
+25  import java.util.List;
+26  import java.util.Map;
+27  
+28  import org.apache.chemistry.opencmis.client.api.CmisObject;
+29  import org.apache.chemistry.opencmis.client.api.Folder;
+30  import org.apache.chemistry.opencmis.client.api.ItemIterable;
+31  import org.apache.chemistry.opencmis.client.api.Session;
+32  import org.apache.chemistry.opencmis.tck.CmisTestResult;
+33  import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTest;
+34  
+35  /**
+36   * Simple folder test.
+37   */
+38  public class CreateAndDeleteFolderTest extends AbstractSessionTest {
+39  
+40      @Override
+41      public void init(Map<String, String> parameters) {
+42          super.init(parameters);
+43          setName("Create and Delete Folder Test");
+44          setDescription("Creates a few folders, checks the newly created folders and their parent and finally deletes the created folders.");
+45      }
+46  
+47      @Override
+48      public void run(Session session) {
+49          CmisTestResult f;
+50  
+51          int numOfFolders = 20;
+52  
+53          // create a test folder
+54          Folder testFolder = createTestFolder(session);
+55  
+56          try {
+57              Map<String, Folder> folders = new HashMap<String, Folder>();
+58  
+59              // create folders
+60              for (int i = 0; i < numOfFolders; i++) {
+61                  Folder newFolder = createFolder(session, testFolder, "folder" + i);
+62                  folders.put(newFolder.getId(), newFolder);
+63              }
+64  
+65              // simple children test
+66              addResult(checkChildren(session, testFolder, "Test folder children check"));
+67  
+68              // check if all folders are there
+69              ItemIterable<CmisObject> children = testFolder.getChildren(SELECT_ALL_NO_CACHE_OC);
+70              List<String> childrenIds = new ArrayList<String>();
+71              for (CmisObject child : children) {
+72                  if (child != null) {
+73                      childrenIds.add(child.getId());
+74                      Folder folder = folders.get(child.getId());
+75  
+76                      f = createResult(FAILURE, "Folder and test folder child don't match! Id: " + child.getId());
+77                      addResult(assertShallowEquals(folder, child, null, f));
+78                  }
+79              }
+80  
+81              f = createResult(FAILURE, "Number of created folders does not match the number of existing folders!");
+82              addResult(assertEquals(numOfFolders, childrenIds.size(), null, f));
+83  
+84              for (Folder folder : folders.values()) {
+85                  if (!childrenIds.contains(folder.getId())) {
+86                      addResult(createResult(FAILURE,
+87                              "Created folder not found in test folder children! Id: " + folder.getId()));
+88                  }
+89              }
+90  
+91              // delete all folders
+92              for (Folder folder : folders.values()) {
+93                  // empty folders should be deleteable like this
+94                  folder.delete(true);
+95  
+96                  f = createResult(FAILURE,
+97                          "Folder should not exist anymore but it is still there! Id: " + folder.getId());
+98                  addResult(assertIsFalse(exists(folder), null, f));
+99              }
+100         } finally {
+101             // delete the test folder
+102             deleteTestFolder();
+103         }
+104 
+105         addResult(createInfoResult("Tested the creation and deletion of " + numOfFolders + " folders."));
+106     }
+107 }
+
+
+ + Added: websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/crud/CreateAndDeleteRelationshipTest.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/crud/CreateAndDeleteRelationshipTest.html (added) +++ websites/staging/chemistry/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/crud/CreateAndDeleteRelationshipTest.html Tue Apr 3 05:28:19 2012 @@ -0,0 +1,180 @@ + + + + +CreateAndDeleteRelationshipTest xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.tck.tests.crud;
+20  
+21  import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.FAILURE;
+22  import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.SKIPPED;
+23  
+24  import java.util.List;
+25  import java.util.Map;
+26  
+27  import org.apache.chemistry.opencmis.client.api.Document;
+28  import org.apache.chemistry.opencmis.client.api.Folder;
+29  import org.apache.chemistry.opencmis.client.api.Relationship;
+30  import org.apache.chemistry.opencmis.client.api.Session;
+31  import org.apache.chemistry.opencmis.commons.enums.RelationshipDirection;
+32  import org.apache.chemistry.opencmis.tck.CmisTestResult;
+33  import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTest;
+34  
+35  /**
+36   * Simple folder test.
+37   */
+38  public class CreateAndDeleteRelationshipTest extends AbstractSessionTest {
+39  
+40  	@Override
+41  	public void init(Map<String, String> parameters) {
+42  		super.init(parameters);
+43  		setName("Create and Delete Relationship Test");
+44  		setDescription("Creates a relationship between two documents, checks the newly created relationship and finally deletes the created relationship.");
+45  	}
+46  
+47  	@Override
+48  	public void run(Session session) {
+49  		CmisTestResult f;
+50  		boolean found;
+51  
+52  		if (hasRelationships(session)) {
+53  			// create a test folder
+54  			Folder testFolder = createTestFolder(session);
+55  
+56  			try {
+57  				// create documents
+58  				Document doc1 = createDocument(session, testFolder, "doc1.txt",
+59  						"doc1");
+60  				Document doc2 = createDocument(session, testFolder, "doc2.txt",
+61  						"doc2");
+62  
+63  				// create relationship
+64  				Relationship rel = createRelationship(session, "rel1", doc1,
+65  						doc2);
+66  
+67  				f = createResult(FAILURE,
+68  						"Source document id does not match relationship source id!");
+69  				addResult(assertEquals(doc1.getId(), rel.getSourceId().getId(),
+70  						null, f));
+71  
+72  				f = createResult(FAILURE,
+73  						"Target document id does not match relationship target id!");
+74  				addResult(assertEquals(doc2.getId(), rel.getTarget().getId(),
+75  						null, f));
+76  
+77  				// check the source document
+78  				doc1.refresh();
+79  				List<Relationship> doc1rels = doc1.getRelationships();
+80  
+81  				f = createResult(FAILURE,
+82  						"Source document has no relationships but must have at least one!");
+83  				addResult(assertListNotEmpty(doc1rels, null, f));
+84  
+85  				if (doc1rels != null) {
+86  					found = false;
+87  					for (Relationship r : doc1rels) {
+88  						if (rel.getId().equals(r.getId())) {
+89  							found = true;
+90  							break;
+91  						}
+92  					}
+93  
+94  					f = createResult(
+95  							FAILURE,
+96  							"Newly created relationship not found in the relationships of the source document!");
+97  					addResult(assertIsTrue(found, null, f));
+98  				}
+99  
+100 				found = false;
+101 				for (Relationship r : session.getRelationships(doc1, true,
+102 						RelationshipDirection.SOURCE, null,
+103 						SELECT_ALL_NO_CACHE_OC)) {
+104 					if (rel.getId().equals(r.getId())) {
+105 						found = true;
+106 						break;
+107 					}
+108 				}
+109 
+110 				f = createResult(
+111 						FAILURE,
+112 						"Newly created relationship not found in the relationships returned by getObjectRelationships() for the source document!");
+113 				addResult(assertIsTrue(found, null, f));
+114 
+115 				// check the target document
+116 				doc2.refresh();
+117 				List<Relationship> doc2rels = doc2.getRelationships();
+118 
+119 				f = createResult(FAILURE,
+120 						"Target document has no relationships but must have at least one!");
+121 				addResult(assertListNotEmpty(doc2rels, null, f));
+122 
+123 				if (doc2rels != null) {
+124 					found = false;
+125 					for (Relationship r : doc2rels) {
+126 						if (rel.getId().equals(r.getId())) {
+127 							found = true;
+128 							break;
+129 						}
+130 					}
+131 
+132 					f = createResult(
+133 							FAILURE,
+134 							"Newly created relationship not found in the relationships of the target document!");
+135 					addResult(assertIsTrue(found, null, f));
+136 				}
+137 
+138 				found = false;
+139 				for (Relationship r : session.getRelationships(doc2, true,
+140 						RelationshipDirection.TARGET, null,
+141 						SELECT_ALL_NO_CACHE_OC)) {
+142 					if (rel.getId().equals(r.getId())) {
+143 						found = true;
+144 						break;
+145 					}
+146 				}
+147 
+148 				f = createResult(
+149 						FAILURE,
+150 						"Newly created relationship not found in the relationships returned by getObjectRelationships() for the target document!");
+151 				addResult(assertIsTrue(found, null, f));
+152 
+153 				// remove
+154 				deleteObject(rel);
+155 				deleteObject(doc2);
+156 				deleteObject(doc1);
+157 			} finally {
+158 				// delete the test folder
+159 				deleteTestFolder();
+160 			}
+161 		} else {
+162 			addResult(createResult(SKIPPED,
+163 					"Relationships not supported. Test Skipped!"));
+164 		}
+165 	}
+166 }
+
+
+ +