Package org.jclouds.compute.domain

Examples of org.jclouds.compute.domain.Image


      VirtualDatacenter vdc = vm.getVirtualDatacenter();
      builder.location(virtualDatacenterToLocation.apply(vdc));

      // Image details
      VirtualMachineTemplate template = vm.getTemplate();
      Image image = virtualMachineTemplateToImage.apply(template);
      builder.imageId(image.getId().toString());
      builder.operatingSystem(image.getOperatingSystem());

      // Hardware details
      Hardware defaultHardware = virtualMachineTemplateToHardware.apply(new VirtualMachineTemplateInVirtualDatacenter(
            template, vdc));
View Full Code Here


      dto.setName("Template");
      dto.setDescription("Template description");
      dto.addLink(new RESTLink("diskfile", "http://foo/bar"));
      dto.addLink(new RESTLink("datacenter", "http://foo/bar/4"));

      Image image = function.apply(wrap(context, VirtualMachineTemplate.class, dto));

      verify(regionMap);
      verify(dcToLocation);

      assertEquals(image.getId(), dto.getId().toString());
      assertEquals(image.getName(), dto.getName());
      assertEquals(image.getDescription(), dto.getDescription());
      assertEquals(image.getUri(), URI.create("http://foo/bar"));
      assertEquals(image.getOperatingSystem(), OperatingSystem.builder().description(dto.getName()).build());
   }
View Full Code Here

      dto.setId(5);
      dto.setName("Template");
      dto.setDescription("Template description");
      dto.addLink(new RESTLink("datacenter", "http://foo/bar/4"));

      Image image = function.apply(wrap(context, VirtualMachineTemplate.class, dto));

      verify(regionMap);
      verify(dcToLocation);

      assertNull(image.getUri());
   }
View Full Code Here

      assertEquals(Iterables.get(node.getPublicAddresses(), 1), extNic.getIp());
   }

   private VirtualMachineTemplateToImage templateToImage() {
      VirtualMachineTemplateToImage templateToImage = EasyMock.createMock(VirtualMachineTemplateToImage.class);
      Image image = EasyMock.createMock(Image.class);

      expect(image.getId()).andReturn("1");
      expect(image.getOperatingSystem()).andReturn(null);
      expect(templateToImage.apply(anyObject(VirtualMachineTemplate.class))).andReturn(image);

      replay(image);
      replay(templateToImage);
View Full Code Here

         builder.hardware(parseHardware(from.getServer().getType()));

         LoginCredentials.Builder credentialsBuilder = LoginCredentials
               .builder().password(from.getInitialPassword());

         Image image = parseImage(from.getServer());
         // image will not be found if server was created a while back and
         // the image has since been destroyed or discontinued (like an old
         // CentOS version)
         if (image != null) {

            builder.operatingSystem(image.getOperatingSystem());
            String user = image.getDefaultCredentials().getUser();
            credentialsBuilder.identity(user);
         }

         builder.credentials(credentialsBuilder.build());
View Full Code Here

   @Test
   public void testWhenNoHardwareOrImageMatchImageIdIsStillSet() {

      Hardware existingHardware = new HardwareBuilder().id("us-sw-1/FOOOOOOOO").providerId("FOOOOOOOO").location(zone)
            .build();
      Image existingImage = new ImageBuilder().id("us-sw-1/FOOOOOOOO")
            .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
            .providerId("FOOOOOOOO").description("foobuntu").location(zone).status(Image.Status.AVAILABLE).build();

      checkHardwareAndImageStatus(null, existingHardware, "us-sw-1/sdc:sdc:centos-5.7:1.2.1", null, existingImage);
   }
View Full Code Here

   @Test
   public void testWhenHardwareAndImageMatchHardwareOperatingSystemAndImageIdAreSet() {

      Hardware existingHardware = new HardwareBuilder().id("us-sw-1/Small 1GB").providerId("Small 1GB").ram(1024)
            .volume(new VolumeImpl(Float.valueOf(61440), true, true)).location(zone).build();
      Image existingImage = new ImageBuilder().id("us-sw-1/sdc:sdc:centos-5.7:1.2.1")
            .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
            .providerId("sdc:sdc:centos-5.7:1.2.1").description("foobuntu").status(Image.Status.AVAILABLE)
            .location(zone).build();

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

   }

   public void testImageToImage() {
      org.jclouds.docker.domain.Image mockImage = mockImage();

      Image image = function.apply(mockImage);

      verify(mockImage);

      assertEquals(mockImage.getId(), image.getId().toString());
   }
View Full Code Here

   }

   @Override
   public synchronized Master getIfPresent(Object key) {
      checkArgument(key instanceof Image, "this cache is for entries who's keys are Images");
      Image image = Image.class.cast(key);
      if (masters.containsKey(image.getId())) {
         return masters.get(image.getId());
      }
      return null;
   }
View Full Code Here

      builder.ids(from.getUuid() + "");
      builder.name(from.getAlias());
      builder.location(from(locations.get()).firstMatch(LocationPredicates.idEquals(from.getUuid() + "")).orNull());
      builder.group(nodeNamingConvention.groupInUniqueNameOrNull(from.getType()));
      builder.imageId(from.getType() + "");
      Image image = from(images.get()).firstMatch(ImagePredicates.idEquals(from.getUuid() + "")).orNull();
      if (image != null)
         builder.operatingSystem(image.getOperatingSystem());
      builder.hardware(from(hardware.get()).firstMatch(HardwarePredicates.idEquals(from.getUuid() + "")).orNull());
      builder.status(serverStatusToNodeStatus.get(from.getState()));
      try {
         if (from.getState() == VM.State.RUNNING) {
            Optional<String> ip = from.getPublicAddress();
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.