Search in sources :

Example 6 with ProcessInstanceImpl

use of com.adobe.acs.commons.mcp.impl.ProcessInstanceImpl 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();
}
Also used : ProcessInstanceImpl(com.adobe.acs.commons.mcp.impl.ProcessInstanceImpl) ResourceResolver(org.apache.sling.api.resource.ResourceResolver) ProcessInstance(com.adobe.acs.commons.mcp.ProcessInstance) Test(org.junit.Test) ActionManagerTest(com.adobe.acs.commons.fam.impl.ActionManagerTest)

Example 7 with ProcessInstanceImpl

use of com.adobe.acs.commons.mcp.impl.ProcessInstanceImpl 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();
}
Also used : ActionManager(com.adobe.acs.commons.fam.ActionManager) ProcessInstanceImpl(com.adobe.acs.commons.mcp.impl.ProcessInstanceImpl) ResourceResolver(org.apache.sling.api.resource.ResourceResolver) ProcessInstance(com.adobe.acs.commons.mcp.ProcessInstance) Test(org.junit.Test) ActionManagerTest(com.adobe.acs.commons.fam.impl.ActionManagerTest)

Aggregations

ActionManagerTest (com.adobe.acs.commons.fam.impl.ActionManagerTest)7 ProcessInstanceImpl (com.adobe.acs.commons.mcp.impl.ProcessInstanceImpl)7 Test (org.junit.Test)7 ProcessInstance (com.adobe.acs.commons.mcp.ProcessInstance)6 ResourceResolver (org.apache.sling.api.resource.ResourceResolver)6 HashMap (java.util.HashMap)2 ActionManager (com.adobe.acs.commons.fam.ActionManager)1 AbstractResourceImpl (com.adobe.acs.commons.mcp.impl.AbstractResourceImpl)1 DeserializeException (com.adobe.acs.commons.mcp.util.DeserializeException)1 CompletableFuture (java.util.concurrent.CompletableFuture)1