@Test public void testFullAppsGetGzipJsonHeaderType() throws Exception { Response response = applicationsResource.getContainers( Version.V2.name(), MediaType.APPLICATION_JSON, "gzip", // encoding EurekaAccept.full.name(), null, // uriInfo null // remote regions ); assertThat(response.getMetadata().getFirst("Content-Encoding").toString(), is("gzip")); assertThat(response.getMetadata().getFirst("Content-Type").toString(), is(MediaType.APPLICATION_JSON)); }
@Override @Before public void setUp() throws Exception { super.setUp(); InstanceInfoGenerator instanceInfos = InstanceInfoGenerator.newBuilder(20, 6).build(); testApplications = instanceInfos.toApplications(); applicationsResource = new ApplicationsResource(serverContext); for (Application application : testApplications.getRegisteredApplications()) { for (InstanceInfo instanceInfo : application.getInstances()) { registry.register(instanceInfo, false); } } }
@Test public void testFullAppsGetGzipXmlHeaderType() throws Exception { Response response = applicationsResource.getContainers( Version.V2.name(), MediaType.APPLICATION_XML, "gzip", // encoding EurekaAccept.full.name(), null, // uriInfo null // remote regions ); assertThat(response.getMetadata().getFirst("Content-Encoding").toString(), is("gzip")); assertThat(response.getMetadata().getFirst("Content-Type").toString(), is(MediaType.APPLICATION_XML)); }
@Test public void testFullAppsGetJson() throws Exception { Response response = applicationsResource.getContainers( Version.V2.name(), MediaType.APPLICATION_JSON, null, // encoding EurekaAccept.full.name(), null, // uriInfo null // remote regions ); String json = String.valueOf(response.getEntity()); DecoderWrapper decoder = CodecWrappers.getDecoder(CodecWrappers.LegacyJacksonJson.class); Applications decoded = decoder.decode(json, Applications.class); // test per app as the full apps list include the mock server that is not part of the test apps for (Application application : testApplications.getRegisteredApplications()) { Application decodedApp = decoded.getRegisteredApplications(application.getName()); assertThat(EurekaEntityComparators.equal(application, decodedApp), is(true)); } }
@Test public void testMiniAppsGet() throws Exception { Response response = applicationsResource.getContainers( Version.V2.name(), MediaType.APPLICATION_JSON,