Search in sources :

Example 66 with HttpDelete

use of org.apache.http.client.methods.HttpDelete in project Activiti by Activiti.

the class DeploymentResourceTest method testDeleteDeployment.

/**
   * Test deleting a single deployment.
   * DELETE repository/deployments/{deploymentId}
   */
@org.activiti.engine.test.Deployment(resources = { "org/activiti/rest/service/api/repository/oneTaskProcess.bpmn20.xml" })
public void testDeleteDeployment() throws Exception {
    Deployment existingDeployment = repositoryService.createDeploymentQuery().singleResult();
    assertNotNull(existingDeployment);
    // Delete the deployment
    HttpDelete httpDelete = new HttpDelete(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_DEPLOYMENT, existingDeployment.getId()));
    CloseableHttpResponse response = executeRequest(httpDelete, HttpStatus.SC_NO_CONTENT);
    closeResponse(response);
    existingDeployment = repositoryService.createDeploymentQuery().singleResult();
    assertNull(existingDeployment);
}
Also used : HttpDelete(org.apache.http.client.methods.HttpDelete) CloseableHttpResponse(org.apache.http.client.methods.CloseableHttpResponse) Deployment(org.activiti.engine.repository.Deployment)

Example 67 with HttpDelete

use of org.apache.http.client.methods.HttpDelete in project Activiti by Activiti.

the class DeploymentResourceTest method testDeleteUnexistingDeployment.

/**
    * Test deleting an unexisting deployment.
    * DELETE repository/deployments/{deploymentId}
    */
public void testDeleteUnexistingDeployment() throws Exception {
    HttpDelete httpDelete = new HttpDelete(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_DEPLOYMENT, "unexisting"));
    CloseableHttpResponse response = executeRequest(httpDelete, HttpStatus.SC_NOT_FOUND);
    closeResponse(response);
}
Also used : HttpDelete(org.apache.http.client.methods.HttpDelete) CloseableHttpResponse(org.apache.http.client.methods.CloseableHttpResponse)

Example 68 with HttpDelete

use of org.apache.http.client.methods.HttpDelete in project Activiti by Activiti.

the class ProcessDefinitionIdentityLinksResourceTest method testDeleteCandidateStarterFromUnexistingProcessDefinition.

public void testDeleteCandidateStarterFromUnexistingProcessDefinition() throws Exception {
    HttpDelete httpDelete = new HttpDelete(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_PROCESS_DEFINITION_IDENTITYLINK, "unexisting", "groups", "admin"));
    CloseableHttpResponse response = executeRequest(httpDelete, HttpStatus.SC_NOT_FOUND);
    closeResponse(response);
}
Also used : HttpDelete(org.apache.http.client.methods.HttpDelete) CloseableHttpResponse(org.apache.http.client.methods.CloseableHttpResponse)

Example 69 with HttpDelete

use of org.apache.http.client.methods.HttpDelete in project Activiti by Activiti.

the class GroupMembershipResourceTest method testDeleteMemberfromUnexistingGroup.

/**
   * Test deleting member from an unexisting group.
   */
public void testDeleteMemberfromUnexistingGroup() throws Exception {
    HttpDelete httpDelete = new HttpDelete(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_GROUP_MEMBERSHIP, "unexisting", "kermit"));
    closeResponse(executeRequest(httpDelete, HttpStatus.SC_NOT_FOUND));
}
Also used : HttpDelete(org.apache.http.client.methods.HttpDelete)

Example 70 with HttpDelete

use of org.apache.http.client.methods.HttpDelete in project Activiti by Activiti.

the class GroupMembershipResourceTest method testDeleteMembershipNoMember.

/**
   * Test delete membership that is no member in the group.
   */
public void testDeleteMembershipNoMember() throws Exception {
    try {
        Group testGroup = identityService.newGroup("testgroup");
        testGroup.setName("Test group");
        testGroup.setType("Test type");
        identityService.saveGroup(testGroup);
        User testUser = identityService.newUser("testuser");
        identityService.saveUser(testUser);
        HttpDelete httpDelete = new HttpDelete(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_GROUP_MEMBERSHIP, "testgroup", "testuser"));
        closeResponse(executeRequest(httpDelete, HttpStatus.SC_NOT_FOUND));
    } finally {
        try {
            identityService.deleteGroup("testgroup");
        } catch (Throwable ignore) {
        // Ignore, since the group may not have been created in the test
        // or already deleted
        }
        try {
            identityService.deleteUser("testuser");
        } catch (Throwable ignore) {
        // Ignore, since the group may not have been created in the test
        // or already deleted
        }
    }
}
Also used : Group(org.activiti.engine.identity.Group) User(org.activiti.engine.identity.User) HttpDelete(org.apache.http.client.methods.HttpDelete)

Aggregations

HttpDelete (org.apache.http.client.methods.HttpDelete)108 HttpResponse (org.apache.http.HttpResponse)25 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)22 Test (org.junit.Test)21 HttpGet (org.apache.http.client.methods.HttpGet)16 HttpPut (org.apache.http.client.methods.HttpPut)16 HttpPost (org.apache.http.client.methods.HttpPost)15 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)14 IOException (java.io.IOException)12 Deployment (org.activiti.engine.test.Deployment)12 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)11 Task (org.activiti.engine.task.Task)9 StringEntity (org.apache.http.entity.StringEntity)9 URI (java.net.URI)7 RequestExecutor (org.apache.stanbol.commons.testing.http.RequestExecutor)7 URISyntaxException (java.net.URISyntaxException)6 Header (org.apache.http.Header)6 HttpEntity (org.apache.http.HttpEntity)6 HttpUriRequest (org.apache.http.client.methods.HttpUriRequest)6 User (org.activiti.engine.identity.User)5