Package org.drools.runtime

Examples of org.drools.runtime.StatefulKnowledgeSession


public class StandaloneBPMNProcessTest extends TestCase {
 
    public void testMinimalProcess() throws Exception {
    KnowledgeBase kbase = createKnowledgeBase("BPMN2-MinimalProcess.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
    ProcessInstance processInstance = ksession.startProcess("Minimal");
    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }
View Full Code Here


    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }

  public void testMinimalProcessWithGraphical() throws Exception {
    KnowledgeBase kbase = createKnowledgeBase("BPMN2-MinimalProcessWithGraphical.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
    ProcessInstance processInstance = ksession.startProcess("Minimal");
    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }
View Full Code Here

    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }

  public void testMinimalProcessWithDIGraphical() throws Exception {
    KnowledgeBase kbase = createKnowledgeBase("BPMN2-MinimalProcessWithDIGraphical.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
    ProcessInstance processInstance = ksession.startProcess("Minimal");
    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }
View Full Code Here

    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }

  public void testCompositeProcessWithDIGraphical() throws Exception {
    KnowledgeBase kbase = createKnowledgeBase("BPMN2-CompositeProcessWithDIGraphical.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
    ProcessInstance processInstance = ksession.startProcess("Composite");
    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }
View Full Code Here

    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }

    public void testScriptTask() throws Exception {
    KnowledgeBase kbase = createKnowledgeBase("BPMN2-ScriptTask.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
    ProcessInstance processInstance = ksession.startProcess("ScriptTask");
    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }
View Full Code Here

    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }

    public void testDataObject() throws Exception {
        KnowledgeBase kbase = createKnowledgeBase("BPMN2-DataObject.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("employee", "UserId-12345");
        ProcessInstance processInstance = ksession.startProcess("Evaluation", params);
        assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
    }
View Full Code Here

        assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
    }

  public void testEvaluationProcess() throws Exception {
    KnowledgeBase kbase = createKnowledgeBase("BPMN2-EvaluationProcess.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
    ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new SystemOutWorkItemHandler());
    ksession.getWorkItemManager().registerWorkItemHandler("RegisterRequest", new SystemOutWorkItemHandler());
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("employee", "UserId-12345");
    ProcessInstance processInstance = ksession.startProcess("Evaluation", params);
    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }
View Full Code Here

    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }

  public void testEvaluationProcess2() throws Exception {
    KnowledgeBase kbase = createKnowledgeBase("BPMN2-EvaluationProcess2.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
    ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new SystemOutWorkItemHandler());
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("employee", "UserId-12345");
    ProcessInstance processInstance = ksession.startProcess("com.sample.evaluation", params);
    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }
View Full Code Here

//    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
//  }
 
    public void testUserTask() throws Exception {
        KnowledgeBase kbase = createKnowledgeBase("BPMN2-UserTask.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
        TestWorkItemHandler workItemHandler = new TestWorkItemHandler();
        ksession.getWorkItemManager().registerWorkItemHandler("Human Task", workItemHandler);
        ProcessInstance processInstance = ksession.startProcess("UserTask");
        assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE);
        ksession = restoreSession(ksession, true);
        WorkItem workItem = workItemHandler.getWorkItem();
        assertNotNull(workItem);
        assertEquals("john", workItem.getParameter("ActorId"));
        ksession.getWorkItemManager().completeWorkItem(workItem.getId(), null);
        assertProcessInstanceCompleted(processInstance.getId(), ksession);
    }
View Full Code Here

        assertProcessInstanceCompleted(processInstance.getId(), ksession);
    }

    public void testLane() throws Exception {
        KnowledgeBase kbase = createKnowledgeBase("BPMN2-Lane.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
        TestWorkItemHandler workItemHandler = new TestWorkItemHandler();
        ksession.getWorkItemManager().registerWorkItemHandler("Human Task", workItemHandler);
        ProcessInstance processInstance = ksession.startProcess("UserTask");
        assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE);
        ksession = restoreSession(ksession, true);
        ksession.getWorkItemManager().registerWorkItemHandler("Human Task", workItemHandler);
        WorkItem workItem = workItemHandler.getWorkItem();
        assertNotNull(workItem);
        assertEquals("john", workItem.getParameter("ActorId"));
        Map<String, Object> results = new HashMap<String, Object>();
        results.put("ActorId", "mary");
        ksession.getWorkItemManager().completeWorkItem(workItem.getId(), results);
        ksession = restoreSession(ksession, true);
        ksession.getWorkItemManager().registerWorkItemHandler("Human Task", workItemHandler);
        workItem = workItemHandler.getWorkItem();
        assertNotNull(workItem);
        assertEquals("mary", workItem.getParameter("ActorId"));
        ksession.getWorkItemManager().completeWorkItem(workItem.getId(), null);
        assertProcessInstanceCompleted(processInstance.getId(), ksession);
    }
View Full Code Here

TOP

Related Classes of org.drools.runtime.StatefulKnowledgeSession

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.