public void testListSnapshotsFail() { URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-snapshots"); 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.listSnapshots().toSet(); assertTrue(snapshots.isEmpty()); }
@Test(dependsOnMethods = "testCreateSnapshot") public void testListSnapshots() { if (volumeOption.isPresent()) { Set<? extends VolumeSnapshot> snapshots = volumeOption.get().listSnapshots().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; } assertNotNull(details); assertEquals(details.getId(), snap.getId()); assertEquals(details.getVolumeId(), snap.getVolumeId()); } assertTrue(foundIt, "Failed to find the snapshot we previously created in listSnapshots() response"); } }
@Test(dependsOnMethods = "testCreateSnapshot") public void testListSnapshots() { if (volumeOption.isPresent()) { Set<? extends VolumeSnapshot> snapshots = volumeOption.get().listSnapshots().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; } assertNotNull(details); assertEquals(details.getId(), snap.getId()); assertEquals(details.getVolumeId(), snap.getVolumeId()); } assertTrue(foundIt, "Failed to find the snapshot we previously created in listSnapshots() response"); } }
public void testListSnapshots() { URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-snapshots"); VolumeApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, authenticatedGET().endpoint(endpoint).build(), HttpResponse.builder().statusCode(200).payload(payloadFromResource("/snapshot_list.json")).build() ).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); Set<? extends VolumeSnapshot> snapshots = api.listSnapshots().toSet(); assertEquals(snapshots, ImmutableSet.of(testSnapshot())); }
public void testListSnapshots() { URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v2/3456/os-snapshots"); VolumeApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, authenticatedGET().endpoint(endpoint).build(), HttpResponse.builder().statusCode(200).payload(payloadFromResource("/snapshot_list.json")).build() ).getVolumeApi("az-1.region-a.geo-1").get(); Set<? extends VolumeSnapshot> snapshots = api.listSnapshots().toSet(); assertEquals(snapshots, ImmutableSet.of(testSnapshot())); }