Package org.jclouds.rackspace.autoscale.v1

Examples of org.jclouds.rackspace.autoscale.v1.AutoscaleApiMetadata$Builder


   @Test
   public void testCreateWebhook() {
      for (String zone : api.getConfiguredZones()) {
         Group g = created.get(zone).get(0);
         WebhookApi webhookApi = api.getWebhookApiForGroupAndPolicyInZone(g.getId(), g.getScalingPolicies().iterator().next().getId(), zone);
         WebhookResponse 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.getWebhookApiForGroupAndPolicyInZone(g.getId(), g.getScalingPolicies().iterator().next().getId(), zone);
         String webhookId = webhookApi.list().first().get().getId();
         assertTrue( webhookApi.update(webhookId, "updated_name", ImmutableMap.<String, Object>of()) );

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

   @Test
   public void testGetWebhook() {
      for (String zone : api.getConfiguredZones()) {
         Group g = created.get(zone).get(0);
         WebhookApi webhookApi = api.getWebhookApiForGroupAndPolicyInZone(g.getId(), g.getScalingPolicies().iterator().next().getId(), zone);
         WebhookResponse webhookList = webhookApi.list().first().get();
         WebhookResponse webhookGet = webhookApi.get(webhookList.getId());
         assertNotNull(webhookList);
         assertNotNull(webhookGet);
         assertEquals(webhookList, webhookGet);
      }
   }
View Full Code Here

   @Test
   public void testDeleteWebhook() {
      for (String zone : api.getConfiguredZones()) {
         Group g = created.get(zone).get(0);
         WebhookApi webhookApi = api.getWebhookApiForGroupAndPolicyInZone(g.getId(), g.getScalingPolicies().iterator().next().getId(), zone);
         WebhookResponse 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.getWebhookApiForGroupAndPolicyInZone(g.getId(), g.getScalingPolicies().iterator().next().getId(), zone);
         WebhookResponse 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

   @Test
   public void testExecuteWebhookFail() throws IOException, URISyntaxException {
      for (String zone : api.getConfiguredZones()) {
         Group g = created.get(zone).get(0);
         WebhookApi webhookApi = api.getWebhookApiForGroupAndPolicyInZone(g.getId(), g.getScalingPolicies().iterator().next().getId(), zone);
         WebhookResponse webhook = webhookApi.create("test_execute_fail", ImmutableMap.<String, Object>of("notes", "test metadata")).first().get();
        
         URI uri = new URI(webhook.getAnonymousExecutionURI().toString() + "123");
         assertFalse( AutoscaleUtils.execute(uri) );
      }
   }
View Full Code Here

            responseWithKeystoneAccess,
            authenticatedGET().endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(201).payload(payloadFromResource("/autoscale_webhook_get_response.json")).build()
            ).getWebhookApiForGroupAndPolicyInZone("1234567890", "321456", "DFW");

      WebhookResponse webhook = api.get("5555");
      assertEquals(webhook.getName(), "alice");
      assertEquals(webhook.getLinks().size(), 2);
   }
View Full Code Here

            responseWithKeystoneAccess,
            authenticatedGET().endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(404).payload(payloadFromResource("/autoscale_webhook_get_response.json")).build()
            ).getWebhookApiForGroupAndPolicyInZone("1234567890", "321456", "DFW");

      WebhookResponse webhook = api.get("5555");
      assertNull(webhook);
   }
View Full Code Here

            responseWithKeystoneAccess,
            authenticatedGET().endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(201).payload(payloadFromResource("/autoscale_webhook_get_response.json")).build()
            ).getWebhookApiForZoneAndGroupAndPolicy("DFW", "1234567890", "321456");

      WebhookResponse webhook = api.get("5555");
      assertEquals(webhook.getName(), "alice");
      assertEquals(webhook.getLinks().size(), 2);
   }
View Full Code Here

            responseWithKeystoneAccess,
            authenticatedGET().endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(404).payload(payloadFromResource("/autoscale_webhook_get_response.json")).build()
            ).getWebhookApiForZoneAndGroupAndPolicy("DFW", "1234567890", "321456");

      WebhookResponse webhook = api.get("5555");
      assertNull(webhook);
   }
View Full Code Here

TOP

Related Classes of org.jclouds.rackspace.autoscale.v1.AutoscaleApiMetadata$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.