Search in sources :

Example 6 with CaseStage

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());
}
Also used : CaseStage(org.kie.server.api.model.cases.CaseStage)

Example 7 with CaseStage

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);
}
Also used : Arrays(java.util.Arrays) CaseInstanceCustomVars(org.kie.server.api.model.cases.CaseInstanceCustomVars) BeforeClass(org.junit.BeforeClass) ProcessInstance(org.kie.server.api.model.instance.ProcessInstance) STATE_ACTIVE(org.kie.api.runtime.process.ProcessInstance.STATE_ACTIVE) CaseStage(org.kie.server.api.model.cases.CaseStage) HashMap(java.util.HashMap) CaseFile(org.kie.server.api.model.cases.CaseFile) CaseInstance(org.kie.server.api.model.cases.CaseInstance) ArrayList(java.util.ArrayList) QueryParamFactory.list(org.kie.server.api.util.QueryParamFactory.list) Map(java.util.Map) KieServices(org.kie.api.KieServices) Assertions(org.assertj.core.api.Assertions) Assume(org.junit.Assume) CaseServicesClient(org.kie.server.client.CaseServicesClient) QueryParamFactory.equalsTo(org.kie.server.api.util.QueryParamFactory.equalsTo) TaskSummary(org.kie.server.api.model.instance.TaskSummary) CASE_ATTR_CORRELATION_KEY(org.jbpm.casemgmt.api.AdvanceCaseRuntimeDataService.CASE_ATTR_CORRELATION_KEY) Assert.assertNotNull(org.junit.Assert.assertNotNull) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) QueryParam(org.kie.server.api.model.definition.QueryParam) SearchQueryFilterSpec(org.kie.server.api.model.definition.SearchQueryFilterSpec) KieServerDeployer(org.kie.server.integrationtests.shared.KieServerDeployer) Assertions.entry(org.assertj.core.api.Assertions.entry) STATE_COMPLETED(org.kie.api.runtime.process.ProcessInstance.STATE_COMPLETED) QueryParamFactory.likeTo(org.kie.server.api.util.QueryParamFactory.likeTo) List(java.util.List) CaseUserTaskWithVariables(org.kie.server.api.model.cases.CaseUserTaskWithVariables) Optional(java.util.Optional) ReleaseId(org.kie.server.api.model.ReleaseId) Collections(java.util.Collections) KieServerReflections(org.kie.server.integrationtests.shared.KieServerReflections) Assert.assertEquals(org.junit.Assert.assertEquals) JbpmKieServerBaseIntegrationTest(org.kie.server.integrationtests.jbpm.JbpmKieServerBaseIntegrationTest) CaseStage(org.kie.server.api.model.cases.CaseStage) ProcessInstance(org.kie.server.api.model.instance.ProcessInstance) Test(org.junit.Test) JbpmKieServerBaseIntegrationTest(org.kie.server.integrationtests.jbpm.JbpmKieServerBaseIntegrationTest)

Example 8 with CaseStage

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());
}
Also used : CaseStage(org.kie.server.api.model.cases.CaseStage)

Example 9 with CaseStage

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;
}
Also used : CaseStage(org.kie.server.api.model.cases.CaseStage) CaseStageList(org.kie.server.api.model.cases.CaseStageList) CaseStageInstance(org.jbpm.casemgmt.api.model.instance.CaseStageInstance)

Aggregations

CaseStage (org.kie.server.api.model.cases.CaseStage)9 Test (org.junit.Test)6 JbpmKieServerBaseIntegrationTest (org.kie.server.integrationtests.jbpm.JbpmKieServerBaseIntegrationTest)6 CaseInstance (org.kie.server.api.model.cases.CaseInstance)3 TaskSummary (org.kie.server.api.model.instance.TaskSummary)3 ArrayList (java.util.ArrayList)2 Arrays (java.util.Arrays)2 Collections (java.util.Collections)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 Assertions (org.assertj.core.api.Assertions)2 Assert.assertEquals (org.junit.Assert.assertEquals)2 Assert.assertNotNull (org.junit.Assert.assertNotNull)2 Assert.assertTrue (org.junit.Assert.assertTrue)2 Assume (org.junit.Assume)2 BeforeClass (org.junit.BeforeClass)2 KieServices (org.kie.api.KieServices)2 STATE_ACTIVE (org.kie.api.runtime.process.ProcessInstance.STATE_ACTIVE)2 STATE_COMPLETED (org.kie.api.runtime.process.ProcessInstance.STATE_COMPLETED)2