Search in sources :

Example 1 with UserTaskDefinition

use of org.jbpm.services.api.model.UserTaskDefinition in project jbpm by kiegroup.

the class EDefinitionTest method testTasksDefinitions.

@Test
public void testTasksDefinitions() {
    DeploymentUnit basicKieJar = archive.deployBasicKieJar();
    Collection<UserTaskDefinition> tasks = definitionService.getTasksDefinitions(basicKieJar.getIdentifier(), HUMAN_TASK_PROCESS_ID);
    Assertions.assertThat(tasks).isNotNull().hasSize(1);
    UserTaskDefinition task = tasks.iterator().next();
    Assertions.assertThat(task.getName()).isEqualTo("Hello");
    Assertions.assertThat(task.getAssociatedEntities()).contains("ibek");
    Assertions.assertThat(task.getTaskInputMappings()).containsEntry("TaskName", "java.lang.String");
}
Also used : UserTaskDefinition(org.jbpm.services.api.model.UserTaskDefinition) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) Test(org.junit.Test) AbstractEJBServicesTest(org.jbpm.test.container.AbstractEJBServicesTest)

Example 2 with UserTaskDefinition

use of org.jbpm.services.api.model.UserTaskDefinition in project jbpm by kiegroup.

the class BPMN2DataServicesTest method testHiringProcessData.

@Test
public void testHiringProcessData() throws IOException {
    assertNotNull(deploymentService);
    DeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
    deploymentService.deploy(deploymentUnit);
    units.add(deploymentUnit);
    String processId = "hiring";
    Collection<UserTaskDefinition> processTasks = bpmn2Service.getTasksDefinitions(deploymentUnit.getIdentifier(), processId);
    assertEquals(4, processTasks.size());
    Map<String, String> processData = bpmn2Service.getProcessVariables(deploymentUnit.getIdentifier(), processId);
    assertEquals(9, processData.keySet().size());
    Map<String, String> taskInputMappings = bpmn2Service.getTaskInputMappings(deploymentUnit.getIdentifier(), processId, "HR Interview");
    assertEquals(4, taskInputMappings.keySet().size());
    assertEquals("java.lang.String", taskInputMappings.get("TaskName"));
    assertEquals("Object", taskInputMappings.get("GroupId"));
    assertEquals("Object", taskInputMappings.get("Comment"));
    assertEquals("String", taskInputMappings.get("in_name"));
    Map<String, String> taskOutputMappings = bpmn2Service.getTaskOutputMappings(deploymentUnit.getIdentifier(), processId, "HR Interview");
    assertEquals(4, taskOutputMappings.keySet().size());
    assertEquals("String", taskOutputMappings.get("out_name"));
    assertEquals("Integer", taskOutputMappings.get("out_age"));
    assertEquals("String", taskOutputMappings.get("out_mail"));
    assertEquals("Integer", taskOutputMappings.get("out_score"));
    Map<String, Collection<String>> associatedEntities = bpmn2Service.getAssociatedEntities(deploymentUnit.getIdentifier(), processId);
    assertEquals(4, associatedEntities.keySet().size());
    Map<String, String> allServiceTasks = bpmn2Service.getServiceTasks(deploymentUnit.getIdentifier(), processId);
    assertEquals(2, allServiceTasks.keySet().size());
}
Also used : UserTaskDefinition(org.jbpm.services.api.model.UserTaskDefinition) Collection(java.util.Collection) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 3 with UserTaskDefinition

use of org.jbpm.services.api.model.UserTaskDefinition in project jbpm by kiegroup.

the class BPMN2DataServicesTest method testHumanTaskProcess.

@Test
public void testHumanTaskProcess() throws IOException {
    assertNotNull(deploymentService);
    DeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
    deploymentService.deploy(deploymentUnit);
    units.add(deploymentUnit);
    String processId = "org.jbpm.writedocument";
    ProcessDefinition procDef = bpmn2Service.getProcessDefinition(deploymentUnit.getIdentifier(), processId);
    assertNotNull(procDef);
    assertEquals(procDef.getId(), "org.jbpm.writedocument");
    assertEquals(procDef.getName(), "humanTaskSample");
    assertEquals(procDef.getKnowledgeType(), "PROCESS");
    assertEquals(procDef.getPackageName(), "defaultPackage");
    assertEquals(procDef.getType(), "RuleFlow");
    assertEquals(procDef.getVersion(), "3");
    Map<String, String> processData = bpmn2Service.getProcessVariables(deploymentUnit.getIdentifier(), processId);
    assertEquals("String", processData.get("approval_document"));
    assertEquals("String", processData.get("approval_translatedDocument"));
    assertEquals("String", processData.get("approval_reviewComment"));
    assertEquals(3, processData.keySet().size());
    Collection<UserTaskDefinition> userTasks = bpmn2Service.getTasksDefinitions(deploymentUnit.getIdentifier(), processId);
    assertNotNull(userTasks);
    assertEquals(3, userTasks.size());
    Map<String, UserTaskDefinition> tasksByName = new HashMap<String, UserTaskDefinition>();
    for (UserTaskDefinition userTask : userTasks) {
        tasksByName.put(userTask.getName(), userTask);
    }
    assertTrue(tasksByName.containsKey("Write a Document"));
    assertTrue(tasksByName.containsKey("Translate Document"));
    assertTrue(tasksByName.containsKey("Review Document"));
    UserTaskDefinition task = tasksByName.get("Write a Document");
    assertEquals(true, task.isSkippable());
    assertEquals("Write a Document", task.getName());
    assertEquals(9, task.getPriority().intValue());
    assertEquals("Write a Document", task.getComment());
    assertEquals("Write a Document", task.getFormName());
    assertEquals("2", task.getId());
    task = tasksByName.get("Translate Document");
    assertEquals(true, task.isSkippable());
    assertEquals("Translate Document", task.getName());
    assertEquals(0, task.getPriority().intValue());
    assertEquals("", task.getComment());
    assertEquals("Translate Document", task.getFormName());
    assertEquals("4", task.getId());
    task = tasksByName.get("Review Document");
    assertEquals(false, task.isSkippable());
    assertEquals("Review Document", task.getName());
    assertEquals(0, task.getPriority().intValue());
    assertEquals("", task.getComment());
    assertEquals("Review Document", task.getFormName());
    assertEquals("5", task.getId());
    Map<String, String> taskInputMappings = bpmn2Service.getTaskInputMappings(deploymentUnit.getIdentifier(), processId, "Write a Document");
    assertEquals(4, taskInputMappings.keySet().size());
    Map<String, String> taskOutputMappings = bpmn2Service.getTaskOutputMappings(deploymentUnit.getIdentifier(), processId, "Write a Document");
    assertEquals(1, taskOutputMappings.keySet().size());
    Map<String, Collection<String>> associatedEntities = bpmn2Service.getAssociatedEntities(deploymentUnit.getIdentifier(), processId);
    assertEquals(3, associatedEntities.keySet().size());
}
Also used : HashMap(java.util.HashMap) UserTaskDefinition(org.jbpm.services.api.model.UserTaskDefinition) Collection(java.util.Collection) ProcessDefinition(org.jbpm.services.api.model.ProcessDefinition) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 4 with UserTaskDefinition

use of org.jbpm.services.api.model.UserTaskDefinition in project jbpm by kiegroup.

the class BPMN2DataServicesTest method testHumanTaskProcessNoIO.

@Test
public void testHumanTaskProcessNoIO() throws IOException {
    assertNotNull(deploymentService);
    DeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
    deploymentService.deploy(deploymentUnit);
    units.add(deploymentUnit);
    String processId = "UserTask";
    Collection<UserTaskDefinition> processTasks = bpmn2Service.getTasksDefinitions(deploymentUnit.getIdentifier(), processId);
    assertEquals(1, processTasks.size());
    Map<String, String> processData = bpmn2Service.getProcessVariables(deploymentUnit.getIdentifier(), processId);
    assertEquals(0, processData.keySet().size());
    Map<String, String> taskInputMappings = bpmn2Service.getTaskInputMappings(deploymentUnit.getIdentifier(), processId, "Hello");
    assertEquals(0, taskInputMappings.keySet().size());
    Map<String, String> taskOutputMappings = bpmn2Service.getTaskOutputMappings(deploymentUnit.getIdentifier(), processId, "Hello");
    assertEquals(0, taskOutputMappings.keySet().size());
    Map<String, Collection<String>> associatedEntities = bpmn2Service.getAssociatedEntities(deploymentUnit.getIdentifier(), processId);
    assertEquals(1, associatedEntities.keySet().size());
}
Also used : UserTaskDefinition(org.jbpm.services.api.model.UserTaskDefinition) Collection(java.util.Collection) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 5 with UserTaskDefinition

use of org.jbpm.services.api.model.UserTaskDefinition in project jbpm by kiegroup.

the class DefinitionServiceEJBIntegrationTest method testHiringProcessData.

@Test
public void testHiringProcessData() throws IOException {
    assertNotNull(deploymentService);
    DeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
    deploymentService.deploy(deploymentUnit);
    units.add(deploymentUnit);
    String processId = "hiring";
    Collection<UserTaskDefinition> processTasks = bpmn2Service.getTasksDefinitions(deploymentUnit.getIdentifier(), processId);
    assertEquals(4, processTasks.size());
    Map<String, String> processData = bpmn2Service.getProcessVariables(deploymentUnit.getIdentifier(), processId);
    assertEquals(9, processData.keySet().size());
    Map<String, String> taskInputMappings = bpmn2Service.getTaskInputMappings(deploymentUnit.getIdentifier(), processId, "HR Interview");
    assertEquals(4, taskInputMappings.keySet().size());
    assertEquals("java.lang.String", taskInputMappings.get("TaskName"));
    assertEquals("Object", taskInputMappings.get("GroupId"));
    assertEquals("Object", taskInputMappings.get("Comment"));
    assertEquals("String", taskInputMappings.get("in_name"));
    Map<String, String> taskOutputMappings = bpmn2Service.getTaskOutputMappings(deploymentUnit.getIdentifier(), processId, "HR Interview");
    assertEquals(4, taskOutputMappings.keySet().size());
    assertEquals("String", taskOutputMappings.get("out_name"));
    assertEquals("Integer", taskOutputMappings.get("out_age"));
    assertEquals("String", taskOutputMappings.get("out_mail"));
    assertEquals("Integer", taskOutputMappings.get("out_score"));
    Map<String, Collection<String>> associatedEntities = bpmn2Service.getAssociatedEntities(deploymentUnit.getIdentifier(), processId);
    assertEquals(4, associatedEntities.keySet().size());
    Map<String, String> allServiceTasks = bpmn2Service.getServiceTasks(deploymentUnit.getIdentifier(), processId);
    assertEquals(2, allServiceTasks.keySet().size());
}
Also used : UserTaskDefinition(org.jbpm.services.api.model.UserTaskDefinition) Collection(java.util.Collection) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) Test(org.junit.Test)

Aggregations

DeploymentUnit (org.jbpm.services.api.model.DeploymentUnit)6 UserTaskDefinition (org.jbpm.services.api.model.UserTaskDefinition)6 Test (org.junit.Test)6 Collection (java.util.Collection)5 KModuleDeploymentUnit (org.jbpm.kie.services.impl.KModuleDeploymentUnit)5 AbstractKieServicesBaseTest (org.jbpm.kie.test.util.AbstractKieServicesBaseTest)3 HashMap (java.util.HashMap)1 ProcessDefinition (org.jbpm.services.api.model.ProcessDefinition)1 AbstractEJBServicesTest (org.jbpm.test.container.AbstractEJBServicesTest)1