@Test public void testGroupIndexTree() throws Exception { String repoId = "public"; // get the index tree Response response = RequestFacade.doGetRequest( RequestFacade.SERVICE_LOCAL + "repo_groups/" + repoId + "/index_content/"); Assert.assertEquals(200, response.getStatus().getCode()); }
@Test public void testIndexTree() throws Exception { String repoId = this.getTestRepositoryId(); // get the index tree Response response = RequestFacade.doGetRequest( RequestFacade.SERVICE_LOCAL + "repositories/" + repoId + "/index_content/"); Assert.assertEquals(200, response.getStatus().getCode()); RepositoryMessageUtil repoUtil = new RepositoryMessageUtil(this, this.getXMLXStream(), MediaType.APPLICATION_XML); RepositoryResource resource = (RepositoryResource) repoUtil.getRepository(repoId); resource.setIndexable(false); repoUtil.updateRepo(resource); // get the index tree response = RequestFacade.doGetRequest( RequestFacade.SERVICE_LOCAL + "repositories/" + repoId + "/index_content/"); Assert.assertEquals(404, response.getStatus().getCode()); }
public static RepositoryTargetResource get(String targetId) throws IOException { String responseText = RequestFacade.doGetRequest("service/local/repo_targets/" + targetId).getEntity().getText(); LOG.debug("responseText: \n" + responseText); XStreamRepresentation representation = new XStreamRepresentation( XStreamFactory.getXmlXStream(), responseText, MediaType.APPLICATION_XML); RepositoryTargetResourceResponse resourceResponse = (RepositoryTargetResourceResponse) representation.getPayload(new RepositoryTargetResourceResponse()); return resourceResponse.getData(); }
/** IMPORTANT: Make sure to release the Response in a finally block when you are done with it. */ public Response getRouteResponse(String routeId) throws IOException { Response response = RequestFacade.doGetRequest("service/local/repo_routes/" + routeId); return response; }