Package org.jclouds.openstack.cinder.v1.domain

Examples of org.jclouds.openstack.cinder.v1.domain.Snapshot$ConcreteBuilder


   public void testApplyInputStream() {
      DateService dateService = injector.getInstance(DateService.class);
      InputStream is = getClass().getResourceAsStream("/describe_snapshots.xml");

      Set<Snapshot> expected = Sets.newLinkedHashSet();
      expected.add(new Snapshot(defaultRegion, "snap-78a54011", "vol-4d826724", 10,
               Snapshot.Status.PENDING, dateService.iso8601DateParse("2008-05-07T12:51:50.000Z"),
               80, "218213537122", "Daily Backup", null));

      DescribeSnapshotsResponseHandler handler = injector
               .getInstance(DescribeSnapshotsResponseHandler.class);
View Full Code Here


      }
   }

   @Test
   public void testCreateAndListEBSBackedImage() throws Exception {
      Snapshot snapshot = createSnapshot();

      // List of images before...
      int sizeBefore = client.describeImagesInRegion(regionId).size();

      // Register a new image...
      ebsBackedImageId = client.registerUnixImageBackedByEbsInRegion(regionId, ebsBackedImageName, snapshot.getId(),
            addNewBlockDevice("/dev/sda2", "myvirtual", 1).withDescription("adrian"));
      imagesToDeregister.add(ebsBackedImageId);
      final Image ebsBackedImage = getOnlyElement(client.describeImagesInRegion(regionId, imageIds(ebsBackedImageId)));
      assertEquals(ebsBackedImage.getName(), ebsBackedImageName);
      assertEquals(ebsBackedImage.getImageType(), ImageType.MACHINE);
      assertEquals(ebsBackedImage.getRootDeviceType(), RootDeviceType.EBS);
      assertEquals(ebsBackedImage.getRootDeviceName(), "/dev/sda1");
      assertEquals(ebsBackedImage.getDescription(), "adrian");
      assertEquals(
            ebsBackedImage.getEbsBlockDevices().entrySet(),
            ImmutableMap.of("/dev/sda1", new Image.EbsBlockDevice(snapshot.getId(), snapshot.getVolumeSize(), true),
                  "/dev/sda2", new Image.EbsBlockDevice(null, 1, false)).entrySet());

      // List of images after - should be one larger than before
      int after = client.describeImagesInRegion(regionId).size();
      assertEquals(after, sizeBefore + 1);
View Full Code Here

         instance = getOnlyElement(concat(ec2Client.getInstanceServices().describeInstancesInRegion(regionId,
               instanceId)));
         BlockDevice device = instance.getEbsBlockDevices().get("/dev/sda1");
         assertNotNull(device, "device: /dev/sda1 not present on: " + instance);
         Snapshot snapshot = ec2Client.getElasticBlockStoreServices().createSnapshotInRegion(regionId,
               device.getVolumeId());
         snapshotsToDelete.add(snapshot.getId());
         return snapshot;
      } finally {
         if (instanceId != null)
            ec2Client.getInstanceServices().terminateInstancesInRegion(regionId, instanceId);
      }
View Full Code Here

   public Snapshot getResult() {
      String region = AWSUtils.findRegionInArgsOrNull(getRequest());
      if (region == null)
         region = defaultRegion.get();
      Snapshot snapshot = new Snapshot(region, id, volumeId, volumeSize, status, startTime,
               progress, ownerId, description, ownerAlias);
      this.id = null;
      this.volumeId = null;
      this.volumeSize = 0;
      this.status = null;
View Full Code Here

      assertEquals(volume.getId(), expected.getId());
   }

   @Test(dependsOnMethods = "testCreateVolumeInAvailabilityZone")
   void testCreateSnapshotInRegion() {
      Snapshot snapshot = client.createSnapshotInRegion(defaultRegion, volumeId);
      Predicate<Snapshot> snapshotted = retry(new SnapshotCompleted(client), 600, 10, SECONDS);
      assert snapshotted.apply(snapshot);

      Snapshot result = Iterables.getOnlyElement(client.describeSnapshotsInRegion(snapshot.getRegion(),
            snapshotIds(snapshot.getId())));

      assertEquals(result.getProgress(), 100);
      this.snapshot = result;
   }
View Full Code Here

   void testDescribeSnapshots() {
      for (String region : ec2Client.getConfiguredRegions()) {
         SortedSet<Snapshot> allResults = Sets.newTreeSet(client.describeSnapshotsInRegion(region));
         assertNotNull(allResults);
         if (allResults.size() >= 1) {
            Snapshot snapshot = allResults.last();
            Snapshot result = Iterables.getOnlyElement(client.describeSnapshotsInRegion(region,
                  snapshotIds(snapshot.getId())));
            assertNotNull(result);
            assertEquals(result, snapshot);
         }
      }
View Full Code Here

         Volume gp2Volume = Iterables.getOnlyElement(ec2Api.getElasticBlockStoreApi().get().describeVolumesInRegion(regionId, gp2Device.getVolumeId()));
         assertNotNull(gp2Volume, "/dev/sdb volume is null");
         assertEquals(gp2Volume.getVolumeType(), "gp2");
         BlockDevice device = instance.getEbsBlockDevices().get("/dev/sda1");
         assertNotNull(device, "device: /dev/sda1 not present on: " + instance);
         Snapshot snapshot = ec2Api.getElasticBlockStoreApi().get().createSnapshotInRegion(regionId,
                 device.getVolumeId());
         snapshotsToDelete.add(snapshot.getId());
         Predicate<Snapshot> snapshotted = retry(new SnapshotCompleted(ec2Api.getElasticBlockStoreApi().get()), 600, 10, SECONDS);
         assert snapshotted.apply(snapshot);
         return snapshot;
      } finally {
         if (instanceId != null)
View Full Code Here

      assertEquals(volume.getVolumeType(), expected.getVolumeType());
   }

   @Test(dependsOnMethods = "testCreateVolumeInAvailabilityZone")
   void testCreateSnapshotInRegion() {
      Snapshot snapshot = client.createSnapshotInRegion(defaultRegion, volumeId);
      Predicate<Snapshot> snapshotted = retry(new SnapshotCompleted(client), 600, 10, SECONDS);
      assert snapshotted.apply(snapshot);

      Snapshot result = Iterables.getOnlyElement(client.describeSnapshotsInRegion(snapshot.getRegion(),
            snapshotIds(snapshot.getId())));

      assertEquals(result.getProgress(), 100);
      this.snapshot = result;
   }
View Full Code Here

   void testDescribeSnapshots() {
      String region = defaultRegion;
      SortedSet<Snapshot> allResults = Sets.newTreeSet(client.describeSnapshotsInRegion(region));
      assertNotNull(allResults);
      if (!allResults.isEmpty()) {
         Snapshot snapshot = allResults.last();
         Snapshot result = Iterables.getOnlyElement(client.describeSnapshotsInRegion(region,
                 snapshotIds(snapshot.getId())));
         assertNotNull(result);
         assertEquals(result, snapshot);
      }
   }
View Full Code Here

   void testDescribeSnapshotsWithFilter() {
      String region = defaultRegion;
      SortedSet<Snapshot> allResults = Sets.newTreeSet(client.describeSnapshotsInRegion(region));
      assertNotNull(allResults);
      if (!allResults.isEmpty()) {
         Snapshot snapshot = allResults.last();
         Snapshot result = Iterables.getOnlyElement(client.describeSnapshotsInRegionWithFilter(region,
                 ImmutableMultimap.<String, String>builder()
                         .put("snapshot-id", snapshot.getId()).build()));
         assertNotNull(result);
         assertEquals(result, snapshot);
      }
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.cinder.v1.domain.Snapshot$ConcreteBuilder

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.