Search in sources :

Example 1 with OtherPerson

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());
    }
}
Also used : OtherPerson(org.jbpm.kie.test.objects.OtherPerson) ProcessDefinition(org.jbpm.services.api.model.ProcessDefinition) KieSession(org.kie.api.runtime.KieSession) Person(org.jbpm.kie.test.objects.Person) OtherPerson(org.jbpm.kie.test.objects.OtherPerson) Thing(org.jbpm.kie.test.objects.Thing) HashSet(java.util.HashSet) Ignore(org.junit.Ignore) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Aggregations

HashSet (java.util.HashSet)1 OtherPerson (org.jbpm.kie.test.objects.OtherPerson)1 Person (org.jbpm.kie.test.objects.Person)1 Thing (org.jbpm.kie.test.objects.Thing)1 AbstractKieServicesBaseTest (org.jbpm.kie.test.util.AbstractKieServicesBaseTest)1 ProcessDefinition (org.jbpm.services.api.model.ProcessDefinition)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1 KieSession (org.kie.api.runtime.KieSession)1