use of org.jbpm.kie.test.objects.OtherPerson in project jbpm by kiegroup.
the class BPMN2DataServicesReferencesTest method testDroolsScriptWithQualifiedClass.
@Test
// TODO!
@Ignore
public void testDroolsScriptWithQualifiedClass() throws Exception {
Assume.assumeTrue("Skip script/expr tests", loadJavaMvelScriptProcesses);
String processId = PROC_ID_RULE_SCRIPT_QUALIFIED_CLASS;
ProcessDefinition procDef = bpmn2Service.getProcessDefinition(deploymentId, processId);
assertNotNull(procDef);
// check that process runs
Person person = new Person();
person.setName("Max");
person.setId(1979l);
person.setTime(3l);
KieSession ksession = deploymentService.getRuntimeManager(deploymentId).getRuntimeEngine(null).getKieSession();
ksession.insert(person);
ksession.insert(new Thing());
ksession.insert(new OtherPerson(person));
ksession.insert(person.getName());
ksession.insert(person.getId());
Long procId = startProcess(deploymentId, processId);
assertNull("Process instance did not complete:", processService.getProcessInstance(procId));
Collection<String> javaClasses = bpmn2Service.getJavaClasses(deploymentId, processId);
assertNotNull("Null set of java classes", javaClasses);
assertFalse("Empty set of java classes", javaClasses.isEmpty());
assertEquals("Number java classes", 4, javaClasses.size());
String[] expected = { "java.lang.Object", Person.class.getCanonicalName(), OtherPerson.class.getCanonicalName(), Thing.class.getCanonicalName() };
Set<String> expectedClasses = new HashSet<String>(Arrays.asList(expected));
for (String className : javaClasses) {
assertTrue("Class name is not qualified: " + className, className.contains("."));
assertTrue("Unexpected class: " + className, expectedClasses.remove(className));
}
if (!expectedClasses.isEmpty()) {
fail("Expected class not found to be referenced: " + expectedClasses.iterator().next());
}
}
Aggregations