Search in sources :

Example 1 with SyntheticWorkflowRunnerImpl

use of com.adobe.acs.commons.workflow.synthetic.impl.SyntheticWorkflowRunnerImpl in project acs-aem-commons by Adobe-Consulting-Services.

the class SyntheticWorkflowSessionTest method test_updateWorkflowData.

@Test
public void test_updateWorkflowData() throws Exception {
    SyntheticWorkflowSession session = new SyntheticWorkflowSession(new SyntheticWorkflowRunnerImpl(), mock(Session.class));
    SyntheticWorkflowData workflowData = new SyntheticWorkflowData("JCR_PATH", "/content/test");
    workflowData.getMetaDataMap().put("cat", "meow");
    workflowData.getMetaDataMap().put("bird", "ka-kaw");
    SyntheticWorkflow workflow = new SyntheticWorkflow("test", workflowData);
    workflowData.getMetaDataMap().put("dog", "woof");
    session.updateWorkflowData(workflow, workflowData);
    // This test is a bit strange since the maps should always be in sync; this updateWorkflowData simply updates itself with itself
    // This is to mimic CQ Workflow behavior which has to manage this persistence via JCR nodes
    Assert.assertEquals(3, workflowData.getMetaDataMap().size());
    Assert.assertEquals("woof", workflowData.getMetaDataMap().get("dog"));
}
Also used : SyntheticWorkflowData(com.adobe.acs.commons.workflow.synthetic.impl.SyntheticWorkflowData) SyntheticWorkflowRunnerImpl(com.adobe.acs.commons.workflow.synthetic.impl.SyntheticWorkflowRunnerImpl) Session(javax.jcr.Session) Test(org.junit.Test)

Example 2 with SyntheticWorkflowRunnerImpl

use of com.adobe.acs.commons.workflow.synthetic.impl.SyntheticWorkflowRunnerImpl in project acs-aem-commons by Adobe-Consulting-Services.

the class SyntheticWorkItemTest method setUp.

@Before
public void setUp() {
    session = SyntheticWorkflowSession.createSyntheticWorkflowSession(new SyntheticWorkflowRunnerImpl(), resourceResolver.adaptTo(Session.class));
    workflowData = new SyntheticWorkflowData("JCR_PATH", "/content/test");
    workflowData.getMetaDataMap().put("dog", "woof");
    syntheticWorkflow = new SyntheticWorkflow("test", workflowData);
    syntheticWorkItem = SyntheticWorkItem.createSyntheticWorkItem(syntheticWorkflow.getWorkflowData());
}
Also used : SyntheticWorkflowData(com.adobe.acs.commons.workflow.synthetic.impl.SyntheticWorkflowData) SyntheticWorkflowRunnerImpl(com.adobe.acs.commons.workflow.synthetic.impl.SyntheticWorkflowRunnerImpl) Before(org.junit.Before)

Example 3 with SyntheticWorkflowRunnerImpl

use of com.adobe.acs.commons.workflow.synthetic.impl.SyntheticWorkflowRunnerImpl in project acs-aem-commons by Adobe-Consulting-Services.

the class SyntheticWorkflowSessionTest method setUp.

@Before
public void setUp() throws Exception {
    context = new AemContext(ResourceResolverType.JCR_MOCK);
    ResourceResolver resourceResolver = context.resourceResolver();
    session = SyntheticWorkflowSession.createSyntheticWorkflowSession(new SyntheticWorkflowRunnerImpl(), resourceResolver.adaptTo(Session.class));
    SyntheticWorkflowData workflowData = new SyntheticWorkflowData("JCR_PATH", "/content/test");
    workflowData.getMetaDataMap().put("cat", "meow");
    workflowData.getMetaDataMap().put("bird", "ka-kaw");
    syntheticWorkflow = new SyntheticWorkflow("test", workflowData);
}
Also used : SyntheticWorkflowData(com.adobe.acs.commons.workflow.synthetic.impl.SyntheticWorkflowData) AemContext(io.wcm.testing.mock.aem.junit.AemContext) SyntheticWorkflowRunnerImpl(com.adobe.acs.commons.workflow.synthetic.impl.SyntheticWorkflowRunnerImpl) ResourceResolver(org.apache.sling.api.resource.ResourceResolver) Before(org.junit.Before)

Example 4 with SyntheticWorkflowRunnerImpl

use of com.adobe.acs.commons.workflow.synthetic.impl.SyntheticWorkflowRunnerImpl in project acs-aem-commons by Adobe-Consulting-Services.

the class SyntheticWorkflowSessionTest method setUp.

@Before
public void setUp() {
    session = new SyntheticWorkflowSession(new SyntheticWorkflowRunnerImpl(), resourceResolver.adaptTo(Session.class));
    workflowData = new SyntheticWorkflowData("JCR_PATH", "/content/test");
    workflowData.getMetaDataMap().put("cat", "meow");
    workflowData.getMetaDataMap().put("bird", "ka-kaw");
    syntheticWorkflow = new SyntheticWorkflow("test", workflowData);
    SyntheticWorkItem syntheticWorkItem = SyntheticWorkItem.createSyntheticWorkItem(syntheticWorkflow.getWorkflowData());
    wrappedWorkItem = (WorkItem) Proxy.newProxyInstance(WrappedSyntheticWorkItem.class.getClassLoader(), new Class[] { WorkItem.class, WrappedSyntheticWorkItem.class }, syntheticWorkItem);
    SyntheticRoute syntheticRoute = new SyntheticRoute(false);
    route = (Route) syntheticRoute;
    workItemFilter = new WorkItemFilter() {

        @Override
        public boolean doInclude(WorkItem workItem) {
            return false;
        }
    };
    workflowModelFilter = new WorkflowModelFilter() {

        @Override
        public boolean doInclude(WorkflowModel workflowModel) {
            return false;
        }
    };
}
Also used : WrappedSyntheticWorkItem(com.adobe.acs.commons.workflow.synthetic.cq.WrappedSyntheticWorkItem) SyntheticWorkflowData(com.adobe.acs.commons.workflow.synthetic.impl.SyntheticWorkflowData) WrappedSyntheticWorkItem(com.adobe.acs.commons.workflow.synthetic.cq.WrappedSyntheticWorkItem) SyntheticWorkflowRunnerImpl(com.adobe.acs.commons.workflow.synthetic.impl.SyntheticWorkflowRunnerImpl) WorkflowModelFilter(com.day.cq.workflow.model.WorkflowModelFilter) WorkflowModel(com.day.cq.workflow.model.WorkflowModel) WorkItemFilter(com.day.cq.workflow.exec.filter.WorkItemFilter) WorkItem(com.day.cq.workflow.exec.WorkItem) WrappedSyntheticWorkItem(com.adobe.acs.commons.workflow.synthetic.cq.WrappedSyntheticWorkItem) Before(org.junit.Before)

Aggregations

SyntheticWorkflowData (com.adobe.acs.commons.workflow.synthetic.impl.SyntheticWorkflowData)4 SyntheticWorkflowRunnerImpl (com.adobe.acs.commons.workflow.synthetic.impl.SyntheticWorkflowRunnerImpl)4 Before (org.junit.Before)3 WrappedSyntheticWorkItem (com.adobe.acs.commons.workflow.synthetic.cq.WrappedSyntheticWorkItem)1 WorkItem (com.day.cq.workflow.exec.WorkItem)1 WorkItemFilter (com.day.cq.workflow.exec.filter.WorkItemFilter)1 WorkflowModel (com.day.cq.workflow.model.WorkflowModel)1 WorkflowModelFilter (com.day.cq.workflow.model.WorkflowModelFilter)1 AemContext (io.wcm.testing.mock.aem.junit.AemContext)1 Session (javax.jcr.Session)1 ResourceResolver (org.apache.sling.api.resource.ResourceResolver)1 Test (org.junit.Test)1