Search in sources :

Example 1 with Person

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

the class ECustomVariableTest method testCustomProcessVariableRetrieval.

@Test
public void testCustomProcessVariableRetrieval() {
    Person candidate = new Person("Dluhoslav Chudobny", 30);
    Map<String, Object> parameters = new HashMap<>();
    parameters.put("candidate", candidate);
    Long pid = ejb.startProcess(ProcessDefinitions.CUSTOM_VARIABLE, parameters);
    Person person = (Person) ejb.getProcessVariable(pid, "candidate");
    Assertions.assertThat(person).isNotNull().isEqualTo(candidate);
}
Also used : HashMap(java.util.HashMap) Person(org.jboss.qa.bpms.remote.ejb.domain.Person) RemoteEjbTest(org.jbpm.remote.ejb.test.RemoteEjbTest) Test(org.junit.Test)

Example 2 with Person

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

the class ETaskAttachmentTest method testCustomAttachment.

@Test
public void testCustomAttachment() throws IOException {
    ejb.startProcess(ProcessDefinitions.HUMAN_TASK);
    List<TaskSummary> taskSummaryList = ejb.getTasksAssignedAsPotentialOwner(userId);
    Long taskId = taskSummaryList.get(0).getId();
    // Add attachment
    Person lisa = new Person("Lisa Simpson", 7);
    ejb.addAttachment(taskId, userId, "Lisa", lisa);
    // Get the attachment
    Attachment attachment = getAttachment(taskId);
    Assertions.assertThat(attachment.getContentType()).isEqualTo(lisa.getClass().getName());
    Assertions.assertThat(attachment.getSize()).isEqualTo(persist(lisa).length);
    // Get the attachment content
    Object content = getContent(taskId, attachment.getId());
    Assertions.assertThat(content).isEqualTo(lisa);
}
Also used : TaskSummary(org.kie.api.task.model.TaskSummary) Attachment(org.kie.api.task.model.Attachment) Person(org.jboss.qa.bpms.remote.ejb.domain.Person) RemoteEjbTest(org.jbpm.remote.ejb.test.RemoteEjbTest) Test(org.junit.Test)

Example 3 with Person

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

the class ECustomVariableTest method testCustomProcessVariableSet.

@Test
public void testCustomProcessVariableSet() {
    Person candidate = new Person("Jack Sparrow", 35);
    Map<String, Object> parameters = new HashMap<>();
    parameters.put("candidate", candidate);
    Long pid = ejb.startProcess(ProcessDefinitions.CUSTOM_VARIABLE, parameters);
    Person betterCandidate = new Person("Barbossa", 53);
    ejb.setProcessVariable(pid, "candidate", betterCandidate);
    Person person = (Person) ejb.getProcessVariable(pid, "candidate");
    Assertions.assertThat(person).isNotNull().isEqualTo(betterCandidate);
}
Also used : HashMap(java.util.HashMap) Person(org.jboss.qa.bpms.remote.ejb.domain.Person) RemoteEjbTest(org.jbpm.remote.ejb.test.RemoteEjbTest) Test(org.junit.Test)

Aggregations

Person (org.jboss.qa.bpms.remote.ejb.domain.Person)3 RemoteEjbTest (org.jbpm.remote.ejb.test.RemoteEjbTest)3 Test (org.junit.Test)3 HashMap (java.util.HashMap)2 Attachment (org.kie.api.task.model.Attachment)1 TaskSummary (org.kie.api.task.model.TaskSummary)1