use of org.alfresco.repo.replication.script.ScriptReplicationDefinition in project alfresco-repository by Alfresco.
the class ReplicationServiceIntegrationTest method testJavascriptAPI.
public void testJavascriptAPI() throws Exception {
ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean("ServiceRegistry");
// Setup some replication tasks
ReplicationDefinition empty = replicationService.createReplicationDefinition(ACTION_NAME, "Empty");
ReplicationDefinition persisted = replicationService.createReplicationDefinition(ACTION_NAME2, "Persisted");
persisted.setTargetName(TRANSFER_TARGET);
persisted.getPayload().add(new NodeRef("workspace://SpacesStore/Testing"));
persisted.getPayload().add(new NodeRef("workspace://SpacesStore/Testing2"));
replicationService.saveReplicationDefinition(persisted);
ReplicationDefinition persisted2 = replicationService.createReplicationDefinition(ACTION_NAME3, "Persisted2");
persisted2.setTargetName("AnotherTarget");
replicationService.saveReplicationDefinition(persisted2);
// Call the test
Map<String, Object> model = new HashMap<String, Object>();
model.put("Empty", new ScriptReplicationDefinition(serviceRegistry, replicationService, null, empty));
model.put("EmptyName", ACTION_NAME);
model.put("Persisted", new ScriptReplicationDefinition(serviceRegistry, replicationService, null, persisted));
model.put("PersistedName", ACTION_NAME2);
model.put("PersistedNodeRef", persisted.getNodeRef().toString());
model.put("PersistedTarget", persisted.getTargetName());
model.put("Persisted2", new ScriptReplicationDefinition(serviceRegistry, replicationService, null, persisted2));
model.put("Persisted2Name", ACTION_NAME3);
model.put("Persisted2NodeRef", persisted2.getNodeRef().toString());
model.put("Persisted2Target", persisted2.getTargetName());
ScriptLocation location = new ClasspathScriptLocation("org/alfresco/repo/replication/script/test_replicationService.js");
this.scriptService.executeScript(location, model);
}
Aggregations