org.apache.http.client.methods.HttpDelete Java Examples

The following examples show how to use org.apache.http.client.methods.HttpDelete. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HttpUtil.java    From keycloak with Apache License 2.0 7 votes vote down vote up
void doDelete(String... path) throws ClientRegistrationException {
    try {
        HttpDelete request = new HttpDelete(getUrl(baseUri, path));

        addAuth(request);

        HttpResponse response = httpClient.execute(request);
        InputStream responseStream = null;
        if (response.getEntity() != null) {
            responseStream = response.getEntity().getContent();
        }

        if (response.getStatusLine().getStatusCode() != 204) {
            throw httpErrorException(response, responseStream);
        }
    } catch (IOException e) {
        throw new ClientRegistrationException("Failed to send request", e);
    }
}
 
Example #2
Source File: ApacheHttpRequestFactory.java    From aws-sdk-java-v2 with Apache License 2.0 7 votes vote down vote up
private HttpRequestBase createApacheRequest(HttpExecuteRequest request, String uri) {
    switch (request.httpRequest().method()) {
        case HEAD:
            return new HttpHead(uri);
        case GET:
            return new HttpGet(uri);
        case DELETE:
            return new HttpDelete(uri);
        case OPTIONS:
            return new HttpOptions(uri);
        case PATCH:
            return wrapEntity(request, new HttpPatch(uri));
        case POST:
            return wrapEntity(request, new HttpPost(uri));
        case PUT:
            return wrapEntity(request, new HttpPut(uri));
        default:
            throw new RuntimeException("Unknown HTTP method name: " + request.httpRequest().method());
    }
}
 
Example #3
Source File: RequestUtils.java    From RoboZombie with Apache License 2.0 6 votes vote down vote up
/**
 * <p>Retrieves the proper extension of {@link HttpRequestBase} for the given {@link InvocationContext}. 
 * This implementation is solely dependent upon the {@link RequestMethod} property in the annotated 
 * metdata of the endpoint method definition.</p>
 *
 * @param context
 * 			the {@link InvocationContext} for which a {@link HttpRequestBase} is to be generated 
 * <br><br>
 * @return the {@link HttpRequestBase} translated from the {@link InvocationContext}'s {@link RequestMethod}
 * <br><br>
 * @throws NullPointerException
 * 			if the supplied {@link InvocationContext} was {@code null} 
 * <br><br>
 * @since 1.3.0
 */
static HttpRequestBase translateRequestMethod(InvocationContext context) {
	
	RequestMethod requestMethod = Metadata.findMethod(assertNotNull(context).getRequest());
	
	switch (requestMethod) {
	
		case POST: return new HttpPost();
		case PUT: return new HttpPut();
		case PATCH: return new HttpPatch();
		case DELETE: return new HttpDelete();
		case HEAD: return new HttpHead();
		case TRACE: return new HttpTrace();
		case OPTIONS: return new HttpOptions();
		
		case GET: default: return new HttpGet();
	}
}
 
Example #4
Source File: RtNetwork.java    From docker-java-api with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void remove() throws IOException, UnexpectedResponseException {
    final UncheckedUriBuilder uri = new UncheckedUriBuilder(
        this.baseUri.toString()
    );
    final HttpDelete delete = new HttpDelete(
        uri.build()
    );
    try {
        this.client.execute(
            delete,
            new MatchStatus(delete.getURI(), HttpStatus.SC_NO_CONTENT)
        );
    } finally {
        delete.releaseConnection();
    }
}
 
Example #5
Source File: RenderDataClient.java    From render with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Deletes the specified stack or a layer of the specified stack.
 *
 * @param  stack  stack to delete.
 * @param  z      z value for layer to delete (or null to delete all layers).
 *
 * @throws IOException
 *   if the request fails for any reason.
 */
public void deleteStack(final String stack,
                        final Double z)
        throws IOException {

    final URI uri;
    if (z == null) {
        uri = getStackUri(stack);
    } else {
        uri = getUri(urls.getZUrlString(stack, z));
    }
    final String requestContext = "DELETE " + uri;
    final TextResponseHandler responseHandler = new TextResponseHandler(requestContext);

    final HttpDelete httpDelete = new HttpDelete(uri);

    LOG.info("deleteStack: submitting {}", requestContext);

    httpClient.execute(httpDelete, responseHandler);
}
 
Example #6
Source File: QueuesRestApiTest.java    From ballerina-message-broker with Apache License 2.0 6 votes vote down vote up
@Parameters({"admin-username", "admin-password"})
@Test
public void testDeleteQueue(String username, String password) throws IOException {
    String queueName = "testDeleteQueue";

    // Create a queue to delete.
    QueueCreateRequest request = new QueueCreateRequest()
            .name(queueName).durable(false).autoDelete(false);

    HttpPost httpPost = new HttpPost(apiBasePath + "/queues");
    ClientHelper.setAuthHeader(httpPost, username, password);

    String value = objectMapper.writeValueAsString(request);
    StringEntity stringEntity = new StringEntity(value, ContentType.APPLICATION_JSON);
    httpPost.setEntity(stringEntity);

    CloseableHttpResponse response = client.execute(httpPost);
    Assert.assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_CREATED);

    // Delete the queue.
    HttpDelete httpDelete = new HttpDelete(apiBasePath + QueuesApiDelegate.QUEUES_API_PATH + "/" + queueName);
    ClientHelper.setAuthHeader(httpDelete, username, password);
    response = client.execute(httpDelete);

    Assert.assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_OK);
}
 
Example #7
Source File: DefaultRestClient.java    From attic-stratos with Apache License 2.0 6 votes vote down vote up
public HttpResponse doDelete(String resourcePath) throws RestClientException {

        HttpDelete delete = new HttpDelete(resourcePath);
        setAuthHeader(delete);

        try {
            return httpClient.execute(delete);

        } catch (IOException e) {
            String errorMsg = "Error while executing DELETE statement";
            log.error(errorMsg, e);
            throw new RestClientException(errorMsg, e);
        } finally {
            delete.releaseConnection();
        }
    }
 
Example #8
Source File: GroupResourceTest.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
/**
 * Test deleting a single group.
 */
@Test
public void testDeleteGroup() throws Exception {
    try {
        Group testGroup = identityService.newGroup("testgroup");
        testGroup.setName("Test group");
        testGroup.setType("Test type");
        identityService.saveGroup(testGroup);

        closeResponse(executeRequest(new HttpDelete(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_GROUP, "testgroup")), HttpStatus.SC_NO_CONTENT));

        assertThat(identityService.createGroupQuery().groupId("testgroup").singleResult()).isNull();

    } finally {
        try {
            identityService.deleteGroup("testgroup");
        } catch (Throwable ignore) {
            // Ignore, since the group may not have been created in the test
            // or already deleted
        }
    }
}
 
Example #9
Source File: ProcessInstanceVariablesCollectionResourceTest.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
/**
 * Test deleting all process variables. DELETE runtime/process-instance/{processInstanceId}/variables
 */
@Test
@Deployment(resources = { "org/flowable/rest/service/api/runtime/ProcessInstanceVariablesCollectionResourceTest.testProcess.bpmn20.xml" })
public void testDeleteAllProcessVariables() throws Exception {

    Map<String, Object> processVariables = new HashMap<>();
    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
    assertThat(runtimeService.getVariablesLocal(processInstance.getId())).isEmpty();
}
 
Example #10
Source File: UserResourceTest.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
/**
 * Test deleting a single user.
 */
@Test
public void testDeleteUser() throws Exception {
    User savedUser = null;
    try {
        User newUser = identityService.newUser("testuser");
        newUser.setFirstName("Fred");
        newUser.setLastName("McDonald");
        newUser.setEmail("[email protected]");
        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
        assertThat(identityService.createUserQuery().userId(newUser.getId()).count()).isZero();
        savedUser = null;

    } finally {

        // Delete user after test fails
        if (savedUser != null) {
            identityService.deleteUser(savedUser.getId());
        }
    }
}
 
Example #11
Source File: TaskVariablesCollectionResourceTest.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
/**
 * Test deleting all local task variables. DELETE runtime/tasks/{taskId}/variables
 */
@CmmnDeployment(resources = { "org/flowable/cmmn/rest/service/api/repository/oneHumanTaskCase.cmmn" })
public void testDeleteAllLocalVariables() throws Exception {
    // Start process with all types of variables
    Map<String, Object> caseVariables = new HashMap<>();
    caseVariables.put("var1", "This is a CaseVariable");
    CaseInstance caseInstance = runtimeService.createCaseInstanceBuilder().caseDefinitionKey("oneHumanTaskCase").variables(caseVariables).start();

    // Set local task variables
    Task task = taskService.createTaskQuery().caseInstanceId(caseInstance.getId()).singleResult();
    Map<String, Object> taskVariables = new HashMap<>();
    taskVariables.put("var1", "This is a TaskVariable");
    taskVariables.put("var2", 123);
    taskService.setVariablesLocal(task.getId(), taskVariables);
    assertThat(taskService.getVariablesLocal(task.getId())).hasSize(2);

    HttpDelete httpDelete = new HttpDelete(
            SERVER_URL_PREFIX + CmmnRestUrls.createRelativeResourceUrl(CmmnRestUrls.URL_TASK_VARIABLES_COLLECTION, task.getId()));
    closeResponse(executeBinaryRequest(httpDelete, HttpStatus.SC_NO_CONTENT));

    // Check if local variables are gone and global remain unchanged
    assertThat(taskService.getVariablesLocal(task.getId())).isEmpty();
    assertThat(taskService.getVariables(task.getId())).hasSize(1);
}
 
Example #12
Source File: SFAPIClient.java    From sailfish-core with Apache License 2.0 5 votes vote down vote up
public XmlResponse cleanResources(Instant olderthan) throws APICallException, APIResponseException {
    String url = rootUrl + RESOURCES_CLEAN_OLDERTHAN.replace("!olderthan", olderthan.toString());
    XmlResponse xmlResponse;
    try {
        HttpDelete req = new HttpDelete(url);

        CloseableHttpResponse res = http.execute(req);
        checkHttpResponse(res);
        xmlResponse = unmarshal(XmlResponse.class, res);
        res.close();
        return xmlResponse;
    } catch (Exception e) {
        throw new APICallException(e);
    }
}
 
Example #13
Source File: SFAPIClient.java    From sailfish-core with Apache License 2.0 5 votes vote down vote up
public XmlResponse cleanResources(String... targets) throws APICallException, APIResponseException {
    String url = rootUrl + RESOURCES_CLEAN_TARGETS.replace("!targets", String.join(",", targets));
    XmlResponse xmlResponse;
    try {
        HttpDelete req = new HttpDelete(url);

        CloseableHttpResponse res = http.execute(req);
        checkHttpResponse(res);
        xmlResponse = unmarshal(XmlResponse.class, res);
        res.close();
        return xmlResponse;
    } catch (Exception e) {
        throw new APICallException(e);
    }
}
 
Example #14
Source File: RdbmsMandatoryAccessControlForExchangesTest.java    From ballerina-message-broker with Apache License 2.0 5 votes vote down vote up
@Parameters({"test-username", "test-password"})
@Test(priority = 2, description = "delete an exchange by a user who does not have exchanges:delete scope")
public void testDeleteExchangeByTestUser(String username, String password) throws Exception {

    HttpDelete httpDelete = new HttpDelete(apiBasePath + "/exchanges/" + "adminUserExchange");
    ClientHelper.setAuthHeader(httpDelete, username, password);
    CloseableHttpResponse response = client.execute(httpDelete);

    Assert.assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_FORBIDDEN);

}
 
Example #15
Source File: ActivitiRestClient.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * Method used to remove/delete a process instance
 *
 * @param processInstanceId used to identify a process instance
 * @return String value containing the status of the request.
 * @throws IOException
 */
public String deleteProcessInstanceByID(String processInstanceId) throws IOException {
    String url = serviceURL + "runtime/process-instances/"
                 + processInstanceId;
    DefaultHttpClient httpClient = getHttpClient();
    HttpDelete httpDelete = new HttpDelete(url);
    HttpResponse response = httpClient.execute(httpDelete);
    return response.getStatusLine().toString();
}
 
Example #16
Source File: SiteToSiteRestApiClient.java    From nifi with Apache License 2.0 5 votes vote down vote up
public TransactionResultEntity commitReceivingFlowFiles(final String transactionUrl, final ResponseCode clientResponse, final String checksum) throws IOException {
    logger.debug("Sending commitReceivingFlowFiles request to transactionUrl: {}, clientResponse={}, checksum={}",
        transactionUrl, clientResponse, checksum);

    stopExtendingTtl();

    final StringBuilder urlBuilder = new StringBuilder(transactionUrl).append("?responseCode=").append(clientResponse.getCode());
    if (ResponseCode.CONFIRM_TRANSACTION.equals(clientResponse)) {
        urlBuilder.append("&checksum=").append(checksum);
    }

    final HttpDelete delete = createDelete(urlBuilder.toString());
    delete.setHeader("Accept", "application/json");
    delete.setHeader(HttpHeaders.PROTOCOL_VERSION, String.valueOf(transportProtocolVersionNegotiator.getVersion()));

    setHandshakeProperties(delete);

    try (CloseableHttpResponse response = getHttpClient().execute(delete)) {
        final int responseCode = response.getStatusLine().getStatusCode();
        logger.debug("commitReceivingFlowFiles responseCode={}", responseCode);

        try (InputStream content = response.getEntity().getContent()) {
            switch (responseCode) {
                case RESPONSE_CODE_OK:
                    return readResponse(content);

                case RESPONSE_CODE_BAD_REQUEST:
                    return readResponse(content);

                default:
                    throw handleErrResponse(responseCode, content);
            }
        }
    }

}
 
Example #17
Source File: ElasticsearchClient.java    From elasticsearch-maven-plugin with Apache License 2.0 5 votes vote down vote up
public void delete(String path) throws ElasticsearchClientException
{
    String uri = String.format("http://%s:%d%s", hostname, port, path);
    log.debug(String.format("Sending DELETE request to %s", uri));

    HttpDelete request = new HttpDelete(uri);
    executeRequest(request);
}
 
Example #18
Source File: DmnDeploymentResourceTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
/**
 * Test deleting a single deployment. DELETE dmn-repository/deployments/{deploymentId}
 */
@DmnDeploymentAnnotation(resources = { "org/activiti/rest/dmn/service/api/repository/simple.dmn" })
public void testDeleteDeployment() throws Exception {
  dmnRepositoryService.createDeploymentQuery().singleResult();
  DmnDeployment existingDeployment = dmnRepositoryService.createDeploymentQuery().singleResult();
  assertNotNull(existingDeployment);

  // Delete the deployment
  HttpDelete httpDelete = new HttpDelete(SERVER_URL_PREFIX + DmnRestUrls.createRelativeResourceUrl(DmnRestUrls.URL_DEPLOYMENT, existingDeployment.getId()));
  CloseableHttpResponse response = executeRequest(httpDelete, HttpStatus.SC_NO_CONTENT);
  closeResponse(response);

  existingDeployment = dmnRepositoryService.createDeploymentQuery().singleResult();
  assertNull(existingDeployment);
}
 
Example #19
Source File: RdbmsMandatoryAccessControlForQueuesTest.java    From ballerina-message-broker with Apache License 2.0 5 votes vote down vote up
@Parameters({"admin-username", "admin-password"})
@Test(priority = 3, description = "delete a queue by a user who has queues:delete scope")
public void testDeleteQueueByAdminUser(String username, String password) throws IOException {
    String queueName = "testCreateQueueByAdminUser";

    // Delete the queue.
    HttpDelete httpDelete = new HttpDelete(apiBasePath + QueuesApiDelegate.QUEUES_API_PATH + "/" + queueName);
    ClientHelper.setAuthHeader(httpDelete, username, password);
    CloseableHttpResponse response = client.execute(httpDelete);

    Assert.assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_OK);
}
 
Example #20
Source File: ModelResourceTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void testDeleteModel() throws Exception {
  Model model = null;
  try {
    Calendar now = Calendar.getInstance();
    now.set(Calendar.MILLISECOND, 0);
    processEngineConfiguration.getClock().setCurrentTime(now.getTime());

    model = repositoryService.newModel();
    model.setCategory("Model category");
    model.setKey("Model key");
    model.setMetaInfo("Model metainfo");
    model.setName("Model name");
    model.setVersion(2);
    repositoryService.saveModel(model);

    HttpDelete httpDelete = new HttpDelete(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_MODEL, model.getId()));
    closeResponse(executeRequest(httpDelete, HttpStatus.SC_NO_CONTENT));

    // Check if the model is really gone
    assertNull(repositoryService.createModelQuery().modelId(model.getId()).singleResult());

    model = null;
  } finally {
    if (model != null) {
      try {
        repositoryService.deleteModel(model.getId());
      } catch (Throwable ignore) {
        // Ignore, model might not be created
      }
    }
  }
}
 
Example #21
Source File: HttpClientStackTest.java    From android-project-wo2b with Apache License 2.0 5 votes vote down vote up
public void testCreateDeleteRequest() throws Exception {
    TestRequest.Delete request = new TestRequest.Delete();
    assertEquals(request.getMethod(), Method.DELETE);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpDelete);
}
 
Example #22
Source File: HttpClientStackTest.java    From product-emm with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #23
Source File: BrokerRestApiClient.java    From ballerina-message-broker with Apache License 2.0 5 votes vote down vote up
public void deleteQueue(String queueName) throws IOException {
    HttpDelete httpDelete = new HttpDelete(apiBasePath + QueuesApiDelegate.QUEUES_API_PATH + "/" + queueName);
    ClientHelper.setAuthHeader(httpDelete, userName, password);
    CloseableHttpResponse response = httpClient.execute(httpDelete);

    Assert.assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_OK);
}
 
Example #24
Source File: StoregateWriteFeature.java    From cyberduck with GNU General Public License v3.0 5 votes vote down vote up
protected void cancel(final Path file, final String location) throws BackgroundException {
    log.warn(String.format("Cancel failed upload %s for %s", location, file));
    try {
        final HttpDelete delete = new HttpDelete(location);
        session.getClient().getClient().execute(delete);
    }
    catch(IOException e) {
        throw new HttpExceptionMappingService().map("Upload {0} failed", e, file);
    }
}
 
Example #25
Source File: DefaultDispatch.java    From knox with Apache License 2.0 5 votes vote down vote up
@Override
public void doDelete(URI url, HttpServletRequest request, HttpServletResponse response)
      throws IOException {
   HttpDelete method = new HttpDelete(url);
   copyRequestHeaderFields(method, request);
   executeRequest(method, request, response);
}
 
Example #26
Source File: ConnectedRESTQA.java    From java-client-api with Apache License 2.0 5 votes vote down vote up
public static void deleteElementRangeIndexTemporalAxis(String dbName, String axisName) throws Exception {
	DefaultHttpClient client = new DefaultHttpClient();
	client.getCredentialsProvider().setCredentials(new AuthScope(host_name, getAdminPort()),
			new UsernamePasswordCredentials("admin", "admin"));

	HttpDelete del = new HttpDelete("http://" + host_name + ":" + admin_port + "/manage/v2/databases/" + dbName
			+ "/temporal/axes/" + axisName + "?format=json");

	del.addHeader("Content-type", "application/json");
	del.addHeader("accept", "application/json");

	HttpResponse response = client.execute(del);
	HttpEntity respEntity = response.getEntity();
	if (response.getStatusLine().getStatusCode() == 400) {
		HttpEntity entity = response.getEntity();
		String responseString = EntityUtils.toString(entity, "UTF-8");
		System.out.println(responseString);
	} else if (respEntity != null) {
		// EntityUtils to get the response content
		String content = EntityUtils.toString(respEntity);
		System.out.println(content);
	} else {
		System.out.println("Axis: " + axisName + " deleted");
		System.out.println("==============================================================");
	}
	client.getConnectionManager().shutdown();
}
 
Example #27
Source File: HttpRequestFactoryTest.java    From confluence-publisher with Apache License 2.0 5 votes vote down vote up
@Test
public void deletePropertyByKeyRequest_withValidParameters_returnsHttpDeleteRequest() {
    // arrange
    String contentId = "1234";
    String key = "content-hash";

    // act
    HttpDelete deletePropertyByKeyRequest = this.httpRequestFactory.deletePropertyByKeyRequest(contentId, key);

    // assert
    assertThat(deletePropertyByKeyRequest.getURI().toString(), is(CONFLUENCE_REST_API_ENDPOINT + "/content/" + contentId + "/property/" + key));
}
 
Example #28
Source File: RenderDataClient.java    From render with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Deletes specified tile.
 *
 * @param  stack   stack containing tile to delete.
 * @param  tileId  id of tile to delete.
 *
 * @throws IOException
 *   if the request fails for any reason.
 */
public void deleteStackTile(final String stack,
                            final String tileId)
        throws IOException {

    final URI uri = getUri(urls.getTileUrlString(stack, tileId));
    final String requestContext = "DELETE " + uri;
    final TextResponseHandler responseHandler = new TextResponseHandler(requestContext);

    final HttpDelete httpDelete = new HttpDelete(uri);

    LOG.info("deleteStackTile: submitting {}", requestContext);

    httpClient.execute(httpDelete, responseHandler);
}
 
Example #29
Source File: DeleteHandler.java    From restfiddle with Apache License 2.0 5 votes vote down vote up
public RfResponseDTO process(RfRequestDTO rfRequestDTO) throws IOException {
RfResponseDTO response = null;
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpDelete httpDelete = new HttpDelete(rfRequestDTO.getEvaluatedApiUrl());
httpDelete.addHeader("Content-Type", "application/json");
try {
    response = processHttpRequest(httpDelete, httpclient);
} finally {
    httpclient.close();
}
return response;
   }
 
Example #30
Source File: HttpAnnotationsEndToEndTest.java    From blueflood with Apache License 2.0 5 votes vote down vote up
@AfterClass
public static void tearDownClass() throws Exception{
    Configuration.getInstance().setProperty(CoreConfig.EVENTS_MODULES.name(), "");
    System.clearProperty(CoreConfig.EVENTS_MODULES.name());

    URIBuilder builder = new URIBuilder().setScheme("http").setHost("127.0.0.1").setPort(9200).setPath("/events");
    HttpDelete delete = new HttpDelete(builder.build());
    HttpResponse response = client.execute(delete);
    if(response.getStatusLine().getStatusCode() != 200)
    {
        System.out.println("Couldn't delete 'events' index after running tests.");
    }
    else {
        System.out.println("Successfully deleted 'events' index after running tests.");
    }

    if (vendor != null) {
        vendor.shutdown();
    }

    if (httpIngestionService != null) {
        httpIngestionService.shutdownService();
    }

    if (httpQueryService != null) {
        httpQueryService.stopService();
    }
}