use of com.netflix.discovery.shared.Application in project eureka by Netflix.
the class BackUpRegistryTest method setupBackupMock.
private void setupBackupMock() {
Application localApp = createLocalApps();
Applications localApps = new Applications();
localApps.addApplication(localApp);
backupRegistry.setLocalRegionApps(localApps);
Application remoteApp = createRemoteApps();
Applications remoteApps = new Applications();
remoteApps.addApplication(remoteApp);
backupRegistry.getRemoteRegionVsApps().put(REMOTE_REGION, remoteApps);
}
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 BaseDiscoveryClientTester method createRemoteAppsDelta.
protected static List<Application> createRemoteAppsDelta() {
Application myapp1 = new Application(REMOTE_REGION_APP1_NAME);
InstanceInfo instanceInfo1 = createInstance(REMOTE_REGION_APP1_NAME, ALL_REGIONS_VIP1_ADDR, REMOTE_REGION_APP1_INSTANCE2_HOSTNAME, REMOTE_ZONE);
instanceInfo1.setActionType(InstanceInfo.ActionType.ADDED);
myapp1.addInstance(instanceInfo1);
Application myapp2 = new Application(REMOTE_REGION_APP2_NAME);
InstanceInfo instanceInfo2 = createInstance(REMOTE_REGION_APP2_NAME, ALL_REGIONS_VIP2_ADDR, REMOTE_REGION_APP2_INSTANCE2_HOSTNAME, REMOTE_ZONE);
instanceInfo2.setActionType(InstanceInfo.ActionType.ADDED);
myapp2.addInstance(instanceInfo2);
return Arrays.asList(myapp1, myapp2);
}
use of com.netflix.discovery.shared.Application in project eureka by Netflix.
the class AbstractJerseyEurekaHttpClient method getApplication.
@Override
public EurekaHttpResponse<Application> getApplication(String appName) {
String urlPath = "apps/" + appName;
ClientResponse response = null;
try {
Builder requestBuilder = jerseyClient.resource(serviceUrl).path(urlPath).getRequestBuilder();
addExtraHeaders(requestBuilder);
response = requestBuilder.accept(MediaType.APPLICATION_JSON_TYPE).get(ClientResponse.class);
Application application = null;
if (response.getStatus() == Status.OK.getStatusCode() && response.hasEntity()) {
application = response.getEntity(Application.class);
}
return anEurekaHttpResponse(response.getStatus(), Application.class).headers(headersOf(response)).entity(application).build();
} finally {
if (logger.isDebugEnabled()) {
logger.debug("Jersey HTTP GET {}/{}; statusCode={}", serviceUrl, urlPath, response == null ? "N/A" : response.getStatus());
}
if (response != null) {
response.close();
}
}
}
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);
}
Aggregations