public void testListSnapshotsInDetail() { URI endpoint = URI.create("http://172.16.0.1:8776/v1/50cdb4c60374463198695d9f798fa34d/snapshots/detail"); SnapshotApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint).build(), HttpResponse.builder() .statusCode(200) .payload(payloadFromResource("/snapshot_list_details.json")) .build()) .getSnapshotApiForZone("RegionOne"); Set<? extends Snapshot> snapshots = api.listInDetail().toSet(); assertEquals(snapshots, ImmutableSet.of(testSnapshot())); // double-check individual fields Snapshot snappy = Iterables.getOnlyElement(snapshots); assertEquals(snappy.getId(), "67d03df1-ce5d-4ba7-adbe-492ceb80170b"); assertEquals(snappy.getVolumeId(), "ea6f70ef-2784-40b9-9d14-d7f33c507c3f"); assertEquals(snappy.getStatus(), Volume.Status.AVAILABLE); assertEquals(snappy.getDescription(), "jclouds test snapshot"); assertEquals(snappy.getName(), "jclouds-test-snapshot"); assertEquals(snappy.getSize(), 1); }
protected Snapshot testSnapshot() { return Snapshot.builder() .id("67d03df1-ce5d-4ba7-adbe-492ceb80170b") .volumeId("ea6f70ef-2784-40b9-9d14-d7f33c507c3f") .description("jclouds test snapshot") .status(Volume.Status.AVAILABLE) .name("jclouds-test-snapshot") .size(1) .created(dateService.iso8601DateParse("2012-11-02T16:23:27.000000")) .build(); }