Search in sources :

Example 11 with Person

use of org.jbpm.bpmn2.objects.Person in project jbpm by kiegroup.

the class IntermediateEventTest method testConditionalBoundaryEventOnTaskComplete.

@Test
public void testConditionalBoundaryEventOnTaskComplete() throws Exception {
    KieBase kbase = createKnowledgeBase("BPMN2-BoundaryConditionalEventOnTask.bpmn2");
    ksession = createKnowledgeSession(kbase);
    TestWorkItemHandler handler = new TestWorkItemHandler();
    ksession.getWorkItemManager().registerWorkItemHandler("Human Task", handler);
    ProcessInstance processInstance = ksession.startProcess("BoundarySignalOnTask");
    ksession.getWorkItemManager().completeWorkItem(handler.getWorkItem().getId(), null);
    Person person = new Person();
    person.setName("john");
    // as the node that boundary event is attached to has been completed insert will not have any effect
    ksession.insert(person);
    ksession.getWorkItemManager().completeWorkItem(handler.getWorkItem().getId(), null);
    assertProcessInstanceFinished(processInstance, ksession);
    assertNodeTriggered(processInstance.getId(), "StartProcess", "User Task", "User Task2", "End1");
}
Also used : TestWorkItemHandler(org.jbpm.bpmn2.objects.TestWorkItemHandler) KieBase(org.kie.api.KieBase) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) WorkflowProcessInstance(org.kie.api.runtime.process.WorkflowProcessInstance) Person(org.jbpm.bpmn2.objects.Person) Test(org.junit.Test)

Example 12 with Person

use of org.jbpm.bpmn2.objects.Person in project jbpm by kiegroup.

the class ActivityTest method testBusinessRuleTaskWithDataInputs2WithPersistence.

@Test
public void testBusinessRuleTaskWithDataInputs2WithPersistence() throws Exception {
    KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-BusinessRuleTaskWithDataInput.bpmn2", "BPMN2-BusinessRuleTaskWithDataInput.drl");
    ksession = createKnowledgeSession(kbase);
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("person", new Person());
    ProcessInstance processInstance = ksession.startProcess("BPMN2-BusinessRuleTask", params);
    assertProcessInstanceFinished(processInstance, ksession);
}
Also used : HashMap(java.util.HashMap) KieBase(org.kie.api.KieBase) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) WorkflowProcessInstance(org.kie.api.runtime.process.WorkflowProcessInstance) Person(org.jbpm.bpmn2.objects.Person) Test(org.junit.Test)

Example 13 with Person

use of org.jbpm.bpmn2.objects.Person in project jbpm by kiegroup.

the class ActivityTest method testMultipleBusinessRuleTaskWithDataInputsWithPersistence.

@Test
public void testMultipleBusinessRuleTaskWithDataInputsWithPersistence() throws Exception {
    KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-MultipleRuleTasksWithDataInput.bpmn2", "BPMN2-MultipleRuleTasks.drl");
    ksession = createKnowledgeSession(kbase);
    ksession.addEventListener(new TriggerRulesEventListener(ksession));
    List<String> listPerson = new ArrayList<String>();
    List<String> listAddress = new ArrayList<String>();
    ksession.setGlobal("listPerson", listPerson);
    ksession.setGlobal("listAddress", listAddress);
    Person person = new Person();
    person.setName("john");
    Address address = new Address();
    address.setStreet("5th avenue");
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("person", person);
    params.put("address", address);
    ProcessInstance processInstance = ksession.startProcess("multiple-rule-tasks", params);
    assertEquals(1, listPerson.size());
    assertEquals(1, listAddress.size());
    assertProcessInstanceFinished(processInstance, ksession);
}
Also used : Address(org.jbpm.bpmn2.objects.Address) HashMap(java.util.HashMap) KieBase(org.kie.api.KieBase) ArrayList(java.util.ArrayList) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) WorkflowProcessInstance(org.kie.api.runtime.process.WorkflowProcessInstance) TriggerRulesEventListener(org.jbpm.process.instance.event.listeners.TriggerRulesEventListener) Person(org.jbpm.bpmn2.objects.Person) Test(org.junit.Test)

Example 14 with Person

use of org.jbpm.bpmn2.objects.Person in project jbpm by kiegroup.

the class ActivityTest method testBusinessRuleTaskWithDataInputsWithPersistence.

@Test
public void testBusinessRuleTaskWithDataInputsWithPersistence() throws Exception {
    KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-BusinessRuleTaskWithDataInputs.bpmn2", "BPMN2-BusinessRuleTaskWithDataInput.drl");
    ksession = createKnowledgeSession(kbase);
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("person", new Person());
    ProcessInstance processInstance = ksession.startProcess("BPMN2-BusinessRuleTask", params);
    assertProcessInstanceFinished(processInstance, ksession);
}
Also used : HashMap(java.util.HashMap) KieBase(org.kie.api.KieBase) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) WorkflowProcessInstance(org.kie.api.runtime.process.WorkflowProcessInstance) Person(org.jbpm.bpmn2.objects.Person) Test(org.junit.Test)

Example 15 with Person

use of org.jbpm.bpmn2.objects.Person in project jbpm by kiegroup.

the class ActivityTest method testAdHocProcessDynamicTask.

@Test
public void testAdHocProcessDynamicTask() throws Exception {
    KieBase kbase = createKnowledgeBase("BPMN2-AdHocProcess.bpmn2");
    ksession = createKnowledgeSession(kbase);
    ProcessInstance processInstance = ksession.startProcess("AdHocProcess");
    assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE);
    ksession = restoreSession(ksession, true);
    ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new DoNothingWorkItemHandler());
    logger.debug("Triggering node");
    ksession.signalEvent("Task1", null, processInstance.getId());
    assertProcessInstanceActive(processInstance);
    TestWorkItemHandler workItemHandler2 = new TestWorkItemHandler();
    ksession.getWorkItemManager().registerWorkItemHandler("OtherTask", workItemHandler2);
    DynamicUtils.addDynamicWorkItem(processInstance, ksession, "OtherTask", new HashMap<String, Object>());
    WorkItem workItem = workItemHandler2.getWorkItem();
    assertNotNull(workItem);
    ksession = restoreSession(ksession, true);
    ksession.getWorkItemManager().completeWorkItem(workItem.getId(), null);
    ksession.signalEvent("User1", null, processInstance.getId());
    assertProcessInstanceActive(processInstance);
    ksession.insert(new Person());
    ksession.signalEvent("Task3", null, processInstance.getId());
    assertProcessInstanceFinished(processInstance, ksession);
}
Also used : TestWorkItemHandler(org.jbpm.bpmn2.objects.TestWorkItemHandler) KieBase(org.kie.api.KieBase) DoNothingWorkItemHandler(org.jbpm.process.instance.impl.demo.DoNothingWorkItemHandler) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) WorkflowProcessInstance(org.kie.api.runtime.process.WorkflowProcessInstance) WorkItem(org.kie.api.runtime.process.WorkItem) Person(org.jbpm.bpmn2.objects.Person) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)32 Person (org.jbpm.bpmn2.objects.Person)29 KieBase (org.kie.api.KieBase)28 WorkflowProcessInstance (org.kie.api.runtime.process.WorkflowProcessInstance)22 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)21 HashMap (java.util.HashMap)10 Person (objects.Person)8 TestWorkItemHandler (org.jbpm.bpmn2.objects.TestWorkItemHandler)8 ArrayList (java.util.ArrayList)6 Tile (objects.Tile)4 Ignore (org.junit.Ignore)4 KieSession (org.kie.api.runtime.KieSession)4 BaseMap (objects.BaseMap)3 DoNothingWorkItemHandler (org.jbpm.process.instance.impl.demo.DoNothingWorkItemHandler)3 FileHandle (com.badlogic.gdx.files.FileHandle)2 Region (com.badlogic.gdx.graphics.g2d.TextureAtlas.TextureAtlasData.Region)2 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)2 TiledMap (com.badlogic.gdx.maps.tiled.TiledMap)2 TiledMapTileLayer (com.badlogic.gdx.maps.tiled.TiledMapTileLayer)2 StaticTiledMapTile (com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile)2