use of org.jbpm.process.builder.ProcessClassBuilder in project kogito-runtimes by kiegroup.
the class ActivityTest method testUserTaskWithAssignment.
@Test
public void testUserTaskWithAssignment() throws Exception {
ProcessDialectRegistry.setDialect("custom", new ProcessDialect() {
@Override
public ReturnValueEvaluatorBuilder getReturnValueEvaluatorBuilder() {
// TODO Auto-generated method stub
return null;
}
@Override
public ProcessClassBuilder getProcessClassBuilder() {
return null;
}
@Override
public AssignmentBuilder getAssignmentBuilder() {
return new AssignmentBuilder() {
@Override
public void build(PackageBuildContext context, Assignment assignment, List<DataDefinition> sourceExpr, DataDefinition targetExpr) {
assertEquals("from_expression", assignment.getFrom().getExpression());
assertEquals("to_expression", assignment.getTo().getExpression());
}
};
}
@Override
public ActionBuilder getActionBuilder() {
return null;
}
@Override
public void addProcess(ProcessBuildContext context) {
}
});
kruntime = createKogitoProcessRuntime("BPMN2-DataOutputAssignmentCustomExpressionLang.bpmn2");
Process scriptProcess = kruntime.getKieBase().getProcess("process");
assertThat(scriptProcess).isNotNull();
Node[] nodes = ((NodeContainer) scriptProcess).getNodes();
assertThat(nodes).hasSize(3);
assertThat(nodes).filteredOn(n -> n instanceof WorkItemNode).allMatch(this::matchExpectedAssociationSetup);
TestWorkItemHandler workItemHandler = new TestWorkItemHandler();
kruntime.getKogitoWorkItemManager().registerWorkItemHandler("Human Task", workItemHandler);
Map<String, Object> params = new HashMap<>();
params.put("name", "John");
KogitoProcessInstance processInstance = kruntime.startProcess("process", params);
kruntime.abortProcessInstance(processInstance.getStringId());
assertProcessInstanceAborted(processInstance);
}
Aggregations