Search in sources :

Example 51 with RuntimeManager

use of org.kie.api.runtime.manager.RuntimeManager in project jbpm by kiegroup.

the class ParalellLoopTest method testProcessMaryApproveJohnApprove.

@Test
public void testProcessMaryApproveJohnApprove() {
    RuntimeManager manager = createRuntimeManager("org/jbpm/test/functional/ParalellLoopTest.bpmn");
    RuntimeEngine engine = getRuntimeEngine(null);
    KieSession ksession = engine.getKieSession();
    // ksession.addEventListener(new TestProcessEventListener());
    taskService = engine.getTaskService();
    ProcessInstance processInstance = ksession.startProcess("hu.tsm.ParalellLoopTest");
    assertProcessInstanceActive(processInstance.getId());
    complete("john", "Approve");
    complete("mary", "Approve");
    assertProcessInstanceCompleted(processInstance.getId());
    manager.disposeRuntimeEngine(engine);
    manager.close();
}
Also used : RuntimeEngine(org.kie.api.runtime.manager.RuntimeEngine) RuntimeManager(org.kie.api.runtime.manager.RuntimeManager) KieSession(org.kie.api.runtime.KieSession) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) Test(org.junit.Test)

Example 52 with RuntimeManager

use of org.kie.api.runtime.manager.RuntimeManager in project jbpm by kiegroup.

the class ParalellLoopTest method testProcessMaryApproveJohnReject.

@Test
public void testProcessMaryApproveJohnReject() {
    RuntimeManager manager = createRuntimeManager("org/jbpm/test/functional/ParalellLoopTest.bpmn");
    RuntimeEngine engine = getRuntimeEngine(null);
    KieSession ksession = engine.getKieSession();
    // ksession.addEventListener(new TestProcessEventListener());
    taskService = engine.getTaskService();
    ProcessInstance processInstance = ksession.startProcess("hu.tsm.ParalellLoopTest");
    assertProcessInstanceActive(processInstance.getId());
    for (int i = 0; i < 20; i++) {
        logger.debug(">>> Loop: {}", i);
        complete("mary", "Approve");
        complete("john", "Reject");
    }
    // A Jóváhagyás folyamatnak vége
    complete("john", "Approve");
    complete("mary", "Approve");
    assertProcessInstanceCompleted(processInstance.getId());
    manager.disposeRuntimeEngine(engine);
    manager.close();
}
Also used : RuntimeEngine(org.kie.api.runtime.manager.RuntimeEngine) RuntimeManager(org.kie.api.runtime.manager.RuntimeManager) KieSession(org.kie.api.runtime.KieSession) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) Test(org.junit.Test)

Example 53 with RuntimeManager

use of org.kie.api.runtime.manager.RuntimeManager in project jbpm by kiegroup.

the class ParalellLoopTest method testProcessJohnReject.

@Test
public void testProcessJohnReject() {
    RuntimeManager manager = createRuntimeManager("org/jbpm/test/functional/ParalellLoopTest.bpmn");
    RuntimeEngine engine = getRuntimeEngine(null);
    KieSession ksession = engine.getKieSession();
    // ksession.addEventListener(new TestProcessEventListener());
    taskService = engine.getTaskService();
    ProcessInstance processInstance = ksession.startProcess("hu.tsm.ParalellLoopTest");
    assertProcessInstanceActive(processInstance.getId());
    for (int i = 0; i < 20; i++) {
        logger.debug(">>> Loop: {}", i);
        assertNodeTriggered(processInstance.getId(), "ApproveMary");
        assertNodeTriggered(processInstance.getId(), "ApproveJohn");
        String user = "john";
        complete(user, "Reject");
    }
    // assertNodeTriggered(processInstance.getId(), "ApproveMary");
    // assertNodeTriggered(processInstance.getId(), "ApproveJohn");
    // A Jóváhagyás folyamatnak vége
    complete("john", "Approve");
    complete("mary", "Approve");
    assertProcessInstanceCompleted(processInstance.getId());
    manager.disposeRuntimeEngine(engine);
    manager.close();
}
Also used : RuntimeEngine(org.kie.api.runtime.manager.RuntimeEngine) RuntimeManager(org.kie.api.runtime.manager.RuntimeManager) KieSession(org.kie.api.runtime.KieSession) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) Test(org.junit.Test)

Example 54 with RuntimeManager

use of org.kie.api.runtime.manager.RuntimeManager in project jbpm by kiegroup.

the class ParalellLoopTest method testProcessAlternateReject.

@Test
public void testProcessAlternateReject() {
    RuntimeManager manager = createRuntimeManager("org/jbpm/test/functional/ParalellLoopTest.bpmn");
    RuntimeEngine engine = getRuntimeEngine(null);
    KieSession ksession = engine.getKieSession();
    // ksession.addEventListener(new TestProcessEventListener());
    taskService = engine.getTaskService();
    ProcessInstance processInstance = ksession.startProcess("hu.tsm.ParalellLoopTest");
    assertProcessInstanceActive(processInstance.getId());
    for (int i = 0; i < 20; i++) {
        logger.debug(">>> Loop: {}", i);
        assertNodeTriggered(processInstance.getId(), "ApproveMary");
        assertNodeTriggered(processInstance.getId(), "ApproveJohn");
        String user = "mary";
        boolean alternate = true;
        if (alternate && i % 2 == 1) {
            user = "john";
        }
        complete(user, "Reject");
    }
    complete("john", "Approve");
    complete("mary", "Approve");
    assertProcessInstanceCompleted(processInstance.getId());
    manager.disposeRuntimeEngine(engine);
    manager.close();
}
Also used : RuntimeEngine(org.kie.api.runtime.manager.RuntimeEngine) RuntimeManager(org.kie.api.runtime.manager.RuntimeManager) KieSession(org.kie.api.runtime.KieSession) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) Test(org.junit.Test)

Example 55 with RuntimeManager

use of org.kie.api.runtime.manager.RuntimeManager in project jbpm by kiegroup.

the class ParalellLoopTest method testProcessMaryReject.

@Test
public void testProcessMaryReject() {
    RuntimeManager manager = createRuntimeManager("org/jbpm/test/functional/ParalellLoopTest.bpmn");
    RuntimeEngine engine = getRuntimeEngine(null);
    KieSession ksession = engine.getKieSession();
    taskService = engine.getTaskService();
    ProcessInstance processInstance = ksession.startProcess("hu.tsm.ParalellLoopTest");
    assertProcessInstanceActive(processInstance.getId());
    for (int i = 0; i < 20; i++) {
        logger.debug(">>> Loop: {}", i);
        assertNodeTriggered(processInstance.getId(), "ApproveMary");
        assertNodeTriggered(processInstance.getId(), "ApproveJohn");
        String user = "mary";
        complete(user, "Reject");
    }
    // assertNodeTriggered(processInstance.getId(), "ApproveMary");
    // assertNodeTriggered(processInstance.getId(), "ApproveJohn");
    // A Jóváhagyás folyamatnak vége
    complete("john", "Approve");
    complete("mary", "Approve");
    assertProcessInstanceCompleted(processInstance.getId());
    manager.disposeRuntimeEngine(engine);
    manager.close();
}
Also used : RuntimeEngine(org.kie.api.runtime.manager.RuntimeEngine) RuntimeManager(org.kie.api.runtime.manager.RuntimeManager) KieSession(org.kie.api.runtime.KieSession) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) Test(org.junit.Test)

Aggregations

RuntimeManager (org.kie.api.runtime.manager.RuntimeManager)150 RuntimeEngine (org.kie.api.runtime.manager.RuntimeEngine)116 InternalRuntimeManager (org.kie.internal.runtime.manager.InternalRuntimeManager)79 KieSession (org.kie.api.runtime.KieSession)55 TaskService (org.kie.api.task.TaskService)53 Test (org.junit.Test)51 HashMap (java.util.HashMap)49 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)46 InternalTaskService (org.kie.internal.task.api.InternalTaskService)44 DeployedUnit (org.jbpm.services.api.model.DeployedUnit)38 UserTaskService (org.jbpm.services.api.UserTaskService)36 UserTaskInstanceDesc (org.jbpm.services.api.model.UserTaskInstanceDesc)35 AbstractKieServicesBaseTest (org.jbpm.kie.test.util.AbstractKieServicesBaseTest)23 TaskSummary (org.kie.api.task.model.TaskSummary)21 ArrayList (java.util.ArrayList)19 KModuleDeploymentUnit (org.jbpm.kie.services.impl.KModuleDeploymentUnit)19 DeploymentNotFoundException (org.jbpm.services.api.DeploymentNotFoundException)18 TaskNotFoundException (org.jbpm.services.api.TaskNotFoundException)15 DeploymentUnit (org.jbpm.services.api.model.DeploymentUnit)15 PermissionDeniedException (org.jbpm.services.task.exception.PermissionDeniedException)15