Search in sources :

Example 6 with RuleAwareProcessEventLister

use of org.jbpm.process.instance.event.listeners.RuleAwareProcessEventLister in project jbpm by kiegroup.

the class IntermediateEventTest method testIntermediateCatchEventConditionRemovePIAfter.

@Test
public void testIntermediateCatchEventConditionRemovePIAfter() throws Exception {
    KieBase kbase = createKnowledgeBase("BPMN2-IntermediateCatchEventCondition.bpmn2");
    ksession = createKnowledgeSession(kbase);
    ksession.addEventListener(new RuleAwareProcessEventLister());
    ProcessInstance processInstance = ksession.startProcess("IntermediateCatchEvent");
    assertProcessInstanceActive(processInstance);
    ksession = restoreSession(ksession, true);
    ksession.addEventListener(new RuleAwareProcessEventLister());
    Collection<? extends Object> processInstances = ksession.getObjects(new ObjectFilter() {

        @Override
        public boolean accept(Object object) {
            if (object instanceof ProcessInstance) {
                return true;
            }
            return false;
        }
    });
    assertThat(processInstances).isNotNull();
    assertThat(processInstances.size()).isEqualTo(1);
    // now activate condition
    Person person = new Person();
    person.setName("Jack");
    ksession.insert(person);
    assertProcessInstanceFinished(processInstance, ksession);
    processInstances = ksession.getObjects(new ObjectFilter() {

        @Override
        public boolean accept(Object object) {
            if (object instanceof ProcessInstance) {
                return true;
            }
            return false;
        }
    });
    assertThat(processInstances).isNotNull();
    assertThat(processInstances.size()).isEqualTo(0);
}
Also used : KieBase(org.kie.api.KieBase) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) WorkflowProcessInstance(org.kie.api.runtime.process.WorkflowProcessInstance) ObjectFilter(org.kie.api.runtime.ObjectFilter) Person(org.jbpm.bpmn2.objects.Person) RuleAwareProcessEventLister(org.jbpm.process.instance.event.listeners.RuleAwareProcessEventLister) Test(org.junit.Test)

Example 7 with RuleAwareProcessEventLister

use of org.jbpm.process.instance.event.listeners.RuleAwareProcessEventLister in project jbpm by kiegroup.

the class ActivityTest method testBusinessRuleTask.

@Test
@RequirePersistence(false)
public void testBusinessRuleTask() throws Exception {
    KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-BusinessRuleTask.bpmn2", "BPMN2-BusinessRuleTask.drl");
    ksession = createKnowledgeSession(kbase);
    ksession.addEventListener(new RuleAwareProcessEventLister());
    ProcessInstance processInstance = ksession.startProcess("BPMN2-BusinessRuleTask");
    assertProcessInstanceFinished(processInstance, ksession);
}
Also used : KieBase(org.kie.api.KieBase) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) WorkflowProcessInstance(org.kie.api.runtime.process.WorkflowProcessInstance) RuleAwareProcessEventLister(org.jbpm.process.instance.event.listeners.RuleAwareProcessEventLister) Test(org.junit.Test) RequirePersistence(org.jbpm.bpmn2.test.RequirePersistence)

Example 8 with RuleAwareProcessEventLister

use of org.jbpm.process.instance.event.listeners.RuleAwareProcessEventLister in project jbpm by kiegroup.

the class ActivityTest method testBusinessRuleTaskWithPersistence.

@Test
@RequirePersistence(true)
public void testBusinessRuleTaskWithPersistence() throws Exception {
    KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-BusinessRuleTask.bpmn2", "BPMN2-BusinessRuleTask.drl");
    ksession = createKnowledgeSession(kbase);
    ksession.addEventListener(new RuleAwareProcessEventLister());
    ProcessInstance processInstance = ksession.startProcess("BPMN2-BusinessRuleTask");
    ksession = restoreSession(ksession, true);
    ksession.addEventListener(new RuleAwareProcessEventLister());
    assertProcessInstanceFinished(processInstance, ksession);
}
Also used : KieBase(org.kie.api.KieBase) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) WorkflowProcessInstance(org.kie.api.runtime.process.WorkflowProcessInstance) RuleAwareProcessEventLister(org.jbpm.process.instance.event.listeners.RuleAwareProcessEventLister) Test(org.junit.Test) RequirePersistence(org.jbpm.bpmn2.test.RequirePersistence)

Aggregations

RuleAwareProcessEventLister (org.jbpm.process.instance.event.listeners.RuleAwareProcessEventLister)8 Test (org.junit.Test)8 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)8 KieBase (org.kie.api.KieBase)7 WorkflowProcessInstance (org.kie.api.runtime.process.WorkflowProcessInstance)5 Person (org.jbpm.bpmn2.objects.Person)3 HashMap (java.util.HashMap)2 RequirePersistence (org.jbpm.bpmn2.test.RequirePersistence)2 WorkflowProcessInstance (org.jbpm.workflow.instance.WorkflowProcessInstance)2 ObjectFilter (org.kie.api.runtime.ObjectFilter)2 AbstractBaseTest (org.jbpm.test.util.AbstractBaseTest)1 KieSession (org.kie.api.runtime.KieSession)1 RuntimeEngine (org.kie.api.runtime.manager.RuntimeEngine)1 RuntimeEnvironment (org.kie.api.runtime.manager.RuntimeEnvironment)1 AuditService (org.kie.api.runtime.manager.audit.AuditService)1