Examples of WebHook


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

   @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

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

         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

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

         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

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

   @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

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

   @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

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

   @Test
   public void testExecuteWebhookFail() throws IOException, URISyntaxException {
      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_fail", ImmutableMap.<String, Object>of("notes", "test metadata")).first().get();
        
         URI uri = new URI(webhook.getAnonymousExecutionURI().get().toString() + "123");
         assertFalse( AutoscaleUtils.execute(uri) );
      }
   }
View Full Code Here

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

      try {
         AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides);
         WebhookApi api = autoscaleApi.getWebhookApiForZoneAndGroupAndPolicy("DFW", "1234567890", "321456");        

         Webhook webhook = api.get("5555");

         /*
          * Check request
          */
         assertAuthentication(server);
         assertRequest(server.takeRequest(), "GET", "/v1.0/888888/groups/1234567890/policies/321456/webhooks/5555");

         /*
          * Check response
          */
         assertEquals(webhook.getName(), "alice");
         assertEquals(webhook.getLinks().size(), 2);
      } finally {
         server.shutdown();
      }
   }
View Full Code Here

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

      try {
         AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides);
         WebhookApi api = autoscaleApi.getWebhookApiForZoneAndGroupAndPolicy("DFW", "1234567890", "321456");        

         Webhook webhook = api.get("5555");

         /*
          * Check request
          */
         assertAuthentication(server);
View Full Code Here

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

      System.out.format("  %s%n", result);

      System.out.format("Execute Webhook - again, anonymously%n");

      Webhook webhook = webhookApi.list().first().get();
      try {
         result = AutoscaleUtils.execute(webhook.getAnonymousExecutionURI().get());
      } catch (IOException e) {
         e.printStackTrace();
      }

      System.out.format("  %s%n", result);
View Full Code Here

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

      try {
         AutoscaleApi autoscaleApi = api(server.getUrl("/").toString(), "rackspace-autoscale", overrides);
         WebhookApi api = autoscaleApi.getWebhookApiForZoneAndGroupAndPolicy("DFW", "1234567890", "321456");        

         Webhook webhook = api.get("5555");

         /*
          * Check request
          */
         assertAuthentication(server);
         assertRequest(server.takeRequest(), "GET", "/v1.0/888888/groups/1234567890/policies/321456/webhooks/5555");

         /*
          * Check response
          */
         assertEquals(webhook.getName(), "alice");
         assertEquals(webhook.getLinks().size(), 2);
      } finally {
         server.shutdown();
      }
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.