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/02/16 17:04:07 UTC
svn commit: r910572 [11/36] - in /incubator/chemistry/trunk/opencmis: ./
_dev/ opencmis-client/ opencmis-client/opencmis-client-api/
opencmis-client/opencmis-client-api/src/
opencmis-client/opencmis-client-api/src/main/
opencmis-client/opencmis-client-...
Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/AbstractSimpleReadOnlyTests.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/AbstractSimpleReadOnlyTests.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/AbstractSimpleReadOnlyTests.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/AbstractSimpleReadOnlyTests.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,518 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.client.provider.framework;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.opencmis.commons.PropertyIds;
+import org.apache.opencmis.commons.api.DocumentTypeDefinition;
+import org.apache.opencmis.commons.api.FolderTypeDefinition;
+import org.apache.opencmis.commons.api.PolicyTypeDefinition;
+import org.apache.opencmis.commons.api.RelationshipTypeDefinition;
+import org.apache.opencmis.commons.api.TypeDefinition;
+import org.apache.opencmis.commons.api.TypeDefinitionContainer;
+import org.apache.opencmis.commons.api.TypeDefinitionList;
+import org.apache.opencmis.commons.enums.BaseObjectTypeIds;
+import org.apache.opencmis.commons.enums.IncludeRelationships;
+import org.apache.opencmis.commons.enums.RelationshipDirection;
+import org.apache.opencmis.commons.provider.AccessControlList;
+import org.apache.opencmis.commons.provider.AllowableActionsData;
+import org.apache.opencmis.commons.provider.ContentStreamData;
+import org.apache.opencmis.commons.provider.ObjectData;
+import org.apache.opencmis.commons.provider.ObjectInFolderContainer;
+import org.apache.opencmis.commons.provider.ObjectInFolderData;
+import org.apache.opencmis.commons.provider.ObjectInFolderList;
+import org.apache.opencmis.commons.provider.ObjectList;
+import org.apache.opencmis.commons.provider.PropertiesData;
+import org.apache.opencmis.commons.provider.RenditionData;
+import org.apache.opencmis.commons.provider.RepositoryInfoData;
+
+/**
+ * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
+ *
+ */
+public abstract class AbstractSimpleReadOnlyTests extends AbstractCmisTestCase {
+
+ public static final String TEST_REPOSITORY_INFO = "repositoryInfo";
+ public static final String TEST_TYPES = "types";
+ public static final String TEST_CONTENT_STREAM = "contentStream";
+ public static final String TEST_NAVIGATION = "navigation";
+ public static final String TEST_QUERY = "query";
+ public static final String TEST_CHECKEDOUT = "checkedout";
+ public static final String TEST_CONTENT_CHANGES = "contentChanges";
+
+ /**
+ * Tests repository info.
+ */
+ public void testRepositoryInfo() throws Exception {
+ if (!isEnabled(TEST_REPOSITORY_INFO)) {
+ return;
+ }
+
+ RepositoryInfoData repInfo = getRepositoryInfo();
+
+ Tools.print(repInfo);
+
+ assertNotNull(repInfo.getRepositoryId());
+ assertNotNull(repInfo.getCmisVersionSupported());
+ assertNotNull(repInfo.getRootFolderId());
+ assertNotNull(repInfo.getRepositoryCapabilities());
+ }
+
+ /**
+ * Some type related tests.
+ */
+ public void testTypes() throws Exception {
+ if (!isEnabled(TEST_TYPES)) {
+ return;
+ }
+
+ String repId = getTestRepositoryId();
+
+ // get standard type
+ TypeDefinition docType = getTypeDefinition("cmis:document");
+ assertTrue(docType instanceof DocumentTypeDefinition);
+ assertEquals("cmis:document", docType.getId());
+ assertEquals(BaseObjectTypeIds.CMIS_DOCUMENT, docType.getBaseId());
+
+ TypeDefinition folderType = getTypeDefinition("cmis:folder");
+ assertTrue(folderType instanceof FolderTypeDefinition);
+ assertEquals("cmis:folder", folderType.getId());
+ assertEquals(BaseObjectTypeIds.CMIS_FOLDER, folderType.getBaseId());
+
+ try {
+ TypeDefinition relationshipType = getTypeDefinition("cmis:relationship");
+ assertTrue(relationshipType instanceof RelationshipTypeDefinition);
+ assertEquals("cmis:relationship", relationshipType.getId());
+ assertEquals(BaseObjectTypeIds.CMIS_RELATIONSHIP, relationshipType.getBaseId());
+ }
+ catch (Exception e) {
+ warning("Relationships type: " + e);
+ }
+
+ try {
+ TypeDefinition policyType = getTypeDefinition("cmis:policy");
+ assertTrue(policyType instanceof PolicyTypeDefinition);
+ assertEquals("cmis:policy", policyType.getId());
+ assertEquals(BaseObjectTypeIds.CMIS_POLICY, policyType.getBaseId());
+ }
+ catch (Exception e) {
+ warning("Policy type: " + e);
+ }
+
+ // getTypeChildren
+ TypeDefinitionList types = getProvider().getRepositoryService().getTypeChildren(repId, null,
+ Boolean.TRUE, null, null, null);
+ assertNotNull(types);
+ assertNotNull(types.hasMoreItems());
+ assertNotNull(types.getList());
+ assertFalse(types.getList().isEmpty());
+
+ getProvider().clearAllCaches();
+
+ for (TypeDefinition type : types.getList()) {
+ TypeDefinition type2 = getTypeDefinition(type.getId());
+ assertEquals(type, type2, true);
+ }
+
+ // getTypeDescendants
+ List<TypeDefinitionContainer> typesContainers = getProvider().getRepositoryService()
+ .getTypeDescendants(repId, null, null, Boolean.TRUE, null);
+ assertNotNull(typesContainers);
+ assertFalse(typesContainers.isEmpty());
+
+ for (TypeDefinitionContainer typeContainer : typesContainers) {
+ assertNotNull(typeContainer.getTypeDefinition());
+ assertNotNull(typeContainer.getTypeDefinition().getId());
+ TypeDefinition type2 = getTypeDefinition(typeContainer.getTypeDefinition().getId());
+ assertEquals(typeContainer.getTypeDefinition(), type2, true);
+ }
+
+ Tools.printTypes("Type Descendants", typesContainers);
+
+ getProvider().clearAllCaches();
+
+ assertTypeContainers(repId, typesContainers);
+ }
+
+ private void assertTypeContainers(String repId, List<TypeDefinitionContainer> typesContainers) {
+ if (typesContainers == null) {
+ return;
+ }
+
+ for (TypeDefinitionContainer container : typesContainers) {
+ assertNotNull(container.getTypeDefinition());
+
+ TypeDefinition type = container.getTypeDefinition();
+ TypeDefinition type2 = getTypeDefinition(type.getId());
+
+ assertEquals(type, type2, true);
+
+ assertTypeContainers(repId, container.getChildren());
+ }
+ }
+
+ /**
+ * Navigation smoke test.
+ */
+ public void testNavigation() throws Exception {
+ if (!isEnabled(TEST_NAVIGATION)) {
+ return;
+ }
+
+ String repId = getTestRepositoryId();
+ String rootFolder = getTestRootFolder();
+
+ ObjectData folderObject = getObject(rootFolder);
+ String path = getPath(folderObject);
+ assertEquals("/", path);
+
+ ObjectInFolderList children = getProvider().getNavigationService().getChildren(repId,
+ rootFolder, "*", null, Boolean.TRUE, IncludeRelationships.BOTH, null, Boolean.TRUE, null,
+ null, null);
+ assertNotNull(children);
+ assertNotNull(children.hasMoreItems());
+
+ if (supportsDescendants()) {
+ List<ObjectInFolderContainer> desc = getProvider().getNavigationService().getDescendants(
+ repId, rootFolder, BigInteger.valueOf(5), null, Boolean.TRUE, IncludeRelationships.BOTH,
+ null, Boolean.TRUE, null);
+ assertNotNull(desc);
+ Tools.print("Descendants", desc);
+ }
+ else {
+ warning("Descendants not supported!");
+ }
+
+ if (supportsFolderTree()) {
+ List<ObjectInFolderContainer> tree = getProvider().getNavigationService().getFolderTree(
+ repId, rootFolder, BigInteger.valueOf(5), null, Boolean.TRUE, IncludeRelationships.BOTH,
+ null, Boolean.TRUE, null);
+ assertNotNull(tree);
+ Tools.print("Tree", tree);
+ }
+ else {
+ warning("Folder Tree not supported!");
+ }
+
+ for (ObjectInFolderData object : children.getObjects()) {
+ assertNotNull(object.getObject());
+ assertNotNull(object.getObject().getId());
+ assertNotNull(object.getObject().getBaseTypeId());
+
+ ObjectData object2 = getObject(object.getObject().getId());
+ assertNotNull(object2.getId());
+ assertEquals(object.getObject().getId(), object2.getId());
+ assertEquals(object.getObject().getProperties(), object2.getProperties());
+
+ ObjectData object3 = getObjectByPath((path.equals("/") ? "/" : path + "/")
+ + object.getPathSegment());
+ assertNotNull(object3);
+ assertNotNull(object3.getId());
+ assertEquals(object.getObject().getId(), object3.getId());
+ assertEquals(object.getObject().getProperties(), object3.getProperties());
+
+ checkObject(object.getObject().getId());
+
+ if (object.getObject().getBaseTypeId() == BaseObjectTypeIds.CMIS_FOLDER) {
+ ObjectInFolderList children2 = getProvider().getNavigationService().getChildren(repId,
+ object.getObject().getId(), null, null, Boolean.TRUE, IncludeRelationships.BOTH, null,
+ Boolean.TRUE, null, null, null);
+ assertNotNull(children2);
+ }
+ else if (object.getObject().getBaseTypeId() == BaseObjectTypeIds.CMIS_DOCUMENT) {
+ checkObjectVersions(object.getObject().getId());
+ }
+ }
+ }
+
+ /**
+ * Content stream smoke test.
+ */
+ public void testContentStream() throws Exception {
+ if (!isEnabled(TEST_CONTENT_STREAM)) {
+ return;
+ }
+
+ String repId = getTestRepositoryId();
+ String rootFolder = getTestRootFolder();
+
+ ObjectInFolderList children = getProvider().getNavigationService().getChildren(repId,
+ rootFolder, null, null, Boolean.FALSE, IncludeRelationships.BOTH, null, Boolean.FALSE,
+ null, null, null);
+
+ for (ObjectInFolderData object : children.getObjects()) {
+ assertNotNull(object.getObject().getId());
+ assertNotNull(object.getObject().getBaseTypeId());
+
+ if (object.getObject().getBaseTypeId() == BaseObjectTypeIds.CMIS_DOCUMENT) {
+ ContentStreamData contentStream = getContent(object.getObject().getId(), null);
+ readContent(contentStream);
+
+ return;
+ }
+ }
+
+ fail("No document in test folder!");
+ }
+
+ /**
+ * Query smoke test.
+ */
+ public void testQuery() throws Exception {
+ if (!isEnabled(TEST_QUERY)) {
+ return;
+ }
+
+ if (supportsQuery()) {
+ String repId = getTestRepositoryId();
+
+ ObjectList rs = getProvider().getDiscoveryService().query(repId,
+ "SELECT * FROM cmis:document", null, null, null, null, null, null, null);
+ assertNotNull(rs);
+
+ if (rs.getObjects() != null) {
+ for (ObjectData object : rs.getObjects()) {
+ assertNotNull(object);
+ assertNotNull(object.getProperties());
+ assertNotNull(object.getProperties().getProperties());
+ }
+ }
+
+ }
+ else {
+ warning("Query not supported!");
+ }
+ }
+
+ /**
+ * Checked out smoke test.
+ */
+ public void testCheckedout() throws Exception {
+ if (!isEnabled(TEST_CHECKEDOUT)) {
+ return;
+ }
+
+ String repId = getTestRepositoryId();
+
+ ObjectList co = getProvider().getNavigationService().getCheckedOutDocs(repId,
+ getTestRootFolder(), null, null, Boolean.TRUE, IncludeRelationships.BOTH, null,
+ BigInteger.valueOf(100), null, null);
+ assertNotNull(co);
+
+ if (co.getObjects() != null) {
+ assertTrue(co.getObjects().size() <= 100);
+
+ for (ObjectData object : co.getObjects()) {
+ assertNotNull(object);
+ assertNotNull(object.getId());
+ assertEquals(BaseObjectTypeIds.CMIS_DOCUMENT, object.getBaseTypeId());
+ }
+ }
+ }
+
+ /**
+ * Content changes smoke test.
+ */
+ public void testContentChanges() throws Exception {
+ if (!isEnabled(TEST_CONTENT_CHANGES)) {
+ return;
+ }
+
+ if (supportsContentChanges()) {
+ String repId = getTestRepositoryId();
+
+ ObjectList cc = getProvider().getDiscoveryService().getContentChanges(repId, null,
+ Boolean.TRUE, "*", Boolean.TRUE, Boolean.TRUE, BigInteger.valueOf(100), null);
+ assertNotNull(cc);
+
+ if (cc.getObjects() != null) {
+ assertTrue(cc.getObjects().size() <= 100);
+
+ for (ObjectData object : cc.getObjects()) {
+ assertNotNull(object);
+ assertNotNull(object.getId());
+ assertNotNull(object.getChangeEventInfo());
+ assertNotNull(object.getChangeEventInfo().getChangeType());
+ assertNotNull(object.getChangeEventInfo().getChangeTime());
+ }
+ }
+ }
+ else {
+ warning("Content changes not supported!");
+ }
+ }
+
+ /**
+ * Tests some of the read-only methods of the Object Service.
+ */
+ private void checkObject(String objectId) throws Exception {
+ System.out.println("Checking object " + objectId + "...");
+
+ ObjectData object = getObject(objectId);
+
+ // check properties
+ PropertiesData properties = getProvider().getObjectService().getProperties(
+ getTestRepositoryId(), objectId, "*", null);
+
+ assertEquals(object.getProperties(), properties);
+
+ // check allowable actions
+ AllowableActionsData allowableActions = getProvider().getObjectService().getAllowableActions(
+ getTestRepositoryId(), objectId, null);
+
+ assertEquals(object.getAllowableActions(), allowableActions);
+
+ // check ACLS
+ if (supportsDiscoverACLs()) {
+ AccessControlList acl = getProvider().getAclService().getAcl(getTestRepositoryId(), objectId,
+ Boolean.FALSE, null);
+
+ assertEquals(object.getAcl(), acl);
+ }
+ else {
+ warning("ACLs not supported!");
+ }
+
+ // check policies
+ if (supportsPolicies()) {
+ List<ObjectData> policies = getProvider().getPolicyService().getAppliedPolicies(
+ getTestRepositoryId(), objectId, null, null);
+
+ if (policies == null) {
+ assertNull(object.getPolicyIds().getPolicyIds());
+ }
+ else {
+ assertNotNull(object.getPolicyIds().getPolicyIds());
+
+ List<String> policyIds = new ArrayList<String>();
+
+ for (ObjectData policy : policies) {
+ assertNotNull(policy);
+ assertNotNull(policy.getId());
+
+ policyIds.add(policy.getId());
+ }
+
+ assertEqualLists(object.getPolicyIds().getPolicyIds(), policyIds);
+ }
+ }
+ else {
+ warning("Policies not supported!");
+ }
+
+ // check renditions
+ if (supportsRenditions()) {
+ List<RenditionData> renditions = getProvider().getObjectService().getRenditions(
+ getTestRepositoryId(), objectId, null, null, null, null);
+
+ assertEqualLists(object.getRenditions(), renditions);
+ }
+ else {
+ warning("Renditions not supported!");
+ }
+
+ // check relationships
+ if (supportsRelationships()) {
+ ObjectList relationships = getProvider().getRelationshipService().getObjectRelationships(
+ getTestRepositoryId(), objectId, Boolean.TRUE, RelationshipDirection.EITHER, null, "*",
+ Boolean.TRUE, null, null, null);
+ assertNotNull(relationships);
+
+ if ((object.getRelationships() != null) && (relationships.getObjects() != null)) {
+ assertEquals(object.getRelationships().size(), relationships.getObjects().size());
+ for (ObjectData rel1 : relationships.getObjects()) {
+ assertBasicProperties(rel1.getProperties());
+ boolean found = false;
+
+ for (ObjectData rel2 : object.getRelationships()) {
+ if (rel2.getId().equals(rel1.getId())) {
+ found = true;
+ assertEquals(rel2.getProperties(), rel1.getProperties());
+ break;
+ }
+ }
+
+ assertTrue(found);
+ }
+ }
+ }
+ else {
+ warning("Relationships not supported!");
+ }
+ }
+
+ /**
+ * Tests some of the read-only methods of the Versioning Service.
+ */
+ private void checkObjectVersions(String objectId) throws Exception {
+ System.out.println("Checking versions of object " + objectId + "...");
+
+ String versionSeriesId = getVersionSeriesId(objectId);
+ assertNotNull(versionSeriesId);
+
+ // check latest version
+ ObjectData latestVersionObject = getProvider().getVersioningService().getObjectOfLatestVersion(
+ getTestRepositoryId(), versionSeriesId, Boolean.FALSE, "*", Boolean.TRUE,
+ IncludeRelationships.BOTH, null, Boolean.TRUE, Boolean.TRUE, null);
+ assertNotNull(latestVersionObject);
+
+ PropertiesData latestVersionProperties = getProvider().getVersioningService()
+ .getPropertiesOfLatestVersion(getTestRepositoryId(), versionSeriesId, Boolean.FALSE, "*",
+ null);
+ assertNotNull(latestVersionProperties);
+
+ assertEquals(latestVersionObject.getProperties(), latestVersionProperties);
+
+ String typeName = (String) latestVersionObject.getProperties().getProperties().get(
+ PropertyIds.CMIS_BASE_TYPE_ID).getFirstValue();
+ if (isVersionable(typeName)) {
+ List<ObjectData> allVersions = getProvider().getVersioningService().getAllVersions(
+ getTestRepositoryId(), versionSeriesId, "*", Boolean.FALSE, null);
+ assertNotNull(allVersions);
+ assertTrue(allVersions.size() > 0);
+
+ boolean foundObject = false;
+ boolean foundLatestObject = false;
+ for (ObjectData object : allVersions) {
+ assertNotNull(object);
+ assertNotNull(object.getId());
+
+ if (objectId.equals(object.getId())) {
+ foundObject = true;
+ }
+
+ if (latestVersionObject.getId().equals(object.getId())) {
+ foundLatestObject = true;
+ assertEquals(latestVersionObject.getProperties(), object.getProperties());
+ }
+ }
+
+ if (!foundObject) {
+ fail("Object " + objectId + " not found in it's version history!");
+ }
+
+ if (!foundLatestObject) {
+ fail("Object " + latestVersionObject.getId() + " not found in it's version history!");
+ }
+ }
+ }
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/AbstractSimpleReadOnlyTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/AbstractSimpleReadWriteTests.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/AbstractSimpleReadWriteTests.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/AbstractSimpleReadWriteTests.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/AbstractSimpleReadWriteTests.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,409 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.client.provider.framework;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.opencmis.commons.PropertyIds;
+import org.apache.opencmis.commons.enums.AclPropagation;
+import org.apache.opencmis.commons.enums.CapabilityContentStreamUpdates;
+import org.apache.opencmis.commons.enums.UnfileObjects;
+import org.apache.opencmis.commons.enums.VersioningState;
+import org.apache.opencmis.commons.provider.AccessControlEntry;
+import org.apache.opencmis.commons.provider.AccessControlList;
+import org.apache.opencmis.commons.provider.ContentStreamData;
+import org.apache.opencmis.commons.provider.Holder;
+import org.apache.opencmis.commons.provider.ObjectData;
+import org.apache.opencmis.commons.provider.PropertiesData;
+import org.apache.opencmis.commons.provider.PropertyData;
+
+/**
+ * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
+ *
+ */
+public abstract class AbstractSimpleReadWriteTests extends AbstractCmisTestCase {
+
+ public static final String TEST_CREATE_FOLDER = "createFolder";
+ public static final String TEST_CREATE_DOCUMENT = "createDocument";
+ public static final String TEST_CREATE_FROM_SOURCE = "createDocumentFromSource";
+ public static final String TEST_SET_AND_DELETE_CONTENT = "setAndDeleteContent";
+ public static final String TEST_UPDATE_PROPERTIES = "updateProperties";
+ public static final String TEST_DELETE_TREE = "deleteTree";
+ public static final String TEST_MOVE_OBJECT = "moveObject";
+ public static final String TEST_VERSIONING = "versioning";
+
+ private static final byte[] CONTENT = "My document test content!".getBytes();
+ private static final byte[] CONTENT2 = "Another test content!".getBytes();
+ private static final String CONTENT_TYPE = "text/plain";
+
+ /**
+ * Tests folder creation.
+ */
+ public void testCreateFolder() throws Exception {
+ if (!isEnabled(TEST_CREATE_FOLDER)) {
+ return;
+ }
+
+ // create folder
+ List<PropertyData<?>> propList = new ArrayList<PropertyData<?>>();
+ propList.add(getObjectFactory().createPropertyStringData(PropertyIds.CMIS_NAME, "testfolder"));
+ propList.add(getObjectFactory().createPropertyIdData(PropertyIds.CMIS_OBJECT_TYPE_ID,
+ getDefaultFolderType()));
+
+ PropertiesData properties = getObjectFactory().createPropertiesData(propList);
+
+ String folderId = createFolder(properties, getTestRootFolder(), null, null, null);
+
+ // delete folder
+ delete(folderId, true);
+ }
+
+ /**
+ * Tests document creation.
+ */
+ public void testCreateDocument() throws Exception {
+ if (!isEnabled(TEST_CREATE_DOCUMENT)) {
+ return;
+ }
+
+ VersioningState vs = (isVersionable(getDefaultDocumentType()) ? VersioningState.MAJOR
+ : VersioningState.NONE);
+
+ // create document
+ List<PropertyData<?>> propList = new ArrayList<PropertyData<?>>();
+ propList.add(getObjectFactory().createPropertyStringData(PropertyIds.CMIS_NAME, "testdoc.txt"));
+ propList.add(getObjectFactory().createPropertyIdData(PropertyIds.CMIS_OBJECT_TYPE_ID,
+ getDefaultDocumentType()));
+
+ PropertiesData properties = getObjectFactory().createPropertiesData(propList);
+
+ ContentStreamData contentStream = createContentStreamData(CONTENT_TYPE, CONTENT);
+
+ String docId = createDocument(properties, getTestRootFolder(), contentStream, vs, null, null,
+ null);
+
+ // read and assert content
+ ContentStreamData contentStream2 = getContent(docId, null);
+ assertEquals(CONTENT_TYPE, contentStream2.getMimeType());
+ if (contentStream2.getLength() != null) {
+ assertEquals(CONTENT.length, contentStream2.getLength().intValue());
+ }
+
+ byte[] content = readContent(contentStream2);
+ assertContent(CONTENT, content);
+
+ // apply an ACL
+ if (supportsManageACLs()) {
+ AccessControlEntry ace = getObjectFactory().createAccessControlEntry(getUsername(),
+ Collections.singletonList("cmis:read"));
+ AccessControlList acl = getObjectFactory().createAccessControlList(
+ Collections.singletonList(ace));
+
+ AccessControlList newAcl = getProvider().getAclService().applyAcl(getTestRepositoryId(),
+ docId, acl, null, AclPropagation.REPOSITORYDETERMINED, null);
+ assertNotNull(newAcl);
+
+ AccessControlList readAcl = getProvider().getAclService().getAcl(getTestRepositoryId(),
+ docId, Boolean.FALSE, null);
+ assertNotNull(readAcl);
+
+ assertEquals(newAcl, readAcl);
+ }
+ else {
+ warning("ACLs management not supported!");
+ }
+
+ // delete document
+ delete(docId, true);
+ }
+
+ /**
+ * Tests document creation from source.
+ */
+ public void testCreateDocumentFromSource() throws Exception {
+ if (!isEnabled(TEST_CREATE_FROM_SOURCE)) {
+ return;
+ }
+
+ VersioningState vs = (isVersionable(getDefaultDocumentType()) ? VersioningState.MAJOR
+ : VersioningState.NONE);
+
+ String docId = createDefaultDocument(getTestRootFolder(), "testdoc.org.txt", CONTENT_TYPE,
+ CONTENT);
+
+ // create a copy
+ List<PropertyData<?>> propList2 = new ArrayList<PropertyData<?>>();
+ propList2.add(getObjectFactory().createPropertyStringData(PropertyIds.CMIS_NAME,
+ "testdoc.copy.txt"));
+
+ PropertiesData properties2 = getObjectFactory().createPropertiesData(propList2);
+
+ String docId2 = createDocumentFromSource(docId, properties2, getTestRootFolder(), vs, null,
+ null, null);
+
+ // get objects
+ getObject(docId);
+ getObject(docId2);
+
+ // read and assert content
+ ContentStreamData contentStream2 = getContent(docId, null);
+ ContentStreamData contentStream3 = getContent(docId2, null);
+
+ assertEquals(contentStream2.getMimeType(), contentStream3.getMimeType());
+ assertEquals(contentStream2.getLength(), contentStream3.getLength());
+
+ byte[] content2 = readContent(contentStream2);
+ byte[] content3 = readContent(contentStream3);
+ assertContent(content2, content3);
+
+ // delete documents
+ delete(docId, true);
+ delete(docId2, true);
+ }
+
+ /**
+ * Tests property updates.
+ */
+ public void testSetAndDeleteContent() throws Exception {
+ if (!isEnabled(TEST_SET_AND_DELETE_CONTENT)) {
+ return;
+ }
+
+ boolean requiresCheckOut = getRepositoryInfo().getRepositoryCapabilities()
+ .getCapabilityContentStreamUpdatability() == CapabilityContentStreamUpdates.PWCONLY;
+
+ String docId = createDefaultDocument(getTestRootFolder(), "testcontent.txt", CONTENT_TYPE,
+ CONTENT);
+
+ // if a check out is required, do it
+ if (requiresCheckOut) {
+ getProvider().getVersioningService().checkOut(getTestRepositoryId(),
+ new Holder<String>(docId), null, null);
+ }
+
+ // delete content
+ Holder<String> docIdHolder = new Holder<String>(docId);
+ getProvider().getObjectService().deleteContentStream(getTestRepositoryId(), docIdHolder, null,
+ null);
+
+ // set content
+ ContentStreamData contentStream2 = createContentStreamData(CONTENT_TYPE, CONTENT2);
+
+ docIdHolder = new Holder<String>(docId);
+ getProvider().getObjectService().setContentStream(getTestRepositoryId(), docIdHolder, true,
+ null, contentStream2, null);
+
+ // read and assert content
+ if (docIdHolder.getValue() != null) {
+ docId = docIdHolder.getValue();
+ }
+ ContentStreamData contentStream3 = getContent(docId, null);
+ assertEquals(CONTENT_TYPE, contentStream3.getMimeType());
+ if (contentStream3.getLength() != null) {
+ assertEquals(CONTENT2.length, contentStream3.getLength().intValue());
+ }
+
+ byte[] content = readContent(contentStream3);
+ assertContent(CONTENT2, content);
+
+ // if it has been checked out, cancel that
+ if (requiresCheckOut) {
+ getProvider().getVersioningService().cancelCheckOut(getTestRepositoryId(), docId, null);
+ }
+
+ // delete document
+ delete(docId, true);
+ }
+
+ /**
+ * Tests property updates.
+ */
+ public void testUpdateProperties() throws Exception {
+ if (!isEnabled(TEST_UPDATE_PROPERTIES)) {
+ return;
+ }
+
+ String name1 = "updateTest1.txt";
+ String name2 = "updateTest2.txt";
+
+ // create document
+ String docId = createDefaultDocument(getTestRootFolder(), name1, CONTENT_TYPE, CONTENT);
+
+ // update
+ List<PropertyData<?>> updatePropList = new ArrayList<PropertyData<?>>();
+ updatePropList.add(getObjectFactory().createPropertyStringData(PropertyIds.CMIS_NAME, name2));
+
+ PropertiesData updateProperties = getObjectFactory().createPropertiesData(updatePropList);
+
+ Holder<String> docIdHolder = new Holder<String>(docId);
+ getProvider().getObjectService().updateProperties(getTestRepositoryId(), docIdHolder, null,
+ updateProperties, null);
+
+ // get new id and check name property
+ docId = docIdHolder.getValue();
+
+ ObjectData updatedObject = getObject(docId);
+ String updatedName = (String) updatedObject.getProperties().getProperties().get(
+ PropertyIds.CMIS_NAME).getFirstValue();
+ assertNotNull(updatedName);
+ assertEquals(name2, updatedName);
+
+ // delete document
+ delete(docId, true);
+ }
+
+ /**
+ * Tests delete tree.
+ */
+ public void testDeleteTree() throws Exception {
+ if (!isEnabled(TEST_DELETE_TREE)) {
+ return;
+ }
+
+ // create a folder tree
+ String folder1 = createDefaultFolder(getTestRootFolder(), "folder1");
+ String folder11 = createDefaultFolder(folder1, "folder11");
+ String folder12 = createDefaultFolder(folder1, "folder12");
+ String folder121 = createDefaultFolder(folder12, "folder121");
+ String folder122 = createDefaultFolder(folder12, "folder122");
+
+ // create a few documents
+ String doc111 = createDefaultDocument(folder11, "doc111.txt", CONTENT_TYPE, CONTENT);
+ String doc1221 = createDefaultDocument(folder122, "doc1221.txt", CONTENT_TYPE, CONTENT2);
+
+ // delete the tree
+ getProvider().getObjectService().deleteTree(getTestRepositoryId(), folder1, Boolean.TRUE,
+ UnfileObjects.DELETE, Boolean.TRUE, null);
+
+ assertFalse(existsObject(folder1));
+ assertFalse(existsObject(folder11));
+ assertFalse(existsObject(folder12));
+ assertFalse(existsObject(folder121));
+ assertFalse(existsObject(folder122));
+ assertFalse(existsObject(doc111));
+ assertFalse(existsObject(doc1221));
+ }
+
+ /**
+ * Tests move object.
+ */
+ public void testMoveObject() throws Exception {
+ if (!isEnabled(TEST_MOVE_OBJECT)) {
+ return;
+ }
+
+ // create folders
+ String folder1 = createDefaultFolder(getTestRootFolder(), "folder1");
+ String folder2 = createDefaultFolder(getTestRootFolder(), "folder2");
+
+ // create document
+ String docId = createDefaultDocument(folder1, "testdoc.txt", CONTENT_TYPE, CONTENT);
+
+ // move it
+ Holder<String> docIdHolder = new Holder<String>(docId);
+ getProvider().getObjectService().moveObject(getTestRepositoryId(), docIdHolder, folder2,
+ folder1, null);
+ assertNotNull(docIdHolder.getValue());
+
+ assertTrue(existsObject(docIdHolder.getValue()));
+ getChild(folder2, docIdHolder.getValue());
+
+ deleteTree(folder1);
+ deleteTree(folder2);
+ }
+
+ /**
+ * Test check-in/check-out.
+ */
+ public void testVersioning() throws Exception {
+ if (!isEnabled(TEST_VERSIONING)) {
+ return;
+ }
+
+ if (!isVersionable(getDefaultDocumentType())) {
+ warning("Default document type is not versionable!");
+ return;
+ }
+
+ // create document
+ String docId = createDefaultDocument(getTestRootFolder(), "versionTest.txt", CONTENT_TYPE,
+ CONTENT);
+
+ // there must be only one version in the version series
+ List<ObjectData> allVersions = getProvider().getVersioningService().getAllVersions(
+ getTestRepositoryId(), getVersionSeriesId(docId), "*", Boolean.FALSE, null);
+ assertNotNull(allVersions);
+ assertEquals(1, allVersions.size());
+
+ assertEquals(docId, allVersions.get(0).getId());
+
+ // check out
+ Holder<String> versionIdHolder = new Holder<String>(docId);
+ getProvider().getVersioningService().checkOut(getTestRepositoryId(), versionIdHolder, null,
+ null);
+ String versionId = versionIdHolder.getValue();
+
+ // object must be marked as checked out
+ assertTrue(isCheckedOut(docId));
+
+ // cancel check out
+ getProvider().getVersioningService().cancelCheckOut(getTestRepositoryId(), versionId, null);
+
+ // object must NOT be marked as checked out
+ assertFalse(isCheckedOut(docId));
+
+ // check out again
+ versionIdHolder.setValue(docId);
+ getProvider().getVersioningService().checkOut(getTestRepositoryId(), versionIdHolder, null,
+ null);
+ versionId = versionIdHolder.getValue();
+
+ // object must be marked as checked out
+ assertTrue(isCheckedOut(docId));
+
+ versionIdHolder.setValue(versionId);
+ getProvider().getVersioningService().checkIn(getTestRepositoryId(), versionIdHolder,
+ Boolean.TRUE, null, null, "Test Version 2", null, null, null, null);
+ docId = versionIdHolder.getValue();
+
+ // object must NOT be marked as checked out
+ assertFalse(isCheckedOut(docId));
+
+ // there must be exactly two versions in the version series
+ allVersions = getProvider().getVersioningService().getAllVersions(getTestRepositoryId(),
+ getVersionSeriesId(docId), "*", Boolean.FALSE, null);
+ assertNotNull(allVersions);
+ assertEquals(2, allVersions.size());
+
+ // delete document
+ delete(docId, true);
+ }
+
+ private boolean isCheckedOut(String docId) {
+ ObjectData object = getObject(docId);
+ PropertyData<?> isCheckedOut = object.getProperties().getProperties().get(
+ PropertyIds.CMIS_IS_VERSION_SERIES_CHECKED_OUT);
+ assertNotNull(isCheckedOut);
+ assertTrue(isCheckedOut.getFirstValue() instanceof Boolean);
+
+ return ((Boolean) isCheckedOut.getFirstValue()).booleanValue();
+ }
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/AbstractSimpleReadWriteTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/Tools.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/Tools.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/Tools.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/Tools.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.client.provider.framework;
+
+import java.util.List;
+
+import org.apache.opencmis.commons.PropertyIds;
+import org.apache.opencmis.commons.api.TypeDefinitionContainer;
+import org.apache.opencmis.commons.provider.ObjectInFolderContainer;
+import org.apache.opencmis.commons.provider.PropertiesData;
+import org.apache.opencmis.commons.provider.RepositoryInfoData;
+
+/**
+ * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
+ *
+ */
+public class Tools {
+
+ public static void print(RepositoryInfoData repositoryInfo) {
+ if (repositoryInfo == null) {
+ return;
+ }
+
+ System.out.println("-------------");
+ System.out.println("Id: " + repositoryInfo.getRepositoryId());
+ System.out.println("Name: " + repositoryInfo.getRepositoryName());
+ System.out.println("CMIS Version: " + repositoryInfo.getCmisVersionSupported());
+ System.out.println("Product: " + repositoryInfo.getVendorName() + " / "
+ + repositoryInfo.getProductName() + " " + repositoryInfo.getProductVersion());
+ System.out.println("Root Folder: " + repositoryInfo.getRootFolderId());
+ System.out.println("Capabilities: " + repositoryInfo.getRepositoryCapabilities());
+ System.out.println("ACL Capabilities: " + repositoryInfo.getAclCapabilities());
+ System.out.println("-------------");
+ }
+
+ public static void printTypes(String title, List<TypeDefinitionContainer> typeContainerList) {
+ System.out.println("-------------");
+ System.out.println(title);
+ System.out.println("-------------");
+
+ printTypes(typeContainerList, 0);
+ }
+
+ private static void printTypes(List<TypeDefinitionContainer> typeContainerList, int level) {
+ if (typeContainerList == null) {
+ return;
+ }
+
+ for (TypeDefinitionContainer container : typeContainerList) {
+ for (int i = 0; i < level; i++) {
+ System.out.print(" ");
+ }
+
+ container.getTypeDefinition().getId();
+ System.out.println(container.getTypeDefinition().getId());
+
+ printTypes(container.getChildren(), level + 1);
+ }
+
+ }
+
+ public static void print(String title, List<ObjectInFolderContainer> containerList) {
+ System.out.println("-------------");
+ System.out.println(title);
+ System.out.println("-------------");
+
+ print(containerList, 0);
+ }
+
+ private static void print(List<ObjectInFolderContainer> containerList, int level) {
+ if (containerList == null) {
+ return;
+ }
+
+ for (ObjectInFolderContainer container : containerList) {
+ for (int i = 0; i < level; i++) {
+ System.out.print(" ");
+ }
+
+ PropertiesData properties = container.getObject().getObject().getProperties();
+ System.out.println(properties.getProperties().get(PropertyIds.CMIS_NAME).getFirstValue()
+ + " (" + properties.getProperties().get(PropertyIds.CMIS_OBJECT_TYPE_ID).getFirstValue()
+ + ")");
+
+ print(container.getChildren(), level + 1);
+ }
+ }
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/Tools.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/misc/ConverterTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/misc/ConverterTest.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/misc/ConverterTest.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/misc/ConverterTest.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,242 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.client.provider.misc;
+
+import java.lang.reflect.Method;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.apache.opencmis.commons.api.TypeDefinition;
+import org.apache.opencmis.commons.enums.AclPropagation;
+import org.apache.opencmis.commons.enums.BaseObjectTypeIds;
+import org.apache.opencmis.commons.enums.CapabilityAcl;
+import org.apache.opencmis.commons.enums.CapabilityChanges;
+import org.apache.opencmis.commons.enums.CapabilityContentStreamUpdates;
+import org.apache.opencmis.commons.enums.CapabilityJoin;
+import org.apache.opencmis.commons.enums.CapabilityQuery;
+import org.apache.opencmis.commons.enums.CapabilityRendition;
+import org.apache.opencmis.commons.enums.ContentStreamAllowed;
+import org.apache.opencmis.commons.impl.Converter;
+import org.apache.opencmis.commons.impl.dataobjects.AclCapabilitiesDataImpl;
+import org.apache.opencmis.commons.impl.dataobjects.DocumentTypeDefinitionImpl;
+import org.apache.opencmis.commons.impl.dataobjects.ObjectDataImpl;
+import org.apache.opencmis.commons.impl.dataobjects.PermissionDefinitionDataImpl;
+import org.apache.opencmis.commons.impl.dataobjects.PermissionMappingDataImpl;
+import org.apache.opencmis.commons.impl.dataobjects.RepositoryCapabilitiesDataImpl;
+import org.apache.opencmis.commons.impl.dataobjects.RepositoryInfoDataImpl;
+import org.apache.opencmis.commons.provider.ObjectData;
+import org.apache.opencmis.commons.provider.PermissionDefinitionData;
+import org.apache.opencmis.commons.provider.PermissionMappingData;
+import org.apache.opencmis.commons.provider.RepositoryInfoData;
+
+/**
+ * Tests converter methods.
+ *
+ * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
+ *
+ */
+public class ConverterTest extends TestCase {
+
+ public void testRepositoryInfo() throws Exception {
+ // dry run
+ RepositoryInfoDataImpl obj1 = new RepositoryInfoDataImpl();
+ RepositoryInfoData obj2 = Converter.convert(Converter.convert(obj1));
+
+ assertDataObjectsEquals("RepositoryInfo", obj1, obj2);
+
+ // values
+ obj1 = new RepositoryInfoDataImpl();
+ obj1.setChangesIncomplete(Boolean.TRUE);
+ obj1.setChangesOnType(Collections.singletonList(BaseObjectTypeIds.CMIS_DOCUMENT));
+ obj1.setCmisVersionSupported("1.0");
+ obj1.setLatestChangeLogToken("changeLogToken");
+ obj1.setPrincipalAnonymous("principalAnonymous");
+ obj1.setPrincipalAnyone("principalAnyone");
+ obj1.setProductName("productName");
+ obj1.setProductVersion("productVersion");
+ obj1.setRepositoryDescription("description");
+ obj1.setRepositoryId("id");
+ obj1.setRepositoryName("name");
+ obj1.setRootFolder("rootFolderId");
+ obj1.setThinClientUri("thinClientUri");
+ obj1.setVendorName("vendorName");
+
+ RepositoryCapabilitiesDataImpl cap1 = new RepositoryCapabilitiesDataImpl();
+ cap1.setAllVersionsSearchable(Boolean.TRUE);
+ cap1.setCapabilityAcl(CapabilityAcl.DISCOVER);
+ cap1.setCapabilityChanges(CapabilityChanges.ALL);
+ cap1.setCapabilityContentStreamUpdates(CapabilityContentStreamUpdates.ANYTIME);
+ cap1.setCapabilityJoin(CapabilityJoin.INNERANDOUTER);
+ cap1.setCapabilityQuery(CapabilityQuery.BOTHCOMBINED);
+ cap1.setCapabilityRendition(CapabilityRendition.READ);
+ cap1.setIsPwcSearchable(Boolean.TRUE);
+ cap1.setIsPwcUpdatable(Boolean.TRUE);
+ cap1.setSupportsGetDescendants(Boolean.TRUE);
+ cap1.setSupportsGetFolderTree(Boolean.TRUE);
+ cap1.setSupportsMultifiling(Boolean.TRUE);
+ cap1.setSupportsUnfiling(Boolean.TRUE);
+ cap1.setSupportsVersionSpecificFiling(Boolean.TRUE);
+ obj1.setRepositoryCapabilities(cap1);
+
+ AclCapabilitiesDataImpl acl1 = new AclCapabilitiesDataImpl();
+ acl1.setAclPropagation(AclPropagation.PROPAGATE);
+ List<PermissionDefinitionData> pddList = new ArrayList<PermissionDefinitionData>();
+ PermissionDefinitionDataImpl pdd1 = new PermissionDefinitionDataImpl();
+ pdd1.setPermission("test:perm1");
+ pdd1.setDescription("Permission1");
+ pddList.add(pdd1);
+ PermissionDefinitionDataImpl pdd2 = new PermissionDefinitionDataImpl();
+ pdd2.setPermission("test:perm2");
+ pdd2.setDescription("Permission2");
+ pddList.add(pdd2);
+ acl1.setPermissionDefinitionData(pddList);
+ List<PermissionMappingData> pmdList = new ArrayList<PermissionMappingData>();
+ PermissionMappingDataImpl pmd1 = new PermissionMappingDataImpl();
+ pmd1.setKey(PermissionMappingData.KEY_CAN_CREATE_DOCUMENT_FOLDER);
+ pmd1.setPermissions(Arrays.asList(new String[] { "p1", "p2" }));
+ pmdList.add(pmd1);
+ PermissionMappingDataImpl pmd2 = new PermissionMappingDataImpl();
+ pmd2.setKey(PermissionMappingData.KEY_CAN_DELETE_OBJECT);
+ pmd2.setPermissions(Arrays.asList(new String[] { "p3", "p4" }));
+ pmdList.add(pmd2);
+ acl1.setPermissionMappingData(pmdList);
+ obj1.setAclCapabilities(acl1);
+
+ obj2 = Converter.convert(Converter.convert(obj1));
+
+ assertDataObjectsEquals("RepositoryInfo", obj1, obj2);
+ }
+
+ public void testTypeDefinition() throws Exception {
+ // dry run
+ DocumentTypeDefinitionImpl obj1 = new DocumentTypeDefinitionImpl();
+ TypeDefinition obj2 = Converter.convert(Converter.convert(obj1));
+
+ assertDataObjectsEquals("TypeDefinition", obj1, obj2);
+
+ // simple values
+ obj1 = new DocumentTypeDefinitionImpl();
+ obj1.setBaseId(BaseObjectTypeIds.CMIS_DOCUMENT);
+ obj1.setContentStreamAllowed(ContentStreamAllowed.ALLOWED);
+ obj1.setDescription("description");
+ obj1.setDisplayName("displayName");
+ obj1.setId("id");
+ obj1.setIsControllableAcl(Boolean.TRUE);
+ obj1.setIsControllablePolicy(Boolean.TRUE);
+ obj1.setIsCreatable(Boolean.TRUE);
+ obj1.setIsFileable(Boolean.TRUE);
+ obj1.setIsIncludedInSupertypeQuery(Boolean.TRUE);
+ obj1.setIsQueryable(Boolean.TRUE);
+ obj1.setIsVersionable(Boolean.TRUE);
+ obj1.setLocalName("localName");
+ obj1.setLocalNamespace("localNamespace");
+ obj1.setParentId("parentId");
+ obj1.setQueryName("queryName");
+
+ obj2 = Converter.convert(Converter.convert(obj1));
+
+ assertDataObjectsEquals("TypeDefinition", obj1, obj2);
+ }
+
+ public void testObject() throws Exception {
+ // dry run
+ ObjectDataImpl obj1 = new ObjectDataImpl();
+ ObjectData obj2 = Converter.convert(Converter.convert(obj1));
+
+ assertDataObjectsEquals("Object", obj1, obj2);
+ }
+
+ /**
+ * Asserts OpenCMIS data objects.
+ */
+ protected void assertDataObjectsEquals(String name, Object expected, Object actual)
+ throws Exception {
+ System.out.println(name);
+
+ if ((expected == null) && (actual == null)) {
+ return;
+ }
+
+ if ((expected == null) || (actual == null)) {
+ fail("Data object is null! name: " + name + " / expected: " + expected + " / actual: "
+ + actual);
+ }
+
+ // handle simple types
+ if ((expected instanceof String) || (expected instanceof Boolean)
+ || (expected instanceof BigInteger) || (expected instanceof BigDecimal)
+ || (expected instanceof Enum<?>)) {
+ assertEquals(expected, actual);
+
+ return;
+ }
+ else if (expected instanceof List<?>) {
+ List<?> expectedList = (List<?>) expected;
+ List<?> actualList = (List<?>) actual;
+
+ assertEquals(expectedList.size(), actualList.size());
+
+ for (int i = 0; i < expectedList.size(); i++) {
+ assertDataObjectsEquals(name + "[" + i + "]", expectedList.get(i), actualList.get(i));
+ }
+
+ return;
+ }
+ else if (expected instanceof Map<?, ?>) {
+ Map<?, ?> expectedMap = (Map<?, ?>) expected;
+ Map<?, ?> actualMap = (Map<?, ?>) actual;
+
+ assertEquals(expectedMap.size(), actualMap.size());
+
+ for (Map.Entry<?, ?> entry : expectedMap.entrySet()) {
+ assertTrue(actualMap.containsKey(entry.getKey()));
+ assertDataObjectsEquals(name + "[" + entry.getKey() + "]", entry.getValue(), actualMap
+ .get(entry.getKey()));
+ }
+
+ return;
+ }
+
+ for (Method m : expected.getClass().getMethods()) {
+ if (!m.getName().startsWith("get") && !m.getName().startsWith("supports")) {
+ continue;
+ }
+
+ if (m.getName().equals("getClass")) {
+ continue;
+ }
+
+ if (m.getParameterTypes().length != 0) {
+ continue;
+ }
+
+ Object expectedValue = m.invoke(expected, new Object[0]);
+ Object actualValue = m.invoke(actual, new Object[0]);
+
+ assertDataObjectsEquals(name + "." + m.getName(), expectedValue, actualValue);
+ }
+ }
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/misc/ConverterTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/misc/MiscTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/misc/MiscTest.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/misc/MiscTest.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/misc/MiscTest.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.client.provider.misc;
+
+import junit.framework.TestCase;
+
+import org.apache.opencmis.commons.impl.UrlBuilder;
+
+/**
+ * Tests miscellaneous details.
+ *
+ * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
+ *
+ */
+public class MiscTest extends TestCase {
+
+ public void testUrlBuilder() {
+ assertEquals("http://host/test", (new UrlBuilder("http://host/test")).toString());
+ assertEquals("http://host/test?query=value", (new UrlBuilder("http://host/test?query=value"))
+ .toString());
+ assertEquals("http://host/test", (new UrlBuilder("http://host/test?")).toString());
+
+ UrlBuilder urlBuilder;
+
+ urlBuilder = new UrlBuilder("http://host/test");
+ urlBuilder.addParameter("query", "value");
+ assertEquals("http://host/test?query=value", urlBuilder.toString());
+
+ urlBuilder = new UrlBuilder("http://host/test");
+ urlBuilder.addPath("path");
+ assertEquals("http://host/test/path", urlBuilder.toString());
+
+ urlBuilder = new UrlBuilder("http://host/test/");
+ urlBuilder.addPath("path");
+ assertEquals("http://host/test/path", urlBuilder.toString());
+
+ urlBuilder = new UrlBuilder("http://host/test");
+ urlBuilder.addPath("/path");
+ assertEquals("http://host/test/path", urlBuilder.toString());
+
+ urlBuilder = new UrlBuilder("http://host/test/");
+ urlBuilder.addPath("/path");
+ assertEquals("http://host/test/path", urlBuilder.toString());
+ }
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/misc/MiscTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/webservices/SimpleReadOnlyTests.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/webservices/SimpleReadOnlyTests.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/webservices/SimpleReadOnlyTests.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/webservices/SimpleReadOnlyTests.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.client.provider.webservices;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.opencmis.client.provider.framework.AbstractSimpleReadOnlyTests;
+import org.apache.opencmis.commons.provider.CmisProvider;
+
+/**
+ * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
+ *
+ */
+public class SimpleReadOnlyTests extends AbstractSimpleReadOnlyTests {
+
+ private Set<String> fTests;
+
+ public SimpleReadOnlyTests() {
+ fTests = new HashSet<String>();
+ fTests.add(TEST_REPOSITORY_INFO);
+ fTests.add(TEST_TYPES);
+ fTests.add(TEST_NAVIGATION);
+ fTests.add(TEST_CONTENT_STREAM);
+ fTests.add(TEST_QUERY);
+ fTests.add(TEST_CHECKEDOUT);
+ fTests.add(TEST_CONTENT_CHANGES);
+ }
+
+ @Override
+ protected CmisProvider createProvider() {
+ return WebServicesTestProviderFactory.createProvider(getWebServicesURL(), getUsername(),
+ getPassword());
+ }
+
+ @Override
+ protected Set<String> getEnabledTests() {
+ return fTests;
+ }
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/webservices/SimpleReadOnlyTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/webservices/SimpleReadWriteTests.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/webservices/SimpleReadWriteTests.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/webservices/SimpleReadWriteTests.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/webservices/SimpleReadWriteTests.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.client.provider.webservices;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.opencmis.client.provider.framework.AbstractSimpleReadWriteTests;
+import org.apache.opencmis.commons.provider.CmisProvider;
+
+/**
+ * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
+ *
+ */
+public class SimpleReadWriteTests extends AbstractSimpleReadWriteTests {
+
+ private Set<String> fTests;
+
+ public SimpleReadWriteTests() {
+ fTests = new HashSet<String>();
+ fTests.add(TEST_CREATE_FOLDER);
+ fTests.add(TEST_CREATE_DOCUMENT);
+ fTests.add(TEST_CREATE_FROM_SOURCE);
+ fTests.add(TEST_SET_AND_DELETE_CONTENT);
+ fTests.add(TEST_UPDATE_PROPERTIES);
+ fTests.add(TEST_DELETE_TREE);
+ fTests.add(TEST_MOVE_OBJECT);
+ fTests.add(TEST_VERSIONING);
+ }
+
+ @Override
+ protected CmisProvider createProvider() {
+ return WebServicesTestProviderFactory.createProvider(getWebServicesURL(), getUsername(),
+ getPassword());
+ }
+
+ @Override
+ protected Set<String> getEnabledTests() {
+ return fTests;
+ }
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/webservices/SimpleReadWriteTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/webservices/WebServicesTestProviderFactory.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/webservices/WebServicesTestProviderFactory.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/webservices/WebServicesTestProviderFactory.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/webservices/WebServicesTestProviderFactory.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.client.provider.webservices;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.opencmis.client.provider.factory.CmisProviderFactory;
+import org.apache.opencmis.commons.SessionParameter;
+import org.apache.opencmis.commons.provider.CmisProvider;
+
+/**
+ * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
+ *
+ */
+public class WebServicesTestProviderFactory {
+
+ public static CmisProvider createProvider(String url, String username, String password) {
+ boolean isPrefix = true;
+ String urlLower = url.toLowerCase();
+
+ if (urlLower.endsWith("?wsdl")) {
+ isPrefix = false;
+ }
+ else if (urlLower.endsWith(".wsdl")) {
+ isPrefix = false;
+ }
+ else if (urlLower.endsWith(".xml")) {
+ isPrefix = false;
+ }
+
+ return createProvider(url, isPrefix, username, password);
+ }
+
+ public static CmisProvider createProvider(String url, boolean isPrefix, String username,
+ String password) {
+ // gather parameters
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put(SessionParameter.USER, username);
+ parameters.put(SessionParameter.PASSWORD, password);
+
+ if (!isPrefix) {
+ parameters.put(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE, url);
+ parameters.put(SessionParameter.WEBSERVICES_NAVIGATION_SERVICE, url);
+ parameters.put(SessionParameter.WEBSERVICES_OBJECT_SERVICE, url);
+ parameters.put(SessionParameter.WEBSERVICES_VERSIONING_SERVICE, url);
+ parameters.put(SessionParameter.WEBSERVICES_DISCOVERY_SERVICE, url);
+ parameters.put(SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE, url);
+ parameters.put(SessionParameter.WEBSERVICES_MULTIFILING_SERVICE, url);
+ parameters.put(SessionParameter.WEBSERVICES_POLICY_SERVICE, url);
+ parameters.put(SessionParameter.WEBSERVICES_ACL_SERVICE, url);
+ }
+ else {
+ parameters.put(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE, url
+ + "RepositoryService?wsdl");
+ parameters.put(SessionParameter.WEBSERVICES_NAVIGATION_SERVICE, url
+ + "NavigationService?wsdl");
+ parameters.put(SessionParameter.WEBSERVICES_OBJECT_SERVICE, url + "ObjectService?wsdl");
+ parameters.put(SessionParameter.WEBSERVICES_VERSIONING_SERVICE, url
+ + "VersioningService?wsdl");
+ parameters.put(SessionParameter.WEBSERVICES_DISCOVERY_SERVICE, url + "DiscoveryService?wsdl");
+ parameters.put(SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE, url
+ + "RelationshipService?wsdl");
+ parameters.put(SessionParameter.WEBSERVICES_MULTIFILING_SERVICE, url
+ + "MultiFilingService?wsdl");
+ parameters.put(SessionParameter.WEBSERVICES_POLICY_SERVICE, url + "PolicyService?wsdl");
+ parameters.put(SessionParameter.WEBSERVICES_ACL_SERVICE, url + "ACLService?wsdl");
+ }
+
+ // get factory and create provider
+ CmisProviderFactory factory = CmisProviderFactory.newInstance();
+ CmisProvider provider = factory.createCmisWebServicesProvider(parameters);
+
+ return provider;
+ }
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/webservices/WebServicesTestProviderFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Feb 16 16:03:38 2010
@@ -0,0 +1,6 @@
+bin
+target
+*.iws
+*.ipr
+*.iml
+.*
Added: incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/pom.xml
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/pom.xml?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/pom.xml (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/pom.xml Tue Feb 16 16:03:38 2010
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.opencmis</groupId>
+ <artifactId>opencmis</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>opencmis-commons-api</artifactId>
+ <name>OpenCMIS Commons API</name>
+
+</project>
\ No newline at end of file
Propchange: incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/PropertyIds.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/PropertyIds.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/PropertyIds.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/PropertyIds.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.commons;
+
+/**
+ * Collection of CMIS property ids.
+ *
+ * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
+ *
+ */
+public final class PropertyIds {
+
+ private PropertyIds() {
+ }
+
+ // ---- base ----
+ public static final String CMIS_NAME = "cmis:name";
+ public static final String CMIS_OBJECT_ID = "cmis:objectId";
+ public static final String CMIS_OBJECT_TYPE_ID = "cmis:objectTypeId";
+ public static final String CMIS_BASE_TYPE_ID = "cmis:baseTypeId";
+ public static final String CMIS_CREATED_BY = "cmis:createdBy";
+ public static final String CMIS_CREATION_DATE = "cmis:creationDate";
+ public static final String CMIS_LAST_MODIFIED_BY = "cmis:lastModifiedBy";
+ public static final String CMIS_LAST_MODIFICATION_DATE = "cmis:lastModificationDate";
+ public static final String CMIS_CHANGE_TOKEN = "cmis:changeToken";
+
+ // ---- document ----
+ public static final String CMIS_IS_IMMUTABLE = "cmis:isImmutable";
+ public static final String CMIS_IS_LATEST_VERSION = "cmis:isLatestVersion";
+ public static final String CMIS_IS_MAJOR_VERSION = "cmis:isMajorVersion";
+ public static final String CMIS_IS_LATEST_MAJOR_VERSION = "cmis:isLatestMajorVersion";
+ public static final String CMIS_VERSION_LABEL = "cmis:versionLabel";
+ public static final String CMIS_VERSION_SERIES_ID = "cmis:versionSeriesId";
+ public static final String CMIS_IS_VERSION_SERIES_CHECKED_OUT = "cmis:isVersionSeriesCheckedOut";
+ public static final String CMIS_VERSION_SERIES_CHECKED_OUT_BY = "cmis:versionSeriesCheckedOutBy";
+ public static final String CMIS_VERSION_SERIES_CHECKED_OUT_ID = "cmis:versionSeriesCheckedOutId";
+ public static final String CMIS_CHECKIN_COMMENT = "cmis:checkinComment";
+ public static final String CMIS_CONTENT_STREAM_LENGTH = "cmis:contentStreamLength";
+ public static final String CMIS_CONTENT_STREAM_MIME_TYPE = "cmis:contentStreamMimeType";
+ public static final String CMIS_CONTENT_STREAM_FILE_NAME = "cmis:contentStreamFileName";
+ public static final String CMIS_CONTENT_STREAM_ID = "cmis:contentStreamId";
+
+ // ---- folder ----
+ public static final String CMIS_PARENT_ID = "cmis:parentId";
+ public static final String CMIS_ALLOWED_CHILD_OBJECT_TYPE_IDS = "cmis:allowedChildObjectTypeIds";
+ public static final String CMIS_PATH = "cmis:path";
+
+ // ---- relationship ----
+ public static final String CMIS_SOURCE_ID = "cmis:sourceId";
+ public static final String CMIS_TARGET_ID = "cmis:targetId";
+
+ // ---- policy ----
+ public static final String CMIS_POLICY_TEXT = "cmis:policyText";
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/PropertyIds.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/SessionParameter.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/SessionParameter.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/SessionParameter.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/SessionParameter.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.commons;
+
+/**
+ * Collection of session parameters.
+ *
+ * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
+ *
+ */
+public final class SessionParameter {
+
+ private SessionParameter() {
+ }
+
+ // ---- general parameter ----
+ public static final String USER = "org.apache.opencmis.user";
+ public static final String PASSWORD = "org.apache.opencmis.password";
+
+ // ---- provider parameter ----
+ /** Class name of the binding class. */
+ public static final String BINDING_SPI_CLASS = "org.apache.opencmis.provider.binding.classname";
+
+ /** URL of the AtomPub service document. */
+ public static final String ATOMPUB_URL = "org.apache.opencmis.provider.atompub.url";
+
+ public static final String WEBSERVICES_REPOSITORY_SERVICE = "org.apache.opencmis.provider.webservices.RepositoryService";
+ public static final String WEBSERVICES_NAVIGATION_SERVICE = "org.apache.opencmis.provider.webservices.NavigationService";
+ public static final String WEBSERVICES_OBJECT_SERVICE = "org.apache.opencmis.provider.webservices.ObjectService";
+ public static final String WEBSERVICES_VERSIONING_SERVICE = "org.apache.opencmis.provider.webservices.VersioningService";
+ public static final String WEBSERVICES_DISCOVERY_SERVICE = "org.apache.opencmis.provider.webservices.DiscoveryService";
+ public static final String WEBSERVICES_RELATIONSHIP_SERVICE = "org.apache.opencmis.provider.webservices.RelationshipService";
+ public static final String WEBSERVICES_MULTIFILING_SERVICE = "org.apache.opencmis.provider.webservices.MultiFilingService";
+ public static final String WEBSERVICES_POLICY_SERVICE = "org.apache.opencmis.provider.webservices.PolicyService";
+ public static final String WEBSERVICES_ACL_SERVICE = "org.apache.opencmis.provider.webservices.ACLService";
+
+ /** Class name of the authentication provider. */
+ public static final String AUTHENTICATION_PROVIDER_CLASS = "org.apache.opencmis.provider.auth.classname";
+
+ /** Toggle for HTTP basic authentication. Evaluated by the standard authentication provider. */
+ public static final String AUTH_HTTP_BASIC = "org.apache.opencmis.provider.auth.http.basic";
+ /**
+ * Toggle for WS-Security UsernameToken authentication. Evaluated by the standard authentication
+ * provider.
+ */
+ public static final String AUTH_SOAP_USERNAMETOKEN = "org.apache.opencmis.provider.auth.soap.usernametoken";
+
+ public static final String CACHE_SIZE_REPOSITORIES = "org.apache.opencmis.provider.cache.repositories.size";
+ public static final String CACHE_SIZE_TYPES = "org.apache.opencmis.provider.cache.types.size";
+ public static final String CACHE_SIZE_OBJECTS = "org.apache.opencmis.provider.cache.objects.size";
+
+ // --- session control ---
+
+ public static final String LOCALE_ISO639_LANGUAGE = "org.apache.opencmis.locale.iso639";
+ public static final String LOCALE_ISO3166_COUNTRY = "org.apache.opencmis.locale.iso3166";
+ public static final String LOCALE_VARIANT = "org.apache.opencmis.locale.variant";
+
+ public static final String SESSION_TYPE = "org.apache.opencmis.session.type";
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/SessionParameter.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/Choice.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/Choice.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/Choice.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/Choice.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.commons.api;
+
+import java.util.List;
+
+public interface Choice<T> {
+
+ String getDisplayName();
+
+ List<T> getValue();
+
+ List<Choice<T>> getChoice();
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/Choice.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/DocumentTypeDefinition.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/DocumentTypeDefinition.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/DocumentTypeDefinition.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/DocumentTypeDefinition.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.commons.api;
+
+import org.apache.opencmis.commons.enums.ContentStreamAllowed;
+
+public interface DocumentTypeDefinition extends TypeDefinition {
+
+ Boolean isVersionable();
+
+ ContentStreamAllowed getContentStreamAllowed();
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/DocumentTypeDefinition.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/ExtensionsData.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/ExtensionsData.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/ExtensionsData.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/ExtensionsData.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.commons.api;
+
+import java.util.List;
+
+/**
+ * Holds extension data either set by the CMIS repository or the client.
+ *
+ * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
+ *
+ */
+public interface ExtensionsData {
+
+ List<Object> getExtensions();
+
+ void setExtensions(List<Object> extensions);
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/ExtensionsData.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/FolderTypeDefinition.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/FolderTypeDefinition.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/FolderTypeDefinition.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/FolderTypeDefinition.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.commons.api;
+
+public interface FolderTypeDefinition extends TypeDefinition {
+
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/FolderTypeDefinition.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/PolicyTypeDefinition.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/PolicyTypeDefinition.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/PolicyTypeDefinition.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/PolicyTypeDefinition.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.commons.api;
+
+public interface PolicyTypeDefinition extends TypeDefinition {
+
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/PolicyTypeDefinition.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/PropertyBooleanDefinition.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/PropertyBooleanDefinition.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/PropertyBooleanDefinition.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/PropertyBooleanDefinition.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.commons.api;
+
+
+public interface PropertyBooleanDefinition extends PropertyDefinition<Boolean> {
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/api/PropertyBooleanDefinition.java
------------------------------------------------------------------------------
svn:eol-style = native