public RepositoryRouteResource getRoute(String routeId) throws IOException { Response response = null; try { response = getRouteResponse(routeId); assertThat(response, isSuccessful()); return this.getResourceFromText(response.getEntity().getText()); } finally { RequestFacade.releaseResponse(response); } }
@Test public void testPathPrefixPath() throws IOException { // note the ending slash! We query the repo root, and slash is there to // avoid redirect Response response = null; try { final String servicePath = "content/simply/simple/"; response = RequestFacade.sendMessage(servicePath, Method.GET); Assert.assertEquals( response.getStatus().getCode(), 200, "Repository should be accessible over " + servicePath); } finally { RequestFacade.releaseResponse(response); } }
protected Status sendMessage(final boolean authenticated, final URL url, Method method) throws IOException { Response response = null; final boolean wasSecureTest = TestContainer.getInstance().getTestContext().isSecureTest(); try { TestContainer.getInstance().getTestContext().setSecureTest(authenticated); response = RequestFacade.sendMessage(url, method, null); return response.getStatus(); } finally { if (response != null) { RequestFacade.releaseResponse(response); } TestContainer.getInstance().getTestContext().setSecureTest(wasSecureTest); } }