public void testParseWithJAXB() throws Exception { Method method = ResourceAsyncClient.class.getMethod("getComputePoolPerformanceStatistics", URI.class); HttpRequest request = factory(ResourceAsyncClient.class).createRequest(method, new URI("/1")); assertResponseParserClassEquals(method, request, ParseXMLWithJAXB.class); Function<HttpResponse, ComputePoolPerformanceStatistics> parser = (Function<HttpResponse, ComputePoolPerformanceStatistics>) RestAnnotationProcessor.createResponseParser(parserFactory, injector, method, request); InputStream is = getClass().getResourceAsStream("/computePoolPerformanceStatistics.xml"); ComputePoolPerformanceStatistics stats = parser.apply(new HttpResponse(200, "ok", newInputStreamPayload(is))); assertLinks(stats.getLinks()); assertEquals(stats.getHourly().getCpu(), createResource("cpu", "hourly")); assertEquals(stats.getDaily().getCpu(), createResource("cpu", "daily")); assertEquals(stats.getHourly().getMemory(), createResource("memory", "hourly")); assertEquals(stats.getDaily().getMemory(), createResource("memory", "daily")); }
private HttpCommand createCommand() throws SecurityException, NoSuchMethodException { Method method = IntegrationTestAsyncClient.class.getMethod("download", String.class); return new TransformingHttpCommandImpl<String>( executorService, processor.createRequest(method, "1"), new ReturnStringIf2xx()); }