mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
This is an action to undo a list of changes made in a user sandbox, relative to
the staging sandbox. Turns out yesterday's revert action isn't quite what is wanted for this use case. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4366 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -34,6 +34,7 @@ import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.model.WCMModel;
|
||||
import org.alfresco.repo.action.ActionImpl;
|
||||
import org.alfresco.repo.avm.actions.AVMRevertListAction;
|
||||
import org.alfresco.repo.avm.actions.AVMUndoSandboxListAction;
|
||||
import org.alfresco.repo.avm.actions.SimpleAVMPromoteAction;
|
||||
import org.alfresco.repo.avm.actions.SimpleAVMSubmitAction;
|
||||
import org.alfresco.repo.avm.util.BulkLoader;
|
||||
@@ -282,6 +283,53 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
fail();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the undo list action.
|
||||
*/
|
||||
public void testUndoListAction()
|
||||
{
|
||||
try
|
||||
{
|
||||
setupBasicTree();
|
||||
fService.createAVMStore("area");
|
||||
fService.createLayeredDirectory("main:/a", "area:/", "a");
|
||||
fService.getFileOutputStream("area:/a/b/c/foo").close();
|
||||
List<AVMDifference> diffs = fSyncService.compare(-1, "area:/a", -1, "main:/a");
|
||||
assertEquals(1, diffs.size());
|
||||
fSyncService.update(diffs, false, false, false, false, null, null);
|
||||
fService.getFileOutputStream("area:/a/b/c/bar").close();
|
||||
diffs = fSyncService.compare(-1, "area:/a", -1, "main:/a");
|
||||
assertEquals(1, diffs.size());
|
||||
final ActionImpl action = new ActionImpl(null,
|
||||
GUID.generate(),
|
||||
AVMUndoSandboxListAction.NAME);
|
||||
VersionPathStuffer stuffer = new VersionPathStuffer();
|
||||
stuffer.add(-1, "area:/a/b/c/bar");
|
||||
String nodeList = stuffer.toString();
|
||||
action.setParameterValue(AVMUndoSandboxListAction.PARAM_NODE_LIST, nodeList);
|
||||
final AVMUndoSandboxListAction revert = (AVMUndoSandboxListAction)fContext.getBean("avm-undo-list");
|
||||
class TxnWork implements TransactionUtil.TransactionWork<Object>
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
{
|
||||
revert.execute(action, null);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
TransactionUtil.executeInUserTransaction((TransactionService)fContext.getBean("transactionComponent"),
|
||||
new TxnWork());
|
||||
diffs = fSyncService.compare(-1, "area:/a", -1, "main:/a");
|
||||
assertEquals(0, diffs.size());
|
||||
System.out.println(recursiveList("area", -1, true));
|
||||
System.out.println(recursiveList("main", -1, true));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
fail();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the promote action.
|
||||
|
Reference in New Issue
Block a user