Allow forceCopy to work on DeletedNodes.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5679 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2007-05-15 10:17:40 +00:00
parent 5f8ffb9e51
commit 3f2d97a835
3 changed files with 20 additions and 2 deletions

View File

@@ -2469,7 +2469,7 @@ public class AVMRepository
} }
fLookupCache.onWrite(pathParts[0]); fLookupCache.onWrite(pathParts[0]);
// Just force a copy if needed by looking up in write mode. // Just force a copy if needed by looking up in write mode.
Lookup lPath = store.lookup(-1, pathParts[1], true, false); Lookup lPath = store.lookup(-1, pathParts[1], true, true);
if (lPath == null) if (lPath == null)
{ {
throw new AVMNotFoundException("Path not found."); throw new AVMNotFoundException("Path not found.");

View File

@@ -84,6 +84,23 @@ import org.alfresco.util.Pair;
*/ */
public class AVMServiceTest extends AVMServiceTestBase public class AVMServiceTest extends AVMServiceTestBase
{ {
public void testForceCopyDeleted()
{
try
{
setupBasicTree();
fService.removeNode("main:/a/b/c/foo");
fService.createSnapshot("main", null, null);
AVMNodeDescriptor desc = fService.forceCopy("main:/a/b/c/foo");
assertTrue(desc.isDeleted());
}
catch (Exception e)
{
e.printStackTrace();
fail();
}
}
public void testLayerSnapshots() public void testLayerSnapshots()
{ {
try try

View File

@@ -83,8 +83,9 @@ public class DeletedNodeImpl extends AVMNodeImpl implements DeletedNode
return fDeletedType; return fDeletedType;
} }
// TODO What happens when this is called? Does it muck anything up.
/** /**
* This should never be called. * This is only called rarely.
*/ */
public AVMNode copy(Lookup lPath) public AVMNode copy(Lookup lPath)
{ {