use of org.drools.core.io.impl.ClassPathResource in project kogito-runtimes by kiegroup.
the class MockCacheProcessInstancesTest method testBasicFlow.
@Test
public void testBasicFlow() {
BpmnProcess process = BpmnProcess.from(new ClassPathResource("BPMN2-UserTask.bpmn2")).get(0);
process.setProcessInstancesFactory(new CacheProcessInstancesFactory(cacheManager));
process.configure();
ProcessInstance<BpmnVariables> processInstance = process.createInstance(BpmnVariables.create(Collections.singletonMap("test", "test")));
processInstance.start();
assertThat(processInstance.status()).isEqualTo(STATE_ACTIVE);
WorkItem workItem = processInstance.workItems(SecurityPolicy.of(new StaticIdentityProvider("john"))).get(0);
assertThat(workItem).isNotNull();
assertThat(workItem.getParameters().get("ActorId")).isEqualTo("john");
processInstance.completeWorkItem(workItem.getId(), null, SecurityPolicy.of(new StaticIdentityProvider("john")));
assertThat(processInstance.status()).isEqualTo(STATE_COMPLETED);
}
use of org.drools.core.io.impl.ClassPathResource in project kogito-runtimes by kiegroup.
the class MockCacheProcessInstancesTest method testProcessInstanceNotFound.
@Test
public void testProcessInstanceNotFound() {
BpmnProcess process = BpmnProcess.from(new ClassPathResource("BPMN2-UserTask.bpmn2")).get(0);
process.setProcessInstancesFactory(new CacheProcessInstancesFactory(cacheManager));
process.configure();
ProcessInstance<BpmnVariables> processInstance = process.createInstance(BpmnVariables.create(Collections.singletonMap("test", "test")));
processInstance.start();
assertThat(processInstance.status()).isEqualTo(STATE_ACTIVE);
mockCache.clear();
assertThatThrownBy(() -> processInstance.workItems().get(0)).isInstanceOf(ProcessInstanceNotFoundException.class);
Optional<? extends ProcessInstance<BpmnVariables>> loaded = process.instances().findById(processInstance.id());
assertThat(loaded).isNotPresent();
}
use of org.drools.core.io.impl.ClassPathResource in project kogito-runtimes by kiegroup.
the class AbstractProcessInstancesIT method createProcess.
public static BpmnProcess createProcess(TestProcessInstancesFactory factory, String fileName) {
BpmnProcess process = BpmnProcess.from(new ClassPathResource(fileName)).get(0);
process.setProcessInstancesFactory(factory);
process.configure();
process.instances().values(ProcessInstanceReadMode.MUTABLE).forEach(p -> p.abort());
return process;
}
use of org.drools.core.io.impl.ClassPathResource in project kogito-runtimes by kiegroup.
the class PersistentProcessInstancesWithLockIT method createProcess.
private BpmnProcess createProcess(MongoDBProcessInstancesFactory factory) {
BpmnProcess process = BpmnProcess.from(new ClassPathResource("BPMN2-UserTask.bpmn2")).get(0);
process.setProcessInstancesFactory(factory);
process.configure();
return process;
}
use of org.drools.core.io.impl.ClassPathResource in project kogito-runtimes by kiegroup.
the class PostgreProcessInstancesWithLockIT method createProcess.
private BpmnProcess createProcess(String fileName) {
BpmnProcess process = BpmnProcess.from(new ClassPathResource(fileName)).get(0);
process.setProcessInstancesFactory(new PostgreProcessInstancesFactory(client));
process.configure();
return process;
}
Aggregations