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 [21/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/MultiFilingTest.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/MultiFilingTest.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/MultiFilingTest.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/MultiFilingTest.java Thu Apr 22 16:27:57 2010
@@ -48,237 +48,237 @@ import org.junit.Test;
public class MultiFilingTest extends AbstractServiceTst {
- private static Log LOG = LogFactory.getLog(MultiFilingTest.class);
- private static final String DOCUMENT_TYPE_ID = UnitTestTypeSystemCreator.COMPLEX_TYPE;
- private static final String FOLDER_TYPE_ID = InMemoryFolderTypeDefinition.getRootFolderType().getId();
- private static final String UNFILED_DOC_NAME = "Unfiled document";
- private static final String RENAMED_DOC_NAME = "My Renamed Document";
-
- private String fId1;
- private String fId2;
- private String fId11;
-
- @Before
- public void setUp() throws Exception {
- super.setUp();
- }
-
- @After
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
- @Test
- public void testCreateUnfiledDocument() {
- LOG.debug("Begin testCreatUnfiledDocument()");
- String docId = createUnfiledDocument();
- String docId2 = getDocument(docId);
- assertEquals(docId, docId2);
-
- // get object parents, must be empty
- List<ObjectParentData> res = fNavSvc.getObjectParents(fRepositoryId, docId, "*", false,
- IncludeRelationships.NONE, null, true, null);
-
- assertNotNull(res);
- assertEquals(res.size(), 0);
-
- LOG.debug("End testCreatUnfiledDocument()");
- }
-
- @Test
- public void testMakeFiledDocumentUnfiled() {
- LOG.debug("Begin testMakeFiledDocumentUnfiled()");
-
- String docId = createDocument("Filed document", fRootFolderId, DOCUMENT_TYPE_ID, true);
-
- fMultiSvc.removeObjectFromFolder(fRepositoryId, docId, fRootFolderId, null);
- List<ObjectParentData> parents = fNavSvc.getObjectParents(fRepositoryId, docId, "*", false,
- IncludeRelationships.NONE, null, true, null);
- assertEquals(0, parents.size());
-
- LOG.debug("End testMakeFiledDocumentUnfiled()");
- }
-
- @Test
- public void testAddDocumentToFolder() {
- LOG.debug("Begin testAddDocumentToFolder()");
- String docId = createUnfiledDocument();
- addDocumentToFolder(docId);
- LOG.debug("End testAddDocumentToFolder()");
- }
-
- @Test
- public void testRemoveDocumentFromFolder() {
- LOG.debug("Begin testRemoveDocumentFromFolder()");
-
- String docId = createUnfiledDocument();
- removeDocumentFromFolder(docId);
- LOG.debug("End testRemoveDocumentFromFolder()");
- }
-
- @Test
- public void testMoveMultiFiledDocument() {
- LOG.debug("begin testMoveMultiFiledDocument()");
- String docId = createUnfiledDocument();
- prepareMultiFiledDocument(docId);
- String newFolderId = createFolder("folder2.1", fId2, FOLDER_TYPE_ID);
-
- Holder<String> idHolder = new Holder<String>(docId);
- fObjSvc.moveObject(fRepositoryId, idHolder, newFolderId, fId11, null);
- List<ObjectParentData> parents = fNavSvc.getObjectParents(fRepositoryId, docId, "*", false,
- IncludeRelationships.NONE, null, true, null);
- assertEquals(3, parents.size());
- boolean foundNewParent = false;
- boolean foundOldParent = false;
- for (ObjectParentData parentData : parents) {
- if (parentData.getObject().getId().equals(newFolderId))
- foundNewParent = true;
- if (parentData.getObject().getId().equals(fId11))
- foundOldParent = true;
- }
- assertTrue("After move new target should be a parent", foundNewParent);
- assertFalse("After move old source should no longer be a parent", foundOldParent);
- LOG.debug("End testMoveMultiFiledDocument()");
- }
-
- @Test
- public void testRenameMultiFiledDocument() {
- LOG.debug("begin testRenameMultiFiledDocument()");
- String docId = createUnfiledDocument();
- prepareMultiFiledDocument(docId);
- renameDocumentAndCheckResult(docId);
- LOG.debug("End testRenameMultiFiledDocument()");
- }
-
- @Test
- public void testRenameMultiFiledDocumentWithNameConflict() {
- LOG.debug("begin testRenameMultiFiledDocument()");
- String docId = createUnfiledDocument();
- prepareMultiFiledDocument(docId);
- // create a document with the new name in one of the folders
- createDocument(RENAMED_DOC_NAME, fId11, DOCUMENT_TYPE_ID, true);
- // try to rename which should fail now
- try {
- renameDocumentAndCheckResult(docId);
- fail("A rename to an existing name in one of the filed folders should fail");
- } catch (Exception e) {
- assertTrue(e instanceof CmisConstraintException);
- }
- LOG.debug("End testRenameMultiFiledDocument()");
- }
-
- @Test
- public void testAddVersionedDocumentToFolder() {
- LOG.debug("Begin testAddVersionedDocumentToFolder()");
- String docId = createVersionedDocument();
- addDocumentToFolder(docId);
- LOG.debug("End testAddVersionedDocumentToFolder()");
- }
-
- @Test
- public void testRemoveVersionedDocumentFromFolder() {
- LOG.debug("Begin testRemoveVersionedDocumentFromFolder()");
-
- String docId = createVersionedDocument();
- removeDocumentFromFolder(docId);
- LOG.debug("End testRemoveVersionedDocumentFromFolder()");
- }
-
- private void createFolders() {
- fId1 = createFolder("folder1", fRootFolderId, FOLDER_TYPE_ID);
- fId2 = createFolder("folder2", fRootFolderId, FOLDER_TYPE_ID);
- fId11 = createFolder("folder1.1", fId1, FOLDER_TYPE_ID);
- }
-
- private void addDocumentToFolder(String docId) {
-
- List<String> folderIds = prepareMultiFiledDocument(docId);
-
- // get object parents, must contain all folders
- List<ObjectParentData> res = fNavSvc.getObjectParents(fRepositoryId, docId, "*", false,
- IncludeRelationships.NONE, null, true, null);
- assertEquals(3, res.size());
- for (ObjectParentData opd : res) {
- assertTrue(folderIds.contains(opd.getObject().getId()));
- assertEquals(BaseTypeId.CMIS_FOLDER, opd.getObject().getBaseTypeId());
- assertEquals(UNFILED_DOC_NAME, opd.getRelativePathSegment());
- }
-
- // try version specific filing, should fail
- try {
- fMultiSvc.addObjectToFolder(fRepositoryId, docId, fId1, false, null);
- fail("Adding not all versions to a folder should fail.");
- } catch (Exception e) {
- assertTrue(e instanceof CmisNotSupportedException);
- }
- }
-
- private void removeDocumentFromFolder(String docId) {
- prepareMultiFiledDocument(docId);
-
- fMultiSvc.removeObjectFromFolder(fRepositoryId, docId, fId1, null);
- List<ObjectParentData> parents = fNavSvc.getObjectParents(fRepositoryId, docId, "*", false,
- IncludeRelationships.NONE, null, true, null);
- assertEquals(2, parents.size());
- for (ObjectParentData opd : parents) {
- assertFalse(fId1.equals(opd.getObject().getId()));
- }
-
- fMultiSvc.removeObjectFromFolder(fRepositoryId, docId, fId2, null);
- parents = fNavSvc.getObjectParents(fRepositoryId, docId, "*", false, IncludeRelationships.NONE, null, true,
- null);
- assertEquals(1, parents.size());
- for (ObjectParentData opd : parents) {
- assertFalse(fId1.equals(opd.getObject().getId()));
- }
-
- fMultiSvc.removeObjectFromFolder(fRepositoryId, docId, fId11, null);
- parents = fNavSvc.getObjectParents(fRepositoryId, docId, "*", false, IncludeRelationships.NONE, null, true,
- null);
- assertEquals(0, parents.size());
- }
-
- private String createUnfiledDocument() {
- return createDocument(UNFILED_DOC_NAME, null, DOCUMENT_TYPE_ID, true);
- }
-
- private List<String> prepareMultiFiledDocument(String docId) {
- createFolders();
-
- // add the document to three folders
- fMultiSvc.addObjectToFolder(fRepositoryId, docId, fId1, true, null);
- fMultiSvc.addObjectToFolder(fRepositoryId, docId, fId2, true, null);
- fMultiSvc.addObjectToFolder(fRepositoryId, docId, fId11, true, null);
-
- List<String> folderIds = new ArrayList<String>();
- folderIds.add(fId1);
- folderIds.add(fId2);
- folderIds.add(fId11);
-
- return folderIds;
- }
-
- private void renameDocumentAndCheckResult(String docId) {
- Holder<String> idHolder = new Holder<String>(docId);
- List<PropertyData<?>> properties = new ArrayList<PropertyData<?>>();
- properties.add(fFactory.createPropertyIdData(PropertyIds.NAME, RENAMED_DOC_NAME));
- Properties newProps = fFactory.createPropertiesData(properties);
- Holder<String> changeTokenHolder = new Holder<String>();
- fObjSvc.updateProperties(fRepositoryId, idHolder, changeTokenHolder, newProps, null);
- docId = idHolder.getValue();
- ObjectData res = fObjSvc.getObject(fRepositoryId, docId, "*", false, IncludeRelationships.NONE, null, false,
- false, null);
- assertNotNull(res);
- Map<String, PropertyData<?>> propMap = res.getProperties().getProperties();
- PropertyData<?> pd = propMap.get(PropertyIds.NAME);
- assertNotNull(pd);
- assertEquals(RENAMED_DOC_NAME, pd.getFirstValue());
- }
+ private static Log LOG = LogFactory.getLog(MultiFilingTest.class);
+ private static final String DOCUMENT_TYPE_ID = UnitTestTypeSystemCreator.COMPLEX_TYPE;
+ private static final String FOLDER_TYPE_ID = InMemoryFolderTypeDefinition.getRootFolderType().getId();
+ private static final String UNFILED_DOC_NAME = "Unfiled document";
+ private static final String RENAMED_DOC_NAME = "My Renamed Document";
+
+ private String fId1;
+ private String fId2;
+ private String fId11;
+
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ @Test
+ public void testCreateUnfiledDocument() {
+ LOG.debug("Begin testCreatUnfiledDocument()");
+ String docId = createUnfiledDocument();
+ String docId2 = getDocument(docId);
+ assertEquals(docId, docId2);
+
+ // get object parents, must be empty
+ List<ObjectParentData> res = fNavSvc.getObjectParents(fRepositoryId, docId, "*", false,
+ IncludeRelationships.NONE, null, true, null);
+
+ assertNotNull(res);
+ assertEquals(res.size(), 0);
+
+ LOG.debug("End testCreatUnfiledDocument()");
+ }
+
+ @Test
+ public void testMakeFiledDocumentUnfiled() {
+ LOG.debug("Begin testMakeFiledDocumentUnfiled()");
+
+ String docId = createDocument("Filed document", fRootFolderId, DOCUMENT_TYPE_ID, true);
+
+ fMultiSvc.removeObjectFromFolder(fRepositoryId, docId, fRootFolderId, null);
+ List<ObjectParentData> parents = fNavSvc.getObjectParents(fRepositoryId, docId, "*", false,
+ IncludeRelationships.NONE, null, true, null);
+ assertEquals(0, parents.size());
+
+ LOG.debug("End testMakeFiledDocumentUnfiled()");
+ }
+
+ @Test
+ public void testAddDocumentToFolder() {
+ LOG.debug("Begin testAddDocumentToFolder()");
+ String docId = createUnfiledDocument();
+ addDocumentToFolder(docId);
+ LOG.debug("End testAddDocumentToFolder()");
+ }
+
+ @Test
+ public void testRemoveDocumentFromFolder() {
+ LOG.debug("Begin testRemoveDocumentFromFolder()");
+
+ String docId = createUnfiledDocument();
+ removeDocumentFromFolder(docId);
+ LOG.debug("End testRemoveDocumentFromFolder()");
+ }
+
+ @Test
+ public void testMoveMultiFiledDocument() {
+ LOG.debug("begin testMoveMultiFiledDocument()");
+ String docId = createUnfiledDocument();
+ prepareMultiFiledDocument(docId);
+ String newFolderId = createFolder("folder2.1", fId2, FOLDER_TYPE_ID);
+
+ Holder<String> idHolder = new Holder<String>(docId);
+ fObjSvc.moveObject(fRepositoryId, idHolder, newFolderId, fId11, null);
+ List<ObjectParentData> parents = fNavSvc.getObjectParents(fRepositoryId, docId, "*", false,
+ IncludeRelationships.NONE, null, true, null);
+ assertEquals(3, parents.size());
+ boolean foundNewParent = false;
+ boolean foundOldParent = false;
+ for (ObjectParentData parentData : parents) {
+ if (parentData.getObject().getId().equals(newFolderId))
+ foundNewParent = true;
+ if (parentData.getObject().getId().equals(fId11))
+ foundOldParent = true;
+ }
+ assertTrue("After move new target should be a parent", foundNewParent);
+ assertFalse("After move old source should no longer be a parent", foundOldParent);
+ LOG.debug("End testMoveMultiFiledDocument()");
+ }
+
+ @Test
+ public void testRenameMultiFiledDocument() {
+ LOG.debug("begin testRenameMultiFiledDocument()");
+ String docId = createUnfiledDocument();
+ prepareMultiFiledDocument(docId);
+ renameDocumentAndCheckResult(docId);
+ LOG.debug("End testRenameMultiFiledDocument()");
+ }
+
+ @Test
+ public void testRenameMultiFiledDocumentWithNameConflict() {
+ LOG.debug("begin testRenameMultiFiledDocument()");
+ String docId = createUnfiledDocument();
+ prepareMultiFiledDocument(docId);
+ // create a document with the new name in one of the folders
+ createDocument(RENAMED_DOC_NAME, fId11, DOCUMENT_TYPE_ID, true);
+ // try to rename which should fail now
+ try {
+ renameDocumentAndCheckResult(docId);
+ fail("A rename to an existing name in one of the filed folders should fail");
+ } catch (Exception e) {
+ assertTrue(e instanceof CmisConstraintException);
+ }
+ LOG.debug("End testRenameMultiFiledDocument()");
+ }
+
+ @Test
+ public void testAddVersionedDocumentToFolder() {
+ LOG.debug("Begin testAddVersionedDocumentToFolder()");
+ String docId = createVersionedDocument();
+ addDocumentToFolder(docId);
+ LOG.debug("End testAddVersionedDocumentToFolder()");
+ }
+
+ @Test
+ public void testRemoveVersionedDocumentFromFolder() {
+ LOG.debug("Begin testRemoveVersionedDocumentFromFolder()");
+
+ String docId = createVersionedDocument();
+ removeDocumentFromFolder(docId);
+ LOG.debug("End testRemoveVersionedDocumentFromFolder()");
+ }
+
+ private void createFolders() {
+ fId1 = createFolder("folder1", fRootFolderId, FOLDER_TYPE_ID);
+ fId2 = createFolder("folder2", fRootFolderId, FOLDER_TYPE_ID);
+ fId11 = createFolder("folder1.1", fId1, FOLDER_TYPE_ID);
+ }
+
+ private void addDocumentToFolder(String docId) {
+
+ List<String> folderIds = prepareMultiFiledDocument(docId);
+
+ // get object parents, must contain all folders
+ List<ObjectParentData> res = fNavSvc.getObjectParents(fRepositoryId, docId, "*", false,
+ IncludeRelationships.NONE, null, true, null);
+ assertEquals(3, res.size());
+ for (ObjectParentData opd : res) {
+ assertTrue(folderIds.contains(opd.getObject().getId()));
+ assertEquals(BaseTypeId.CMIS_FOLDER, opd.getObject().getBaseTypeId());
+ assertEquals(UNFILED_DOC_NAME, opd.getRelativePathSegment());
+ }
+
+ // try version specific filing, should fail
+ try {
+ fMultiSvc.addObjectToFolder(fRepositoryId, docId, fId1, false, null);
+ fail("Adding not all versions to a folder should fail.");
+ } catch (Exception e) {
+ assertTrue(e instanceof CmisNotSupportedException);
+ }
+ }
+
+ private void removeDocumentFromFolder(String docId) {
+ prepareMultiFiledDocument(docId);
+
+ fMultiSvc.removeObjectFromFolder(fRepositoryId, docId, fId1, null);
+ List<ObjectParentData> parents = fNavSvc.getObjectParents(fRepositoryId, docId, "*", false,
+ IncludeRelationships.NONE, null, true, null);
+ assertEquals(2, parents.size());
+ for (ObjectParentData opd : parents) {
+ assertFalse(fId1.equals(opd.getObject().getId()));
+ }
+
+ fMultiSvc.removeObjectFromFolder(fRepositoryId, docId, fId2, null);
+ parents = fNavSvc.getObjectParents(fRepositoryId, docId, "*", false, IncludeRelationships.NONE, null, true,
+ null);
+ assertEquals(1, parents.size());
+ for (ObjectParentData opd : parents) {
+ assertFalse(fId1.equals(opd.getObject().getId()));
+ }
+
+ fMultiSvc.removeObjectFromFolder(fRepositoryId, docId, fId11, null);
+ parents = fNavSvc.getObjectParents(fRepositoryId, docId, "*", false, IncludeRelationships.NONE, null, true,
+ null);
+ assertEquals(0, parents.size());
+ }
+
+ private String createUnfiledDocument() {
+ return createDocument(UNFILED_DOC_NAME, null, DOCUMENT_TYPE_ID, true);
+ }
+
+ private List<String> prepareMultiFiledDocument(String docId) {
+ createFolders();
+
+ // add the document to three folders
+ fMultiSvc.addObjectToFolder(fRepositoryId, docId, fId1, true, null);
+ fMultiSvc.addObjectToFolder(fRepositoryId, docId, fId2, true, null);
+ fMultiSvc.addObjectToFolder(fRepositoryId, docId, fId11, true, null);
+
+ List<String> folderIds = new ArrayList<String>();
+ folderIds.add(fId1);
+ folderIds.add(fId2);
+ folderIds.add(fId11);
+
+ return folderIds;
+ }
+
+ private void renameDocumentAndCheckResult(String docId) {
+ Holder<String> idHolder = new Holder<String>(docId);
+ List<PropertyData<?>> properties = new ArrayList<PropertyData<?>>();
+ properties.add(fFactory.createPropertyIdData(PropertyIds.NAME, RENAMED_DOC_NAME));
+ Properties newProps = fFactory.createPropertiesData(properties);
+ Holder<String> changeTokenHolder = new Holder<String>();
+ fObjSvc.updateProperties(fRepositoryId, idHolder, changeTokenHolder, newProps, null);
+ docId = idHolder.getValue();
+ ObjectData res = fObjSvc.getObject(fRepositoryId, docId, "*", false, IncludeRelationships.NONE, null, false,
+ false, null);
+ assertNotNull(res);
+ Map<String, PropertyData<?>> propMap = res.getProperties().getProperties();
+ PropertyData<?> pd = propMap.get(PropertyIds.NAME);
+ assertNotNull(pd);
+ assertEquals(RENAMED_DOC_NAME, pd.getFirstValue());
+ }
- private String createVersionedDocument() {
+ private String createVersionedDocument() {
- return createDocument(UNFILED_DOC_NAME, null, UnitTestTypeSystemCreator.VERSION_DOCUMENT_TYPE_ID,
- VersioningState.MAJOR, true);
+ return createDocument(UNFILED_DOC_NAME, null, UnitTestTypeSystemCreator.VERSION_DOCUMENT_TYPE_ID,
+ VersioningState.MAJOR, true);
- }
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/NavigationServiceTest.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/NavigationServiceTest.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/NavigationServiceTest.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/NavigationServiceTest.java Thu Apr 22 16:27:57 2010
@@ -45,186 +45,186 @@ import static org.junit.Assert.*;
* @author Jens
*/
public class NavigationServiceTest extends AbstractServiceTst {
- private static Log log = LogFactory.getLog(NavigationServiceTest.class);
- private static final int NUM_ROOT_FOLDERS = 10;
- private String fLevel1FolderId;
-
- @Before
- public void setUp() throws Exception {
- super.setUp();
- }
-
- @After
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
- @Test
- public void testGetChildren() {
- log.info("starting testGetChildren() ...");
- createLevel1Folders();
-
- log.info("test getting all objects with getChildren");
- BigInteger maxItems = BigInteger.valueOf(NUM_ROOT_FOLDERS * 2);
- BigInteger skipCount = BigInteger.valueOf(0);
- ObjectInFolderList result = fNavSvc.getChildren(fRepositoryId, fRootFolderId, "*", null, false,
- IncludeRelationships.NONE, null, true, maxItems, skipCount, null);
- List<ObjectInFolderData> folders = result.getObjects();
- log.info(" found " + folders.size() + " folders in getChildren()");
- for (ObjectInFolderData folder : folders) {
- log.info(" found folder id " + folder.getObject().getId() + " path segment " + folder.getPathSegment());
- }
- assertEquals(NUM_ROOT_FOLDERS, folders.size());
-
- log.info("test paging with getChildren");
- maxItems = BigInteger.valueOf(3);
- skipCount = BigInteger.valueOf(3);
- result = fNavSvc.getChildren(fRepositoryId, fRootFolderId, "*", null, false, IncludeRelationships.NONE, null,
- true, maxItems, skipCount, null);
- folders = result.getObjects();
- log.info(" found " + folders.size() + " folders in getChildren()");
- for (ObjectInFolderData folder : folders) {
- log.info(" found folder id " + folder.getObject().getId() + " path segment " + folder.getPathSegment());
- }
- assertEquals(3, folders.size());
- assertEquals("Folder 3", folders.get(0).getPathSegment());
- log.info("... testGetChildren() finished.");
- }
-
- @Test
- public void testGetFolderTree() {
- log.info("starting testGetFolderTree() ...");
- createFolderHierachy(3, 5);
-
- log.info("test getting all objects with getFolderTree");
- BigInteger depth = BigInteger.valueOf(-1);
- Boolean includePathSegments = true;
- String propertyFilter = "*";
- String renditionFilter = null;
- Boolean includeAllowableActions = false;
- String objectId = fRootFolderId;
-
- List<ObjectInFolderContainer> tree = fNavSvc.getFolderTree(fRepositoryId, objectId, depth, propertyFilter,
- includeAllowableActions, IncludeRelationships.NONE, renditionFilter, includePathSegments, null);
-
- log.info("Descendants for object id " + objectId + " are: ");
- for (ObjectInFolderContainer folder : tree) {
- logFolderContainer(folder, 0);
- }
-
- log.info("... testGetFolderTree() finished.");
- }
-
- private void logFolderContainer(ObjectInFolderContainer folder, int depth) {
- StringBuilder prefix = new StringBuilder();
- for (int i = 0; i < depth; i++)
- prefix.append(" ");
-
- log.info(prefix + "name: " + folder.getObject().getPathSegment());
- List<ObjectInFolderContainer> children = folder.getChildren();
- if (null != children) {
- for (ObjectInFolderContainer child : children) {
- logFolderContainer(child, depth + 1);
- }
- }
- }
-
- @Test
- public void testGetDescendants() {
- log.info("starting testGetDescendants() ...");
- final int numLevels = 3;
- final int childrenPerLevel = 3;
- int objCount = createFolderHierachy(numLevels, childrenPerLevel);
-
- log.info("test getting all objects with getDescendants");
- List<ObjectInFolderContainer> result = fNavSvc.getDescendants(fRepositoryId, fRootFolderId, BigInteger
- .valueOf(-1), "*", Boolean.TRUE, IncludeRelationships.NONE, null, Boolean.TRUE, null);
-
- for (ObjectInFolderContainer obj : result) {
- log.info(" found folder id " + obj.getObject().getObject().getId() + " path segment "
- + obj.getObject().getPathSegment());
- }
- int sizeOfDescs = getSizeOfDescendants(result);
- assertEquals(objCount, sizeOfDescs);
-
- log.info("test getting one level with getDescendants");
- result = fNavSvc.getDescendants(fRepositoryId, fRootFolderId, BigInteger.valueOf(1), "*", Boolean.TRUE,
- IncludeRelationships.NONE, null, Boolean.TRUE, null);
-
- for (ObjectInFolderContainer obj : result) {
- log.info(" found folder id " + obj.getObject().getObject().getId() + " path segment "
- + obj.getObject().getPathSegment());
- }
- sizeOfDescs = getSizeOfDescendants(result);
- assertEquals(childrenPerLevel, sizeOfDescs);
-
- log.info("test getting two levels with getDescendants");
- result = fNavSvc.getDescendants(fRepositoryId, fRootFolderId, BigInteger.valueOf(2), "*", Boolean.TRUE,
- IncludeRelationships.NONE, null, Boolean.TRUE, null);
-
- for (ObjectInFolderContainer obj : result) {
- log.info(" found folder id " + obj.getObject().getObject().getId() + " path segment "
- + obj.getObject().getPathSegment());
- }
- sizeOfDescs = getSizeOfDescendants(result);
- assertEquals(childrenPerLevel * childrenPerLevel + childrenPerLevel, sizeOfDescs);
-
- log.info("... testGetDescendants() finished.");
- }
-
- @Test
- public void testGetFolderParent() {
- log.info("starting testGetFolderParent() ...");
- createLevel1Folders();
- String folderId = fLevel1FolderId;
-
- ObjectData result = fNavSvc.getFolderParent(fRepositoryId, folderId, null, null);
- log.info(" found parent for id \'" + folderId + "\' is \'" + result.getId() + "\'");
- assertEquals(fRootFolderId, result.getId()); // should be root folder
-
- folderId = fRootFolderId;
- try {
- result = fNavSvc.getFolderParent(fRepositoryId, folderId, null, null);
- log.info(" found parent for id " + folderId + " is " + result.getId());
- fail("Should not be possible to get parent for root folder");
- } catch (Exception e) {
- assertEquals(CmisInvalidArgumentException.class, e.getClass());
- log.info(" getParent() for root folder raised expected exception");
- }
- log.info("... testGetFolderParent() finished.");
- }
-
- private int getSizeOfDescendants(List<ObjectInFolderContainer> objs) {
- int sum = 0;
- if (null != objs) {
- sum = objs.size();
- for (ObjectInFolderContainer obj : objs) {
- if (null != obj.getChildren())
- sum += getSizeOfDescendants(obj.getChildren());
- }
- }
- return sum;
- }
-
- private void createLevel1Folders() {
- for (int i = 0; i < NUM_ROOT_FOLDERS; i++) {
- List<PropertyData<?>> properties = new ArrayList<PropertyData<?>>();
- properties.add(fFactory.createPropertyIdData(PropertyIds.NAME, "Folder " + i));
- properties.add(fFactory.createPropertyIdData(PropertyIds.OBJECT_TYPE_ID, InMemoryFolderTypeDefinition
- .getRootFolderType().getId()));
- Properties props = fFactory.createPropertiesData(properties);
- String id = fObjSvc.createFolder(fRepositoryId, props, fRootFolderId, null, null, null, null);
- if (i == 3) // store one
- fLevel1FolderId = id;
- }
- }
-
- private int createFolderHierachy(int levels, int childrenPerLevel) {
-
- ObjectGenerator gen = new ObjectGenerator(fFactory, fNavSvc, fObjSvc, fRepositoryId);
- gen.createFolderHierachy(levels, childrenPerLevel, fRootFolderId);
- int objCount = gen.getObjectsInTotal();
- return objCount;
- }
+ private static Log log = LogFactory.getLog(NavigationServiceTest.class);
+ private static final int NUM_ROOT_FOLDERS = 10;
+ private String fLevel1FolderId;
+
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ @Test
+ public void testGetChildren() {
+ log.info("starting testGetChildren() ...");
+ createLevel1Folders();
+
+ log.info("test getting all objects with getChildren");
+ BigInteger maxItems = BigInteger.valueOf(NUM_ROOT_FOLDERS * 2);
+ BigInteger skipCount = BigInteger.valueOf(0);
+ ObjectInFolderList result = fNavSvc.getChildren(fRepositoryId, fRootFolderId, "*", null, false,
+ IncludeRelationships.NONE, null, true, maxItems, skipCount, null);
+ List<ObjectInFolderData> folders = result.getObjects();
+ log.info(" found " + folders.size() + " folders in getChildren()");
+ for (ObjectInFolderData folder : folders) {
+ log.info(" found folder id " + folder.getObject().getId() + " path segment " + folder.getPathSegment());
+ }
+ assertEquals(NUM_ROOT_FOLDERS, folders.size());
+
+ log.info("test paging with getChildren");
+ maxItems = BigInteger.valueOf(3);
+ skipCount = BigInteger.valueOf(3);
+ result = fNavSvc.getChildren(fRepositoryId, fRootFolderId, "*", null, false, IncludeRelationships.NONE, null,
+ true, maxItems, skipCount, null);
+ folders = result.getObjects();
+ log.info(" found " + folders.size() + " folders in getChildren()");
+ for (ObjectInFolderData folder : folders) {
+ log.info(" found folder id " + folder.getObject().getId() + " path segment " + folder.getPathSegment());
+ }
+ assertEquals(3, folders.size());
+ assertEquals("Folder 3", folders.get(0).getPathSegment());
+ log.info("... testGetChildren() finished.");
+ }
+
+ @Test
+ public void testGetFolderTree() {
+ log.info("starting testGetFolderTree() ...");
+ createFolderHierachy(3, 5);
+
+ log.info("test getting all objects with getFolderTree");
+ BigInteger depth = BigInteger.valueOf(-1);
+ Boolean includePathSegments = true;
+ String propertyFilter = "*";
+ String renditionFilter = null;
+ Boolean includeAllowableActions = false;
+ String objectId = fRootFolderId;
+
+ List<ObjectInFolderContainer> tree = fNavSvc.getFolderTree(fRepositoryId, objectId, depth, propertyFilter,
+ includeAllowableActions, IncludeRelationships.NONE, renditionFilter, includePathSegments, null);
+
+ log.info("Descendants for object id " + objectId + " are: ");
+ for (ObjectInFolderContainer folder : tree) {
+ logFolderContainer(folder, 0);
+ }
+
+ log.info("... testGetFolderTree() finished.");
+ }
+
+ private void logFolderContainer(ObjectInFolderContainer folder, int depth) {
+ StringBuilder prefix = new StringBuilder();
+ for (int i = 0; i < depth; i++)
+ prefix.append(" ");
+
+ log.info(prefix + "name: " + folder.getObject().getPathSegment());
+ List<ObjectInFolderContainer> children = folder.getChildren();
+ if (null != children) {
+ for (ObjectInFolderContainer child : children) {
+ logFolderContainer(child, depth + 1);
+ }
+ }
+ }
+
+ @Test
+ public void testGetDescendants() {
+ log.info("starting testGetDescendants() ...");
+ final int numLevels = 3;
+ final int childrenPerLevel = 3;
+ int objCount = createFolderHierachy(numLevels, childrenPerLevel);
+
+ log.info("test getting all objects with getDescendants");
+ List<ObjectInFolderContainer> result = fNavSvc.getDescendants(fRepositoryId, fRootFolderId, BigInteger
+ .valueOf(-1), "*", Boolean.TRUE, IncludeRelationships.NONE, null, Boolean.TRUE, null);
+
+ for (ObjectInFolderContainer obj : result) {
+ log.info(" found folder id " + obj.getObject().getObject().getId() + " path segment "
+ + obj.getObject().getPathSegment());
+ }
+ int sizeOfDescs = getSizeOfDescendants(result);
+ assertEquals(objCount, sizeOfDescs);
+
+ log.info("test getting one level with getDescendants");
+ result = fNavSvc.getDescendants(fRepositoryId, fRootFolderId, BigInteger.valueOf(1), "*", Boolean.TRUE,
+ IncludeRelationships.NONE, null, Boolean.TRUE, null);
+
+ for (ObjectInFolderContainer obj : result) {
+ log.info(" found folder id " + obj.getObject().getObject().getId() + " path segment "
+ + obj.getObject().getPathSegment());
+ }
+ sizeOfDescs = getSizeOfDescendants(result);
+ assertEquals(childrenPerLevel, sizeOfDescs);
+
+ log.info("test getting two levels with getDescendants");
+ result = fNavSvc.getDescendants(fRepositoryId, fRootFolderId, BigInteger.valueOf(2), "*", Boolean.TRUE,
+ IncludeRelationships.NONE, null, Boolean.TRUE, null);
+
+ for (ObjectInFolderContainer obj : result) {
+ log.info(" found folder id " + obj.getObject().getObject().getId() + " path segment "
+ + obj.getObject().getPathSegment());
+ }
+ sizeOfDescs = getSizeOfDescendants(result);
+ assertEquals(childrenPerLevel * childrenPerLevel + childrenPerLevel, sizeOfDescs);
+
+ log.info("... testGetDescendants() finished.");
+ }
+
+ @Test
+ public void testGetFolderParent() {
+ log.info("starting testGetFolderParent() ...");
+ createLevel1Folders();
+ String folderId = fLevel1FolderId;
+
+ ObjectData result = fNavSvc.getFolderParent(fRepositoryId, folderId, null, null);
+ log.info(" found parent for id \'" + folderId + "\' is \'" + result.getId() + "\'");
+ assertEquals(fRootFolderId, result.getId()); // should be root folder
+
+ folderId = fRootFolderId;
+ try {
+ result = fNavSvc.getFolderParent(fRepositoryId, folderId, null, null);
+ log.info(" found parent for id " + folderId + " is " + result.getId());
+ fail("Should not be possible to get parent for root folder");
+ } catch (Exception e) {
+ assertEquals(CmisInvalidArgumentException.class, e.getClass());
+ log.info(" getParent() for root folder raised expected exception");
+ }
+ log.info("... testGetFolderParent() finished.");
+ }
+
+ private int getSizeOfDescendants(List<ObjectInFolderContainer> objs) {
+ int sum = 0;
+ if (null != objs) {
+ sum = objs.size();
+ for (ObjectInFolderContainer obj : objs) {
+ if (null != obj.getChildren())
+ sum += getSizeOfDescendants(obj.getChildren());
+ }
+ }
+ return sum;
+ }
+
+ private void createLevel1Folders() {
+ for (int i = 0; i < NUM_ROOT_FOLDERS; i++) {
+ List<PropertyData<?>> properties = new ArrayList<PropertyData<?>>();
+ properties.add(fFactory.createPropertyIdData(PropertyIds.NAME, "Folder " + i));
+ properties.add(fFactory.createPropertyIdData(PropertyIds.OBJECT_TYPE_ID, InMemoryFolderTypeDefinition
+ .getRootFolderType().getId()));
+ Properties props = fFactory.createPropertiesData(properties);
+ String id = fObjSvc.createFolder(fRepositoryId, props, fRootFolderId, null, null, null, null);
+ if (i == 3) // store one
+ fLevel1FolderId = id;
+ }
+ }
+
+ private int createFolderHierachy(int levels, int childrenPerLevel) {
+
+ ObjectGenerator gen = new ObjectGenerator(fFactory, fNavSvc, fObjSvc, fRepositoryId);
+ gen.createFolderHierachy(levels, childrenPerLevel, fRootFolderId);
+ int objCount = gen.getObjectsInTotal();
+ return objCount;
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectCreator.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/ObjectCreator.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/ObjectCreator.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectCreator.java Thu Apr 22 16:27:57 2010
@@ -43,140 +43,140 @@ import org.apache.chemistry.opencmis.com
public class ObjectCreator {
- private BindingsObjectFactory fFactory;
- private ObjectService fObjSvc;
- private String fRepositoryId;
-
- public ObjectCreator(BindingsObjectFactory factory, ObjectService objSvc, String repositoryId) {
- fObjSvc = objSvc;
- fFactory = factory;
- fRepositoryId = repositoryId;
- }
-
- public String createDocument(String name, String typeId, String folderId, VersioningState versioningState,
- Map<String, String> propsToSet) {
- ContentStream contentStream = null;
- List<String> policies = null;
- Acl addACEs = null;
- Acl removeACEs = null;
- ExtensionsData extension = null;
-
- Properties props = createStringDocumentProperties(name, typeId, propsToSet);
-
- contentStream = createContent();
-
- String id = null;
- id = fObjSvc.createDocument(fRepositoryId, props, folderId, contentStream, versioningState, policies, addACEs,
- removeACEs, extension);
- if (null == id)
- junit.framework.Assert.fail("createDocument failed.");
-
- return id;
- }
-
- public Properties createStringDocumentProperties(String name, String typeId, Map<String, String> propsToSet) {
- List<PropertyData<?>> properties = new ArrayList<PropertyData<?>>();
- properties.add(fFactory.createPropertyIdData(PropertyIds.NAME, name));
- properties.add(fFactory.createPropertyIdData(PropertyIds.OBJECT_TYPE_ID, typeId));
- if (null != propsToSet)
- for (Entry<String, String> propToSet : propsToSet.entrySet()) {
- properties.add(fFactory.createPropertyStringData(propToSet.getKey(), propToSet.getValue()));
- }
- Properties props = fFactory.createPropertiesData(properties);
- return props;
- }
-
- public ContentStream createContent() {
- ContentStreamImpl content = new ContentStreamImpl();
- content.setFileName("data.txt");
- content.setMimeType("text/plain");
- int len = 32 * 1024;
- byte[] b = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x0c, 0x0a,
- 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x0c, 0x0a }; // 32
- // Bytes
- ByteArrayOutputStream ba = new ByteArrayOutputStream(len);
- try {
- for (int i = 0; i < 1024; i++)
- ba.write(b);
- } catch (IOException e) {
- throw new RuntimeException("Failed to fill content stream with data", e);
- }
- content.setStream(new ByteArrayInputStream(ba.toByteArray()));
- content.setLength(BigInteger.valueOf(len));
- return content;
- }
-
- public ContentStream createAlternateContent() {
- ContentStreamImpl content = new ContentStreamImpl();
- content.setFileName("data.txt");
- content.setMimeType("text/plain");
- int len = 32 * 1024;
- byte[] b = { 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61,
- 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61 }; // 32
- // Bytes
- ByteArrayOutputStream ba = new ByteArrayOutputStream(len);
- try {
- for (int i = 0; i < 1024; i++)
- ba.write(b);
- } catch (IOException e) {
- throw new RuntimeException("Failed to fill content stream with data", e);
- }
- content.setStream(new ByteArrayInputStream(ba.toByteArray()));
- content.setLength(BigInteger.valueOf(len));
- return content;
- }
-
- /**
- * Compare two streams and return true if they are equal
- *
- * @param csd1
- * @param csd2
- * @return
- */
- public boolean verifyContent(ContentStream csd1, ContentStream csd2) {
- if (!csd1.getFileName().equals(csd2.getFileName()))
- return false;
- if (!csd1.getBigLength().equals(csd2.getBigLength()))
- return false;
- if (!csd1.getMimeType().equals(csd2.getMimeType()))
- return false;
- long len = csd1.getBigLength().longValue();
- InputStream s1 = csd1.getStream();
- InputStream s2 = csd2.getStream();
- try {
- for (int i = 0; i < len; i++) {
- int val1 = s1.read();
- int val2 = s2.read();
- if (val1 != val2)
- return false;
- }
- } catch (IOException e) {
- e.printStackTrace();
- return false;
- }
- return true;
- }
-
- public void updateProperty(String id, String propertyId, String propertyValue) {
- Properties properties = getUpdatePropertyList(propertyId, propertyValue);
-
- Holder<String> idHolder = new Holder<String>(id);
- Holder<String> changeTokenHolder = new Holder<String>();
- fObjSvc.updateProperties(fRepositoryId, idHolder, changeTokenHolder, properties, null);
- }
-
- public Properties getUpdatePropertyList(String propertyId, String propertyValue) {
- List<PropertyData<?>> properties = new ArrayList<PropertyData<?>>();
- properties.add(fFactory.createPropertyStringData(propertyId, propertyValue));
- Properties newProps = fFactory.createPropertiesData(properties);
- return newProps;
- }
-
- public boolean verifyProperty(String id, String propertyId, String propertyValue) {
- Properties props = fObjSvc.getProperties(fRepositoryId, id, "*", null);
- Map<String, PropertyData<?>> propsMap = props.getProperties();
- PropertyString pd = (PropertyString) propsMap.get(propertyId);
- return propertyValue.equals(pd.getFirstValue());
- }
+ private BindingsObjectFactory fFactory;
+ private ObjectService fObjSvc;
+ private String fRepositoryId;
+
+ public ObjectCreator(BindingsObjectFactory factory, ObjectService objSvc, String repositoryId) {
+ fObjSvc = objSvc;
+ fFactory = factory;
+ fRepositoryId = repositoryId;
+ }
+
+ public String createDocument(String name, String typeId, String folderId, VersioningState versioningState,
+ Map<String, String> propsToSet) {
+ ContentStream contentStream = null;
+ List<String> policies = null;
+ Acl addACEs = null;
+ Acl removeACEs = null;
+ ExtensionsData extension = null;
+
+ Properties props = createStringDocumentProperties(name, typeId, propsToSet);
+
+ contentStream = createContent();
+
+ String id = null;
+ id = fObjSvc.createDocument(fRepositoryId, props, folderId, contentStream, versioningState, policies, addACEs,
+ removeACEs, extension);
+ if (null == id)
+ junit.framework.Assert.fail("createDocument failed.");
+
+ return id;
+ }
+
+ public Properties createStringDocumentProperties(String name, String typeId, Map<String, String> propsToSet) {
+ List<PropertyData<?>> properties = new ArrayList<PropertyData<?>>();
+ properties.add(fFactory.createPropertyIdData(PropertyIds.NAME, name));
+ properties.add(fFactory.createPropertyIdData(PropertyIds.OBJECT_TYPE_ID, typeId));
+ if (null != propsToSet)
+ for (Entry<String, String> propToSet : propsToSet.entrySet()) {
+ properties.add(fFactory.createPropertyStringData(propToSet.getKey(), propToSet.getValue()));
+ }
+ Properties props = fFactory.createPropertiesData(properties);
+ return props;
+ }
+
+ public ContentStream createContent() {
+ ContentStreamImpl content = new ContentStreamImpl();
+ content.setFileName("data.txt");
+ content.setMimeType("text/plain");
+ int len = 32 * 1024;
+ byte[] b = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x0c, 0x0a,
+ 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x0c, 0x0a }; // 32
+ // Bytes
+ ByteArrayOutputStream ba = new ByteArrayOutputStream(len);
+ try {
+ for (int i = 0; i < 1024; i++)
+ ba.write(b);
+ } catch (IOException e) {
+ throw new RuntimeException("Failed to fill content stream with data", e);
+ }
+ content.setStream(new ByteArrayInputStream(ba.toByteArray()));
+ content.setLength(BigInteger.valueOf(len));
+ return content;
+ }
+
+ public ContentStream createAlternateContent() {
+ ContentStreamImpl content = new ContentStreamImpl();
+ content.setFileName("data.txt");
+ content.setMimeType("text/plain");
+ int len = 32 * 1024;
+ byte[] b = { 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61,
+ 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61 }; // 32
+ // Bytes
+ ByteArrayOutputStream ba = new ByteArrayOutputStream(len);
+ try {
+ for (int i = 0; i < 1024; i++)
+ ba.write(b);
+ } catch (IOException e) {
+ throw new RuntimeException("Failed to fill content stream with data", e);
+ }
+ content.setStream(new ByteArrayInputStream(ba.toByteArray()));
+ content.setLength(BigInteger.valueOf(len));
+ return content;
+ }
+
+ /**
+ * Compare two streams and return true if they are equal
+ *
+ * @param csd1
+ * @param csd2
+ * @return
+ */
+ public boolean verifyContent(ContentStream csd1, ContentStream csd2) {
+ if (!csd1.getFileName().equals(csd2.getFileName()))
+ return false;
+ if (!csd1.getBigLength().equals(csd2.getBigLength()))
+ return false;
+ if (!csd1.getMimeType().equals(csd2.getMimeType()))
+ return false;
+ long len = csd1.getBigLength().longValue();
+ InputStream s1 = csd1.getStream();
+ InputStream s2 = csd2.getStream();
+ try {
+ for (int i = 0; i < len; i++) {
+ int val1 = s1.read();
+ int val2 = s2.read();
+ if (val1 != val2)
+ return false;
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ return false;
+ }
+ return true;
+ }
+
+ public void updateProperty(String id, String propertyId, String propertyValue) {
+ Properties properties = getUpdatePropertyList(propertyId, propertyValue);
+
+ Holder<String> idHolder = new Holder<String>(id);
+ Holder<String> changeTokenHolder = new Holder<String>();
+ fObjSvc.updateProperties(fRepositoryId, idHolder, changeTokenHolder, properties, null);
+ }
+
+ public Properties getUpdatePropertyList(String propertyId, String propertyValue) {
+ List<PropertyData<?>> properties = new ArrayList<PropertyData<?>>();
+ properties.add(fFactory.createPropertyStringData(propertyId, propertyValue));
+ Properties newProps = fFactory.createPropertiesData(properties);
+ return newProps;
+ }
+
+ public boolean verifyProperty(String id, String propertyId, String propertyValue) {
+ Properties props = fObjSvc.getProperties(fRepositoryId, id, "*", null);
+ Map<String, PropertyData<?>> propsMap = props.getProperties();
+ PropertyString pd = (PropertyString) propsMap.get(propertyId);
+ return propertyValue.equals(pd.getFirstValue());
+ }
}