Package org.jclouds.openstack.v2_0.internal

Examples of org.jclouds.openstack.v2_0.internal.BaseOpenStackMockTest


            responseWithAccess,
            authenticatedGET().endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(OK.getStatusCode()).payload(payloadFromResource("/limit-list.json")).build()
      ).getLimitApi();

      Limits limits = api.list();
      assertEquals(limits.getAbsoluteLimits().get("records per domain"), Integer.valueOf(500));
      assertEquals(limits.getAbsoluteLimits().get("domains"), Integer.valueOf(500));
      assertEquals(Iterables.size(limits.getRateLimits()), 2);
     
      RateLimit statusRateLimit = Iterables.tryFind(limits.getRateLimits(), isStatusRateLimit()).orNull();
      assertEquals(statusRateLimit.getRegex(), ".*/v\\d+\\.\\d+/(\\d+/status).*");
      assertEquals(Iterables.get(statusRateLimit.getLimits(), 0).getVerb(), "GET");
      assertEquals(Iterables.get(statusRateLimit.getLimits(), 0).getValue(), 5);
      assertEquals(Iterables.get(statusRateLimit.getLimits(), 0).getRemaining().get(), Integer.valueOf(5));
      assertEquals(Iterables.get(statusRateLimit.getLimits(), 0).getUnit(), "SECOND");
View Full Code Here


*/
@Test(groups = "live", singleThreaded = true, testName = "LimitApiLiveTest")
public class LimitApiLiveTest extends BaseCloudDNSApiLiveTest {
   @Test
   public void testList() throws Exception {
      Limits limits = api.getLimitApi().list();
      assertNotNull(limits.getAbsoluteLimits());
      assertNotNull(limits.getRateLimits());
      assertTrue(limits.getAbsoluteLimits().size() > 1);
      assertTrue(Iterables.size(limits.getRateLimits()) > 1);
   }
View Full Code Here

            responseWithAccess,
            authenticatedGET().endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(OK.getStatusCode()).payload(payloadFromResource("/limit-list.json")).build()
      ).getLimitApi();

      Limits limits = api.list();
      assertEquals(limits.getAbsoluteLimits().get("records per domain"), Integer.valueOf(500));
      assertEquals(limits.getAbsoluteLimits().get("domains"), Integer.valueOf(500));
      assertEquals(Iterables.size(limits.getRateLimits()), 2);
     
      RateLimit statusRateLimit = Iterables.tryFind(limits.getRateLimits(), isStatusRateLimit()).orNull();
      assertEquals(statusRateLimit.getRegex(), ".*/v\\d+\\.\\d+/(\\d+/status).*");
      assertEquals(Iterables.get(statusRateLimit.getLimits(), 0).getVerb(), "GET");
      assertEquals(Iterables.get(statusRateLimit.getLimits(), 0).getValue(), 5);
      assertEquals(Iterables.get(statusRateLimit.getLimits(), 0).getRemaining().get(), Integer.valueOf(5));
      assertEquals(Iterables.get(statusRateLimit.getLimits(), 0).getUnit(), "SECOND");
View Full Code Here

        
      }

      ImmutableList.Builder<Link> links = ImmutableList.builder();
      for(Map<String, String> linkMap : (List<Map<String, String>>) scalingPolicyMap.get("links")) {
         Link link = Link.builder().href(URI.create(linkMap.get("href"))).relation(Relation.fromValue(linkMap.get("rel"))).build();
         links.add(link);
      }

      Double d = (Double)scalingPolicyMap.get(targetType.toString()); // GSON only knows double now
      ScalingPolicyResponse scalingPolicyResponse =
View Full Code Here

           
         }

         ImmutableList.Builder<Link> links = ImmutableList.builder();
         for(Map<String, String> linkMap : (List<Map<String, String>>) scalingPolicyMap.get("links")) {
            Link link = Link.builder().href(URI.create(linkMap.get("href"))).relation(Relation.fromValue(linkMap.get("rel"))).build();
            links.add(link);
         }

         Double d = (Double)scalingPolicyMap.get(targetType.toString()); // GSON only knows double now
         ScalingPolicyResponse scalingPolicyResponse =
View Full Code Here

           
         }

         ImmutableList.Builder<Link> links = ImmutableList.builder();
         for(Map<String, String> linkMap : (List<Map<String, String>>) scalingPolicyMap.get("links")) {
            Link link = Link.builder().href(URI.create(linkMap.get("href"))).relation(Relation.fromValue(linkMap.get("rel"))).build();
            links.add(link);
         }

         Double d = (Double)scalingPolicyMap.get(targetType.toString()); // GSON only knows double now

         ScalingPolicyResponse scalingPolicyResponse =
               new ScalingPolicyResponse(
                     (String)scalingPolicyMap.get("name"),
                     ScalingPolicyType.getByValue((String)scalingPolicyMap.get("type")).get(),
                     ((Double)scalingPolicyMap.get("cooldown")).intValue(),
                     DoubleMath.isMathematicalInteger(d) ? Integer.toString(d.intValue()) : Double.toString(d),
                           targetType,
                           ImmutableList.copyOf(links.build()),
                           (String) scalingPolicyMap.get("id")
                     );
         scalingPoliciesList.add(scalingPolicyResponse);
      }

      ImmutableList.Builder<Link> links = ImmutableList.builder();
      for(Map<String, String> linkMap : (List<Map<String, String>>) group.get("links")) {
         Link link = Link.builder().href(URI.create(linkMap.get("href"))).relation(Relation.fromValue(linkMap.get("rel"))).build();
         links.add(link);
      }

      String groupId = (String) group.get("id");
      return Group.builder()
View Full Code Here

        
      }

      ImmutableList.Builder<Link> links = ImmutableList.builder();
      for(Map<String, String> linkMap : (List<Map<String, String>>) scalingPolicyMap.get("links")) {
         Link link = Link.builder().href(URI.create(linkMap.get("href"))).relation(Relation.fromValue(linkMap.get("rel"))).build();
         links.add(link);
      }

      Double d = (Double)scalingPolicyMap.get(targetType.toString()); // GSON only knows double now
      ScalingPolicy scalingPolicyResponse =
View Full Code Here

           
         }

         ImmutableList.Builder<Link> links = ImmutableList.builder();
         for(Map<String, String> linkMap : (List<Map<String, String>>) scalingPolicyMap.get("links")) {
            Link link = Link.builder().href(URI.create(linkMap.get("href"))).relation(Relation.fromValue(linkMap.get("rel"))).build();
            links.add(link);
         }

         Double d = (Double)scalingPolicyMap.get(targetType.toString()); // GSON only knows double now
         ScalingPolicy scalingPolicyResponse =
View Full Code Here

           
         }

         ImmutableList.Builder<Link> links = ImmutableList.builder();
         for(Map<String, String> linkMap : (List<Map<String, String>>) scalingPolicyMap.get("links")) {
            Link link = Link.builder().href(URI.create(linkMap.get("href"))).relation(Relation.fromValue(linkMap.get("rel"))).build();
            links.add(link);
         }

         Double d = (Double)scalingPolicyMap.get(targetType.toString()); // GSON only knows double now

         ScalingPolicy scalingPolicyResponse =
               new ScalingPolicy(
                     (String)scalingPolicyMap.get("name"),
                     ScalingPolicyType.getByValue((String)scalingPolicyMap.get("type")).get(),
                     ((Double)scalingPolicyMap.get("cooldown")).intValue(),
                     DoubleMath.isMathematicalInteger(d) ? Integer.toString(d.intValue()) : Double.toString(d),
                           targetType,
                           (Map<String, String>) scalingPolicyMap.get("args"),
                           ImmutableList.copyOf(links.build()),
                           (String) scalingPolicyMap.get("id")
                     );
         scalingPoliciesList.add(scalingPolicyResponse);
      }

      ImmutableList.Builder<Link> links = ImmutableList.builder();
      for(Map<String, String> linkMap : (List<Map<String, String>>) group.get("links")) {
         Link link = Link.builder().href(URI.create(linkMap.get("href"))).relation(Relation.fromValue(linkMap.get("rel"))).build();
         links.add(link);
      }

      String groupId = (String) group.get("id");
      return Group.builder()
View Full Code Here

        
      }

      ImmutableList.Builder<Link> links = ImmutableList.builder();
      for (Map<String, String> linkMap : (List<Map<String, String>>) scalingPolicyMap.get("links")) {
         Link link = Link.builder().href(URI.create(linkMap.get("href"))).relation(Relation.fromValue(linkMap.get("rel"))).build();
         links.add(link);
      }

      Double d = (Double)scalingPolicyMap.get(targetType.toString()); // GSON only knows double now
      ScalingPolicy scalingPolicyResponse =
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.v2_0.internal.BaseOpenStackMockTest

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.