Search in sources :

Example 6 with VariableInstanceLog

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

the class StartEventTest method testSignalOutputType.

@Test
@BZ("1090375")
public void testSignalOutputType() throws Exception {
    KieSession ksession = createKSession(SIGNAL_OUTPUT_TYPE);
    SignalObjectReport report = new SignalObjectReport("Type of signal object report");
    ksession.signalEvent("SignalObjectReport", report);
    List<? extends VariableInstanceLog> vars = getLogService().findVariableInstancesByName("report", false);
    VariableInstanceLog lastvar = vars.get(vars.size() - 1);
    Assertions.assertThat(lastvar.getValue()).isEqualTo(report.toString());
}
Also used : VariableInstanceLog(org.kie.api.runtime.manager.audit.VariableInstanceLog) SignalObjectReport(org.jbpm.test.iodata.SignalObjectReport) KieSession(org.kie.api.runtime.KieSession) Test(org.junit.Test) BZ(qa.tools.ikeeper.annotation.BZ)

Example 7 with VariableInstanceLog

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

the class AsyncThreadContinuationTest method testCorrectProcessStateAfterException.

@Test
public void testCorrectProcessStateAfterException() {
    KieSession ksession = createKSession(BPMN_ATC);
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("message", "Ivo");
    ProcessInstance pi = ksession.startProcess(PROCESS_ATC, params);
    List<? extends VariableInstanceLog> vars = getLogService().findVariableInstances(pi.getId(), "message");
    List<String> varValues = new ArrayList<String>();
    for (VariableInstanceLog v : vars) {
        varValues.add(v.getValue());
    }
    Assertions.assertThat(varValues).contains("Hello Ivo").doesNotContain("Hello Ivo asynchronously");
}
Also used : VariableInstanceLog(org.kie.api.runtime.manager.audit.VariableInstanceLog) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) KieSession(org.kie.api.runtime.KieSession) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) Test(org.junit.Test)

Example 8 with VariableInstanceLog

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

the class AsyncThreadContinuationTest method testRepeatFailingSyncTask.

@Test(timeout = 10000)
public void testRepeatFailingSyncTask() {
    KieSession ksession = createKSession(BPMN_ATC);
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("message", "Ivo");
    ProcessInstance pi = ksession.startProcess(PROCESS_ATC, params);
    synchronized (LOCK_ATC) {
        try {
            LOCK_ATC.wait();
        } catch (InterruptedException e) {
        }
    }
    ksession.getProcessInstance(pi.getId());
    List<? extends VariableInstanceLog> vars = getLogService().findVariableInstances(pi.getId(), "message");
    List<String> varValues = new ArrayList<String>();
    for (VariableInstanceLog v : vars) {
        varValues.add(v.getValue());
    }
    Assertions.assertThat(varValues).contains("Hello Ivo asynchronously");
}
Also used : VariableInstanceLog(org.kie.api.runtime.manager.audit.VariableInstanceLog) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) KieSession(org.kie.api.runtime.KieSession) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) Test(org.junit.Test)

Example 9 with VariableInstanceLog

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

the class AsyncThreadIsolationTest method testCorrectProcessStateAfterException.

@Test(timeout = 10000)
public void testCorrectProcessStateAfterException() {
    KieSession ksession = createKSession(BPMN_ATI);
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("message", "Ivo");
    ProcessInstance pi = ksession.startProcess(PROCESS_ATI, params);
    synchronized (LOCK) {
        try {
            LOCK.wait();
        } catch (InterruptedException e) {
        }
    }
    List<? extends VariableInstanceLog> vars = getLogService().findVariableInstances(pi.getId(), "message");
    List<String> varValues = new ArrayList<String>();
    for (VariableInstanceLog v : vars) {
        varValues.add(v.getValue());
    }
    Assertions.assertThat(varValues).contains("Hello Ivo asynchronously");
    pi = ksession.getProcessInstance(pi.getId());
    Assertions.assertThat(pi).isNotNull();
    Assertions.assertThat(pi.getState()).isEqualTo(ProcessInstance.STATE_ACTIVE);
}
Also used : VariableInstanceLog(org.kie.api.runtime.manager.audit.VariableInstanceLog) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) KieSession(org.kie.api.runtime.KieSession) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) Test(org.junit.Test)

Aggregations

VariableInstanceLog (org.kie.api.runtime.manager.audit.VariableInstanceLog)9 Test (org.junit.Test)8 HashMap (java.util.HashMap)5 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)5 KieSession (org.kie.api.runtime.KieSession)4 ArrayList (java.util.ArrayList)3 AbstractKieServicesBaseTest (org.jbpm.kie.test.util.AbstractKieServicesBaseTest)2 ProcessDefinition (org.jbpm.services.api.model.ProcessDefinition)2 Person (org.jbpm.test.domain.Person)2 Ignore (org.junit.Ignore)2 AuditService (org.kie.api.runtime.manager.audit.AuditService)2 SignalObjectReport (org.jbpm.test.iodata.SignalObjectReport)1 ProcessVariableIndexer (org.kie.internal.process.ProcessVariableIndexer)1 BZ (qa.tools.ikeeper.annotation.BZ)1