Package org.jclouds.openstack.reddwarf.v1.domain

Examples of org.jclouds.openstack.reddwarf.v1.domain.Flavor


      FlavorInRegion flavorInRegionToConvert = new FlavorInRegion(Flavor.builder().id(id.toString())
               .name("Test Flavor " + id).ram(262144).disk(10000).vcpus(16).build(), "az-1.region-a.geo-1");

      Hardware converted = new FlavorInRegionToHardware(locationIndex).apply(flavorInRegionToConvert);

      Flavor flavorToConvert = flavorInRegionToConvert.getFlavor();
      assertEquals(converted.getName(), flavorToConvert.getName());
      assertEquals(converted.getId(), flavorInRegionToConvert.slashEncode());
      assertEquals(converted.getProviderId(), flavorToConvert.getId());
      assertEquals(converted.getLocation(), locationIndex.get().get("az-1.region-a.geo-1"));

      assertEquals(converted.getRam(), flavorToConvert.getRam());

      assertNotNull(converted.getProcessors());
      assertFalse(converted.getProcessors().isEmpty());
      assertEquals(converted.getProcessors().iterator().next().getCores(), (double) flavorToConvert.getVcpus());

      assertNotNull(converted.getVolumes());
      assertFalse(converted.getVolumes().isEmpty());
      assertEquals(converted.getVolumes().iterator().next().getSize(), Float.valueOf(flavorToConvert.getDisk()));

   }
View Full Code Here


   public void testGetFlavorById() throws Exception {
      for (String regionId : regions) {
         FlavorApi flavorApi = api.getFlavorApi(regionId);
         Set<? extends Flavor> response = flavorApi.listInDetail().concat().toSet();
         for (Flavor flavor : response) {
            Flavor details = flavorApi.get(flavor.getId());
            assertNotNull(details);
            assertEquals(details.getId(), flavor.getId());
            assertEquals(details.getName(), flavor.getName());
            assertEquals(details.getLinks(), flavor.getLinks());
            assertEquals(details.getRam(), flavor.getRam());
            assertEquals(details.getDisk(), flavor.getDisk());
            assertEquals(details.getVcpus(), flavor.getVcpus());
         }
      }
   }
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");
        RedDwarfApi 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

            responseWithKeystoneAccess,
            authenticatedGET().endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(200).payload(payloadFromResource("/flavor_get.json")).build()
      ).getFlavorApiForZone("RegionOne");

      Flavor flavor = api.get(1);
      assertEquals(flavor.getName(), "512MB Instance");
      assertEquals(flavor.getId(), 1);
      assertEquals(flavor.getRam(), 512);
      assertEquals(flavor.getLinks().size(), 2);
   }
View Full Code Here

               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

    @Test
    public void testGetFlavor() {
        for (String zone : api.getConfiguredZones()) {
            FlavorApi flavorApi = api.getFlavorApiForZone(zone);          
            for (Flavor flavor : flavorApi.list()) {
                Flavor flavorFromGet = flavorApi.get(flavor.getId());
                assertEquals(flavorFromGet.getId(), flavor.getId());
                assertEquals(flavorFromGet.getRam(), flavor.getRam());
                assertEquals(flavorFromGet.getName(), flavor.getName());
                assertEquals(flavorFromGet.getLinks(), flavor.getLinks());
            }
        }
    }
View Full Code Here

            responseWithKeystoneAccess,
            authenticatedGET().endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(200).payload(payloadFromResource("/flavor_get.json")).build()
      ).getFlavorApiForZone("RegionOne");

      Flavor flavor = api.get(1);
      assertEquals(flavor.getName(), "512MB Instance");
      assertEquals(flavor.getId(), 1);
      assertEquals(flavor.getRam(), 512);
      assertEquals(flavor.getLinks().size(), 2);
   }
View Full Code Here

               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

    @Test
    public void testGetFlavor() {
        for (String zone : api.getConfiguredZones()) {
            FlavorApi flavorApi = api.getFlavorApiForZone(zone);          
            for (Flavor flavor : flavorApi.list()) {
                Flavor flavorFromGet = flavorApi.get(flavor.getId());
                assertEquals(flavorFromGet.getId(), flavor.getId());
                assertEquals(flavorFromGet.getRam(), flavor.getRam());
                assertEquals(flavorFromGet.getName(), flavor.getName());
                assertEquals(flavorFromGet.getLinks(), flavor.getLinks());
            }
        }
    }
View Full Code Here

            responseWithKeystoneAccess,
            authenticatedGET().endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(200).payload(payloadFromResource("/flavor_get.json")).build()
      ).getFlavorApiForZone("RegionOne");

      Flavor flavor = api.get(1);
      assertEquals(flavor.getName(), "512MB Instance");
      assertEquals(flavor.getId(), 1);
      assertEquals(flavor.getRam(), 512);
      assertEquals(flavor.getLinks().size(), 2);
   }
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.reddwarf.v1.domain.Flavor

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.