Author: jens
Date: Thu May 6 10:53:51 2010
New Revision: 941654
URL: http://svn.apache.org/viewvc?rev=941654&view=rev
Log:
Fix a couple of multi-threading issues with InMemory Server
Modified:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryService.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/AbstractMultiFilingImpl.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/AbstractSingleFilingImpl.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AbstractServiceTst.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/MultiFilingTest.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java
Modified:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java?rev=941654&r1=941653&r2=941654&view=diff
==============================================================================
---
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
(original)
+++
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
Thu May 6 10:53:51 2010
@@ -585,21 +585,14 @@ public class InMemoryObjectServiceImpl e
}
// get name from properties and perform special rename to check if
- // path
- // already exists
+ // path already exists
PropertyData<?> pd = properties.getProperties().get(PropertyIds.NAME);
if (pd != null && so instanceof Filing) {
String newName = (String) pd.getFirstValue();
List<Folder> parents = ((Filing) so).getParents();
if (so instanceof Folder && parents.isEmpty())
throw new CmisConstraintException("updateProperties failed,
you cannot rename the root folder");
- for (Folder parent : parents) {
- if (parent.hasChild(newName))
- throw new CmisConstraintException(
- "updateProperties failed, cannot rename because
path already exists.");
- }
- so.rename((String) pd.getFirstValue()); // note: this does
- // persist
+ so.rename((String) pd.getFirstValue()); // note: this does persist
hasUpdatedName = true;
}
Modified:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryService.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryService.java?rev=941654&r1=941653&r2=941654&view=diff
==============================================================================
---
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryService.java
(original)
+++
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryService.java
Thu May 6 10:53:51 2010
@@ -19,13 +19,11 @@
package org.apache.chemistry.opencmis.inmemory.server;
import java.math.BigInteger;
-import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.chemistry.opencmis.commons.api.Acl;
import org.apache.chemistry.opencmis.commons.api.AllowableActions;
-import org.apache.chemistry.opencmis.commons.api.BindingsObjectFactory;
import org.apache.chemistry.opencmis.commons.api.ContentStream;
import org.apache.chemistry.opencmis.commons.api.ExtensionsData;
import org.apache.chemistry.opencmis.commons.api.FailedToDeleteData;
@@ -43,18 +41,12 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.api.TypeDefinitionList;
import org.apache.chemistry.opencmis.commons.api.server.CallContext;
import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
-import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
import org.apache.chemistry.opencmis.commons.enums.RelationshipDirection;
import org.apache.chemistry.opencmis.commons.enums.UnfileObject;
import org.apache.chemistry.opencmis.commons.enums.VersioningState;
-import
org.apache.chemistry.opencmis.commons.impl.dataobjects.BindingsObjectFactoryImpl;
import org.apache.chemistry.opencmis.commons.impl.server.AbstractCmisService;
-import org.apache.chemistry.opencmis.inmemory.ConfigConstants;
import org.apache.chemistry.opencmis.inmemory.storedobj.api.StoreManager;
-import
org.apache.chemistry.opencmis.inmemory.storedobj.impl.StoreManagerFactory;
-import org.apache.chemistry.opencmis.inmemory.storedobj.impl.StoreManagerImpl;
-import org.apache.chemistry.opencmis.util.repository.ObjectGenerator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -76,47 +68,15 @@ public class InMemoryService extends Abs
return storeManager;
}
- public InMemoryService(Map<String, String> parameters) {
-
- // initialize in-memory management
- String repositoryClassName = (String)
parameters.get(ConfigConstants.REPOSITORY_CLASS);
- if (null == repositoryClassName)
- repositoryClassName = StoreManagerImpl.class.getName();
-
- if (null == storeManager)
- storeManager =
StoreManagerFactory.createInstance(repositoryClassName);
-
- String repositoryId = parameters.get(ConfigConstants.REPOSITORY_ID);
-
- List<String> allAvailableRepositories =
storeManager.getAllRepositoryIds();
-
- // init existing repositories
- for (String existingRepId : allAvailableRepositories)
- storeManager.initRepository(existingRepId);
-
- // create repository if configured as a startup parameter
- if (null != repositoryId) {
- if (allAvailableRepositories.contains(repositoryId))
- LOG.warn("Repostory " + repositoryId + " already exists and
will not be created.");
- else {
- String typeCreatorClassName =
parameters.get(ConfigConstants.TYPE_CREATOR_CLASS);
- storeManager.createAndInitRepository(repositoryId,
typeCreatorClassName);
- }
- }
-
+ public InMemoryService(Map<String, String> parameters, StoreManager sm) {
+ storeManager = sm;
fRepSvc = new InMemoryRepositoryServiceImpl(storeManager);
fNavSvc = new InMemoryNavigationServiceImpl(storeManager);
fObjSvc = new InMemoryObjectServiceImpl(storeManager);
fVerSvc = new InMemoryVersioningServiceImpl(storeManager, fObjSvc);
fDisSvc = new InMemoryDiscoveryServiceImpl(storeManager, fRepSvc,
fNavSvc);
fMultiSvc = new InMemoryMultiFilingServiceImpl(storeManager);
-
- // With some special configuration settings fill the repository with
- // some documents and folders
- // if is empty
- if (!allAvailableRepositories.contains(repositoryId))
- fillRepositoryIfConfigured(parameters, repositoryId);
}
public CallContext getCallContext() {
@@ -412,135 +372,5 @@ public class InMemoryService extends Abs
// //////////////
//
- private void fillRepositoryIfConfigured(Map<String, String> parameters,
String repositoryId) {
- class DummyCallContext implements CallContext {
-
- public String get(String key) {
- return null;
- }
-
- public String getBinding() {
- return null;
- }
-
- public boolean isObjectInfoRequired() {
- return false;
- }
-
- public String getRepositoryId() {
- return null;
- }
-
- public String getLocale() {
- return null;
- }
-
- public String getPassword() {
- return null;
- }
-
- public String getUsername() {
- return null;
- }
- }
-
- String doFillRepositoryStr =
parameters.get(ConfigConstants.USE_REPOSITORY_FILER);
- boolean doFillRepository = doFillRepositoryStr == null ? false :
Boolean.parseBoolean(doFillRepositoryStr);
-
- if (!doFillRepository)
- return;
-
- BindingsObjectFactory objectFactory = new BindingsObjectFactoryImpl();
-// NavigationService navSvc = new NavigationServiceImpl(fNavSvc);
-// ObjectService objSvc = new ObjectServiceImpl(fObjSvc);
-// RepositoryService repSvc = new RepositoryServiceImpl(fRepSvc);
-
- String levelsStr = parameters.get(ConfigConstants.FILLER_DEPTH);
- int levels = 1;
- if (null != levelsStr)
- levels = Integer.parseInt(levelsStr);
-
- String docsPerLevelStr =
parameters.get(ConfigConstants.FILLER_DOCS_PER_FOLDER);
- int docsPerLevel = 1;
- if (null != docsPerLevelStr)
- docsPerLevel = Integer.parseInt(docsPerLevelStr);
-
- String childrenPerLevelStr =
parameters.get(ConfigConstants.FILLER_FOLDERS_PER_FOLDER);
- int childrenPerLevel = 2;
- if (null != childrenPerLevelStr)
- childrenPerLevel = Integer.parseInt(childrenPerLevelStr);
-
- String documentTypeId =
parameters.get(ConfigConstants.FILLER_DOCUMENT_TYPE_ID);
- if (null == documentTypeId)
- documentTypeId = BaseTypeId.CMIS_DOCUMENT.value();
-
- String folderTypeId =
parameters.get(ConfigConstants.FILLER_FOLDER_TYPE_ID);
- if (null == folderTypeId)
- folderTypeId = BaseTypeId.CMIS_FOLDER.value();
-
- int contentSizeKB = 0;
- String contentSizeKBStr =
parameters.get(ConfigConstants.FILLER_CONTENT_SIZE);
- if (null != contentSizeKBStr)
- contentSizeKB = Integer.parseInt(contentSizeKBStr);
-
- // Create a hierarchy of folders and fill it with some documents
- ObjectGenerator gen = new ObjectGenerator(objectFactory, this, this,
repositoryId);
-
- gen.setNumberOfDocumentsToCreatePerFolder(docsPerLevel);
-
- // Set the type id for all created documents:
- gen.setDocumentTypeId(documentTypeId);
-
- // Set the type id for all created folders:
- gen.setFolderTypeId(folderTypeId);
-
- // Set contentSize
- gen.setContentSizeInKB(contentSizeKB);
-
- // set properties that need to be filled
- // set the properties the generator should fill with values for
- // documents:
- // Note: must be valid properties in configured document and folder
type
-
- List<String> propsToSet = readPropertiesToSetFromConfig(parameters,
ConfigConstants.FILLER_DOCUMENT_PROPERTY);
- if (null != propsToSet)
- gen.setDocumentPropertiesToGenerate(propsToSet);
-
- propsToSet = readPropertiesToSetFromConfig(parameters,
ConfigConstants.FILLER_FOLDER_PROPERTY);
- if (null != propsToSet)
- gen.setFolderPropertiesToGenerate(propsToSet);
-
- // Simulate a runtime context with configuration parameters
- // Attach the CallContext to a thread local context that can be
accessed
- // from everywhere
- DummyCallContext ctx = new DummyCallContext();
- setCallContext(ctx);
- // Build the tree
- RepositoryInfo rep = fRepSvc.getRepositoryInfo(ctx, repositoryId,
null);
- String rootFolderId = rep.getRootFolderId();
-
- try {
- gen.createFolderHierachy(levels, childrenPerLevel, rootFolderId);
- // Dump the tree
- gen.dumpFolder(rootFolderId, "*");
- } catch (Exception e) {
- LOG.error("Could not create folder hierarchy with documents. " +
e);
- e.printStackTrace();
- }
-
- }
-
- private List<String> readPropertiesToSetFromConfig(Map<String, String>
parameters, String keyPrefix) {
- List<String> propsToSet = new ArrayList<String>();
- for (int i = 0;; ++i) {
- String propertyKey = keyPrefix + Integer.toString(i);
- String propertyToAdd = parameters.get(propertyKey);
- if (null == propertyToAdd)
- break;
- else
- propsToSet.add(propertyToAdd);
- }
- return propsToSet;
- }
}
Modified:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java?rev=941654&r1=941653&r2=941654&view=diff
==============================================================================
---
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java
(original)
+++
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java
Thu May 6 10:53:51 2010
@@ -19,13 +19,23 @@
package org.apache.chemistry.opencmis.inmemory.server;
import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
+import org.apache.chemistry.opencmis.commons.api.BindingsObjectFactory;
+import org.apache.chemistry.opencmis.commons.api.RepositoryInfo;
import org.apache.chemistry.opencmis.commons.api.server.CallContext;
import org.apache.chemistry.opencmis.commons.api.server.CmisService;
+import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
+import
org.apache.chemistry.opencmis.commons.impl.dataobjects.BindingsObjectFactoryImpl;
import
org.apache.chemistry.opencmis.commons.impl.server.AbstractServiceFactory;
import org.apache.chemistry.opencmis.inmemory.ConfigConstants;
+import org.apache.chemistry.opencmis.inmemory.storedobj.api.StoreManager;
+import
org.apache.chemistry.opencmis.inmemory.storedobj.impl.StoreManagerFactory;
+import org.apache.chemistry.opencmis.inmemory.storedobj.impl.StoreManagerImpl;
import org.apache.chemistry.opencmis.server.support.CmisServiceWrapper;
+import org.apache.chemistry.opencmis.util.repository.ObjectGenerator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -38,24 +48,31 @@ public class InMemoryServiceFactoryImpl
private static final BigInteger DEFAULT_DEPTH_TYPES =
BigInteger.valueOf(-1);
private static CallContext OVERRIDE_CTX;
- private InMemoryService inMemoryService;
- // private CmisServiceWrapper<InMemoryService> wrapperService;
+ private Map<String, String> inMemoryServiceParameters;
private ThreadLocal<CmisServiceWrapper<InMemoryService>>
threadLocalService = new ThreadLocal<CmisServiceWrapper<InMemoryService>>();
private boolean fUseOverrideCtx = false;
+ private StoreManager storeManager; // singleton root of everything
@Override
public void init(Map<String, String> parameters) {
LOG.info("Initializing in-memory repository...");
- inMemoryService = new InMemoryService(parameters);
- // wrapperService = new
- // CmisServiceWrapper<InMemoryService>(inMemoryService,
- // DEFAULT_MAX_ITEMS_TYPES, DEFAULT_DEPTH_TYPES,
- // DEFAULT_MAX_ITEMS_OBJECTS, DEFAULT_DEPTH_OBJECTS);
+ inMemoryServiceParameters = parameters;
String overrideCtx =
parameters.get(ConfigConstants.OVERRIDE_CALL_CONTEXT);
if (null != overrideCtx)
fUseOverrideCtx = true;
+ String repositoryClassName = (String)
parameters.get(ConfigConstants.REPOSITORY_CLASS);
+ if (null == repositoryClassName)
+ repositoryClassName = StoreManagerImpl.class.getName();
+
+ if (null == storeManager)
+ storeManager =
StoreManagerFactory.createInstance(repositoryClassName);
+
+ initStorageManager(parameters);
+
+ fillRepositoryIfConfigured(parameters);
+
LOG.info("...initialized in-memory repository.");
}
@@ -65,34 +82,200 @@ public class InMemoryServiceFactoryImpl
@Override
public CmisService getService(CallContext context) {
- LOG.debug("start getService()");
+ LOG.debug("start getService()");
- // Attach the CallContext to a thread local context that can be
- // accessed from everywhere
- // Some unit tests set their own context. So if we find one then we use
- // this one and ignore the provided one. Otherwise we set a new
context.
- if (fUseOverrideCtx && null != OVERRIDE_CTX) {
- context = OVERRIDE_CTX;
- }
-
- CmisServiceWrapper<InMemoryService> wrapperService =
threadLocalService.get();
- if (wrapperService == null) {
- wrapperService = new
CmisServiceWrapper<InMemoryService>(inMemoryService, DEFAULT_MAX_ITEMS_TYPES,
- DEFAULT_DEPTH_TYPES, DEFAULT_MAX_ITEMS_OBJECTS,
DEFAULT_DEPTH_OBJECTS);
- threadLocalService.set(wrapperService);
- }
+ // Attach the CallContext to a thread local context that can be
+ // accessed from everywhere
+ // Some unit tests set their own context. So if we find one then we use
+ // this one and ignore the provided one. Otherwise we set a new context.
+ if (fUseOverrideCtx && null != OVERRIDE_CTX) {
+ context = OVERRIDE_CTX;
+ }
+
+ CmisServiceWrapper<InMemoryService> wrapperService =
threadLocalService.get();
+ if (wrapperService == null) {
+ wrapperService = new CmisServiceWrapper<InMemoryService>(new
InMemoryService(
+ inMemoryServiceParameters, storeManager),
DEFAULT_MAX_ITEMS_TYPES, DEFAULT_DEPTH_TYPES,
+ DEFAULT_MAX_ITEMS_OBJECTS, DEFAULT_DEPTH_OBJECTS);
+ threadLocalService.set(wrapperService);
+ }
- wrapperService.getWrappedService().setCallContext(context);
+ wrapperService.getWrappedService().setCallContext(context);
- LOG.debug("stop getService()");
- return inMemoryService; // wrapperService;
+ LOG.debug("stop getService()");
+ return wrapperService.getWrappedService(); // wrapperService;
- }
+ }
@Override
public void destroy() {
threadLocalService = null;
- // RuntimeContext.remove();
}
+ private void initStorageManager(Map<String, String> parameters) {
+ // initialize in-memory management
+ String repositoryClassName = (String)
parameters.get(ConfigConstants.REPOSITORY_CLASS);
+ if (null == repositoryClassName)
+ repositoryClassName = StoreManagerImpl.class.getName();
+
+ if (null == storeManager)
+ storeManager =
StoreManagerFactory.createInstance(repositoryClassName);
+
+ String repositoryId = parameters.get(ConfigConstants.REPOSITORY_ID);
+
+ List<String> allAvailableRepositories =
storeManager.getAllRepositoryIds();
+
+ // init existing repositories
+ for (String existingRepId : allAvailableRepositories)
+ storeManager.initRepository(existingRepId);
+
+ // create repository if configured as a startup parameter
+ if (null != repositoryId) {
+ if (allAvailableRepositories.contains(repositoryId))
+ LOG.warn("Repostory " + repositoryId + " already exists and
will not be created.");
+ else {
+ String typeCreatorClassName =
parameters.get(ConfigConstants.TYPE_CREATOR_CLASS);
+ storeManager.createAndInitRepository(repositoryId,
typeCreatorClassName);
+ }
+ }
+
+ }
+
+ private List<String> readPropertiesToSetFromConfig(Map<String, String>
parameters, String keyPrefix) {
+ List<String> propsToSet = new ArrayList<String>();
+ for (int i = 0;; ++i) {
+ String propertyKey = keyPrefix + Integer.toString(i);
+ String propertyToAdd = parameters.get(propertyKey);
+ if (null == propertyToAdd)
+ break;
+ else
+ propsToSet.add(propertyToAdd);
+ }
+ return propsToSet;
+ }
+
+
+ private void fillRepositoryIfConfigured(Map<String, String> parameters) {
+
+ class DummyCallContext implements CallContext {
+
+ public String get(String key) {
+ return null;
+ }
+
+ public String getBinding() {
+ return null;
+ }
+
+ public boolean isObjectInfoRequired() {
+ return false;
+ }
+
+ public String getRepositoryId() {
+ return null;
+ }
+
+ public String getLocale() {
+ return null;
+ }
+
+ public String getPassword() {
+ return null;
+ }
+
+ public String getUsername() {
+ return null;
+ }
+ }
+
+// List<String> allAvailableRepositories =
storeManager.getAllRepositoryIds();
+ String repositoryId = parameters.get(ConfigConstants.REPOSITORY_ID);
+ String doFillRepositoryStr =
parameters.get(ConfigConstants.USE_REPOSITORY_FILER);
+ boolean doFillRepository = doFillRepositoryStr == null ? false :
Boolean.parseBoolean(doFillRepositoryStr);
+
+ if (doFillRepository /* &&
!allAvailableRepositories.contains(repositoryId) */ ) {
+
+ // create an initial temporary service instance to fill the
repository
+
+ InMemoryService svc = new InMemoryService(inMemoryServiceParameters,
storeManager);
+
+ BindingsObjectFactory objectFactory = new
BindingsObjectFactoryImpl();
+
+ String levelsStr = parameters.get(ConfigConstants.FILLER_DEPTH);
+ int levels = 1;
+ if (null != levelsStr)
+ levels = Integer.parseInt(levelsStr);
+
+ String docsPerLevelStr =
parameters.get(ConfigConstants.FILLER_DOCS_PER_FOLDER);
+ int docsPerLevel = 1;
+ if (null != docsPerLevelStr)
+ docsPerLevel = Integer.parseInt(docsPerLevelStr);
+
+ String childrenPerLevelStr =
parameters.get(ConfigConstants.FILLER_FOLDERS_PER_FOLDER);
+ int childrenPerLevel = 2;
+ if (null != childrenPerLevelStr)
+ childrenPerLevel = Integer.parseInt(childrenPerLevelStr);
+
+ String documentTypeId =
parameters.get(ConfigConstants.FILLER_DOCUMENT_TYPE_ID);
+ if (null == documentTypeId)
+ documentTypeId = BaseTypeId.CMIS_DOCUMENT.value();
+
+ String folderTypeId =
parameters.get(ConfigConstants.FILLER_FOLDER_TYPE_ID);
+ if (null == folderTypeId)
+ folderTypeId = BaseTypeId.CMIS_FOLDER.value();
+
+ int contentSizeKB = 0;
+ String contentSizeKBStr =
parameters.get(ConfigConstants.FILLER_CONTENT_SIZE);
+ if (null != contentSizeKBStr)
+ contentSizeKB = Integer.parseInt(contentSizeKBStr);
+
+ // Create a hierarchy of folders and fill it with some documents
+ ObjectGenerator gen = new ObjectGenerator(objectFactory, svc, svc,
repositoryId);
+
+ gen.setNumberOfDocumentsToCreatePerFolder(docsPerLevel);
+
+ // Set the type id for all created documents:
+ gen.setDocumentTypeId(documentTypeId);
+
+ // Set the type id for all created folders:
+ gen.setFolderTypeId(folderTypeId);
+
+ // Set contentSize
+ gen.setContentSizeInKB(contentSizeKB);
+
+ // set properties that need to be filled
+ // set the properties the generator should fill with values for
+ // documents:
+ // Note: must be valid properties in configured document and folder
type
+
+ List<String> propsToSet = readPropertiesToSetFromConfig(parameters,
ConfigConstants.FILLER_DOCUMENT_PROPERTY);
+ if (null != propsToSet)
+ gen.setDocumentPropertiesToGenerate(propsToSet);
+
+ propsToSet = readPropertiesToSetFromConfig(parameters,
ConfigConstants.FILLER_FOLDER_PROPERTY);
+ if (null != propsToSet)
+ gen.setFolderPropertiesToGenerate(propsToSet);
+
+ // Simulate a runtime context with configuration parameters
+ // Attach the CallContext to a thread local context that can be
accessed
+ // from everywhere
+ DummyCallContext ctx = new DummyCallContext();
+ svc.setCallContext(ctx);
+
+ // Build the tree
+ RepositoryInfo rep = svc.getRepositoryInfo(repositoryId, null);
+ String rootFolderId = rep.getRootFolderId();
+
+ try {
+ gen.createFolderHierachy(levels, childrenPerLevel, rootFolderId);
+ // Dump the tree
+ gen.dumpFolder(rootFolderId, "*");
+ } catch (Exception e) {
+ LOG.error("Could not create folder hierarchy with documents. " +
e);
+ e.printStackTrace();
+ }
+ } // if
+
+ } // fillRepositoryIfConfigured
+
}
Modified:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/AbstractMultiFilingImpl.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/AbstractMultiFilingImpl.java?rev=941654&r1=941653&r2=941654&view=diff
==============================================================================
---
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/AbstractMultiFilingImpl.java
(original)
+++
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/AbstractMultiFilingImpl.java
Thu May 6 10:53:51 2010
@@ -21,6 +21,9 @@ package org.apache.chemistry.opencmis.in
import java.util.ArrayList;
import java.util.List;
+import
org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
+import
org.apache.chemistry.opencmis.commons.exceptions.CmisNameConstraintViolationException;
+import org.apache.chemistry.opencmis.inmemory.NameValidator;
import org.apache.chemistry.opencmis.inmemory.storedobj.api.Folder;
import org.apache.chemistry.opencmis.inmemory.storedobj.api.MultiFiling;
@@ -47,6 +50,16 @@ public abstract class AbstractMultiFilin
*/
public void addParent(Folder parent) {
+ try {
+ fObjStore.lock();
+ addParentIntern(parent);
+ } finally {
+ fObjStore.unlock();
+ }
+ }
+
+ private void addParentIntern(Folder parent) {
+
if (parent.hasChild(getName()))
throw new IllegalArgumentException(
"Cannot assign new parent folder, this name already exists
in target folder.");
@@ -55,8 +68,9 @@ public abstract class AbstractMultiFilin
fParents = new ArrayList<Folder>();
fParents.add(parent);
- }
-
+ }
+
+
/*
* (non-Javadoc)
*
@@ -65,6 +79,15 @@ public abstract class AbstractMultiFilin
* (org.apache.opencmis.inmemory.storedobj.api.Folder)
*/
public void removeParent(Folder parent) {
+ try {
+ fObjStore.lock();
+ removeParentIntern(parent);
+ } finally {
+ fObjStore.unlock();
+ }
+ }
+
+ private void removeParentIntern(Folder parent) {
fParents.remove(parent);
if (fParents.isEmpty())
fParents = null;
@@ -100,8 +123,30 @@ public abstract class AbstractMultiFilin
* org.apache.opencmis.inmemory.storedobj.api.Folder)
*/
public void move(Folder oldParent, Folder newParent) {
- addParent(newParent);
- removeParent(oldParent);
+ try {
+ fObjStore.lock();
+ addParentIntern(newParent);
+ removeParentIntern(oldParent);
+ } finally {
+ fObjStore.unlock();
+ }
+ }
+
+ public void rename(String newName) {
+ try {
+ if (!NameValidator.isValidId(newName))
+ throw new
CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
+ fObjStore.lock();
+ for (Folder folder : fParents) {
+ if (folder == null)
+ throw new CmisInvalidArgumentException("Root folder cannot
be renamed.");
+ if (folder.hasChild(newName))
+ throw new CmisNameConstraintViolationException("Cannot
rename object to " + newName
+ + ". This path already exists in parent " +
folder.getPath() + ".");
+ }
+ setName(newName);
+ } finally {
+ fObjStore.unlock();
+ }
}
-
}
Modified:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/AbstractSingleFilingImpl.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/AbstractSingleFilingImpl.java?rev=941654&r1=941653&r2=941654&view=diff
==============================================================================
---
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/AbstractSingleFilingImpl.java
(original)
+++
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/AbstractSingleFilingImpl.java
Thu May 6 10:53:51 2010
@@ -98,34 +98,49 @@ public abstract class AbstractSingleFili
*
setParent(org.opencmis.client.provider.spi.inmemory.storedobj.api.Folder)
*/
public void setParent(Folder parent) {
- fParent = (FolderImpl) parent;
+ try {
+ fObjStore.lock();
+ fParent = (FolderImpl) parent;
+ } finally {
+ fObjStore.unlock();
+ }
}
public void rename(String newName) {
if (!NameValidator.isValidId(newName))
throw new
CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
- if (getParent() == null)
- throw new CmisInvalidArgumentException("Root folder cannot be
renamed.");
- if (getParent().hasChild(newName))
- throw new CmisNameConstraintViolationException("Cannot rename
object to " + newName
- + ". This path already exists.");
-
- setName(newName);
+ try {
+ fObjStore.lock();
+ if (getParent() == null)
+ throw new CmisInvalidArgumentException("Root folder cannot be
renamed.");
+ if (getParent().hasChild(newName))
+ throw new CmisNameConstraintViolationException("Cannot rename
object to " + newName
+ + ". This path already exists.");
+
+ setName(newName);
+ } finally {
+ fObjStore.unlock();
+ }
}
public void move(Folder oldParent, Folder newParent) {
- if (this instanceof Document || this instanceof VersionedDocument)
- fParent.moveChildDocument(this, oldParent, newParent);
- else {// it must be a folder
- if (getParent() == null)
- throw new IllegalArgumentException("Root folder cannot be
moved.");
- if (newParent == null)
- throw new IllegalArgumentException("null is not a valid move
target.");
- if (newParent.hasChild(getName()))
- throw new IllegalArgumentException("Cannot move folder, this
name already exists in target.");
-
- setParent(newParent);
+ try {
+ fObjStore.lock();
+ if (this instanceof Document || this instanceof VersionedDocument)
+ fParent.moveChildDocument(this, oldParent, newParent);
+ else {// it must be a folder
+ if (getParent() == null)
+ throw new IllegalArgumentException("Root folder cannot be
moved.");
+ if (newParent == null)
+ throw new IllegalArgumentException("null is not a valid
move target.");
+ if (newParent.hasChild(getName()))
+ throw new IllegalArgumentException("Cannot move folder,
this name already exists in target.");
+
+ setParent(newParent);
+ }
+ } finally {
+ fObjStore.unlock();
}
}
Modified:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java?rev=941654&r1=941653&r2=941654&view=diff
==============================================================================
---
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java
(original)
+++
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java
Thu May 6 10:53:51 2010
@@ -36,13 +36,18 @@ public class FolderImpl extends Abstract
}
public void addChildFolder(Folder folder) {
- boolean hasChild;
- String name = folder.getName();
- hasChild = hasChild(name);
- if (hasChild)
- throw new RuntimeException("Cannot create folder " + name + ".
Name already exists in parent folder");
- folder.setParent(this);
- folder.persist();
+ try {
+ fObjStore.lock();
+ boolean hasChild;
+ String name = folder.getName();
+ hasChild = hasChild(name);
+ if (hasChild)
+ throw new RuntimeException("Cannot create folder " + name + ".
Name already exists in parent folder");
+ folder.setParent(this);
+ folder.persist();
+ } finally {
+ fObjStore.unlock();
+ }
}
/*
@@ -61,23 +66,28 @@ public class FolderImpl extends Abstract
}
private void addChildObject(StoredObject so) {
- String name = so.getName();
- if (!NameValidator.isValidId(name))
- throw new
CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
-
- boolean hasChild;
- hasChild = hasChild(name);
- if (hasChild)
- throw new RuntimeException("Cannot create document " + name + ".
Name already exists in parent folder");
-
- if (so instanceof SingleFiling)
- ((SingleFiling) so).setParent(this);
- else if (so instanceof MultiFiling)
- ((MultiFiling) so).addParent(this);
- else
- throw new RuntimeException("Cannot create document, object is not
fileable.");
-
- so.persist();
+ try {
+ fObjStore.lock();
+ String name = so.getName();
+ if (!NameValidator.isValidId(name))
+ throw new
CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
+
+ boolean hasChild;
+ hasChild = hasChild(name);
+ if (hasChild)
+ throw new RuntimeException("Cannot create document " + name +
". Name already exists in parent folder");
+
+ if (so instanceof SingleFiling)
+ ((SingleFiling) so).setParent(this);
+ else if (so instanceof MultiFiling)
+ ((MultiFiling) so).addParent(this);
+ else
+ throw new RuntimeException("Cannot create document, object is
not fileable.");
+
+ so.persist();
+ } finally {
+ fObjStore.unlock();
+ }
}
/*
@@ -206,18 +216,23 @@ public class FolderImpl extends Abstract
}
public void moveChildDocument(StoredObject so, Folder oldParent, Folder
newParent) {
- if (newParent.hasChild(so.getName()))
- throw new IllegalArgumentException("Cannot move object, this name
already exists in target.");
- if (!(so instanceof Filing))
- throw new IllegalArgumentException("Cannot move object, object
does not have a path.");
-
- if (so instanceof SingleFiling) {
- SingleFiling pathObj = (SingleFiling) so;
- pathObj.setParent(newParent);
- } else if (so instanceof MultiFiling) {
- MultiFiling pathObj = (MultiFiling) so;
- pathObj.addParent(newParent);
- pathObj.removeParent(oldParent);
+ try {
+ fObjStore.lock();
+ if (newParent.hasChild(so.getName()))
+ throw new IllegalArgumentException("Cannot move object, this
name already exists in target.");
+ if (!(so instanceof Filing))
+ throw new IllegalArgumentException("Cannot move object, object
does not have a path.");
+
+ if (so instanceof SingleFiling) {
+ SingleFiling pathObj = (SingleFiling) so;
+ pathObj.setParent(newParent);
+ } else if (so instanceof MultiFiling) {
+ MultiFiling pathObj = (MultiFiling) so;
+ pathObj.addParent(newParent);
+ pathObj.removeParent(oldParent);
+ }
+ } finally {
+ fObjStore.unlock();
}
}
Modified:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java?rev=941654&r1=941653&r2=941654&view=diff
==============================================================================
---
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java
(original)
+++
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java
Thu May 6 10:53:51 2010
@@ -19,10 +19,12 @@
package org.apache.chemistry.opencmis.inmemory.storedobj.impl;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
import
org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
@@ -36,10 +38,27 @@ import org.apache.chemistry.opencmis.inm
import org.apache.chemistry.opencmis.inmemory.storedobj.api.VersionedDocument;
/**
- * InMemory folder implementation
- *
- * @author Jens
- *
+ * The object store is the central core of the in-memory repository. It is
based on huge HashMap
+ * map mapping ids to objects in memory. To allow access from multiple threads
a Java concurrent
+ * HashMap is used that allows parallel access methods.
+ *
+ * Certain methods in the in-memory repository must guarantee constraints. For
example a folder
+ * enforces that each child has a unique name. Therefore certain operations
must occur in an
+ * atomic manner. In the example it must be guaranteed that no write access
occurs to the
+ * map between acquiring the iterator to find the children and finishing the
add operation when
+ * no name conflicts can occur. For this purpose this class has methods to
lock an unlock the
+ * state of the repository. It is very important that the caller acquiring the
lock enforces an
+ * unlock under all circumstances. Typical code is:
+ *
+ * ObjectStoreImpl os = ... ;
+ * try {
+ * os.lock();
+ * } finally {
+ * os.unlock();
+ * }
+ *
+ * The locking is very coarse-grained. Productive implementations would
probably implement finer
+ * grained locks on a folder or document rather than the complete repository.
*/
public class ObjectStoreImpl implements ObjectStore {
@@ -50,9 +69,12 @@ public class ObjectStoreImpl implements
private static int NEXT_UNUSED_ID = 100;
/**
- * Maps the absolute folder path to the corresponding folder object
+ * a concurrent HashMap as core element to hold all objects in the
repository
*/
- private Map<String, StoredObject> fStoredObjectMap = new HashMap<String,
StoredObject>();
+ private Map<String, StoredObject> fStoredObjectMap = new
ConcurrentHashMap<String, StoredObject>();
+
+ private Lock fLock = new ReentrantLock();
+
final String fRepositoryId;
FolderImpl fRootFolder = null;
@@ -65,6 +87,14 @@ public class ObjectStoreImpl implements
return NEXT_UNUSED_ID++;
}
+ public void lock() {
+ fLock.lock();
+ }
+
+ public void unlock() {
+ fLock.unlock();
+ }
+
/*
* (non-Javadoc)
*
Modified:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java?rev=941654&r1=941653&r2=941654&view=diff
==============================================================================
---
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java
(original)
+++
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java
Thu May 6 10:53:51 2010
@@ -241,7 +241,6 @@ public class StoredObjectImpl implements
public void rename(String newName) {
setName(newName);
- persist();
}
/*
Modified:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AbstractServiceTst.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/AbstractServiceTst.java?rev=941654&r1=941653&r2=941654&view=diff
==============================================================================
---
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AbstractServiceTst.java
(original)
+++
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AbstractServiceTst.java
Thu May 6 10:53:51 2010
@@ -92,7 +92,7 @@ public class AbstractServiceTst /* exten
addParameters(parameters);
fTestCallContext = new DummyCallContext();
- // Attach a standatrd CallContext to a thread before the services are
+ // Attach a standard CallContext to a thread before the services are
// initialized.
// RuntimeContext.attachCfg(fTestCallContext);
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=941654&r1=941653&r2=941654&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 May 6 10:53:51 2010
@@ -38,6 +38,7 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
import org.apache.chemistry.opencmis.commons.enums.VersioningState;
import
org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
+import
org.apache.chemistry.opencmis.commons.exceptions.CmisNameConstraintViolationException;
import
org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException;
import
org.apache.chemistry.opencmis.inmemory.types.InMemoryFolderTypeDefinition;
import org.apache.commons.logging.Log;
@@ -162,7 +163,7 @@ public class MultiFilingTest extends Abs
renameDocumentAndCheckResult(docId);
fail("A rename to an existing name in one of the filed folders
should fail");
} catch (Exception e) {
- assertTrue(e instanceof CmisConstraintException);
+ assertTrue(e instanceof CmisNameConstraintViolationException);
}
LOG.debug("End testRenameMultiFiledDocument()");
}
Modified:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.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/ObjectServiceTest.java?rev=941654&r1=941653&r2=941654&view=diff
==============================================================================
---
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java
(original)
+++
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java
Thu May 6 10:53:51 2010
@@ -52,6 +52,7 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.enums.VersioningState;
import
org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
import
org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
+import
org.apache.chemistry.opencmis.commons.exceptions.CmisNameConstraintViolationException;
import
org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException;
import
org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
import
org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException;
@@ -639,7 +640,7 @@ public class ObjectServiceTest extends A
fObjSvc.updateProperties(fRepositoryId, idHolder,
changeTokenHolder, newProps, null);
fail("Update with a conflicting name should fail.");
} catch (Exception e) {
- assertTrue(e instanceof CmisConstraintException);
+ assertTrue(e instanceof CmisNameConstraintViolationException);
}
} catch (Exception e) {