LoadBalancerStepDefinitions { @Given("^detach security-group \"([^\"]*)\"$") public LoadBalancerStepDefinitions detachSecurityGroup(String securityGroupId) { executionStateCache.addDetachedSecurityGroup(securityGroupId); logger.info("Detaching security group " + securityGroupId + " from " + executionStateCache.getLoadBalancerName()); loadBalancerRaider.deleteSecurityGroups(executionStateCache.getLoadBalancerName(), securityGroupId); 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();  }
@Test public void testDetachSecurityGroup() throws Throwable { loadBalancerStepDefinitions.givenLoadBalancerName("ELB", "elb"); loadBalancerStepDefinitions.detachSecurityGroup("sg-123"); }