mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Replication Service tweaks
In preparation for writing the webscripts, add a rename service method, and change the user facing type of the name from QName to string git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21440 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -304,7 +304,7 @@ public class ReplicationActionExecutor extends ActionExecuterAbstractBase {
|
|||||||
try {
|
try {
|
||||||
// Quick try
|
// Quick try
|
||||||
lockToken = jobLockService.getLock(
|
lockToken = jobLockService.getLock(
|
||||||
replicationDef.getReplicationName(),
|
replicationDef.getReplicationQName(),
|
||||||
replicationActionLockDuration,
|
replicationActionLockDuration,
|
||||||
5 * 1000, // Every 5 seconds
|
5 * 1000, // Every 5 seconds
|
||||||
6 // 6 times = wait up to 30 seconds
|
6 // 6 times = wait up to 30 seconds
|
||||||
@@ -312,7 +312,7 @@ public class ReplicationActionExecutor extends ActionExecuterAbstractBase {
|
|||||||
} catch(LockAcquisitionException e) {
|
} catch(LockAcquisitionException e) {
|
||||||
// Long try - every 30 seconds
|
// Long try - every 30 seconds
|
||||||
lockToken = jobLockService.getLock(
|
lockToken = jobLockService.getLock(
|
||||||
replicationDef.getReplicationName(),
|
replicationDef.getReplicationQName(),
|
||||||
replicationActionLockDuration,
|
replicationActionLockDuration,
|
||||||
retryTime,
|
retryTime,
|
||||||
retries
|
retries
|
||||||
@@ -323,7 +323,7 @@ public class ReplicationActionExecutor extends ActionExecuterAbstractBase {
|
|||||||
{
|
{
|
||||||
jobLockService.refreshLock(
|
jobLockService.refreshLock(
|
||||||
lockToken,
|
lockToken,
|
||||||
replicationDef.getReplicationName(),
|
replicationDef.getReplicationQName(),
|
||||||
replicationActionLockDuration
|
replicationActionLockDuration
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -331,7 +331,7 @@ public class ReplicationActionExecutor extends ActionExecuterAbstractBase {
|
|||||||
{
|
{
|
||||||
jobLockService.releaseLock(
|
jobLockService.releaseLock(
|
||||||
lockToken,
|
lockToken,
|
||||||
replicationDef.getReplicationName()
|
replicationDef.getReplicationQName()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -52,7 +52,7 @@ public class ReplicationDefinitionImpl extends ActionImpl implements Replication
|
|||||||
* @param replicationName
|
* @param replicationName
|
||||||
* a unique name for the replication action.
|
* a unique name for the replication action.
|
||||||
*/
|
*/
|
||||||
public ReplicationDefinitionImpl(String id, QName replicationName)
|
public ReplicationDefinitionImpl(String id, String replicationName)
|
||||||
{
|
{
|
||||||
this(id, replicationName, null);
|
this(id, replicationName, null);
|
||||||
}
|
}
|
||||||
@@ -65,10 +65,10 @@ public class ReplicationDefinitionImpl extends ActionImpl implements Replication
|
|||||||
* @param description
|
* @param description
|
||||||
* a description of the replication
|
* a description of the replication
|
||||||
*/
|
*/
|
||||||
public ReplicationDefinitionImpl(String id, QName replicationName, String description)
|
public ReplicationDefinitionImpl(String id, String replicationName, String description)
|
||||||
{
|
{
|
||||||
super(null, id, "replicationActionExecutor");
|
super(null, id, "replicationActionExecutor");
|
||||||
setParameterValue(REPLICATION_DEFINITION_NAME, replicationName);
|
setReplicationQName(QName.createQName(null, replicationName));
|
||||||
setDescription(description);
|
setDescription(description);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,10 +80,27 @@ public class ReplicationDefinitionImpl extends ActionImpl implements Replication
|
|||||||
/*
|
/*
|
||||||
* @see org.alfresco.service.cmr.replication.ReplicationDefinition#getReplicationName()
|
* @see org.alfresco.service.cmr.replication.ReplicationDefinition#getReplicationName()
|
||||||
*/
|
*/
|
||||||
public QName getReplicationName()
|
public String getReplicationName()
|
||||||
|
{
|
||||||
|
return getReplicationQName().getLocalName();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @see org.alfresco.service.cmr.replication.ReplicationDefinition#getReplicationQName()
|
||||||
|
*/
|
||||||
|
public QName getReplicationQName()
|
||||||
{
|
{
|
||||||
Serializable parameterValue = getParameterValue(REPLICATION_DEFINITION_NAME);
|
Serializable parameterValue = getParameterValue(REPLICATION_DEFINITION_NAME);
|
||||||
return (QName) parameterValue;
|
return (QName)parameterValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sets or changes the replication name, which should match
|
||||||
|
* the association name in the data dictionary
|
||||||
|
*/
|
||||||
|
protected void setReplicationQName(QName replicationName)
|
||||||
|
{
|
||||||
|
setParameterValue(REPLICATION_DEFINITION_NAME, replicationName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -22,7 +22,6 @@ package org.alfresco.repo.replication;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.alfresco.service.cmr.replication.ReplicationDefinition;
|
import org.alfresco.service.cmr.replication.ReplicationDefinition;
|
||||||
import org.alfresco.service.namespace.QName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class provides the implementation of ReplicationDefinition persistence.
|
* This class provides the implementation of ReplicationDefinition persistence.
|
||||||
@@ -52,17 +51,30 @@ public interface ReplicationDefinitionPersister
|
|||||||
*/
|
*/
|
||||||
void deleteReplicationDefinition(ReplicationDefinition replicationDefinition);
|
void deleteReplicationDefinition(ReplicationDefinition replicationDefinition);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method renames a {@link ReplicationDefinition} that has been stored
|
||||||
|
* in the repository using the <code>save()</code> method.
|
||||||
|
* If no {@link ReplicationDefinition} exists in the repository with the specified
|
||||||
|
* replication name, then nothing happens.
|
||||||
|
*
|
||||||
|
* @param oldReplicationName The unique identifier used to specify the
|
||||||
|
* {@link ReplicationDefinition} to rename.
|
||||||
|
* @param newReplicationName The unique identifier used to specify the
|
||||||
|
* new {@link ReplicationDefinition} name.
|
||||||
|
*/
|
||||||
|
void renameReplicationDefinition(String oldReplicationName, String newReplicationName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method retrieves a {@link ReplicationDefinition} that has been stored
|
* This method retrieves a {@link ReplicationDefinition} that has been stored
|
||||||
* in the repository using the <code>save()</code> method. If no
|
* in the repository using the <code>save()</code> method. If no
|
||||||
* {@link ReplicationDefinition} exists in the repository with the specified
|
* {@link ReplicationDefinition} exists in the repository with the specified
|
||||||
* rendition name then this method returns null.
|
* replication name then this method returns null.
|
||||||
*
|
*
|
||||||
* @param replicationName The unique identifier used to specify the
|
* @param replicationName The unique identifier used to specify the
|
||||||
* {@link ReplicationDefinition} to retrieve.
|
* {@link ReplicationDefinition} to retrieve.
|
||||||
* @return The specified {@link ReplicationDefinition} or null.
|
* @return The specified {@link ReplicationDefinition} or null.
|
||||||
*/
|
*/
|
||||||
ReplicationDefinition loadReplicationDefinition(QName replicationName);
|
ReplicationDefinition loadReplicationDefinition(String replicationName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method retrieves the {@link ReplicationDefinition}s that have been
|
* This method retrieves the {@link ReplicationDefinition}s that have been
|
||||||
|
@@ -118,6 +118,10 @@ public class ReplicationDefinitionPersisterImpl implements ReplicationDefinition
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ReplicationDefinition loadReplicationDefinition(String replicationDefinitionName)
|
||||||
|
{
|
||||||
|
return loadReplicationDefinition( buildReplicationQName(replicationDefinitionName) );
|
||||||
|
}
|
||||||
public ReplicationDefinition loadReplicationDefinition(QName replicationDefinitionName)
|
public ReplicationDefinition loadReplicationDefinition(QName replicationDefinitionName)
|
||||||
{
|
{
|
||||||
NodeRef actionNode = findActionNode(replicationDefinitionName);
|
NodeRef actionNode = findActionNode(replicationDefinitionName);
|
||||||
@@ -130,6 +134,47 @@ public class ReplicationDefinitionPersisterImpl implements ReplicationDefinition
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void renameReplicationDefinition(String oldReplicationName, String newReplicationName)
|
||||||
|
{
|
||||||
|
renameReplicationDefinition(
|
||||||
|
buildReplicationQName(oldReplicationName),
|
||||||
|
buildReplicationQName(newReplicationName)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
public void renameReplicationDefinition(QName oldReplicationName, QName newReplicationName)
|
||||||
|
{
|
||||||
|
NodeRef actionNode = findActionNode(oldReplicationName);
|
||||||
|
if(actionNode == null)
|
||||||
|
{
|
||||||
|
// No current definition with this name
|
||||||
|
// So, nothing to do
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure the destination name is free
|
||||||
|
if(findActionNode(newReplicationName) != null)
|
||||||
|
{
|
||||||
|
throw new ReplicationServiceException("Can't rename to '" + newReplicationName +
|
||||||
|
"' as a definition with that name already exists");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rename the node
|
||||||
|
nodeService.moveNode(
|
||||||
|
actionNode, REPLICATION_ACTION_ROOT_NODE_REF,
|
||||||
|
ContentModel.ASSOC_CONTAINS, newReplicationName
|
||||||
|
);
|
||||||
|
|
||||||
|
// Update the definition properties
|
||||||
|
ReplicationDefinition rd = loadReplicationDefinition(newReplicationName);
|
||||||
|
rd.setParameterValue(
|
||||||
|
ReplicationDefinitionImpl.REPLICATION_DEFINITION_NAME,
|
||||||
|
newReplicationName
|
||||||
|
);
|
||||||
|
saveReplicationDefinition(rd);
|
||||||
|
|
||||||
|
// All done
|
||||||
|
}
|
||||||
|
|
||||||
public void saveReplicationDefinition(ReplicationDefinition replicationAction)
|
public void saveReplicationDefinition(ReplicationDefinition replicationAction)
|
||||||
{
|
{
|
||||||
NodeRef actionNodeRef = findOrCreateActionNode(replicationAction);
|
NodeRef actionNodeRef = findOrCreateActionNode(replicationAction);
|
||||||
@@ -143,7 +188,7 @@ public class ReplicationDefinitionPersisterImpl implements ReplicationDefinition
|
|||||||
|
|
||||||
public void deleteReplicationDefinition(ReplicationDefinition replicationAction)
|
public void deleteReplicationDefinition(ReplicationDefinition replicationAction)
|
||||||
{
|
{
|
||||||
QName actionName = replicationAction.getReplicationName();
|
QName actionName = replicationAction.getReplicationQName();
|
||||||
NodeRef actionNode = findActionNode(actionName);
|
NodeRef actionNode = findActionNode(actionName);
|
||||||
if(actionNode != null) {
|
if(actionNode != null) {
|
||||||
nodeService.deleteNode(actionNode);
|
nodeService.deleteNode(actionNode);
|
||||||
@@ -174,7 +219,7 @@ public class ReplicationDefinitionPersisterImpl implements ReplicationDefinition
|
|||||||
|
|
||||||
private NodeRef findOrCreateActionNode(ReplicationDefinition replicationAction)
|
private NodeRef findOrCreateActionNode(ReplicationDefinition replicationAction)
|
||||||
{
|
{
|
||||||
QName actionName = replicationAction.getReplicationName();
|
QName actionName = replicationAction.getReplicationQName();
|
||||||
NodeRef actionNode = findActionNode(actionName);
|
NodeRef actionNode = findActionNode(actionName);
|
||||||
if (actionNode == null)
|
if (actionNode == null)
|
||||||
{
|
{
|
||||||
@@ -200,4 +245,9 @@ public class ReplicationDefinitionPersisterImpl implements ReplicationDefinition
|
|||||||
throw new ReplicationServiceException("Unable to find replication action root node.");
|
throw new ReplicationServiceException("Unable to find replication action root node.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static QName buildReplicationQName(String name)
|
||||||
|
{
|
||||||
|
return QName.createQName(null, name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -26,7 +26,6 @@ import org.alfresco.service.cmr.replication.ReplicationDefinition;
|
|||||||
import org.alfresco.service.cmr.replication.ReplicationService;
|
import org.alfresco.service.cmr.replication.ReplicationService;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.transfer.TransferService;
|
import org.alfresco.service.cmr.transfer.TransferService;
|
||||||
import org.alfresco.service.namespace.QName;
|
|
||||||
import org.alfresco.util.GUID;
|
import org.alfresco.util.GUID;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
@@ -97,7 +96,7 @@ public class ReplicationServiceImpl implements ReplicationService, ReplicationDe
|
|||||||
* (org.alfresco.service.namespace.QName, java.lang.String)
|
* (org.alfresco.service.namespace.QName, java.lang.String)
|
||||||
*/
|
*/
|
||||||
public ReplicationDefinition createReplicationDefinition(
|
public ReplicationDefinition createReplicationDefinition(
|
||||||
QName replicationDefinitionName, String description) {
|
String replicationDefinitionName, String description) {
|
||||||
if (log.isDebugEnabled())
|
if (log.isDebugEnabled())
|
||||||
{
|
{
|
||||||
StringBuilder msg = new StringBuilder();
|
StringBuilder msg = new StringBuilder();
|
||||||
@@ -114,7 +113,7 @@ public class ReplicationServiceImpl implements ReplicationService, ReplicationDe
|
|||||||
* org.alfresco.service.cmr.replication.ReplicationService#loadReplicationDefinition
|
* org.alfresco.service.cmr.replication.ReplicationService#loadReplicationDefinition
|
||||||
* (org.alfresco.service.namespace.QName)
|
* (org.alfresco.service.namespace.QName)
|
||||||
*/
|
*/
|
||||||
public ReplicationDefinition loadReplicationDefinition(QName replicationDefinitionName) {
|
public ReplicationDefinition loadReplicationDefinition(String replicationDefinitionName) {
|
||||||
return replicationDefinitionPersister.loadReplicationDefinition(replicationDefinitionName);
|
return replicationDefinitionPersister.loadReplicationDefinition(replicationDefinitionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,6 +136,17 @@ public class ReplicationServiceImpl implements ReplicationService, ReplicationDe
|
|||||||
return replicationDefinitionPersister.loadReplicationDefinitions(target); // TODO is this right
|
return replicationDefinitionPersister.loadReplicationDefinitions(target); // TODO is this right
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see
|
||||||
|
* org.alfresco.service.cmr.replication.ReplicationService#renameReplicationDefinition
|
||||||
|
* (String,String)
|
||||||
|
*/
|
||||||
|
public void renameReplicationDefinition(String oldReplicationName, String newReplicationName)
|
||||||
|
{
|
||||||
|
replicationDefinitionPersister.renameReplicationDefinition(oldReplicationName, newReplicationName);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see
|
* @see
|
||||||
|
@@ -25,8 +25,6 @@ import junit.framework.TestCase;
|
|||||||
import org.alfresco.service.cmr.action.ActionService;
|
import org.alfresco.service.cmr.action.ActionService;
|
||||||
import org.alfresco.service.cmr.replication.ReplicationDefinition;
|
import org.alfresco.service.cmr.replication.ReplicationDefinition;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
|
||||||
import org.alfresco.service.namespace.QName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Nick Burch
|
* @author Nick Burch
|
||||||
@@ -39,8 +37,8 @@ public class ReplicationServiceImplTest extends TestCase
|
|||||||
private final ReplicationDefinitionPersisterImpl replicationDefinitionPersister = mock(ReplicationDefinitionPersisterImpl.class);
|
private final ReplicationDefinitionPersisterImpl replicationDefinitionPersister = mock(ReplicationDefinitionPersisterImpl.class);
|
||||||
private ReplicationServiceImpl replicationService;
|
private ReplicationServiceImpl replicationService;
|
||||||
|
|
||||||
private final QName ACTION_NAME = QName.createQName(NamespaceService.ALFRESCO_URI, "testName");
|
private final String ACTION_NAME = "testName";
|
||||||
private final QName ACTION_NAME2 = QName.createQName(NamespaceService.ALFRESCO_URI, "testName2");
|
private final String ACTION_NAME2 = "testName2";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception
|
protected void setUp() throws Exception
|
||||||
|
@@ -100,8 +100,10 @@ public class ReplicationServiceIntegrationTest extends TestCase
|
|||||||
private NodeRef thumbnail2a_2; // Thumbnail extends content
|
private NodeRef thumbnail2a_2; // Thumbnail extends content
|
||||||
private NodeRef zone2a_3; // Zone doesn't
|
private NodeRef zone2a_3; // Zone doesn't
|
||||||
|
|
||||||
private final QName ACTION_NAME = QName.createQName(NamespaceService.ALFRESCO_URI, "testName");
|
private final String ACTION_NAME = "testName";
|
||||||
private final QName ACTION_NAME2 = QName.createQName(NamespaceService.ALFRESCO_URI, "testName2");
|
private final String ACTION_NAME2 = "testName2";
|
||||||
|
private final QName ACTION_QNAME = QName.createQName(null, ACTION_NAME);
|
||||||
|
private final QName ACTION_QNAME2 = QName.createQName(null, ACTION_NAME2);
|
||||||
|
|
||||||
private final String TRANSFER_TARGET = "TestTransferTarget";
|
private final String TRANSFER_TARGET = "TestTransferTarget";
|
||||||
|
|
||||||
@@ -192,6 +194,7 @@ public class ReplicationServiceIntegrationTest extends TestCase
|
|||||||
assertNotNull(replicationAction);
|
assertNotNull(replicationAction);
|
||||||
assertEquals("Test Definition", replicationAction.getDescription());
|
assertEquals("Test Definition", replicationAction.getDescription());
|
||||||
assertEquals(ACTION_NAME, replicationAction.getReplicationName());
|
assertEquals(ACTION_NAME, replicationAction.getReplicationName());
|
||||||
|
assertEquals(ACTION_QNAME, replicationAction.getReplicationQName());
|
||||||
|
|
||||||
String id = replicationAction.getId();
|
String id = replicationAction.getId();
|
||||||
assertNotNull(id);
|
assertNotNull(id);
|
||||||
@@ -224,6 +227,7 @@ public class ReplicationServiceIntegrationTest extends TestCase
|
|||||||
assertNotNull(retrieved);
|
assertNotNull(retrieved);
|
||||||
assertEquals(initialId, retrieved.getId());
|
assertEquals(initialId, retrieved.getId());
|
||||||
assertEquals(ACTION_NAME, retrieved.getReplicationName());
|
assertEquals(ACTION_NAME, retrieved.getReplicationName());
|
||||||
|
assertEquals(ACTION_QNAME, retrieved.getReplicationQName());
|
||||||
assertEquals("Test Definition", retrieved.getDescription());
|
assertEquals("Test Definition", retrieved.getDescription());
|
||||||
assertEquals(2, retrieved.getPayload().size());
|
assertEquals(2, retrieved.getPayload().size());
|
||||||
|
|
||||||
@@ -233,6 +237,7 @@ public class ReplicationServiceIntegrationTest extends TestCase
|
|||||||
assertNotNull(second);
|
assertNotNull(second);
|
||||||
assertEquals(initialId, second.getId());
|
assertEquals(initialId, second.getId());
|
||||||
assertEquals(ACTION_NAME, second.getReplicationName());
|
assertEquals(ACTION_NAME, second.getReplicationName());
|
||||||
|
assertEquals(ACTION_QNAME, second.getReplicationQName());
|
||||||
assertEquals("Test Definition", second.getDescription());
|
assertEquals("Test Definition", second.getDescription());
|
||||||
assertEquals(2, second.getPayload().size());
|
assertEquals(2, second.getPayload().size());
|
||||||
}
|
}
|
||||||
@@ -394,6 +399,54 @@ public class ReplicationServiceIntegrationTest extends TestCase
|
|||||||
assertEquals(content1_1, rdTT.getPayload().get(0));
|
assertEquals(content1_1, rdTT.getPayload().get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that we can rename definitions
|
||||||
|
*/
|
||||||
|
public void testRenaming() throws Exception
|
||||||
|
{
|
||||||
|
// Create one instance
|
||||||
|
ReplicationDefinition rdTT = replicationService.createReplicationDefinition(ACTION_NAME, "Test");
|
||||||
|
rdTT.setTargetName("TestTarget");
|
||||||
|
replicationService.saveReplicationDefinition(rdTT);
|
||||||
|
assertEquals(1, replicationService.loadReplicationDefinitions().size());
|
||||||
|
|
||||||
|
|
||||||
|
// Rename it
|
||||||
|
replicationService.renameReplicationDefinition(ACTION_NAME, ACTION_NAME2);
|
||||||
|
|
||||||
|
assertEquals(1, replicationService.loadReplicationDefinitions().size());
|
||||||
|
assertEquals(null, replicationService.loadReplicationDefinition(ACTION_NAME));
|
||||||
|
|
||||||
|
rdTT = replicationService.loadReplicationDefinition(ACTION_NAME2);
|
||||||
|
assertNotNull(rdTT);
|
||||||
|
assertEquals(ACTION_NAME2, rdTT.getReplicationName());
|
||||||
|
assertEquals(ACTION_QNAME2, rdTT.getReplicationQName());
|
||||||
|
|
||||||
|
|
||||||
|
// If the source name doesn't exist, does nothing
|
||||||
|
replicationService.renameReplicationDefinition(ACTION_NAME, ACTION_NAME2);
|
||||||
|
|
||||||
|
assertEquals(1, replicationService.loadReplicationDefinitions().size());
|
||||||
|
assertEquals(null, replicationService.loadReplicationDefinition(ACTION_NAME));
|
||||||
|
|
||||||
|
rdTT = replicationService.loadReplicationDefinition(ACTION_NAME2);
|
||||||
|
assertNotNull(rdTT);
|
||||||
|
assertEquals(ACTION_NAME2, rdTT.getReplicationName());
|
||||||
|
assertEquals(ACTION_QNAME2, rdTT.getReplicationQName());
|
||||||
|
|
||||||
|
|
||||||
|
// Renaming to a duplicate name breaks
|
||||||
|
rdTT = replicationService.createReplicationDefinition(ACTION_NAME, "Test");
|
||||||
|
rdTT.setTargetName("TestTarget");
|
||||||
|
replicationService.saveReplicationDefinition(rdTT);
|
||||||
|
assertEquals(2, replicationService.loadReplicationDefinitions().size());
|
||||||
|
|
||||||
|
try {
|
||||||
|
replicationService.renameReplicationDefinition(ACTION_NAME, ACTION_NAME2);
|
||||||
|
fail("Shouldn't be able to rename onto a duplicate name");
|
||||||
|
} catch(ReplicationServiceException e) {}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that the action service can find the executor
|
* Test that the action service can find the executor
|
||||||
* for us, and that it has everything it needs
|
* for us, and that it has everything it needs
|
||||||
@@ -503,7 +556,7 @@ public class ReplicationServiceIntegrationTest extends TestCase
|
|||||||
// Get the lock, and run
|
// Get the lock, and run
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
String token = jobLockService.getLock(
|
String token = jobLockService.getLock(
|
||||||
rd.getReplicationName(),
|
rd.getReplicationQName(),
|
||||||
10 * 1000,
|
10 * 1000,
|
||||||
1,
|
1,
|
||||||
1
|
1
|
||||||
@@ -540,7 +593,7 @@ public class ReplicationServiceIntegrationTest extends TestCase
|
|||||||
|
|
||||||
// Get the lock for 2 seconds
|
// Get the lock for 2 seconds
|
||||||
String token = jobLockService.getLock(
|
String token = jobLockService.getLock(
|
||||||
rd.getReplicationName(),
|
rd.getReplicationQName(),
|
||||||
2 * 1000,
|
2 * 1000,
|
||||||
1,
|
1,
|
||||||
1
|
1
|
||||||
@@ -564,7 +617,7 @@ public class ReplicationServiceIntegrationTest extends TestCase
|
|||||||
|
|
||||||
// Release our lock, should allow the replication task
|
// Release our lock, should allow the replication task
|
||||||
// to get going and spot the cancel
|
// to get going and spot the cancel
|
||||||
jobLockService.releaseLock(token, rd.getReplicationName());
|
jobLockService.releaseLock(token, rd.getReplicationQName());
|
||||||
|
|
||||||
// Let the main replication task run to cancelled/completed
|
// Let the main replication task run to cancelled/completed
|
||||||
// This can take quite some time though...
|
// This can take quite some time though...
|
||||||
|
@@ -39,7 +39,12 @@ public interface ReplicationDefinition extends CancellableAction, Serializable {
|
|||||||
/**
|
/**
|
||||||
* @return the name which uniquely identifies this replication definition.
|
* @return the name which uniquely identifies this replication definition.
|
||||||
*/
|
*/
|
||||||
QName getReplicationName();
|
String getReplicationName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the qualified name which uniquely identifies this replication definition.
|
||||||
|
*/
|
||||||
|
QName getReplicationQName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the name of the target repository.
|
* @return the name of the target repository.
|
||||||
|
@@ -21,7 +21,6 @@ package org.alfresco.service.cmr.replication;
|
|||||||
import org.alfresco.repo.replication.ReplicationDefinitionPersister;
|
import org.alfresco.repo.replication.ReplicationDefinitionPersister;
|
||||||
import org.alfresco.service.NotAuditable;
|
import org.alfresco.service.NotAuditable;
|
||||||
import org.alfresco.service.PublicService;
|
import org.alfresco.service.PublicService;
|
||||||
import org.alfresco.service.namespace.QName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Replication service.
|
* The Replication service.
|
||||||
@@ -38,7 +37,7 @@ public interface ReplicationService extends ReplicationDefinitionPersister {
|
|||||||
* @return the created {@link ReplicationDefinition}
|
* @return the created {@link ReplicationDefinition}
|
||||||
*/
|
*/
|
||||||
@NotAuditable
|
@NotAuditable
|
||||||
ReplicationDefinition createReplicationDefinition(QName replicationName, String description);
|
ReplicationDefinition createReplicationDefinition(String replicationName, String description);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs the specified replication.
|
* Runs the specified replication.
|
||||||
|
Reference in New Issue
Block a user