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/04/16 16:19:33 UTC
svn commit: r934904 [2/2] - in
/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit:
./ bindings/ runtime/ runtime/suite/ sample/
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyRepositoryInfoIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyRepositoryInfoIT.java?rev=934904&r1=934903&r2=934904&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyRepositoryInfoIT.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyRepositoryInfoIT.java Fri Apr 16 14:19:32 2010
@@ -35,226 +35,223 @@ import org.junit.Test;
*/
public class ReadOnlyRepositoryInfoIT extends AbstractSessionTest {
- @Test
- public void changesIncomplete() {
- RepositoryInfo r = this.session.getRepositoryInfo();
- Assert.assertNotNull(r);
- Assert.assertNotNull(r.getChangesIncomplete());
- }
-
- @Test
- public void changesOnType() {
- RepositoryInfo r = this.session.getRepositoryInfo();
- Assert.assertNotNull(r);
- Assert.assertNotNull(r.getChangesOnType());
- }
-
- @Test
- public void cmisVersionSupported() {
- RepositoryInfo r = this.session.getRepositoryInfo();
- Assert.assertNotNull(r);
- Assert.assertNotNull(r.getCmisVersionSupported());
- this.log.info("getCmisVersionSupported = "
- + r.getCmisVersionSupported());
- }
-
- @Test
- public void description() {
- RepositoryInfo r = this.session.getRepositoryInfo();
- Assert.assertNotNull(r);
- Assert.assertNotNull(r.getDescription());
- this.log.info("getDescription = " + r.getDescription());
- }
-
- @Test
- public void id() {
- RepositoryInfo r = this.session.getRepositoryInfo();
- Assert.assertNotNull(r);
- Assert.assertNotNull(r.getId());
- this.log.info("getId = " + r.getId());
- }
-
- @Test
- public void name() {
- RepositoryInfo r = this.session.getRepositoryInfo();
- Assert.assertNotNull(r);
- Assert.assertNotNull(r.getName());
- this.log.info("getName = " + r.getName());
- }
-
- @Test
- public void principalIdAnonymous() {
- RepositoryInfo r = this.session.getRepositoryInfo();
- Assert.assertNotNull(r);
- Assert.assertNotNull(r.getPrincipalIdAnonymous());
- this.log.info("getPrincipalIdAnonymous = "
- + r.getPrincipalIdAnonymous());
- }
-
- @Test
- public void principalIdAnyone() {
- RepositoryInfo r = this.session.getRepositoryInfo();
- Assert.assertNotNull(r);
- Assert.assertNotNull(r.getPrincipalIdAnyone());
- this.log.info("getPrincipalIdAnyone = " + r.getPrincipalIdAnyone());
- }
-
- @Test
- public void productName() {
- RepositoryInfo r = this.session.getRepositoryInfo();
- Assert.assertNotNull(r);
- Assert.assertNotNull(r.getProductName());
- this.log.info("getProductName = " + r.getProductName());
- }
-
- @Test
- public void thinClientUri() {
- RepositoryInfo r = this.session.getRepositoryInfo();
- Assert.assertNotNull(r);
- String uri = r.getThinClientUri();
- this.log.info("getThinClientUri = " + uri);
- }
-
- @Test
- public void vendorName() {
- RepositoryInfo r = this.session.getRepositoryInfo();
- Assert.assertNotNull(r);
- Assert.assertNotNull(r.getVendorName());
- this.log.info("getVendorName = " + r.getVendorName());
- }
-
- @Test
- public void repositoryCapabilitiesAclSupport() {
- RepositoryInfo r = this.session.getRepositoryInfo();
- Assert.assertNotNull(r);
-
- // capabilities
- RepositoryCapabilities repcap = r.getCapabilities();
- Assert.assertNotNull(repcap);
-
- CapabilityAcl capacl = repcap.getAclCapability();
- Assert.assertNotNull(capacl);
- switch (capacl) {
- case DISCOVER:
- case MANAGE:
- case NONE:
- break;
- default:
- Assert.fail("enumeration not supported: " + capacl);
- }
- this.log.info("CapabilityAcl = " + capacl);
- }
-
- @Test
- public void repositoryCapabilitiesChangesSupport() {
- RepositoryInfo r = this.session.getRepositoryInfo();
- Assert.assertNotNull(r);
-
- // capabilities
- RepositoryCapabilities repcap = r.getCapabilities();
- Assert.assertNotNull(repcap);
- CapabilityChanges capch = repcap.getChangesCapability();
- Assert.assertNotNull(capch);
- switch (capch) {
- case ALL:
- case OBJECTIDSONLY:
- case PROPERTIES:
- case NONE:
- break;
- default:
- Assert.fail("enumeration not supported: " + capch);
- }
- this.log.info("CapabilityChanges = " + capch);
- }
-
- @Test
- public void repositoryCapabilitiesContentStreamUpdateabilitySupport() {
- RepositoryInfo r = this.session.getRepositoryInfo();
- Assert.assertNotNull(r);
-
- // capabilities
- RepositoryCapabilities repcap = r.getCapabilities();
- Assert.assertNotNull(repcap);
- CapabilityContentStreamUpdates ccsu = repcap
- .getContentStreamUpdatesCapability();
- Assert.assertNotNull(ccsu);
- switch (ccsu) {
- case ANYTIME:
- case NONE:
- case PWCONLY:
- break;
- default:
- Assert.fail("enumeration not supported: " + ccsu);
- }
- this.log.info("CapabilityContentStreamUpdates = " + ccsu);
- }
-
- @Test
- public void repositoryCapabilitiesJointSupport() {
- RepositoryInfo r = this.session.getRepositoryInfo();
- Assert.assertNotNull(r);
-
- // capabilities
- RepositoryCapabilities repcap = r.getCapabilities();
- Assert.assertNotNull(repcap);
-
- CapabilityJoin capj = repcap.getJoinCapability();
- Assert.assertNotNull(capj);
-
- switch (capj) {
- case INNERANDOUTER:
- case INNERONLY:
- case NONE:
- break;
- default:
- Assert.fail("enumeration not supported: " + capj);
- }
- this.log.info("CapabilityJoin = " + capj);
- }
-
- @Test
- public void repositoryCapabilitiesQuerySupport() {
- RepositoryInfo r = this.session.getRepositoryInfo();
- Assert.assertNotNull(r);
-
- // capabilities
- RepositoryCapabilities repcap = r.getCapabilities();
- Assert.assertNotNull(repcap);
-
- CapabilityQuery capq = repcap.getQueryCapability();
- Assert.assertNotNull(capq);
- switch (capq) {
- case BOTHCOMBINED:
- case BOTHSEPARATE:
- case FULLTEXTONLY:
- case METADATAONLY:
- case NONE:
- break;
- default:
- Assert.fail("enumeration not supported: " + capq);
- }
- this.log.info("CapabilityQuery = " + capq);
- }
-
- @Test
- public void repositoryCapabilitiesRenditionSupport() {
- RepositoryInfo r = this.session.getRepositoryInfo();
- Assert.assertNotNull(r);
-
- // capabilities
- RepositoryCapabilities repcap = r.getCapabilities();
- Assert.assertNotNull(repcap);
-
- CapabilityRenditions caprend = repcap.getRenditionsCapability();
- Assert.assertNotNull(caprend);
- switch (caprend) {
- case NONE:
- case READ:
- break;
- default:
- Assert.fail("enumeration not supported: " + caprend);
- }
- this.log.info("CapabilityRendition = " + caprend);
- }
+ @Test
+ public void changesIncomplete() {
+ RepositoryInfo r = this.session.getRepositoryInfo();
+ Assert.assertNotNull(r);
+ Assert.assertNotNull(r.getChangesIncomplete());
+ }
+
+ @Test
+ public void changesOnType() {
+ RepositoryInfo r = this.session.getRepositoryInfo();
+ Assert.assertNotNull(r);
+ Assert.assertNotNull(r.getChangesOnType());
+ }
+
+ @Test
+ public void cmisVersionSupported() {
+ RepositoryInfo r = this.session.getRepositoryInfo();
+ Assert.assertNotNull(r);
+ Assert.assertNotNull(r.getCmisVersionSupported());
+ this.log.info("getCmisVersionSupported = " + r.getCmisVersionSupported());
+ }
+
+ @Test
+ public void description() {
+ RepositoryInfo r = this.session.getRepositoryInfo();
+ Assert.assertNotNull(r);
+ Assert.assertNotNull(r.getDescription());
+ this.log.info("getDescription = " + r.getDescription());
+ }
+
+ @Test
+ public void id() {
+ RepositoryInfo r = this.session.getRepositoryInfo();
+ Assert.assertNotNull(r);
+ Assert.assertNotNull(r.getId());
+ this.log.info("getId = " + r.getId());
+ }
+
+ @Test
+ public void name() {
+ RepositoryInfo r = this.session.getRepositoryInfo();
+ Assert.assertNotNull(r);
+ Assert.assertNotNull(r.getName());
+ this.log.info("getName = " + r.getName());
+ }
+
+ @Test
+ public void principalIdAnonymous() {
+ RepositoryInfo r = this.session.getRepositoryInfo();
+ Assert.assertNotNull(r);
+ Assert.assertNotNull(r.getPrincipalIdAnonymous());
+ this.log.info("getPrincipalIdAnonymous = " + r.getPrincipalIdAnonymous());
+ }
+
+ @Test
+ public void principalIdAnyone() {
+ RepositoryInfo r = this.session.getRepositoryInfo();
+ Assert.assertNotNull(r);
+ Assert.assertNotNull(r.getPrincipalIdAnyone());
+ this.log.info("getPrincipalIdAnyone = " + r.getPrincipalIdAnyone());
+ }
+
+ @Test
+ public void productName() {
+ RepositoryInfo r = this.session.getRepositoryInfo();
+ Assert.assertNotNull(r);
+ Assert.assertNotNull(r.getProductName());
+ this.log.info("getProductName = " + r.getProductName());
+ }
+
+ @Test
+ public void thinClientUri() {
+ RepositoryInfo r = this.session.getRepositoryInfo();
+ Assert.assertNotNull(r);
+ String uri = r.getThinClientUri();
+ this.log.info("getThinClientUri = " + uri);
+ }
+
+ @Test
+ public void vendorName() {
+ RepositoryInfo r = this.session.getRepositoryInfo();
+ Assert.assertNotNull(r);
+ Assert.assertNotNull(r.getVendorName());
+ this.log.info("getVendorName = " + r.getVendorName());
+ }
+
+ @Test
+ public void repositoryCapabilitiesAclSupport() {
+ RepositoryInfo r = this.session.getRepositoryInfo();
+ Assert.assertNotNull(r);
+
+ // capabilities
+ RepositoryCapabilities repcap = r.getCapabilities();
+ Assert.assertNotNull(repcap);
+
+ CapabilityAcl capacl = repcap.getAclCapability();
+ Assert.assertNotNull(capacl);
+ switch (capacl) {
+ case DISCOVER:
+ case MANAGE:
+ case NONE:
+ break;
+ default:
+ Assert.fail("enumeration not supported: " + capacl);
+ }
+ this.log.info("CapabilityAcl = " + capacl);
+ }
+
+ @Test
+ public void repositoryCapabilitiesChangesSupport() {
+ RepositoryInfo r = this.session.getRepositoryInfo();
+ Assert.assertNotNull(r);
+
+ // capabilities
+ RepositoryCapabilities repcap = r.getCapabilities();
+ Assert.assertNotNull(repcap);
+ CapabilityChanges capch = repcap.getChangesCapability();
+ Assert.assertNotNull(capch);
+ switch (capch) {
+ case ALL:
+ case OBJECTIDSONLY:
+ case PROPERTIES:
+ case NONE:
+ break;
+ default:
+ Assert.fail("enumeration not supported: " + capch);
+ }
+ this.log.info("CapabilityChanges = " + capch);
+ }
+
+ @Test
+ public void repositoryCapabilitiesContentStreamUpdateabilitySupport() {
+ RepositoryInfo r = this.session.getRepositoryInfo();
+ Assert.assertNotNull(r);
+
+ // capabilities
+ RepositoryCapabilities repcap = r.getCapabilities();
+ Assert.assertNotNull(repcap);
+ CapabilityContentStreamUpdates ccsu = repcap.getContentStreamUpdatesCapability();
+ Assert.assertNotNull(ccsu);
+ switch (ccsu) {
+ case ANYTIME:
+ case NONE:
+ case PWCONLY:
+ break;
+ default:
+ Assert.fail("enumeration not supported: " + ccsu);
+ }
+ this.log.info("CapabilityContentStreamUpdates = " + ccsu);
+ }
+
+ @Test
+ public void repositoryCapabilitiesJointSupport() {
+ RepositoryInfo r = this.session.getRepositoryInfo();
+ Assert.assertNotNull(r);
+
+ // capabilities
+ RepositoryCapabilities repcap = r.getCapabilities();
+ Assert.assertNotNull(repcap);
+
+ CapabilityJoin capj = repcap.getJoinCapability();
+ Assert.assertNotNull(capj);
+
+ switch (capj) {
+ case INNERANDOUTER:
+ case INNERONLY:
+ case NONE:
+ break;
+ default:
+ Assert.fail("enumeration not supported: " + capj);
+ }
+ this.log.info("CapabilityJoin = " + capj);
+ }
+
+ @Test
+ public void repositoryCapabilitiesQuerySupport() {
+ RepositoryInfo r = this.session.getRepositoryInfo();
+ Assert.assertNotNull(r);
+
+ // capabilities
+ RepositoryCapabilities repcap = r.getCapabilities();
+ Assert.assertNotNull(repcap);
+
+ CapabilityQuery capq = repcap.getQueryCapability();
+ Assert.assertNotNull(capq);
+ switch (capq) {
+ case BOTHCOMBINED:
+ case BOTHSEPARATE:
+ case FULLTEXTONLY:
+ case METADATAONLY:
+ case NONE:
+ break;
+ default:
+ Assert.fail("enumeration not supported: " + capq);
+ }
+ this.log.info("CapabilityQuery = " + capq);
+ }
+
+ @Test
+ public void repositoryCapabilitiesRenditionSupport() {
+ RepositoryInfo r = this.session.getRepositoryInfo();
+ Assert.assertNotNull(r);
+
+ // capabilities
+ RepositoryCapabilities repcap = r.getCapabilities();
+ Assert.assertNotNull(repcap);
+
+ CapabilityRenditions caprend = repcap.getRenditionsCapability();
+ Assert.assertNotNull(caprend);
+ switch (caprend) {
+ case NONE:
+ case READ:
+ break;
+ default:
+ Assert.fail("enumeration not supported: " + caprend);
+ }
+ this.log.info("CapabilityRendition = " + caprend);
+ }
}
\ No newline at end of file
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyTypeIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyTypeIT.java?rev=934904&r1=934903&r2=934904&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyTypeIT.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyTypeIT.java Fri Apr 16 14:19:32 2010
@@ -27,8 +27,7 @@ import org.apache.chemistry.opencmis.cli
import org.apache.chemistry.opencmis.client.api.ObjectType;
import org.apache.chemistry.opencmis.client.api.PolicyType;
import org.apache.chemistry.opencmis.client.api.RelationshipType;
-import org.apache.chemistry.opencmis.client.api.Tree;
-//import org.apache.chemistry.opencmis.client.api.util.PagingList;
+import org.apache.chemistry.opencmis.client.api.Tree; //import org.apache.chemistry.opencmis.client.api.util.PagingList;
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
import org.junit.Test;
@@ -37,8 +36,7 @@ public class ReadOnlyTypeIT extends Abst
@Test
public void readOptionalBaseTypePolicy() {
try {
- ObjectType otd = this.session
- .getTypeDefinition(ObjectType.POLICY_BASETYPE_ID);
+ ObjectType otd = this.session.getTypeDefinition(ObjectType.POLICY_BASETYPE_ID);
Assert.assertTrue(otd instanceof PolicyType);
Assert.assertEquals(ObjectType.POLICY_BASETYPE_ID, otd.getId());
Assert.assertEquals(null, otd.getBaseType());
@@ -50,12 +48,10 @@ public class ReadOnlyTypeIT extends Abst
@Test
public void readOptionalBaseTypeRelation() {
try {
- ObjectType otd = this.session
- .getTypeDefinition(ObjectType.RELATIONSHIP_BASETYPE_ID);
+ ObjectType otd = this.session.getTypeDefinition(ObjectType.RELATIONSHIP_BASETYPE_ID);
Assert.assertNotNull(otd);
Assert.assertTrue(otd instanceof RelationshipType);
- Assert.assertEquals(ObjectType.RELATIONSHIP_BASETYPE_ID, otd
- .getId());
+ Assert.assertEquals(ObjectType.RELATIONSHIP_BASETYPE_ID, otd.getId());
Assert.assertEquals(null, otd.getBaseType());
} catch (CmisObjectNotFoundException e) {
// policies not supported
@@ -64,8 +60,7 @@ public class ReadOnlyTypeIT extends Abst
@Test
public void readBaseTypeDocument() {
- ObjectType otd = this.session
- .getTypeDefinition(ObjectType.DOCUMENT_BASETYPE_ID);
+ ObjectType otd = this.session.getTypeDefinition(ObjectType.DOCUMENT_BASETYPE_ID);
Assert.assertNotNull(otd);
Assert.assertTrue(otd instanceof DocumentType);
Assert.assertEquals(ObjectType.DOCUMENT_BASETYPE_ID, otd.getId());
@@ -75,8 +70,7 @@ public class ReadOnlyTypeIT extends Abst
@Test
public void readBaseTypeFolder() {
- ObjectType otf = this.session
- .getTypeDefinition(ObjectType.FOLDER_BASETYPE_ID);
+ ObjectType otf = this.session.getTypeDefinition(ObjectType.FOLDER_BASETYPE_ID);
Assert.assertNotNull(otf);
Assert.assertTrue(otf instanceof FolderType);
Assert.assertEquals(ObjectType.FOLDER_BASETYPE_ID, otf.getId());
@@ -85,56 +79,50 @@ public class ReadOnlyTypeIT extends Abst
@Test
public void readTypeChildrenDocument() {
- ObjectType otd = this.session
- .getTypeDefinition(ObjectType.DOCUMENT_BASETYPE_ID);
+ ObjectType otd = this.session.getTypeDefinition(ObjectType.DOCUMENT_BASETYPE_ID);
Assert.assertNotNull(otd);
-// PagingList<ObjectType> pc = this.session.getTypeChildren(otd.getId(),
-// true, 2);
-// Assert.assertNotNull(pc);
-//
-// for (List<ObjectType> children : pc) {
-// for (ObjectType ot1 : children) {
-// ObjectType ot2 = this.session.getTypeDefinition(ot1.getId());
-// Assert.assertEquals(ot1.getId(), ot2.getId());
-// }
-// }
+ // PagingList<ObjectType> pc = this.session.getTypeChildren(otd.getId(),
+ // true, 2);
+ // Assert.assertNotNull(pc);
+ //
+ // for (List<ObjectType> children : pc) {
+ // for (ObjectType ot1 : children) {
+ // ObjectType ot2 = this.session.getTypeDefinition(ot1.getId());
+ // Assert.assertEquals(ot1.getId(), ot2.getId());
+ // }
+ // }
}
@Test
public void readTypeChildrenFolder() {
- ObjectType otd = this.session
- .getTypeDefinition(ObjectType.FOLDER_BASETYPE_ID);
+ ObjectType otd = this.session.getTypeDefinition(ObjectType.FOLDER_BASETYPE_ID);
Assert.assertNotNull(otd);
-// PagingList<ObjectType> pc = this.session.getTypeChildren(otd.getId(),
-// true, 2);
-// Assert.assertNotNull(pc);
-//
-// for (List<ObjectType> children : pc) {
-// for (ObjectType ot1 : children) {
-// ObjectType ot2 = this.session.getTypeDefinition(ot1.getId());
-// Assert.assertEquals(ot1, ot2);
-// }
-// }
+ // PagingList<ObjectType> pc = this.session.getTypeChildren(otd.getId(),
+ // true, 2);
+ // Assert.assertNotNull(pc);
+ //
+ // for (List<ObjectType> children : pc) {
+ // for (ObjectType ot1 : children) {
+ // ObjectType ot2 = this.session.getTypeDefinition(ot1.getId());
+ // Assert.assertEquals(ot1, ot2);
+ // }
+ // }
}
@Test
public void readTypeDescandantsDocument() {
- ObjectType otd = this.session
- .getTypeDefinition(ObjectType.DOCUMENT_BASETYPE_ID);
+ ObjectType otd = this.session.getTypeDefinition(ObjectType.DOCUMENT_BASETYPE_ID);
Assert.assertNotNull(otd);
- List<Tree<ObjectType>> desc = this.session.getTypeDescendants(otd
- .getId(), 1, true);
+ List<Tree<ObjectType>> desc = this.session.getTypeDescendants(otd.getId(), 1, true);
Assert.assertNotNull(desc);
Assert.assertFalse(desc.isEmpty());
}
@Test
public void readTypeDescandantsFolder() {
- ObjectType otd = this.session
- .getTypeDefinition(ObjectType.FOLDER_BASETYPE_ID);
+ ObjectType otd = this.session.getTypeDefinition(ObjectType.FOLDER_BASETYPE_ID);
Assert.assertNotNull(otd);
- List<Tree<ObjectType>> desc = this.session.getTypeDescendants(otd
- .getId(), 1, true);
+ List<Tree<ObjectType>> desc = this.session.getTypeDescendants(otd.getId(), 1, true);
Assert.assertNotNull(desc);
desc.isEmpty();
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/WriteObjectIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/WriteObjectIT.java?rev=934904&r1=934903&r2=934904&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/WriteObjectIT.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/WriteObjectIT.java Fri Apr 16 14:19:32 2010
@@ -39,246 +39,196 @@ import org.junit.Test;
public class WriteObjectIT extends AbstractSessionTest {
- @Test
- public void createFolder() {
- ObjectId parentId = this.session
- .createObjectId(Fixture.getTestRootId());
- String folderName = UUID.randomUUID().toString();
- String typeId = FixtureData.FOLDER_TYPE_ID.value();
-
-
- /*
- ObjectType ot = this.session.getTypeDefinition(typeId);
- Collection<PropertyDefinition<?>> pdefs = ot.getPropertyDefintions()
- .values();
- List<Property<?>> properties = new ArrayList<Property<?>>();
- Property<?> prop = null;
-
- for (PropertyDefinition<?> pd : pdefs) {
- try {
- CmisProperties cmisp = CmisProperties.fromValue(pd.getId());
- switch (cmisp) {
- case NAME:
- prop = this.session.getObjectFactory().createProperty(pd,
- folderName);
- properties.add(prop);
- break;
- case OBJECT_TYPE_ID:
- prop = this.session.getObjectFactory().createProperty(pd,
- typeId);
- properties.add(prop);
- break;
- default:
- break;
- }
- } catch (Exception e) {
- // custom property definition
- }
-
- }
- */
-
- Map<String, Object> properties = new HashMap<String, Object>();
- properties.put(PropertyIds.NAME, folderName);
- properties.put(PropertyIds.OBJECT_TYPE_ID, typeId);
-
- ObjectId id = this.session.createFolder(properties, parentId, null,
- null, null);
- assertNotNull(id);
- }
-
- @Test
- public void createDocument() throws IOException {
- ObjectId parentId = this.session
- .createObjectId(Fixture.getTestRootId());
- String folderName = UUID.randomUUID().toString();
- String typeId = FixtureData.DOCUMENT_TYPE_ID.value();
-
- /*
- ObjectType ot = this.session.getTypeDefinition(typeId);
- Collection<PropertyDefinition<?>> pdefs = ot.getPropertyDefintions()
- .values();
- List<Property<?>> properties = new ArrayList<Property<?>>();
- Property<?> prop = null;
-
- for (PropertyDefinition<?> pd : pdefs) {
- try {
- CmisProperties cmisp = CmisProperties.fromValue(pd.getId());
- switch (cmisp) {
- case NAME:
- prop = this.session.getObjectFactory().createProperty(pd,
- folderName);
- properties.add(prop);
- break;
- case OBJECT_TYPE_ID:
- prop = this.session.getObjectFactory().createProperty(pd,
- typeId);
- properties.add(prop);
- break;
- default:
- break;
- }
- } catch (Exception e) {
- /*
- * custom property definition (note: document type should not
- * have further mandatory properties)
- */
-/* this.log
- .info(
- "Custom property found but not supported in test case!",
- e);
- }
- }
-*/
-
- Map<String, Object> properties = new HashMap<String, Object>();
- properties.put(PropertyIds.NAME, folderName);
- properties.put(PropertyIds.OBJECT_TYPE_ID, typeId);
-
- String filename = UUID.randomUUID().toString();
- String mimetype = "text/html; charset=UTF-8";
- String content1 = "Im Walde rauscht ein Wasserfall. Wenn's nicht mehr rauscht ist's Wasser all.";
-
- byte[] buf1 = content1.getBytes("UTF-8");
- ByteArrayInputStream in1 = new ByteArrayInputStream(buf1);
- ContentStream contentStream = this.session.getObjectFactory()
- .createContentStream(filename, buf1.length, mimetype, in1);
- assertNotNull(contentStream);
-
- ObjectId id = this.session.createDocument(properties, parentId,
- contentStream, VersioningState.NONE, null, null, null);
- assertNotNull(id);
-
- // verify content
- Document doc = (Document) this.session.getObject(id);
- assertNotNull(doc);
- // Assert.assertEquals(buf1.length, doc.getContentStreamLength());
- // Assert.assertEquals(mimetype, doc.getContentStreamMimeType());
- // Assert.assertEquals(filename, doc.getContentStreamFileName());
- String content2 = this.getContentAsString(doc.getContentStream());
- assertEquals(content1, content2);
- }
-
- @Test
- public void createDocumentFromSource() throws IOException {
- try {
- // verify content
- String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME + "/"
- + FixtureData.DOCUMENT1_NAME;
- Document srcDocument = (Document) this.session
- .getObjectByPath(path);
- assertNotNull("Document not found: " + path, srcDocument);
- String srcContent = this.getContentAsString(srcDocument
- .getContentStream());
-
- ObjectId parentFolder = session.createObjectId(Fixture
- .getTestRootId());
- /*
- List<Property<?>> srcProperties = srcDocument.getProperties();
- assertNotNull(srcProperties);
- List<Property<?>> dstProperties = new ArrayList<Property<?>>();
-
- for (Property<?> p : srcProperties) {
- if (p.getId().equalsIgnoreCase(CmisProperties.NAME.value())) {
- // change the name
- String name = UUID.randomUUID().toString();
- Property<String> pn = this.session.getObjectFactory()
- .createProperty(p.getDefinition(), name);
- dstProperties.add(pn);
- } else {
- dstProperties.add(p);
- }
- }
-*/
- String name = UUID.randomUUID().toString();
-
- Map<String, Object> properties = new HashMap<String, Object>();
- properties.put(PropertyIds.NAME, name);
-
- ObjectId dstDocumentId = this.session.createDocumentFromSource(
- srcDocument, properties, parentFolder,
- VersioningState.NONE, null, null, null);
- assertNotNull(dstDocumentId);
- Document dstDocument = (Document) this.session
- .getObject(dstDocumentId);
- String dstContent = this.getContentAsString(dstDocument
- .getContentStream());
- assertEquals(srcContent, dstContent);
-
- } catch (CmisNotSupportedException e) {
- // not an error
- this.log.info(e.getMessage());
- }
- }
-
- @Test
- public void deleteAndCreateContent() throws IOException {
- // verify content
-
- String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME + "/"
- + FixtureData.DOCUMENT1_NAME;
- Document document = (Document) this.session.getObjectByPath(path);
- assertNotNull("Document not found: " + path, document);
-
- // check default content
- ContentStream contentStream = document.getContentStream();
- assertNotNull(contentStream);
- String contentString = this.getContentAsString(contentStream);
- assertNotNull(contentString);
-
- // delete and set new content
- // ObjectId id = (return id not supported by AtomPub)
- document.deleteContentStream();
- // assertNotNull(id);
-
- String filename = UUID.randomUUID().toString();
- String mimetype = "text/html; charset=UTF-8";
- String content1 = "Im Walde rauscht ein Wasserfall. Wenn's nicht mehr rauscht ist's Wasser all.";
-
- byte[] buf1 = content1.getBytes("UTF-8");
- ByteArrayInputStream in1 = new ByteArrayInputStream(buf1);
- contentStream = this.session.getObjectFactory().createContentStream(
- filename, buf1.length, mimetype, in1);
- assertNotNull(contentStream);
-
- document.setContentStream(contentStream, true);
-
- // check default content
- ContentStream contentStream2 = document.getContentStream();
- assertNotNull(contentStream2);
- String contentString2 = this.getContentAsString(contentStream2);
- assertNotNull(contentString2);
-
- assertEquals(content1, contentString2);
- }
-
- @Test
- public void updateProperties() {
- // verify content
- String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME + "/"
- + FixtureData.DOCUMENT1_NAME;
- Document document = (Document) this.session.getObjectByPath(path);
- assertNotNull("Document not found: " + path, document);
-
- document.setProperty(PropertyIds.NAME, "Neuer Name");
- document.updateProperties();
- assertTrue(true);
- }
-
- private String getContentAsString(ContentStream stream) throws IOException {
- assertNotNull(stream);
- InputStream in2 = stream.getStream();
- assertNotNull(in2);
- StringBuffer sbuf = null;
- sbuf = new StringBuffer(in2.available());
- int count;
- byte[] buf2 = new byte[100];
- while ((count = in2.read(buf2)) != -1) {
- for (int i = 0; i < count; i++) {
- sbuf.append((char) buf2[i]);
- }
- }
- in2.close();
- return sbuf.toString();
- }
+ @Test
+ public void createFolder() {
+ ObjectId parentId = this.session.createObjectId(Fixture.getTestRootId());
+ String folderName = UUID.randomUUID().toString();
+ String typeId = FixtureData.FOLDER_TYPE_ID.value();
+
+ /*
+ * ObjectType ot = this.session.getTypeDefinition(typeId);
+ * Collection<PropertyDefinition<?>> pdefs = ot.getPropertyDefintions()
+ * .values(); List<Property<?>> properties = new
+ * ArrayList<Property<?>>(); Property<?> prop = null;
+ *
+ * for (PropertyDefinition<?> pd : pdefs) { try { CmisProperties cmisp =
+ * CmisProperties.fromValue(pd.getId()); switch (cmisp) { case NAME:
+ * prop = this.session.getObjectFactory().createProperty(pd,
+ * folderName); properties.add(prop); break; case OBJECT_TYPE_ID: prop =
+ * this.session.getObjectFactory().createProperty(pd, typeId);
+ * properties.add(prop); break; default: break; } } catch (Exception e)
+ * { // custom property definition }
+ *
+ * }
+ */
+
+ Map<String, Object> properties = new HashMap<String, Object>();
+ properties.put(PropertyIds.NAME, folderName);
+ properties.put(PropertyIds.OBJECT_TYPE_ID, typeId);
+
+ ObjectId id = this.session.createFolder(properties, parentId, null, null, null);
+ assertNotNull(id);
+ }
+
+ @Test
+ public void createDocument() throws IOException {
+ ObjectId parentId = this.session.createObjectId(Fixture.getTestRootId());
+ String folderName = UUID.randomUUID().toString();
+ String typeId = FixtureData.DOCUMENT_TYPE_ID.value();
+
+ /*
+ * ObjectType ot = this.session.getTypeDefinition(typeId);
+ * Collection<PropertyDefinition<?>> pdefs = ot.getPropertyDefintions()
+ * .values(); List<Property<?>> properties = new
+ * ArrayList<Property<?>>(); Property<?> prop = null;
+ *
+ * for (PropertyDefinition<?> pd : pdefs) { try { CmisProperties cmisp =
+ * CmisProperties.fromValue(pd.getId()); switch (cmisp) { case NAME:
+ * prop = this.session.getObjectFactory().createProperty(pd,
+ * folderName); properties.add(prop); break; case OBJECT_TYPE_ID: prop =
+ * this.session.getObjectFactory().createProperty(pd, typeId);
+ * properties.add(prop); break; default: break; } } catch (Exception e)
+ * { /* custom property definition (note: document type should not have
+ * further mandatory properties)
+ */
+ /*
+ * this.log .info(
+ * "Custom property found but not supported in test case!", e); } }
+ */
+
+ Map<String, Object> properties = new HashMap<String, Object>();
+ properties.put(PropertyIds.NAME, folderName);
+ properties.put(PropertyIds.OBJECT_TYPE_ID, typeId);
+
+ String filename = UUID.randomUUID().toString();
+ String mimetype = "text/html; charset=UTF-8";
+ String content1 = "Im Walde rauscht ein Wasserfall. Wenn's nicht mehr rauscht ist's Wasser all.";
+
+ byte[] buf1 = content1.getBytes("UTF-8");
+ ByteArrayInputStream in1 = new ByteArrayInputStream(buf1);
+ ContentStream contentStream = this.session.getObjectFactory().createContentStream(filename, buf1.length,
+ mimetype, in1);
+ assertNotNull(contentStream);
+
+ ObjectId id = this.session.createDocument(properties, parentId, contentStream, VersioningState.NONE, null,
+ null, null);
+ assertNotNull(id);
+
+ // verify content
+ Document doc = (Document) this.session.getObject(id);
+ assertNotNull(doc);
+ // Assert.assertEquals(buf1.length, doc.getContentStreamLength());
+ // Assert.assertEquals(mimetype, doc.getContentStreamMimeType());
+ // Assert.assertEquals(filename, doc.getContentStreamFileName());
+ String content2 = this.getContentAsString(doc.getContentStream());
+ assertEquals(content1, content2);
+ }
+
+ @Test
+ public void createDocumentFromSource() throws IOException {
+ try {
+ // verify content
+ String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME + "/" + FixtureData.DOCUMENT1_NAME;
+ Document srcDocument = (Document) this.session.getObjectByPath(path);
+ assertNotNull("Document not found: " + path, srcDocument);
+ String srcContent = this.getContentAsString(srcDocument.getContentStream());
+
+ ObjectId parentFolder = session.createObjectId(Fixture.getTestRootId());
+ /*
+ * List<Property<?>> srcProperties = srcDocument.getProperties();
+ * assertNotNull(srcProperties); List<Property<?>> dstProperties =
+ * new ArrayList<Property<?>>();
+ *
+ * for (Property<?> p : srcProperties) { if
+ * (p.getId().equalsIgnoreCase(CmisProperties.NAME.value())) { //
+ * change the name String name = UUID.randomUUID().toString();
+ * Property<String> pn = this.session.getObjectFactory()
+ * .createProperty(p.getDefinition(), name); dstProperties.add(pn);
+ * } else { dstProperties.add(p); } }
+ */
+ String name = UUID.randomUUID().toString();
+
+ Map<String, Object> properties = new HashMap<String, Object>();
+ properties.put(PropertyIds.NAME, name);
+
+ ObjectId dstDocumentId = this.session.createDocumentFromSource(srcDocument, properties, parentFolder,
+ VersioningState.NONE, null, null, null);
+ assertNotNull(dstDocumentId);
+ Document dstDocument = (Document) this.session.getObject(dstDocumentId);
+ String dstContent = this.getContentAsString(dstDocument.getContentStream());
+ assertEquals(srcContent, dstContent);
+
+ } catch (CmisNotSupportedException e) {
+ // not an error
+ this.log.info(e.getMessage());
+ }
+ }
+
+ @Test
+ public void deleteAndCreateContent() throws IOException {
+ // verify content
+
+ String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME + "/" + FixtureData.DOCUMENT1_NAME;
+ Document document = (Document) this.session.getObjectByPath(path);
+ assertNotNull("Document not found: " + path, document);
+
+ // check default content
+ ContentStream contentStream = document.getContentStream();
+ assertNotNull(contentStream);
+ String contentString = this.getContentAsString(contentStream);
+ assertNotNull(contentString);
+
+ // delete and set new content
+ // ObjectId id = (return id not supported by AtomPub)
+ document.deleteContentStream();
+ // assertNotNull(id);
+
+ String filename = UUID.randomUUID().toString();
+ String mimetype = "text/html; charset=UTF-8";
+ String content1 = "Im Walde rauscht ein Wasserfall. Wenn's nicht mehr rauscht ist's Wasser all.";
+
+ byte[] buf1 = content1.getBytes("UTF-8");
+ ByteArrayInputStream in1 = new ByteArrayInputStream(buf1);
+ contentStream = this.session.getObjectFactory().createContentStream(filename, buf1.length, mimetype, in1);
+ assertNotNull(contentStream);
+
+ document.setContentStream(contentStream, true);
+
+ // check default content
+ ContentStream contentStream2 = document.getContentStream();
+ assertNotNull(contentStream2);
+ String contentString2 = this.getContentAsString(contentStream2);
+ assertNotNull(contentString2);
+
+ assertEquals(content1, contentString2);
+ }
+
+ @Test
+ public void updateProperties() {
+ // verify content
+ String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME + "/" + FixtureData.DOCUMENT1_NAME;
+ Document document = (Document) this.session.getObjectByPath(path);
+ assertNotNull("Document not found: " + path, document);
+
+ document.setProperty(PropertyIds.NAME, "Neuer Name");
+ document.updateProperties();
+ assertTrue(true);
+ }
+
+ private String getContentAsString(ContentStream stream) throws IOException {
+ assertNotNull(stream);
+ InputStream in2 = stream.getStream();
+ assertNotNull(in2);
+ StringBuffer sbuf = null;
+ sbuf = new StringBuffer(in2.available());
+ int count;
+ byte[] buf2 = new byte[100];
+ while ((count = in2.read(buf2)) != -1) {
+ for (int i = 0; i < count; i++) {
+ sbuf.append((char) buf2[i]);
+ }
+ }
+ in2.close();
+ return sbuf.toString();
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/suite/SuiteAtomPubIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/suite/SuiteAtomPubIT.java?rev=934904&r1=934903&r2=934904&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/suite/SuiteAtomPubIT.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/suite/SuiteAtomPubIT.java Fri Apr 16 14:19:32 2010
@@ -23,7 +23,7 @@ import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
-@SuiteClasses( {} )
+@SuiteClasses( {})
public class SuiteAtomPubIT {
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/suite/SuiteWebServiceIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/suite/SuiteWebServiceIT.java?rev=934904&r1=934903&r2=934904&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/suite/SuiteWebServiceIT.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/suite/SuiteWebServiceIT.java Fri Apr 16 14:19:32 2010
@@ -23,10 +23,10 @@ import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
-@SuiteClasses( { })
+@SuiteClasses( {})
public class SuiteWebServiceIT {
static {
- // TODO SKL not working
+ // TODO SKL not working
// Fixture.enableWebServices();
}
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/sample/AbstractSampleIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/sample/AbstractSampleIT.java?rev=934904&r1=934903&r2=934904&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/sample/AbstractSampleIT.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/sample/AbstractSampleIT.java Fri Apr 16 14:19:32 2010
@@ -39,136 +39,136 @@ import org.junit.Test;
/**
* Sample test case that demonstrates how to build integration tests.
- *
+ *
* @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
- *
+ *
*/
public abstract class AbstractSampleIT {
- private static Session fSession;
+ private static Session fSession;
- /**
- * Returns the current Session object.
- */
- protected Session getSession() {
- return fSession;
- }
-
- /**
- * Returns a new Session object.
- */
- protected abstract Session createSession();
-
- @BeforeClass
- public static void setUpClass() {
- fSession = null;
- }
-
- @Before
- public void setUp() {
- if (fSession == null) {
- fSession = createSession();
- }
- }
-
- /**
- * Simple repository info test.
- */
- @Test
- public void testRepositoryInfo() {
- RepositoryInfo ri = getSession().getRepositoryInfo();
- assertNotNull(ri);
- assertEquals(SessionFactory.getRepositoryId(), ri.getId());
- assertNotNull(ri.getName());
- assertNotNull(ri.getRootFolderId());
- assertNotNull(ri.getCmisVersionSupported());
- assertNotNull(ri.getCapabilities());
- //assertNotNull(ri.getAclCapabilities());
- }
-
- /**
- * Simple types test.
- */
- @Test
- public void testTypes() {
- String documentBaseId = "cmis:document";
- String folderBaseId = "cmis:folder";
-
- // check document type definition
- ObjectType documentType = getSession().getTypeDefinition(documentBaseId);
- checkBaseType(documentBaseId, BaseTypeId.CMIS_DOCUMENT, documentType);
-
- // check folder type definition
- ObjectType folderType = getSession().getTypeDefinition(folderBaseId);
- checkBaseType(folderBaseId, BaseTypeId.CMIS_FOLDER, folderType);
-
- // get base types via getTypesChildren
- PagingList<ObjectType> baseTypes = getSession().getTypeChildren(null, true, 10);
- assertNotNull(baseTypes);
-
- List<ObjectType> baseTypePage = baseTypes.get(0);
- assertNotNull(baseTypePage);
- assertTrue(baseTypePage.size() >= 2);
- assertTrue(baseTypePage.size() <= 4);
-
- assertEquals(1, baseTypes.size());
- assertEquals(baseTypePage.size(), baseTypes.getNumItems());
-
- boolean hasDocumentBaseType = false;
- boolean hasFolderBaseType = false;
- for (ObjectType ot : baseTypePage) {
- checkBaseType(null, null, ot);
-
- if (ot.getId().equals(documentBaseId)) {
- hasDocumentBaseType = true;
- }
-
- if (ot.getId().equals(folderBaseId)) {
- hasFolderBaseType = true;
- }
- }
-
- assertTrue(hasDocumentBaseType);
- assertTrue(hasFolderBaseType);
-
- // get base types via getTypeDescendants
- List<Tree<ObjectType>> baseTypeDesc = getSession().getTypeDescendants(null, -1, true);
- assertNotNull(baseTypeDesc);
-
- hasDocumentBaseType = false;
- hasFolderBaseType = false;
- for (Tree<ObjectType> cot : baseTypeDesc) {
- assertNotNull(cot);
- //checkBaseType(null, null, cot.getItem());
-
- if (cot.getItem().getId().equals(documentBaseId)) {
- hasDocumentBaseType = true;
- }
-
- if (cot.getItem().getId().equals(folderBaseId)) {
- hasFolderBaseType = true;
- }
- }
-
- assertTrue(hasDocumentBaseType);
- assertTrue(hasFolderBaseType);
- }
-
- /**
- * Checks a base type.
- */
- private void checkBaseType(String id, BaseTypeId baseType, ObjectType objectType) {
- assertNotNull(objectType);
- if (id != null) {
- assertEquals(id, objectType.getId());
- }
- if (baseType != null) {
- assertEquals(baseType, objectType.getBaseTypeId());
- }
- assertTrue(objectType.isBaseType());
- assertNull(objectType.getBaseType());
- assertNull(objectType.getParentType());
- assertNotNull(objectType.getPropertyDefinitions());
- assertFalse(objectType.getPropertyDefinitions().isEmpty());
- }
+ /**
+ * Returns the current Session object.
+ */
+ protected Session getSession() {
+ return fSession;
+ }
+
+ /**
+ * Returns a new Session object.
+ */
+ protected abstract Session createSession();
+
+ @BeforeClass
+ public static void setUpClass() {
+ fSession = null;
+ }
+
+ @Before
+ public void setUp() {
+ if (fSession == null) {
+ fSession = createSession();
+ }
+ }
+
+ /**
+ * Simple repository info test.
+ */
+ @Test
+ public void testRepositoryInfo() {
+ RepositoryInfo ri = getSession().getRepositoryInfo();
+ assertNotNull(ri);
+ assertEquals(SessionFactory.getRepositoryId(), ri.getId());
+ assertNotNull(ri.getName());
+ assertNotNull(ri.getRootFolderId());
+ assertNotNull(ri.getCmisVersionSupported());
+ assertNotNull(ri.getCapabilities());
+ // assertNotNull(ri.getAclCapabilities());
+ }
+
+ /**
+ * Simple types test.
+ */
+ @Test
+ public void testTypes() {
+ String documentBaseId = "cmis:document";
+ String folderBaseId = "cmis:folder";
+
+ // check document type definition
+ ObjectType documentType = getSession().getTypeDefinition(documentBaseId);
+ checkBaseType(documentBaseId, BaseTypeId.CMIS_DOCUMENT, documentType);
+
+ // check folder type definition
+ ObjectType folderType = getSession().getTypeDefinition(folderBaseId);
+ checkBaseType(folderBaseId, BaseTypeId.CMIS_FOLDER, folderType);
+
+ // get base types via getTypesChildren
+ PagingList<ObjectType> baseTypes = getSession().getTypeChildren(null, true, 10);
+ assertNotNull(baseTypes);
+
+ List<ObjectType> baseTypePage = baseTypes.get(0);
+ assertNotNull(baseTypePage);
+ assertTrue(baseTypePage.size() >= 2);
+ assertTrue(baseTypePage.size() <= 4);
+
+ assertEquals(1, baseTypes.size());
+ assertEquals(baseTypePage.size(), baseTypes.getNumItems());
+
+ boolean hasDocumentBaseType = false;
+ boolean hasFolderBaseType = false;
+ for (ObjectType ot : baseTypePage) {
+ checkBaseType(null, null, ot);
+
+ if (ot.getId().equals(documentBaseId)) {
+ hasDocumentBaseType = true;
+ }
+
+ if (ot.getId().equals(folderBaseId)) {
+ hasFolderBaseType = true;
+ }
+ }
+
+ assertTrue(hasDocumentBaseType);
+ assertTrue(hasFolderBaseType);
+
+ // get base types via getTypeDescendants
+ List<Tree<ObjectType>> baseTypeDesc = getSession().getTypeDescendants(null, -1, true);
+ assertNotNull(baseTypeDesc);
+
+ hasDocumentBaseType = false;
+ hasFolderBaseType = false;
+ for (Tree<ObjectType> cot : baseTypeDesc) {
+ assertNotNull(cot);
+ // checkBaseType(null, null, cot.getItem());
+
+ if (cot.getItem().getId().equals(documentBaseId)) {
+ hasDocumentBaseType = true;
+ }
+
+ if (cot.getItem().getId().equals(folderBaseId)) {
+ hasFolderBaseType = true;
+ }
+ }
+
+ assertTrue(hasDocumentBaseType);
+ assertTrue(hasFolderBaseType);
+ }
+
+ /**
+ * Checks a base type.
+ */
+ private void checkBaseType(String id, BaseTypeId baseType, ObjectType objectType) {
+ assertNotNull(objectType);
+ if (id != null) {
+ assertEquals(id, objectType.getId());
+ }
+ if (baseType != null) {
+ assertEquals(baseType, objectType.getBaseTypeId());
+ }
+ assertTrue(objectType.isBaseType());
+ assertNull(objectType.getBaseType());
+ assertNull(objectType.getParentType());
+ assertNotNull(objectType.getPropertyDefinitions());
+ assertFalse(objectType.getPropertyDefinitions().isEmpty());
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/sample/AtomPubSampleIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/sample/AtomPubSampleIT.java?rev=934904&r1=934903&r2=934904&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/sample/AtomPubSampleIT.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/sample/AtomPubSampleIT.java Fri Apr 16 14:19:32 2010
@@ -29,9 +29,9 @@ import org.apache.chemistry.opencmis.fit
*/
public class AtomPubSampleIT extends AbstractSampleIT {
- @Override
- protected Session createSession() {
- return SessionFactory.createAtomPubSession();
- }
-
+ @Override
+ protected Session createSession() {
+ return SessionFactory.createAtomPubSession();
+ }
+
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/sample/WebServicesSampleIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/sample/WebServicesSampleIT.java?rev=934904&r1=934903&r2=934904&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/sample/WebServicesSampleIT.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/sample/WebServicesSampleIT.java Fri Apr 16 14:19:32 2010
@@ -29,9 +29,9 @@ import org.apache.chemistry.opencmis.fit
*/
public class WebServicesSampleIT extends AbstractSampleIT {
- @Override
- protected Session createSession() {
- return SessionFactory.createWebServicesSession();
- }
+ @Override
+ protected Session createSession() {
+ return SessionFactory.createWebServicesSession();
+ }
}