mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix ALF-19749: NodeService/CopyService interface changes breaks backwards compatibility with add-ons
- This maintains binary compatibility with extensions build before 4.2 - e.g. GOOGLEDOCS-235 Unable to deploy latest Google Docs Enterprise AMPs onto 4.2 (HEAD-QA) - Reversed ALF-19217: NodeService and CopyService APIs return modified flags We are back to creating redundant versions when duplicate changes are made to data git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@54488 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -755,93 +755,6 @@ public class CopyServiceImplTest extends TestCase
|
||||
//System.out.println(
|
||||
// NodeStoreInspector.dumpNodeStore(nodeService, storeRef));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the return value of copy method
|
||||
* ALF-19217
|
||||
*/
|
||||
public void testCopyReturnValue()
|
||||
{
|
||||
// Check copying of the properties
|
||||
// Create the node used for copying
|
||||
NodeRef source = nodeService.createNode(
|
||||
rootNodeRef,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
QName.createQName("{test}test1"),
|
||||
TEST_TYPE_QNAME,
|
||||
createTypePropertyBag()).getChildRef();
|
||||
// Create target
|
||||
NodeRef target = nodeService.createNode(
|
||||
rootNodeRef,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
QName.createQName("{test}test2"),
|
||||
TEST_TYPE_QNAME,
|
||||
null).getChildRef();
|
||||
|
||||
// Copy the node and check
|
||||
assertTrue("Should be true for a new copy", copyService.copy(source, target));
|
||||
// Copy the same once again - should return false
|
||||
assertFalse("We are copying the same twice, no copying should be actually done", copyService.copy(source, target));
|
||||
|
||||
// Check copying of aspects
|
||||
source = nodeService.createNode(
|
||||
rootNodeRef,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
QName.createQName("{test}test3"),
|
||||
TEST_TYPE_QNAME,
|
||||
createTypePropertyBag()).getChildRef();
|
||||
// Create another bag of properties
|
||||
Map<QName, Serializable> aspectProperties = new HashMap<QName, Serializable>();
|
||||
aspectProperties.put(PROP3_QNAME_MANDATORY, TEST_VALUE_1);
|
||||
aspectProperties.put(PROP4_QNAME_OPTIONAL, TEST_VALUE_2);
|
||||
|
||||
// Apply the test aspect
|
||||
nodeService.addAspect(
|
||||
source,
|
||||
TEST_ASPECT_QNAME,
|
||||
aspectProperties);
|
||||
|
||||
nodeService.addAspect(source, ContentModel.ASPECT_TITLED, null);
|
||||
|
||||
// Create target
|
||||
target = nodeService.createNode(
|
||||
rootNodeRef,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
QName.createQName("{test}test4"),
|
||||
TEST_TYPE_QNAME,
|
||||
null).getChildRef();
|
||||
|
||||
// Copy the node and check
|
||||
assertTrue("Should be true for a new copy", copyService.copy(source, target));
|
||||
// Copy the same once again - should return false
|
||||
assertFalse("We are copying the same twice, no copying should be actually done", copyService.copy(source, target));
|
||||
|
||||
// Check copying of children
|
||||
source = nodeService.createNode(
|
||||
rootNodeRef,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
QName.createQName("{test}test3"),
|
||||
TEST_TYPE_QNAME,
|
||||
createTypePropertyBag()).getChildRef();
|
||||
NodeRef child = nodeService.createNode(
|
||||
source,
|
||||
TEST_CHILD_ASSOC_TYPE_QNAME,
|
||||
TEST_CHILD_ASSOC_QNAME,
|
||||
TEST_TYPE_QNAME,
|
||||
null).getChildRef();
|
||||
// Create target
|
||||
target = nodeService.createNode(
|
||||
rootNodeRef,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
QName.createQName("{test}test4"),
|
||||
TEST_TYPE_QNAME,
|
||||
null).getChildRef();
|
||||
// Copy the node and check
|
||||
assertTrue("Should be true for a new copy", copyService.copy(source, target));
|
||||
// Copy the same once again - should return true, as copying of children is always creating a new node
|
||||
// See org.alfresco.repo.copy.CopyServiceImpl.recursiveCopy()
|
||||
assertTrue("We are copying the same twice, will return true as we are copying a node with children", copyService.copy(source, target));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a potentially recursive copy
|
||||
|
Reference in New Issue
Block a user