mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Added a recursive copy method to AVMService. Added basic test for it. However,
for most purposes, createBranch has the same effect at a fraction of the cost. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4287 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -66,6 +66,43 @@ import org.alfresco.util.Pair;
|
||||
*/
|
||||
public class AVMServiceTest extends AVMServiceTestBase
|
||||
{
|
||||
/**
|
||||
* Test copy.
|
||||
*/
|
||||
public void testCopy()
|
||||
{
|
||||
try
|
||||
{
|
||||
setupBasicTree();
|
||||
// Copy a file.
|
||||
fService.copy(-1, "main:/a/b/c/foo", "main:/d", "fooCopy");
|
||||
AVMNodeDescriptor desc = fService.lookup(-1, "main:/d/fooCopy");
|
||||
assertTrue(desc.isFile());
|
||||
// Copy a whole tree
|
||||
fService.copy(-1, "main:/a", "main:/d/e", "aCopy");
|
||||
desc = fService.lookup(-1, "main:/d/e/aCopy");
|
||||
assertTrue(desc.isDirectory());
|
||||
desc = fService.lookup(-1, "main:/a/b/c/bar");
|
||||
AVMNodeDescriptor desc2 = fService.lookup(-1, "main:/d/e/aCopy/b/c/bar");
|
||||
assertTrue(desc2.isFile());
|
||||
assertEquals(desc.getLength(), desc2.getLength());
|
||||
// Check that it rejects infinite copies.
|
||||
try
|
||||
{
|
||||
fService.copy(-1, "main:/", "main://d/e", "illegal");
|
||||
fail();
|
||||
}
|
||||
catch (AVMException ae)
|
||||
{
|
||||
// This is a success.
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
fail();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Test cyclic lookup behavior.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user