Package org.jclouds.rackspace.autoscale.v1.domain

Examples of org.jclouds.rackspace.autoscale.v1.domain.Webhook$Builder


      for (String zone : api.getConfiguredZones()) {

         PolicyApi policyApi = api.getPolicyApiForGroupInZone(created.get(zone).get(0).getId(), zone);

         assertNotNull(policyApi);
         ScalingPolicyResponse listResponse = policyApi.list().iterator().next();
         ScalingPolicyResponse getResponse = policyApi.get(listResponse.getId());
         assertEquals(listResponse.getId(), getResponse.getId());
         assertEquals(listResponse.getName(), getResponse.getName());
         assertEquals(listResponse.getCooldown(), getResponse.getCooldown());
         assertEquals(listResponse.getLinks(), getResponse.getLinks());
         assertEquals(listResponse.getTarget(), getResponse.getTarget());
         assertEquals(listResponse.getTargetType(), getResponse.getTargetType());
         assertEquals(listResponse.getType(), getResponse.getType());
      }
   }
View Full Code Here


         assertNotNull(policyId);

         boolean result = policyApi.update(policyId, updated);
         assertTrue(result);

         ScalingPolicyResponse updatedResponse = policyApi.get(policyId);

         assertNotNull(updatedResponse.getId());
         assertEquals(updatedResponse.getCooldown(), 3);
         assertEquals(updatedResponse.getTarget(), "2");
         assertEquals(updatedResponse.getTargetType(), ScalingPolicyTargetType.PERCENT_CHANGE);
         assertEquals(updatedResponse.getType(), ScalingPolicyType.WEBHOOK);
         assertEquals(updatedResponse.getName(), "scale up by 2 PERCENT server");
      }
   }
View Full Code Here

            responseWithKeystoneAccess,
            authenticatedGET().method("GET").endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(201).payload(payloadFromResource("/autoscale_policy_get_response.json")).build()
            ).getPolicyApiForGroupInZone("groupId1", "DFW");

      ScalingPolicyResponse scalingPolicyResponse = api.get("policyId");

      assertNotNull(scalingPolicyResponse);
      assertEquals(scalingPolicyResponse.getCooldown(), 150);
      assertEquals(scalingPolicyResponse.getId(), "policyId");
      assertEquals(scalingPolicyResponse.getName(), "scale up by one server");
      assertEquals(scalingPolicyResponse.getTarget(), "1");
      assertEquals(scalingPolicyResponse.getLinks().size(), 1);
   }
View Full Code Here

            responseWithKeystoneAccess,
            authenticatedGET().method("GET").endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(404).payload(payloadFromResource("/autoscale_policy_get_response.json")).build()
            ).getPolicyApiForGroupInZone("groupId1", "DFW");

      ScalingPolicyResponse scalingPolicyResponse = api.get("policyId");

      assertNull(scalingPolicyResponse);
   }
View Full Code Here

            responseWithKeystoneAccess,
            authenticatedGET().method("GET").endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(201).payload(payloadFromResource("/autoscale_policy_get_response.json")).build()
            ).getPolicyApiForZoneAndGroup("DFW", "groupId1");

      ScalingPolicyResponse scalingPolicyResponse = api.get("policyId");

      assertNotNull(scalingPolicyResponse);
      assertEquals(scalingPolicyResponse.getCooldown(), 150);
      assertEquals(scalingPolicyResponse.getId(), "policyId");
      assertEquals(scalingPolicyResponse.getName(), "scale up by one server");
      assertEquals(scalingPolicyResponse.getTarget(), "1");
      assertEquals(scalingPolicyResponse.getLinks().size(), 1);
   }
View Full Code Here

   @Test
   public void testCreateWebhook() {
      for (String zone : api.getConfiguredZones()) {
         Group g = created.get(zone).get(0);
         WebhookApi webhookApi = api.getWebhookApiForZoneAndGroupAndPolicy(zone, g.getId(), g.getScalingPolicies().iterator().next().getId());
         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");
      }
   }
View Full Code Here

         Group g = created.get(zone).get(0);
         WebhookApi webhookApi = api.getWebhookApiForZoneAndGroupAndPolicy(zone, g.getId(), g.getScalingPolicies().iterator().next().getId());
         String webhookId = webhookApi.list().first().get().getId();
         assertTrue( webhookApi.update(webhookId, "updated_name", ImmutableMap.<String, Object>of()) );

         Webhook webhook= webhookApi.get(webhookId);
         assertEquals(webhook.getName(), "updated_name");
         assertTrue( webhook.getMetadata().isEmpty() );
      }
   }
View Full Code Here

         Group g = created.get(zone).get(0);
         WebhookApi webhookApi;
         boolean foundWebhook = false;
         for (ScalingPolicy sp :  g.getScalingPolicies()) {
            webhookApi = api.getWebhookApiForZoneAndGroupAndPolicy(zone, g.getId(), sp.getId());
            Webhook webhookResponse = webhookApi.list().first().get();
            if (webhookResponse != null) {
               Webhook webhookGet = webhookApi.get(webhookResponse.getId());
               assertEquals(webhookResponse, webhookGet);
               foundWebhook = true;
            }
         }
         assertTrue(foundWebhook, "No webhooks were found, and some were expected");
View Full Code Here

   @Test
   public void testDeleteWebhook() {
      for (String zone : api.getConfiguredZones()) {
         Group g = created.get(zone).get(0);
         WebhookApi webhookApi = api.getWebhookApiForZoneAndGroupAndPolicy(zone, g.getId(), g.getScalingPolicies().iterator().next().getId());
         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");
        
         assertTrue( webhookApi.delete(webhook.getId()) );
         assertNull( webhookApi.get(webhook.getId()) );
      }
   }
View Full Code Here

   @Test
   public void testExecuteWebhook() throws IOException {
      for (String zone : api.getConfiguredZones()) {
         Group g = created.get(zone).get(0);
         WebhookApi webhookApi = api.getWebhookApiForZoneAndGroupAndPolicy(zone, g.getId(), g.getScalingPolicies().iterator().next().getId());
         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);
      }
   }
View Full Code Here

TOP

Related Classes of org.jclouds.rackspace.autoscale.v1.domain.Webhook$Builder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.