tweaked the test to be simpler & more accurate

This commit is contained in:
danikov 2011-11-21 17:34:47 +00:00
parent 381ce837d2
commit 3cc79d3cdd
4 changed files with 8 additions and 21 deletions

View File

@ -19,7 +19,9 @@
package org.jclouds.cloudloadbalancers.features; package org.jclouds.cloudloadbalancers.features;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertEquals;
import java.util.Arrays;
import java.util.Properties; import java.util.Properties;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -36,6 +38,7 @@ import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.rest.RestContext; import org.jclouds.rest.RestContext;
import org.testng.annotations.AfterGroups; import org.testng.annotations.AfterGroups;
import org.testng.annotations.BeforeGroups; import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -53,6 +56,7 @@ public class BaseCloudLoadBalancersClientLiveTest {
protected CloudLoadBalancersClient client; protected CloudLoadBalancersClient client;
protected RestContext<CloudLoadBalancersClient, CloudLoadBalancersAsyncClient> context; protected RestContext<CloudLoadBalancersClient, CloudLoadBalancersAsyncClient> context;
protected String provider = "cloudloadbalancers"; protected String provider = "cloudloadbalancers";
protected String[] regions = {};
protected String identity; protected String identity;
protected String credential; protected String credential;
protected String endpoint; protected String endpoint;

View File

@ -21,6 +21,7 @@ package org.jclouds.cloudloadbalancers.features;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
import java.util.Arrays;
import java.util.Set; import java.util.Set;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -47,7 +48,7 @@ public class LoadBalancerClientLiveTest extends BaseCloudLoadBalancersClientLive
@BeforeGroups(groups = "live") @BeforeGroups(groups = "live")
protected void setup() { protected void setup() {
assertTrue(client.getConfiguredRegions().size() > 0, "Need to have some regions!"); assertEquals(client.getConfiguredRegions(), Arrays.asList(regions));
Logger.getAnonymousLogger().info("running against regions "+client.getConfiguredRegions()); Logger.getAnonymousLogger().info("running against regions "+client.getConfiguredRegions());
} }

View File

@ -18,10 +18,7 @@
*/ */
package org.jclouds.rackspace.cloudloadbalancers; package org.jclouds.rackspace.cloudloadbalancers;
import static org.testng.Assert.assertEquals;
import org.jclouds.cloudloadbalancers.features.LoadBalancerClientLiveTest; import org.jclouds.cloudloadbalancers.features.LoadBalancerClientLiveTest;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
@ -32,12 +29,6 @@ import org.testng.annotations.Test;
public class CloudLoadBalancersUKLoadBalancerClientLiveTest extends LoadBalancerClientLiveTest { public class CloudLoadBalancersUKLoadBalancerClientLiveTest extends LoadBalancerClientLiveTest {
public CloudLoadBalancersUKLoadBalancerClientLiveTest() { public CloudLoadBalancersUKLoadBalancerClientLiveTest() {
provider = "cloudloadbalancers-uk"; provider = "cloudloadbalancers-uk";
} regions = CloudLoadBalancersUKPropertiesBuilder.REGIONS;
@BeforeGroups(groups = "live")
protected void setup() {
super.setup();
assertEquals(client.getConfiguredRegions().size(),
CloudLoadBalancersUKPropertiesBuilder.REGIONS.length);
} }
} }

View File

@ -18,10 +18,7 @@
*/ */
package org.jclouds.rackspace.cloudloadbalancers; package org.jclouds.rackspace.cloudloadbalancers;
import static org.testng.Assert.assertEquals;
import org.jclouds.cloudloadbalancers.features.LoadBalancerClientLiveTest; import org.jclouds.cloudloadbalancers.features.LoadBalancerClientLiveTest;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
@ -32,12 +29,6 @@ import org.testng.annotations.Test;
public class CloudLoadBalancersUSLoadBalancerClientLiveTest extends LoadBalancerClientLiveTest { public class CloudLoadBalancersUSLoadBalancerClientLiveTest extends LoadBalancerClientLiveTest {
public CloudLoadBalancersUSLoadBalancerClientLiveTest() { public CloudLoadBalancersUSLoadBalancerClientLiveTest() {
provider = "cloudloadbalancers-us"; provider = "cloudloadbalancers-us";
} regions = CloudLoadBalancersUSPropertiesBuilder.REGIONS;
@BeforeGroups(groups = "live")
protected void setup() {
super.setup();
assertEquals(client.getConfiguredRegions().size(),
CloudLoadBalancersUSPropertiesBuilder.REGIONS.length);
} }
} }