Search in sources :

Example 6 with Application

use of com.netflix.discovery.shared.Application in project eureka by Netflix.

the class EurekaEntityFunctions method deepCopyApplication.

public static Application deepCopyApplication(Application source) {
    Application result = new Application(source.getName());
    deepCopyApplication(source, result, EurekaEntityTransformers.<InstanceInfo>identity());
    return result;
}
Also used : Application(com.netflix.discovery.shared.Application)

Example 7 with Application

use of com.netflix.discovery.shared.Application in project eureka by Netflix.

the class EurekaEntityFunctions method toApplications.

public static Applications toApplications(List<InstanceInfo> instances) {
    Applications result = new Applications();
    for (InstanceInfo instance : instances) {
        Application app = result.getRegisteredApplications(instance.getAppName());
        if (app == null) {
            app = new Application(instance.getAppName());
            result.addApplication(app);
        }
        app.addInstance(instance);
    }
    return updateMeta(result);
}
Also used : Applications(com.netflix.discovery.shared.Applications) InstanceInfo(com.netflix.appinfo.InstanceInfo) Application(com.netflix.discovery.shared.Application)

Example 8 with Application

use of com.netflix.discovery.shared.Application in project eureka by Netflix.

the class BackUpRegistryTest method createLocalApps.

private Application createLocalApps() {
    Application myapp = new Application(LOCAL_REGION_APP_NAME);
    InstanceInfo instanceInfo = createLocalInstance(LOCAL_REGION_INSTANCE_1_HOSTNAME);
    myapp.addInstance(instanceInfo);
    return myapp;
}
Also used : Application(com.netflix.discovery.shared.Application) InstanceInfo(com.netflix.appinfo.InstanceInfo)

Example 9 with Application

use of com.netflix.discovery.shared.Application in project eureka by Netflix.

the class BackUpRegistryTest method testLocalOnly.

@Test
public void testLocalOnly() throws Exception {
    setUp(false);
    Applications applications = client.getApplications();
    List<Application> registeredApplications = applications.getRegisteredApplications();
    System.out.println("***" + registeredApplications);
    Assert.assertNotNull("Local region apps not found.", registeredApplications);
    Assert.assertEquals("Local apps size not as expected.", 1, registeredApplications.size());
    Assert.assertEquals("Local region apps not present.", LOCAL_REGION_APP_NAME, registeredApplications.get(0).getName());
}
Also used : Applications(com.netflix.discovery.shared.Applications) Application(com.netflix.discovery.shared.Application) Test(org.junit.Test)

Example 10 with Application

use of com.netflix.discovery.shared.Application in project eureka by Netflix.

the class BackUpRegistryTest method createRemoteApps.

private Application createRemoteApps() {
    Application myapp = new Application(REMOTE_REGION_APP_NAME);
    InstanceInfo instanceInfo = createRemoteInstance(REMOTE_REGION_INSTANCE_1_HOSTNAME);
    myapp.addInstance(instanceInfo);
    return myapp;
}
Also used : Application(com.netflix.discovery.shared.Application) InstanceInfo(com.netflix.appinfo.InstanceInfo)

Aggregations

Application (com.netflix.discovery.shared.Application)60 InstanceInfo (com.netflix.appinfo.InstanceInfo)35 Applications (com.netflix.discovery.shared.Applications)25 Test (org.junit.Test)18 DecoderWrapper (com.netflix.discovery.converters.wrappers.DecoderWrapper)7 HashMap (java.util.HashMap)7 Response (javax.ws.rs.core.Response)7 CodecWrappers (com.netflix.discovery.converters.wrappers.CodecWrappers)6 Lease (com.netflix.eureka.lease.Lease)4 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 InputStream (java.io.InputStream)3 ArrayList (java.util.ArrayList)3 EurekaHttpResponseBuilder (com.netflix.discovery.shared.transport.EurekaHttpResponse.EurekaHttpResponseBuilder)2 PeerEurekaNode (com.netflix.eureka.cluster.PeerEurekaNode)2 Map (java.util.Map)2 ConcurrentMap (java.util.concurrent.ConcurrentMap)2 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)1 ApplicationInfoManager (com.netflix.appinfo.ApplicationInfoManager)1