diff --git a/config/alfresco/action-services-context.xml b/config/alfresco/action-services-context.xml
index d7a8fe6f13..dadad1640d 100644
--- a/config/alfresco/action-services-context.xml
+++ b/config/alfresco/action-services-context.xml
@@ -406,4 +406,13 @@
+
+
+
+
+
+ false
+
+
+
diff --git a/config/alfresco/messages/action-config.properties b/config/alfresco/messages/action-config.properties
index 84c4e57c15..f816114c55 100644
--- a/config/alfresco/messages/action-config.properties
+++ b/config/alfresco/messages/action-config.properties
@@ -90,3 +90,6 @@ start-workflow.description=This will start a workflow for the matched items.
simple-avm-submit.title=Simple Direct Submit
simple-avm-submit.description=This will submit any newer nodes in the matched item to the corresponding staging.
+simple-avm-promote.title=Simple Sandbox Promotion
+simple-avm-promote.description=This promotes any newer nodes in the matched item to the specified target sandbox.
+simple-avm-promote.target-store.display-label=The name of the target AVM store.
diff --git a/source/java/org/alfresco/repo/avm/AVMRepository.java b/source/java/org/alfresco/repo/avm/AVMRepository.java
index 234dfa772c..6d6e25ae52 100644
--- a/source/java/org/alfresco/repo/avm/AVMRepository.java
+++ b/source/java/org/alfresco/repo/avm/AVMRepository.java
@@ -351,7 +351,7 @@ public class AVMRepository
String dstName)
{
// This is about as ugly as it gets.
- if (dstPath.indexOf(srcPath + srcName) == 0)
+ if ((dstPath + "/").indexOf(srcPath + srcName + "/") == 0)
{
throw new AVMCycleException("Cyclic rename.");
}
diff --git a/source/java/org/alfresco/repo/avm/AVMServiceTest.java b/source/java/org/alfresco/repo/avm/AVMServiceTest.java
index 401a8d1b27..3075347832 100644
--- a/source/java/org/alfresco/repo/avm/AVMServiceTest.java
+++ b/source/java/org/alfresco/repo/avm/AVMServiceTest.java
@@ -31,6 +31,8 @@ import java.util.Set;
import java.util.TreeMap;
import org.alfresco.model.ContentModel;
+import org.alfresco.repo.action.ActionImpl;
+import org.alfresco.repo.avm.actions.SimpleAVMPromoteAction;
import org.alfresco.repo.avm.actions.SimpleAVMSubmitAction;
import org.alfresco.repo.avm.util.BulkLoader;
import org.alfresco.repo.domain.PropertyValue;
@@ -53,6 +55,7 @@ import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.transaction.TransactionService;
+import org.alfresco.util.GUID;
/**
* Big test of AVM behavior.
@@ -60,6 +63,45 @@ import org.alfresco.service.transaction.TransactionService;
*/
public class AVMServiceTest extends AVMServiceTestBase
{
+ /**
+ * Test the promote action.
+ */
+ public void testPromoteAction()
+ {
+ try
+ {
+ setupBasicTree();
+ fService.createDirectory("main:/", "appBase");
+ fService.rename("main:/", "a", "main:/appBase", "a");
+ fService.rename("main:/", "d", "main:/appBase", "d");
+ fService.createSnapshot("main");
+ fService.createAVMStore("source");
+ fService.createLayeredDirectory("main:/appBase", "source:/", "appBase");
+ fService.getFileOutputStream("source:/appBase/a/b/c/foo").close();
+ final ActionImpl action = new ActionImpl(AVMNodeConverter.ToNodeRef(-1, "source:/appBase/a"),
+ GUID.generate(),
+ SimpleAVMPromoteAction.NAME);
+ action.setParameterValue(SimpleAVMPromoteAction.PARAM_TARGET_STORE, "main");
+ final SimpleAVMPromoteAction promote = (SimpleAVMPromoteAction)fContext.getBean("simple-avm-promote");
+ class TxnWork implements TransactionUtil.TransactionWork