@Test public void testShouldNotAddExtraInstance() throws Exception { when(deployConfiguration.getMaxCapacity()).thenReturn(4); when(autoScalingGroup.getMaxSize()).thenReturn(4); when(instances.size()).thenReturn(4); when(autoScalingGroup.getInstances()).thenReturn(instances); AwsAutoScalingDeployUtils utils = new AwsAutoScalingDeployUtils("eu-west-1", deployConfiguration, null); Assert.assertFalse(utils.shouldAddExtraInstance(autoScalingGroup)); }
public boolean shouldAddExtraInstance(AutoScalingGroup autoScalingGroup) { return autoScalingGroup.getInstances().size() < autoScalingGroup.getMaxSize() && !(activeConfiguration.getMaxCapacity() != -1 && autoScalingGroup.getInstances().size() > activeConfiguration.getMaxCapacity()); }
AwsAutoScalingDeployUtils { public boolean shouldAddExtraInstance(AutoScalingGroup autoScalingGroup) { return autoScalingGroup.getInstances().size() < autoScalingGroup.getMaxSize() && !(activeConfiguration.getMaxCapacity() != -1 && autoScalingGroup.getInstances().size() > activeConfiguration.getMaxCapacity()); } }
AwsAutoScalingDeployUtils { public boolean shouldAddExtraInstance(AutoScalingGroup autoScalingGroup) { return autoScalingGroup.getInstances().size() < autoScalingGroup.getMaxSize() && !(activeConfiguration.getMaxCapacity() != -1 && autoScalingGroup.getInstances().size() > activeConfiguration.getMaxCapacity()); } AwsAutoScalingDeployUtils(String region, DeployConfiguration activeConfiguration, Log log); }
AwsAutoScalingDeployUtils { public boolean shouldAddExtraInstance(AutoScalingGroup autoScalingGroup) { return autoScalingGroup.getInstances().size() < autoScalingGroup.getMaxSize() && !(activeConfiguration.getMaxCapacity() != -1 && autoScalingGroup.getInstances().size() > activeConfiguration.getMaxCapacity()); } AwsAutoScalingDeployUtils(String region, DeployConfiguration activeConfiguration, Log log); AutoScalingGroup getAutoScalingGroup(); void suspendScheduledActions(); void setMinimalCapacity(int cap); void resumeScheduledActions(); boolean checkInstanceInService(String instanceId); List<Ec2Instance> getInstancesForAutoScalingGroup(Log log, AutoScalingGroup autoScalingGroup); void enableStickiness(String loadbalancerName, List<Integer> ports); void disableStickiness(String loadbalancerName, List<Integer> ports); boolean shouldAddExtraInstance(AutoScalingGroup autoScalingGroup); void setDesiredCapacity(AutoScalingGroup autoScalingGroup, Integer capacity); void updateInstanceState(Ec2Instance instance, List<String> loadBalancerNames); boolean checkInstanceInServiceOnAllElb(Instance newInstance, List<String> loadBalancerNames); boolean checkEc2Instance(String instanceId); void setDeployMetadataTags(final String version, Properties properties); }
AwsAutoScalingDeployUtils { public boolean shouldAddExtraInstance(AutoScalingGroup autoScalingGroup) { return autoScalingGroup.getInstances().size() < autoScalingGroup.getMaxSize() && !(activeConfiguration.getMaxCapacity() != -1 && autoScalingGroup.getInstances().size() > activeConfiguration.getMaxCapacity()); } AwsAutoScalingDeployUtils(String region, DeployConfiguration activeConfiguration, Log log); AutoScalingGroup getAutoScalingGroup(); void suspendScheduledActions(); void setMinimalCapacity(int cap); void resumeScheduledActions(); boolean checkInstanceInService(String instanceId); List<Ec2Instance> getInstancesForAutoScalingGroup(Log log, AutoScalingGroup autoScalingGroup); void enableStickiness(String loadbalancerName, List<Integer> ports); void disableStickiness(String loadbalancerName, List<Integer> ports); boolean shouldAddExtraInstance(AutoScalingGroup autoScalingGroup); void setDesiredCapacity(AutoScalingGroup autoScalingGroup, Integer capacity); void updateInstanceState(Ec2Instance instance, List<String> loadBalancerNames); boolean checkInstanceInServiceOnAllElb(Instance newInstance, List<String> loadBalancerNames); boolean checkEc2Instance(String instanceId); void setDeployMetadataTags(final String version, Properties properties);  }