Package org.jclouds.compute.domain

Examples of org.jclouds.compute.domain.HardwareBuilder


                  .operatingSystem(
                        OperatingSystem.builder().name("Ubuntu 10.04 LTS 32-bit").family(OsFamily.UBUNTU).version("10.04")
                              .is64Bit(false).description("Ubuntu 10.04 LTS 32-bit").build())
                  .publicAddresses(ImmutableSet.of("31.192.231.254"))
                  .hardware(
                        new HardwareBuilder().ids("vz1840356").ram(512)
                              .processors(ImmutableList.of(new Processor(1, 1.0)))
                              .volumes(ImmutableList.<Volume> of(new VolumeImpl(5f, true, true))).hypervisor("OpenVZ")
                              .build()).status(Status.RUNNING).build().toString());
   }
View Full Code Here


         metadataMap = ImmutableMap.of();
      }
      builder.group(groupFromMapOrName(metadataMap, from.getHostname(), nodeNamingConvention));
      builder.imageId(from.getTemplateName() + "");
      builder.operatingSystem(parseOperatingSystem(from));
      builder.hardware(new HardwareBuilder().ids(from.getId() + "").ram(from.getMemorySizeMB())
            .processors(ImmutableList.of(new Processor(from.getCpuCores(), 1.0)))
            .volumes(ImmutableList.<Volume> of(new VolumeImpl((float) from.getDiskSizeGB(), true, true)))
            .hypervisor(from.getPlatform()).build());
      builder.status(serverStateToNodeStatus.get(from.getState()));
      Iterable<String> addresses = Iterables.filter(Iterables.transform(from.getIps(), new Function<Ip, String>() {
View Full Code Here

   @Override
   public Hardware apply(ServerSpec spec) {
      Location location = FluentIterable.from(locations.get()).firstMatch(idEquals(spec.getDatacenter())).orNull();
      assert location != null : String.format("no location matched ServerSpec %s", spec);
      return new HardwareBuilder().ids(spec.toString()).ram(spec.getMemorySizeMB()).processors(
               ImmutableList.of(new Processor(spec.getCpuCores(), 1.0))).volumes(
               ImmutableList.<Volume> of(new VolumeImpl((float) spec.getDiskSizeGB(), true, true))).hypervisor(
               spec.getPlatform()).location(location).supportsImage(
               ImagePredicates.idEquals(spec.getTemplateName())).build();
   }
View Full Code Here

   GroupNamingConvention.Factory namingConvention = Guice.createInjector().getInstance(GroupNamingConvention.Factory.class);

   @Test
   public void testWhenNoHardwareOrImageMatchServerScopedIdsImageIdIsStillSet() {

      Hardware existingHardware = new HardwareBuilder().id("az-1.region-a.geo-1/FOOOOOOOO").providerId("FOOOOOOOO")
            .location(zone).build();
      Image existingImage = new ImageBuilder().id("az-1.region-a.geo-1/FOOOOOOOO")
            .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
            .providerId("FOOOOOOOO").description("foobuntu").location(zone).status(Image.Status.AVAILABLE).build();
View Full Code Here

   }

   @Test
   public void testWhenNoHardwareAndImageMatchServerScopedIdsHardwareOperatingSystemAndImageIdAreSet() {

      Hardware existingHardware = new HardwareBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f216543fd")
            .providerId("52415800-8b69-11e0-9b19-734f216543fd").location(zone).build();
      Image existingImage = new ImageBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f6f006e54")
            .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
            .providerId("52415800-8b69-11e0-9b19-734f6f006e54").description("foobuntu").status(Image.Status.AVAILABLE)
            .location(zone).build();
View Full Code Here

            existingImage.getOperatingSystem(), existingImage);
   }

   @Test
   public void testNullAccessIPs() {
      Hardware existingHardware = new HardwareBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f216543fd")
            .providerId("52415800-8b69-11e0-9b19-734f216543fd").location(zone).build();
      Image existingImage = new ImageBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f6f006e54")
            .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
            .providerId("52415800-8b69-11e0-9b19-734f6f006e54").description("foobuntu").status(Image.Status.AVAILABLE)
            .location(zone).build();
View Full Code Here

      assertEquals(convertedNodeMetadata.getPublicAddresses(), ImmutableSet.of("67.23.10.132", "67.23.10.131"));
   }

   @Test
   public void testDuplicateAccessIPs() {
      Hardware existingHardware = new HardwareBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f216543fd")
            .providerId("52415800-8b69-11e0-9b19-734f216543fd").location(zone).build();
      Image existingImage = new ImageBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f6f006e54")
            .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
            .providerId("52415800-8b69-11e0-9b19-734f6f006e54").description("foobuntu").status(Image.Status.AVAILABLE)
            .location(zone).build();
View Full Code Here

      assertEquals(convertedNodeMetadata.getPublicAddresses(), ImmutableSet.of("67.23.10.132", "67.23.10.131"));
   }

   @Test
   public void testAlternateAccessIPs() {
      Hardware existingHardware = new HardwareBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f216543fd")
            .providerId("52415800-8b69-11e0-9b19-734f216543fd").location(zone).build();
      Image existingImage = new ImageBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f6f006e54")
            .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
            .providerId("52415800-8b69-11e0-9b19-734f6f006e54").description("foobuntu").status(Image.Status.AVAILABLE)
            .location(zone).build();
View Full Code Here

@Singleton
public class ServiceOfferingToHardware implements Function<ServiceOffering, Hardware> {

   @Override
   public Hardware apply(ServiceOffering offering) {
      return new HardwareBuilder()
            .ids(offering.getId() + "")
            .name(offering.getName())
            .tags(offering.getTags())
            .processors(ImmutableList.of(new Processor(offering.getCpuNumber(), offering.getCpuSpeed())))
            .ram(offering.getMemory())//
View Full Code Here

      if (image != null) {
         builder.imageId(image.getId());
         builder.operatingSystem(image.getOperatingSystem());
      }

      builder.hardware(new HardwareBuilder()
        .ids(from.getServiceOfferingId() + "")
        .name(from.getServiceOfferingName() + "")
         // .tags() TODO
        .processors(ImmutableList.of(new Processor(from.getCpuCount(), from.getCpuSpeed())))
        .ram((int)from.getMemory())//
View Full Code Here

TOP

Related Classes of org.jclouds.compute.domain.HardwareBuilder

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.