Package org.jclouds.openstack.trove.v1.features

Examples of org.jclouds.openstack.trove.v1.features.FlavorApi


      ImageApi imageApi = api.getImageApiForZone(zoneId);
      return Iterables.getLast(imageApi.list().concat()).getId();
   }

   protected String flavorRefForZone(String zoneId) {
      FlavorApi flavorApi = api.getFlavorApiForZone(zoneId);
      return DEFAULT_FLAVOR_ORDERING.min(flavorApi.listInDetail().concat()).getId();
   }
View Full Code Here


      }

      @Override
      protected Function<Object, IterableWithMarker<Resource>> markerToNextForArg0(Optional<Object> arg0) {
         String zone = arg0.get().toString();
         final FlavorApi flavorApi = api.getFlavorApiForZone(zone);
         return new Function<Object, IterableWithMarker<Resource>>() {

            @SuppressWarnings("unchecked")
            @Override
            public IterableWithMarker<Resource> apply(Object input) {
               PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
               return IterableWithMarker.class.cast(flavorApi.list(paginationOptions));
            }

            @Override
            public String toString() {
               return "listFlavors()";
View Full Code Here

      }

      @Override
      protected Function<Object, IterableWithMarker<Flavor>> markerToNextForArg0(Optional<Object> arg0) {
         String zone = arg0.get().toString();
         final FlavorApi flavorApi = api.getFlavorApiForZone(zone);
         return new Function<Object, IterableWithMarker<Flavor>>() {

            @SuppressWarnings("unchecked")
            @Override
            public IterableWithMarker<Flavor> apply(Object input) {
               PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
               return IterableWithMarker.class.cast(flavorApi.listInDetail(paginationOptions));
            }

            @Override
            public String toString() {
               return "listFlavorsInDetail()";
View Full Code Here

      }

      @Override
      protected Function<Object, IterableWithMarker<Resource>> markerToNextForArg0(Optional<Object> arg0) {
         String region = arg0.get().toString();
         final FlavorApi flavorApi = api.getFlavorApi(region);
         return new Function<Object, IterableWithMarker<Resource>>() {

            @SuppressWarnings("unchecked")
            @Override
            public IterableWithMarker<Resource> apply(Object input) {
               PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
               return IterableWithMarker.class.cast(flavorApi.list(paginationOptions));
            }

            @Override
            public String toString() {
               return "listFlavors()";
View Full Code Here

      }

      @Override
      protected Function<Object, IterableWithMarker<Flavor>> markerToNextForArg0(Optional<Object> arg0) {
         String region = arg0.get().toString();
         final FlavorApi flavorApi = api.getFlavorApi(region);
         return new Function<Object, IterableWithMarker<Flavor>>() {

            @SuppressWarnings("unchecked")
            @Override
            public IterableWithMarker<Flavor> apply(Object input) {
               PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
               return IterableWithMarker.class.cast(flavorApi.listInDetail(paginationOptions));
            }

            @Override
            public String toString() {
               return "listFlavorsInDetail()";
View Full Code Here

      // Get the first image from the list as it tends to be "lighter" and faster to start
      return Iterables.get(imageApi.list().concat(), 0).getId();
   }

   protected String flavorRefForRegion(String regionId) {
      FlavorApi flavorApi = api.getFlavorApi(regionId);
      return DEFAULT_FLAVOR_ORDERING.min(flavorApi.listInDetail().concat()).getId();
   }
View Full Code Here

      assertEquals(flavor.getLinks().size(), 2);
   }
  
   public void testGetFlavorByAccountId() {
        URI endpoint = URI.create("http://172.16.0.1:8776/v1/3456/flavors/40806637803162");
        TroveApi redDwarfApi = requestsSendResponses(
               keystoneAuthWithUsernameAndPasswordAndTenantName,
               responseWithKeystoneAccess,
               authenticatedGET().endpoint(endpoint).build(),
               HttpResponse.builder().statusCode(200).payload(payloadFromResource("/flavor_list.json")).build() );
        FlavorApi api = redDwarfApi.getFlavorApiForZone("RegionOne");

        Set<? extends Flavor> flavors = api.list( redDwarfApi.getCurrentTenantId().get().getId() ).toSet();
        Flavor flavor = flavors.iterator().next();
        assertEquals(flavor.getName(), "512MB Instance");
        assertEquals(flavor.getId(), 1);
        assertEquals(flavor.getRam(), 512);
        assertEquals(flavor.getLinks().size(), 2);
View Full Code Here

      HttpResponse authenticationResponse = HttpResponse.builder()
            .statusCode(200)
            .payload(payloadFromResourceWithContentType("/access_rax_us.json", "application/json"))
            .build();

      TroveApi whenRegionExists = requestSendsResponse(authenticate, authenticationResponse);

      assertEquals(whenRegionExists.getConfiguredZones(), ImmutableSet.of("ORD", "DFW", "SYD"));

   }
View Full Code Here

      HttpResponse authenticationResponse = HttpResponse.builder()
            .statusCode(200)
            .payload(payloadFromResourceWithContentType("/access_rax_uk.json", "application/json"))
            .build();

      TroveApi whenNovaRegionExists = requestSendsResponse(authenticate, authenticationResponse);

      assertEquals(whenNovaRegionExists.getConfiguredZones(), ImmutableSet.of("LON"));

   }
View Full Code Here

        HttpResponse deleteInstanceResponse = HttpResponse.builder().statusCode(202).build();

        List<HttpRequest> requests = ImmutableList.ofkeystoneAuthWithUsernameAndPasswordAndTenantName, createInstance,     createInstance,     createInstance,        getInstance, deleteInstance,         getInstance,   createInstance,     createInstance,        getInstance);
        List<HttpResponse> responses = ImmutableList.of(responseWithKeystoneAccess,                       createInstanceFail, createInstanceFail, createInstanceSuccess, badStatus,   deleteInstanceResponse, deletedStatus, createInstanceFail, createInstanceSuccess, goodStatus);

        TroveApi api = orderedRequestsSendResponses(requests, responses);

        TroveUtils utils = new TroveUtils(api);
        Instance instance = utils.getWorkingInstance("RegionOne", "json_rack_instance", "1", 2);
        assertEquals(instance.getSize(),2);
        assertEquals(instance.getName(), "json_rack_instance")
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.trove.v1.features.FlavorApi

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.