use of org.apache.http.client.methods.HttpDelete in project Activiti by Activiti.
the class TaskResourceTest method testDeleteTaskInProcess.
/**
* Test updating a task that is part of a process.
* PUT runtime/tasks/{taskId}
*/
@Deployment
public void testDeleteTaskInProcess() throws Exception {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
assertNotNull(task);
HttpDelete httpDelete = new HttpDelete(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK, task.getId()));
closeResponse(executeRequest(httpDelete, HttpStatus.SC_FORBIDDEN));
}
use of org.apache.http.client.methods.HttpDelete in project azure-tools-for-java by Microsoft.
the class SparkBatchSubmission method killBatchJob.
/**
* kill batch job
* @param connectUrl : eg http://localhost:8998/batches
* @param batchId : batch Id
* @return response result
* @throws IOException
*/
public HttpResponse killBatchJob(String connectUrl, int batchId) throws IOException {
CloseableHttpClient httpclient = HttpClients.custom().setDefaultCredentialsProvider(credentialsProvider).build();
HttpDelete httpDelete = new HttpDelete(connectUrl + "/" + batchId);
httpDelete.addHeader("User-Agent", userAgentName);
httpDelete.addHeader("Content-Type", "application/json");
try (CloseableHttpResponse response = httpclient.execute(httpDelete)) {
return StreamUtil.getResultFromHttpResponse(response);
}
}
use of org.apache.http.client.methods.HttpDelete in project azure-tools-for-java by Microsoft.
the class SparkInteractiveSessions method killSession.
/**
* kill session
*
* @param connectUrl : eg http://localhost:8998/sessions
* @param sessionId : session id
* @return response result
* @throws IOException
*/
public HttpResponse killSession(String connectUrl, int sessionId) throws IOException {
CloseableHttpClient httpclient = HttpClients.custom().setDefaultCredentialsProvider(credentialsProvider).build();
HttpDelete httpDelete = new HttpDelete(connectUrl + "/" + sessionId);
httpDelete.addHeader("Content-Type", "application/json");
try (CloseableHttpResponse response = httpclient.execute(httpDelete)) {
return StreamUtil.getResultFromHttpResponse(response);
}
}
use of org.apache.http.client.methods.HttpDelete in project camel by apache.
the class CxfRsRouterTest method testPostConsumer.
@Test
public void testPostConsumer() throws Exception {
HttpPost post = new HttpPost("http://localhost:" + getPort() + "/CxfRsRouterTest/route/customerservice/customers");
post.addHeader("Accept", "text/xml");
StringEntity entity = new StringEntity(POST_REQUEST, "ISO-8859-1");
entity.setContentType("text/xml; charset=ISO-8859-1");
post.setEntity(entity);
CloseableHttpClient httpclient = HttpClientBuilder.create().build();
try {
HttpResponse response = httpclient.execute(post);
assertEquals(200, response.getStatusLine().getStatusCode());
assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Customer><id>124</id><name>Jack</name></Customer>", EntityUtils.toString(response.getEntity()));
HttpDelete del = new HttpDelete("http://localhost:" + getPort() + "/CxfRsRouterTest/route/customerservice/customers/124/");
response = httpclient.execute(del);
// need to check the response of delete method
assertEquals(200, response.getStatusLine().getStatusCode());
} finally {
httpclient.close();
}
}
use of org.apache.http.client.methods.HttpDelete in project robolectric by robolectric.
the class ParamsParserTest method parseParams_returnsNullForUnsupportedOperations.
@Test
public void parseParams_returnsNullForUnsupportedOperations() throws Exception {
HttpDelete httpDelete = new HttpDelete("http://example.com/deleteme");
assertThat(ParamsParser.parseParams(httpDelete)).isEmpty();
}
Aggregations