use of org.kie.server.api.model.cases.CaseStage in project droolsjbpm-integration by kiegroup.
the class CarInsuranceClaimCaseIntegrationTest method assertBuildClaimReportStage.
private void assertBuildClaimReportStage(String caseId) {
List<CaseStage> activeStages = caseClient.getStages(CONTAINER_ID, caseId, true, 0, 10);
assertEquals(1, activeStages.size());
CaseStage stage = activeStages.iterator().next();
assertEquals("Build claim report", stage.getName());
}
use of org.kie.server.api.model.cases.CaseStage in project droolsjbpm-integration by kiegroup.
the class CaseServiceIntegrationTest method testAddDynamicSubProcessToStage.
@Test
public void testAddDynamicSubProcessToStage() {
String caseId = startCarInsuranceClaimCase(USER_YODA, USER_JOHN, USER_YODA);
Assertions.assertThat(caseId).isNotNull();
List<CaseStage> caseStages = caseClient.getStages(CONTAINER_ID, caseId, false, 0, 50);
String activeStageId = caseStages.stream().filter(stage -> STAGE_ACTIVE_STATE.equals(stage.getStatus())).findFirst().orElseThrow(() -> new IllegalStateException("No active stage found.")).getIdentifier();
List<ProcessInstance> instances = caseClient.getProcessInstances(CONTAINER_ID, caseId, Arrays.asList(1, 2, 3), 0, 10);
Assertions.assertThat(instances).hasSize(1);
final long originalCaseProcessInstanceId = instances.get(0).getId();
caseClient.addDynamicSubProcessToStage(CONTAINER_ID, caseId, activeStageId, DATA_VERIFICATION_DEF_ID, Collections.emptyMap());
instances = caseClient.getProcessInstances(CONTAINER_ID, caseId, Arrays.asList(1, 2, 3), 0, 10);
Assertions.assertThat(instances).hasSize(2);
final ProcessInstance newlyCreatedProcessInstance = instances.stream().filter((pi) -> pi.getId() != originalCaseProcessInstanceId).findFirst().get();
Assertions.assertThat(newlyCreatedProcessInstance.getProcessId()).isEqualTo(DATA_VERIFICATION_DEF_ID);
Assertions.assertThat(newlyCreatedProcessInstance.getState()).isEqualTo(STATE_COMPLETED);
}
use of org.kie.server.api.model.cases.CaseStage in project droolsjbpm-integration by kiegroup.
the class CarInsuranceClaimCaseIntegrationTest method assertClaimAssesmentStage.
private void assertClaimAssesmentStage(String caseId) {
List<CaseStage> activeStages = caseClient.getStages(CONTAINER_ID, caseId, true, 0, 10);
assertEquals(1, activeStages.size());
CaseStage stage = activeStages.iterator().next();
assertEquals("Claim assesment", stage.getName());
}
use of org.kie.server.api.model.cases.CaseStage in project droolsjbpm-integration by kiegroup.
the class CaseManagementRuntimeDataServiceBase method getStages.
public CaseStageList getStages(String containerId, String caseId, boolean activeOnly, Integer page, Integer pageSize) {
Collection<CaseStageInstance> caseStageInstances = caseRuntimeDataService.getCaseInstanceStages(caseId, activeOnly, ConvertUtils.buildQueryContext(page, pageSize));
List<CaseStage> caseStages = ConvertUtils.transformStages(caseStageInstances);
CaseStageList stageList = new CaseStageList(caseStages);
return stageList;
}
Aggregations