Search in sources :

Example 1 with MyType

use of org.jboss.qa.bpms.remote.ejb.domain.MyType in project jbpm by kiegroup.

the class EObjectVariableTest method testMyTypeProcessVariableInside.

@Test
public void testMyTypeProcessVariableInside() {
    Map<String, Object> parameters = new HashMap<>();
    parameters.put("myobject", new MyType("Hello World!"));
    long pid = ejb.startProcess(ProcessDefinitions.OBJECT_VARIABLE, parameters);
    List<VariableDesc> typeVarHistory = ejb.getVariableHistory(pid, "type");
    Assertions.assertThat(typeVarHistory).isNotNull();
    Assertions.assertThat(typeVarHistory.size()).isEqualTo(1);
    VariableDesc typeVarLog = typeVarHistory.get(0);
    Assertions.assertThat(typeVarLog.getNewValue()).isEqualTo(MyType.class.getName());
    List<VariableDesc> contentVarHistory = ejb.getVariableHistory(pid, "myobject");
    Assertions.assertThat(contentVarHistory).isNotNull();
    Assertions.assertThat(contentVarHistory.size()).isEqualTo(1);
    VariableDesc contentVarLog = contentVarHistory.get(0);
    Assertions.assertThat(contentVarLog.getNewValue()).isEqualTo("MyType{text=Hello World!}");
}
Also used : MyType(org.jboss.qa.bpms.remote.ejb.domain.MyType) HashMap(java.util.HashMap) VariableDesc(org.jbpm.services.api.model.VariableDesc) RemoteEjbTest(org.jbpm.remote.ejb.test.RemoteEjbTest) Test(org.junit.Test)

Example 2 with MyType

use of org.jboss.qa.bpms.remote.ejb.domain.MyType in project jbpm by kiegroup.

the class ETaskContentTest method testGetTaskContentWithOwnType.

@Test
public void testGetTaskContentWithOwnType() {
    MyType myObject = new MyType("my object text");
    Map<String, Object> params = new HashMap<>();
    params.put("myObject", myObject);
    params.put("textContent", "HelloContent");
    ProcessInstance pi = ejb.startAndGetProcess(ProcessDefinitions.HUMAN_TASK_WITH_OWN_TYPE, params);
    Assertions.assertThat(pi).isNotNull();
    Assertions.assertThat(pi.getState()).isEqualTo(ProcessInstance.STATE_ACTIVE);
    List<Long> ts = ejb.getTasksByProcessInstanceId(pi.getId());
    Assertions.assertThat(ts.size()).isEqualTo(1);
    long taskId = ts.get(0);
    ejb.start(taskId, userId);
    Map<String, Object> content = ejb.getTaskInputContentByTaskId(taskId);
    for (Entry<String, Object> c : content.entrySet()) {
        System.out.println(c.getKey() + " : " + c.getValue());
    }
    Assertions.assertThat(((MyType) content.get("inputMyObject")).getText()).isEqualTo(myObject.getText());
}
Also used : MyType(org.jboss.qa.bpms.remote.ejb.domain.MyType) HashMap(java.util.HashMap) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) RemoteEjbTest(org.jbpm.remote.ejb.test.RemoteEjbTest) Test(org.junit.Test)

Example 3 with MyType

use of org.jboss.qa.bpms.remote.ejb.domain.MyType in project jbpm by kiegroup.

the class ETaskParametersTest method testMapVariable.

@Test
public void testMapVariable() {
    MyType myObject1 = new MyType("my object 1");
    MyType myObject2 = new MyType("my object 2");
    Map<String, MyType> mapVariable = new LinkedHashMap<>();
    mapVariable.put("object1", myObject1);
    mapVariable.put("object2", myObject2);
    startProcessAndCompleteTask(ProcessDefinitions.HUMAN_TASK_WITH_DIFFERENT_TYPES, "outMapVariable", mapVariable, "mapVariable");
}
Also used : MyType(org.jboss.qa.bpms.remote.ejb.domain.MyType) LinkedHashMap(java.util.LinkedHashMap) RemoteEjbTest(org.jbpm.remote.ejb.test.RemoteEjbTest) Test(org.junit.Test)

Example 4 with MyType

use of org.jboss.qa.bpms.remote.ejb.domain.MyType in project jbpm by kiegroup.

the class ETaskParametersTest method testCompleteTaskWithMyType.

@Test
public void testCompleteTaskWithMyType() {
    MyType myObject = new MyType("my object text");
    startProcessAndCompleteTask(ProcessDefinitions.HUMAN_TASK_WITH_DIFFERENT_TYPES, "outMyObject", myObject, "myObject");
}
Also used : MyType(org.jboss.qa.bpms.remote.ejb.domain.MyType) RemoteEjbTest(org.jbpm.remote.ejb.test.RemoteEjbTest) Test(org.junit.Test)

Example 5 with MyType

use of org.jboss.qa.bpms.remote.ejb.domain.MyType in project jbpm by kiegroup.

the class ETaskParametersTest method testCompleteTaskWithNestedType.

@Test
public void testCompleteTaskWithNestedType() {
    MyType myObject = new MyType("my object text");
    NestedType nestedObject = new NestedType("nested object text", myObject);
    startProcessAndCompleteTask(ProcessDefinitions.HUMAN_TASK_WITH_DIFFERENT_TYPES, "outNestedObject", nestedObject, "nestedObject");
}
Also used : MyType(org.jboss.qa.bpms.remote.ejb.domain.MyType) NestedType(org.jboss.qa.bpms.remote.ejb.domain.NestedType) RemoteEjbTest(org.jbpm.remote.ejb.test.RemoteEjbTest) Test(org.junit.Test)

Aggregations

MyType (org.jboss.qa.bpms.remote.ejb.domain.MyType)7 RemoteEjbTest (org.jbpm.remote.ejb.test.RemoteEjbTest)7 Test (org.junit.Test)7 HashMap (java.util.HashMap)2 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 ListType (org.jboss.qa.bpms.remote.ejb.domain.ListType)1 NestedType (org.jboss.qa.bpms.remote.ejb.domain.NestedType)1 VariableDesc (org.jbpm.services.api.model.VariableDesc)1 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)1