Merged BRANCHES/DEV/BELARUS/HEAD-2011_11_10 to HEAD:

32408: ALF-1793: ACP import with UPDATE_EXISTING causes VersionServiceException



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@32677 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Matt Ward
2011-12-09 14:18:00 +00:00
parent bb62b42981
commit 2d323dd56f
2 changed files with 58 additions and 1 deletions

View File

@@ -684,4 +684,35 @@ public class NodeServiceImplTest extends BaseVersionStoreTest
assertEquals(1, nodeService.getChildAssocs(this.rootNodeRef, ContentModel.ASSOC_CONTAINS, jpQName).size());
assertEquals(jpNode, nodeService.getChildByName(rootNodeRef, ContentModel.ASSOC_CONTAINS, jpProp));
}
/*
* Test that during applying versionable aspect to the node
* that does not already have versionable aspect
* version history of this node should be deleted
*/
public void testALF1793AddVersionableAspect()
{
// Create a new versionable node and create new version
NodeRef versionableNode = createNewVersionableNode();
createVersion(versionableNode, this.versionProperties);
//Copy UUID from node properties
Map<QName, Serializable> oldProperties = this.dbNodeService.getProperties(versionableNode);
Map<QName, Serializable> newProperties = new HashMap<QName, Serializable>();
newProperties.put(ContentModel.PROP_NODE_UUID, oldProperties.get(ContentModel.PROP_NODE_UUID));
// Delete node and create new one with the same UUID
this.dbNodeService.deleteNode(versionableNode);
NodeRef newNode = this.dbNodeService.createNode(
rootNodeRef,
ContentModel.ASSOC_CHILDREN,
QName.createQName("{test}MyNode"),
TEST_TYPE_QNAME,
newProperties).getChildRef();
// add the versionable aspect to the node and create new version
this.dbNodeService.addAspect(newNode, ContentModel.ASPECT_VERSIONABLE, null);
Version version = createVersion(newNode, this.versionProperties);
assertNotNull(version);
}
}