public void testListSnapshotsById() { Iterable<String> snapshotIds = Iterables.transform(client.getSnapshotClient().listSnapshots(), new Function<Snapshot, String>() { public String apply(Snapshot input) { return input.getId(); } }); assertNotNull(snapshotIds); assertFalse(Iterables.isEmpty(snapshotIds)); for (String id : snapshotIds) { Set<Snapshot> found = client.getSnapshotClient().listSnapshots(ListSnapshotsOptions.Builder.id(id)); assertNotNull(found); assertEquals(1, found.size()); Snapshot snapshot = Iterables.getOnlyElement(found); assertEquals(id, snapshot.getId()); checkSnapshot(snapshot); } }
public void testListSnapshotsOptions() throws NoSuchMethodException { Invokable<?, ?> method = method(SnapshotApi.class, "listSnapshots", ListSnapshotsOptions[].class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListSnapshotsOptions.Builder.accountInDomain("acc", "7") .id("5") .interval(Snapshot.Interval.MONTHLY) .isRecursive(true) .keyword("fred") .name("fred's snapshot") .snapshotType(Snapshot.Type.RECURRING) .volumeId("11"))); assertRequestLineEquals(httpRequest, "GET http://localhost:8080/client/api?response=json&command=listSnapshots&listAll=true&account=acc&domainid=7&id=5&intervaltype=MONTHLY&isrecursive=true&keyword=fred&name=fred%27s%20snapshot&snapshottype=RECURRING&volumeid=11 HTTP/1.1"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertPayloadEquals(httpRequest, null, null, false); assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class); assertSaxResponseParserClassEquals(method, null); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class); checkFilters(httpRequest); }
public void testListSnapshotsById() { Iterable<String> snapshotIds = Iterables.transform(client.getSnapshotApi().listSnapshots(), new Function<Snapshot, String>() { public String apply(Snapshot input) { return input.getId(); } }); assertNotNull(snapshotIds); assertFalse(Iterables.isEmpty(snapshotIds)); for (String id : snapshotIds) { Set<Snapshot> found = client.getSnapshotApi().listSnapshots(ListSnapshotsOptions.Builder.id(id)); assertNotNull(found); assertEquals(1, found.size()); Snapshot snapshot = Iterables.getOnlyElement(found); assertEquals(id, snapshot.getId()); checkSnapshot(snapshot); } }
public void testListSnapshotsNonexistantId() { Set<Snapshot> found = client.getSnapshotApi().listSnapshots(ListSnapshotsOptions.Builder.id("foo")); assertNotNull(found); assertTrue(found.isEmpty()); }
public void testListSnapshotsNonexistantId() { Set<Snapshot> found = client.getSnapshotClient().listSnapshots(ListSnapshotsOptions.Builder.id("foo")); assertNotNull(found); assertTrue(found.isEmpty()); }
public void testListSnapshotsOptions() throws NoSuchMethodException { Invokable<?, ?> method = method(SnapshotAsyncClient.class, "listSnapshots", ListSnapshotsOptions[].class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListSnapshotsOptions.Builder.accountInDomain("acc", "7").id("5").interval(Snapshot.Interval.MONTHLY).isRecursive(true).keyword("fred").name("fred's snapshot").snapshotType(Snapshot.Type.RECURRING).volumeId("11"))); assertRequestLineEquals(httpRequest, "GET http://localhost:8080/client/api?response=json&command=listSnapshots&listAll=true&account=acc&domainid=7&id=5&intervaltype=MONTHLY&isrecursive=true&keyword=fred&name=fred%27s%20snapshot&snapshottype=RECURRING&volumeid=11 HTTP/1.1"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertPayloadEquals(httpRequest, null, null, false); assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class); assertSaxResponseParserClassEquals(method, null); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class); checkFilters(httpRequest); }