use of com.adobe.acs.commons.mcp.ProcessInstance in project acs-aem-commons by Adobe-Consulting-Services.
the class PageRelocatorTest method barebonesRun.
@Test
public void barebonesRun() throws LoginException, DeserializeException, RepositoryException, PersistenceException {
ResourceResolver rr = getEnhancedMockResolver(true);
ProcessInstance instance = new ProcessInstanceImpl(getControlledProcessManager(), tool, "relocator test");
assertEquals("Page Relocator: relocator test", instance.getName());
initInstance(instance, rr);
assertEquals(0.0, instance.updateProgress(), 0.00001);
instance.run(rr);
assertEquals(1.0, instance.updateProgress(), 0.00001);
verify(rr, atLeast(3)).commit();
}
use of com.adobe.acs.commons.mcp.ProcessInstance in project acs-aem-commons by Adobe-Consulting-Services.
the class PageRelocatorTest method validateMoveOperation.
@Test
public void validateMoveOperation() throws RepositoryException, LoginException, DeserializeException, PersistenceException {
ResourceResolver rr = getEnhancedMockResolver(true);
ProcessInstance instance = new ProcessInstanceImpl(getControlledProcessManager(), tool, "relocator test");
initInstance(instance, rr);
ActionManager manager = getActionManager();
tool.movePages(manager);
assertTrue("Should be no reported errors", manager.getErrorCount() == 0);
assertFalse("Should have captured activate requests", tool.replicatorQueue.activateOperations.isEmpty());
assertFalse("Should have captured deactivate requests", tool.replicatorQueue.deactivateOperations.isEmpty());
// Our mock doesn't pretend to create target pages at the moment...
// Resource pageB = rr.getResource("/content/pageB");
// verify(rr, times(1)).create(eq(pageB), eq("pageA"), any());
verify(rr, atLeastOnce()).commit();
}
use of com.adobe.acs.commons.mcp.ProcessInstance in project acs-aem-commons by Adobe-Consulting-Services.
the class ControlledProcessManagerImpl method createManagedProcessInstance.
@Override
public ProcessInstance createManagedProcessInstance(ProcessDefinition definition, String description) {
ProcessInstance instance = new ProcessInstanceImpl(this, definition, description);
activeProcesses.put(instance.getId(), instance);
return instance;
}
use of com.adobe.acs.commons.mcp.ProcessInstance in project acs-aem-commons by Adobe-Consulting-Services.
the class ControlledProcessManagerImpl method getInactiveProcesses.
@Override
public Collection<ProcessInstance> getInactiveProcesses() {
ArrayList<ProcessInstance> processes = new ArrayList();
try (ResourceResolver rr = getServiceResourceResolver()) {
Resource tree = rr.getResource(ProcessInstanceImpl.BASE_PATH);
TreeFilteringResourceVisitor visitor = new TreeFilteringResourceVisitor();
visitor.setLeafVisitor((r, l) -> {
if (!activeProcesses.containsKey(r.getName())) {
processes.add(r.adaptTo(ArchivedProcessInstance.class));
}
});
visitor.accept(tree);
} catch (LoginException ex) {
LOG.error("Error getting inactive process list", ex);
}
return processes;
}
Aggregations