Search in sources :

Example 21 with CaseFile

use of org.kie.server.api.model.cases.CaseFile in project droolsjbpm-integration by kiegroup.

the class CaseInstanceMigrationIntegrationTest method startCarInsuranceClaimCase.

private String startCarInsuranceClaimCase(String insured, String insuranceRep) {
    CaseFile caseFile = CaseFile.builder().addUserAssignments(CASE_INSURED_ROLE, insured).addUserAssignments(CASE_INS_REP_ROLE, insuranceRep).addUserAssignments(CASE_INS_ASSESSOR_ROLE, insuranceRep).build();
    String caseId = caseClient.startCase(CONTAINER_ID, CLAIM_CASE_DEF_ID, caseFile);
    assertNotNull(caseId);
    return caseId;
}
Also used : CaseFile(org.kie.server.api.model.cases.CaseFile)

Example 22 with CaseFile

use of org.kie.server.api.model.cases.CaseFile in project droolsjbpm-integration by kiegroup.

the class CustomCaseIdIntegrationTest method testCustomCaseIdWithOptionalParams.

@Test
public void testCustomCaseIdWithOptionalParams() {
    Assume.assumeFalse(TestConfig.isLocalServer());
    Map<String, Object> data = new HashMap<>();
    data.put("var1", "VALUE1");
    data.put("country", "spa");
    CaseFile caseFile = CaseFile.builder().addUserAssignments(CASE_OWNER_ROLE, USER_YODA).data(data).build();
    String caseId = caseClient.startCase(CONTAINER_ID, PREFIX_VARIABLE_LOWER_CAPITALIZE, caseFile);
    assertNotNull(caseId);
    assertTrue("Created Case Id doesn't match expected value, value is: " + caseId, caseId.matches(CONTAINER_ID + "-value1-Spa-01234[0-9]+"));
}
Also used : HashMap(java.util.HashMap) CaseFile(org.kie.server.api.model.cases.CaseFile) Test(org.junit.Test)

Example 23 with CaseFile

use of org.kie.server.api.model.cases.CaseFile in project droolsjbpm-integration by kiegroup.

the class CustomCaseIdIntegrationTest method testCustomCaseIdWithoutParamsThrowsException.

@Test
public void testCustomCaseIdWithoutParamsThrowsException() {
    Assume.assumeFalse(TestConfig.isLocalServer());
    CaseFile caseFile = CaseFile.builder().addUserAssignments(CASE_OWNER_ROLE, USER_YODA).data(Collections.emptyMap()).build();
    assertThatThrownBy(() -> caseClient.startCase(CONTAINER_ID, PREFIX_VARIABLE_LOWER_CAPITALIZE, caseFile)).isInstanceOf(KieServicesException.class).hasMessageContaining("Case Id Prefix cannot be generated");
}
Also used : CaseFile(org.kie.server.api.model.cases.CaseFile) KieServicesException(org.kie.server.api.exception.KieServicesException) Test(org.junit.Test)

Aggregations

CaseFile (org.kie.server.api.model.cases.CaseFile)23 HashMap (java.util.HashMap)17 Test (org.junit.Test)13 JbpmKieServerBaseIntegrationTest (org.kie.server.integrationtests.jbpm.JbpmKieServerBaseIntegrationTest)9 CaseInstance (org.kie.server.api.model.cases.CaseInstance)3 TaskSummary (org.kie.server.api.model.instance.TaskSummary)3 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)2 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Date (java.util.Date)1 List (java.util.List)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 WebTarget (javax.ws.rs.client.WebTarget)1 CaseDefinitionNotFoundException (org.jbpm.casemgmt.api.CaseDefinitionNotFoundException)1 CaseNotFoundException (org.jbpm.casemgmt.api.CaseNotFoundException)1 CaseRuntimeDataService (org.jbpm.casemgmt.api.CaseRuntimeDataService)1 CaseService (org.jbpm.casemgmt.api.CaseService)1 TaskSpecification (org.jbpm.casemgmt.api.dynamic.TaskSpecification)1