Package org.jclouds.compute.domain

Examples of org.jclouds.compute.domain.OperatingSystem$Builder


      }
      String osVersion = osVersion().apply(description);
      if (osVersion == null) {
         logger.debug("Cannot determine os version for item: %s", productItem);
      }
      OperatingSystem os = OperatingSystem.builder()
            .description(description)
            .family(osFamily)
            .version(osVersion)
            .is64Bit(Objects.equal(bits, 64))
            .build();
View Full Code Here


      @SuppressWarnings("unchecked")
      Supplier<Set<? extends Image>> images = createMock(Supplier.class);
      replay(images);
     
      final Image image = new ImageBuilder().providerId("cc-image").name("image").id("us-east-1/cc-image").location(location)
               .operatingSystem(new OperatingSystem(OsFamily.UBUNTU, null, "1.0", "hvm", "ubuntu", true))
               .description("description").version("1.0").defaultCredentials(LoginCredentials.builder().user("root").build())
               .status(Image.Status.AVAILABLE)
               .build();
      Map<RegionAndName, Image> imageMap = ImmutableMap.of(
               new RegionAndName(image.getLocation().getId(), image.getProviderId()), image);
View Full Code Here

   }

   private TemplateBuilder newTemplateBuilder() {
      final Supplier<Set<? extends Image>> images = Suppliers.<Set<? extends Image>> ofInstance(ImmutableSet.<Image> of(
               new ImageBuilder().providerId("cc-image").name("image").id("us-east-1/cc-image").location(location)
                        .operatingSystem(new OperatingSystem(OsFamily.UBUNTU, null, "1.0", "hvm", "ubuntu", true))
                        .description("description").version("1.0").defaultCredentials(LoginCredentials.builder().user("root").build())
                        .status(Image.Status.AVAILABLE)
                        .build(),
               new ImageBuilder().providerId("normal-image").name("image").id("us-east-1/normal-image").location(location)
                        .operatingSystem(new OperatingSystem(OsFamily.UBUNTU, null, "1.0", "paravirtual", "ubuntu", true))
                        .description("description").version("1.0").defaultCredentials(LoginCredentials.builder().user("root").build())
                        .status(Image.Status.AVAILABLE)
                        .build()));
     
      // weird compilation error means have to cast this - see https://bugs.eclipse.org/bugs/show_bug.cgi?id=365818
View Full Code Here

      Provider<TemplateOptions> optionsProvider = createMock(Provider.class);
      Provider<TemplateBuilder> templateBuilderProvider = createMock(Provider.class);
      TemplateOptions defaultOptions = createMock(TemplateOptions.class);
      Image knownImage = createMock(Image.class);
      OperatingSystem os = createMock(OperatingSystem.class);

      expect(optionsProvider.get()).andReturn(defaultOptions);

      expect(knownImage.getId()).andReturn("us-east-1/ami").atLeastOnce();
      expect(knownImage.getLocation()).andReturn(region).atLeastOnce();
      expect(knownImage.getName()).andReturn(null).atLeastOnce();
      expect(knownImage.getDescription()).andReturn(null).atLeastOnce();
      expect(knownImage.getVersion()).andReturn(null).atLeastOnce();
      expect(knownImage.getProviderId()).andReturn("ami").atLeastOnce();

      expect(knownImage.getOperatingSystem()).andReturn(os).atLeastOnce();

      expect(os.getName()).andReturn(null).atLeastOnce();
      expect(os.getVersion()).andReturn(null).atLeastOnce();
      expect(os.getFamily()).andReturn(null).atLeastOnce();
      expect(os.getDescription()).andReturn(null).atLeastOnce();
      expect(os.getArch()).andReturn("paravirtual").atLeastOnce();
      expect(os.is64Bit()).andReturn(false).atLeastOnce();

      replay(knownImage);
      replay(os);
      replay(defaultOptions);
      replay(optionsProvider);
View Full Code Here

  
   @Test
   public void testConversionWhereLocationFound() {
      UUID id = UUID.randomUUID();
      Image novaImageToConvert = Image.builder().id(id.toString()).name("Test Image " + id).status(Image.Status.DELETED).build();
      OperatingSystem operatingSystem = new OperatingSystem(OsFamily.UBUNTU, "My Test OS", "My Test Version", "x86",
               "My Test OS", true);
      ImageInZoneToImage converter = new ImageInZoneToImage(NovaComputeServiceContextModule.toPortableImageStatus,
               constant(operatingSystem), locationIndex);

      ImageInZone novaImageInZoneToConvert = new ImageInZone(novaImageToConvert, "az-1.region-a.geo-1");
View Full Code Here

   @Test(expectedExceptions = IllegalStateException.class)
   public void testConversionWhereLocationNotFound() {
      UUID id = UUID.randomUUID();
      Image novaImageToConvert = Image.builder().id(id.toString()).name("Test Image " + id).build();
      OperatingSystem operatingSystem = new OperatingSystem(OsFamily.UBUNTU, "My Test OS", "My Test Version", "x86",
               "My Test OS", true);
      ImageInZoneToImage converter = new ImageInZoneToImage(NovaComputeServiceContextModule.toPortableImageStatus,
               constant(operatingSystem), locationIndex);

      ImageInZone novaImageInZoneToConvert = new ImageInZone(novaImageToConvert, "South");
View Full Code Here

      Image imageToConvert = Image.builder().id("id-" + name).name(name).build();

      ImageToOperatingSystem converter = new ImageToOperatingSystem(
            new HashMap<OsFamily, Map<String, String>>());

      OperatingSystem convertedOs = converter.apply(imageToConvert);

      assertEquals(convertedOs.getName(), imageToConvert.getName());
      assertEquals(convertedOs.getFamily(), OsFamily.OEL);
      assertEquals(convertedOs.getDescription(), imageToConvert.getName());
      assertEquals(convertedOs.getVersion(), null);
      assertEquals(convertedOs.getArch(), null);
      assertTrue(convertedOs.is64Bit());
   }
View Full Code Here

     
      String name = "oneiric-server-cloudimg-amd64";

      Image imageToConvert = Image.builder().id("id-" + name).name(name).build();
     
      OperatingSystem convertedOs = converterForUbuntu.apply(imageToConvert);

      assertEquals(convertedOs.getName(), imageToConvert.getName());
      assertEquals(convertedOs.getFamily(), OsFamily.UBUNTU);
      assertEquals(convertedOs.getDescription(), imageToConvert.getName());
      assertEquals(convertedOs.getVersion(), "11.10");
      assertEquals(convertedOs.getArch(), null);
      assertTrue(convertedOs.is64Bit());
   }
View Full Code Here

     
      String name = "natty-server-cloudimg-amd64";

      Image imageToConvert = Image.builder().id("id-" + name).name(name).build();
     
      OperatingSystem convertedOs = converterForUbuntu.apply(imageToConvert);

      assertEquals(convertedOs.getName(), imageToConvert.getName());
      assertEquals(convertedOs.getFamily(), OsFamily.UBUNTU);
      assertEquals(convertedOs.getDescription(), imageToConvert.getName());
      assertEquals(convertedOs.getVersion(), "11.04");
      assertEquals(convertedOs.getArch(), null);
      assertTrue(convertedOs.is64Bit());
   }
View Full Code Here

      @SuppressWarnings("unchecked")
      Supplier<Set<? extends Image>> images = createMock(Supplier.class);
      replay(images);
     
      final Image image = new ImageBuilder().providerId("cc-image").name("image").id("us-east-1/cc-image").location(location)
               .operatingSystem(new OperatingSystem(OsFamily.UBUNTU, null, "1.0", "hvm", "ubuntu", true))
               .description("description").version("1.0").defaultCredentials(LoginCredentials.builder().user("root").build())
               .status(Image.Status.AVAILABLE)
               .build();
      Map<RegionAndName, Image> imageMap = ImmutableMap.of(
               new RegionAndName(image.getLocation().getId(), image.getProviderId()), image);
View Full Code Here

TOP

Related Classes of org.jclouds.compute.domain.OperatingSystem$Builder

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.