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

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


   public void testGetFlavorById() throws Exception {
      for (String zoneId : zones) {
         FlavorApi flavorApi = api.getFlavorApiForZone(zoneId);
         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


      FlavorInZone flavorInZoneToConvert = new FlavorInZone(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 FlavorInZoneToHardware(locationIndex).apply(flavorInZoneToConvert);

      Flavor flavorToConvert = flavorInZoneToConvert.getFlavor();
      assertEquals(converted.getName(), flavorToConvert.getName());
      assertEquals(converted.getId(), flavorInZoneToConvert.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

   @Override
   public Hardware apply(FlavorInZone flavorInZone) {
      Location location = locationIndex.get().get(flavorInZone.getZone());
      checkState(location != null, "location %s not in locationIndex: %s", flavorInZone.getZone(), locationIndex.get());
      Flavor flavor = flavorInZone.getFlavor();
      return new HardwareBuilder().id(flavorInZone.slashEncode()).providerId(flavor.getId()).name(flavor.getName())
               .ram(flavor.getRam()).processor(new Processor(flavor.getVcpus(), 1.0)).volume(
                        new VolumeImpl(Float.valueOf(flavor.getDisk()), true, true)).location(location).build();
   }
View Full Code Here

   public void testGetFlavorById() throws Exception {
      for (String zoneId : zones) {
         FlavorApi flavorApi = api.getFlavorApiForZone(zoneId);
         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

      FlavorInZone flavorInZoneToConvert = new FlavorInZone(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 FlavorInZoneToHardware(locationIndex).apply(flavorInZoneToConvert);

      Flavor flavorToConvert = flavorInZoneToConvert.getFlavor();
      assertEquals(converted.getName(), flavorToConvert.getName());
      assertEquals(converted.getId(), flavorInZoneToConvert.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

   @Override
   public Hardware apply(FlavorInZone flavorInZone) {
      Location location = locationIndex.get().get(flavorInZone.getZone());
      checkState(location != null, "location %s not in locationIndex: %s", flavorInZone.getZone(), locationIndex.get());
      Flavor flavor = flavorInZone.getFlavor();
      return new HardwareBuilder().id(flavorInZone.slashEncode()).providerId(flavor.getId()).name(flavor.getName())
               .ram(flavor.getRam()).processor(new Processor(flavor.getVcpus(), 1.0)).volume(
                        new VolumeImpl(Float.valueOf(flavor.getDisk()), true, true)).location(location).build();
   }
View Full Code Here

   public void testGetFlavorById() throws Exception {
      for (String zoneId : zones) {
         FlavorApi flavorApi = api.getFlavorApiForZone(zoneId);
         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

      FlavorInZone flavorInZoneToConvert = new FlavorInZone(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 FlavorInZoneToHardware(locationIndex).apply(flavorInZoneToConvert);

      Flavor flavorToConvert = flavorInZoneToConvert.getFlavor();
      assertEquals(converted.getName(), flavorToConvert.getName());
      assertEquals(converted.getId(), flavorInZoneToConvert.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

   @Override
   public Hardware apply(FlavorInZone flavorInZone) {
      Location location = locationIndex.get().get(flavorInZone.getZone());
      checkState(location != null, "location %s not in locationIndex: %s", flavorInZone.getZone(), locationIndex.get());
      Flavor flavor = flavorInZone.getFlavor();
      return new HardwareBuilder().id(flavorInZone.slashEncode()).providerId(flavor.getId()).name(flavor.getName())
               .ram(flavor.getRam()).processor(new Processor(flavor.getVcpus(), 1.0)).volume(
                        new VolumeImpl(Float.valueOf(flavor.getDisk()), true, true)).location(location).build();
   }
View Full Code Here

   @Override
   public Hardware apply(FlavorInRegion flavorInRegion) {
      Location location = locationIndex.get().get(flavorInRegion.getRegion());
      checkState(location != null, "location %s not in locationIndex: %s", flavorInRegion.getRegion(), locationIndex.get());
      Flavor flavor = flavorInRegion.getFlavor();
      return new HardwareBuilder().id(flavorInRegion.slashEncode()).providerId(flavor.getId()).name(flavor.getName())
               .ram(flavor.getRam()).processor(new Processor(flavor.getVcpus(), 1.0)).volume(
                        new VolumeImpl(Float.valueOf(flavor.getDisk()), true, true)).location(location).build();
   }
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.