Search in sources :

Example 16 with TaskSummary

use of org.kie.server.api.model.instance.TaskSummary in project droolsjbpm-integration by kiegroup.

the class TaskSearchServiceIntegrationTest method testFindTaskWithTaskIdEqualsToFilter.

@Test
public void testFindTaskWithTaskIdEqualsToFilter() throws Exception {
    Long processInstanceId = processClient.startProcess(CONTAINER_ID, PROCESS_ID_USERTASK);
    Assertions.assertThat(processInstanceId).isNotNull();
    List<TaskSummary> tasks = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10);
    Assertions.assertThat(tasks).isNotEmpty();
    TaskSummary task = tasks.get(0);
    testFindTaskInstanceWithSearchService(createQueryFilterEqualsTo(TaskField.TASKID, task.getId()), task.getId());
}
Also used : TaskSummary(org.kie.server.api.model.instance.TaskSummary) Test(org.junit.Test)

Example 17 with TaskSummary

use of org.kie.server.api.model.instance.TaskSummary in project droolsjbpm-integration by kiegroup.

the class TaskSearchServiceIntegrationTest method testFindTaskWithParentIdGreaterThanAndEqualsToFilter.

@Test
public void testFindTaskWithParentIdGreaterThanAndEqualsToFilter() throws Exception {
    Long processInstanceId = processClient.startProcess(CONTAINER_ID, PROCESS_ID_USERTASK);
    Assertions.assertThat(processInstanceId).isNotNull();
    List<TaskSummary> tasks = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10);
    Assertions.assertThat(tasks).isNotEmpty();
    TaskSummary task = tasks.get(0);
    testFindTaskInstanceWithSearchService(createQueryFilterGreaterThanAndEqualsTo(TaskField.PARENTID, -2, -1), task.getId());
}
Also used : TaskSummary(org.kie.server.api.model.instance.TaskSummary) Test(org.junit.Test)

Example 18 with TaskSummary

use of org.kie.server.api.model.instance.TaskSummary in project droolsjbpm-integration by kiegroup.

the class TaskSearchServiceIntegrationTest method testFindTaskWithCreatedOnGreaterThanOrEqualsToFilter.

@Test
public void testFindTaskWithCreatedOnGreaterThanOrEqualsToFilter() throws Exception {
    Long processInstanceId = processClient.startProcess(CONTAINER_ID, PROCESS_ID_USERTASK);
    Assertions.assertThat(processInstanceId).isNotNull();
    List<TaskSummary> tasks = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10);
    Assertions.assertThat(tasks).isNotEmpty();
    TaskSummary task = tasks.get(0);
    testFindTaskInstanceWithSearchService(createQueryFilterGreaterThanOrEqualsTo(TaskField.CREATEDON, subtractOneMinuteFromDate(task.getCreatedOn())), task.getId());
}
Also used : TaskSummary(org.kie.server.api.model.instance.TaskSummary) Test(org.junit.Test)

Example 19 with TaskSummary

use of org.kie.server.api.model.instance.TaskSummary in project droolsjbpm-integration by kiegroup.

the class TaskSearchServiceIntegrationTest method testFindTaskWithDeploymentIdEqualsToFilter.

@Test
public void testFindTaskWithDeploymentIdEqualsToFilter() throws Exception {
    Long processInstanceId = processClient.startProcess(CONTAINER_ID, PROCESS_ID_USERTASK);
    Assertions.assertThat(processInstanceId).isNotNull();
    List<TaskSummary> tasks = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10);
    Assertions.assertThat(tasks).isNotEmpty();
    TaskSummary task = tasks.get(0);
    testFindTaskInstanceWithSearchService(createQueryFilterEqualsTo(TaskField.DEPLOYMENTID, CONTAINER_ID), task.getId());
}
Also used : TaskSummary(org.kie.server.api.model.instance.TaskSummary) Test(org.junit.Test)

Example 20 with TaskSummary

use of org.kie.server.api.model.instance.TaskSummary in project droolsjbpm-integration by kiegroup.

the class UserTaskEscalationIntegrationTest method testCompleteTaskBeforeEscalation.

@Test
@Category(Unstable.class)
public void testCompleteTaskBeforeEscalation() throws InterruptedException {
    // Unstable on slow DBs where starting of task is called after escalation timeout.
    Long processInstanceId = processClient.startProcess(CONTAINER_ID, PROCESS_ID_USERTASK_ESCALATION, params);
    assertNotNull(processInstanceId);
    assertTrue(processInstanceId > 0);
    List<TaskSummary> taskList = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10);
    assertNotNull(taskList);
    assertEquals(1, taskList.size());
    TaskSummary taskSummary = taskList.get(0);
    assertEquals("User Task", taskSummary.getName());
    Long taskId = taskSummary.getId();
    taskClient.startTask(CONTAINER_ID, taskId, USER_YODA);
    taskClient.completeTask(CONTAINER_ID, taskId, USER_YODA, new HashMap<String, Object>());
    ProcessInstance processInstance = processClient.getProcessInstance(CONTAINER_ID, processInstanceId);
    assertNotNull(processInstance);
    assertEquals(org.kie.api.runtime.process.ProcessInstance.STATE_COMPLETED, processInstance.getState().intValue());
    KieServerAssert.assertNullOrEmpty("Email received!", wiser.getMessages());
    // wait while, cause email is sent 6s after task start
    Thread.sleep(8000L);
    KieServerAssert.assertNullOrEmpty("Email received!", wiser.getMessages());
}
Also used : TaskSummary(org.kie.server.api.model.instance.TaskSummary) ProcessInstance(org.kie.server.api.model.instance.ProcessInstance) Category(org.junit.experimental.categories.Category) Test(org.junit.Test)

Aggregations

TaskSummary (org.kie.server.api.model.instance.TaskSummary)142 Test (org.junit.Test)131 HashMap (java.util.HashMap)79 JbpmKieServerBaseIntegrationTest (org.kie.server.integrationtests.jbpm.JbpmKieServerBaseIntegrationTest)39 ProcessInstance (org.kie.server.api.model.instance.ProcessInstance)31 TaskInstance (org.kie.server.api.model.instance.TaskInstance)28 ArrayList (java.util.ArrayList)24 OrgEntities (org.kie.server.api.model.admin.OrgEntities)21 KieServicesException (org.kie.server.api.exception.KieServicesException)14 Category (org.junit.experimental.categories.Category)7 NodeInstance (org.kie.server.api.model.instance.NodeInstance)7 Date (java.util.Date)6 CaseInstance (org.kie.server.api.model.cases.CaseInstance)6 TaskEventInstance (org.kie.server.api.model.instance.TaskEventInstance)6 WorkItemInstance (org.kie.server.api.model.instance.WorkItemInstance)6 ProcessDefinition (org.kie.server.api.model.definition.ProcessDefinition)5 ProcessServicesClient (org.kie.server.client.ProcessServicesClient)5 UserTaskServicesClient (org.kie.server.client.UserTaskServicesClient)5 Calendar (java.util.Calendar)4 List (java.util.List)3