Clarify LoadBalancerClientLiveTest

This commit is contained in:
Richard Downer 2011-12-21 23:05:37 +00:00
parent d9f01e0ff8
commit 5414f7e06a
1 changed files with 12 additions and 3 deletions

View File

@ -30,6 +30,7 @@ import java.util.concurrent.TimeUnit;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import org.jclouds.cloudstack.domain.AsyncJob; import org.jclouds.cloudstack.domain.AsyncJob;
import org.jclouds.cloudstack.domain.JobResult;
import org.jclouds.cloudstack.domain.LoadBalancerRule; import org.jclouds.cloudstack.domain.LoadBalancerRule;
import org.jclouds.cloudstack.domain.LoadBalancerRule.Algorithm; import org.jclouds.cloudstack.domain.LoadBalancerRule.Algorithm;
import org.jclouds.cloudstack.domain.LoadBalancerRule.State; import org.jclouds.cloudstack.domain.LoadBalancerRule.State;
@ -121,10 +122,18 @@ public class LoadBalancerClientLiveTest extends BaseCloudStackClientLiveTest {
public void testAssignToLoadBalancerRule() throws Exception { public void testAssignToLoadBalancerRule() throws Exception {
if (networksDisabled) if (networksDisabled)
return; return;
assertTrue(jobComplete.apply(client.getLoadBalancerClient().assignVirtualMachinesToLoadBalancerRule(rule.getId(), long jobId = client.getLoadBalancerClient().assignVirtualMachinesToLoadBalancerRule(rule.getId(),
vm.getId()))); vm.getId());
assertEquals(client.getLoadBalancerClient().listVirtualMachinesAssignedToLoadBalancerRule(rule.getId()).size(), 1); assertTrue(jobComplete.apply(jobId));
AsyncJob<JobResult> result = client.getAsyncJobClient().getAsyncJob(jobId);
assertTrue(result.hasSucceed());
Set<VirtualMachine> machines = client.getLoadBalancerClient().listVirtualMachinesAssignedToLoadBalancerRule(rule.getId());
assertEquals(machines.size(), 1);
assertTrue(loadBalancerRuleActive.apply(rule), rule.toString()); assertTrue(loadBalancerRuleActive.apply(rule), rule.toString());
}
@Test(dependsOnMethods = "testAssignToLoadBalancerRule")
public void testCanSshInThroughNewLoadBalancerRule() throws Exception {
loopAndCheckSSH(); loopAndCheckSSH();
} }