AsynchronousTransformer extends BatchRefineTransformer implements
        AsyncTransformer { @Override public void transform(HttpRequestEntity entity, String requestId) throws IOException { logMessage(entity.getRequest()); if (!fActive.add(requestId)) { throw new IllegalStateException("A request with ID " + requestId + " was already in progress."); } File output = output(requestId); ImmutablePair<MimeType, Properties> pair = exporterOptions(entity); fEngine.transform( downloadInput(entity).toURI(), fetchTransform(entity), output.toURI(), pair.getRight(), new CallbackWrapper(requestId, output, pair.getLeft()) ); } AsynchronousTransformer(IAsyncTransformEngine engine); @Override void activate(CallBackHandler callBackHandler); @Override void transform(HttpRequestEntity entity, String requestId); @Override boolean isActive(String requestId);  }
@Test public void testTransform() throws Exception { File reference = findAndCopy("outputs/" + fInput + "_" + fTransform + "." + fFormat); MimeType mime = mapContentType(fFormat); Response response = doRequest(fInput, fTransform, fFormat, mime); File output = EngineTestUtils .toFile(response.getBody().asInputStream()); assertEquals(reference, output, mime); }