use of org.apache.http.client.methods.HttpDelete in project opennms by OpenNMS.
the class GraphMLTopologyIT method deleteGraph.
private void deleteGraph() throws IOException, InterruptedException {
try (HttpClientWrapper client = createClientWrapper()) {
HttpDelete httpDelete = new HttpDelete(URL);
CloseableHttpResponse response = client.execute(httpDelete);
assertEquals(200, response.getStatusLine().getStatusCode());
}
// We wait to give the GraphMLMetaTopologyFactory the chance to clean up afterwards
Thread.sleep(20000);
}
use of org.apache.http.client.methods.HttpDelete in project TaEmCasa by Dionen.
the class HttpClientStackTest method createDeleteRequest.
@Test
public void createDeleteRequest() throws Exception {
TestRequest.Delete request = new TestRequest.Delete();
assertEquals(request.getMethod(), Method.DELETE);
HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
assertTrue(httpRequest instanceof HttpDelete);
}
use of org.apache.http.client.methods.HttpDelete in project nhin-d by DirectProject.
the class AbstractDeleteRequest method createRequest.
/**
* {@inheritDoc}
*/
@Override
protected final HttpUriRequest createRequest() throws IOException {
try {
HttpDelete delete = new HttpDelete(getRequestUri());
delete.setHeader("Accept", MediaType.APPLICATION_JSON);
return delete;
} catch (ServiceException e) {
throw new IOException("Error creating request URI.", e);
}
}
use of org.apache.http.client.methods.HttpDelete in project Activiti by Activiti.
the class TaskAttachmentResourceTest method testDeleteAttachment.
/**
* Test deleting a single attachments for a task
* DELETE runtime/tasks/{taskId}/attachments/{attachmentId}
*/
public void testDeleteAttachment() throws Exception {
try {
Task task = taskService.newTask();
taskService.saveTask(task);
// Create URL-attachment
Attachment urlAttachment = taskService.createAttachment("simpleType", task.getId(), null, "Simple attachment", "Simple attachment description", "http://activiti.org");
taskService.saveAttachment(urlAttachment);
// Delete the attachment
HttpDelete httpDelete = new HttpDelete(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_ATTACHMENT, task.getId(), urlAttachment.getId()));
closeResponse(executeBinaryRequest(httpDelete, HttpStatus.SC_NO_CONTENT));
// Check if attachment is really deleted
assertNull(taskService.getAttachment(urlAttachment.getId()));
// Deleting again should result in 404
closeResponse(executeBinaryRequest(httpDelete, HttpStatus.SC_NOT_FOUND));
} finally {
// Clean adhoc-tasks even if test fails
List<Task> tasks = taskService.createTaskQuery().list();
for (Task task : tasks) {
taskService.deleteTask(task.getId(), true);
}
}
}
use of org.apache.http.client.methods.HttpDelete in project Activiti by Activiti.
the class ProcessInstanceVariablesCollectionResourceTest method testDeleteAllProcessVariables.
/**
* Test deleting all process variables.
* DELETE runtime/process-instance/{processInstanceId}/variables
*/
@Deployment(resources = { "org/activiti/rest/service/api/runtime/ProcessInstanceVariablesCollectionResourceTest.testProcess.bpmn20.xml" })
public void testDeleteAllProcessVariables() throws Exception {
Map<String, Object> processVariables = new HashMap<String, Object>();
processVariables.put("var1", "This is a ProcVariable");
processVariables.put("var2", 123);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess", processVariables);
HttpDelete httpDelete = new HttpDelete(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_PROCESS_INSTANCE_VARIABLE_COLLECTION, processInstance.getId()));
closeResponse(executeRequest(httpDelete, HttpStatus.SC_NO_CONTENT));
// Check if local variables are gone and global remain unchanged
assertEquals(0, runtimeService.getVariablesLocal(processInstance.getId()).size());
}
Aggregations