use of org.kie.server.api.model.type.JaxbLong in project droolsjbpm-integration by kiegroup.
the class JbpmRestIntegrationTest method testBasicJbpmRequest.
@Test
public void testBasicJbpmRequest() throws Exception {
KieContainerResource resource = new KieContainerResource(CONTAINER, releaseId);
Map<String, Object> valuesMap = new HashMap<String, Object>();
valuesMap.put(CONTAINER_ID, resource.getContainerId());
valuesMap.put(PROCESS_ID, HUMAN_TASK_OWN_TYPE_ID);
Response response = null;
try {
WebTarget clientRequest = newRequest(build(TestConfig.getKieServerHttpUrl(), PROCESS_URI + "/" + START_PROCESS_POST_URI, valuesMap));
logger.info("[POST] " + clientRequest.getUri());
response = clientRequest.request().post(createEntity(""));
Assert.assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus());
Assertions.assertThat((String) response.getHeaders().getFirst("Content-Type")).startsWith(getMediaType().toString());
JaxbLong pId = response.readEntity(JaxbLong.class);
valuesMap.put(PROCESS_INST_ID, pId.unwrap());
clientRequest = newRequest(build(TestConfig.getKieServerHttpUrl(), PROCESS_URI + "/" + ABORT_PROCESS_INST_DEL_URI, valuesMap));
logger.info("[DELETE] " + clientRequest.getUri());
response = clientRequest.request(getMediaType()).delete();
int noContentStatusCode = Response.Status.NO_CONTENT.getStatusCode();
int okStatusCode = Response.Status.OK.getStatusCode();
assertTrue("Wrong status code returned: " + response.getStatus(), response.getStatus() == noContentStatusCode || response.getStatus() == okStatusCode);
} finally {
if (response != null) {
response.close();
}
}
}
use of org.kie.server.api.model.type.JaxbLong in project droolsjbpm-integration by kiegroup.
the class JbpmRestIntegrationTest method testBasicJbpmRequestWithSingleAcceptHeader.
@Test
public void testBasicJbpmRequestWithSingleAcceptHeader() throws Exception {
KieContainerResource resource = new KieContainerResource(CONTAINER, releaseId);
Map<String, Object> valuesMap = new HashMap<String, Object>();
valuesMap.put(CONTAINER_ID, resource.getContainerId());
valuesMap.put(PROCESS_ID, HUMAN_TASK_OWN_TYPE_ID);
Response response = null;
try {
WebTarget clientRequest = newRequest(build(TestConfig.getKieServerHttpUrl(), PROCESS_URI + "/" + START_PROCESS_POST_URI, valuesMap));
logger.info("[POST] " + clientRequest.getUri());
response = clientRequest.request(getMediaType()).post(createEntity(""));
Assert.assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus());
Assertions.assertThat((String) response.getHeaders().getFirst("Content-Type")).startsWith(getMediaType().toString());
JaxbLong pId = response.readEntity(JaxbLong.class);
valuesMap.put(PROCESS_INST_ID, pId.unwrap());
clientRequest = newRequest(build(TestConfig.getKieServerHttpUrl(), PROCESS_URI + "/" + ABORT_PROCESS_INST_DEL_URI, valuesMap));
logger.info("[DELETE] " + clientRequest.getUri());
response = clientRequest.request(getMediaType()).delete();
int noContentStatusCode = Response.Status.NO_CONTENT.getStatusCode();
int okStatusCode = Response.Status.OK.getStatusCode();
assertTrue("Wrong status code returned: " + response.getStatus(), response.getStatus() == noContentStatusCode || response.getStatus() == okStatusCode);
} finally {
if (response != null) {
response.close();
}
}
}
use of org.kie.server.api.model.type.JaxbLong in project droolsjbpm-integration by kiegroup.
the class JbpmRestIntegrationTest method testBasicJbpmRequestManyAcceptHeaders.
@Test
public void testBasicJbpmRequestManyAcceptHeaders() throws Exception {
KieContainerResource resource = new KieContainerResource(CONTAINER, releaseId);
Map<String, Object> valuesMap = new HashMap<String, Object>();
valuesMap.put(CONTAINER_ID, resource.getContainerId());
valuesMap.put(PROCESS_ID, HUMAN_TASK_OWN_TYPE_ID);
Response response = null;
try {
WebTarget clientRequest = newRequest(build(TestConfig.getKieServerHttpUrl(), PROCESS_URI + "/" + START_PROCESS_POST_URI, valuesMap));
logger.info("[POST] " + clientRequest.getUri());
response = clientRequest.request(acceptHeadersByFormat.get(marshallingFormat)).post(createEntity(""));
Assert.assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus());
Assertions.assertThat((String) response.getHeaders().getFirst("Content-Type")).startsWith(getMediaType().toString());
JaxbLong pId = response.readEntity(JaxbLong.class);
valuesMap.put(PROCESS_INST_ID, pId.unwrap());
clientRequest = newRequest(build(TestConfig.getKieServerHttpUrl(), PROCESS_URI + "/" + ABORT_PROCESS_INST_DEL_URI, valuesMap));
logger.info("[DELETE] " + clientRequest.getUri());
response = clientRequest.request(getMediaType()).delete();
int noContentStatusCode = Response.Status.NO_CONTENT.getStatusCode();
int okStatusCode = Response.Status.OK.getStatusCode();
assertTrue("Wrong status code returned: " + response.getStatus(), response.getStatus() == noContentStatusCode || response.getStatus() == okStatusCode);
} finally {
if (response != null) {
response.close();
}
}
}
Aggregations