private KieBase createKnowledgeBase() { KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add( ResourceFactory.newClassPathResource( "memory/BPMN2-RuleTaskWithInsertProcessInstance.bpmn2"), ResourceType.BPMN2); kbuilder.add( ResourceFactory.newClassPathResource("memory/ProcessInstanceRule.drl"), ResourceType.DRL); if (!kbuilder.getErrors().isEmpty()) { Iterator<KnowledgeBuilderError> errIter = kbuilder.getErrors().iterator(); while (errIter.hasNext()) { KnowledgeBuilderError err = errIter.next(); StringBuilder lines = new StringBuilder(""); if (err.getLines().length > 0) { lines.append(err.getLines()[0]); for (int i = 1; i < err.getLines().length; ++i) { lines.append(", " + err.getLines()[i]); } } logger.warn(err.getMessage() + " (" + lines.toString() + ")"); } throw new IllegalArgumentException("Errors while parsing knowledge base"); } KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); return kbase; }
public ChecklistUI() { setSize(new Dimension(400, 300)); setTitle("Checklist"); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); initializeComponent(); JBPMHelper.startH2Server(); JBPMHelper.setupDataSource(); DefaultRuntimeEnvironment environment = new DefaultRuntimeEnvironment(); environment.setUserGroupCallback( new UserGroupCallback() { public List<String> getGroupsForUser( String userId, List<String> groupIds, List<String> allExistingGroupIds) { List<String> result = new ArrayList<String>(); if ("actor4".equals(userId)) { result.add("group1"); } return result; } public boolean existsUser(String arg0) { return true; } public boolean existsGroup(String arg0) { return true; } }); environment.addAsset( ResourceFactory.newClassPathResource("checklist/SampleChecklistProcess.bpmn"), ResourceType.BPMN2); checklistManager = new DefaultChecklistManager(environment); }
@Test public void testFixedPattern() throws FileNotFoundException { DecisionTableConfiguration dtconf = KnowledgeBuilderFactory.newDecisionTableConfiguration(); dtconf.setInputType(DecisionTableInputType.XLS); KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add( ResourceFactory.newClassPathResource("fixedPattern.xls", getClass()), ResourceType.DTABLE, dtconf); if (kbuilder.hasErrors()) { fail(kbuilder.getErrors().toString()); } KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(); List<Long> list = new ArrayList<Long>(); ksession.setGlobal("list", list); ksession.insert(1L); ksession.insert(2); ksession.fireAllRules(); assertEquals(1, list.size()); assertEquals(1L, (long) list.get(0)); ksession.dispose(); }
/** * Test that illustrates that jobs are persisted and survives server restart and as soon as * GlobalTimerService is active jobs are fired NOTE: this test is disabled by default as it * requires real db (not in memory) and test to be executed separately each with new jvm process */ @Test @Ignore public void testContinueGlobalTestService() throws Exception { SimpleRuntimeEnvironment environment = new DefaultRuntimeEnvironment(); environment.addAsset( ResourceFactory.newClassPathResource("BPMN2-IntermediateCatchEventTimerCycle2.bpmn2"), ResourceType.BPMN2); environment.addToConfiguration( "drools.timerService", "org.jbpm.process.core.timer.impl.RegisteredTimerServiceDelegate"); RuntimeManager manger = RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(environment); // build GlobalTimerService instance TimerService globalTs = new GlobalTimerService(manger, globalScheduler); // and register it in the registry under 'default' key TimerServiceRegistry.getInstance().registerTimerService("default", globalTs); // prepare listener to assert results final List<Long> timerExporations = new ArrayList<Long>(); ProcessEventListener listener = new DefaultProcessEventListener() { @Override public void afterNodeLeft(ProcessNodeLeftEvent event) { if (event.getNodeInstance().getNodeName().equals("timer")) { timerExporations.add(event.getProcessInstance().getId()); } } }; Thread.sleep(5000); }
// JBRULES-2526 @Test public void testOrWithVariableResolution2() throws Exception { final KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add( ResourceFactory.newClassPathResource( "test_OrCEFollowedByMultipleEval2.drl", FirstOrderLogicTest.class), ResourceType.DRL); assertFalse(kbuilder.getErrors().toString(), kbuilder.hasErrors()); final KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); final StatefulKnowledgeSession ksession = createKnowledgeSession(kbase); final AgendaEventListener al = mock(AgendaEventListener.class); ksession.addEventListener(al); ksession.insert(new FactA("a")); ksession.insert(new FactB("b")); ksession.insert(new FactC("c")); ksession.fireAllRules(); verify(al, times(8)).afterMatchFired(any(AfterMatchFiredEvent.class)); }
protected KieSession createKnowledgeSession(String processFile) throws Exception { KieServices ks = KieServices.Factory.get(); KieRepository kr = ks.getRepository(); KieFileSystem kfs = ks.newKieFileSystem(); if (processFile != null) { Resource process = ResourceFactory.newClassPathResource(processFile); kfs.write(process); } KieBuilder kb = ks.newKieBuilder(kfs); kb.buildAll(); if (kb.getResults().hasMessages(Level.ERROR)) { throw new RuntimeException("Build Errors:\n" + kb.getResults().toString()); } KieContainer kContainer = ks.newKieContainer(kr.getDefaultReleaseId()); KieBase kbase = kContainer.getKieBase(); Environment env = EnvironmentFactory.newEnvironment(); Properties defaultProps = new Properties(); defaultProps.setProperty( "drools.processSignalManagerFactory", DefaultSignalManagerFactory.class.getName()); defaultProps.setProperty( "drools.processInstanceManagerFactory", DefaultProcessInstanceManagerFactory.class.getName()); SessionConfiguration conf = new SessionConfiguration(defaultProps); KieSession ksession = (StatefulKnowledgeSession) kbase.newKieSession(conf, env); return ksession; }
/** * Creates default configuration of <code>RuntimeManager</code> with given <code>strategy</code> * and all <code>resources</code> being added to knowledge base. <br> * There should be only one <code>RuntimeManager</code> created during single test. * * @param strategy - selected strategy of those that are supported * @param resources - resources that shall be added to knowledge base * @param identifier - identifies the runtime manager * @return new instance of RuntimeManager */ protected RuntimeManager createRuntimeManager( Strategy strategy, Map<String, ResourceType> resources, String identifier) { if (manager != null) { throw new IllegalStateException("There is already one RuntimeManager active"); } RuntimeEnvironmentBuilder builder = null; if (!setupDataSource) { builder = RuntimeEnvironmentBuilder.getEmpty() .addConfiguration( "drools.processSignalManagerFactory", DefaultSignalManagerFactory.class.getName()) .addConfiguration( "drools.processInstanceManagerFactory", DefaultProcessInstanceManagerFactory.class.getName()); } else if (sessionPersistence) { builder = RuntimeEnvironmentBuilder.getDefault().entityManagerFactory(emf); } else { builder = RuntimeEnvironmentBuilder.getDefaultInMemory(); } builder.userGroupCallback(new JBossUserGroupCallbackImpl("classpath:/usergroups.properties")); for (Map.Entry<String, ResourceType> entry : resources.entrySet()) { builder.addAsset(ResourceFactory.newClassPathResource(entry.getKey()), entry.getValue()); } return createRuntimeManager(strategy, resources, builder.get(), identifier); }
private static KieSession createKieSession() { KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add( ResourceFactory.newClassPathResource("exceptions/ExceptionHandlingWithSignal.bpmn2"), ResourceType.BPMN2); KieBase kbase = kbuilder.newKnowledgeBase(); return kbase.newKieSession(); }
private KnowledgeBase createBase() { KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add( ResourceFactory.newClassPathResource("processinstance/HelloWorld.rf"), ResourceType.DRF); assertFalse(kbuilder.getErrors().toString(), kbuilder.hasErrors()); return kbuilder.newKnowledgeBase(); }
@Test public void invokePmmlWithTrait() { String extraDrl = "package org.drools.pmml.pmml_4_2.test;" + "" + "import org.drools.core.factmodel.traits.Entity;" + "" + "rule \"Init\" " + "when " + " $s : String( this == \"trigger\" ) " + "then " + " System.out.println( \"Trig\" ); " + " Entity o = new Entity(); " + " insert( o ); \n" + "" + // don an object with the default input trait ( modelName + "Input" ) // both soft and hard fields will be used to feed data into the model "" + " MockColdTrait input = don( o, MockColdTrait.class ); " + " modify( input ) { " + " setTemp( 22.0 );" + " } " + "end " + "" + "" + "rule Log when $x : MockColdTrait() then System.out.println( \"IN \" + $x ); end " + "rule Log2 when $x : Cold() then System.out.println( \"OUT \" + $x ); end "; KieServices ks = KieServices.Factory.get(); KieFileSystem kfs = ks.newKieFileSystem(); kfs.write(ResourceFactory.newClassPathResource(pmmlSource).setResourceType(ResourceType.PMML)); kfs.write( ResourceFactory.newByteArrayResource(extraDrl.getBytes()) .setSourcePath("rules.drl") .setResourceType(ResourceType.DRL)); Results res = ks.newKieBuilder(kfs).buildAll().getResults(); if (res.hasMessages(Message.Level.ERROR)) { System.out.println(res.getMessages(Message.Level.ERROR)); } assertEquals(0, res.getMessages(Message.Level.ERROR).size()); KieSession kSession = ks.newKieContainer(ks.getRepository().getDefaultReleaseId()).newKieSession(); kSession.insert("trigger"); kSession.fireAllRules(); System.out.println(reportWMObjects(kSession)); QueryResults qrs = kSession.getQueryResults("Cold", "MockCold", Variable.v); assertTrue(qrs.iterator().hasNext()); Object val = qrs.iterator().next().get("$result"); Assert.assertEquals(0.56, val); }
@Produces @Singleton @PerRequest @PerProcessInstance public RuntimeEnvironment produceEnvironment(EntityManagerFactory emf) { RuntimeEnvironment environment = RuntimeEnvironmentBuilder.Factory.get() .newDefaultBuilder() .entityManagerFactory(emf) .userGroupCallback(getUserGroupCallback()) .registerableItemsFactory( InjectableRegisterableItemsFactory.getFactory( beanManager, new ManagedAuditEventBuilderImpl())) .addAsset( ResourceFactory.newClassPathResource("BPMN2-ScriptTask.bpmn2"), ResourceType.BPMN2) .addAsset( ResourceFactory.newClassPathResource("BPMN2-UserTask.bpmn2"), ResourceType.BPMN2) .get(); return environment; }
KieBase loadDecisionTableDirect(String decisionTableResourceName) { logDecisionTableAsDrools(decisionTableResourceName); KnowledgeBase kieBase = KnowledgeBaseFactory.newKnowledgeBase(); DecisionTableConfiguration dtconf = KnowledgeBuilderFactory.newDecisionTableConfiguration(); dtconf.setInputType(DecisionTableInputType.XLS); KnowledgeBuilder kBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kBuilder.add( ResourceFactory.newClassPathResource("rules/" + decisionTableResourceName), ResourceType.DTABLE, dtconf); validate(kBuilder); kieBase.addKnowledgePackages(kBuilder.getKnowledgePackages()); return kieBase; }
private KnowledgeBase loadKnowledgeBase(String fileName) { KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add(ResourceFactory.newClassPathResource(fileName, getClass()), ResourceType.DRL); KnowledgeBuilderErrors errors = kbuilder.getErrors(); if (errors.size() > 0) { for (KnowledgeBuilderError error : errors) { logger.warn(error.toString()); } throw new IllegalArgumentException("Could not parse knowledge."); } assertFalse(kbuilder.hasErrors()); KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); Collection<KnowledgePackage> knowledgePackages = kbuilder.getKnowledgePackages(); kbase.addKnowledgePackages(knowledgePackages); return kbase; }
/** * Creates default configuration of <code>RuntimeManager</code> with given <code>strategy</code> * and all <code>resources</code> being added to knowledge base. <br> * There should be only one <code>RuntimeManager</code> created during single test. * * @param strategy - selected strategy of those that are supported * @param resources - resources that shall be added to knowledge base * @param identifier - identifies the runtime manager * @return new instance of RuntimeManager */ protected RuntimeManager createRuntimeManager( Strategy strategy, Map<String, ResourceType> resources, String identifier) { if (manager != null) { throw new IllegalStateException("There is already one RuntimeManager active"); } RuntimeEnvironmentBuilder builder = RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder().entityManagerFactory(emf); builder.userGroupCallback( new TestJaasUserGroupCallbackImpl("classpath:/usergroups.properties")); for (Map.Entry<String, ResourceType> entry : resources.entrySet()) { builder.addAsset(ResourceFactory.newClassPathResource(entry.getKey()), entry.getValue()); } return createRuntimeManager(strategy, resources, builder.get(), identifier); }
private KnowledgeBase readKnowledgeBase(String resource) throws Exception { KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); DecisionTableConfiguration config = KnowledgeBuilderFactory.newDecisionTableConfiguration(); config.setInputType(DecisionTableInputType.XLS); kbuilder.add( ResourceFactory.newClassPathResource(resource, getClass()), ResourceType.DTABLE, config); KnowledgeBuilderErrors errors = kbuilder.getErrors(); if (errors.size() > 0) { for (KnowledgeBuilderError error : errors) { System.err.println(error); } throw new IllegalArgumentException("Could not parse knowledge."); } KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); return kbase; }
@Test public void testExists3() throws Exception { final KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add( ResourceFactory.newClassPathResource( "test_Exists_JBRULES_2810.drl", FirstOrderLogicTest.class), ResourceType.DRL); assertFalse(kbuilder.getErrors().toString(), kbuilder.hasErrors()); final KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); final StatefulKnowledgeSession ksession = createKnowledgeSession(kbase); WorkingMemoryConsoleLogger logger = new WorkingMemoryConsoleLogger(ksession); ksession.fireAllRules(); ksession.dispose(); }
/** * Test that illustrates that jobs are persisted and survives server restart and as soon as * GlobalTimerService is active jobs are fired and it loads and aborts the process instance to * illustrate jobs are properly removed when isntance is aborted NOTE: this test is disabled by * default as it requires real db (not in memory) and test to be executed separately each with new * jvm process */ @Test @Ignore public void testAbortGlobalTestService() throws Exception { SimpleRuntimeEnvironment environment = new DefaultRuntimeEnvironment(); environment.addAsset( ResourceFactory.newClassPathResource("BPMN2-IntermediateCatchEventTimerCycle3.bpmn2"), ResourceType.BPMN2); environment.addToConfiguration( "drools.timerService", "org.jbpm.process.core.timer.impl.RegisteredTimerServiceDelegate"); RuntimeManager manger = RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(environment); // build GlobalTimerService instance TimerService globalTs = new GlobalTimerService(manger, globalScheduler); // and register it in the registry under 'default' key TimerServiceRegistry.getInstance().registerTimerService("default", globalTs); // prepare listener to assert results final List<Long> timerExporations = new ArrayList<Long>(); ProcessEventListener listener = new DefaultProcessEventListener() { @Override public void afterNodeLeft(ProcessNodeLeftEvent event) { if (event.getNodeInstance().getNodeName().equals("timer")) { timerExporations.add(event.getProcessInstance().getId()); } } }; long id = -1; Thread.sleep(5000); Runtime runtime = manger.getRuntime(ProcessInstanceIdContext.get()); KieSession ksession = runtime.getKieSession(); ksession.addEventListener(listener); ksession.abortProcessInstance(id); ProcessInstance processInstance = ksession.getProcessInstance(id); assertNull(processInstance); // let's wait to ensure no more timers are expired and triggered Thread.sleep(3000); ksession.dispose(); }
@Test public void testCollectAfterOrCE() throws Exception { // Set up facts final Cheesery bonFromage = new Cheesery(); bonFromage.addCheese(new Cheese("cheddar")); bonFromage.addCheese(new Cheese("cheddar")); // Test in memory compile of DRL KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add( ResourceFactory.newClassPathResource("test_OrCEFollowedByCollect.drl", getClass()), ResourceType.DRL); KnowledgeBuilderErrors errors = kbuilder.getErrors(); if (errors.size() > 0) { for (KnowledgeBuilderError error : errors) { logger.warn(error.toString()); } throw new IllegalArgumentException("Could not parse knowledge."); } assertFalse(kbuilder.hasErrors()); Collection<KnowledgePackage> knowledgePackages = kbuilder.getKnowledgePackages(); KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages(knowledgePackages); StatefulKnowledgeSession session = createKnowledgeSession(kbase); session.insert(bonFromage); int rules = session.fireAllRules(); assertEquals(2, rules); // Serialize and test again knowledgePackages = SerializationHelper.serializeObject(knowledgePackages); kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages(knowledgePackages); session = createKnowledgeSession(kbase); session.insert(bonFromage); rules = session.fireAllRules(); assertEquals(2, rules); }
/** * Creates default configuration of <code>RuntimeManager</code> with given <code>strategy</code> * and all <code>resources</code> being added to knowledge base. <br> * There should be only one <code>RuntimeManager</code> created during single test. * * @param strategy - selected strategy of those that are supported * @param resources - resources that shall be added to knowledge base * @return new instance of RuntimeManager */ protected RuntimeManager createRuntimeManager( Strategy strategy, Map<String, ResourceType> resources) { if (manager != null) { throw new IllegalStateException("There is already one RuntimeManager active"); } RuntimeEnvironmentBuilder builder = null; if (!setupDataSource) { builder = RuntimeEnvironmentBuilder.getEmpty() .addConfiguration( "drools.processSignalManagerFactory", DefaultSignalManagerFactory.class.getName()) .addConfiguration( "drools.processInstanceManagerFactory", DefaultProcessInstanceManagerFactory.class.getName()); } else if (sessionPersistence) { builder = RuntimeEnvironmentBuilder.getDefault().entityManagerFactory(emf); } else { builder = RuntimeEnvironmentBuilder.getDefaultInMemory(); } builder.userGroupCallback(new JBossUserGroupCallbackImpl("classpath:/usergroups.properties")); for (Map.Entry<String, ResourceType> entry : resources.entrySet()) { builder.addAsset(ResourceFactory.newClassPathResource(entry.getKey()), entry.getValue()); } switch (strategy) { case SINGLETON: manager = managerFactory.newSingletonRuntimeManager(builder.get()); break; case REQUEST: manager = managerFactory.newPerRequestRuntimeManager(builder.get()); break; case PROCESS_INSTANCE: manager = managerFactory.newPerProcessInstanceRuntimeManager(builder.get()); break; default: manager = managerFactory.newSingletonRuntimeManager(builder.get()); break; } return manager; }
public WorkingMemorySimulationRepository(boolean fireRulesOnStore, String... rules) { this.fireRulesOnStore = fireRulesOnStore; KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); for (String path : rules) { kbuilder.add(ResourceFactory.newClassPathResource(path), ResourceType.DRL); } if (kbuilder.hasErrors()) { throw new RuntimeException("Error while building knowledge base: " + kbuilder.getErrors()); } this.ksession = kbuilder.newKnowledgeBase().newKieSession(); try { ksession.setGlobal("logger", new SystemOutLogger()); // register global for aggregated events ksession.setGlobal("simulation", new ArrayList<AggregatedActivitySimulationEvent>()); } catch (Exception e) { // catch it as there could be no simulation global declared } }
protected InternalKieModule createKieJar( KieServices ks, ReleaseId releaseId, List<String> resources) { KieFileSystem kfs = createKieFileSystemWithKProject(ks); kfs.writePomXML(getPom(releaseId)); for (String resource : resources) { kfs.write( "src/main/resources/KBase-test/" + resource, ResourceFactory.newClassPathResource(resource)); } KieBuilder kieBuilder = ks.newKieBuilder(kfs); if (!kieBuilder.buildAll().getResults().getMessages().isEmpty()) { for (Message message : kieBuilder.buildAll().getResults().getMessages()) { logger.error("Error Message: ({}) {}", message.getPath(), message.getText()); } throw new RuntimeException( "There are errors builing the package, please check your knowledge assets!"); } return (InternalKieModule) kieBuilder.getKieModule(); }
private static KnowledgeBase readKnowledgeBase() throws Exception { KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add( ResourceFactory.newClassPathResource("evaluation/Evaluation2.bpmn"), ResourceType.BPMN2); return kbuilder.newKnowledgeBase(); }
@Test public void testSessionPerProcessInstance() throws Exception { RuntimeEnvironment environment = RuntimeEnvironmentBuilder.Factory.get() .newDefaultBuilder() .entityManagerFactory(emf) .userGroupCallback(userGroupCallback) .addAsset( ResourceFactory.newClassPathResource( "org/jbpm/test/functional/timer/IntermediateCatchEventTimerCycleWithHT.bpmn2"), ResourceType.BPMN2) .schedulerService(globalScheduler) .get(); long startTimeStamp = System.currentTimeMillis(); long maxEndTime = startTimeStamp + maxWaitTime; manager = RuntimeManagerFactory.Factory.get().newPerProcessInstanceRuntimeManager(environment); // prepare task service with users and groups RuntimeEngine engine = manager.getRuntimeEngine(EmptyContext.get()); TaskService taskService = engine.getTaskService(); Group grouphr = TaskModelProvider.getFactory().newGroup(); ((InternalOrganizationalEntity) grouphr).setId("HR"); User mary = TaskModelProvider.getFactory().newUser(); ((InternalOrganizationalEntity) mary).setId("mary"); User john = TaskModelProvider.getFactory().newUser(); ((InternalOrganizationalEntity) john).setId("john"); ((InternalTaskService) taskService).addGroup(grouphr); ((InternalTaskService) taskService).addUser(mary); ((InternalTaskService) taskService).addUser(john); manager.disposeRuntimeEngine(engine); completedStart = 0; for (int i = 0; i < nbThreadsProcess; i++) { new StartProcessPerProcessInstanceRunnable(manager, i).run(); } completedTask = 0; for (int i = 0; i < nbThreadsTask; i++) { new Thread(new CompleteTaskPerProcessInstanceRunnable(manager, i)).start(); } while (completedStart < nbThreadsProcess || completedTask < nbThreadsTask) { Thread.sleep(100); if (System.currentTimeMillis() > maxEndTime) { fail("Failure, did not finish in time most likely hanging"); } } // make sure all process instance were completed engine = manager.getRuntimeEngine(EmptyContext.get()); AuditService logService = engine.getAuditService(); // active List<? extends ProcessInstanceLog> logs = logService.findActiveProcessInstances("IntermediateCatchEvent"); assertNotNull(logs); for (ProcessInstanceLog log : logs) { logger.debug("Left over {}", log.getProcessInstanceId()); } assertEquals(0, logs.size()); // completed logs = logService.findProcessInstances("IntermediateCatchEvent"); assertNotNull(logs); assertEquals(nbThreadsProcess, logs.size()); manager.disposeRuntimeEngine(engine); logger.debug("Done"); }