Skip to content

Instantly share code, notes, and snippets.

@jenglert
Created March 22, 2012 17:33
Show Gist options
  • Save jenglert/2160489 to your computer and use it in GitHub Desktop.
Save jenglert/2160489 to your computer and use it in GitHub Desktop.
protected RedirectManager createRedirectManager(final boolean captureOutput) {
final String productServiceUrl = "http://localhost:7501/product_service/1.0";
final String captureDir = "./src/test/resources/json/" + getClass().getSimpleName() + "/product_service";
Sales salesClient = SalesFactory.instance(new MapConfig(new HashMap<String, Object>() {{
if (captureOutput) {
put(SalesFactory.PRODUCT_SERVICE_URI(), productServiceUrl);
put(SalesFactory.CAPTURE_DIR(), captureDir);
}
else {
put(SalesFactory.PRODUCT_SERVICE_URI(), "file:" + captureDir);
}
put("client_params", new HashMap<String, Object>() {{ put("request_timeout_ms", 120000); }});
}}));
ProductLooks productLooksClient = ProductLooksFactory.instance(new MapConfig(new HashMap<String, Object>() {{
if (captureOutput) {
put(SalesFactory.PRODUCT_SERVICE_URI(), productServiceUrl);
put(SalesFactory.CAPTURE_DIR(), captureDir);
}
else {
put(SalesFactory.PRODUCT_SERVICE_URI(), "file:" + captureDir);
}
put("client_params", new HashMap<String, Object>() {{ put("request_timeout_ms", 120000); }});
}}));
try {
return new RedirectManager(salesClient, productLooksClient);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment