protected void delete(Object[] queryParams, String url, Object... uriVariables) { URI uri = null; try { uri = getURIBuilder(root + url, queryParams).build(uriVariables); client.resource(uri).delete(); } catch (UniformInterfaceException e) { handleUniformInterfaceException(e, uri); } catch (RuntimeException e) { handleRuntimeException(e, uri); } }
@Test public void shouldBeAbleToIndexValuesContainingSpaces() throws Exception { final long nodeId = helper.createNode(); final String key = "key"; final String value = "value with spaces in it"; String indexName = indexes.newInstance(); helper.createNodeIndex( indexName ); final RestRequest request = RestRequest.req(); JaxRsResponse response = request.post( functionalTestHelper.indexNodeUri( indexName ), createJsonStringFor( nodeId, key, value ) ); assertEquals( Status.CREATED.getStatusCode(), response.getStatus() ); URI location = response.getLocation(); response.close(); response = request.get( functionalTestHelper.indexNodeUri( indexName, key, URIHelper.encode( value ) ) ); assertEquals( Status.OK.getStatusCode(), response.getStatus() ); Collection<?> hits = (Collection<?>) JsonHelper.readJson( response.getEntity() ); assertEquals( 1, hits.size() ); response.close(); CLIENT.resource( location ) .delete(); response = request.get( functionalTestHelper.indexNodeUri( indexName, key, URIHelper.encode( value ) ) ); hits = (Collection<?>) JsonHelper.readJson( response.getEntity() ); assertEquals( 0, hits.size() ); }
@Test public void shouldBeAbleToIndexValuesContainingSpaces() throws Exception { final long startNodeId = helper.createNode(); final long endNodeId = helper.createNode(); final String relationshiptype = "tested-together"; final long relationshipId = helper.createRelationship( relationshiptype, startNodeId, endNodeId ); final String key = "key"; final String value = "value with spaces in it"; final String indexName = indexes.newInstance(); helper.createRelationshipIndex( indexName ); JaxRsResponse response = httpPostIndexRelationshipNameKeyValue( indexName, relationshipId, key, value ); assertEquals( Status.CREATED.getStatusCode(), response.getStatus() ); URI location = response.getLocation(); response.close(); response = httpGetIndexRelationshipNameKeyValue( indexName, key, URIHelper.encode( value ) ); assertEquals( Status.OK.getStatusCode(), response.getStatus() ); String responseEntity = response.getEntity(); Collection<?> hits = (Collection<?>) JsonHelper.readJson( responseEntity ); assertEquals( 1, hits.size() ); response.close(); CLIENT.resource( location ).delete(); response = httpGetIndexRelationshipNameKeyValue( indexName, key, URIHelper.encode( value ) ); assertEquals( 200, response.getStatus() ); responseEntity = response.getEntity(); hits = (Collection<?>) JsonHelper.readJson( responseEntity ); assertEquals( 0, hits.size() ); response.close(); }
public ClientResponse graylogRESTDelete(String resource) { WebResource webResource = client.resource(resource); return webResource.delete(ClientResponse.class); }
public void deleteTest(long id) { try { WebResource webResource = client.resource(serviceURL + String.format(TEST_BY_ID_PATH, id)); webResource.delete(ClientResponse.class); } catch (Exception e) { LOGGER.error("Unable to finish test", e); } }
public void deleteTest(long id) { try { WebResource webResource = client.resource(serviceURL + String.format(TEST_BY_ID_PATH, id)); webResource.delete(ClientResponse.class); } catch (Exception e) { LOGGER.error("Unable to finish test", e); } }
@Override public Void call() throws Exception { final WebResource webResource = client.resource(uri); webResource.delete(); return null; } });
public void deleteLevel(AdminLevel level) { URI uri = UriBuilder.fromUri(root) .path("adminLevel") .path(Integer.toString(level.getId())) .build(); client.resource(uri) .delete(); }
@Override public Void call() throws Exception { final WebResource votesResource = client.resource(votesUri); votesResource.delete(); return null; } });
@Override public Void call() throws Exception { final WebResource webResource = client.resource(uri); webResource.delete(); return null; } });
@Override public Void call() throws Exception { final WebResource votesResource = client.resource(votesUri); votesResource.delete(); return null; } });
protected void delete(Object[] queryParams, String url, Object... uriVariables) { URI uri = null; try { uri = getURIBuilder(root + url, queryParams).build(uriVariables); client.resource(uri).delete(); } catch (UniformInterfaceException e) { handleUniformInterfaceException(e, uri); } catch (RuntimeException e) { handleRuntimeException(e, uri); } }
@Override public Void execute(final CommandContext commandContext) { commandContext.getImJaxrsUrlHelper().emailTemplate(tenantId.getId(), type).delete(); return null; }
@Override public Void execute(CommandContext commandContext) { commandContext.getImJaxrsUrlHelper().tenantSettings(tenantId.getId(), type).delete(); return null; }
protected void invalidateIdentityContext(final IdentityContextId identityContextId) { RestExecutor.execute(() -> { imJaxrsUrlHelper.authentication(identityContextId.getId()).delete(); return null; }); }
@Override public void forceDelete(GenericId id) throws IOException { String pathFragment = IdUtil.getURLPathFragment(id); for (WebResource wr: this.repositoryResources) { ClientResponse response = wr.path(pathFragment).delete(ClientResponse.class); if ((response.getClientResponseStatus() != ClientResponse.Status.NO_CONTENT) || (response.getClientResponseStatus() != ClientResponse.Status.NOT_FOUND)) { LOGGER.debug(String.format("Error %d when deleting id %s from URI %s", response.getStatus(), id.toString(), wr.getURI().toString())); } } }
@Override public Void execute(final CommandContext commandContext) { commandContext.getImJaxrsUrlHelper().userAttribute(user.getId().getId(), key).delete(); return null; }
/** {@inheritDoc} */ public void deleteProperty(String name) { Util.assertHasLength(name); ClientResponse cRes = getStore().path(name).delete(ClientResponse.class); if (Status.NOT_FOUND.getStatusCode() == cRes.getStatus()) { throw new PropertyNotFoundException(name); } if (Status.NO_CONTENT.getStatusCode() != cRes.getStatus()) { throw new PropertyAccessException("Cannot delete property, an HTTP error " + cRes.getStatus() + OCCURED); } }
@Override public Void execute(final CommandContext commandContext) { commandContext.getImJaxrsUrlHelper().resource(entityToDelete).path(entityToDelete.getId().getId()).delete(); return null; }
@Override public Void execute(final CommandContext commandContext) { commandContext.getImJaxrsUrlHelper().resource(entityRelation) // .path(entityRelation.leftEntity().getId().getId()) // .path(entityRelation.rightEntity().getId().getId()) // .delete(); return null; }