@Test public void testRegisterInstances() throws Throwable { loadBalancerStepDefinitions.givenLoadBalancerName("ELB", "elb"); executionStateCache.addDeregisteredInstance(createInstances()); loadBalancerStepDefinitions.registerInstances(); Assert.assertEquals(0, executionStateCache.getDeregistedInstance().size()); }
@When("^attach unregistered instances$") public LoadBalancerStepDefinitions registerInstances() { List<EC2InstanceTO> instances = executionStateCache.getDeregistedInstance(); if (instances == null || instances.isEmpty()) { throw new RuntimeException("No Instances are available"); } loadBalancerRaider.registerInstancesFromLoadBalancer(executionStateCache.getLoadBalancerName(), Ec2Utils.generateInstanceIdList(instances)); executionStateCache.clearDeregisteredInstance(); return this; }
LoadBalancerStepDefinitions { @When("^attach unregistered instances$") public LoadBalancerStepDefinitions registerInstances() { List<EC2InstanceTO> instances = executionStateCache.getDeregistedInstance(); if (instances == null || instances.isEmpty()) { throw new RuntimeException("No Instances are available"); } loadBalancerRaider.registerInstancesFromLoadBalancer(executionStateCache.getLoadBalancerName(), Ec2Utils.generateInstanceIdList(instances)); executionStateCache.clearDeregisteredInstance(); return this; } }
LoadBalancerStepDefinitions { @When("^attach unregistered instances$") public LoadBalancerStepDefinitions registerInstances() { List<EC2InstanceTO> instances = executionStateCache.getDeregistedInstance(); if (instances == null || instances.isEmpty()) { throw new RuntimeException("No Instances are available"); } loadBalancerRaider.registerInstancesFromLoadBalancer(executionStateCache.getLoadBalancerName(), Ec2Utils.generateInstanceIdList(instances)); executionStateCache.clearDeregisteredInstance(); return this; } LoadBalancerStepDefinitions(); }
LoadBalancerStepDefinitions { @When("^attach unregistered instances$") public LoadBalancerStepDefinitions registerInstances() { List<EC2InstanceTO> instances = executionStateCache.getDeregistedInstance(); if (instances == null || instances.isEmpty()) { throw new RuntimeException("No Instances are available"); } loadBalancerRaider.registerInstancesFromLoadBalancer(executionStateCache.getLoadBalancerName(), Ec2Utils.generateInstanceIdList(instances)); executionStateCache.clearDeregisteredInstance(); return this; } LoadBalancerStepDefinitions(); ExecutionStateCache getExecutionStateCache(); void setExecutionStateCache(ExecutionStateCache executionStateCache); @Given("^(ELB|ALB|NLB) \"([^\"]*)\"$") LoadBalancerStepDefinitions givenLoadBalancerName(String loadbalancerType, String loadBalancerName); void givenLoadBalancerNameIgnoreExecCache(String loadbalancerType, String loadBalancerName); Map<String, String> getLoadBalancerNames(); @Given("^detach security-group \"([^\"]*)\"$") LoadBalancerStepDefinitions detachSecurityGroup(String securityGroupId); @Given("^attach security-group \"([^\"]*)\"$") LoadBalancerStepDefinitions attachSecurityGroup(String securityGroupId); @Given("^detach (\\d+) security-groups$") LoadBalancerStepDefinitions detachRandomSecurityGroups(int num); @Given("^attach removed security-groups$") LoadBalancerStepDefinitions attachRandomRemovedSecurityGroups(); @Given("^detach subnet \"([^\"]*)\"$") LoadBalancerStepDefinitions detachSubnet(String subnetId); @Given("^detach (\\d+) subnets$") LoadBalancerStepDefinitions detachRandomSubnets(int num); @Given("^attach removed subnets$") LoadBalancerStepDefinitions attachRandomRemovedSubnets(); @Given("^attach subnet \"([^\"]*)\"$") LoadBalancerStepDefinitions attachSubnet(String subnetId); @Then("^assertEC2 healthy host count = (\\d+)$") void assertHealthyHostCount(int expected); @Then("^assertEC2 unhealthy host count = (\\d+)$") void assertUntHealthyHostCount(int expected); @When("^LB corrupt HealthChecks$") void corruptLBHealthCheck(); @Then("^LB unCorrupt HealthChecks$") void unCorruptLBHealthCheck(); @When("^detach instanceId \"([^\"]*)\" from loadbalancer$") void deRegisterGivenInstance(String instanceID); LoadBalancerStepDefinitions deRegisterPercentOfInstances(double percentage); @When("^detach (\\d+) instances from loadbalancer$") LoadBalancerStepDefinitions deRegisterInstances(int numInstances); @When("^detach (\\d+)% instances from loadbalancer$") LoadBalancerStepDefinitions deRegisterPercentOfInstances(int percentage); @When("^attach unregistered instances$") LoadBalancerStepDefinitions registerInstances(); boolean confirmUnHealthyHostCount(int expected); boolean confirmHealthyHostCount(int expected); List<String> getSecurityGroups(); List<String> getSubnets(); List<String> findAllInServiceInstances(); List<String> findAllInServiceInstances(String loadBalancerName); List<String> findAllOutOfServiceInstances(); }
LoadBalancerStepDefinitions { @When("^attach unregistered instances$") public LoadBalancerStepDefinitions registerInstances() { List<EC2InstanceTO> instances = executionStateCache.getDeregistedInstance(); if (instances == null || instances.isEmpty()) { throw new RuntimeException("No Instances are available"); } loadBalancerRaider.registerInstancesFromLoadBalancer(executionStateCache.getLoadBalancerName(), Ec2Utils.generateInstanceIdList(instances)); executionStateCache.clearDeregisteredInstance(); return this; } LoadBalancerStepDefinitions(); ExecutionStateCache getExecutionStateCache(); void setExecutionStateCache(ExecutionStateCache executionStateCache); @Given("^(ELB|ALB|NLB) \"([^\"]*)\"$") LoadBalancerStepDefinitions givenLoadBalancerName(String loadbalancerType, String loadBalancerName); void givenLoadBalancerNameIgnoreExecCache(String loadbalancerType, String loadBalancerName); Map<String, String> getLoadBalancerNames(); @Given("^detach security-group \"([^\"]*)\"$") LoadBalancerStepDefinitions detachSecurityGroup(String securityGroupId); @Given("^attach security-group \"([^\"]*)\"$") LoadBalancerStepDefinitions attachSecurityGroup(String securityGroupId); @Given("^detach (\\d+) security-groups$") LoadBalancerStepDefinitions detachRandomSecurityGroups(int num); @Given("^attach removed security-groups$") LoadBalancerStepDefinitions attachRandomRemovedSecurityGroups(); @Given("^detach subnet \"([^\"]*)\"$") LoadBalancerStepDefinitions detachSubnet(String subnetId); @Given("^detach (\\d+) subnets$") LoadBalancerStepDefinitions detachRandomSubnets(int num); @Given("^attach removed subnets$") LoadBalancerStepDefinitions attachRandomRemovedSubnets(); @Given("^attach subnet \"([^\"]*)\"$") LoadBalancerStepDefinitions attachSubnet(String subnetId); @Then("^assertEC2 healthy host count = (\\d+)$") void assertHealthyHostCount(int expected); @Then("^assertEC2 unhealthy host count = (\\d+)$") void assertUntHealthyHostCount(int expected); @When("^LB corrupt HealthChecks$") void corruptLBHealthCheck(); @Then("^LB unCorrupt HealthChecks$") void unCorruptLBHealthCheck(); @When("^detach instanceId \"([^\"]*)\" from loadbalancer$") void deRegisterGivenInstance(String instanceID); LoadBalancerStepDefinitions deRegisterPercentOfInstances(double percentage); @When("^detach (\\d+) instances from loadbalancer$") LoadBalancerStepDefinitions deRegisterInstances(int numInstances); @When("^detach (\\d+)% instances from loadbalancer$") LoadBalancerStepDefinitions deRegisterPercentOfInstances(int percentage); @When("^attach unregistered instances$") LoadBalancerStepDefinitions registerInstances(); boolean confirmUnHealthyHostCount(int expected); boolean confirmHealthyHostCount(int expected); List<String> getSecurityGroups(); List<String> getSubnets(); List<String> findAllInServiceInstances(); List<String> findAllInServiceInstances(String loadBalancerName); List<String> findAllOutOfServiceInstances();  }