@Test(dependsOnMethods = "testApply_ServerNotInNormalState") public void testApply_NatRuleNotInNormalState() throws Exception { final Server server = serverBuilder.state(State.NORMAL).build(); loadServerExpectations(server); networkApiExpectations(); final NatRule natRule = natRuleBuilder.state(State.FAILED_ADD).build(); expect(networkApi.listNatRules(jcloudsNetworkDomainId)) .andReturn(PagedIterables.onlyPage(IterableWithMarkers.from(Lists.newArrayList(natRule)))); publicIpBlockExpectations(); firewallRuleAndPortListExpectations(); powerOffAndDeleteServerExpectations(); applyAndAssertDeleted(); }
@Test(dependsOnMethods = "testApply_NatRuleNotInNormalState") public void testApply_PublicIpBlockNotInNormalState() throws Exception { final Server server = serverBuilder.state(State.NORMAL).build(); loadServerExpectations(server); networkApiExpectations(); natRuleExpectations(); final PublicIpBlock publicIpBlock = publicIpBlockBuilder.state(State.FAILED_CHANGE).build(); expect(networkApi.listPublicIPv4AddressBlocks(jcloudsNetworkDomainId)) .andReturn(PagedIterables.onlyPage(IterableWithMarkers.from(Lists.newArrayList(publicIpBlock)))); firewallRuleAndPortListExpectations(); powerOffAndDeleteServerExpectations(); applyAndAssertDeleted(); }
@Test public void testApply_ServerAndNetworkingDeleted() throws Exception { final Server server = serverBuilder.state(State.NORMAL).build(); loadServerExpectations(server); networkApiExpectations(); natRuleExpectations(); publicIpBlockExpectations(); firewallRuleAndPortListExpectations(); powerOffAndDeleteServerExpectations(); applyAndAssertDeleted(); }
@Test(dependsOnMethods = "testApply_PublicIpBlockNotInNormalState") public void testApply_FirewallRuleNotInNormalState() throws Exception { final Server server = serverBuilder.state(State.NORMAL).build(); loadServerExpectations(server); networkApiExpectations(); natRuleExpectations(); publicIpBlockExpectations(); final FirewallRule firewallRule = firewallRuleBuilder.state(State.FAILED_CHANGE).destination( FirewallRuleTarget.builder() .portList(FirewallRuleTarget.PortList.create("portListId", null, null, null, null)).build()).build(); expect(networkApi.listFirewallRules(jcloudsNetworkDomainId)) .andReturn(PagedIterables.onlyPage(IterableWithMarkers.from(Lists.newArrayList(firewallRule)))); powerOffAndDeleteServerExpectations(); applyAndAssertDeleted(); }
@Test(dependsOnMethods = "testApply_ServerAndNetworkingDeleted") public void testApply_ServerNotInNormalState() throws Exception { final Server server = serverBuilder.state(State.FAILED_ADD).build(); loadServerExpectations(server); replay(api, serverApi, networkApi); Predicate<String> serverStoppedPredicate = contextModule .provideServerStoppedPredicate(api, new ComputeServiceConstants.Timeouts(), new ComputeServiceConstants.PollPeriod()); Predicate<String> serverDeletedPredicate = contextModule .provideServerDeletedPredicate(api, new ComputeServiceConstants.Timeouts(), new ComputeServiceConstants.PollPeriod()); cleanupServer = new CleanupServer(api, new ComputeServiceConstants.Timeouts(), serverStoppedPredicate, serverDeletedPredicate); applyWithExpectedErrorMessage("Server(serverId) not deleted as it is in state(FailedAdd)."); }