Updated Branches: refs/heads/master 2e4f67c7f -> 90c7a3a53
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/ScalingPolicyApiLiveTest.java ---------------------------------------------------------------------- diff --git a/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/ScalingPolicyApiLiveTest.java b/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/ScalingPolicyApiLiveTest.java index cd1c664..a99f32d 100644 --- a/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/ScalingPolicyApiLiveTest.java +++ b/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/ScalingPolicyApiLiveTest.java @@ -31,11 +31,11 @@ import org.jclouds.rackspace.autoscale.v1.domain.LaunchConfiguration; import org.jclouds.rackspace.autoscale.v1.domain.LaunchConfiguration.LaunchConfigurationType; import org.jclouds.rackspace.autoscale.v1.domain.LoadBalancer; import org.jclouds.rackspace.autoscale.v1.domain.Personality; +import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy; +import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyScheduleType; +import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyTargetType; +import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyType; import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy; -import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyScheduleType; -import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyTargetType; -import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyType; -import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicyResponse; import org.jclouds.rackspace.autoscale.v1.internal.BaseAutoscaleApiLiveTest; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; @@ -89,9 +89,9 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest { .contents("VGhpcyBpcyBhIHRlc3QgZmlsZS4=").build())) .type(LaunchConfigurationType.LAUNCH_SERVER).build(); - List<ScalingPolicy> scalingPolicies = Lists.newArrayList(); + List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList(); - ScalingPolicy scalingPolicy = ScalingPolicy.builder().cooldown(3).type(ScalingPolicyType.WEBHOOK) + CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder().cooldown(3).type(ScalingPolicyType.WEBHOOK) .name("scale up by 1").targetType(ScalingPolicyTargetType.INCREMENTAL).target("1").build(); scalingPolicies.add(scalingPolicy); @@ -152,9 +152,9 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest { PolicyApi policyApi = api.getPolicyApiForZoneAndGroup(zone, created.get(zone).get(0).getId()); - List<ScalingPolicy> scalingPolicies = Lists.newArrayList(); + List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList(); - ScalingPolicy scalingPolicy = ScalingPolicy.builder() + CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder() .cooldown(3) .type(ScalingPolicyType.WEBHOOK) .name("scale up by one server") @@ -163,7 +163,7 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest { .build(); scalingPolicies.add(scalingPolicy); - FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = policyApi.create(scalingPolicies); + FluentIterable<ScalingPolicy> scalingPolicyResponse = policyApi.create(scalingPolicies); assertNotNull(scalingPolicyResponse.iterator().next().getId()); assertEquals(scalingPolicyResponse.iterator().next().getCooldown(), 3); assertEquals(scalingPolicyResponse.iterator().next().getTarget(), "1"); @@ -176,9 +176,9 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest { PolicyApi policyApi = api.getPolicyApiForZoneAndGroup(zone, created.get(zone).get(0).getId()); - List<ScalingPolicy> scalingPolicies = Lists.newArrayList(); + List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList(); - ScalingPolicy scalingPolicy = ScalingPolicy.builder() + CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder() .cooldown(3) .type(ScalingPolicyType.SCHEDULE) .name("scale up by one server") @@ -188,7 +188,7 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest { .build(); scalingPolicies.add(scalingPolicy); - FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = policyApi.create(scalingPolicies); + FluentIterable<ScalingPolicy> scalingPolicyResponse = policyApi.create(scalingPolicies); assertNotNull(scalingPolicyResponse.iterator().next().getId()); assertEquals(scalingPolicyResponse.iterator().next().getCooldown(), 3); assertEquals(scalingPolicyResponse.iterator().next().getTarget(), "1"); @@ -203,9 +203,9 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest { PolicyApi policyApi = api.getPolicyApiForZoneAndGroup(zone, created.get(zone).get(0).getId()); - List<ScalingPolicy> scalingPolicies = Lists.newArrayList(); + List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList(); - ScalingPolicy scalingPolicy = ScalingPolicy.builder() + CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder() .cooldown(3) .type(ScalingPolicyType.SCHEDULE) .name("scale up by one server") @@ -215,7 +215,7 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest { .build(); scalingPolicies.add(scalingPolicy); - FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = policyApi.create(scalingPolicies); + FluentIterable<ScalingPolicy> scalingPolicyResponse = policyApi.create(scalingPolicies); assertNotNull(scalingPolicyResponse.iterator().next().getId()); assertEquals(scalingPolicyResponse.iterator().next().getCooldown(), 3); assertEquals(scalingPolicyResponse.iterator().next().getTarget(), "1"); @@ -230,7 +230,7 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest { PolicyApi policyApi = api.getPolicyApiForZoneAndGroup(zone, created.get(zone).get(0).getId()); - FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = policyApi.list(); + FluentIterable<ScalingPolicy> scalingPolicyResponse = policyApi.list(); assertNotNull(scalingPolicyResponse.iterator().next().getId()); } } @@ -242,8 +242,8 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest { PolicyApi policyApi = api.getPolicyApiForZoneAndGroup(zone, created.get(zone).get(0).getId()); assertNotNull(policyApi); - ScalingPolicyResponse listResponse = policyApi.list().iterator().next(); - ScalingPolicyResponse getResponse = policyApi.get(listResponse.getId()); + ScalingPolicy listResponse = policyApi.list().iterator().next(); + ScalingPolicy getResponse = policyApi.get(listResponse.getId()); assertEquals(listResponse.getId(), getResponse.getId()); assertEquals(listResponse.getName(), getResponse.getName()); assertEquals(listResponse.getCooldown(), getResponse.getCooldown()); @@ -260,9 +260,9 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest { PolicyApi policyApi = api.getPolicyApiForZoneAndGroup(zone, created.get(zone).get(0).getId()); - List<ScalingPolicy> scalingPolicies = Lists.newArrayList(); + List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList(); - ScalingPolicy scalingPolicy = ScalingPolicy.builder() + CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder() .cooldown(3) .type(ScalingPolicyType.WEBHOOK) .name("scale up by one server") @@ -271,7 +271,7 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest { .build(); scalingPolicies.add(scalingPolicy); - ScalingPolicy updated = ScalingPolicy.builder() + CreateScalingPolicy updated = CreateScalingPolicy.builder() .cooldown(3) .type(ScalingPolicyType.WEBHOOK) .name("scale up by 2 PERCENT server") @@ -280,14 +280,14 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest { .build(); - FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = policyApi.create(scalingPolicies); + FluentIterable<ScalingPolicy> scalingPolicyResponse = policyApi.create(scalingPolicies); String policyId = scalingPolicyResponse.iterator().next().getId(); assertNotNull(policyId); boolean result = policyApi.update(policyId, updated); assertTrue(result); - ScalingPolicyResponse updatedResponse = policyApi.get(policyId); + ScalingPolicy updatedResponse = policyApi.get(policyId); assertNotNull(updatedResponse.getId()); assertEquals(updatedResponse.getCooldown(), 3); @@ -304,9 +304,9 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest { PolicyApi policyApi = api.getPolicyApiForZoneAndGroup(zone, created.get(zone).get(0).getId()); - List<ScalingPolicy> scalingPolicies = Lists.newArrayList(); + List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList(); - ScalingPolicy scalingPolicy = ScalingPolicy.builder() + CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder() .cooldown(3) .type(ScalingPolicyType.WEBHOOK) .name("scale up by one server") @@ -315,7 +315,7 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest { .build(); scalingPolicies.add(scalingPolicy); - FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = policyApi.create(scalingPolicies); + FluentIterable<ScalingPolicy> scalingPolicyResponse = policyApi.create(scalingPolicies); String policyId = scalingPolicyResponse.iterator().next().getId(); assertNotNull(policyId); @@ -330,9 +330,9 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest { PolicyApi policyApi = api.getPolicyApiForZoneAndGroup(zone, created.get(zone).get(0).getId()); - List<ScalingPolicy> scalingPolicies = Lists.newArrayList(); + List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList(); - ScalingPolicy scalingPolicy = ScalingPolicy.builder() + CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder() .cooldown(3) .type(ScalingPolicyType.WEBHOOK) .name("scale up by 0 server") @@ -341,7 +341,7 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest { .build(); scalingPolicies.add(scalingPolicy); - FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = policyApi.create(scalingPolicies); + FluentIterable<ScalingPolicy> scalingPolicyResponse = policyApi.create(scalingPolicies); String policyId = scalingPolicyResponse.iterator().next().getId(); assertNotNull(policyId); @@ -358,15 +358,15 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest { for (Group group : created.get(zone)) { PolicyApi policyApi = api.getPolicyApiForZoneAndGroup(zone, group.getId()); if(policyApi == null)continue; - for(ScalingPolicyResponse sgr : policyApi.list()) { + for(ScalingPolicy sgr : policyApi.list()) { if(!policyApi.delete(sgr.getId())) { System.out.println("Could not delete an autoscale policy after tests!"); } } - List<ScalingPolicy> scalingPolicies = Lists.newArrayList(); + List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList(); - ScalingPolicy scalingPolicy = ScalingPolicy.builder() + CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder() .cooldown(3) .type(ScalingPolicyType.WEBHOOK) .name("0 machines") @@ -375,7 +375,7 @@ public class ScalingPolicyApiLiveTest extends BaseAutoscaleApiLiveTest { .build(); scalingPolicies.add(scalingPolicy); - FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = policyApi.create(scalingPolicies); + FluentIterable<ScalingPolicy> scalingPolicyResponse = policyApi.create(scalingPolicies); String policyId = scalingPolicyResponse.first().get().getId(); Uninterruptibles.sleepUninterruptibly(10, TimeUnit.SECONDS); http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/ScalingPolicyApiMockTest.java ---------------------------------------------------------------------- diff --git a/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/ScalingPolicyApiMockTest.java b/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/ScalingPolicyApiMockTest.java index 0a324cc..f62f287 100644 --- a/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/ScalingPolicyApiMockTest.java +++ b/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/ScalingPolicyApiMockTest.java @@ -26,11 +26,11 @@ import java.io.IOException; import java.util.List; import org.jclouds.rackspace.autoscale.v1.AutoscaleApi; +import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy; +import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyScheduleType; +import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyTargetType; +import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyType; import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy; -import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyScheduleType; -import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyTargetType; -import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyType; -import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicyResponse; import org.jclouds.rackspace.autoscale.v1.internal.BaseAutoscaleApiMockTest; import org.testng.annotations.Test; @@ -56,9 +56,9 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest { AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides); PolicyApi api = autoscaleApi.getPolicyApiForZoneAndGroup("DFW", "groupId1"); - List<ScalingPolicy> scalingPolicies = Lists.newArrayList(); + List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList(); - ScalingPolicy scalingPolicy = ScalingPolicy.builder() + CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder() .cooldown(1800) .type(ScalingPolicyType.WEBHOOK) .name("scale up by one server") @@ -67,7 +67,7 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest { .build(); scalingPolicies.add(scalingPolicy); - FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = api.create(scalingPolicies); + FluentIterable<ScalingPolicy> scalingPolicyResponse = api.create(scalingPolicies); /* * Check request @@ -99,9 +99,9 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest { AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides); PolicyApi api = autoscaleApi.getPolicyApiForZoneAndGroup("DFW", "groupId1"); - List<ScalingPolicy> scalingPolicies = Lists.newArrayList(); + List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList(); - ScalingPolicy scalingPolicy = ScalingPolicy.builder() + CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder() .cooldown(1800) .type(ScalingPolicyType.WEBHOOK) .name("scale up by one server") @@ -110,7 +110,7 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest { .build(); scalingPolicies.add(scalingPolicy); - FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = api.create(scalingPolicies); + FluentIterable<ScalingPolicy> scalingPolicyResponse = api.create(scalingPolicies); /* * Check request @@ -136,9 +136,9 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest { AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides); PolicyApi api = autoscaleApi.getPolicyApiForZoneAndGroup("DFW", "groupId1"); - List<ScalingPolicy> scalingPolicies = Lists.newArrayList(); + List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList(); - ScalingPolicy scalingPolicy = ScalingPolicy.builder() + CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder() .cooldown(2) .type(ScalingPolicyType.SCHEDULE) .name("scale down by 5.5 percent at 11pm") @@ -148,7 +148,7 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest { .build(); scalingPolicies.add(scalingPolicy); - FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = api.create(scalingPolicies); + FluentIterable<ScalingPolicy> scalingPolicyResponse = api.create(scalingPolicies); /* * Check request @@ -183,9 +183,9 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest { AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides); PolicyApi api = autoscaleApi.getPolicyApiForZoneAndGroup("DFW", "groupId1"); - List<ScalingPolicy> scalingPolicies = Lists.newArrayList(); + List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList(); - ScalingPolicy scalingPolicy = ScalingPolicy.builder() + CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder() .cooldown(2) .type(ScalingPolicyType.SCHEDULE) .name("scale down by 5.5 percent on the 5th") @@ -195,7 +195,7 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest { .build(); scalingPolicies.add(scalingPolicy); - FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = api.create(scalingPolicies); + FluentIterable<ScalingPolicy> scalingPolicyResponse = api.create(scalingPolicies); /* * Check request @@ -230,7 +230,7 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest { AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides); PolicyApi api = autoscaleApi.getPolicyApiForZoneAndGroup("DFW", "groupId1"); - FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = api.list(); + FluentIterable<ScalingPolicy> scalingPolicyResponse = api.list(); /* * Check request @@ -262,7 +262,7 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest { AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides); PolicyApi api = autoscaleApi.getPolicyApiForZoneAndGroup("DFW", "groupId1"); - FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = api.list(); + FluentIterable<ScalingPolicy> scalingPolicyResponse = api.list(); /* * Check request @@ -288,7 +288,7 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest { AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides); PolicyApi api = autoscaleApi.getPolicyApiForZoneAndGroup("DFW", "groupId1"); - ScalingPolicyResponse scalingPolicyResponse = api.get("policyId"); + ScalingPolicy scalingPolicyResponse = api.get("policyId"); /* * Check request @@ -319,7 +319,7 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest { AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides); PolicyApi api = autoscaleApi.getPolicyApiForZoneAndGroup("DFW", "groupId1"); - ScalingPolicyResponse scalingPolicyResponse = api.get("policyId"); + ScalingPolicy scalingPolicyResponse = api.get("policyId"); /* * Check request @@ -345,7 +345,7 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest { AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides); PolicyApi api = autoscaleApi.getPolicyApiForZoneAndGroup("DFW", "groupId1"); - ScalingPolicy scalingPolicy = ScalingPolicy.builder() + CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder() .cooldown(6) .type(ScalingPolicyType.WEBHOOK) .name("scale down by 5 percent") @@ -379,7 +379,7 @@ public class ScalingPolicyApiMockTest extends BaseAutoscaleApiMockTest { AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides); PolicyApi api = autoscaleApi.getPolicyApiForZoneAndGroup("DFW", "groupId1"); - ScalingPolicy scalingPolicy = ScalingPolicy.builder() + CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder() .cooldown(6) .type(ScalingPolicyType.WEBHOOK) .name("scale down by 5 percent") http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/WebhookApiLiveTest.java ---------------------------------------------------------------------- diff --git a/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/WebhookApiLiveTest.java b/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/WebhookApiLiveTest.java index 58adad6..2e84fd9 100644 --- a/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/WebhookApiLiveTest.java +++ b/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/WebhookApiLiveTest.java @@ -36,12 +36,12 @@ import org.jclouds.rackspace.autoscale.v1.domain.LaunchConfiguration; import org.jclouds.rackspace.autoscale.v1.domain.LaunchConfiguration.LaunchConfigurationType; import org.jclouds.rackspace.autoscale.v1.domain.LoadBalancer; import org.jclouds.rackspace.autoscale.v1.domain.Personality; +import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy; +import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyTargetType; +import org.jclouds.rackspace.autoscale.v1.domain.CreateScalingPolicy.ScalingPolicyType; import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy; -import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyTargetType; -import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicy.ScalingPolicyType; -import org.jclouds.rackspace.autoscale.v1.domain.ScalingPolicyResponse; +import org.jclouds.rackspace.autoscale.v1.domain.CreateWebhook; import org.jclouds.rackspace.autoscale.v1.domain.Webhook; -import org.jclouds.rackspace.autoscale.v1.domain.WebhookResponse; import org.jclouds.rackspace.autoscale.v1.internal.BaseAutoscaleApiLiveTest; import org.jclouds.rackspace.autoscale.v1.utils.AutoscaleUtils; import org.testng.annotations.AfterClass; @@ -96,9 +96,9 @@ public class WebhookApiLiveTest extends BaseAutoscaleApiLiveTest { .contents("VGhpcyBpcyBhIHRlc3QgZmlsZS4=").build())) .type(LaunchConfigurationType.LAUNCH_SERVER).build(); - List<ScalingPolicy> scalingPolicies = Lists.newArrayList(); + List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList(); - ScalingPolicy scalingPolicy = ScalingPolicy.builder().cooldown(3).type(ScalingPolicyType.WEBHOOK) + CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder().cooldown(3).type(ScalingPolicyType.WEBHOOK) .name("scale up by 1").targetType(ScalingPolicyTargetType.INCREMENTAL).target("1").build(); scalingPolicies.add(scalingPolicy); @@ -161,7 +161,7 @@ public class WebhookApiLiveTest extends BaseAutoscaleApiLiveTest { for (String zone : api.getConfiguredZones()) { Group g = created.get(zone).get(0); WebhookApi webhookApi = api.getWebhookApiForZoneAndGroupAndPolicy(zone, g.getId(), g.getScalingPolicies().iterator().next().getId()); - WebhookResponse webhook = webhookApi.create("test1", ImmutableMap.<String, Object>of("notes", "test metadata")).first().get(); + Webhook webhook = webhookApi.create("test1", ImmutableMap.<String, Object>of("notes", "test metadata")).first().get(); assertEquals(webhook.getName(), "test1"); assertEquals(webhook.getMetadata().get("notes"), "test metadata"); @@ -173,10 +173,10 @@ public class WebhookApiLiveTest extends BaseAutoscaleApiLiveTest { for (String zone : api.getConfiguredZones()) { Group g = created.get(zone).get(0); WebhookApi webhookApi = api.getWebhookApiForZoneAndGroupAndPolicy(zone, g.getId(), g.getScalingPolicies().iterator().next().getId()); - FluentIterable<WebhookResponse> webhookResponse = webhookApi.create( + FluentIterable<Webhook> webhookResponse = webhookApi.create( ImmutableList.of( - Webhook.builder().name("test5").metadata(null).build(), - Webhook.builder().name("test6").metadata(ImmutableMap.<String, Object>of("notes2", "different test")).build() + CreateWebhook.builder().name("test5").metadata(null).build(), + CreateWebhook.builder().name("test6").metadata(ImmutableMap.<String, Object>of("notes2", "different test")).build() )); assertEquals(webhookResponse.get(0).getName(), "test5"); @@ -194,7 +194,7 @@ public class WebhookApiLiveTest extends BaseAutoscaleApiLiveTest { String webhookId = webhookApi.list().first().get().getId(); assertTrue( webhookApi.update(webhookId, "updated_name", ImmutableMap.<String, Object>of()) ); - WebhookResponse webhook= webhookApi.get(webhookId); + Webhook webhook= webhookApi.get(webhookId); assertEquals(webhook.getName(), "updated_name"); assertTrue( webhook.getMetadata().isEmpty() ); } @@ -206,11 +206,11 @@ public class WebhookApiLiveTest extends BaseAutoscaleApiLiveTest { Group g = created.get(zone).get(0); WebhookApi webhookApi; boolean foundWebhook = false; - for (ScalingPolicyResponse sp : g.getScalingPolicies()) { + for (ScalingPolicy sp : g.getScalingPolicies()) { webhookApi = api.getWebhookApiForZoneAndGroupAndPolicy(zone, g.getId(), sp.getId()); - WebhookResponse webhookResponse = webhookApi.list().first().get(); + Webhook webhookResponse = webhookApi.list().first().get(); if (webhookResponse != null) { - WebhookResponse webhookGet = webhookApi.get(webhookResponse.getId()); + Webhook webhookGet = webhookApi.get(webhookResponse.getId()); assertEquals(webhookResponse, webhookGet); foundWebhook = true; } @@ -233,7 +233,7 @@ public class WebhookApiLiveTest extends BaseAutoscaleApiLiveTest { for (String zone : api.getConfiguredZones()) { Group g = created.get(zone).get(0); WebhookApi webhookApi = api.getWebhookApiForZoneAndGroupAndPolicy(zone, g.getId(), g.getScalingPolicies().iterator().next().getId()); - WebhookResponse webhook = webhookApi.create("test1", ImmutableMap.<String, Object>of("notes", "test metadata")).first().get(); + Webhook webhook = webhookApi.create("test1", ImmutableMap.<String, Object>of("notes", "test metadata")).first().get(); assertEquals(webhook.getName(), "test1"); assertEquals(webhook.getMetadata().get("notes"), "test metadata"); @@ -248,7 +248,7 @@ public class WebhookApiLiveTest extends BaseAutoscaleApiLiveTest { for (String zone : api.getConfiguredZones()) { Group g = created.get(zone).get(0); WebhookApi webhookApi = api.getWebhookApiForZoneAndGroupAndPolicy(zone, g.getId(), g.getScalingPolicies().iterator().next().getId()); - WebhookResponse webhook = webhookApi.create("test_execute", ImmutableMap.<String, Object>of("notes", "test metadata")).first().get(); + Webhook webhook = webhookApi.create("test_execute", ImmutableMap.<String, Object>of("notes", "test metadata")).first().get(); assertTrue( AutoscaleUtils.execute(webhook.getAnonymousExecutionURI().get()) , " for " + webhook + " in " + zone); } @@ -259,7 +259,7 @@ public class WebhookApiLiveTest extends BaseAutoscaleApiLiveTest { for (String zone : api.getConfiguredZones()) { Group g = created.get(zone).get(0); WebhookApi webhookApi = api.getWebhookApiForZoneAndGroupAndPolicy(zone, g.getId(), g.getScalingPolicies().iterator().next().getId()); - WebhookResponse webhook = webhookApi.create("test_execute_fail", ImmutableMap.<String, Object>of("notes", "test metadata")).first().get(); + Webhook webhook = webhookApi.create("test_execute_fail", ImmutableMap.<String, Object>of("notes", "test metadata")).first().get(); URI uri = new URI(webhook.getAnonymousExecutionURI().get().toString() + "123"); assertFalse( AutoscaleUtils.execute(uri) ); @@ -274,15 +274,15 @@ public class WebhookApiLiveTest extends BaseAutoscaleApiLiveTest { for (Group group : created.get(zone)) { PolicyApi policyApi = api.getPolicyApiForZoneAndGroup(zone, group.getId()); if(policyApi == null)continue; - for(ScalingPolicyResponse sgr : policyApi.list()) { + for(ScalingPolicy sgr : policyApi.list()) { if(!policyApi.delete(sgr.getId())) { System.out.println("Could not delete an autoscale policy after tests!"); } } - List<ScalingPolicy> scalingPolicies = Lists.newArrayList(); + List<CreateScalingPolicy> scalingPolicies = Lists.newArrayList(); - ScalingPolicy scalingPolicy = ScalingPolicy.builder() + CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder() .cooldown(2) .type(ScalingPolicyType.WEBHOOK) .name("0 machines") @@ -291,7 +291,7 @@ public class WebhookApiLiveTest extends BaseAutoscaleApiLiveTest { .build(); scalingPolicies.add(scalingPolicy); - FluentIterable<ScalingPolicyResponse> scalingPolicyResponse = policyApi.create(scalingPolicies); + FluentIterable<ScalingPolicy> scalingPolicyResponse = policyApi.create(scalingPolicies); String policyId = scalingPolicyResponse.iterator().next().getId(); Uninterruptibles.sleepUninterruptibly(10, TimeUnit.SECONDS); http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/90c7a3a5/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/WebhookApiMockTest.java ---------------------------------------------------------------------- diff --git a/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/WebhookApiMockTest.java b/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/WebhookApiMockTest.java index de3a3db..da39ec3 100644 --- a/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/WebhookApiMockTest.java +++ b/rackspace-autoscale/src/test/java/org/jclouds/rackspace/autoscale/v1/features/WebhookApiMockTest.java @@ -24,8 +24,8 @@ import static org.testng.Assert.assertTrue; import java.io.IOException; import org.jclouds.rackspace.autoscale.v1.AutoscaleApi; +import org.jclouds.rackspace.autoscale.v1.domain.CreateWebhook; import org.jclouds.rackspace.autoscale.v1.domain.Webhook; -import org.jclouds.rackspace.autoscale.v1.domain.WebhookResponse; import org.jclouds.rackspace.autoscale.v1.internal.BaseAutoscaleApiMockTest; import org.testng.annotations.Test; @@ -52,7 +52,7 @@ public class WebhookApiMockTest extends BaseAutoscaleApiMockTest { AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides); WebhookApi api = autoscaleApi.getWebhookApiForZoneAndGroupAndPolicy("DFW", "1234567890", "321456"); - FluentIterable<WebhookResponse> webhooks = api.create("PagerDuty", ImmutableMap.<String, Object>of("notes", "PagerDuty will fire this webhook")); + FluentIterable<Webhook> webhooks = api.create("PagerDuty", ImmutableMap.<String, Object>of("notes", "PagerDuty will fire this webhook")); /* * Check request @@ -79,7 +79,7 @@ public class WebhookApiMockTest extends BaseAutoscaleApiMockTest { AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides); WebhookApi api = autoscaleApi.getWebhookApiForZoneAndGroupAndPolicy("DFW", "1234567890", "321456"); - FluentIterable<WebhookResponse> webhooks = api.create("PagerDuty", ImmutableMap.<String, Object>of("notes", "PagerDuty will fire this webhook")); + FluentIterable<Webhook> webhooks = api.create("PagerDuty", ImmutableMap.<String, Object>of("notes", "PagerDuty will fire this webhook")); /* * Check request @@ -105,9 +105,9 @@ public class WebhookApiMockTest extends BaseAutoscaleApiMockTest { AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides); WebhookApi api = autoscaleApi.getWebhookApiForZoneAndGroupAndPolicy("DFW", "1234567890", "321456"); - FluentIterable<WebhookResponse> webhooks = api.create(ImmutableList.of( - Webhook.builder().name("PagerDuty").metadata(ImmutableMap.<String, Object>of("notes", "PagerDuty will fire this webhook")).build(), - Webhook.builder().name("Nagios").metadata(ImmutableMap.<String, Object>of()).build() + FluentIterable<Webhook> webhooks = api.create(ImmutableList.of( + CreateWebhook.builder().name("PagerDuty").metadata(ImmutableMap.<String, Object>of("notes", "PagerDuty will fire this webhook")).build(), + CreateWebhook.builder().name("Nagios").metadata(ImmutableMap.<String, Object>of()).build() )); /* @@ -136,9 +136,9 @@ public class WebhookApiMockTest extends BaseAutoscaleApiMockTest { AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides); WebhookApi api = autoscaleApi.getWebhookApiForZoneAndGroupAndPolicy("DFW", "1234567890", "321456"); - FluentIterable<WebhookResponse> webhooks = api.create(ImmutableList.of( - Webhook.builder().name("PagerDuty").metadata(ImmutableMap.<String, Object>of("notes", "PagerDuty will fire this webhook")).build(), - Webhook.builder().name("Nagios").metadata(ImmutableMap.<String, Object>of()).build() + FluentIterable<Webhook> webhooks = api.create(ImmutableList.of( + CreateWebhook.builder().name("PagerDuty").metadata(ImmutableMap.<String, Object>of("notes", "PagerDuty will fire this webhook")).build(), + CreateWebhook.builder().name("Nagios").metadata(ImmutableMap.<String, Object>of()).build() )); /* @@ -165,7 +165,7 @@ public class WebhookApiMockTest extends BaseAutoscaleApiMockTest { AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides); WebhookApi api = autoscaleApi.getWebhookApiForZoneAndGroupAndPolicy("DFW", "1234567890", "321456"); - FluentIterable<WebhookResponse> webhooks = api.list(); + FluentIterable<Webhook> webhooks = api.list(); /* * Check request @@ -193,7 +193,7 @@ public class WebhookApiMockTest extends BaseAutoscaleApiMockTest { AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides); WebhookApi api = autoscaleApi.getWebhookApiForZoneAndGroupAndPolicy("DFW", "1234567890", "321456"); - FluentIterable<WebhookResponse> webhooks = api.list(); + FluentIterable<Webhook> webhooks = api.list(); /* * Check request @@ -271,7 +271,7 @@ public class WebhookApiMockTest extends BaseAutoscaleApiMockTest { AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides); WebhookApi api = autoscaleApi.getWebhookApiForZoneAndGroupAndPolicy("DFW", "1234567890", "321456"); - WebhookResponse webhook = api.get("5555"); + Webhook webhook = api.get("5555"); /* * Check request @@ -298,7 +298,7 @@ public class WebhookApiMockTest extends BaseAutoscaleApiMockTest { AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides); WebhookApi api = autoscaleApi.getWebhookApiForZoneAndGroupAndPolicy("DFW", "1234567890", "321456"); - WebhookResponse webhook = api.get("5555"); + Webhook webhook = api.get("5555"); /* * Check request
