use of org.apache.http.client.methods.HttpDelete in project openkit-android by OpenKit.
the class AsyncHttpClient method delete.
/**
* Perform a HTTP DELETE request.
* @param context the Android Context which initiated the request.
* @param url the URL to send the request to.
* @param responseHandler the response handler instance that should handle the response.
*/
public void delete(Context context, String url, AsyncHttpResponseHandler responseHandler) {
final HttpDelete delete = new HttpDelete(url);
sendRequest(httpClient, httpContext, delete, null, responseHandler, context);
}
use of org.apache.http.client.methods.HttpDelete in project Activiti by Activiti.
the class HistoricProcessInstanceCommentResourceTest method testDeleteComment.
/**
* Test deleting a comment for a task.
* DELETE runtime/tasks/{taskId}/comments/{commentId}
*/
@Deployment(resources = { "org/activiti/rest/service/api/repository/oneTaskProcess.bpmn20.xml" })
public void testDeleteComment() throws Exception {
ProcessInstance pi = null;
try {
pi = runtimeService.startProcessInstanceByKey("oneTaskProcess");
// Add a comment as "kermit"
identityService.setAuthenticatedUserId("kermit");
Comment comment = taskService.addComment(null, pi.getId(), "This is a comment...");
identityService.setAuthenticatedUserId(null);
closeResponse(executeRequest(new HttpDelete(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_HISTORIC_PROCESS_INSTANCE_COMMENT, pi.getId(), comment.getId())), HttpStatus.SC_NO_CONTENT));
// Test with unexisting instance
closeResponse(executeRequest(new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_HISTORIC_PROCESS_INSTANCE_COMMENT, "unexistinginstance", "123")), HttpStatus.SC_NOT_FOUND));
// Test with unexisting comment
closeResponse(executeRequest(new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_HISTORIC_PROCESS_INSTANCE_COMMENT, pi.getId(), "unexistingcomment")), HttpStatus.SC_NOT_FOUND));
} finally {
if (pi != null) {
List<Comment> comments = taskService.getProcessInstanceComments(pi.getId());
for (Comment c : comments) {
taskService.deleteComment(c.getId());
}
}
}
}
use of org.apache.http.client.methods.HttpDelete in project Activiti by Activiti.
the class UserResourceTest method testDeleteUser.
/**
* Test deleting a single user.
*/
public void testDeleteUser() throws Exception {
User savedUser = null;
try {
User newUser = identityService.newUser("testuser");
newUser.setFirstName("Fred");
newUser.setLastName("McDonald");
newUser.setEmail("no-reply@activiti.org");
identityService.saveUser(newUser);
savedUser = newUser;
closeResponse(executeRequest(new HttpDelete(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_USER, newUser.getId())), HttpStatus.SC_NO_CONTENT));
// Check if user is deleted
assertEquals(0, identityService.createUserQuery().userId(newUser.getId()).count());
savedUser = null;
} finally {
// Delete user after test fails
if (savedUser != null) {
identityService.deleteUser(savedUser.getId());
}
}
}
use of org.apache.http.client.methods.HttpDelete in project Activiti by Activiti.
the class JobResourceTest method testDeleteUnexistingJob.
/**
* Test getting an unexisting job.
*/
public void testDeleteUnexistingJob() throws Exception {
HttpDelete httpDelete = new HttpDelete(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_JOB, "unexistingjob"));
CloseableHttpResponse response = executeRequest(httpDelete, HttpStatus.SC_NOT_FOUND);
closeResponse(response);
}
use of org.apache.http.client.methods.HttpDelete in project Activiti by Activiti.
the class ModelResourceTest method testDeleteUnexistingModel.
public void testDeleteUnexistingModel() throws Exception {
HttpDelete httpDelete = new HttpDelete(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_MODEL, "unexisting"));
closeResponse(executeRequest(httpDelete, HttpStatus.SC_NOT_FOUND));
}
Aggregations