Package org.jclouds.openstack.nova.v2_0.domain

Examples of org.jclouds.openstack.nova.v2_0.domain.Volume$ConcreteBuilder


   public void testListVolumesInDetail() {
      Set<? extends Volume> volumes = volumeApi.listInDetail().toSet();
      assertNotNull(volumes);
      boolean foundIt = false;
      for (Volume vol : volumes) {
         Volume details = volumeApi.get(vol.getId());
         assertNotNull(details);
         assertNotNull(details.getId());
         assertNotNull(details.getCreated());
         assertTrue(details.getSize() > -1);

         assertEquals(details.getId(), vol.getId());
         assertEquals(details.getSize(), vol.getSize());
         assertEquals(details.getName(), vol.getName());
         assertEquals(details.getDescription(), vol.getDescription());
         assertEquals(details.getCreated(), vol.getCreated());
         if (Objects.equal(details.getId(), testVolume.getId())) {
            foundIt = true;
         }
      }
      assertTrue(foundIt, "Failed to find the volume we previously created in listInDetail() response");
   }
View Full Code Here


         if (status.equals(volume.getStatus())) {
            return true;
         }
         else {
            Volume volumeUpdated = volumeApi.get(volume.getId());
            checkNotNull(volumeUpdated, "Volume %s not found.", volume.getId());

            return status.equals(volumeUpdated.getStatus());
         }
      }
View Full Code Here

*/
@Test(groups = "unit", testName = "CloudServersUKProviderTest")
public class CloudServersUKProviderTest extends BaseProviderMetadataTest {

   public CloudServersUKProviderTest() {
      super(new CloudServersUKProviderMetadata(), new NovaApiMetadata());
   }
View Full Code Here

        }
        ComputeServiceContext context = iaasInfo.getComputeService().getContext();
       
        RestContext<NovaApi, NovaAsyncApi> nova = context.unwrap();
        VolumeApi api = nova.getApi().getVolumeExtensionForZone(region).get();
        Volume volume = api.create(sizeGB, CreateVolumeOptions.Builder.availabilityZone(zone));
        if (volume == null) {
      log.fatal("Volume creation was unsuccessful. [region] : " + region+" [zone] : " + zone
          + " of Iaas : " + iaasInfo);
      return null;
    }
   
    log.info("Successfully created a new volume [id]: "+volume.getId()
        +" in [region] : "+region+" [zone] : "+zone+" of Iaas : "+iaasInfo);
    return volume.getId();
  }
View Full Code Here

                  .payload(payloadFromStringWithContentType("{\"volume\":{\"display_name\":\"jclouds-test-volume\",\"display_description\":\"description of test volume\",\"size\":1}}", MediaType.APPLICATION_JSON))
                  .build(),
            HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_details.json")).build()
      ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();

      Volume volume = api.create(1, CreateVolumeOptions.Builder.name("jclouds-test-volume").description("description of test volume"));
      assertEquals(volume, testVolume());
   }
View Full Code Here

            responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
            authenticatedGET().endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_details.json")).build()
      ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();

      Volume volume = api.get("1");
      assertEquals(volume, testVolume());
      // double-check equals()
      assertEquals(volume.getStatus(), Volume.Status.IN_USE);
      assertEquals(volume.getDescription(), "This is a test volume");
      assertEquals(volume.getZone(), "nova");
      assertEquals(volume.getName(), "test");
      assertEquals(volume.getStatus(), Volume.Status.IN_USE);
      assertEquals(Iterables.getOnlyElement(volume.getAttachments()), testAttachment());
   }
View Full Code Here

      if (volumeOption.isPresent()) {
         Set<? extends Volume> volumes = volumeOption.get().list().toSet();
         assertNotNull(volumes);
         boolean foundIt = false;
         for (Volume vol : volumes) {
            Volume details = volumeOption.get().get(vol.getId());
            assertNotNull(details);
            if (Objects.equal(details.getId(), testVolume.getId())) {
               foundIt = true;
            }
         }
         assertTrue(foundIt, "Failed to find the volume we created in list() response");
      }
View Full Code Here

      if (volumeOption.isPresent()) {
         Set<? extends Volume> volumes = volumeOption.get().listInDetail().toSet();
         assertNotNull(volumes);
         boolean foundIt = false;
         for (Volume vol : volumes) {
            Volume details = volumeOption.get().get(vol.getId());
            assertNotNull(details);
            assertNotNull(details.getId());
            assertNotNull(details.getCreated());
            assertTrue(details.getSize() > -1);

            assertEquals(details.getId(), vol.getId());
            assertEquals(details.getSize(), vol.getSize());
            assertEquals(details.getName(), vol.getName());
            assertEquals(details.getDescription(), vol.getDescription());
            assertEquals(details.getCreated(), vol.getCreated());
            if (Objects.equal(details.getId(), testVolume.getId())) {
               foundIt = true;
            }
         }
         assertTrue(foundIt, "Failed to find the volume we previously created in listInDetail() response");
      }
View Full Code Here

                  .payload(payloadFromStringWithContentType("{\"volume\":{\"display_name\":\"jclouds-test-volume\",\"display_description\":\"description of test volume\",\"size\":1}}", MediaType.APPLICATION_JSON))
                  .build(),
            HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_details.json")).build()
      ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();

      Volume volume = api.create(1, CreateVolumeOptions.Builder.name("jclouds-test-volume").description("description of test volume"));
      assertEquals(volume, testVolume());
   }
View Full Code Here

            responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
            authenticatedGET().endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_details.json")).build()
      ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();

      Volume volume = api.get("1");
      assertEquals(volume, testVolume());
      // double-check equals()
      assertEquals(volume.getStatus(), Volume.Status.IN_USE);
      assertEquals(volume.getDescription(), "This is a test volume");
      assertEquals(volume.getZone(), "nova");
      assertEquals(volume.getName(), "test");
      assertEquals(volume.getStatus(), Volume.Status.IN_USE);
      assertEquals(Iterables.getOnlyElement(volume.getAttachments()), testAttachment());
   }
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.nova.v2_0.domain.Volume$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.