Package org.jclouds.compute.domain

Examples of org.jclouds.compute.domain.Image


   @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();

      checkHardwareAndImageStatus(existingHardware, existingHardware, existingImage.getId(),
            existingImage.getOperatingSystem(), existingImage);
   }
View Full Code Here


      builder.imageId(instance.getRegion() + "/" + instance.getImageId());

      // extract the operating system from the image
      RegionAndName regionAndName = new RegionAndName(instance.getRegion(), instance.getImageId());
      try {
         Image image = imageMap.get().getUnchecked(regionAndName);
         if (image != null)
            builder.operatingSystem(image.getOperatingSystem());
      } catch (CacheLoader.InvalidCacheLoadException e) {
         logger.debug("image not found for %s: %s", regionAndName, e);
      } catch (UncheckedExecutionException e) {
         logger.debug("error getting image for %s: %s", regionAndName, e);
      }
View Full Code Here

      builder.name(from.getName());
      builder.description(from.getName());
      builder.version(from.getUpdated().getTime() + "");
      builder.operatingSystem(imageToOs.apply(from));
      builder.status(toPortableImageStatus.get(from.getStatus()));
      Image image = builder.build();
      return image;
   }
View Full Code Here

      ImageExtension apiThatCreatesImage = requestsSendResponses(requestResponseMap).getImageExtension().get();
     
      ImageTemplate newImageTemplate = apiThatCreatesImage.buildImageTemplateFromNode("temp-template-ignore", "3239ade9-fd25-405c-8eda-59f0313a3fb0");
     
      Image image = Futures.getUnchecked(apiThatCreatesImage.createImage(newImageTemplate));
      assertEquals(image.getId(), "3dc6ce25-a6cf-4d60-a664-3499993b511b");
   }
View Full Code Here

      builder.hostname(from.getDisplayName());
      builder.location(FluentIterable.from(locations.get()).firstMatch(idEquals(from.getZoneId())).orNull());
      if (from.getDisplayName() != null) {
         builder.group(nodeNamingConvention.groupInUniqueNameOrNull(from.getDisplayName()));
      }
      Image image = FluentIterable.from(images.get()).firstMatch(new Predicate<Image>() {
         @Override
         public boolean apply(Image input) {
            return input.getProviderId().equals(from.getTemplateId() + "")
            // either location free image (location is null) or in the same zone as the VM
                  && (input.getLocation() == null || input.getId().equals(from.getZoneId() + ""));
         }
      }).orNull();
      if (image != null) {
         builder.imageId(image.getId());
         builder.operatingSystem(image.getOperatingSystem());
      }

      builder.hardware(new HardwareBuilder()
        .ids(from.getServiceOfferingId() + "")
        .name(from.getServiceOfferingName() + "")
View Full Code Here

      EC2ImageParser parser = createMock(EC2ImageParser.class);
      EC2Client caller = createMock(EC2Client.class);
      AMIClient client = createMock(AMIClient.class);

      org.jclouds.ec2.domain.Image ec2Image = createMock(org.jclouds.ec2.domain.Image.class);
      Image image = createNiceMock(Image.class);
      Set<? extends org.jclouds.ec2.domain.Image> images = ImmutableSet.<org.jclouds.ec2.domain.Image> of(ec2Image);

      expect(caller.getAMIServices()).andReturn(client).atLeastOnce();
      expect(client.describeImagesInRegion("region", imageIds("ami"))).andReturn(Set.class.cast(images));
      expect(parser.apply(ec2Image)).andReturn(image);
View Full Code Here

      EC2ImageParser parser = createMock(EC2ImageParser.class);
      EC2Client caller = createMock(EC2Client.class);
      AMIClient client = createMock(AMIClient.class);

      org.jclouds.ec2.domain.Image ec2Image = createMock(org.jclouds.ec2.domain.Image.class);
      Image image = createNiceMock(Image.class);
      Set<? extends org.jclouds.ec2.domain.Image> images = ImmutableSet.<org.jclouds.ec2.domain.Image> of(ec2Image);

      expect(caller.getAMIServices()).andReturn(client).atLeastOnce();
      expect(client.describeImagesInRegion("region", imageIds("ami"))).andReturn(Set.class.cast(images));
      expect(parser.apply(ec2Image)).andThrow(new ResourceNotFoundException());
View Full Code Here

      EC2ImageParser parser = createMock(EC2ImageParser.class);
      EC2Client caller = createMock(EC2Client.class);
      AMIClient client = createMock(AMIClient.class);

      org.jclouds.ec2.domain.Image ec2Image = createMock(org.jclouds.ec2.domain.Image.class);
      Image image = createNiceMock(Image.class);
      Set<? extends org.jclouds.ec2.domain.Image> images = ImmutableSet.<org.jclouds.ec2.domain.Image> of(ec2Image);

      expect(caller.getAMIServices()).andReturn(client).atLeastOnce();
      expect(client.describeImagesInRegion("region", imageIds("ami"))).andReturn(Set.class.cast(images));
      expect(parser.apply(ec2Image)).andThrow(new NoSuchElementException());
View Full Code Here

   public void testTemplateChoiceForInstanceByImageIdDoesNotGetAllImages() throws Exception {
      @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);
     
      // weird compilation error means have to declare extra generics for call to build() - see https://bugs.eclipse.org/bugs/show_bug.cgi?id=365818
      Supplier<LoadingCache<RegionAndName, ? extends Image>> imageCache = Suppliers.<LoadingCache<RegionAndName, ? extends Image>> ofInstance(
               CacheBuilder.newBuilder().<RegionAndName,Image>build(CacheLoader.from(Functions.forMap(imageMap))));
View Full Code Here

            .<Hardware> of(c1_medium().build()));

      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();
View Full Code Here

TOP

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

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.