Search in sources :

Example 1 with VipAddressResolver

use of com.netflix.appinfo.providers.VipAddressResolver in project eureka by Netflix.

the class NonEc2EurekaClientModuleTest method testDI.

@SuppressWarnings("deprecation")
@Test
public void testDI() {
    InstanceInfo instanceInfo = injector.getInstance(InstanceInfo.class);
    Assert.assertEquals(ApplicationInfoManager.getInstance().getInfo(), instanceInfo);
    VipAddressResolver vipAddressResolver = injector.getInstance(VipAddressResolver.class);
    Assert.assertTrue(vipAddressResolver instanceof Archaius2VipAddressResolver);
    EurekaClient eurekaClient = injector.getInstance(EurekaClient.class);
    DiscoveryClient discoveryClient = injector.getInstance(DiscoveryClient.class);
    Assert.assertEquals(DiscoveryManager.getInstance().getEurekaClient(), eurekaClient);
    Assert.assertEquals(DiscoveryManager.getInstance().getDiscoveryClient(), discoveryClient);
    Assert.assertEquals(eurekaClient, discoveryClient);
    EurekaClientConfig eurekaClientConfig = injector.getInstance(EurekaClientConfig.class);
    Assert.assertEquals(DiscoveryManager.getInstance().getEurekaClientConfig(), eurekaClientConfig);
    EurekaInstanceConfig eurekaInstanceConfig = injector.getInstance(EurekaInstanceConfig.class);
    Assert.assertEquals(DiscoveryManager.getInstance().getEurekaInstanceConfig(), eurekaInstanceConfig);
    Assert.assertTrue(eurekaInstanceConfig instanceof EurekaArchaius2InstanceConfig);
    ApplicationInfoManager applicationInfoManager = injector.getInstance(ApplicationInfoManager.class);
    InstanceInfo myInfo = applicationInfoManager.getInfo();
    Assert.assertEquals(DataCenterInfo.Name.MyOwn, myInfo.getDataCenterInfo().getName());
}
Also used : EurekaClientConfig(com.netflix.discovery.EurekaClientConfig) EurekaArchaius2InstanceConfig(com.netflix.appinfo.EurekaArchaius2InstanceConfig) Archaius2VipAddressResolver(com.netflix.appinfo.providers.Archaius2VipAddressResolver) VipAddressResolver(com.netflix.appinfo.providers.VipAddressResolver) EurekaInstanceConfig(com.netflix.appinfo.EurekaInstanceConfig) EurekaClient(com.netflix.discovery.EurekaClient) DiscoveryClient(com.netflix.discovery.DiscoveryClient) InstanceInfo(com.netflix.appinfo.InstanceInfo) Archaius2VipAddressResolver(com.netflix.appinfo.providers.Archaius2VipAddressResolver) ApplicationInfoManager(com.netflix.appinfo.ApplicationInfoManager) Test(org.junit.Test)

Example 2 with VipAddressResolver

use of com.netflix.appinfo.providers.VipAddressResolver in project eureka by Netflix.

the class Ec2EurekaClientModuleTest method testDI.

@SuppressWarnings("deprecation")
@Test
public void testDI() {
    InstanceInfo instanceInfo = injector.getInstance(InstanceInfo.class);
    Assert.assertEquals(ApplicationInfoManager.getInstance().getInfo(), instanceInfo);
    VipAddressResolver vipAddressResolver = injector.getInstance(VipAddressResolver.class);
    Assert.assertTrue(vipAddressResolver instanceof Archaius2VipAddressResolver);
    EurekaClient eurekaClient = injector.getInstance(EurekaClient.class);
    DiscoveryClient discoveryClient = injector.getInstance(DiscoveryClient.class);
    Assert.assertEquals(DiscoveryManager.getInstance().getEurekaClient(), eurekaClient);
    Assert.assertEquals(DiscoveryManager.getInstance().getDiscoveryClient(), discoveryClient);
    Assert.assertEquals(eurekaClient, discoveryClient);
    EurekaClientConfig eurekaClientConfig = injector.getInstance(EurekaClientConfig.class);
    Assert.assertEquals(DiscoveryManager.getInstance().getEurekaClientConfig(), eurekaClientConfig);
    EurekaInstanceConfig eurekaInstanceConfig = injector.getInstance(EurekaInstanceConfig.class);
    Assert.assertEquals(DiscoveryManager.getInstance().getEurekaInstanceConfig(), eurekaInstanceConfig);
    Assert.assertTrue(eurekaInstanceConfig instanceof Ec2EurekaArchaius2InstanceConfig);
    ApplicationInfoManager applicationInfoManager = injector.getInstance(ApplicationInfoManager.class);
    InstanceInfo myInfo = applicationInfoManager.getInfo();
    Assert.assertTrue(myInfo.getDataCenterInfo() instanceof AmazonInfo);
    Assert.assertEquals(DataCenterInfo.Name.Amazon, myInfo.getDataCenterInfo().getName());
}
Also used : EurekaClientConfig(com.netflix.discovery.EurekaClientConfig) Ec2EurekaArchaius2InstanceConfig(com.netflix.appinfo.Ec2EurekaArchaius2InstanceConfig) Archaius2VipAddressResolver(com.netflix.appinfo.providers.Archaius2VipAddressResolver) VipAddressResolver(com.netflix.appinfo.providers.VipAddressResolver) EurekaInstanceConfig(com.netflix.appinfo.EurekaInstanceConfig) EurekaClient(com.netflix.discovery.EurekaClient) DiscoveryClient(com.netflix.discovery.DiscoveryClient) AmazonInfo(com.netflix.appinfo.AmazonInfo) InstanceInfo(com.netflix.appinfo.InstanceInfo) Archaius2VipAddressResolver(com.netflix.appinfo.providers.Archaius2VipAddressResolver) ApplicationInfoManager(com.netflix.appinfo.ApplicationInfoManager) Test(org.junit.Test)

Aggregations

ApplicationInfoManager (com.netflix.appinfo.ApplicationInfoManager)2 EurekaInstanceConfig (com.netflix.appinfo.EurekaInstanceConfig)2 InstanceInfo (com.netflix.appinfo.InstanceInfo)2 Archaius2VipAddressResolver (com.netflix.appinfo.providers.Archaius2VipAddressResolver)2 VipAddressResolver (com.netflix.appinfo.providers.VipAddressResolver)2 DiscoveryClient (com.netflix.discovery.DiscoveryClient)2 EurekaClient (com.netflix.discovery.EurekaClient)2 EurekaClientConfig (com.netflix.discovery.EurekaClientConfig)2 Test (org.junit.Test)2 AmazonInfo (com.netflix.appinfo.AmazonInfo)1 Ec2EurekaArchaius2InstanceConfig (com.netflix.appinfo.Ec2EurekaArchaius2InstanceConfig)1 EurekaArchaius2InstanceConfig (com.netflix.appinfo.EurekaArchaius2InstanceConfig)1