moved off deprecated FluentIterable methods

This commit is contained in:
Adrian Cole 2012-12-30 13:18:27 -08:00
parent 755094c599
commit 038e550d2d
57 changed files with 102 additions and 102 deletions

View File

@ -85,7 +85,7 @@ public class MetricApiExpectTest extends BaseCloudWatchApiExpectTest {
CloudWatchApi apiWhenMetricsDontExist = requestSendsResponse( CloudWatchApi apiWhenMetricsDontExist = requestSendsResponse(
listMetrics, listMetricsResponse); listMetrics, listMetricsResponse);
assertEquals(apiWhenMetricsDontExist.getMetricApiForRegion(null).list().get(0).toImmutableSet(), ImmutableSet.of()); assertEquals(apiWhenMetricsDontExist.getMetricApiForRegion(null).list().get(0).toSet(), ImmutableSet.of());
} }
public void testListMetrics2PagesWhenResponseIs2xx() throws Exception { public void testListMetrics2PagesWhenResponseIs2xx() throws Exception {

View File

@ -166,7 +166,7 @@ public class TagApiExpectTest extends BaseEC2ApiExpectTest<EC2Api> {
EC2Api apiWhenDontExist = requestSendsResponse( EC2Api apiWhenDontExist = requestSendsResponse(
list, listResponse); list, listResponse);
assertEquals(apiWhenDontExist.getTagApi().get().list().toImmutableSet(), ImmutableSet.of()); assertEquals(apiWhenDontExist.getTagApi().get().list().toSet(), ImmutableSet.of());
} }
HttpRequest filter = HttpRequest filter =
@ -212,7 +212,7 @@ public class TagApiExpectTest extends BaseEC2ApiExpectTest<EC2Api> {
assertEquals(apiWhenDontExist.getTagApi().get().filter(ImmutableMultimap.<String, String> builder() assertEquals(apiWhenDontExist.getTagApi().get().filter(ImmutableMultimap.<String, String> builder()
.put("resource-type", "instance") .put("resource-type", "instance")
.put("key", "stack") .put("key", "stack")
.build()).toImmutableSet(), ImmutableSet.of()); .build()).toSet(), ImmutableSet.of());
} }
HttpRequest delete = HttpRequest.builder() HttpRequest delete = HttpRequest.builder()

View File

@ -94,7 +94,7 @@ public abstract class BaseTagApiLiveTest extends BaseEC2ApiLiveTest {
public boolean apply(Tag in) { public boolean apply(Tag in) {
return in.getResourceId().equals(resource.id); return in.getResourceId().equals(resource.id);
} }
}).toImmutableSet().equals(input); }).toSet().equals(input);
} }
}, 600, 200, 200, TimeUnit.MILLISECONDS).apply(ImmutableSet.of(tag, tag2))); }, 600, 200, 200, TimeUnit.MILLISECONDS).apply(ImmutableSet.of(tag, tag2)));

View File

@ -60,7 +60,7 @@ public class SnapshotApiExpectTest extends BaseCinderApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/snapshot_list_simple.json")).build() HttpResponse.builder().statusCode(200).payload(payloadFromResource("/snapshot_list_simple.json")).build()
).getSnapshotApiForZone("RegionOne"); ).getSnapshotApiForZone("RegionOne");
Set<? extends Snapshot> snapshots = api.list().toImmutableSet(); Set<? extends Snapshot> snapshots = api.list().toSet();
assertEquals(snapshots, ImmutableSet.of(testSnapshot())); assertEquals(snapshots, ImmutableSet.of(testSnapshot()));
} }
@ -73,7 +73,7 @@ public class SnapshotApiExpectTest extends BaseCinderApiExpectTest {
HttpResponse.builder().statusCode(404).build() HttpResponse.builder().statusCode(404).build()
).getSnapshotApiForZone("RegionOne"); ).getSnapshotApiForZone("RegionOne");
Set<? extends Snapshot> snapshots = api.list().toImmutableSet(); Set<? extends Snapshot> snapshots = api.list().toSet();
assertTrue(snapshots.isEmpty()); assertTrue(snapshots.isEmpty());
} }
@ -86,7 +86,7 @@ public class SnapshotApiExpectTest extends BaseCinderApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/snapshot_list_details.json")).build() HttpResponse.builder().statusCode(200).payload(payloadFromResource("/snapshot_list_details.json")).build()
).getSnapshotApiForZone("RegionOne"); ).getSnapshotApiForZone("RegionOne");
Set<? extends Snapshot> snapshots = api.listInDetail().toImmutableSet(); Set<? extends Snapshot> snapshots = api.listInDetail().toSet();
assertEquals(snapshots, ImmutableSet.of(testSnapshot())); assertEquals(snapshots, ImmutableSet.of(testSnapshot()));
// double-check individual fields // double-check individual fields
@ -108,7 +108,7 @@ public class SnapshotApiExpectTest extends BaseCinderApiExpectTest {
HttpResponse.builder().statusCode(404).build() HttpResponse.builder().statusCode(404).build()
).getSnapshotApiForZone("RegionOne"); ).getSnapshotApiForZone("RegionOne");
Set<? extends Snapshot> snapshots = api.listInDetail().toImmutableSet(); Set<? extends Snapshot> snapshots = api.listInDetail().toSet();
assertTrue(snapshots.isEmpty()); assertTrue(snapshots.isEmpty());
} }

View File

@ -92,7 +92,7 @@ public class VolumeAndSnapshotApiLiveTest extends BaseCinderApiLiveTest {
@Test(dependsOnMethods = "testCreateVolume") @Test(dependsOnMethods = "testCreateVolume")
public void testListVolumes() { public void testListVolumes() {
Set<? extends Volume> volumes = volumeApi.list().toImmutableSet(); Set<? extends Volume> volumes = volumeApi.list().toSet();
assertNotNull(volumes); assertNotNull(volumes);
boolean foundIt = false; boolean foundIt = false;
for (Volume vol : volumes) { for (Volume vol : volumes) {
@ -107,7 +107,7 @@ public class VolumeAndSnapshotApiLiveTest extends BaseCinderApiLiveTest {
@Test(dependsOnMethods = "testCreateVolume") @Test(dependsOnMethods = "testCreateVolume")
public void testListVolumesInDetail() { public void testListVolumesInDetail() {
Set<? extends Volume> volumes = volumeApi.listInDetail().toImmutableSet(); Set<? extends Volume> volumes = volumeApi.listInDetail().toSet();
assertNotNull(volumes); assertNotNull(volumes);
boolean foundIt = false; boolean foundIt = false;
for (Volume vol : volumes) { for (Volume vol : volumes) {
@ -146,7 +146,7 @@ public class VolumeAndSnapshotApiLiveTest extends BaseCinderApiLiveTest {
@Test(dependsOnMethods = "testCreateSnapshot") @Test(dependsOnMethods = "testCreateSnapshot")
public void testListSnapshots() { public void testListSnapshots() {
Set<? extends Snapshot> snapshots = snapshotApi.list().toImmutableSet(); Set<? extends Snapshot> snapshots = snapshotApi.list().toSet();
assertNotNull(snapshots); assertNotNull(snapshots);
boolean foundIt = false; boolean foundIt = false;
for (Snapshot snap : snapshots) { for (Snapshot snap : snapshots) {
@ -163,7 +163,7 @@ public class VolumeAndSnapshotApiLiveTest extends BaseCinderApiLiveTest {
@Test(dependsOnMethods = "testCreateSnapshot") @Test(dependsOnMethods = "testCreateSnapshot")
public void testListSnapshotsInDetail() { public void testListSnapshotsInDetail() {
Set<? extends Snapshot> snapshots = snapshotApi.listInDetail().toImmutableSet(); Set<? extends Snapshot> snapshots = snapshotApi.listInDetail().toSet();
assertNotNull(snapshots); assertNotNull(snapshots);
boolean foundIt = false; boolean foundIt = false;
for (Snapshot snap : snapshots) { for (Snapshot snap : snapshots) {

View File

@ -59,7 +59,7 @@ public class VolumeApiExpectTest extends BaseCinderApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_list_simple.json")).build() HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_list_simple.json")).build()
).getVolumeApiForZone("RegionOne"); ).getVolumeApiForZone("RegionOne");
Set<? extends Volume> volumes = api.list().toImmutableSet(); Set<? extends Volume> volumes = api.list().toSet();
assertEquals(volumes, ImmutableSet.of(testVolume())); assertEquals(volumes, ImmutableSet.of(testVolume()));
} }
@ -72,7 +72,7 @@ public class VolumeApiExpectTest extends BaseCinderApiExpectTest {
HttpResponse.builder().statusCode(404).build() HttpResponse.builder().statusCode(404).build()
).getVolumeApiForZone("RegionOne"); ).getVolumeApiForZone("RegionOne");
Set<? extends Volume> volumes = api.list().toImmutableSet(); Set<? extends Volume> volumes = api.list().toSet();
assertTrue(volumes.isEmpty()); assertTrue(volumes.isEmpty());
} }
@ -85,7 +85,7 @@ public class VolumeApiExpectTest extends BaseCinderApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_list_details.json")).build() HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_list_details.json")).build()
).getVolumeApiForZone("RegionOne"); ).getVolumeApiForZone("RegionOne");
Set<? extends Volume> volumes = api.listInDetail().toImmutableSet(); Set<? extends Volume> volumes = api.listInDetail().toSet();
assertEquals(volumes, ImmutableSet.of(testVolume())); assertEquals(volumes, ImmutableSet.of(testVolume()));
} }
@ -98,7 +98,7 @@ public class VolumeApiExpectTest extends BaseCinderApiExpectTest {
HttpResponse.builder().statusCode(404).build() HttpResponse.builder().statusCode(404).build()
).getVolumeApiForZone("RegionOne"); ).getVolumeApiForZone("RegionOne");
Set<? extends Volume> volumes = api.listInDetail().toImmutableSet(); Set<? extends Volume> volumes = api.listInDetail().toSet();
assertTrue(volumes.isEmpty()); assertTrue(volumes.isEmpty());
} }

View File

@ -52,7 +52,7 @@ public class VolumeTypeApiExpectTest extends BaseCinderApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_type_list_simple.json")).build() HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_type_list_simple.json")).build()
).getVolumeTypeApiForZone("RegionOne"); ).getVolumeTypeApiForZone("RegionOne");
Set<? extends VolumeType> types = api.list().toImmutableSet(); Set<? extends VolumeType> types = api.list().toSet();
assertEquals(types, ImmutableSet.of(testVolumeType())); assertEquals(types, ImmutableSet.of(testVolumeType()));
} }

View File

@ -55,7 +55,7 @@ public class VolumeTypeApiLiveTest extends BaseCinderApiLiveTest {
} }
public void testListAndGetVolumeTypes() { public void testListAndGetVolumeTypes() {
Set<? extends VolumeType> volumeTypes = volumeTypeApi.list().toImmutableSet(); Set<? extends VolumeType> volumeTypes = volumeTypeApi.list().toSet();
assertNotNull(volumeTypes); assertNotNull(volumeTypes);
for (VolumeType vt : volumeTypes) { for (VolumeType vt : volumeTypes) {

View File

@ -95,7 +95,7 @@ public class LocationIdToURIFromAccessForTypeAndVersion implements Supplier<Map<
@Override @Override
public Map<String, Supplier<URI>> get() { public Map<String, Supplier<URI>> get() {
FluentIterable<Service> services = FluentIterable.from(access.get()).filter(apiTypeEquals); FluentIterable<Service> services = FluentIterable.from(access.get()).filter(apiTypeEquals);
if (services.toImmutableSet().size() == 0) if (services.toSet().size() == 0)
throw new NoSuchElementException(String.format("apiType %s not found in catalog %s", apiType, services)); throw new NoSuchElementException(String.format("apiType %s not found in catalog %s", apiType, services));
Iterable<Endpoint> endpoints = concat(services); Iterable<Endpoint> endpoints = concat(services);

View File

@ -61,7 +61,7 @@ public class TenantApiExpectTest extends BaseKeystoneRestApiExpectTest<KeystoneA
payloadFromResourceWithContentType("/tenant_list.json", APPLICATION_JSON)).build()) payloadFromResourceWithContentType("/tenant_list.json", APPLICATION_JSON)).build())
.getTenantApi().get(); .getTenantApi().get();
assertEquals(api.list().concat().toImmutableSet(), expectedTenants); assertEquals(api.list().concat().toSet(), expectedTenants);
} }
public void testListTenantsPage() { public void testListTenantsPage() {
@ -72,7 +72,7 @@ public class TenantApiExpectTest extends BaseKeystoneRestApiExpectTest<KeystoneA
HttpResponse.builder().statusCode(200).payload( HttpResponse.builder().statusCode(200).payload(
payloadFromResourceWithContentType("/tenant_list.json", APPLICATION_JSON)).build()) payloadFromResourceWithContentType("/tenant_list.json", APPLICATION_JSON)).build())
.getTenantApi().get(); .getTenantApi().get();
Set<? extends Tenant> tenants = api.list(new PaginationOptions()).toImmutableSet(); Set<? extends Tenant> tenants = api.list(new PaginationOptions()).toSet();
assertNotNull(tenants); assertNotNull(tenants);
assertFalse(tenants.isEmpty()); assertFalse(tenants.isEmpty());
@ -93,7 +93,7 @@ public class TenantApiExpectTest extends BaseKeystoneRestApiExpectTest<KeystoneA
Set<Tenant> expected = ImmutableSet.of(Tenant.builder().name("this-is-a-test").id("14").description("None").build()); Set<Tenant> expected = ImmutableSet.of(Tenant.builder().name("this-is-a-test").id("14").description("None").build());
assertEquals(api.list().concat().toImmutableSet(), expected); assertEquals(api.list().concat().toSet(), expected);
} }
// this is not a compatible format of json per: // this is not a compatible format of json per:

View File

@ -38,7 +38,7 @@ public class TenantApiLiveTest extends BaseKeystoneApiLiveTest {
public void testTenants() { public void testTenants() {
TenantApi api = keystoneContext.getApi().getTenantApi().get(); TenantApi api = keystoneContext.getApi().getTenantApi().get();
Set<? extends Tenant> result = api.list().concat().toImmutableSet(); Set<? extends Tenant> result = api.list().concat().toSet();
assertNotNull(result); assertNotNull(result);
assertFalse(result.isEmpty()); assertFalse(result.isEmpty());

View File

@ -66,7 +66,7 @@ public class UserApiExpectTest extends BaseKeystoneRestApiExpectTest<KeystoneApi
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/user_list.json", APPLICATION_JSON)).build()) HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/user_list.json", APPLICATION_JSON)).build())
.getUserApi().get(); .getUserApi().get();
assertEquals(api.list().concat().toImmutableSet(), expectedUsers); assertEquals(api.list().concat().toSet(), expectedUsers);
} }
public void testListUsersPage() { public void testListUsersPage() {
@ -80,7 +80,7 @@ public class UserApiExpectTest extends BaseKeystoneRestApiExpectTest<KeystoneApi
assertFalse(users.isEmpty()); assertFalse(users.isEmpty());
assertEquals(users.toImmutableSet(), expectedUsers); assertEquals(users.toSet(), expectedUsers);
} }
public void testListUsersNotFound() { public void testListUsersNotFound() {

View File

@ -41,7 +41,7 @@ public class UserApiLiveTest extends BaseKeystoneApiLiveTest {
public void testUsers() { public void testUsers() {
UserApi api = keystoneContext.getApi().getUserApi().get(); UserApi api = keystoneContext.getApi().getUserApi().get();
Set<? extends User> users = api.list().concat().toImmutableSet(); Set<? extends User> users = api.list().concat().toSet();
assertNotNull(users); assertNotNull(users);
assertFalse(users.isEmpty()); assertFalse(users.isEmpty());
for (User user : users) { for (User user : users) {
@ -54,7 +54,7 @@ public class UserApiLiveTest extends BaseKeystoneApiLiveTest {
public void testUserRolesOnTenant() { public void testUserRolesOnTenant() {
UserApi api = keystoneContext.getApi().getUserApi().get(); UserApi api = keystoneContext.getApi().getUserApi().get();
Set<? extends Tenant> tenants = keystoneContext.getApi().getTenantApi().get().list().concat().toImmutableSet(); Set<? extends Tenant> tenants = keystoneContext.getApi().getTenantApi().get().list().concat().toSet();
for (User user : api.list().concat()) { for (User user : api.list().concat()) {
for (Tenant tenant : tenants) { for (Tenant tenant : tenants) {

View File

@ -159,7 +159,7 @@ public class NovaComputeServiceAdapter implements
Set<String> zones = zoneIds.get(); Set<String> zones = zoneIds.get();
checkState(zones.size() > 0, "no zones found in supplier %s", zoneIds); checkState(zones.size() > 0, "no zones found in supplier %s", zoneIds);
for (final String zoneId : zones) { for (final String zoneId : zones) {
Set<? extends Image> images = novaApi.getImageApiForZone(zoneId).listInDetail().concat().toImmutableSet(); Set<? extends Image> images = novaApi.getImageApiForZone(zoneId).listInDetail().concat().toSet();
if (images.size() == 0) { if (images.size() == 0) {
logger.debug("no images found in zone %s", zoneId); logger.debug("no images found in zone %s", zoneId);
continue; continue;

View File

@ -52,7 +52,7 @@ public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest {
if (!apiOption.isPresent()) if (!apiOption.isPresent())
continue; continue;
FloatingIPApi api = apiOption.get(); FloatingIPApi api = apiOption.get();
Set<? extends FloatingIP> response = api.list().toImmutableSet(); Set<? extends FloatingIP> response = api.list().toSet();
assert null != response; assert null != response;
assertTrue(response.size() >= 0); assertTrue(response.size() >= 0);
for (FloatingIP ip : response) { for (FloatingIP ip : response) {
@ -77,7 +77,7 @@ public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest {
FloatingIP floatingIP = api.create(); FloatingIP floatingIP = api.create();
assertNotNull(floatingIP); assertNotNull(floatingIP);
Set<? extends FloatingIP> response = api.list().toImmutableSet(); Set<? extends FloatingIP> response = api.list().toSet();
boolean ipInSet = false; boolean ipInSet = false;
for (FloatingIP ip : response) { for (FloatingIP ip : response) {
if (ip.getId().equals(floatingIP.getId())) if (ip.getId().equals(floatingIP.getId()))
@ -87,7 +87,7 @@ public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest {
api.delete(floatingIP.getId()); api.delete(floatingIP.getId());
response = api.list().toImmutableSet(); response = api.list().toSet();
ipInSet = false; ipInSet = false;
for (FloatingIP ip : response) { for (FloatingIP ip : response) {
if (ip.getId().equals(floatingIP.getId())) { if (ip.getId().equals(floatingIP.getId())) {

View File

@ -59,7 +59,7 @@ public class HostAdministrationApiExpectTest extends BaseNovaApiExpectTest {
Host expected = Host.builder().name("ubuntu").service("compute").build(); Host expected = Host.builder().name("ubuntu").service("compute").build();
Set<? extends Host> result = api.list().toImmutableSet(); Set<? extends Host> result = api.list().toSet();
Host host = Iterables.getOnlyElement(result); Host host = Iterables.getOnlyElement(result);
assertEquals(host.getName(), "ubuntu"); assertEquals(host.getName(), "ubuntu");
assertEquals(host.getService(), "compute"); assertEquals(host.getService(), "compute");
@ -84,7 +84,7 @@ public class HostAdministrationApiExpectTest extends BaseNovaApiExpectTest {
HostResourceUsage.builder().memoryMb(6144).project("f8535069c3fb404cb61c873b1a0b4921").cpu(3).diskGb(80).host("ubuntu").build() HostResourceUsage.builder().memoryMb(6144).project("f8535069c3fb404cb61c873b1a0b4921").cpu(3).diskGb(80).host("ubuntu").build()
); );
assertEquals(api.listResourceUsage("xyz").toImmutableSet(), expected); assertEquals(api.listResourceUsage("xyz").toSet(), expected);
} }
public void testEnableHost() { public void testEnableHost() {

View File

@ -65,7 +65,7 @@ public class HostAdministrationApiLiveTest extends BaseNovaApiLiveTest {
public void testListAndGet() throws Exception { public void testListAndGet() throws Exception {
if (optApi.isPresent()) { if (optApi.isPresent()) {
HostAdministrationApi api = optApi.get(); HostAdministrationApi api = optApi.get();
Set<? extends Host> hosts = api.list().toImmutableSet(); Set<? extends Host> hosts = api.list().toSet();
assertNotNull(hosts); assertNotNull(hosts);
for (Host host : hosts) { for (Host host : hosts) {
for (HostResourceUsage usage : api.listResourceUsage(host.getName())) { for (HostResourceUsage usage : api.listResourceUsage(host.getName())) {

View File

@ -78,7 +78,7 @@ public class HostAggregateApiLiveTest extends BaseNovaApiLiveTest {
public void testListAndGetAggregate() { public void testListAndGetAggregate() {
if (apiOption.isPresent()) { if (apiOption.isPresent()) {
HostAggregateApi api = apiOption.get(); HostAggregateApi api = apiOption.get();
Set<? extends HostAggregate> aggregates = api.list().toImmutableSet(); Set<? extends HostAggregate> aggregates = api.list().toSet();
for (HostAggregate aggregate : aggregates) { for (HostAggregate aggregate : aggregates) {
assertNotNull(aggregate.getId()); assertNotNull(aggregate.getId());
assertNotNull(aggregate.getName()); assertNotNull(aggregate.getName());

View File

@ -44,7 +44,7 @@ public class SecurityGroupApiLiveTest extends BaseNovaApiLiveTest {
public void list() throws Exception { public void list() throws Exception {
for (String zoneId : novaContext.getApi().getConfiguredZones()) { for (String zoneId : novaContext.getApi().getConfiguredZones()) {
SecurityGroupApi api = novaContext.getApi().getSecurityGroupExtensionForZone(zoneId).get(); SecurityGroupApi api = novaContext.getApi().getSecurityGroupExtensionForZone(zoneId).get();
Set<? extends SecurityGroup> securityGroupsList = api.list().toImmutableSet(); Set<? extends SecurityGroup> securityGroupsList = api.list().toSet();
assertNotNull(securityGroupsList); assertNotNull(securityGroupsList);
} }
} }

View File

@ -58,7 +58,7 @@ public class SimpleTenantUsageApiExpectTest extends BaseNovaApiExpectTest {
.payload(payloadFromResource("/simple_tenant_usages.json")).build()) .payload(payloadFromResource("/simple_tenant_usages.json")).build())
.getSimpleTenantUsageExtensionForZone("az-1.region-a.geo-1").get(); .getSimpleTenantUsageExtensionForZone("az-1.region-a.geo-1").get();
Set<? extends SimpleTenantUsage> results = api.list().toImmutableSet(); Set<? extends SimpleTenantUsage> results = api.list().toSet();
SimpleTenantUsage usage = Iterables.getOnlyElement(results); SimpleTenantUsage usage = Iterables.getOnlyElement(results);
assertEquals(usage.getTenantId(), "f8535069c3fb404cb61c873b1a0b4921"); assertEquals(usage.getTenantId(), "f8535069c3fb404cb61c873b1a0b4921");

View File

@ -41,7 +41,7 @@ public class SimpleTenantUsageApiLiveTest extends BaseNovaApiLiveTest {
Optional<? extends SimpleTenantUsageApi> optApi = novaContext.getApi().getSimpleTenantUsageExtensionForZone(zoneId); Optional<? extends SimpleTenantUsageApi> optApi = novaContext.getApi().getSimpleTenantUsageExtensionForZone(zoneId);
if (optApi.isPresent() && identity.endsWith(":admin")) { if (optApi.isPresent() && identity.endsWith(":admin")) {
SimpleTenantUsageApi api = optApi.get(); SimpleTenantUsageApi api = optApi.get();
Set<? extends SimpleTenantUsage> usages = api.list().toImmutableSet(); Set<? extends SimpleTenantUsage> usages = api.list().toSet();
assertNotNull(usages); assertNotNull(usages);
for (SimpleTenantUsage usage : usages) { for (SimpleTenantUsage usage : usages) {
SimpleTenantUsage details = api.get(usage.getTenantId()); SimpleTenantUsage details = api.get(usage.getTenantId());

View File

@ -55,7 +55,7 @@ public class VirtualInterfaceApiLiveTest extends BaseNovaApiLiveTest {
Server testServer = null; Server testServer = null;
try { try {
testServer = createServerInZone(zone); testServer = createServerInZone(zone);
Set<? extends VirtualInterface> results = apiOption.get().listOnServer(testServer.getId()).toImmutableSet(); Set<? extends VirtualInterface> results = apiOption.get().listOnServer(testServer.getId()).toSet();
for (VirtualInterface vif : results) { for (VirtualInterface vif : results) {
assertNotNull(vif.getId()); assertNotNull(vif.getId());
assertNotNull(vif.getMacAddress()); assertNotNull(vif.getMacAddress());

View File

@ -62,7 +62,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_list.json")).build() HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_list.json")).build()
).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
Set<? extends Volume> volumes = api.list().toImmutableSet(); Set<? extends Volume> volumes = api.list().toSet();
assertEquals(volumes, ImmutableSet.of(testVolume())); assertEquals(volumes, ImmutableSet.of(testVolume()));
} }
@ -75,7 +75,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest {
HttpResponse.builder().statusCode(404).build() HttpResponse.builder().statusCode(404).build()
).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
Set<? extends Volume> volumes = api.list().toImmutableSet(); Set<? extends Volume> volumes = api.list().toSet();
assertTrue(volumes.isEmpty()); assertTrue(volumes.isEmpty());
} }
@ -88,7 +88,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_list_detail.json")).build() HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_list_detail.json")).build()
).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
Set<? extends Volume> volumes = api.listInDetail().toImmutableSet(); Set<? extends Volume> volumes = api.listInDetail().toSet();
assertEquals(volumes, ImmutableSet.of(testVolume())); assertEquals(volumes, ImmutableSet.of(testVolume()));
} }
@ -101,7 +101,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest {
HttpResponse.builder().statusCode(404).build() HttpResponse.builder().statusCode(404).build()
).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
Set<? extends Volume> volumes = api.listInDetail().toImmutableSet(); Set<? extends Volume> volumes = api.listInDetail().toSet();
assertTrue(volumes.isEmpty()); assertTrue(volumes.isEmpty());
} }
@ -203,7 +203,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/attachment_list.json")).build() HttpResponse.builder().statusCode(200).payload(payloadFromResource("/attachment_list.json")).build()
).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
Set<? extends VolumeAttachment> attachments = api.listAttachmentsOnServer("instance-1").toImmutableSet(); Set<? extends VolumeAttachment> attachments = api.listAttachmentsOnServer("instance-1").toSet();
assertEquals(attachments, ImmutableSet.of(testAttachment())); assertEquals(attachments, ImmutableSet.of(testAttachment()));
// double-check individual fields // double-check individual fields
VolumeAttachment attachment = Iterables.getOnlyElement(attachments); VolumeAttachment attachment = Iterables.getOnlyElement(attachments);
@ -312,7 +312,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/snapshot_list.json")).build() HttpResponse.builder().statusCode(200).payload(payloadFromResource("/snapshot_list.json")).build()
).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
Set<? extends VolumeSnapshot> snapshots = api.listSnapshots().toImmutableSet(); Set<? extends VolumeSnapshot> snapshots = api.listSnapshots().toSet();
assertEquals(snapshots, ImmutableSet.of(testSnapshot())); assertEquals(snapshots, ImmutableSet.of(testSnapshot()));
} }
@ -325,7 +325,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest {
HttpResponse.builder().statusCode(404).build() HttpResponse.builder().statusCode(404).build()
).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
Set<? extends VolumeSnapshot> snapshots = api.listSnapshots().toImmutableSet(); Set<? extends VolumeSnapshot> snapshots = api.listSnapshots().toSet();
assertTrue(snapshots.isEmpty()); assertTrue(snapshots.isEmpty());
} }
@ -363,7 +363,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/snapshot_list_detail.json")).build() HttpResponse.builder().statusCode(200).payload(payloadFromResource("/snapshot_list_detail.json")).build()
).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
Set<? extends VolumeSnapshot> snapshots = api.listSnapshotsInDetail().toImmutableSet(); Set<? extends VolumeSnapshot> snapshots = api.listSnapshotsInDetail().toSet();
assertEquals(snapshots, ImmutableSet.of(testSnapshot())); assertEquals(snapshots, ImmutableSet.of(testSnapshot()));
// double-check individual fields // double-check individual fields
@ -385,7 +385,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest {
HttpResponse.builder().statusCode(404).build() HttpResponse.builder().statusCode(404).build()
).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
Set<? extends VolumeSnapshot> snapshots = api.listSnapshotsInDetail().toImmutableSet(); Set<? extends VolumeSnapshot> snapshots = api.listSnapshotsInDetail().toSet();
assertTrue(snapshots.isEmpty()); assertTrue(snapshots.isEmpty());
} }

View File

@ -108,7 +108,7 @@ public class VolumeApiLiveTest extends BaseNovaApiLiveTest {
@Test(dependsOnMethods = "testCreateVolume") @Test(dependsOnMethods = "testCreateVolume")
public void testListVolumes() { public void testListVolumes() {
if (volumeOption.isPresent()) { if (volumeOption.isPresent()) {
Set<? extends Volume> volumes = volumeOption.get().list().toImmutableSet(); Set<? extends Volume> volumes = volumeOption.get().list().toSet();
assertNotNull(volumes); assertNotNull(volumes);
boolean foundIt = false; boolean foundIt = false;
for (Volume vol : volumes) { for (Volume vol : volumes) {
@ -125,7 +125,7 @@ public class VolumeApiLiveTest extends BaseNovaApiLiveTest {
@Test(dependsOnMethods = "testCreateVolume") @Test(dependsOnMethods = "testCreateVolume")
public void testListVolumesInDetail() { public void testListVolumesInDetail() {
if (volumeOption.isPresent()) { if (volumeOption.isPresent()) {
Set<? extends Volume> volumes = volumeOption.get().listInDetail().toImmutableSet(); Set<? extends Volume> volumes = volumeOption.get().listInDetail().toSet();
assertNotNull(volumes); assertNotNull(volumes);
boolean foundIt = false; boolean foundIt = false;
for (Volume vol : volumes) { for (Volume vol : volumes) {
@ -174,7 +174,7 @@ public class VolumeApiLiveTest extends BaseNovaApiLiveTest {
@Test(dependsOnMethods = "testCreateSnapshot") @Test(dependsOnMethods = "testCreateSnapshot")
public void testListSnapshots() { public void testListSnapshots() {
if (volumeOption.isPresent()) { if (volumeOption.isPresent()) {
Set<? extends VolumeSnapshot> snapshots = volumeOption.get().listSnapshots().toImmutableSet(); Set<? extends VolumeSnapshot> snapshots = volumeOption.get().listSnapshots().toSet();
assertNotNull(snapshots); assertNotNull(snapshots);
boolean foundIt = false; boolean foundIt = false;
for (VolumeSnapshot snap : snapshots) { for (VolumeSnapshot snap : snapshots) {
@ -193,7 +193,7 @@ public class VolumeApiLiveTest extends BaseNovaApiLiveTest {
@Test(dependsOnMethods = "testCreateSnapshot") @Test(dependsOnMethods = "testCreateSnapshot")
public void testListSnapshotsInDetail() { public void testListSnapshotsInDetail() {
if (volumeOption.isPresent()) { if (volumeOption.isPresent()) {
Set<? extends VolumeSnapshot> snapshots = volumeOption.get().listSnapshotsInDetail().toImmutableSet(); Set<? extends VolumeSnapshot> snapshots = volumeOption.get().listSnapshotsInDetail().toSet();
assertNotNull(snapshots); assertNotNull(snapshots);
boolean foundIt = false; boolean foundIt = false;
for (VolumeSnapshot snap : snapshots) { for (VolumeSnapshot snap : snapshots) {
@ -225,7 +225,7 @@ public class VolumeApiLiveTest extends BaseNovaApiLiveTest {
try { try {
final String serverId = server_id = createServerInZone(zone).getId(); final String serverId = server_id = createServerInZone(zone).getId();
Set<? extends VolumeAttachment> attachments = volumeOption.get().listAttachmentsOnServer(serverId).toImmutableSet(); Set<? extends VolumeAttachment> attachments = volumeOption.get().listAttachmentsOnServer(serverId).toSet();
assertNotNull(attachments); assertNotNull(attachments);
final int before = attachments.size(); final int before = attachments.size();
@ -241,7 +241,7 @@ public class VolumeApiLiveTest extends BaseNovaApiLiveTest {
} }
}, 60 * 1000L).apply(volumeOption.get())); }, 60 * 1000L).apply(volumeOption.get()));
attachments = volumeOption.get().listAttachmentsOnServer(serverId).toImmutableSet(); attachments = volumeOption.get().listAttachmentsOnServer(serverId).toSet();
assertNotNull(attachments); assertNotNull(attachments);
assertEquals(attachments.size(), before + 1); assertEquals(attachments.size(), before + 1);

View File

@ -59,7 +59,7 @@ public class VolumeAttachmentApiExpectTest extends BaseNovaApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/attachment_list.json")).build() HttpResponse.builder().statusCode(200).payload(payloadFromResource("/attachment_list.json")).build()
).getVolumeAttachmentExtensionForZone("az-1.region-a.geo-1").get(); ).getVolumeAttachmentExtensionForZone("az-1.region-a.geo-1").get();
Set<? extends VolumeAttachment> attachments = api.listAttachmentsOnServer("instance-1").toImmutableSet(); Set<? extends VolumeAttachment> attachments = api.listAttachmentsOnServer("instance-1").toSet();
assertEquals(attachments, ImmutableSet.of(testAttachment())); assertEquals(attachments, ImmutableSet.of(testAttachment()));
// double-check individual fields // double-check individual fields
VolumeAttachment attachment = Iterables.getOnlyElement(attachments); VolumeAttachment attachment = Iterables.getOnlyElement(attachments);

View File

@ -105,7 +105,7 @@ public class VolumeAttachmentApiLiveTest extends BaseNovaApiLiveTest {
final String serverId = server_id = createServerInZone(zone).getId(); final String serverId = server_id = createServerInZone(zone).getId();
Set<? extends VolumeAttachment> attachments = Set<? extends VolumeAttachment> attachments =
volumeAttachmentApi.get().listAttachmentsOnServer(serverId).toImmutableSet(); volumeAttachmentApi.get().listAttachmentsOnServer(serverId).toSet();
assertNotNull(attachments); assertNotNull(attachments);
final int before = attachments.size(); final int before = attachments.size();
@ -121,7 +121,7 @@ public class VolumeAttachmentApiLiveTest extends BaseNovaApiLiveTest {
} }
}, 60 * 1000L).apply(volumeAttachmentApi.get())); }, 60 * 1000L).apply(volumeAttachmentApi.get()));
attachments = volumeAttachmentApi.get().listAttachmentsOnServer(serverId).toImmutableSet(); attachments = volumeAttachmentApi.get().listAttachmentsOnServer(serverId).toSet();
assertNotNull(attachments); assertNotNull(attachments);
assertEquals(attachments.size(), before + 1); assertEquals(attachments.size(), before + 1);

View File

@ -57,7 +57,7 @@ public class VolumeTypeApiExpectTest extends BaseNovaApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_type_list.json")).build() HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_type_list.json")).build()
).getVolumeTypeExtensionForZone("az-1.region-a.geo-1").get(); ).getVolumeTypeExtensionForZone("az-1.region-a.geo-1").get();
Set<? extends VolumeType> types = api.list().toImmutableSet(); Set<? extends VolumeType> types = api.list().toSet();
assertEquals(types, ImmutableSet.of(testVolumeType())); assertEquals(types, ImmutableSet.of(testVolumeType()));
} }

View File

@ -97,7 +97,7 @@ public class VolumeTypeApiLiveTest extends BaseNovaApiLiveTest {
@Test(dependsOnMethods = "testCreateVolumeType") @Test(dependsOnMethods = "testCreateVolumeType")
public void testListVolumeTypes() { public void testListVolumeTypes() {
if (volumeTypeOption.isPresent()) { if (volumeTypeOption.isPresent()) {
Set<? extends VolumeType> volumeTypes = volumeTypeOption.get().list().toImmutableSet(); Set<? extends VolumeType> volumeTypes = volumeTypeOption.get().list().toSet();
assertNotNull(volumeTypes); assertNotNull(volumeTypes);
boolean foundIt = false; boolean foundIt = false;
for (VolumeType vt : volumeTypes) { for (VolumeType vt : volumeTypes) {

View File

@ -47,7 +47,7 @@ public class FlavorApiLiveTest extends BaseNovaApiLiveTest {
public void testListFlavors() throws Exception { public void testListFlavors() throws Exception {
for (String zoneId : zones) { for (String zoneId : zones) {
FlavorApi api = novaContext.getApi().getFlavorApiForZone(zoneId); FlavorApi api = novaContext.getApi().getFlavorApiForZone(zoneId);
Set<? extends Resource> response = api.list().concat().toImmutableSet(); Set<? extends Resource> response = api.list().concat().toSet();
assertNotNull(response); assertNotNull(response);
assertFalse(response.isEmpty()); assertFalse(response.isEmpty());
for (Resource flavor : response) { for (Resource flavor : response) {
@ -67,7 +67,7 @@ public class FlavorApiLiveTest extends BaseNovaApiLiveTest {
public void testListFlavorsInDetail() throws Exception { public void testListFlavorsInDetail() throws Exception {
for (String zoneId : zones) { for (String zoneId : zones) {
FlavorApi api = novaContext.getApi().getFlavorApiForZone(zoneId); FlavorApi api = novaContext.getApi().getFlavorApiForZone(zoneId);
Set<? extends Flavor> response = api.listInDetail().concat().toImmutableSet(); Set<? extends Flavor> response = api.listInDetail().concat().toSet();
assertNotNull(response); assertNotNull(response);
assertFalse(response.isEmpty()); assertFalse(response.isEmpty());
for (Flavor flavor : response) { for (Flavor flavor : response) {
@ -90,7 +90,7 @@ public class FlavorApiLiveTest extends BaseNovaApiLiveTest {
public void testGetFlavorById() throws Exception { public void testGetFlavorById() throws Exception {
for (String zoneId : zones) { for (String zoneId : zones) {
FlavorApi api = novaContext.getApi().getFlavorApiForZone(zoneId); FlavorApi api = novaContext.getApi().getFlavorApiForZone(zoneId);
Set<? extends Flavor> response = api.listInDetail().concat().toImmutableSet(); Set<? extends Flavor> response = api.listInDetail().concat().toSet();
for (Flavor flavor : response) { for (Flavor flavor : response) {
Flavor details = api.get(flavor.getId()); Flavor details = api.get(flavor.getId());
assertNotNull(details); assertNotNull(details);

View File

@ -42,7 +42,7 @@ public class ImageApiLiveTest extends BaseNovaApiLiveTest {
public void testListImages() throws Exception { public void testListImages() throws Exception {
for (String zoneId : zones) { for (String zoneId : zones) {
ImageApi api = novaContext.getApi().getImageApiForZone(zoneId); ImageApi api = novaContext.getApi().getImageApiForZone(zoneId);
Set<? extends Resource> response = api.list().concat().toImmutableSet(); Set<? extends Resource> response = api.list().concat().toSet();
assertNotNull(response); assertNotNull(response);
assertFalse(response.isEmpty()); assertFalse(response.isEmpty());
for (Resource image : response) { for (Resource image : response) {
@ -57,7 +57,7 @@ public class ImageApiLiveTest extends BaseNovaApiLiveTest {
public void testListImagesInDetail() throws Exception { public void testListImagesInDetail() throws Exception {
for (String zoneId : novaContext.getApi().getConfiguredZones()) { for (String zoneId : novaContext.getApi().getConfiguredZones()) {
ImageApi api = novaContext.getApi().getImageApiForZone(zoneId); ImageApi api = novaContext.getApi().getImageApiForZone(zoneId);
Set<? extends Image> response = api.listInDetail().concat().toImmutableSet(); Set<? extends Image> response = api.listInDetail().concat().toSet();
assertNotNull(response); assertNotNull(response);
assertFalse(response.isEmpty()); assertFalse(response.isEmpty());
for (Image image : response) { for (Image image : response) {
@ -81,7 +81,7 @@ public class ImageApiLiveTest extends BaseNovaApiLiveTest {
public void testGetImageById() throws Exception { public void testGetImageById() throws Exception {
for (String zoneId : novaContext.getApi().getConfiguredZones()) { for (String zoneId : novaContext.getApi().getConfiguredZones()) {
ImageApi api = novaContext.getApi().getImageApiForZone(zoneId); ImageApi api = novaContext.getApi().getImageApiForZone(zoneId);
Set<? extends Image> response = api.listInDetail().concat().toImmutableSet(); Set<? extends Image> response = api.listInDetail().concat().toSet();
for (Image image : response) { for (Image image : response) {
Image details = api.get(image.getId()); Image details = api.get(image.getId());
assertNotNull(details); assertNotNull(details);

View File

@ -54,7 +54,7 @@ public class LoadBalancerApiExpectTest extends BaseCloudLoadBalancerApiExpectTes
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/loadbalancers-list.json")).build() HttpResponse.builder().statusCode(200).payload(payloadFromResource("/loadbalancers-list.json")).build()
).getLoadBalancerApiForZone("DFW"); ).getLoadBalancerApiForZone("DFW");
Set<LoadBalancer> loadBalancers = api.list().concat().toImmutableSet(); Set<LoadBalancer> loadBalancers = api.list().concat().toSet();
assertEquals(loadBalancers, testLoadBalancers()); assertEquals(loadBalancers, testLoadBalancers());
} }

View File

@ -106,7 +106,7 @@ public class LoadBalancerApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
public void testListLoadBalancers() throws Exception { public void testListLoadBalancers() throws Exception {
for (String zone: clbApi.getConfiguredZones()) { for (String zone: clbApi.getConfiguredZones()) {
Set<LoadBalancer> response = clbApi.getLoadBalancerApiForZone(zone).list().concat().toImmutableSet(); Set<LoadBalancer> response = clbApi.getLoadBalancerApiForZone(zone).list().concat().toSet();
assertNotNull(response); assertNotNull(response);
assertTrue(response.size() >= 0); assertTrue(response.size() >= 0);

View File

@ -51,7 +51,7 @@ public class NodeApiExpectTest extends BaseCloudLoadBalancerApiExpectTest<CloudL
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/nodes-list.json")).build() HttpResponse.builder().statusCode(200).payload(payloadFromResource("/nodes-list.json")).build()
).getNodeApiForZoneAndLoadBalancer("DFW", 2000); ).getNodeApiForZoneAndLoadBalancer("DFW", 2000);
Set<Node> nodes = api.list().concat().toImmutableSet(); Set<Node> nodes = api.list().concat().toSet();
assertEquals(nodes, testNodes()); assertEquals(nodes, testNodes());
} }

View File

@ -105,7 +105,7 @@ public class NodeApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
@Test(dependsOnMethods = "testModifyNode") @Test(dependsOnMethods = "testModifyNode")
public void testListNodes() throws Exception { public void testListNodes() throws Exception {
for (LoadBalancer lb : nodes.keySet()) { for (LoadBalancer lb : nodes.keySet()) {
Set<Node> response = clbApi.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).list().concat().toImmutableSet(); Set<Node> response = clbApi.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).list().concat().toSet();
assert null != response; assert null != response;
assertTrue(response.size() >= 0); assertTrue(response.size() >= 0);
for (Node n : response) { for (Node n : response) {

View File

@ -111,7 +111,7 @@ public class BulkMessageApiLiveTest extends BaseSQSApiLiveTest {
} }
protected Set<Message> collectMessages(MessageApi api) { protected Set<Message> collectMessages(MessageApi api) {
return SQS.receiveAllAtRate(api, idPayload.size(), attribute("None").visibilityTimeout(5)).toImmutableSet(); return SQS.receiveAllAtRate(api, idPayload.size(), attribute("None").visibilityTimeout(5)).toSet();
} }
@Test(dependsOnMethods = "testChangeMessageVisibility") @Test(dependsOnMethods = "testChangeMessageVisibility")

View File

@ -86,7 +86,7 @@ public class ConcurrentOpenSocketFinder implements OpenSocketFinder {
public HostAndPort apply(String from) { public HostAndPort apply(String from) {
return HostAndPort.fromParts(from, port); return HostAndPort.fromParts(from, port);
} }
}).toImmutableSet(); }).toSet();
// Specify a retry period of 1s, expressed in the same time units. // Specify a retry period of 1s, expressed in the same time units.
long period = timeUnits.convert(1, TimeUnit.SECONDS); long period = timeUnits.convert(1, TimeUnit.SECONDS);

View File

@ -49,7 +49,7 @@ public class TransformingSetSupplier<F, T> implements Supplier<Set<? extends T>>
.filter(notNull()) .filter(notNull())
.transform(converter) .transform(converter)
.filter(notNull()) .filter(notNull())
.toImmutableSet(); .toSet();
} }
@Override @Override

View File

@ -58,7 +58,7 @@ public final class Bundles {
.filter(Predicates.notNull()) .filter(Predicates.notNull())
.transform(instantiateIfPossible(type)) .transform(instantiateIfPossible(type))
.filter(Predicates.notNull()) .filter(Predicates.notNull())
.toImmutableSet(); .toSet();
} }
/** /**

View File

@ -70,7 +70,7 @@ public class AdvanceUntilEmptyIterableTest {
AdvanceUntilEmptyIterable<String> iterable = new AdvanceUntilEmptyIterable<String>(nextIterable); AdvanceUntilEmptyIterable<String> iterable = new AdvanceUntilEmptyIterable<String>(nextIterable);
Assert.assertEquals(iterable.concat().toImmutableSet(), Assert.assertEquals(iterable.concat().toSet(),
ImmutableSet.of("foo", "bar", "boo", "baz", "ham", "cheeze")); ImmutableSet.of("foo", "bar", "boo", "baz", "ham", "cheeze"));
EasyMock.verify(nextIterable); EasyMock.verify(nextIterable);

View File

@ -18,7 +18,7 @@ public class IterableWithMarkersTest {
public void testElementsEqual() { public void testElementsEqual() {
IterableWithMarker<String> initial = IterableWithMarkers.from(ImmutableSet.of("foo", "bar")); IterableWithMarker<String> initial = IterableWithMarkers.from(ImmutableSet.of("foo", "bar"));
Assert.assertEquals(initial.toImmutableSet(), ImmutableSet.of("foo", "bar")); Assert.assertEquals(initial.toSet(), ImmutableSet.of("foo", "bar"));
Assert.assertEquals(initial.nextMarker(), Optional.absent()); Assert.assertEquals(initial.nextMarker(), Optional.absent());
} }
@ -26,7 +26,7 @@ public class IterableWithMarkersTest {
public void testMarkerEqual() { public void testMarkerEqual() {
IterableWithMarker<String> initial = IterableWithMarkers.from(ImmutableSet.of("foo", "bar"), "MARKER"); IterableWithMarker<String> initial = IterableWithMarkers.from(ImmutableSet.of("foo", "bar"), "MARKER");
Assert.assertEquals(initial.toImmutableSet(), ImmutableSet.of("foo", "bar")); Assert.assertEquals(initial.toSet(), ImmutableSet.of("foo", "bar"));
Assert.assertEquals(initial.nextMarker(), Optional.of("MARKER")); Assert.assertEquals(initial.nextMarker(), Optional.of("MARKER"));
} }
} }

View File

@ -68,7 +68,7 @@ public class PagedIterablesTest {
PagedIterable<String> iterable = PagedIterables.advance(initial, markerToNext); PagedIterable<String> iterable = PagedIterables.advance(initial, markerToNext);
Assert.assertEquals(iterable.concat().toImmutableSet(), Assert.assertEquals(iterable.concat().toSet(),
ImmutableSet.of("foo", "bar", "boo", "baz", "ham", "cheeze")); ImmutableSet.of("foo", "bar", "boo", "baz", "ham", "cheeze"));
EasyMock.verify(markerToNext); EasyMock.verify(markerToNext);

View File

@ -144,7 +144,7 @@ public class LoadBalancerApiExpectTest extends BaseELBApiExpectTest {
LoadBalancer lb1 = new GetLoadBalancerResponseTest().expected().toBuilder().name("my-load-balancer-1").build(); LoadBalancer lb1 = new GetLoadBalancerResponseTest().expected().toBuilder().name("my-load-balancer-1").build();
LoadBalancer lb2 = new GetLoadBalancerResponseTest().expected(); LoadBalancer lb2 = new GetLoadBalancerResponseTest().expected();
assertEquals(apiWhenExist.getLoadBalancerApi().list().concat().toImmutableSet(), ImmutableSet.of(lb1, lb2)); assertEquals(apiWhenExist.getLoadBalancerApi().list().concat().toSet(), ImmutableSet.of(lb1, lb2));
} }
public void testList2PagesWhenResponseIs2xxInEU() throws Exception { public void testList2PagesWhenResponseIs2xxInEU() throws Exception {
@ -203,7 +203,7 @@ public class LoadBalancerApiExpectTest extends BaseELBApiExpectTest {
ELBApi apiWhenDontExist = requestSendsResponse( ELBApi apiWhenDontExist = requestSendsResponse(
list, listResponse); list, listResponse);
assertEquals(apiWhenDontExist.getLoadBalancerApi().list().get(0).toImmutableSet(), ImmutableSet.of()); assertEquals(apiWhenDontExist.getLoadBalancerApi().list().get(0).toSet(), ImmutableSet.of());
} }

View File

@ -149,7 +149,7 @@ public class UserApiExpectTest extends BaseIAMApiExpectTest {
IAMApi apiWhenExist = requestsSendResponses(list, listResponse, list2, list2Response); IAMApi apiWhenExist = requestsSendResponses(list, listResponse, list2, list2Response);
assertEquals(apiWhenExist.getUserApi().list().concat().toImmutableList(), assertEquals(apiWhenExist.getUserApi().list().concat().toList(),
ImmutableList.copyOf(Iterables.concat(new ListUsersResponseTest().expected(), new ListUsersResponseTest().expected()))); ImmutableList.copyOf(Iterables.concat(new ListUsersResponseTest().expected(), new ListUsersResponseTest().expected())));
} }

View File

@ -49,7 +49,7 @@ public class ImageApiLiveTest extends BaseGlanceApiLiveTest {
public void testList() throws Exception { public void testList() throws Exception {
for (String zoneId : glanceContext.getApi().getConfiguredZones()) { for (String zoneId : glanceContext.getApi().getConfiguredZones()) {
ImageApi api = glanceContext.getApi().getImageApiForZone(zoneId); ImageApi api = glanceContext.getApi().getImageApiForZone(zoneId);
Set<? extends Image> response = api.list().concat().toImmutableSet(); Set<? extends Image> response = api.list().concat().toSet();
assert null != response; assert null != response;
for (Image image : response) { for (Image image : response) {
checkImage(image); checkImage(image);
@ -67,7 +67,7 @@ public class ImageApiLiveTest extends BaseGlanceApiLiveTest {
public void testListInDetail() throws Exception { public void testListInDetail() throws Exception {
for (String zoneId : glanceContext.getApi().getConfiguredZones()) { for (String zoneId : glanceContext.getApi().getConfiguredZones()) {
ImageApi api = glanceContext.getApi().getImageApiForZone(zoneId); ImageApi api = glanceContext.getApi().getImageApiForZone(zoneId);
Set<? extends ImageDetails> response = api.listInDetail().concat().toImmutableSet(); Set<? extends ImageDetails> response = api.listInDetail().concat().toSet();
assert null != response; assert null != response;
for (ImageDetails image : response) { for (ImageDetails image : response) {
checkImage(image); checkImage(image);

View File

@ -55,7 +55,7 @@ public class NetworkApiExpectTest extends BaseQuantumApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/list_network_refs.json", APPLICATION_JSON)).build()) HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/list_network_refs.json", APPLICATION_JSON)).build())
.getNetworkApiForZone("region-a.geo-1"); .getNetworkApiForZone("region-a.geo-1");
Set<? extends Reference> nets = api.listReferences().toImmutableSet(); Set<? extends Reference> nets = api.listReferences().toSet();
assertEquals(nets, listOfNetworkRefs()); assertEquals(nets, listOfNetworkRefs());
} }
@ -76,7 +76,7 @@ public class NetworkApiExpectTest extends BaseQuantumApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/list_networks.json", APPLICATION_JSON)).build()) HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/list_networks.json", APPLICATION_JSON)).build())
.getNetworkApiForZone("region-a.geo-1"); .getNetworkApiForZone("region-a.geo-1");
Set<? extends Network> nets = api.list().toImmutableSet(); Set<? extends Network> nets = api.list().toSet();
assertEquals(nets, listOfNetworks()); assertEquals(nets, listOfNetworks());
} }

View File

@ -42,8 +42,8 @@ public class NetworkApiLiveTest extends BaseQuantumApiLiveTest {
public void testListNetworks() { public void testListNetworks() {
for (String zoneId : quantumContext.getApi().getConfiguredZones()) { for (String zoneId : quantumContext.getApi().getConfiguredZones()) {
Set<? extends Reference> ids = quantumContext.getApi().getNetworkApiForZone(zoneId).listReferences().toImmutableSet(); Set<? extends Reference> ids = quantumContext.getApi().getNetworkApiForZone(zoneId).listReferences().toSet();
Set<? extends Network> networks = quantumContext.getApi().getNetworkApiForZone(zoneId).list().toImmutableSet(); Set<? extends Network> networks = quantumContext.getApi().getNetworkApiForZone(zoneId).list().toSet();
assertNotNull(ids); assertNotNull(ids);
assertEquals(ids.size(), networks.size()); assertEquals(ids.size(), networks.size());
for (Network network : networks) { for (Network network : networks) {

View File

@ -56,7 +56,7 @@ public class PortApiExpectTest extends BaseQuantumApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromStringWithContentType("{\"ports\": [{\"id\": \"a6058a59-fa8c-46cc-bac8-08904e6ff0a5\"}]}", APPLICATION_JSON)).build()) HttpResponse.builder().statusCode(200).payload(payloadFromStringWithContentType("{\"ports\": [{\"id\": \"a6058a59-fa8c-46cc-bac8-08904e6ff0a5\"}]}", APPLICATION_JSON)).build())
.getPortApiForZoneAndNetwork("region-a.geo-1", "1a104cf5-cb18-4d35-9407-2fd2646d9d0b"); .getPortApiForZoneAndNetwork("region-a.geo-1", "1a104cf5-cb18-4d35-9407-2fd2646d9d0b");
Set<? extends Reference> nets = api.listReferences().toImmutableSet(); Set<? extends Reference> nets = api.listReferences().toSet();
assertEquals(nets, ImmutableSet.of(Reference.builder().id("a6058a59-fa8c-46cc-bac8-08904e6ff0a5").build())); assertEquals(nets, ImmutableSet.of(Reference.builder().id("a6058a59-fa8c-46cc-bac8-08904e6ff0a5").build()));
} }
@ -77,7 +77,7 @@ public class PortApiExpectTest extends BaseQuantumApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromStringWithContentType("{\"ports\": [{\"state\": \"DOWN\", \"id\": \"814ae4bb-33d9-425f-8ee2-13a5c90b1465\"}]}", APPLICATION_JSON)).build()) HttpResponse.builder().statusCode(200).payload(payloadFromStringWithContentType("{\"ports\": [{\"state\": \"DOWN\", \"id\": \"814ae4bb-33d9-425f-8ee2-13a5c90b1465\"}]}", APPLICATION_JSON)).build())
.getPortApiForZoneAndNetwork("region-a.geo-1", "1a104cf5-cb18-4d35-9407-2fd2646d9d0b"); .getPortApiForZoneAndNetwork("region-a.geo-1", "1a104cf5-cb18-4d35-9407-2fd2646d9d0b");
Set<? extends Port> nets = api.list().toImmutableSet(); Set<? extends Port> nets = api.list().toSet();
assertEquals(nets, ImmutableSet.of(Port.builder().state(Port.State.DOWN).id("814ae4bb-33d9-425f-8ee2-13a5c90b1465").build())); assertEquals(nets, ImmutableSet.of(Port.builder().state(Port.State.DOWN).id("814ae4bb-33d9-425f-8ee2-13a5c90b1465").build()));
} }

View File

@ -46,11 +46,11 @@ public class PortApiLiveTest extends BaseQuantumApiLiveTest {
public void testListPorts() { public void testListPorts() {
for (String zoneId : quantumContext.getApi().getConfiguredZones()) { for (String zoneId : quantumContext.getApi().getConfiguredZones()) {
NetworkApi netApi = quantumContext.getApi().getNetworkApiForZone(zoneId); NetworkApi netApi = quantumContext.getApi().getNetworkApiForZone(zoneId);
Set<? extends Reference> nets = netApi.listReferences().toImmutableSet(); Set<? extends Reference> nets = netApi.listReferences().toSet();
for(Reference net : nets) { for(Reference net : nets) {
PortApi portApi = quantumContext.getApi().getPortApiForZoneAndNetwork(zoneId, net.getId()); PortApi portApi = quantumContext.getApi().getPortApiForZoneAndNetwork(zoneId, net.getId());
Set<? extends Reference> portRefs = portApi.listReferences().toImmutableSet(); Set<? extends Reference> portRefs = portApi.listReferences().toSet();
Set<? extends Port> ports = portApi.list().toImmutableSet(); Set<? extends Port> ports = portApi.list().toSet();
assertEquals(portRefs.size(), ports.size()); assertEquals(portRefs.size(), ports.size());
for (Port port : ports) { for (Port port : ports) {

View File

@ -68,7 +68,7 @@ public class ContainerApiExpectTest extends BaseSwiftApiExpectTest {
SwiftApi apiWhenNoContainersExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword, SwiftApi apiWhenNoContainersExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
responseWithKeystoneAccess, list, listResponse); responseWithKeystoneAccess, list, listResponse);
assertEquals(apiWhenNoContainersExist.getContainerApiForRegion("region-a.geo-1").list().toImmutableSet(), assertEquals(apiWhenNoContainersExist.getContainerApiForRegion("region-a.geo-1").list().toSet(),
ImmutableSet.of()); ImmutableSet.of());
} }

View File

@ -141,7 +141,7 @@ public class InstanceApiExpectTest extends BaseRDSApiExpectTest {
RDSApi apiWhenExist = requestsSendResponses( RDSApi apiWhenExist = requestsSendResponses(
list, listResponse, list2, list2Response); list, listResponse, list2, list2Response);
assertEquals(apiWhenExist.getInstanceApi().list().concat().toImmutableList(), assertEquals(apiWhenExist.getInstanceApi().list().concat().toList(),
ImmutableList.copyOf(Iterables.concat(new DescribeDBInstancesResponseTest().expected(), ImmutableList.copyOf(Iterables.concat(new DescribeDBInstancesResponseTest().expected(),
new DescribeDBInstancesResponseTest().expected()))); new DescribeDBInstancesResponseTest().expected())));
} }

View File

@ -195,7 +195,7 @@ public class SecurityGroupApiExpectTest extends BaseRDSApiExpectTest {
RDSApi apiWhenExist = requestsSendResponses( RDSApi apiWhenExist = requestsSendResponses(
list, listResponse, list2, list2Response); list, listResponse, list2, list2Response);
assertEquals(apiWhenExist.getSecurityGroupApi().list().concat().toImmutableList(), assertEquals(apiWhenExist.getSecurityGroupApi().list().concat().toList(),
ImmutableList.copyOf(Iterables.concat(new DescribeDBSecurityGroupsResponseTest().expected(), ImmutableList.copyOf(Iterables.concat(new DescribeDBSecurityGroupsResponseTest().expected(),
new DescribeDBSecurityGroupsResponseTest().expected()))); new DescribeDBSecurityGroupsResponseTest().expected())));
} }

View File

@ -141,7 +141,7 @@ public class SubnetGroupApiExpectTest extends BaseRDSApiExpectTest {
RDSApi apiWhenExist = requestsSendResponses( RDSApi apiWhenExist = requestsSendResponses(
list, listResponse, list2, list2Response); list, listResponse, list2, list2Response);
assertEquals(apiWhenExist.getSubnetGroupApi().list().concat().toImmutableList(), assertEquals(apiWhenExist.getSubnetGroupApi().list().concat().toList(),
ImmutableList.copyOf(Iterables.concat(new DescribeDBSubnetGroupsResponseTest().expected(), ImmutableList.copyOf(Iterables.concat(new DescribeDBSubnetGroupsResponseTest().expected(),
new DescribeDBSubnetGroupsResponseTest().expected()))); new DescribeDBSubnetGroupsResponseTest().expected())));
} }

View File

@ -206,7 +206,7 @@ public class GleSYSComputeServiceAdapter implements ComputeServiceAdapter<Server
@Override @Override
public Set<OSTemplate> listImages() { public Set<OSTemplate> listImages() {
return api.getServerApi().listTemplates().toImmutableSet(); return api.getServerApi().listTemplates().toSet();
} }
// cheat until we have a getTemplate command // cheat until we have a getTemplate command

View File

@ -55,7 +55,7 @@ public class ArchiveApiExpectTest extends BaseGleSYSApiExpectTest {
Set<Archive> expected = ImmutableSet.of( Set<Archive> expected = ImmutableSet.of(
Archive.builder().username("xxxxx_test1").freeSize("20 GB").totalSize("30 GB").locked(false).build()); Archive.builder().username("xxxxx_test1").freeSize("20 GB").totalSize("30 GB").locked(false).build());
assertEquals(api.list().toImmutableSet(), expected); assertEquals(api.list().toSet(), expected);
} }
public void testListArchivesWhenResponseIs4xxReturnsEmpty() { public void testListArchivesWhenResponseIs4xxReturnsEmpty() {

View File

@ -69,7 +69,7 @@ public class EmailAccountApiExpectTest extends BaseGleSYSApiExpectTest {
.modified(dateService.iso8601SecondsDateParse("2012-06-24T11:53:48+02:00")).build() .modified(dateService.iso8601SecondsDateParse("2012-06-24T11:53:48+02:00")).build()
); );
Set<EmailAccount> actual = api.listDomain("cl13016.test.jclouds.org").toImmutableSet(); Set<EmailAccount> actual = api.listDomain("cl13016.test.jclouds.org").toSet();
assertEquals(actual, expected); assertEquals(actual, expected);
assertEquals(Iterables.get(actual, 0).toString(), Iterables.get(expected, 0).toString()); assertEquals(Iterables.get(actual, 0).toString(), Iterables.get(expected, 0).toString());
} }

View File

@ -158,7 +158,7 @@ public class IpApiExpectTest extends BaseGleSYSApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/ip_list_free.json")).build()) HttpResponse.builder().statusCode(200).payload(payloadFromResource("/ip_list_free.json")).build())
.getIpApi(); .getIpApi();
assertEquals(api.listFree(4, "Falkenberg", "OpenVZ").toImmutableSet(), ParseIpAddressFromResponseTest.EXPECTED_IPS); assertEquals(api.listFree(4, "Falkenberg", "OpenVZ").toSet(), ParseIpAddressFromResponseTest.EXPECTED_IPS);
} }
public void testListFreeWhenResponseIs404ReturnsEmptySet() { public void testListFreeWhenResponseIs404ReturnsEmptySet() {
@ -169,7 +169,7 @@ public class IpApiExpectTest extends BaseGleSYSApiExpectTest {
HttpResponse.builder().statusCode(404).build()) HttpResponse.builder().statusCode(404).build())
.getIpApi(); .getIpApi();
assertEquals(api.listFree(6, "Falkenberg", "OpenVZ").toImmutableSet(), ImmutableSet.of()); assertEquals(api.listFree(6, "Falkenberg", "OpenVZ").toSet(), ImmutableSet.of());
} }
public void testAddWhenResponseIs2xx() { public void testAddWhenResponseIs2xx() {

View File

@ -73,7 +73,7 @@ public class ServerApiExpectTest extends BaseGleSYSApiExpectTest {
HttpResponse.builder().statusCode(204).payload(payloadFromResource("/server_list.json")).build()).getServerApi(); HttpResponse.builder().statusCode(204).payload(payloadFromResource("/server_list.json")).build()).getServerApi();
Server expected = Server.builder().id("vz1541880").hostname("mammamia").datacenter("Falkenberg").platform("OpenVZ").build(); Server expected = Server.builder().id("vz1541880").hostname("mammamia").datacenter("Falkenberg").platform("OpenVZ").build();
assertEquals(api.list().toImmutableSet(), ImmutableSet.<Server>of(expected)); assertEquals(api.list().toSet(), ImmutableSet.<Server>of(expected));
} }
public void testListServersWhenReponseIs404IsEmpty() { public void testListServersWhenReponseIs404IsEmpty() {
@ -162,7 +162,7 @@ public class ServerApiExpectTest extends BaseGleSYSApiExpectTest {
expectedBuilder.add(OSTemplate.builder().name(name).minDiskSize(20).minMemSize(1024).os("windows").platform("Xen").build()); expectedBuilder.add(OSTemplate.builder().name(name).minDiskSize(20).minMemSize(1024).os("windows").platform("Xen").build());
} }
assertEquals(api.listTemplates().toImmutableSet(), expectedBuilder.build()); assertEquals(api.listTemplates().toSet(), expectedBuilder.build());
} }
public void testGetServerDetailsWhenResponseIs2xx() throws Exception { public void testGetServerDetailsWhenResponseIs2xx() throws Exception {