@Inject ASGResource(EurekaServerContext eurekaServer) { this.registry = eurekaServer.getRegistry(); if (registry instanceof AwsInstanceRegistry) { this.awsAsgUtil = ((AwsInstanceRegistry) registry).getAwsAsgUtil(); } else { this.awsAsgUtil = null; } }
registry = new AwsInstanceRegistry( eurekaServerConfig, eurekaClient.getEurekaClientConfig(),
registry = new AwsInstanceRegistry( eurekaServerConfig, eurekaClient.getEurekaClientConfig(),
@Test public void testOverridesWithAsgEnabledThenDisabled() { // Regular registration first InstanceInfo myInstance = createLocalUpInstanceWithAsg(LOCAL_REGION_INSTANCE_1_HOSTNAME); registerInstanceLocally(myInstance); verifyLocalInstanceStatus(myInstance.getId(), InstanceStatus.UP); // Now we disable the ASG and we should expect OUT_OF_SERVICE status. ((AwsInstanceRegistry) registry).getAwsAsgUtil().setStatus(myInstance.getASGName(), false); myInstance = createLocalUpInstanceWithAsg(LOCAL_REGION_INSTANCE_1_HOSTNAME); registerInstanceLocally(myInstance); verifyLocalInstanceStatus(myInstance.getId(), InstanceStatus.OUT_OF_SERVICE); // Now we re-enable the ASG and we should expect UP status. ((AwsInstanceRegistry) registry).getAwsAsgUtil().setStatus(myInstance.getASGName(), true); myInstance = createLocalUpInstanceWithAsg(LOCAL_REGION_INSTANCE_1_HOSTNAME); registerInstanceLocally(myInstance); verifyLocalInstanceStatus(myInstance.getId(), InstanceStatus.UP); }
@Inject ASGResource(EurekaServerContext eurekaServer) { this.registry = eurekaServer.getRegistry(); if (registry instanceof AwsInstanceRegistry) { this.awsAsgUtil = ((AwsInstanceRegistry) registry).getAwsAsgUtil(); } else { this.awsAsgUtil = null; } }