Added: chemistry/site/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/basics/RepositoryInfoTest.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/basics/RepositoryInfoTest.html?rev=1308698&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/basics/RepositoryInfoTest.html (added) +++ chemistry/site/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/basics/RepositoryInfoTest.html Tue Apr 3 05:27:23 2012 @@ -0,0 +1,282 @@ + + + + +RepositoryInfoTest 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.basics;
+20  
+21  import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.FAILURE;
+22  import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.OK;
+23  import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.WARNING;
+24  
+25  import java.util.Map;
+26  
+27  import org.apache.chemistry.opencmis.client.api.Session;
+28  import org.apache.chemistry.opencmis.commons.data.AclCapabilities;
+29  import org.apache.chemistry.opencmis.commons.data.RepositoryCapabilities;
+30  import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
+31  import org.apache.chemistry.opencmis.commons.definitions.PermissionDefinition;
+32  import org.apache.chemistry.opencmis.tck.CmisTestResult;
+33  import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTest;
+34  
+35  /**
+36   * Repository info test.
+37   */
+38  public class RepositoryInfoTest extends AbstractSessionTest {
+39  
+40      @Override
+41      public void init(Map<String, String> parameters) {
+42          super.init(parameters);
+43          setName("Repository Info Test");
+44          setDescription("Gets and checks the repository info.");
+45      }
+46  
+47      @Override
+48      public void run(Session session) {
+49          CmisTestResult success;
+50          CmisTestResult failure;
+51  
+52          RepositoryInfo ri = getRepositoryInfo(session);
+53  
+54          // id
+55          success = createResult(OK, "Repository id: " + ri.getId());
+56          failure = createResult(FAILURE, "Repository id is not set!", true);
+57          addResult(assertStringNotEmpty(ri.getId(), success, failure));
+58  
+59          // name
+60          failure = createResult(FAILURE, "Repository name is not set!");
+61          addResult(assertNotNull(ri.getName(), null, failure));
+62  
+63          success = createResult(OK, "Repository name: " + ri.getName());
+64          failure = createResult(WARNING, "Repository name is empty!");
+65          addResult(assertStringNotEmpty(ri.getName(), success, failure));
+66  
+67          // description
+68          failure = createResult(FAILURE, "Repository description is not set!");
+69          addResult(assertNotNull(ri.getDescription(), null, failure));
+70  
+71          success = createResult(OK, "Repository description: " + ri.getDescription());
+72          failure = createResult(WARNING, "Repository description is empty!");
+73          addResult(assertStringNotEmpty(ri.getDescription(), success, failure));
+74  
+75          // vendor
+76          failure = createResult(FAILURE, "Vendor name is not set!");
+77          addResult(assertStringNotEmpty(ri.getVendorName(), null, failure));
+78  
+79          success = createResult(OK, "Vendor name: " + ri.getVendorName());
+80          failure = createResult(WARNING, "Vendor name is empty!");
+81          addResult(assertStringNotEmpty(ri.getVendorName(), success, failure));
+82  
+83          // product name
+84          failure = createResult(FAILURE, "Product name is not set!");
+85          addResult(assertStringNotEmpty(ri.getProductName(), null, failure));
+86  
+87          success = createResult(OK, "Product name: " + ri.getProductName());
+88          failure = createResult(WARNING, "Product name is empty!");
+89          addResult(assertStringNotEmpty(ri.getProductName(), success, failure));
+90  
+91          // product version
+92          failure = createResult(FAILURE, "Product version is not set!");
+93          addResult(assertStringNotEmpty(ri.getProductVersion(), null, failure));
+94  
+95          success = createResult(OK, "Product version: " + ri.getProductVersion());
+96          failure = createResult(WARNING, "Product version is empty!");
+97          addResult(assertStringNotEmpty(ri.getProductVersion(), success, failure));
+98  
+99          // CMIS version supported
+100         success = createResult(OK, "CMIS Version Supported: " + ri.getCmisVersionSupported());
+101         failure = createResult(FAILURE, "CMIS Version Supported is not set!");
+102         addResult(assertStringNotEmpty(ri.getCmisVersionSupported(), success, failure));
+103 
+104         failure = createResult(FAILURE, "CMIS Version Supported is not '1.0'!");
+105         addResult(assertEquals("1.0", ri.getCmisVersionSupported(), null, failure));
+106 
+107         // root folder
+108         success = createResult(OK, "Root folder id: " + ri.getRootFolderId());
+109         failure = createResult(FAILURE, "Root folder id is not set!");
+110         addResult(assertStringNotEmpty(ri.getRootFolderId(), success, failure));
+111 
+112         // thin client uri
+113         success = createResult(OK, "Thin client URI: " + ri.getThinClientUri());
+114         failure = createResult(WARNING, "Thin client URI is not set!");
+115         addResult(assertStringNotEmpty(ri.getThinClientUri(), success, failure));
+116 
+117         // principal id anonymous
+118         success = createResult(OK, "Principal Id anonymous: " + ri.getPrincipalIdAnonymous());
+119         failure = createResult(WARNING, "Principal Id anonymous is not set!");
+120         addResult(assertStringNotEmpty(ri.getPrincipalIdAnonymous(), success, failure));
+121 
+122         // principal id anyone
+123         success = createResult(OK, "Principal Id anyone: " + ri.getPrincipalIdAnyone());
+124         failure = createResult(WARNING, "Principal Id anyone is not set!");
+125         addResult(assertStringNotEmpty(ri.getPrincipalIdAnyone(), success, failure));
+126 
+127         // latest change log token
+128         success = createResult(OK, "Latest change log token: " + ri.getLatestChangeLogToken());
+129         failure = createResult(WARNING, "Latest change log token is not set!");
+130         addResult(assertStringNotEmpty(ri.getLatestChangeLogToken(), success, failure));
+131 
+132         // changes incomplete
+133         success = createResult(OK, "Changes Incomplete: " + ri.getChangesIncomplete());
+134         failure = createResult(WARNING, "Changes Incomplete is not set!");
+135         addResult(assertNotNull(ri.getChangesIncomplete(), success, failure));
+136 
+137         // changes on type
+138         success = createResult(OK, "Changes on type: " + ri.getChangesOnType());
+139         failure = createResult(WARNING, "Changes on type is not set!");
+140         addResult(assertNotNull(ri.getChangesOnType(), success, failure));
+141 
+142         if (ri.getChangesOnType() != null) {
+143             failure = createResult(WARNING, "Changes on type has more than 4 entries!");
+144             addResult(assertIsTrue(ri.getChangesOnType().size() < 5, null, failure));
+145         }
+146 
+147         // capabilities
+148         if (ri.getCapabilities() == null) {
+149             addResult(createResult(FAILURE, "Capabilities are not set!"));
+150         } else {
+151             RepositoryCapabilities cap = ri.getCapabilities();
+152 
+153             // ACL capability
+154             success = createResult(OK, "ACL capability: " + cap.getAclCapability());
+155             failure = createResult(FAILURE, "ACL capability is not set!");
+156             addResult(assertNotNull(cap.getAclCapability(), success, failure));
+157 
+158             // changes capability
+159             success = createResult(OK, "Changes capability: " + cap.getChangesCapability());
+160             failure = createResult(WARNING, "Changes capability is not set!");
+161             addResult(assertNotNull(cap.getChangesCapability(), success, failure));
+162 
+163             // content stream updates capability
+164             success = createResult(OK, "Content stream updates capability: " + cap.getContentStreamUpdatesCapability());
+165             failure = createResult(FAILURE, "Content stream updates is not set!");
+166             addResult(assertNotNull(cap.getContentStreamUpdatesCapability(), success, failure));
+167 
+168             // get descendants capability
+169             success = createResult(OK, "Get descendants capability: " + cap.isGetDescendantsSupported());
+170             failure = createResult(FAILURE, "Get descendants capability is not set!");
+171             addResult(assertNotNull(cap.isGetDescendantsSupported(), success, failure));
+172 
+173             // get folder tree capability
+174             success = createResult(OK, "Get folder tree capability: " + cap.isGetFolderTreeSupported());
+175             failure = createResult(FAILURE, "Get folder tree capability is not set!");
+176             addResult(assertNotNull(cap.isGetFolderTreeSupported(), success, failure));
+177 
+178             // multifiling capability
+179             success = createResult(OK, "Multifiling capability: " + cap.isMultifilingSupported());
+180             failure = createResult(FAILURE, "Multifiling capability is not set!");
+181             addResult(assertNotNull(cap.isMultifilingSupported(), success, failure));
+182 
+183             // unfiling capability
+184             success = createResult(OK, "Unfiling capability: " + cap.isUnfilingSupported());
+185             failure = createResult(FAILURE, "Unfiling capability is not set!");
+186             addResult(assertNotNull(cap.isUnfilingSupported(), success, failure));
+187 
+188             // version specific filing capability
+189             success = createResult(OK, "Version specific filing capability: " + cap.isVersionSpecificFilingSupported());
+190             failure = createResult(FAILURE, "Version specific filing capability is not set!");
+191             addResult(assertNotNull(cap.isVersionSpecificFilingSupported(), success, failure));
+192 
+193             // query capability
+194             success = createResult(OK, "Query capability: " + cap.getQueryCapability());
+195             failure = createResult(FAILURE, "Query capability is not set!");
+196             addResult(assertNotNull(cap.getQueryCapability(), success, failure));
+197 
+198             // JOIN capability
+199             success = createResult(OK, "JOIN capability: " + cap.getJoinCapability());
+200             failure = createResult(FAILURE, "JOIN capability is not set!");
+201             addResult(assertNotNull(cap.getJoinCapability(), success, failure));
+202 
+203             // all versions searchable capability
+204             success = createResult(OK, "All versions searchable capability: " + cap.isAllVersionsSearchableSupported());
+205             failure = createResult(FAILURE, "All versions searchable capability is not set!");
+206             addResult(assertNotNull(cap.isAllVersionsSearchableSupported(), success, failure));
+207 
+208             // PWC searchable capability
+209             success = createResult(OK, "PWC searchable capability: " + cap.isPwcSearchableSupported());
+210             failure = createResult(FAILURE, "PWC searchable capability is not set!");
+211             addResult(assertNotNull(cap.isPwcSearchableSupported(), success, failure));
+212 
+213             // PWC updatable capability
+214             success = createResult(OK, "PWC updatable capability: " + cap.isPwcUpdatableSupported());
+215             failure = createResult(FAILURE, "PWC updatable capability is not set!");
+216             addResult(assertNotNull(cap.isPwcUpdatableSupported(), success, failure));
+217 
+218             // renditions capability
+219             success = createResult(OK, "Renditions capability: " + cap.getRenditionsCapability());
+220             failure = createResult(FAILURE, "Renditions capability is not set!");
+221             addResult(assertNotNull(cap.getRenditionsCapability(), success, failure));
+222         }
+223 
+224         // ACL capabilities
+225         if (ri.getAclCapabilities() == null) {
+226             addResult(createResult(WARNING, "ACL capabilities are not set!"));
+227         } else {
+228             AclCapabilities aclCap = ri.getAclCapabilities();
+229 
+230             // supported permissions
+231             success = createResult(OK, "Supported permissions: " + aclCap.getSupportedPermissions());
+232             failure = createResult(WARNING, "Supported permissions are not set!");
+233             addResult(assertNotNull(aclCap.getSupportedPermissions(), success, failure));
+234 
+235             // ACL propagation
+236             success = createResult(OK, "ACL propagation: " + aclCap.getAclPropagation());
+237             failure = createResult(WARNING, "ACL propagation is not set!");
+238             addResult(assertNotNull(aclCap.getAclPropagation(), success, failure));
+239 
+240             // permissions
+241             success = createResult(OK, "Permissions: "
+242                     + (aclCap.getPermissions() == null ? "?" : aclCap.getPermissions().size()));
+243             failure = createResult(FAILURE, "Permissions are not set!");
+244             addResult(assertNotNull(aclCap.getPermissions(), success, failure));
+245 
+246             if (aclCap.getPermissions() != null) {
+247                 int i = 0;
+248                 for (PermissionDefinition permDef : aclCap.getPermissions()) {
+249                     failure = createResult(FAILURE, "Permission #" + i + " is not set!");
+250                     addResult(assertNotNull(permDef, null, failure));
+251 
+252                     if (permDef != null) {
+253                         failure = createResult(FAILURE, "Id of permission #" + i + " is not set!");
+254                         addResult(assertStringNotEmpty(permDef.getId(), null, failure));
+255                     }
+256 
+257                     i++;
+258                 }
+259             }
+260 
+261             // permission mapping
+262             success = createResult(OK, "Permission mapping: "
+263                     + (aclCap.getPermissionMapping() == null ? "?" : aclCap.getPermissionMapping().size()));
+264             failure = createResult(WARNING, "Permission mapping is not set!");
+265             addResult(assertNotNull(aclCap.getPermissionMapping(), success, failure));
+266         }
+267     }
+268 }
+
+
+ + Added: chemistry/site/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/basics/RootFolderTest.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/basics/RootFolderTest.html?rev=1308698&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/basics/RootFolderTest.html (added) +++ chemistry/site/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/basics/RootFolderTest.html Tue Apr 3 05:27:23 2012 @@ -0,0 +1,107 @@ + + + + +RootFolderTest 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.basics;
+20  
+21  import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.FAILURE;
+22  import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.OK;
+23  import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.WARNING;
+24  
+25  import java.util.Map;
+26  
+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.data.RepositoryInfo;
+30  import org.apache.chemistry.opencmis.commons.enums.Action;
+31  import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
+32  import org.apache.chemistry.opencmis.tck.CmisTestResult;
+33  import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTest;
+34  
+35  /**
+36   * Basic root folder tests.
+37   */
+38  public class RootFolderTest extends AbstractSessionTest {
+39  
+40      @Override
+41      public void init(Map<String, String> parameters) {
+42          super.init(parameters);
+43          setName("Root Folder Test");
+44          setDescription("Checks the root folder and its children for specification compliance.");
+45      }
+46  
+47      @Override
+48      public void run(Session session) throws Exception {
+49          CmisTestResult success;
+50          CmisTestResult failure;
+51  
+52          // check root folder id
+53          RepositoryInfo ri = getRepositoryInfo(session);
+54  
+55          success = createResult(OK, "Root folder id: " + ri.getRootFolderId());
+56          failure = createResult(FAILURE, "Root folder id is not set!");
+57          addResult(assertStringNotEmpty(ri.getRootFolderId(), success, failure));
+58  
+59          // get the root folder
+60          Folder rootFolder = session.getRootFolder(SELECT_ALL_NO_CACHE_OC);
+61  
+62          if (rootFolder == null) {
+63              addResult(createResult(FAILURE, "Root folder is not available!"));
+64              return;
+65          }
+66  
+67          addResult(checkObject(session, rootFolder, getAllProperties(rootFolder), "Root folder object spec compliance"));
+68  
+69          // folder and path
+70          failure = createResult(FAILURE,
+71                  "Root folder id in the repository info doesn't match the root folder object id!");
+72          addResult(assertEquals(ri.getRootFolderId(), rootFolder.getId(), null, failure));
+73  
+74          failure = createResult(FAILURE, "Root folder is not a cmis:folder!");
+75          addResult(assertEquals(BaseTypeId.CMIS_FOLDER, rootFolder.getBaseTypeId(), null, failure));
+76  
+77          failure = createResult(FAILURE, "Root folder path is not '/'!");
+78          addResult(assertEquals("/", rootFolder.getPath(), null, failure));
+79  
+80          failure = createResult(FAILURE, "Root folder has parents!");
+81          addResult(assertEquals(0, rootFolder.getParents().size(), null, failure));
+82  
+83          // allowable actions
+84          failure = createResult(FAILURE, "Root folder has CAN_GET_FOLDER_PARENT allowable action!");
+85          addResult(assertNotAllowableAction(rootFolder, Action.CAN_GET_FOLDER_PARENT, null, failure));
+86  
+87          failure = createResult(WARNING, "Root folder has no CAN_GET_CHILDREN allowable action!");
+88          addResult(assertAllowableAction(rootFolder, Action.CAN_GET_CHILDREN, null, failure));
+89  
+90          // simple children test
+91          addResult(checkChildren(session, rootFolder, "Root folder children check"));
+92      }
+93  }
+
+
+ + Added: chemistry/site/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/basics/SecurityTest.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/basics/SecurityTest.html?rev=1308698&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/basics/SecurityTest.html (added) +++ chemistry/site/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/basics/SecurityTest.html Tue Apr 3 05:27:23 2012 @@ -0,0 +1,87 @@ + + + + +SecurityTest 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.basics;
+20  
+21  import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.WARNING;
+22  
+23  import java.util.Map;
+24  
+25  import org.apache.chemistry.opencmis.client.api.Session;
+26  import org.apache.chemistry.opencmis.commons.SessionParameter;
+27  import org.apache.chemistry.opencmis.commons.enums.BindingType;
+28  import org.apache.chemistry.opencmis.tck.CmisTestResult;
+29  import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTest;
+30  
+31  public class SecurityTest extends AbstractSessionTest {
+32  
+33      @Override
+34      public void init(Map<String, String> parameters) {
+35          super.init(parameters);
+36          setName("Security Test");
+37          setDescription("Checks if HTTPS is used.");
+38      }
+39  
+40      @Override
+41      public void run(Session session) throws Exception {
+42          CmisTestResult f;
+43  
+44          BindingType binding = getBinding();
+45  
+46          addResult(createInfoResult("Binding: " + binding));
+47  
+48          f = createResult(WARNING, "HTTPS is not used. Credentials might be transferred as plain text!");
+49  
+50          switch (binding) {
+51          case ATOMPUB:
+52              if (!isHttpsUrl(getParameters().get(SessionParameter.ATOMPUB_URL))) {
+53                  addResult(f);
+54              }
+55              break;
+56          case WEBSERVICES:
+57              if (!isHttpsUrl(getParameters().get(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE))) {
+58                  addResult(f);
+59              }
+60              break;
+61          default:
+62              // nothing to do
+63          }
+64      }
+65  
+66      private static boolean isHttpsUrl(String url) {
+67          if (url == null) {
+68              return false;
+69          }
+70  
+71          return url.trim().toLowerCase().startsWith("https://");
+72      }
+73  }
+
+
+ + Added: chemistry/site/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/basics/TypesTest.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/basics/TypesTest.html?rev=1308698&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/basics/TypesTest.html (added) +++ chemistry/site/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/basics/TypesTest.html Tue Apr 3 05:27:23 2012 @@ -0,0 +1,217 @@ + + + + +TypesTest 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.basics;
+20  
+21  import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.FAILURE;
+22  import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.WARNING;
+23  
+24  import java.util.HashMap;
+25  import java.util.List;
+26  import java.util.Map;
+27  
+28  import org.apache.chemistry.opencmis.client.api.ItemIterable;
+29  import org.apache.chemistry.opencmis.client.api.ObjectType;
+30  import org.apache.chemistry.opencmis.client.api.Session;
+31  import org.apache.chemistry.opencmis.client.api.Tree;
+32  import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
+33  import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
+34  import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
+35  import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
+36  import org.apache.chemistry.opencmis.tck.CmisTestResult;
+37  import org.apache.chemistry.opencmis.tck.impl.AbstractSessionTest;
+38  
+39  /**
+40   * Types test.
+41   */
+42  public class TypesTest extends AbstractSessionTest {
+43      @Override
+44      public void init(Map<String, String> parameters) {
+45          super.init(parameters);
+46          setName("Types Test");
+47          setDescription("Checks all types exposed by the repository for specification compliance.");
+48      }
+49  
+50      @Override
+51      public void run(Session session) {
+52          CmisTestResult failure;
+53  
+54          // document
+55          try {
+56              TypeDefinition documentType = session.getTypeDefinition(BaseTypeId.CMIS_DOCUMENT.value());
+57              addResult(checkTypeDefinition(session, documentType, "Document type spec compliance."));
+58  
+59              failure = createResult(FAILURE, "Document type has the wrong base type: " + documentType.getBaseTypeId());
+60              addResult(assertEquals(BaseTypeId.CMIS_DOCUMENT, documentType.getBaseTypeId(), null, failure));
+61          } catch (CmisObjectNotFoundException e) {
+62              addResult(createResult(FAILURE, "Document type not available!", e, false));
+63          }
+64  
+65          // folder
+66          try {
+67              TypeDefinition folderType = session.getTypeDefinition(BaseTypeId.CMIS_FOLDER.value());
+68  
+69              addResult(checkTypeDefinition(session, folderType, "Folder type spec compliance."));
+70  
+71              failure = createResult(FAILURE, "Folder type has the wrong base type: " + folderType.getBaseTypeId());
+72              addResult(assertEquals(BaseTypeId.CMIS_FOLDER, folderType.getBaseTypeId(), null, failure));
+73          } catch (CmisObjectNotFoundException e) {
+74              addResult(createResult(FAILURE, "Folder type not available!", e, false));
+75          }
+76  
+77          // relationship
+78          try {
+79              TypeDefinition relationshipType = session.getTypeDefinition(BaseTypeId.CMIS_RELATIONSHIP.value());
+80              addResult(checkTypeDefinition(session, relationshipType, "Relationship type spec compliance."));
+81  
+82              failure = createResult(FAILURE,
+83                      "Relationship type has the wrong base type: " + relationshipType.getBaseTypeId());
+84              addResult(assertEquals(BaseTypeId.CMIS_RELATIONSHIP, relationshipType.getBaseTypeId(), null, failure));
+85          } catch (CmisObjectNotFoundException e) {
+86              addResult(createResult(WARNING, "Relationship type not available!", e, false));
+87          }
+88  
+89          // policy
+90          try {
+91              TypeDefinition policyType = session.getTypeDefinition(BaseTypeId.CMIS_POLICY.value());
+92              addResult(checkTypeDefinition(session, policyType, "Policy type spec compliance."));
+93  
+94              failure = createResult(FAILURE, "Policy type has the wrong base type: " + policyType.getBaseTypeId());
+95              addResult(assertEquals(BaseTypeId.CMIS_POLICY, policyType.getBaseTypeId(), null, failure));
+96          } catch (CmisInvalidArgumentException e) {
+97              addResult(createResult(WARNING, "Policy type not available!", e, false));
+98          } catch (CmisObjectNotFoundException e) {
+99              addResult(createResult(WARNING, "Policy type not available!", e, false));
+100         }
+101 
+102         int numOfTypes = runTypeChecks(session, session.getTypeDescendants(null, -1, true));
+103 
+104         addResult(createInfoResult("Checked " + numOfTypes + " type definitions."));
+105     }
+106 
+107     private int runTypeChecks(Session session, List<Tree<ObjectType>> types) {
+108         if (types == null) {
+109             return 0;
+110         }
+111 
+112         int numOfTypes = 0;
+113         CmisTestResult failure;
+114 
+115         for (Tree<ObjectType> tree : types) {
+116             failure = createResult(FAILURE, "Types tree contains null leaf!");
+117             addResult(assertNotNull(tree, null, failure));
+118 
+119             if (tree != null) {
+120                 numOfTypes++;
+121 
+122                 addResult(checkTypeDefinition(session, tree.getItem(), "Type spec compliance: "
+123                         + tree.getItem().getId()));
+124 
+125                 // clear the cache to ensure that the type definition is
+126                 // reloaded from the repository
+127                 session.clear();
+128 
+129                 try {
+130                     TypeDefinition reloadedType = session.getTypeDefinition(tree.getItem().getId());
+131 
+132                     addResult(checkTypeDefinition(session, reloadedType, "Type spec compliance: "
+133                             + (reloadedType == null ? "?" : reloadedType.getId())));
+134 
+135                     failure = createResult(FAILURE,
+136                             "Type fetched via getTypeDescendants() is does not macth type fetched via getTypeDefinition(): "
+137                                     + tree.getItem().getId());
+138                     addResult(assertEquals(tree.getItem(), reloadedType, null, failure));
+139                 } catch (CmisObjectNotFoundException e) {
+140                     addResult(createResult(FAILURE,
+141                             "Type fetched via getTypeDescendants() is not available via getTypeDefinition(): "
+142                                     + tree.getItem().getId(), e, false));
+143                 }
+144 
+145                 // clear the cache again to ensure that the type definition
+146                 // children are reloaded from the repository
+147                 session.clear();
+148 
+149                 try {
+150                     ItemIterable<ObjectType> reloadedTypeChildren = session.getTypeChildren(tree.getItem().getId(),
+151                             true);
+152 
+153                     // check type children
+154                     Map<String, ObjectType> typeChilden = new HashMap<String, ObjectType>();
+155                     for (ObjectType childType : reloadedTypeChildren) {
+156                         addResult(checkTypeDefinition(session, childType, "Type spec compliance: "
+157                                 + (childType == null ? "?" : childType.getId())));
+158 
+159                         if (childType != null) {
+160                             typeChilden.put(childType.getId(), childType);
+161                         }
+162                     }
+163 
+164                     // compare type children and type descendants
+165                     if (tree.getChildren() == null) {
+166                         failure = createResult(FAILURE,
+167                                 "Type children fetched via getTypeDescendants() don't match type children fetched via getTypeChildren(): "
+168                                         + tree.getItem().getId());
+169                         addResult(assertEquals(0, typeChilden.size(), null, failure));
+170                     } else {
+171                         // collect the children
+172                         Map<String, ObjectType> typeDescendants = new HashMap<String, ObjectType>();
+173                         for (Tree<ObjectType> childType : tree.getChildren()) {
+174                             if ((childType != null) && (childType.getItem() != null)) {
+175                                 typeDescendants.put(childType.getItem().getId(), childType.getItem());
+176                             }
+177                         }
+178 
+179                         failure = createResult(FAILURE,
+180                                 "Type children fetched via getTypeDescendants() don't match type children fetched via getTypeChildren(): "
+181                                         + tree.getItem().getId());
+182                         addResult(assertEquals(typeDescendants.size(), typeChilden.size(), null, failure));
+183 
+184                         for (ObjectType compareType : typeDescendants.values()) {
+185                             failure = createResult(FAILURE,
+186                                     "Type fetched via getTypeDescendants() doesn't match type fetched via getTypeChildren(): "
+187                                             + tree.getItem().getId());
+188                             addResult(assertEquals(compareType, typeChilden.get(compareType.getId()), null, failure));
+189                         }
+190                     }
+191                 } catch (CmisObjectNotFoundException e) {
+192                     addResult(createResult(FAILURE,
+193                             "Type children fetched via getTypeDescendants() is not available via getTypeChildren(): "
+194                                     + tree.getItem().getId(), e, false));
+195                 }
+196 
+197                 numOfTypes += runTypeChecks(session, tree.getChildren());
+198             }
+199         }
+200 
+201         return numOfTypes;
+202     }
+203 }
+
+
+ + Added: chemistry/site/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/basics/package-frame.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/basics/package-frame.html?rev=1308698&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/basics/package-frame.html (added) +++ chemistry/site/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/basics/package-frame.html Tue Apr 3 05:27:23 2012 @@ -0,0 +1,36 @@ + + + + + + OpenCMIS Test Compatibility Kit 0.7.0 Reference Package org.apache.chemistry.opencmis.tck.tests.basics + + + + +

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

+ +

Classes

+ + + + + \ No newline at end of file Added: chemistry/site/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/basics/package-summary.html URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/basics/package-summary.html?rev=1308698&view=auto ============================================================================== --- chemistry/site/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/basics/package-summary.html (added) +++ chemistry/site/trunk/content/java/0.7.0/maven/chemistry-opencmis-test/chemistry-opencmis-test-tck/xref/org/apache/chemistry/opencmis/tck/tests/basics/package-summary.html Tue Apr 3 05:27:23 2012 @@ -0,0 +1,87 @@ + + + + + + OpenCMIS Test Compatibility Kit 0.7.0 Reference Package org.apache.chemistry.opencmis.tck.tests.basics + + + +
+ +
+
+ +
+ +

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

+ + + + + + + + + + + + + + + + + + + + + + + + +
Class Summary
+ BasicsTestGroup +
+ RepositoryInfoTest +
+ RootFolderTest +
+ SecurityTest +
+ TypesTest +
+ +
+ +
+
+ +
+
+ Copyright © 2009-2012 The Apache Software Foundation. All Rights Reserved. + + \ No newline at end of file