use of org.kie.server.api.model.cases.CaseFile in project droolsjbpm-integration by kiegroup.
the class CaseServiceRestOnlyIntegrationTest method testCreateCase.
@Test
public void testCreateCase() {
CaseFile caseFileObj = CaseFile.builder().addUserAssignments(CASE_OWNER_ROLE, USER_YODA).addUserAssignments(CASE_CONTACT_ROLE, USER_JOHN).build();
Entity<CaseFile> caseFile = Entity.entity(caseFileObj, getMediaType());
Map<String, Object> valuesMap = new HashMap<String, Object>();
valuesMap.put(RestURI.CONTAINER_ID, CONTAINER_ID);
valuesMap.put(RestURI.CASE_DEF_ID, CASE_HR_DEF_ID);
WebTarget clientRequest = newRequest(build(TestConfig.getKieServerHttpUrl(), RestURI.CASE_URI + "/" + RestURI.START_CASE_POST_URI, valuesMap));
logger.debug("Start case: [POST] " + clientRequest.getUri());
response = clientRequest.request(getMediaType()).post(caseFile);
Assert.assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus());
String caseId = response.readEntity(JaxbString.class).getValue();
assertNotNull(caseId);
}
use of org.kie.server.api.model.cases.CaseFile in project droolsjbpm-integration by kiegroup.
the class CustomCaseIdIntegrationTest method testCustomCaseId.
@Test
public void testCustomCaseId() {
Assume.assumeFalse(TestConfig.isLocalServer());
Map<String, Object> data = new HashMap<>();
data.put("s", "first case started");
CaseFile caseFile = CaseFile.builder().addUserAssignments(CASE_OWNER_ROLE, USER_YODA).data(data).build();
String caseId = caseClient.startCase(CONTAINER_ID, CASE_HR_DEF_ID, caseFile);
assertNotNull(caseId);
assertTrue("Created Case Id doesn't start with expected value, value is: " + caseId, caseId.startsWith("HR-01234"));
}
use of org.kie.server.api.model.cases.CaseFile in project droolsjbpm-integration by kiegroup.
the class CaseRuntimeDataServiceIntegrationTest method testCaseRolesCardinality.
@Test
public void testCaseRolesCardinality() {
Map<String, Object> data = new HashMap<>();
data.put("s", "first case started");
CaseFile caseFile = CaseFile.builder().data(data).addUserAssignments(CASE_INSURED_ROLE, USER_YODA).addUserAssignments(CASE_INS_REP_ROLE, USER_JOHN).build();
String caseId = caseClient.startCase(CONTAINER_ID, CLAIM_CASE_DEF_ID, caseFile);
assertNotNull(caseId);
// Try to add second user to insured role with cardinality 1
assertClientException(() -> caseClient.assignUserToRole(CONTAINER_ID, caseId, CASE_INSURED_ROLE, USER_YODA), 400, "Cannot add more users for role " + CASE_INSURED_ROLE);
}
use of org.kie.server.api.model.cases.CaseFile in project droolsjbpm-integration by kiegroup.
the class CaseRuntimeDataServiceIntegrationTest method startUserTaskCase.
private String startUserTaskCase(String owner, String contact) {
Map<String, Object> data = new HashMap<>();
data.put("s", "first case started");
CaseFile caseFile = CaseFile.builder().addUserAssignments(CASE_OWNER_ROLE, owner).addUserAssignments(CASE_CONTACT_ROLE, contact).data(data).build();
String caseId = caseClient.startCase(CONTAINER_ID, CASE_HR_DEF_ID, caseFile);
assertNotNull(caseId);
return caseId;
}
use of org.kie.server.api.model.cases.CaseFile in project droolsjbpm-integration by kiegroup.
the class CaseRuntimeDataServiceIntegrationTest method startCarInsuranceClaimCase.
private String startCarInsuranceClaimCase(String insured, String insuranceRep, String assessor) {
Map<String, Object> data = new HashMap<>();
data.put("s", "first case started");
CaseFile caseFile = CaseFile.builder().addUserAssignments(CASE_INSURED_ROLE, insured).addUserAssignments(CASE_INS_REP_ROLE, insuranceRep).addUserAssignments(CASE_ASSESSOR_ROLE, assessor).data(data).build();
String caseId = caseClient.startCase(CONTAINER_ID, CLAIM_CASE_DEF_ID, caseFile);
assertNotNull(caseId);
return caseId;
}
Aggregations