Initial replication service tests

Fix up the definition parameter persisting, and test that we can create/save/load/list the definitions propertly


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@20965 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Nick Burch
2010-07-06 15:02:02 +00:00
parent d82fc2acb3
commit 7a8e50de23
4 changed files with 232 additions and 16 deletions

View File

@@ -20,6 +20,7 @@
package org.alfresco.repo.replication;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -47,6 +48,9 @@ public class ReplicationDefinitionPersisterImpl implements ReplicationDefinition
/** Reference to the replication action space node */
private static final StoreRef SPACES_STORE = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
protected static final NodeRef REPLICATION_ACTION_ROOT_NODE_REF = new NodeRef(SPACES_STORE, "replication_actions_space");
protected static final Set<QName> ACTION_TYPES = new HashSet<QName>(
Arrays.asList(new QName[] { ActionModel.TYPE_ACTION }));
/* Injected services */
private NodeService nodeService;
@@ -79,10 +83,8 @@ public class ReplicationDefinitionPersisterImpl implements ReplicationDefinition
// Note that in the call to getChildAssocs below, only the specified
// types are included.
// Subtypes of the type action:action will not be returned.
Set<QName> actionTypes = new HashSet<QName>();
actionTypes.add(ActionModel.TYPE_ACTION);
List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(REPLICATION_ACTION_ROOT_NODE_REF, actionTypes);
List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(REPLICATION_ACTION_ROOT_NODE_REF, ACTION_TYPES);
List<ReplicationDefinition> renderingActions = new ArrayList<ReplicationDefinition>(childAssocs.size());
for (ChildAssociationRef actionAssoc : childAssocs)