public void testListSnapshotsInDetailFail() { URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-snapshots/detail"); VolumeApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, authenticatedGET().endpoint(endpoint).build(), HttpResponse.builder().statusCode(404).build() ).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); Set<? extends VolumeSnapshot> snapshots = api.listSnapshotsInDetail().toSet(); assertTrue(snapshots.isEmpty()); }
@Test(dependsOnMethods = "testCreateSnapshot") public void testListSnapshotsInDetail() { if (volumeOption.isPresent()) { Set<? extends VolumeSnapshot> snapshots = volumeOption.get().listSnapshotsInDetail().toSet(); assertNotNull(snapshots); boolean foundIt = false; for (VolumeSnapshot snap : snapshots) { VolumeSnapshot details = volumeOption.get().getSnapshot(snap.getId()); if (Objects.equal(snap.getVolumeId(), testVolume.getId())) { foundIt = true; assertSame(details, testSnapshot); } assertSame(details, snap); } assertTrue(foundIt, "Failed to find the snapshot we created in listSnapshotsInDetail() response"); } }
@Test(dependsOnMethods = "testCreateSnapshot") public void testListSnapshotsInDetail() { if (volumeOption.isPresent()) { Set<? extends VolumeSnapshot> snapshots = volumeOption.get().listSnapshotsInDetail().toSet(); assertNotNull(snapshots); boolean foundIt = false; for (VolumeSnapshot snap : snapshots) { VolumeSnapshot details = volumeOption.get().getSnapshot(snap.getId()); if (Objects.equal(snap.getVolumeId(), testVolume.getId())) { foundIt = true; assertSame(details, testSnapshot); } assertSame(details, snap); } assertTrue(foundIt, "Failed to find the snapshot we created in listSnapshotsInDetail() response"); } }
public void testListSnapshotsInDetail() { URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-snapshots/detail"); VolumeApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, authenticatedGET().endpoint(endpoint).build(), HttpResponse.builder().statusCode(200).payload(payloadFromResource("/snapshot_list_detail.json")).build() ).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); Set<? extends VolumeSnapshot> snapshots = api.listSnapshotsInDetail().toSet(); assertEquals(snapshots, ImmutableSet.of(testSnapshot())); // double-check individual fields VolumeSnapshot snappy = Iterables.getOnlyElement(snapshots); assertEquals(snappy.getId(), "7"); assertEquals(snappy.getVolumeId(), "9"); assertEquals(snappy.getStatus(), Volume.Status.AVAILABLE); assertEquals(snappy.getDescription(), "jclouds live test snapshot"); assertEquals(snappy.getName(), "jclouds-live-test"); assertEquals(snappy.getSize(), 1); }
public void testListSnapshotsInDetail() { URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v2/3456/os-snapshots/detail"); VolumeApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, authenticatedGET().endpoint(endpoint).build(), HttpResponse.builder().statusCode(200).payload(payloadFromResource("/snapshot_list_detail.json")).build() ).getVolumeApi("az-1.region-a.geo-1").get(); Set<? extends VolumeSnapshot> snapshots = api.listSnapshotsInDetail().toSet(); assertEquals(snapshots, ImmutableSet.of(testSnapshot())); // double-check individual fields VolumeSnapshot snappy = Iterables.getOnlyElement(snapshots); assertEquals(snappy.getId(), "7"); assertEquals(snappy.getVolumeId(), "9"); assertEquals(snappy.getStatus(), Volume.Status.AVAILABLE); assertEquals(snappy.getDescription(), "jclouds live test snapshot"); assertEquals(snappy.getName(), "jclouds-live-test"); assertEquals(snappy.getSize(), 1); }