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/22 18:28:00 UTC

svn commit: r936938 [25/29] - in /incubator/chemistry/opencmis/trunk/chemistry-opencmis-server: chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/ chemistry-opencmis-server-bindings/src/main/java/org/apache/chem...

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/VersioningTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/VersioningTest.java?rev=936938&r1=936937&r2=936938&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/VersioningTest.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/VersioningTest.java Thu Apr 22 16:27:57 2010
@@ -61,641 +61,641 @@ import org.junit.Before;
 import org.junit.Test;
 
 public class VersioningTest extends AbstractServiceTst {
-	private static Log log = LogFactory.getLog(ObjectServiceTest.class);
-	private static final String PROP_VALUE = "Mickey Mouse";
-	private static final String PROP_VALUE_NEW = "Donald Duck";
-	private static final String PROP_NAME = "My Versioned Document";
-	private static final String TEST_USER = "TestUser";
-	private static final String TEST_USER_2 = "OtherUser";
-
-	ObjectCreator fCreator;
-
-	@Before
-	public void setUp() throws Exception {
-		super.setTypeCreatorClass(VersionTestTypeSystemCreator.class.getName());
-		super.setUp();
-		fCreator = new ObjectCreator(fFactory, fObjSvc, fRepositoryId);
-		setRuntimeContext(TEST_USER);
-	}
-
-	@After
-	public void tearDown() throws Exception {
-		super.tearDown();
-	}
-
-	private void setRuntimeContext(String user) {
-
-		/*
-		 * DummyCallContext ctx = new DummyCallContext();
-		 * ctx.put(CallContext.USERNAME, user); // Attach the CallContext to a
-		 * thread local context that can be accessed from everywhere
-		 * RuntimeContext.attachCfg(ctx);
-		 */
-		fTestCallContext.put(CallContext.USERNAME, user);
-	}
-
-	@Test
-	public void testCreateVersionedDocumentMinor() {
-		createVersionedDocument(VersioningState.MINOR);
-	}
-
-	@Test
-	public void testCreateVersionedDocumentCheckedOut() {
-		createVersionedDocument(VersioningState.CHECKEDOUT);
-	}
-
-	@Test
-	public void testCreateVersionedDocumentNone() {
-		try {
-			createVersionedDocument(VersioningState.NONE);
-			fail("creating a document of a versionable type with state VersioningState.NONE should fail.");
-		} catch (Exception e) {
-			assertEquals(CmisConstraintException.class, e.getClass());
-		}
-	}
-
-	@Test
-	public void testCheckOutBasic() {
-		String verId = createDocument(PROP_NAME, fRootFolderId, VersioningState.MAJOR);
-
-		ObjectData version = fObjSvc.getObject(fRepositoryId, verId, "*", false, IncludeRelationships.NONE, null,
-				false, false, null);
-		String docId = getVersionSeriesId(verId, version.getProperties().getProperties());
-		assertTrue(null != docId && docId.length() > 0);
-
-		assertFalse(isCheckedOut(docId));
-
-		Holder<Boolean> contentCopied = new Holder<Boolean>();
-		Holder<String> idHolder = new Holder<String>(verId); // or should this
-		// be version
-		// series?
-		fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
-		String pwcId = idHolder.getValue();
-		// test that object is checked out and that all properties are set
-		// correctly
-		Properties props = fObjSvc.getProperties(fRepositoryId, pwcId, "*", null);
-		String changeToken = (String) props.getProperties().get(PropertyIds.CHANGE_TOKEN).getFirstValue();
-		checkVersionProperties(pwcId, VersioningState.CHECKEDOUT, props.getProperties(), null);
-
-		// Test that a second checkout is not possible
-		try {
-			fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
-			fail("Checking out a document that is already checked-out should fail.");
-		} catch (Exception e) {
-			assertTrue(e instanceof CmisUpdateConflictException);
-		}
-		// version and version series should be checked out now
-		assertTrue(isCheckedOut(docId));
-		assertTrue(isCheckedOut(pwcId));
-
-		// Set a new content and modify property
-		ContentStream altContent = fCreator.createAlternateContent();
-		idHolder = new Holder<String>(pwcId);
-		Holder<String> tokenHolder = new Holder<String>(changeToken);
-		fObjSvc.setContentStream(fRepositoryId, idHolder, true, tokenHolder, altContent, null);
-		fCreator.updateProperty(idHolder.getValue(), VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE_NEW);
-
-		// Test that a check-in as same user is possible
-		String checkinComment = "Checkin without content and properties.";
-		fVerSvc.checkIn(fRepositoryId, idHolder, true, null, null, checkinComment, null, null, null, null);
-		// Neither the version nor the version series should be checked out any
-		// longer:
-		assertFalse(isCheckedOut(idHolder.getValue()));
-		assertFalse(isCheckedOut(docId));
-		ContentStream retrievedContent = fObjSvc.getContentStream(fRepositoryId, idHolder.getValue(), null, BigInteger
-				.valueOf(-1) /* offset */, BigInteger.valueOf(-1) /* length */, null);
-		assertTrue(fCreator.verifyContent(fCreator.createAlternateContent(), retrievedContent));
-		assertTrue(fCreator.verifyProperty(idHolder.getValue(), VersionTestTypeSystemCreator.PROPERTY_ID,
-				PROP_VALUE_NEW));
-
-		List<ObjectData> allVersions = fVerSvc.getAllVersions(fRepositoryId, docId, docId, "*", false, null);
-		assertEquals(2, allVersions.size());
-	}
-
-	@Test
-	public void testCheckInWithContent() {
-		String verId = createDocument(PROP_NAME, fRootFolderId, VersioningState.MAJOR);
-
-		ObjectData version = fObjSvc.getObject(fRepositoryId, verId, "*", false, IncludeRelationships.NONE, null,
-				false, false, null);
-		String docId = getVersionSeriesId(verId, version.getProperties().getProperties());
-		assertTrue(null != docId && docId.length() > 0);
-
-		assertFalse(isCheckedOut(docId));
-
-		Holder<Boolean> contentCopied = new Holder<Boolean>();
-		Holder<String> idHolder = new Holder<String>(verId); // or should this
-		// be version
-		// series?
-		fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
-		String pwcId = idHolder.getValue();
-
-		ContentStream altContent = fCreator.createAlternateContent();
-		Properties newProps = fCreator.getUpdatePropertyList(VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE_NEW);
-		idHolder = new Holder<String>(pwcId);
-		assertTrue(isCheckedOut(docId));
-		assertTrue(isCheckedOut(pwcId));
-
-		// Test check-in and pass content and properties
-		String checkinComment = "Checkin with content and properties.";
-		fVerSvc.checkIn(fRepositoryId, idHolder, true, newProps, altContent, checkinComment, null, null, null, null);
-		// Neither the version nor the version series should be checked out any
-		// longer:
-		assertFalse(isCheckedOut(idHolder.getValue()));
-		assertFalse(isCheckedOut(docId));
-		ContentStream retrievedContent = fObjSvc.getContentStream(fRepositoryId, idHolder.getValue(), null, BigInteger
-				.valueOf(-1) /* offset */, BigInteger.valueOf(-1) /* length */, null);
-
-		// New content and property should be set
-		assertTrue(fCreator.verifyContent(fCreator.createAlternateContent(), retrievedContent));
-		assertTrue(fCreator.verifyProperty(idHolder.getValue(), VersionTestTypeSystemCreator.PROPERTY_ID,
-				PROP_VALUE_NEW));
-	}
-
-	@Test
-	public void testCheckOutAndOtherUser() {
-		String verId = createDocument(PROP_NAME, fRootFolderId, VersioningState.MAJOR);
-		ObjectData version = fObjSvc.getObject(fRepositoryId, verId, "*", false, IncludeRelationships.NONE, null,
-				false, false, null);
-		String docId = getVersionSeriesId(verId, version.getProperties().getProperties());
-		assertTrue(null != docId && docId.length() > 0);
-		assertFalse(isCheckedOut(docId));
-		Holder<Boolean> contentCopied = new Holder<Boolean>();
-		Holder<String> idHolder = new Holder<String>(verId); // or should this
-		// be version
-		// series?
-		fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
-		String pwcId = idHolder.getValue();
-
-		// Test that a checkin as another user is not possible
-		setRuntimeContext(TEST_USER_2);
-		try {
-			fVerSvc.checkIn(fRepositoryId, idHolder, true, null, null, "My Comment", null, null, null, null);
-			fail("Checking in a document as another user should fail.");
-		} catch (Exception e) {
-			assertTrue(e instanceof CmisUpdateConflictException);
-		}
-
-		// Test that a cancel checkout as another user is not possible
-		try {
-			fVerSvc.cancelCheckOut(fRepositoryId, pwcId, null);
-			fail("Checking in a document as another user should fail.");
-		} catch (Exception e) {
-			assertTrue(e instanceof CmisUpdateConflictException);
-		}
-
-		// Test that an updateProperties as another user is not possible
-		try {
-			fCreator.updateProperty(pwcId, VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE_NEW);
-			fail("updateProperty in a document as another user should fail.");
-		} catch (Exception e) {
-			assertTrue(e instanceof CmisUpdateConflictException);
-		}
-
-		ContentStream altContent = fCreator.createAlternateContent();
-		Holder<String> pwcHolder = new Holder<String>(pwcId);
-		try {
-			fObjSvc.setContentStream(fRepositoryId, pwcHolder, true, null, altContent, null);
-			fail("setContentStream in a document as another user should fail.");
-		} catch (Exception e) {
-			assertTrue(e instanceof CmisUpdateConflictException);
-		}
-
-		setRuntimeContext(TEST_USER);
-		// Test that a check-in as same user is possible
-		fVerSvc.checkIn(fRepositoryId, pwcHolder, true, null, null, "testCheckOutAndOtherUser", null, null, null, null);
-
-		// Because nothing was changed we should have a new version with
-		// identical content
-		ContentStream retrievedContent = fObjSvc.getContentStream(fRepositoryId, pwcHolder.getValue(), null, BigInteger
-				.valueOf(-1) /* offset */, BigInteger.valueOf(-1) /* length */, null);
-		assertTrue(fCreator.verifyContent(retrievedContent, fCreator.createContent()));
-		assertTrue(fCreator.verifyProperty(idHolder.getValue(), VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE));
-	}
-
-	@Test
-	public void testCancelCheckout() {
-		String verId = createDocument(PROP_NAME, fRootFolderId, VersioningState.MAJOR);
-		ObjectData version = fObjSvc.getObject(fRepositoryId, verId, "*", false, IncludeRelationships.NONE, null,
-				false, false, null);
-		String idOfLastVersion = version.getId();
-		String docId = getVersionSeriesId(verId, version.getProperties().getProperties());
-		assertTrue(null != docId && docId.length() > 0);
-		assertFalse(isCheckedOut(docId));
-		Holder<Boolean> contentCopied = new Holder<Boolean>();
-		Holder<String> idHolder = new Holder<String>(verId); // or should this
-		// be version
-		// series?
-		fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
-		String pwcId = idHolder.getValue();
-
-		// Set a new content and modify property
-		Properties props = fObjSvc.getProperties(fRepositoryId, pwcId, "*", null);
-		String changeToken = (String) props.getProperties().get(PropertyIds.CHANGE_TOKEN).getFirstValue();
-		ContentStream altContent = fCreator.createAlternateContent();
-		idHolder = new Holder<String>(pwcId);
-		Holder<String> tokenHolder = new Holder<String>(changeToken);
-		fObjSvc.setContentStream(fRepositoryId, idHolder, true, tokenHolder, altContent, null);
-		fCreator.updateProperty(idHolder.getValue(), VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE_NEW);
-
-		// cancel checkout
-		fVerSvc.cancelCheckOut(fRepositoryId, pwcId, null);
-		try {
-			// Verify that pwc no longer exists
-			fObjSvc.getObject(fRepositoryId, pwcId, "*", false, IncludeRelationships.NONE, null, false, false, null);
-			fail("Getting pwc after cancel checkout should fail.");
-		} catch (CmisObjectNotFoundException e1) {
-		} catch (Exception e2) {
-			fail("Expected a CmisObjectNotFoundException after cancel checkin, but got a " + e2.getClass().getName());
-		}
-
-		// verify that the old content and properties are still valid
-		assertTrue(fCreator.verifyProperty(docId, VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE));
-		ContentStream retrievedContent = fObjSvc.getContentStream(fRepositoryId, idOfLastVersion, null, BigInteger
-				.valueOf(-1) /* offset */, BigInteger.valueOf(-1) /* length */, null);
-		assertTrue(fCreator.verifyContent(retrievedContent, fCreator.createContent()));
-	}
-
-	@Test
-	public void testGetPropertiesOfLatestVersion() {
-		VersioningState versioningState = VersioningState.MAJOR;
-		String verId = createDocument(PROP_NAME, fRootFolderId, versioningState);
-		getDocument(verId);
-
-		ObjectData version = fObjSvc.getObject(fRepositoryId, verId, "*", false, IncludeRelationships.NONE, null,
-				false, false, null);
-		String docId = getVersionSeriesId(verId, version.getProperties().getProperties());
-		assertTrue(null != docId && docId.length() > 0);
-
-		Holder<Boolean> contentCopied = new Holder<Boolean>();
-		Holder<String> idHolder = new Holder<String>(verId); // or should this
-		// be version
-		// series?
-		fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
-		String pwcId = idHolder.getValue();
-
-		ContentStream altContent = fCreator.createAlternateContent();
-		Properties newProps = fCreator.getUpdatePropertyList(VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE_NEW);
-		idHolder = new Holder<String>(pwcId);
-		assertTrue(isCheckedOut(docId));
-		assertTrue(isCheckedOut(pwcId));
-
-		// Test check-in and pass content and properties
-		String checkinComment = "Checkin with content and properties.";
-		fVerSvc.checkIn(fRepositoryId, idHolder, true, newProps, altContent, checkinComment, null, null, null, null);
-
-		Properties latest = fVerSvc.getPropertiesOfLatestVersion(fRepositoryId, docId, docId, true, "*", null);
-		assertNotNull(latest);
-
-		checkVersionProperties(verId, versioningState, latest.getProperties(), checkinComment);
-	}
-
-	@Test
-	public void testGetLatestVersion() {
-		VersioningState versioningState = VersioningState.MINOR;
-		String verId = createDocument(PROP_NAME, fRootFolderId, versioningState);
-		getDocument(verId);
-
-		ObjectData version = fObjSvc.getObject(fRepositoryId, verId, "*", false, IncludeRelationships.NONE, null,
-				false, false, null);
-		String docId = getVersionSeriesId(verId, version.getProperties().getProperties());
-		assertTrue(null != docId && docId.length() > 0);
-
-		Holder<Boolean> contentCopied = new Holder<Boolean>();
-		Holder<String> idHolder = new Holder<String>(verId); // or should this
-		// be version
-		// series?
-		fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
-		String pwcId = idHolder.getValue();
-
-		ContentStream altContent = fCreator.createAlternateContent();
-		Properties newProps = fCreator.getUpdatePropertyList(VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE_NEW);
-		idHolder = new Holder<String>(pwcId);
-		assertTrue(isCheckedOut(docId));
-		assertTrue(isCheckedOut(pwcId));
-
-		// Test check-in and pass content and properties
-		String checkinComment = "Checkin with content and properties.";
-		fVerSvc.checkIn(fRepositoryId, idHolder, true, newProps, altContent, checkinComment, null, null, null, null);
-
-		// get latest major version
-		versioningState = VersioningState.MAJOR;
-		boolean isMajor = true;
-		ObjectData objData = fVerSvc.getObjectOfLatestVersion(fRepositoryId, docId, docId, isMajor, "*", false,
-				IncludeRelationships.NONE, null, false, false, null);
-		checkVersionProperties(verId, versioningState, objData.getProperties().getProperties(), checkinComment);
-		ContentStream retrievedContent = fObjSvc.getContentStream(fRepositoryId, objData.getId(), null, BigInteger
-				.valueOf(-1) /* offset */, BigInteger.valueOf(-1) /* length */, null);
-		assertTrue(fCreator.verifyContent(retrievedContent, fCreator.createAlternateContent()));
-
-		// get latest non-major version, must be the same as before
-		versioningState = VersioningState.MAJOR;
-		isMajor = false;
-		objData = fVerSvc.getObjectOfLatestVersion(fRepositoryId, docId, docId, isMajor, "*", false,
-				IncludeRelationships.NONE, null, false, false, null);
-		checkVersionProperties(verId, versioningState, objData.getProperties().getProperties(), checkinComment);
-		retrievedContent = fObjSvc.getContentStream(fRepositoryId, objData.getId(), null,
-				BigInteger.valueOf(-1) /* offset */, BigInteger.valueOf(-1) /* length */, null);
-		assertTrue(fCreator.verifyContent(retrievedContent, fCreator.createAlternateContent()));
-	}
-
-	@Test
-	public void testGetCheckedOutDocuments() {
-		// create two folders with each having two documents, one of them being
-		// checked out
-		final int count = 2;
-		String[] folderIds = createLevel1Folders();
-		String[] verSeriesIds = new String[folderIds.length * count];
-		for (int i = 0; i < folderIds.length; i++) {
-			for (int j = 0; j < count; j++) {
-				String verId = createDocument("MyDoc" + j, folderIds[i], VersioningState.MAJOR);
-				ObjectData od = fObjSvc.getObject(fRepositoryId, verId, "*", false, IncludeRelationships.NONE, null,
-						false, false, null);
-				verSeriesIds[i * folderIds.length + j] = getVersionSeriesId(verId, od.getProperties().getProperties());
-			}
-		}
-		// checkout first in each folder
-		Holder<Boolean> contentCopied = new Holder<Boolean>();
-		Holder<String> idHolder = new Holder<String>(verSeriesIds[0]);
-		fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
-		idHolder = new Holder<String>(verSeriesIds[2]);
-		fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
-
-		// must be one in first folder
-		ObjectList checkedOutDocuments = fNavSvc.getCheckedOutDocs(fRepositoryId, folderIds[0], "*", null, false,
-				IncludeRelationships.NONE, null, BigInteger.valueOf(-1), BigInteger.valueOf(-1), null);
-		assertEquals(1, checkedOutDocuments.getNumItems().longValue());
-		assertEquals(1, checkedOutDocuments.getObjects().size());
-
-		// must be one in second folder
-		checkedOutDocuments = fNavSvc.getCheckedOutDocs(fRepositoryId, folderIds[1], "*", null, false,
-				IncludeRelationships.NONE, null, BigInteger.valueOf(-1), BigInteger.valueOf(-1), null);
-		assertEquals(1, checkedOutDocuments.getNumItems().longValue());
-		assertEquals(1, checkedOutDocuments.getObjects().size());
-
-		// must be two in repository
-		checkedOutDocuments = fNavSvc.getCheckedOutDocs(fRepositoryId, null, "*", null, false,
-				IncludeRelationships.NONE, null, BigInteger.valueOf(-1), BigInteger.valueOf(-1), null);
-		assertEquals(2, checkedOutDocuments.getNumItems().longValue());
-		assertEquals(2, checkedOutDocuments.getObjects().size());
-	}
-
-	@Test
-	public void testModifyOldVersions() {
-		String versionSeriesId = createVersionSeriesWithThreeVersions();
-		List<ObjectData> allVersions = fVerSvc.getAllVersions(fRepositoryId, null, versionSeriesId, "*", false, null);
-		assertEquals(3, allVersions.size());
-
-	}
-
-	private String[] createLevel1Folders() {
-		final int num = 2;
-		String[] res = new String[num];
-
-		for (int i = 0; i < num; i++) {
-			List<PropertyData<?>> properties = new ArrayList<PropertyData<?>>();
-			properties.add(fFactory.createPropertyIdData(PropertyIds.NAME, "Folder " + i));
-			properties.add(fFactory.createPropertyIdData(PropertyIds.OBJECT_TYPE_ID, BaseTypeId.CMIS_FOLDER.value()));
-			Properties props = fFactory.createPropertiesData(properties);
-			String id = fObjSvc.createFolder(fRepositoryId, props, fRootFolderId, null, null, null, null);
-			res[i] = id;
-		}
-		return res;
-	}
-
-	private void createVersionedDocument(VersioningState versioningState) {
-		// type id is:
-		// VersionTestTypeSystemCreator.VERSION_TEST_DOCUMENT_TYPE_ID
-		String verId = createDocument(PROP_NAME, fRootFolderId, versioningState);
-		getDocument(verId);
-
-		ObjectData version = fObjSvc.getObject(fRepositoryId, verId, "*", false, IncludeRelationships.NONE, null,
-				false, false, null);
-		String docId = getVersionSeriesId(verId, version.getProperties().getProperties());
-		assertTrue(null != docId && docId.length() > 0);
-
-		List<ObjectData> allVersions = fVerSvc.getAllVersions(fRepositoryId, docId, docId, "*", false, null);
-		assertEquals(1, allVersions.size());
-
-		checkVersionProperties(verId, versioningState, allVersions.get(0).getProperties().getProperties(), null);
-	}
-
-	private String getVersionSeriesId(String docId, Map<String, PropertyData<?>> props) {
-		PropertyId pdid = (PropertyId) props.get(PropertyIds.VERSION_SERIES_ID);
-		assertNotNull(pdid);
-		String sVal = pdid.getFirstValue();
-		assertNotNull(sVal);
-		return sVal;
-	}
-
-	private boolean isCheckedOut(String objectId) {
-		Properties props = fObjSvc.getProperties(fRepositoryId, objectId, "*", null);
-		return isCheckedOut(props.getProperties());
-	}
-
-	private boolean isCheckedOut(Map<String, PropertyData<?>> props) {
-		PropertyBoolean pdb = (PropertyBoolean) props.get(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT);
-		assertNotNull(pdb);
-		boolean bVal = pdb.getFirstValue();
-		return bVal;
-
-	}
-
-	private void checkVersionProperties(String docId, VersioningState versioningState,
-			Map<String, PropertyData<?>> props, String checkinComment) {
-		for (PropertyData<?> pd : props.values()) {
-			log.info("return property id: " + pd.getId() + ", value: " + pd.getValues());
-		}
-
-		DocumentTypeDefinition typeDef = (DocumentTypeDefinition) fRepSvc.getTypeDefinition(fRepositoryId,
-				VersionTestTypeSystemCreator.VERSION_TEST_DOCUMENT_TYPE_ID, null);
-		PropertyBoolean pdb = (PropertyBoolean) props.get(PropertyIds.IS_LATEST_VERSION);
-		assertNotNull(pdb);
-		boolean bVal = pdb.getFirstValue();
-		assertEquals(versioningState != VersioningState.CHECKEDOUT, bVal); // if
-		// checked
-		// out
-		// it
-		// isn
-		// 't
-		// the
-		// latest
-		// version
-
-		pdb = (PropertyBoolean) props.get(PropertyIds.IS_MAJOR_VERSION);
-		assertNotNull(pdb);
-		bVal = pdb.getFirstValue();
-		assertEquals(versioningState == VersioningState.MAJOR, bVal);
-
-		pdb = (PropertyBoolean) props.get(PropertyIds.IS_LATEST_MAJOR_VERSION);
-		assertNotNull(pdb);
-		bVal = pdb.getFirstValue();
-		assertEquals(versioningState == VersioningState.MAJOR, bVal);
-
-		PropertyId pdid = (PropertyId) props.get(PropertyIds.VERSION_SERIES_ID);
-		assertNotNull(pdb);
-		String sVal = pdid.getFirstValue();
-		if (typeDef.isVersionable())
-			assertFalse(docId.equals(sVal));
-		else
-			assertEquals(docId, sVal);
-
-		pdb = (PropertyBoolean) props.get(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT);
-		assertNotNull(pdb);
-		bVal = pdb.getFirstValue();
-		assertEquals(versioningState == VersioningState.CHECKEDOUT, bVal);
-
-		PropertyString pds = (PropertyString) props.get(PropertyIds.VERSION_SERIES_CHECKED_OUT_BY);
-		assertNotNull(pdb);
-		sVal = pds.getFirstValue();
-		if (versioningState == VersioningState.CHECKEDOUT)
-			assertTrue(sVal != null && sVal.length() > 0);
-		else
-			assertTrue(null == sVal || sVal.equals(""));
-
-		pdid = (PropertyId) props.get(PropertyIds.VERSION_SERIES_CHECKED_OUT_ID);
-		assertNotNull(pdid);
-		sVal = pdid.getFirstValue();
-		if (versioningState == VersioningState.CHECKEDOUT)
-			assertTrue(sVal != null && sVal.length() > 0);
-		else
-			assertTrue(null == sVal || sVal.equals(""));
-
-		pds = (PropertyString) props.get(PropertyIds.CHECKIN_COMMENT);
-		assertNotNull(pdb);
-		sVal = pds.getFirstValue();
-		if (checkinComment == null)
-			assertTrue(null == sVal);
-		else
-			assertEquals(checkinComment, sVal);
-
-	}
-
-	public String getDocument(String id) {
-		String returnedId = null;
-		try {
-			ObjectData res = fObjSvc.getObject(fRepositoryId, id, "*", false, IncludeRelationships.NONE, null, false,
-					false, null);
-			assertNotNull(res);
-			testReturnedProperties(res.getProperties().getProperties());
-			returnedId = res.getId();
-			assertEquals(id, returnedId);
-		} catch (Exception e) {
-			fail("getObject() failed with exception: " + e);
-		}
-		return returnedId;
-	}
-
-	private void testReturnedProperties(Map<String, PropertyData<?>> props) {
-		for (PropertyData<?> pd : props.values()) {
-			log.info("return property id: " + pd.getId() + ", value: " + pd.getValues());
-		}
-
-		PropertyData<?> pd = props.get(PropertyIds.NAME);
-		assertNotNull(pd);
-		assertEquals(PROP_NAME, pd.getFirstValue());
-		pd = props.get(PropertyIds.OBJECT_TYPE_ID);
-		assertEquals(VersionTestTypeSystemCreator.VERSION_TEST_DOCUMENT_TYPE_ID, pd.getFirstValue());
-		pd = props.get(VersionTestTypeSystemCreator.PROPERTY_ID);
-		assertEquals(PROP_VALUE, pd.getFirstValue());
-	}
-
-	private String createDocument(String name, String folderId, VersioningState versioningState) {
-
-		String id = null;
-		Map<String, String> properties = new HashMap<String, String>();
-		properties.put(VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE);
-		id = fCreator.createDocument(name, VersionTestTypeSystemCreator.VERSION_TEST_DOCUMENT_TYPE_ID, folderId,
-				versioningState, properties);
-
-		return id;
-	}
-
-	private String createVersionSeriesWithThreeVersions() {
-		String verIdV1 = createDocument(PROP_NAME, fRootFolderId, VersioningState.MAJOR);
-		getDocument(verIdV1);
-
-		ObjectData version = fObjSvc.getObject(fRepositoryId, verIdV1, "*", false, IncludeRelationships.NONE, null,
-				false, false, null);
-		String verSeriesId = getVersionSeriesId(verIdV1, version.getProperties().getProperties());
-
-		// create second version with different content
-		Holder<String> idHolder = new Holder<String>(verIdV1);
-		Holder<Boolean> contentCopied = new Holder<Boolean>(false);
-		fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
-
-		ContentStream content2 = createContent('a');
-		Properties newProps = fCreator.getUpdatePropertyList(VersionTestTypeSystemCreator.PROPERTY_ID,
-				"PropertyFromVersion2");
-		idHolder = new Holder<String>(verIdV1);
-		// Test check-in and pass content and properties
-		String checkinComment = "Checkin from Unit Test-2.";
-		fVerSvc.checkIn(fRepositoryId, idHolder, true, newProps, content2, checkinComment, null, null, null, null);
-		String verIdV2 = idHolder.getValue();
-
-		// create third version with different content
-		contentCopied = new Holder<Boolean>(false);
-		fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
-		ContentStream content3 = super.createContent('a');
-		newProps = fCreator.getUpdatePropertyList(VersionTestTypeSystemCreator.PROPERTY_ID, "PropertyFromVersion3");
-		// Test check-in and pass content and properties
-		checkinComment = "Checkin from Unit Test-3.";
-		fVerSvc.checkIn(fRepositoryId, idHolder, true, newProps, content3, checkinComment, null, null, null, null);
-		/* String verIdV3 = */idHolder.getValue();
-
-		// Try to update version2 which should fail (on a versioned document
-		// only a document that
-		// is checked out can be modified.
-		try {
-			fCreator.updateProperty(verIdV2, VersionTestTypeSystemCreator.PROPERTY_ID, "ChangeWithoutCheckout");
-			fail("updateProperty for an older version should fail.");
-		} catch (Exception e) {
-			assertTrue(e instanceof CmisUpdateConflictException);
-		}
-		// try to set content on an older version
-		ContentStream content4 = super.createContent('x');
-		idHolder = new Holder<String>(verIdV2);
-		try {
-			fObjSvc.setContentStream(fRepositoryId, idHolder, true, null, content4, null);
-			fail("setContentStream for an older version should fail.");
-		} catch (Exception e) {
-			assertTrue(e instanceof CmisUpdateConflictException);
-		}
-
-		return verSeriesId;
-	}
-
-	public static class VersionTestTypeSystemCreator implements TypeCreator {
-		static public String VERSION_TEST_DOCUMENT_TYPE_ID = "MyVersionedType";
-		static public String PROPERTY_ID = "StringProp";
-
-		public List<TypeDefinition> createTypesList() {
-			// always add CMIS default types
-			List<TypeDefinition> typesList = new LinkedList<TypeDefinition>();
-
-			// create a complex type with properties
-			InMemoryDocumentTypeDefinition cmisComplexType = new InMemoryDocumentTypeDefinition(
-					VERSION_TEST_DOCUMENT_TYPE_ID, "VersionedType", InMemoryDocumentTypeDefinition
-							.getRootDocumentType());
-
-			// create a single String property definition
-
-			Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
-
-			PropertyStringDefinitionImpl prop1 = PropertyCreationHelper.createStringDefinition(PROPERTY_ID,
-					"Sample String Property");
-			propertyDefinitions.put(prop1.getId(), prop1);
-
-			cmisComplexType.addCustomPropertyDefinitions(propertyDefinitions);
-			cmisComplexType.setIsVersionable(true); // make it a versionable
-			// type;
+    private static Log log = LogFactory.getLog(ObjectServiceTest.class);
+    private static final String PROP_VALUE = "Mickey Mouse";
+    private static final String PROP_VALUE_NEW = "Donald Duck";
+    private static final String PROP_NAME = "My Versioned Document";
+    private static final String TEST_USER = "TestUser";
+    private static final String TEST_USER_2 = "OtherUser";
+
+    ObjectCreator fCreator;
+
+    @Before
+    public void setUp() throws Exception {
+        super.setTypeCreatorClass(VersionTestTypeSystemCreator.class.getName());
+        super.setUp();
+        fCreator = new ObjectCreator(fFactory, fObjSvc, fRepositoryId);
+        setRuntimeContext(TEST_USER);
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    private void setRuntimeContext(String user) {
+
+        /*
+         * DummyCallContext ctx = new DummyCallContext();
+         * ctx.put(CallContext.USERNAME, user); // Attach the CallContext to a
+         * thread local context that can be accessed from everywhere
+         * RuntimeContext.attachCfg(ctx);
+         */
+        fTestCallContext.put(CallContext.USERNAME, user);
+    }
+
+    @Test
+    public void testCreateVersionedDocumentMinor() {
+        createVersionedDocument(VersioningState.MINOR);
+    }
+
+    @Test
+    public void testCreateVersionedDocumentCheckedOut() {
+        createVersionedDocument(VersioningState.CHECKEDOUT);
+    }
+
+    @Test
+    public void testCreateVersionedDocumentNone() {
+        try {
+            createVersionedDocument(VersioningState.NONE);
+            fail("creating a document of a versionable type with state VersioningState.NONE should fail.");
+        } catch (Exception e) {
+            assertEquals(CmisConstraintException.class, e.getClass());
+        }
+    }
+
+    @Test
+    public void testCheckOutBasic() {
+        String verId = createDocument(PROP_NAME, fRootFolderId, VersioningState.MAJOR);
+
+        ObjectData version = fObjSvc.getObject(fRepositoryId, verId, "*", false, IncludeRelationships.NONE, null,
+                false, false, null);
+        String docId = getVersionSeriesId(verId, version.getProperties().getProperties());
+        assertTrue(null != docId && docId.length() > 0);
+
+        assertFalse(isCheckedOut(docId));
+
+        Holder<Boolean> contentCopied = new Holder<Boolean>();
+        Holder<String> idHolder = new Holder<String>(verId); // or should this
+        // be version
+        // series?
+        fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
+        String pwcId = idHolder.getValue();
+        // test that object is checked out and that all properties are set
+        // correctly
+        Properties props = fObjSvc.getProperties(fRepositoryId, pwcId, "*", null);
+        String changeToken = (String) props.getProperties().get(PropertyIds.CHANGE_TOKEN).getFirstValue();
+        checkVersionProperties(pwcId, VersioningState.CHECKEDOUT, props.getProperties(), null);
+
+        // Test that a second checkout is not possible
+        try {
+            fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
+            fail("Checking out a document that is already checked-out should fail.");
+        } catch (Exception e) {
+            assertTrue(e instanceof CmisUpdateConflictException);
+        }
+        // version and version series should be checked out now
+        assertTrue(isCheckedOut(docId));
+        assertTrue(isCheckedOut(pwcId));
+
+        // Set a new content and modify property
+        ContentStream altContent = fCreator.createAlternateContent();
+        idHolder = new Holder<String>(pwcId);
+        Holder<String> tokenHolder = new Holder<String>(changeToken);
+        fObjSvc.setContentStream(fRepositoryId, idHolder, true, tokenHolder, altContent, null);
+        fCreator.updateProperty(idHolder.getValue(), VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE_NEW);
+
+        // Test that a check-in as same user is possible
+        String checkinComment = "Checkin without content and properties.";
+        fVerSvc.checkIn(fRepositoryId, idHolder, true, null, null, checkinComment, null, null, null, null);
+        // Neither the version nor the version series should be checked out any
+        // longer:
+        assertFalse(isCheckedOut(idHolder.getValue()));
+        assertFalse(isCheckedOut(docId));
+        ContentStream retrievedContent = fObjSvc.getContentStream(fRepositoryId, idHolder.getValue(), null, BigInteger
+                .valueOf(-1) /* offset */, BigInteger.valueOf(-1) /* length */, null);
+        assertTrue(fCreator.verifyContent(fCreator.createAlternateContent(), retrievedContent));
+        assertTrue(fCreator.verifyProperty(idHolder.getValue(), VersionTestTypeSystemCreator.PROPERTY_ID,
+                PROP_VALUE_NEW));
+
+        List<ObjectData> allVersions = fVerSvc.getAllVersions(fRepositoryId, docId, docId, "*", false, null);
+        assertEquals(2, allVersions.size());
+    }
+
+    @Test
+    public void testCheckInWithContent() {
+        String verId = createDocument(PROP_NAME, fRootFolderId, VersioningState.MAJOR);
+
+        ObjectData version = fObjSvc.getObject(fRepositoryId, verId, "*", false, IncludeRelationships.NONE, null,
+                false, false, null);
+        String docId = getVersionSeriesId(verId, version.getProperties().getProperties());
+        assertTrue(null != docId && docId.length() > 0);
+
+        assertFalse(isCheckedOut(docId));
+
+        Holder<Boolean> contentCopied = new Holder<Boolean>();
+        Holder<String> idHolder = new Holder<String>(verId); // or should this
+        // be version
+        // series?
+        fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
+        String pwcId = idHolder.getValue();
+
+        ContentStream altContent = fCreator.createAlternateContent();
+        Properties newProps = fCreator.getUpdatePropertyList(VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE_NEW);
+        idHolder = new Holder<String>(pwcId);
+        assertTrue(isCheckedOut(docId));
+        assertTrue(isCheckedOut(pwcId));
+
+        // Test check-in and pass content and properties
+        String checkinComment = "Checkin with content and properties.";
+        fVerSvc.checkIn(fRepositoryId, idHolder, true, newProps, altContent, checkinComment, null, null, null, null);
+        // Neither the version nor the version series should be checked out any
+        // longer:
+        assertFalse(isCheckedOut(idHolder.getValue()));
+        assertFalse(isCheckedOut(docId));
+        ContentStream retrievedContent = fObjSvc.getContentStream(fRepositoryId, idHolder.getValue(), null, BigInteger
+                .valueOf(-1) /* offset */, BigInteger.valueOf(-1) /* length */, null);
+
+        // New content and property should be set
+        assertTrue(fCreator.verifyContent(fCreator.createAlternateContent(), retrievedContent));
+        assertTrue(fCreator.verifyProperty(idHolder.getValue(), VersionTestTypeSystemCreator.PROPERTY_ID,
+                PROP_VALUE_NEW));
+    }
+
+    @Test
+    public void testCheckOutAndOtherUser() {
+        String verId = createDocument(PROP_NAME, fRootFolderId, VersioningState.MAJOR);
+        ObjectData version = fObjSvc.getObject(fRepositoryId, verId, "*", false, IncludeRelationships.NONE, null,
+                false, false, null);
+        String docId = getVersionSeriesId(verId, version.getProperties().getProperties());
+        assertTrue(null != docId && docId.length() > 0);
+        assertFalse(isCheckedOut(docId));
+        Holder<Boolean> contentCopied = new Holder<Boolean>();
+        Holder<String> idHolder = new Holder<String>(verId); // or should this
+        // be version
+        // series?
+        fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
+        String pwcId = idHolder.getValue();
+
+        // Test that a checkin as another user is not possible
+        setRuntimeContext(TEST_USER_2);
+        try {
+            fVerSvc.checkIn(fRepositoryId, idHolder, true, null, null, "My Comment", null, null, null, null);
+            fail("Checking in a document as another user should fail.");
+        } catch (Exception e) {
+            assertTrue(e instanceof CmisUpdateConflictException);
+        }
+
+        // Test that a cancel checkout as another user is not possible
+        try {
+            fVerSvc.cancelCheckOut(fRepositoryId, pwcId, null);
+            fail("Checking in a document as another user should fail.");
+        } catch (Exception e) {
+            assertTrue(e instanceof CmisUpdateConflictException);
+        }
+
+        // Test that an updateProperties as another user is not possible
+        try {
+            fCreator.updateProperty(pwcId, VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE_NEW);
+            fail("updateProperty in a document as another user should fail.");
+        } catch (Exception e) {
+            assertTrue(e instanceof CmisUpdateConflictException);
+        }
+
+        ContentStream altContent = fCreator.createAlternateContent();
+        Holder<String> pwcHolder = new Holder<String>(pwcId);
+        try {
+            fObjSvc.setContentStream(fRepositoryId, pwcHolder, true, null, altContent, null);
+            fail("setContentStream in a document as another user should fail.");
+        } catch (Exception e) {
+            assertTrue(e instanceof CmisUpdateConflictException);
+        }
+
+        setRuntimeContext(TEST_USER);
+        // Test that a check-in as same user is possible
+        fVerSvc.checkIn(fRepositoryId, pwcHolder, true, null, null, "testCheckOutAndOtherUser", null, null, null, null);
+
+        // Because nothing was changed we should have a new version with
+        // identical content
+        ContentStream retrievedContent = fObjSvc.getContentStream(fRepositoryId, pwcHolder.getValue(), null, BigInteger
+                .valueOf(-1) /* offset */, BigInteger.valueOf(-1) /* length */, null);
+        assertTrue(fCreator.verifyContent(retrievedContent, fCreator.createContent()));
+        assertTrue(fCreator.verifyProperty(idHolder.getValue(), VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE));
+    }
+
+    @Test
+    public void testCancelCheckout() {
+        String verId = createDocument(PROP_NAME, fRootFolderId, VersioningState.MAJOR);
+        ObjectData version = fObjSvc.getObject(fRepositoryId, verId, "*", false, IncludeRelationships.NONE, null,
+                false, false, null);
+        String idOfLastVersion = version.getId();
+        String docId = getVersionSeriesId(verId, version.getProperties().getProperties());
+        assertTrue(null != docId && docId.length() > 0);
+        assertFalse(isCheckedOut(docId));
+        Holder<Boolean> contentCopied = new Holder<Boolean>();
+        Holder<String> idHolder = new Holder<String>(verId); // or should this
+        // be version
+        // series?
+        fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
+        String pwcId = idHolder.getValue();
+
+        // Set a new content and modify property
+        Properties props = fObjSvc.getProperties(fRepositoryId, pwcId, "*", null);
+        String changeToken = (String) props.getProperties().get(PropertyIds.CHANGE_TOKEN).getFirstValue();
+        ContentStream altContent = fCreator.createAlternateContent();
+        idHolder = new Holder<String>(pwcId);
+        Holder<String> tokenHolder = new Holder<String>(changeToken);
+        fObjSvc.setContentStream(fRepositoryId, idHolder, true, tokenHolder, altContent, null);
+        fCreator.updateProperty(idHolder.getValue(), VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE_NEW);
+
+        // cancel checkout
+        fVerSvc.cancelCheckOut(fRepositoryId, pwcId, null);
+        try {
+            // Verify that pwc no longer exists
+            fObjSvc.getObject(fRepositoryId, pwcId, "*", false, IncludeRelationships.NONE, null, false, false, null);
+            fail("Getting pwc after cancel checkout should fail.");
+        } catch (CmisObjectNotFoundException e1) {
+        } catch (Exception e2) {
+            fail("Expected a CmisObjectNotFoundException after cancel checkin, but got a " + e2.getClass().getName());
+        }
+
+        // verify that the old content and properties are still valid
+        assertTrue(fCreator.verifyProperty(docId, VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE));
+        ContentStream retrievedContent = fObjSvc.getContentStream(fRepositoryId, idOfLastVersion, null, BigInteger
+                .valueOf(-1) /* offset */, BigInteger.valueOf(-1) /* length */, null);
+        assertTrue(fCreator.verifyContent(retrievedContent, fCreator.createContent()));
+    }
+
+    @Test
+    public void testGetPropertiesOfLatestVersion() {
+        VersioningState versioningState = VersioningState.MAJOR;
+        String verId = createDocument(PROP_NAME, fRootFolderId, versioningState);
+        getDocument(verId);
+
+        ObjectData version = fObjSvc.getObject(fRepositoryId, verId, "*", false, IncludeRelationships.NONE, null,
+                false, false, null);
+        String docId = getVersionSeriesId(verId, version.getProperties().getProperties());
+        assertTrue(null != docId && docId.length() > 0);
+
+        Holder<Boolean> contentCopied = new Holder<Boolean>();
+        Holder<String> idHolder = new Holder<String>(verId); // or should this
+        // be version
+        // series?
+        fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
+        String pwcId = idHolder.getValue();
+
+        ContentStream altContent = fCreator.createAlternateContent();
+        Properties newProps = fCreator.getUpdatePropertyList(VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE_NEW);
+        idHolder = new Holder<String>(pwcId);
+        assertTrue(isCheckedOut(docId));
+        assertTrue(isCheckedOut(pwcId));
+
+        // Test check-in and pass content and properties
+        String checkinComment = "Checkin with content and properties.";
+        fVerSvc.checkIn(fRepositoryId, idHolder, true, newProps, altContent, checkinComment, null, null, null, null);
+
+        Properties latest = fVerSvc.getPropertiesOfLatestVersion(fRepositoryId, docId, docId, true, "*", null);
+        assertNotNull(latest);
+
+        checkVersionProperties(verId, versioningState, latest.getProperties(), checkinComment);
+    }
+
+    @Test
+    public void testGetLatestVersion() {
+        VersioningState versioningState = VersioningState.MINOR;
+        String verId = createDocument(PROP_NAME, fRootFolderId, versioningState);
+        getDocument(verId);
+
+        ObjectData version = fObjSvc.getObject(fRepositoryId, verId, "*", false, IncludeRelationships.NONE, null,
+                false, false, null);
+        String docId = getVersionSeriesId(verId, version.getProperties().getProperties());
+        assertTrue(null != docId && docId.length() > 0);
+
+        Holder<Boolean> contentCopied = new Holder<Boolean>();
+        Holder<String> idHolder = new Holder<String>(verId); // or should this
+        // be version
+        // series?
+        fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
+        String pwcId = idHolder.getValue();
+
+        ContentStream altContent = fCreator.createAlternateContent();
+        Properties newProps = fCreator.getUpdatePropertyList(VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE_NEW);
+        idHolder = new Holder<String>(pwcId);
+        assertTrue(isCheckedOut(docId));
+        assertTrue(isCheckedOut(pwcId));
+
+        // Test check-in and pass content and properties
+        String checkinComment = "Checkin with content and properties.";
+        fVerSvc.checkIn(fRepositoryId, idHolder, true, newProps, altContent, checkinComment, null, null, null, null);
+
+        // get latest major version
+        versioningState = VersioningState.MAJOR;
+        boolean isMajor = true;
+        ObjectData objData = fVerSvc.getObjectOfLatestVersion(fRepositoryId, docId, docId, isMajor, "*", false,
+                IncludeRelationships.NONE, null, false, false, null);
+        checkVersionProperties(verId, versioningState, objData.getProperties().getProperties(), checkinComment);
+        ContentStream retrievedContent = fObjSvc.getContentStream(fRepositoryId, objData.getId(), null, BigInteger
+                .valueOf(-1) /* offset */, BigInteger.valueOf(-1) /* length */, null);
+        assertTrue(fCreator.verifyContent(retrievedContent, fCreator.createAlternateContent()));
+
+        // get latest non-major version, must be the same as before
+        versioningState = VersioningState.MAJOR;
+        isMajor = false;
+        objData = fVerSvc.getObjectOfLatestVersion(fRepositoryId, docId, docId, isMajor, "*", false,
+                IncludeRelationships.NONE, null, false, false, null);
+        checkVersionProperties(verId, versioningState, objData.getProperties().getProperties(), checkinComment);
+        retrievedContent = fObjSvc.getContentStream(fRepositoryId, objData.getId(), null,
+                BigInteger.valueOf(-1) /* offset */, BigInteger.valueOf(-1) /* length */, null);
+        assertTrue(fCreator.verifyContent(retrievedContent, fCreator.createAlternateContent()));
+    }
+
+    @Test
+    public void testGetCheckedOutDocuments() {
+        // create two folders with each having two documents, one of them being
+        // checked out
+        final int count = 2;
+        String[] folderIds = createLevel1Folders();
+        String[] verSeriesIds = new String[folderIds.length * count];
+        for (int i = 0; i < folderIds.length; i++) {
+            for (int j = 0; j < count; j++) {
+                String verId = createDocument("MyDoc" + j, folderIds[i], VersioningState.MAJOR);
+                ObjectData od = fObjSvc.getObject(fRepositoryId, verId, "*", false, IncludeRelationships.NONE, null,
+                        false, false, null);
+                verSeriesIds[i * folderIds.length + j] = getVersionSeriesId(verId, od.getProperties().getProperties());
+            }
+        }
+        // checkout first in each folder
+        Holder<Boolean> contentCopied = new Holder<Boolean>();
+        Holder<String> idHolder = new Holder<String>(verSeriesIds[0]);
+        fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
+        idHolder = new Holder<String>(verSeriesIds[2]);
+        fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
+
+        // must be one in first folder
+        ObjectList checkedOutDocuments = fNavSvc.getCheckedOutDocs(fRepositoryId, folderIds[0], "*", null, false,
+                IncludeRelationships.NONE, null, BigInteger.valueOf(-1), BigInteger.valueOf(-1), null);
+        assertEquals(1, checkedOutDocuments.getNumItems().longValue());
+        assertEquals(1, checkedOutDocuments.getObjects().size());
+
+        // must be one in second folder
+        checkedOutDocuments = fNavSvc.getCheckedOutDocs(fRepositoryId, folderIds[1], "*", null, false,
+                IncludeRelationships.NONE, null, BigInteger.valueOf(-1), BigInteger.valueOf(-1), null);
+        assertEquals(1, checkedOutDocuments.getNumItems().longValue());
+        assertEquals(1, checkedOutDocuments.getObjects().size());
+
+        // must be two in repository
+        checkedOutDocuments = fNavSvc.getCheckedOutDocs(fRepositoryId, null, "*", null, false,
+                IncludeRelationships.NONE, null, BigInteger.valueOf(-1), BigInteger.valueOf(-1), null);
+        assertEquals(2, checkedOutDocuments.getNumItems().longValue());
+        assertEquals(2, checkedOutDocuments.getObjects().size());
+    }
+
+    @Test
+    public void testModifyOldVersions() {
+        String versionSeriesId = createVersionSeriesWithThreeVersions();
+        List<ObjectData> allVersions = fVerSvc.getAllVersions(fRepositoryId, null, versionSeriesId, "*", false, null);
+        assertEquals(3, allVersions.size());
+
+    }
+
+    private String[] createLevel1Folders() {
+        final int num = 2;
+        String[] res = new String[num];
+
+        for (int i = 0; i < num; i++) {
+            List<PropertyData<?>> properties = new ArrayList<PropertyData<?>>();
+            properties.add(fFactory.createPropertyIdData(PropertyIds.NAME, "Folder " + i));
+            properties.add(fFactory.createPropertyIdData(PropertyIds.OBJECT_TYPE_ID, BaseTypeId.CMIS_FOLDER.value()));
+            Properties props = fFactory.createPropertiesData(properties);
+            String id = fObjSvc.createFolder(fRepositoryId, props, fRootFolderId, null, null, null, null);
+            res[i] = id;
+        }
+        return res;
+    }
+
+    private void createVersionedDocument(VersioningState versioningState) {
+        // type id is:
+        // VersionTestTypeSystemCreator.VERSION_TEST_DOCUMENT_TYPE_ID
+        String verId = createDocument(PROP_NAME, fRootFolderId, versioningState);
+        getDocument(verId);
+
+        ObjectData version = fObjSvc.getObject(fRepositoryId, verId, "*", false, IncludeRelationships.NONE, null,
+                false, false, null);
+        String docId = getVersionSeriesId(verId, version.getProperties().getProperties());
+        assertTrue(null != docId && docId.length() > 0);
+
+        List<ObjectData> allVersions = fVerSvc.getAllVersions(fRepositoryId, docId, docId, "*", false, null);
+        assertEquals(1, allVersions.size());
+
+        checkVersionProperties(verId, versioningState, allVersions.get(0).getProperties().getProperties(), null);
+    }
+
+    private String getVersionSeriesId(String docId, Map<String, PropertyData<?>> props) {
+        PropertyId pdid = (PropertyId) props.get(PropertyIds.VERSION_SERIES_ID);
+        assertNotNull(pdid);
+        String sVal = pdid.getFirstValue();
+        assertNotNull(sVal);
+        return sVal;
+    }
+
+    private boolean isCheckedOut(String objectId) {
+        Properties props = fObjSvc.getProperties(fRepositoryId, objectId, "*", null);
+        return isCheckedOut(props.getProperties());
+    }
+
+    private boolean isCheckedOut(Map<String, PropertyData<?>> props) {
+        PropertyBoolean pdb = (PropertyBoolean) props.get(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT);
+        assertNotNull(pdb);
+        boolean bVal = pdb.getFirstValue();
+        return bVal;
+
+    }
+
+    private void checkVersionProperties(String docId, VersioningState versioningState,
+            Map<String, PropertyData<?>> props, String checkinComment) {
+        for (PropertyData<?> pd : props.values()) {
+            log.info("return property id: " + pd.getId() + ", value: " + pd.getValues());
+        }
+
+        DocumentTypeDefinition typeDef = (DocumentTypeDefinition) fRepSvc.getTypeDefinition(fRepositoryId,
+                VersionTestTypeSystemCreator.VERSION_TEST_DOCUMENT_TYPE_ID, null);
+        PropertyBoolean pdb = (PropertyBoolean) props.get(PropertyIds.IS_LATEST_VERSION);
+        assertNotNull(pdb);
+        boolean bVal = pdb.getFirstValue();
+        assertEquals(versioningState != VersioningState.CHECKEDOUT, bVal); // if
+        // checked
+        // out
+        // it
+        // isn
+        // 't
+        // the
+        // latest
+        // version
+
+        pdb = (PropertyBoolean) props.get(PropertyIds.IS_MAJOR_VERSION);
+        assertNotNull(pdb);
+        bVal = pdb.getFirstValue();
+        assertEquals(versioningState == VersioningState.MAJOR, bVal);
+
+        pdb = (PropertyBoolean) props.get(PropertyIds.IS_LATEST_MAJOR_VERSION);
+        assertNotNull(pdb);
+        bVal = pdb.getFirstValue();
+        assertEquals(versioningState == VersioningState.MAJOR, bVal);
+
+        PropertyId pdid = (PropertyId) props.get(PropertyIds.VERSION_SERIES_ID);
+        assertNotNull(pdb);
+        String sVal = pdid.getFirstValue();
+        if (typeDef.isVersionable())
+            assertFalse(docId.equals(sVal));
+        else
+            assertEquals(docId, sVal);
+
+        pdb = (PropertyBoolean) props.get(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT);
+        assertNotNull(pdb);
+        bVal = pdb.getFirstValue();
+        assertEquals(versioningState == VersioningState.CHECKEDOUT, bVal);
+
+        PropertyString pds = (PropertyString) props.get(PropertyIds.VERSION_SERIES_CHECKED_OUT_BY);
+        assertNotNull(pdb);
+        sVal = pds.getFirstValue();
+        if (versioningState == VersioningState.CHECKEDOUT)
+            assertTrue(sVal != null && sVal.length() > 0);
+        else
+            assertTrue(null == sVal || sVal.equals(""));
+
+        pdid = (PropertyId) props.get(PropertyIds.VERSION_SERIES_CHECKED_OUT_ID);
+        assertNotNull(pdid);
+        sVal = pdid.getFirstValue();
+        if (versioningState == VersioningState.CHECKEDOUT)
+            assertTrue(sVal != null && sVal.length() > 0);
+        else
+            assertTrue(null == sVal || sVal.equals(""));
+
+        pds = (PropertyString) props.get(PropertyIds.CHECKIN_COMMENT);
+        assertNotNull(pdb);
+        sVal = pds.getFirstValue();
+        if (checkinComment == null)
+            assertTrue(null == sVal);
+        else
+            assertEquals(checkinComment, sVal);
+
+    }
+
+    public String getDocument(String id) {
+        String returnedId = null;
+        try {
+            ObjectData res = fObjSvc.getObject(fRepositoryId, id, "*", false, IncludeRelationships.NONE, null, false,
+                    false, null);
+            assertNotNull(res);
+            testReturnedProperties(res.getProperties().getProperties());
+            returnedId = res.getId();
+            assertEquals(id, returnedId);
+        } catch (Exception e) {
+            fail("getObject() failed with exception: " + e);
+        }
+        return returnedId;
+    }
+
+    private void testReturnedProperties(Map<String, PropertyData<?>> props) {
+        for (PropertyData<?> pd : props.values()) {
+            log.info("return property id: " + pd.getId() + ", value: " + pd.getValues());
+        }
+
+        PropertyData<?> pd = props.get(PropertyIds.NAME);
+        assertNotNull(pd);
+        assertEquals(PROP_NAME, pd.getFirstValue());
+        pd = props.get(PropertyIds.OBJECT_TYPE_ID);
+        assertEquals(VersionTestTypeSystemCreator.VERSION_TEST_DOCUMENT_TYPE_ID, pd.getFirstValue());
+        pd = props.get(VersionTestTypeSystemCreator.PROPERTY_ID);
+        assertEquals(PROP_VALUE, pd.getFirstValue());
+    }
+
+    private String createDocument(String name, String folderId, VersioningState versioningState) {
+
+        String id = null;
+        Map<String, String> properties = new HashMap<String, String>();
+        properties.put(VersionTestTypeSystemCreator.PROPERTY_ID, PROP_VALUE);
+        id = fCreator.createDocument(name, VersionTestTypeSystemCreator.VERSION_TEST_DOCUMENT_TYPE_ID, folderId,
+                versioningState, properties);
+
+        return id;
+    }
+
+    private String createVersionSeriesWithThreeVersions() {
+        String verIdV1 = createDocument(PROP_NAME, fRootFolderId, VersioningState.MAJOR);
+        getDocument(verIdV1);
+
+        ObjectData version = fObjSvc.getObject(fRepositoryId, verIdV1, "*", false, IncludeRelationships.NONE, null,
+                false, false, null);
+        String verSeriesId = getVersionSeriesId(verIdV1, version.getProperties().getProperties());
+
+        // create second version with different content
+        Holder<String> idHolder = new Holder<String>(verIdV1);
+        Holder<Boolean> contentCopied = new Holder<Boolean>(false);
+        fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
+
+        ContentStream content2 = createContent('a');
+        Properties newProps = fCreator.getUpdatePropertyList(VersionTestTypeSystemCreator.PROPERTY_ID,
+                "PropertyFromVersion2");
+        idHolder = new Holder<String>(verIdV1);
+        // Test check-in and pass content and properties
+        String checkinComment = "Checkin from Unit Test-2.";
+        fVerSvc.checkIn(fRepositoryId, idHolder, true, newProps, content2, checkinComment, null, null, null, null);
+        String verIdV2 = idHolder.getValue();
+
+        // create third version with different content
+        contentCopied = new Holder<Boolean>(false);
+        fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
+        ContentStream content3 = super.createContent('a');
+        newProps = fCreator.getUpdatePropertyList(VersionTestTypeSystemCreator.PROPERTY_ID, "PropertyFromVersion3");
+        // Test check-in and pass content and properties
+        checkinComment = "Checkin from Unit Test-3.";
+        fVerSvc.checkIn(fRepositoryId, idHolder, true, newProps, content3, checkinComment, null, null, null, null);
+        /* String verIdV3 = */idHolder.getValue();
+
+        // Try to update version2 which should fail (on a versioned document
+        // only a document that
+        // is checked out can be modified.
+        try {
+            fCreator.updateProperty(verIdV2, VersionTestTypeSystemCreator.PROPERTY_ID, "ChangeWithoutCheckout");
+            fail("updateProperty for an older version should fail.");
+        } catch (Exception e) {
+            assertTrue(e instanceof CmisUpdateConflictException);
+        }
+        // try to set content on an older version
+        ContentStream content4 = super.createContent('x');
+        idHolder = new Holder<String>(verIdV2);
+        try {
+            fObjSvc.setContentStream(fRepositoryId, idHolder, true, null, content4, null);
+            fail("setContentStream for an older version should fail.");
+        } catch (Exception e) {
+            assertTrue(e instanceof CmisUpdateConflictException);
+        }
+
+        return verSeriesId;
+    }
+
+    public static class VersionTestTypeSystemCreator implements TypeCreator {
+        static public String VERSION_TEST_DOCUMENT_TYPE_ID = "MyVersionedType";
+        static public String PROPERTY_ID = "StringProp";
+
+        public List<TypeDefinition> createTypesList() {
+            // always add CMIS default types
+            List<TypeDefinition> typesList = new LinkedList<TypeDefinition>();
+
+            // create a complex type with properties
+            InMemoryDocumentTypeDefinition cmisComplexType = new InMemoryDocumentTypeDefinition(
+                    VERSION_TEST_DOCUMENT_TYPE_ID, "VersionedType", InMemoryDocumentTypeDefinition
+                            .getRootDocumentType());
+
+            // create a single String property definition
+
+            Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
+
+            PropertyStringDefinitionImpl prop1 = PropertyCreationHelper.createStringDefinition(PROPERTY_ID,
+                    "Sample String Property");
+            propertyDefinitions.put(prop1.getId(), prop1);
+
+            cmisComplexType.addCustomPropertyDefinitions(propertyDefinitions);
+            cmisComplexType.setIsVersionable(true); // make it a versionable
+            // type;
 
-			// add type to types collection
-			typesList.add(cmisComplexType);
+            // add type to types collection
+            typesList.add(cmisComplexType);
 
-			return typesList;
-		}
+            return typesList;
+        }
 
-	} // ObjectTestTypeSystemCreator
+    } // ObjectTestTypeSystemCreator
 
 }
\ No newline at end of file

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/AbstractServicesFactory.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/AbstractServicesFactory.java?rev=936938&r1=936937&r2=936938&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/AbstractServicesFactory.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/AbstractServicesFactory.java Thu Apr 22 16:27:57 2010
@@ -30,78 +30,78 @@ import org.apache.chemistry.opencmis.com
  */
 public abstract class AbstractServicesFactory {
 
-	/**
-	 * Initializes the factory instance.
-	 */
-	public void init(Map<String, String> parameters) {
-	}
-
-	/**
-	 * Cleans up the the factory instance.
-	 */
-	public void destroy() {
-	}
-
-	/**
-	 * Returns the CMIS Repository Service object.
-	 */
-	public CmisRepositoryService getRepositoryService() {
-		throw new CmisNotSupportedException("Repository Service not supported!");
-	}
-
-	/**
-	 * Returns the CMIS Navigation Service object.
-	 */
-	public CmisNavigationService getNavigationService() {
-		throw new CmisNotSupportedException("Navigation Service not supported!");
-	}
-
-	/**
-	 * Returns the CMIS Object Service object.
-	 */
-	public CmisObjectService getObjectService() {
-		throw new CmisNotSupportedException("Object Service not supported!");
-	}
-
-	/**
-	 * Returns the CMIS Versioning Service object.
-	 */
-	public CmisVersioningService getVersioningService() {
-		throw new CmisNotSupportedException("Versioning Service not supported!");
-	}
-
-	/**
-	 * Returns the CMIS Relationship Service object.
-	 */
-	public CmisRelationshipService getRelationshipService() {
-		throw new CmisNotSupportedException("Releationship Service not supported!");
-	}
-
-	/**
-	 * Returns the CMIS Discovery Service object.
-	 */
-	public CmisDiscoveryService getDiscoveryService() {
-		throw new CmisNotSupportedException("Discovery Service not supported!");
-	}
-
-	/**
-	 * Returns the CMIS MultiFiling Service object.
-	 */
-	public CmisMultiFilingService getMultiFilingService() {
-		throw new CmisNotSupportedException("MultiFiling Service not supported!");
-	}
-
-	/**
-	 * Returns the CMIS ACL Service object.
-	 */
-	public CmisAclService getAclService() {
-		throw new CmisNotSupportedException("ACL Service not supported!");
-	}
-
-	/**
-	 * Returns the CMIS Policy Service object.
-	 */
-	public CmisPolicyService getPolicyService() {
-		throw new CmisNotSupportedException("Policy Service not supported!");
-	}
+    /**
+     * Initializes the factory instance.
+     */
+    public void init(Map<String, String> parameters) {
+    }
+
+    /**
+     * Cleans up the the factory instance.
+     */
+    public void destroy() {
+    }
+
+    /**
+     * Returns the CMIS Repository Service object.
+     */
+    public CmisRepositoryService getRepositoryService() {
+        throw new CmisNotSupportedException("Repository Service not supported!");
+    }
+
+    /**
+     * Returns the CMIS Navigation Service object.
+     */
+    public CmisNavigationService getNavigationService() {
+        throw new CmisNotSupportedException("Navigation Service not supported!");
+    }
+
+    /**
+     * Returns the CMIS Object Service object.
+     */
+    public CmisObjectService getObjectService() {
+        throw new CmisNotSupportedException("Object Service not supported!");
+    }
+
+    /**
+     * Returns the CMIS Versioning Service object.
+     */
+    public CmisVersioningService getVersioningService() {
+        throw new CmisNotSupportedException("Versioning Service not supported!");
+    }
+
+    /**
+     * Returns the CMIS Relationship Service object.
+     */
+    public CmisRelationshipService getRelationshipService() {
+        throw new CmisNotSupportedException("Releationship Service not supported!");
+    }
+
+    /**
+     * Returns the CMIS Discovery Service object.
+     */
+    public CmisDiscoveryService getDiscoveryService() {
+        throw new CmisNotSupportedException("Discovery Service not supported!");
+    }
+
+    /**
+     * Returns the CMIS MultiFiling Service object.
+     */
+    public CmisMultiFilingService getMultiFilingService() {
+        throw new CmisNotSupportedException("MultiFiling Service not supported!");
+    }
+
+    /**
+     * Returns the CMIS ACL Service object.
+     */
+    public CmisAclService getAclService() {
+        throw new CmisNotSupportedException("ACL Service not supported!");
+    }
+
+    /**
+     * Returns the CMIS Policy Service object.
+     */
+    public CmisPolicyService getPolicyService() {
+        throw new CmisNotSupportedException("Policy Service not supported!");
+    }
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisAclService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisAclService.java?rev=936938&r1=936937&r2=936938&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisAclService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisAclService.java Thu Apr 22 16:27:57 2010
@@ -32,34 +32,34 @@ import org.apache.chemistry.opencmis.com
  */
 public interface CmisAclService {
 
-	/**
-	 * Returns the ACL of an object.
-	 * 
-	 * <p>
-	 * Bindings: AtomPub, Web Services
-	 * </p>
-	 */
-	Acl getAcl(CallContext context, String repositoryId, String objectId, Boolean onlyBasicPermissions,
-			ExtensionsData extension);
+    /**
+     * Returns the ACL of an object.
+     * 
+     * <p>
+     * Bindings: AtomPub, Web Services
+     * </p>
+     */
+    Acl getAcl(CallContext context, String repositoryId, String objectId, Boolean onlyBasicPermissions,
+            ExtensionsData extension);
 
-	/**
-	 * Adds ACEs to and removes ACEs from the ACL of an object.
-	 * 
-	 * <p>
-	 * Bindings: Web Services
-	 * </p>
-	 */
-	Acl applyAcl(CallContext context, String repositoryId, String objectId, Acl addAces, Acl removeAces,
-			AclPropagation aclPropagation, ExtensionsData extension);
+    /**
+     * Adds ACEs to and removes ACEs from the ACL of an object.
+     * 
+     * <p>
+     * Bindings: Web Services
+     * </p>
+     */
+    Acl applyAcl(CallContext context, String repositoryId, String objectId, Acl addAces, Acl removeAces,
+            AclPropagation aclPropagation, ExtensionsData extension);
 
-	/**
-	 * Applies a new ACL to an object. Since it is not possible to transmit an
-	 * "add ACL" and a "remove ACL" via AtomPub, the merging has to be done the
-	 * client side. The ACEs provided here is supposed to the new complete ACL.
-	 * 
-	 * <p>
-	 * Bindings: AtomPub
-	 * </p>
-	 */
-	Acl applyAcl(CallContext context, String repositoryId, String objectId, Acl aces, AclPropagation aclPropagation);
+    /**
+     * Applies a new ACL to an object. Since it is not possible to transmit an
+     * "add ACL" and a "remove ACL" via AtomPub, the merging has to be done the
+     * client side. The ACEs provided here is supposed to the new complete ACL.
+     * 
+     * <p>
+     * Bindings: AtomPub
+     * </p>
+     */
+    Acl applyAcl(CallContext context, String repositoryId, String objectId, Acl aces, AclPropagation aclPropagation);
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisDiscoveryService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisDiscoveryService.java?rev=936938&r1=936937&r2=936938&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisDiscoveryService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisDiscoveryService.java Thu Apr 22 16:27:57 2010
@@ -35,25 +35,25 @@ import org.apache.chemistry.opencmis.com
  */
 public interface CmisDiscoveryService {
 
-	/**
-	 * Queries the repository.
-	 * 
-	 * <p>
-	 * Bindings: AtomPub, Web Services
-	 * </p>
-	 */
-	public ObjectList query(CallContext context, String repositoryId, String statement, Boolean searchAllVersions,
-			Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
-			BigInteger maxItems, BigInteger skipCount, ExtensionsData extension);
+    /**
+     * Queries the repository.
+     * 
+     * <p>
+     * Bindings: AtomPub, Web Services
+     * </p>
+     */
+    public ObjectList query(CallContext context, String repositoryId, String statement, Boolean searchAllVersions,
+            Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
+            BigInteger maxItems, BigInteger skipCount, ExtensionsData extension);
 
-	/**
-	 * Retrieves the content changes.
-	 * 
-	 * <p>
-	 * Bindings: AtomPub, Web Services
-	 * </p>
-	 */
-	public ObjectList getContentChanges(CallContext context, String repositoryId, Holder<String> changeLogToken,
-			Boolean includeProperties, String filter, Boolean includePolicyIds, Boolean includeAcl,
-			BigInteger maxItems, ExtensionsData extension, ObjectInfoHolder objectInfos);
+    /**
+     * Retrieves the content changes.
+     * 
+     * <p>
+     * Bindings: AtomPub, Web Services
+     * </p>
+     */
+    public ObjectList getContentChanges(CallContext context, String repositoryId, Holder<String> changeLogToken,
+            Boolean includeProperties, String filter, Boolean includePolicyIds, Boolean includeAcl,
+            BigInteger maxItems, ExtensionsData extension, ObjectInfoHolder objectInfos);
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisMultiFilingService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisMultiFilingService.java?rev=936938&r1=936937&r2=936938&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisMultiFilingService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisMultiFilingService.java Thu Apr 22 16:27:57 2010
@@ -31,23 +31,23 @@ import org.apache.chemistry.opencmis.com
  */
 public interface CmisMultiFilingService {
 
-	/**
-	 * Adds an object to a folder.
-	 * 
-	 * <p>
-	 * Bindings: AtomPub, Web Services
-	 * </p>
-	 */
-	ObjectData addObjectToFolder(CallContext context, String repositoryId, String objectId, String folderId,
-			Boolean allVersions, ExtensionsData extension, ObjectInfoHolder objectInfos);
+    /**
+     * Adds an object to a folder.
+     * 
+     * <p>
+     * Bindings: AtomPub, Web Services
+     * </p>
+     */
+    ObjectData addObjectToFolder(CallContext context, String repositoryId, String objectId, String folderId,
+            Boolean allVersions, ExtensionsData extension, ObjectInfoHolder objectInfos);
 
-	/**
-	 * Removes an object to a folder.
-	 * 
-	 * <p>
-	 * Bindings: AtomPub, Web Services
-	 * </p>
-	 */
-	ObjectData removeObjectFromFolder(CallContext context, String repositoryId, String objectId, String folderId,
-			ExtensionsData extension, ObjectInfoHolder objectInfos);
+    /**
+     * Removes an object to a folder.
+     * 
+     * <p>
+     * Bindings: AtomPub, Web Services
+     * </p>
+     */
+    ObjectData removeObjectFromFolder(CallContext context, String repositoryId, String objectId, String folderId,
+            ExtensionsData extension, ObjectInfoHolder objectInfos);
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisNavigationService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisNavigationService.java?rev=936938&r1=936937&r2=936938&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisNavigationService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-spi/src/main/java/org/apache/chemistry/opencmis/server/spi/CmisNavigationService.java Thu Apr 22 16:27:57 2010
@@ -39,72 +39,72 @@ import org.apache.chemistry.opencmis.com
  */
 public interface CmisNavigationService {
 
-	/**
-	 * Get the descendants on a folder.
-	 * 
-	 * <p>
-	 * Bindings: AtomPub, Web Services
-	 * </p>
-	 */
-	List<ObjectInFolderContainer> getDescendants(CallContext context, String repositoryId, String folderId,
-			BigInteger depth, String filter, Boolean includeAllowableActions,
-			IncludeRelationships includeRelationships, String renditionFilter, Boolean includePathSegment,
-			ExtensionsData extension, ObjectInfoHolder objectInfos);
-
-	/**
-	 * Get the folder tree on a folder.
-	 * 
-	 * <p>
-	 * Bindings: AtomPub, Web Services
-	 * </p>
-	 */
-	List<ObjectInFolderContainer> getFolderTree(CallContext context, String repositoryId, String folderId,
-			BigInteger depth, String filter, Boolean includeAllowableActions,
-			IncludeRelationships includeRelationships, String renditionFilter, Boolean includePathSegment,
-			ExtensionsData extension, ObjectInfoHolder objectInfos);
-
-	/**
-	 * Get the children on a folder.
-	 * 
-	 * <p>
-	 * Bindings: AtomPub, Web Services
-	 * </p>
-	 */
-	ObjectInFolderList getChildren(CallContext context, String repositoryId, String folderId, String filter,
-			String orderBy, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
-			String renditionFilter, Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount,
-			ExtensionsData extension, ObjectInfoHolder objectInfos);
-
-	/**
-	 * Gets the parent on a folder.
-	 * 
-	 * <p>
-	 * Bindings: AtomPub, Web Services
-	 * </p>
-	 */
-	ObjectData getFolderParent(CallContext context, String repositoryId, String folderId, String filter,
-			ExtensionsData extension, ObjectInfoHolder objectInfos);
-
-	/**
-	 * Gets the parents on an object.
-	 * 
-	 * <p>
-	 * Bindings: AtomPub, Web Services
-	 * </p>
-	 */
-	List<ObjectParentData> getObjectParents(CallContext context, String repositoryId, String objectId, String filter,
-			Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
-			Boolean includeRelativePathSegment, ExtensionsData extension, ObjectInfoHolder objectInfos);
-
-	/**
-	 * Gets the the list of checked out documents.
-	 * 
-	 * <p>
-	 * Bindings: AtomPub, Web Services
-	 * </p>
-	 */
-	ObjectList getCheckedOutDocs(CallContext context, String repositoryId, String folderId, String filter,
-			String orderBy, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
-			String renditionFilter, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension,
-			ObjectInfoHolder objectInfos);
+    /**
+     * Get the descendants on a folder.
+     * 
+     * <p>
+     * Bindings: AtomPub, Web Services
+     * </p>
+     */
+    List<ObjectInFolderContainer> getDescendants(CallContext context, String repositoryId, String folderId,
+            BigInteger depth, String filter, Boolean includeAllowableActions,
+            IncludeRelationships includeRelationships, String renditionFilter, Boolean includePathSegment,
+            ExtensionsData extension, ObjectInfoHolder objectInfos);
+
+    /**
+     * Get the folder tree on a folder.
+     * 
+     * <p>
+     * Bindings: AtomPub, Web Services
+     * </p>
+     */
+    List<ObjectInFolderContainer> getFolderTree(CallContext context, String repositoryId, String folderId,
+            BigInteger depth, String filter, Boolean includeAllowableActions,
+            IncludeRelationships includeRelationships, String renditionFilter, Boolean includePathSegment,
+            ExtensionsData extension, ObjectInfoHolder objectInfos);
+
+    /**
+     * Get the children on a folder.
+     * 
+     * <p>
+     * Bindings: AtomPub, Web Services
+     * </p>
+     */
+    ObjectInFolderList getChildren(CallContext context, String repositoryId, String folderId, String filter,
+            String orderBy, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+            String renditionFilter, Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount,
+            ExtensionsData extension, ObjectInfoHolder objectInfos);
+
+    /**
+     * Gets the parent on a folder.
+     * 
+     * <p>
+     * Bindings: AtomPub, Web Services
+     * </p>
+     */
+    ObjectData getFolderParent(CallContext context, String repositoryId, String folderId, String filter,
+            ExtensionsData extension, ObjectInfoHolder objectInfos);
+
+    /**
+     * Gets the parents on an object.
+     * 
+     * <p>
+     * Bindings: AtomPub, Web Services
+     * </p>
+     */
+    List<ObjectParentData> getObjectParents(CallContext context, String repositoryId, String objectId, String filter,
+            Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
+            Boolean includeRelativePathSegment, ExtensionsData extension, ObjectInfoHolder objectInfos);
+
+    /**
+     * Gets the the list of checked out documents.
+     * 
+     * <p>
+     * Bindings: AtomPub, Web Services
+     * </p>
+     */
+    ObjectList getCheckedOutDocs(CallContext context, String repositoryId, String folderId, String filter,
+            String orderBy, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+            String renditionFilter, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension,
+            ObjectInfoHolder objectInfos);
 }