public List<CaseActionSummary> getCompletedActions(String containerId, String caseId) { List<NodeInstance> activeNodes = getCaseCompletedNodes(containerId, caseId); return activeNodes.stream() .map(s -> new CaseActionNodeInstanceMapper( (new HumanTaskNodePredicate().test(s.getNodeType()) ? userTaskServicesClient.findTaskByWorkItemId(s.getWorkItemId()).getActualOwner() : ""), CaseActionStatus.COMPLETED).apply(s)) .collect(toList()); }
public List<CaseActionSummary> getCompletedActions(String containerId, String caseId) { List<NodeInstance> activeNodes = getCaseCompletedNodes(containerId, caseId); return activeNodes.stream() .map(s -> new CaseActionNodeInstanceMapper( (new HumanTaskNodePredicate().test(s.getNodeType()) ? userTaskServicesClient.findTaskByWorkItemId(s.getWorkItemId()).getActualOwner() : ""), CaseActionStatus.COMPLETED).apply(s)) .collect(toList()); }
public List<CaseActionSummary> getInProgressActions(String containerId, String caseId) { List<NodeInstance> activeNodes = client.getActiveNodes(containerId, caseId, 0, PAGE_SIZE_UNLIMITED); return activeNodes.stream() .map(s -> new CaseActionNodeInstanceMapper( (new HumanTaskNodePredicate().test(s.getNodeType()) ? userTaskServicesClient.findTaskByWorkItemId(s.getWorkItemId()).getActualOwner() : ""), CaseActionStatus.IN_PROGRESS).apply(s)) .collect(toList()); }
public List<CaseActionSummary> getInProgressActions(String containerId, String caseId) { List<NodeInstance> activeNodes = client.getActiveNodes(containerId, caseId, 0, PAGE_SIZE_UNLIMITED); return activeNodes.stream() .map(s -> new CaseActionNodeInstanceMapper( (new HumanTaskNodePredicate().test(s.getNodeType()) ? userTaskServicesClient.findTaskByWorkItemId(s.getWorkItemId()).getActualOwner() : ""), CaseActionStatus.IN_PROGRESS).apply(s)) .collect(toList()); }
private void verifyCurrentActivities(Long processInstanceId) { final NodeInstance nodeInstanceMock = mock(NodeInstance.class); final List<NodeInstance> nodeInstanceList = singletonList(nodeInstanceMock); when(queryServicesClient.findActiveNodeInstances(processInstanceId, 0, Integer.MAX_VALUE)).thenReturn(nodeInstanceList); when(nodeInstanceMock.getDate()).thenReturn(new Date()); ProcessInstanceKey instanceKey = new ProcessInstanceKey(serverTemplateId, containerId, processInstanceId); service.getProcessInstanceActiveNodes(instanceKey); verify(queryServicesClient).findActiveNodeInstances(processInstanceId, 0, Integer.MAX_VALUE); verify(nodeInstanceMock).getDate(); verify(nodeInstanceMock).getId(); verify(nodeInstanceMock).getName(); verify(nodeInstanceMock).getNodeType(); }
private void verifyCurrentActivities(Long processInstanceId) { final NodeInstance nodeInstanceMock = mock(NodeInstance.class); final List<NodeInstance> nodeInstanceList = singletonList(nodeInstanceMock); when(queryServicesClient.findActiveNodeInstances(processInstanceId, 0, Integer.MAX_VALUE)).thenReturn(nodeInstanceList); when(nodeInstanceMock.getDate()).thenReturn(new Date()); ProcessInstanceKey instanceKey = new ProcessInstanceKey(serverTemplateId, containerId, processInstanceId); service.getProcessInstanceActiveNodes(instanceKey); verify(queryServicesClient).findActiveNodeInstances(processInstanceId, 0, Integer.MAX_VALUE); verify(nodeInstanceMock).getDate(); verify(nodeInstanceMock).getId(); verify(nodeInstanceMock).getName(); verify(nodeInstanceMock).getNodeType(); }
@Test public void getCompletedActionsTest_withoutUserTasks() { final NodeInstance nodeInstance = createTestNodeInstance("completedNode", "Service Task", 1L); when(clientMock.getCompletedNodes(containerId, caseId, 0, PAGE_SIZE_UNLIMITED)).thenReturn(singletonList(nodeInstance)); final List<CaseActionSummary> result = testedService.getCompletedActions(containerId, caseId); verifyZeroInteractions(userTaskServicesClient); SoftAssertions.assertSoftly(softly -> { softly.assertThat(result.get(0).getName()).isEqualTo(nodeInstance.getName()); softly.assertThat(result.get(0).getType()).isEqualTo(nodeInstance.getNodeType()); softly.assertThat(result.get(0).getActualOwner()).isEmpty(); softly.assertThat(result.get(0).getActionStatus()).isEqualTo(CaseActionStatus.COMPLETED); }); }
@Test public void getCompletedActionsTest_withoutUserTasks() { final NodeInstance nodeInstance = createTestNodeInstance("completedNode", "Service Task", 1L); when(clientMock.getCompletedNodes(containerId, caseId, 0, PAGE_SIZE_UNLIMITED)).thenReturn(singletonList(nodeInstance)); final List<CaseActionSummary> result = testedService.getCompletedActions(containerId, caseId); verifyZeroInteractions(userTaskServicesClient); SoftAssertions.assertSoftly(softly -> { softly.assertThat(result.get(0).getName()).isEqualTo(nodeInstance.getName()); softly.assertThat(result.get(0).getType()).isEqualTo(nodeInstance.getNodeType()); softly.assertThat(result.get(0).getActualOwner()).isEmpty(); softly.assertThat(result.get(0).getActionStatus()).isEqualTo(CaseActionStatus.COMPLETED); }); }
@Override public CaseActionSummary apply(NodeInstance nodeInstance) { if (nodeInstance == null) { return null; } return CaseActionSummary.builder() .id(nodeInstance.getId()) .name(nodeInstance.getName()) .type(nodeInstance.getNodeType()) .createdOn(nodeInstance.getDate()) .actualOwner(actualOwner) .actionStatus(actionStatus) .build(); } }
@Override public CaseActionSummary apply(NodeInstance nodeInstance) { if (nodeInstance == null) { return null; } return CaseActionSummary.builder() .id(nodeInstance.getId()) .name(nodeInstance.getName()) .type(nodeInstance.getNodeType()) .createdOn(nodeInstance.getDate()) .actualOwner(actualOwner) .actionStatus(actionStatus) .build(); } }
@Override public NodeInstanceSummary apply(NodeInstance nodeInstance) { if (nodeInstance == null) { return null; } return new NodeInstanceSummary(nodeInstance.getId(), nodeInstance.getProcessInstanceId(), nodeInstance.getName(), nodeInstance.getNodeId(), nodeInstance.getNodeType(), nodeInstance.getDate(), nodeInstance.getConnection(), nodeInstance.getCompleted(), nodeInstance.getReferenceId(), nodeInstance.getSlaCompliance(), nodeInstance.getSlaDueDate()); } }
@Test public void getCompletedActionsTest_withUserTasks() { final NodeInstance nodeInstance = createTestNodeInstance("completedNode", NODE_TYPE_HUMAN_TASK, 1L); final TaskInstance taskInstance = TaskInstance.builder().actualOwner("owner").build(); when(clientMock.getCompletedNodes(containerId, caseId, 0, PAGE_SIZE_UNLIMITED)).thenReturn(singletonList(nodeInstance)); when(userTaskServicesClient.findTaskByWorkItemId(nodeInstance.getWorkItemId())).thenReturn(taskInstance); final List<CaseActionSummary> result = testedService.getCompletedActions(containerId, caseId); SoftAssertions.assertSoftly(softly -> { softly.assertThat(result.get(0).getName()).isEqualTo(nodeInstance.getName()); softly.assertThat(result.get(0).getType()).isEqualTo(nodeInstance.getNodeType()); softly.assertThat(result.get(0).getActualOwner()).isEqualTo(taskInstance.getActualOwner()); softly.assertThat(result.get(0).getActionStatus()).isEqualTo(CaseActionStatus.COMPLETED); }); }
@Test public void getCompletedActionsTest_withUserTasks() { final NodeInstance nodeInstance = createTestNodeInstance("completedNode", NODE_TYPE_HUMAN_TASK, 1L); final TaskInstance taskInstance = TaskInstance.builder().actualOwner("owner").build(); when(clientMock.getCompletedNodes(containerId, caseId, 0, PAGE_SIZE_UNLIMITED)).thenReturn(singletonList(nodeInstance)); when(userTaskServicesClient.findTaskByWorkItemId(nodeInstance.getWorkItemId())).thenReturn(taskInstance); final List<CaseActionSummary> result = testedService.getCompletedActions(containerId, caseId); SoftAssertions.assertSoftly(softly -> { softly.assertThat(result.get(0).getName()).isEqualTo(nodeInstance.getName()); softly.assertThat(result.get(0).getType()).isEqualTo(nodeInstance.getNodeType()); softly.assertThat(result.get(0).getActualOwner()).isEqualTo(taskInstance.getActualOwner()); softly.assertThat(result.get(0).getActionStatus()).isEqualTo(CaseActionStatus.COMPLETED); }); }
private void assertClaimAssesmentCaseStage(CaseStage stage, String status) { assertEquals("Claim assesment", stage.getName()); assertNotNull(stage.getIdentifier()); assertEquals(status, stage.getStatus()); if (status.endsWith("Active")) { List<NodeInstance> activeNodes = stage.getActiveNodes(); assertEquals(1, activeNodes.size()); assertEquals("Assessor evaluation", activeNodes.get(0).getName()); assertEquals("HumanTaskNode", activeNodes.get(0).getNodeType()); } else { KieServerAssert.assertNullOrEmpty("Active nodes should be null or empty.", stage.getActiveNodes()); } List<CaseAdHocFragment> adHocFragments = stage.getAdHocFragments(); assertEquals(2, adHocFragments.size()); assertEquals("Classify claim", adHocFragments.get(0).getName()); assertEquals("RuleSetNode", adHocFragments.get(0).getType()); assertEquals("Calculate claim", adHocFragments.get(1).getName()); assertEquals("WorkItemNode", adHocFragments.get(1).getType()); }
@Override public NodeInstanceSummary apply(NodeInstance nodeInstance) { if (nodeInstance == null) { return null; } return new NodeInstanceSummary(nodeInstance.getId(), nodeInstance.getProcessInstanceId(), nodeInstance.getName(), nodeInstance.getNodeId(), nodeInstance.getNodeType(), nodeInstance.getDate(), nodeInstance.getConnection(), nodeInstance.getCompleted(), nodeInstance.getReferenceId(), nodeInstance.getSlaCompliance(), nodeInstance.getSlaDueDate()); } }
private void assertBuildClaimReportCaseStage(CaseStage stage, String status) { assertEquals("Build claim report", stage.getName()); assertNotNull(stage.getIdentifier()); assertEquals(status, stage.getStatus()); if (status.endsWith("Active")) { List<NodeInstance> activeNodes = stage.getActiveNodes(); assertEquals(1, activeNodes.size()); assertEquals("Provide accident information", activeNodes.get(0).getName()); assertEquals("HumanTaskNode", activeNodes.get(0).getNodeType()); } else { KieServerAssert.assertNullOrEmpty("Active nodes should be null or empty.", stage.getActiveNodes()); } List<CaseAdHocFragment> adHocFragments = stage.getAdHocFragments(); assertEquals(2, adHocFragments.size()); assertEquals("Provide accident information", adHocFragments.get(0).getName()); assertEquals("HumanTaskNode", adHocFragments.get(0).getType()); assertEquals("Submit police report", adHocFragments.get(1).getName()); assertEquals("HumanTaskNode", adHocFragments.get(1).getType()); }
private void assertNodeInstance(NodeInstance expected, NodeInstance actual) { assertNotNull(actual); assertEquals(expected.getName(), actual.getName()); assertEquals(expected.getContainerId(), actual.getContainerId()); assertEquals(expected.getNodeType(), actual.getNodeType()); assertEquals(expected.getCompleted(), actual.getCompleted()); assertEquals(expected.getProcessInstanceId(), actual.getProcessInstanceId()); }
private void assertNodeInstance(NodeInstance expected, NodeInstance actual) { assertNotNull(actual); assertEquals(expected.getName(), actual.getName()); assertEquals(expected.getContainerId(), actual.getContainerId()); assertEquals(expected.getNodeType(), actual.getNodeType()); assertEquals(expected.getCompleted(), actual.getCompleted()); assertEquals(expected.getProcessInstanceId(), actual.getProcessInstanceId()); }
public static void assertCaseActionNodeInstance(final NodeInstance nodeInstance, final CaseActionSummary caseActionSummary) { assertNotNull(caseActionSummary); assertNotNull(nodeInstance); assertEquals(nodeInstance.getId(), caseActionSummary.getId()); assertEquals(nodeInstance.getName(), caseActionSummary.getName()); assertEquals(nodeInstance.getNodeType(), caseActionSummary.getType()); assertEquals(nodeInstance.getDate(), caseActionSummary.getCreatedOn()); assertNotNull(caseActionSummary.getActionStatus()); }
public static void assertCaseActionNodeInstance(final NodeInstance nodeInstance, final CaseActionSummary caseActionSummary) { assertNotNull(caseActionSummary); assertNotNull(nodeInstance); assertEquals(nodeInstance.getId(), caseActionSummary.getId()); assertEquals(nodeInstance.getName(), caseActionSummary.getName()); assertEquals(nodeInstance.getNodeType(), caseActionSummary.getType()); assertEquals(nodeInstance.getDate(), caseActionSummary.getCreatedOn()); assertNotNull(caseActionSummary.getActionStatus()); }