@Test(expected = ProcessingException.class) public void testEnableProjectsInvalidUrl() { IndexerUtil.enableProjects("http: }
public static void enableProjects(final String host) throws ResponseProcessingException, ProcessingException, WebApplicationException { final Invocation.Builder request = ClientBuilder.newClient() .target(host) .path("api") .path("v1") .path("configuration") .path("projectsEnabled") .request(); final String enabled = request.get(String.class); if (enabled == null || !Boolean.valueOf(enabled)) { final Response r = request.put(Entity.text(Boolean.TRUE.toString())); if (r.getStatusInfo().getFamily() != Response.Status.Family.SUCCESSFUL) { throw new WebApplicationException(String.format("Unable to enable projects: %s", r.getStatusInfo().getReasonPhrase()), r.getStatus()); } } }
IndexerUtil { public static void enableProjects(final String host) throws ResponseProcessingException, ProcessingException, WebApplicationException { final Invocation.Builder request = ClientBuilder.newClient() .target(host) .path("api") .path("v1") .path("configuration") .path("projectsEnabled") .request(); final String enabled = request.get(String.class); if (enabled == null || !Boolean.valueOf(enabled)) { final Response r = request.put(Entity.text(Boolean.TRUE.toString())); if (r.getStatusInfo().getFamily() != Response.Status.Family.SUCCESSFUL) { throw new WebApplicationException(String.format("Unable to enable projects: %s", r.getStatusInfo().getReasonPhrase()), r.getStatus()); } } } }
IndexerUtil { public static void enableProjects(final String host) throws ResponseProcessingException, ProcessingException, WebApplicationException { final Invocation.Builder request = ClientBuilder.newClient() .target(host) .path("api") .path("v1") .path("configuration") .path("projectsEnabled") .request(); final String enabled = request.get(String.class); if (enabled == null || !Boolean.valueOf(enabled)) { final Response r = request.put(Entity.text(Boolean.TRUE.toString())); if (r.getStatusInfo().getFamily() != Response.Status.Family.SUCCESSFUL) { throw new WebApplicationException(String.format("Unable to enable projects: %s", r.getStatusInfo().getReasonPhrase()), r.getStatus()); } } } private  IndexerUtil(); }
IndexerUtil { public static void enableProjects(final String host) throws ResponseProcessingException, ProcessingException, WebApplicationException { final Invocation.Builder request = ClientBuilder.newClient() .target(host) .path("api") .path("v1") .path("configuration") .path("projectsEnabled") .request(); final String enabled = request.get(String.class); if (enabled == null || !Boolean.valueOf(enabled)) { final Response r = request.put(Entity.text(Boolean.TRUE.toString())); if (r.getStatusInfo().getFamily() != Response.Status.Family.SUCCESSFUL) { throw new WebApplicationException(String.format("Unable to enable projects: %s", r.getStatusInfo().getReasonPhrase()), r.getStatus()); } } } private  IndexerUtil(); static void enableProjects(final String host); }
IndexerUtil { public static void enableProjects(final String host) throws ResponseProcessingException, ProcessingException, WebApplicationException { final Invocation.Builder request = ClientBuilder.newClient() .target(host) .path("api") .path("v1") .path("configuration") .path("projectsEnabled") .request(); final String enabled = request.get(String.class); if (enabled == null || !Boolean.valueOf(enabled)) { final Response r = request.put(Entity.text(Boolean.TRUE.toString())); if (r.getStatusInfo().getFamily() != Response.Status.Family.SUCCESSFUL) { throw new WebApplicationException(String.format("Unable to enable projects: %s", r.getStatusInfo().getReasonPhrase()), r.getStatus()); } } } private  IndexerUtil(); static void enableProjects(final String host);  }