use of com.sun.jersey.api.client.config.DefaultClientConfig in project hadoop by apache.
the class TestTimelineReaderWebServicesHBaseStorage method createClient.
private static Client createClient() {
ClientConfig cfg = new DefaultClientConfig();
cfg.getClasses().add(YarnJacksonJaxbJsonProvider.class);
return new Client(new URLConnectionClientHandler(new DummyURLConnectionFactory()), cfg);
}
use of com.sun.jersey.api.client.config.DefaultClientConfig in project hadoop by apache.
the class TestTimelineReaderWebServices method createClient.
private static Client createClient() {
ClientConfig cfg = new DefaultClientConfig();
cfg.getClasses().add(YarnJacksonJaxbJsonProvider.class);
return new Client(new URLConnectionClientHandler(new DummyURLConnectionFactory()), cfg);
}
use of com.sun.jersey.api.client.config.DefaultClientConfig in project hadoop by apache.
the class TestRMHA method checkActiveRMWebServices.
// Do some sanity testing of the web-services after fail-over.
private void checkActiveRMWebServices() throws JSONException {
// Validate web-service
Client webServiceClient = Client.create(new DefaultClientConfig());
InetSocketAddress rmWebappAddr = NetUtils.getConnectAddress(rm.getWebapp().getListenerAddress());
String webappURL = "http://" + rmWebappAddr.getHostName() + ":" + rmWebappAddr.getPort();
WebResource webResource = webServiceClient.resource(webappURL);
String path = app.getApplicationId().toString();
ClientResponse response = webResource.path("ws").path("v1").path("cluster").path("apps").path(path).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
assertEquals(MediaType.APPLICATION_JSON_TYPE + "; " + JettyUtils.UTF_8, response.getType().toString());
JSONObject json = response.getEntity(JSONObject.class);
assertEquals("incorrect number of elements", 1, json.length());
JSONObject appJson = json.getJSONObject("app");
assertEquals("ACCEPTED", appJson.getString("state"));
// Other stuff is verified in the regular web-services related tests
}
use of com.sun.jersey.api.client.config.DefaultClientConfig in project nhin-d by DirectProject.
the class TestUtils method getResource.
public static WebResource getResource(String serviceURL) {
final ClientConfig config = new DefaultClientConfig();
config.getSingletons().add(new TxJSONProvider());
// need to set timeouts so we don't block forever in the event of a bad URL or hung web server
config.getProperties().put(ClientConfig.PROPERTY_CONNECT_TIMEOUT, CONNECTION_TIMEOUT);
config.getProperties().put(ClientConfig.PROPERTY_READ_TIMEOUT, READ_TIMEOUT);
final Client client = Client.create(config);
WebResource resource = client.resource(serviceURL);
return resource;
}
use of com.sun.jersey.api.client.config.DefaultClientConfig in project ORCID-Source by ORCID.
the class CrossRefManagerImpl method createClient.
private Client createClient() {
Set<Class<?>> providers = new HashSet<Class<?>>();
providers.add(JacksonJsonProvider.class);
ClientConfig config = new DefaultClientConfig(providers);
config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
Client client = ApacheHttpClient4.create(config);
client.setFollowRedirects(true);
client.addFilter(new ContentTypeFromTextToJsonClientFilter());
return client;
}
Aggregations