use of com.netflix.discovery.converters.wrappers.DecoderWrapper in project eureka by Netflix.
the class ApplicationsResourceTest method testFullAppsGetJson.
@Test
public void testFullAppsGetJson() throws Exception {
Response response = applicationsResource.getContainers(Version.V2.name(), MediaType.APPLICATION_JSON, // encoding
null, EurekaAccept.full.name(), // uriInfo
null, // remote regions
null);
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));
}
}
use of com.netflix.discovery.converters.wrappers.DecoderWrapper in project eureka by Netflix.
the class ApplicationsResourceTest method testMiniAppsGet.
@Test
public void testMiniAppsGet() throws Exception {
Response response = applicationsResource.getContainers(Version.V2.name(), MediaType.APPLICATION_JSON, // encoding
null, EurekaAccept.compact.name(), // uriInfo
null, // remote regions
null);
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());
// assert false as one is mini, so should NOT equal
assertThat(EurekaEntityComparators.equal(application, decodedApp), is(false));
}
for (Application application : testApplications.getRegisteredApplications()) {
Application decodedApp = decoded.getRegisteredApplications(application.getName());
assertThat(application.getName(), is(decodedApp.getName()));
// now do mini equals
for (InstanceInfo instanceInfo : application.getInstances()) {
InstanceInfo decodedInfo = decodedApp.getByInstanceId(instanceInfo.getId());
assertThat(EurekaEntityComparators.equalMini(instanceInfo, decodedInfo), is(true));
}
}
}
use of com.netflix.discovery.converters.wrappers.DecoderWrapper in project eureka by Netflix.
the class AbstractVIPResourceTest method testFullVipGet.
@Test
public void testFullVipGet() throws Exception {
Response response = resource.getVipResponse(Version.V2.name(), vipName, MediaType.APPLICATION_JSON, EurekaAccept.full, Key.EntityType.VIP);
String json = String.valueOf(response.getEntity());
DecoderWrapper decoder = CodecWrappers.getDecoder(CodecWrappers.LegacyJacksonJson.class);
Applications decodedApps = decoder.decode(json, Applications.class);
Application decodedApp = decodedApps.getRegisteredApplications(testApplication.getName());
assertThat(EurekaEntityComparators.equal(testApplication, decodedApp), is(true));
}
Aggregations