use of com.netflix.discovery.shared.Application in project eureka by Netflix.
the class BackUpRegistryTest method testRemoteEnabledAndQueried.
@Test
public void testRemoteEnabledAndQueried() throws Exception {
setUp(true);
Applications applications = client.getApplicationsForARegion(REMOTE_REGION);
List<Application> registeredApplications = applications.getRegisteredApplications();
Assert.assertNotNull("Remote region apps not found.", registeredApplications);
Assert.assertEquals("Remote apps size not as expected.", 1, registeredApplications.size());
Assert.assertEquals("Remote region apps not present.", REMOTE_REGION_APP_NAME, registeredApplications.get(0).getName());
}
use of com.netflix.discovery.shared.Application in project eureka by Netflix.
the class EurekaCodecCompatibilityTest method testApplicationEncodeDecode.
@Test
public void testApplicationEncodeDecode() throws Exception {
final Application application = new Application("testApp");
application.addInstance(infoIterator.next());
application.addInstance(infoIterator.next());
Action2 codingAction = new Action2() {
@Override
public void call(EncoderWrapper encodingCodec, DecoderWrapper decodingCodec) throws IOException {
String encodedString = encodingCodec.encode(application);
Application decodedValue = decodingCodec.decode(encodedString, Application.class);
assertThat(EurekaEntityComparators.equal(application, decodedValue), is(true));
}
};
verifyAllPairs(codingAction, Application.class, availableJsonWrappers);
verifyAllPairs(codingAction, Application.class, availableXmlWrappers);
}
use of com.netflix.discovery.shared.Application in project eureka by Netflix.
the class EurekaJacksonCodecTest method testApplicationJacksonEncodeXStreamDecode.
@Test
public void testApplicationJacksonEncodeXStreamDecode() throws Exception {
// Encode
ByteArrayOutputStream captureStream = new ByteArrayOutputStream();
codec.writeTo(APPLICATION_1, captureStream);
byte[] encoded = captureStream.toByteArray();
// Decode
InputStream source = new ByteArrayInputStream(encoded);
Application decoded = (Application) new EntityBodyConverter().read(source, Application.class, MediaType.APPLICATION_JSON_TYPE);
assertTrue(EurekaEntityComparators.equal(decoded, APPLICATION_1));
}
use of com.netflix.discovery.shared.Application in project eureka by Netflix.
the class EurekaJsonAndXmlJacksonCodecTest method doApplicationEncodeDecode.
private void doApplicationEncodeDecode(AbstractEurekaJacksonCodec codec) throws Exception {
Application application = new Application("testApp");
application.addInstance(infoIterator.next());
application.addInstance(infoIterator.next());
String encodedString = codec.getObjectMapper(Application.class).writeValueAsString(application);
Application decodedValue = codec.getObjectMapper(Application.class).readValue(encodedString, Application.class);
assertThat(EurekaEntityComparators.equal(application, decodedValue), is(true));
}
use of com.netflix.discovery.shared.Application in project eureka by Netflix.
the class EurekaJacksonCodecTest method testApplicationXStreamEncodeJacksonDecode.
@Test
public void testApplicationXStreamEncodeJacksonDecode() throws Exception {
Application original = APPLICATION_1;
// Encode
ByteArrayOutputStream captureStream = new ByteArrayOutputStream();
new EntityBodyConverter().write(original, captureStream, MediaType.APPLICATION_JSON_TYPE);
byte[] encoded = captureStream.toByteArray();
// Decode
InputStream source = new ByteArrayInputStream(encoded);
Application decoded = codec.readValue(Application.class, source);
assertTrue(EurekaEntityComparators.equal(decoded, original));
}
Aggregations