Prefer immutable over empty collections

The former does not create an object when calling iterator(), as
discussed here:

https://groups.google.com/d/msg/jclouds-dev/l7BviKDXreA/mP6Ow_RYxIgJ
This commit is contained in:
Andrew Gaul 2012-10-20 14:22:49 -07:00
parent 38d3b7d76c
commit 28d7a6f143
73 changed files with 441 additions and 478 deletions

View File

@ -20,7 +20,6 @@ package org.jclouds.cloudloadbalancers.features;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.Set;
import org.jclouds.cloudloadbalancers.domain.NodeAttributes;
@ -38,6 +37,7 @@ import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableList;
import com.google.inject.TypeLiteral;
/**
@ -85,7 +85,7 @@ public class NodeAsyncClientTest extends BaseCloudLoadBalancersAsyncClientTest<N
public void createNodesInLoadBalancerWithType() throws SecurityException, NoSuchMethodException, IOException {
Method method = NodeAsyncClient.class.getMethod("createNodesInLoadBalancer", Set.class, int.class);
HttpRequest httpRequest = processor.createRequest(method, Collections.<NodeRequest>singleton(NodeRequest.builder().
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<NodeRequest>of(NodeRequest.builder().
address("192.168.1.1").port(8080).build()), 3);
assertRequestLineEquals(httpRequest,

View File

@ -22,7 +22,6 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@ -30,6 +29,8 @@ import java.util.Set;
import java.util.Map.Entry;
import java.util.logging.Logger;
import com.google.common.collect.ImmutableSet;
import org.jclouds.cloudloadbalancers.domain.LoadBalancer;
import org.jclouds.cloudloadbalancers.domain.LoadBalancerRequest;
import org.jclouds.cloudloadbalancers.domain.Node;
@ -71,7 +72,7 @@ public class NodeClientLiveTest extends BaseCloudLoadBalancersClientLiveTest {
String region = lb.getRegion();
Logger.getAnonymousLogger().info("starting node on loadbalancer " + lb.getId() + " in region " + region);
Set<Node> newNodes = client.getNodeClient(region).createNodesInLoadBalancer(
Collections.<NodeRequest> singleton(NodeRequest.builder().address("192.168.1.2").port(8080).build()),
ImmutableSet.<NodeRequest> of(NodeRequest.builder().address("192.168.1.2").port(8080).build()),
lb.getId());
for (Node n : newNodes) {

View File

@ -21,7 +21,6 @@ package org.jclouds.cloudstack.compute.strategy;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import java.util.Collections;
import java.util.Map;
import org.jclouds.cloudstack.compute.options.CloudStackTemplateOptions;
@ -36,7 +35,7 @@ import com.google.common.collect.ImmutableSet;
@Test(singleThreaded = true, testName="OptionsConverterTest")
public class OptionsConverterTest {
private static final Map<String,Network> EMPTY_NETWORKS_MAP = Collections.<String, Network>emptyMap();
private static final Map<String,Network> EMPTY_NETWORKS_MAP = ImmutableMap.<String, Network>of();
private static final String ZONE_ID = "2";
private final NetworkService firewallServiceWithStaticNat
= NetworkService.builder().name("Firewall").capabilities(ImmutableMap.of("StaticNat", "true")).build();

View File

@ -21,7 +21,6 @@ package org.jclouds.cloudstack.features;
import static org.testng.Assert.assertEquals;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.Set;
import java.util.TimeZone;
@ -112,7 +111,7 @@ public class GlobalHostClientExpectTest extends BaseCloudStackRestClientExpectTe
Host expected = Host.builder().id("1").name("cs2-xevsrv.alucloud.local").state(Host.State.UP).type(Host.Type.ROUTING).ipAddress("10.26.26.107").zoneId("1").zoneName("Dev Zone 1").podId("1").podName("Dev Pod 1").version("2.2.12.20110928142833").hypervisor("XenServer").cpuNumber(24).cpuSpeed(2266).cpuAllocated("2.76%").cpuUsed("0.1%").cpuWithOverProvisioning(54384.0F).networkKbsRead(4443).networkKbsWrite(15048).memoryTotal(100549733760L).memoryAllocated(3623878656L).memoryUsed(3623878656L).capabilities("xen-3.0-x86_64 , xen-3.0-x86_32p , hvm-3.0-x86_32 , hvm-3.0-x86_32p , hvm-3.0-x86_64").lastPinged(lastPinged).managementServerId("223098941760041").clusterId("1").clusterName("Xen Clust 1").clusterType(Host.ClusterType.CLOUD_MANAGED).localStorageActive(false).created(created).events("PrepareUnmanaged; HypervisorVersionChanged; ManagementServerDown; PingTimeout; AgentDisconnected; MaintenanceRequested; HostDown; AgentConnected; StartAgentRebalance; ShutdownRequested; Ping").hasEnoughCapacity(false).allocationState(AllocationState.ENABLED).build();
Host actual = requestSendsResponse(request, response).addHost("1", "http://example.com", "XenServer", "fred", "sekrit",
AddHostOptions.Builder.hostTags(Collections.<String>emptySet()).allocationState(AllocationState.ENABLED).clusterId("1").clusterName("Xen Clust 1").podId("1"));
AddHostOptions.Builder.hostTags(ImmutableSet.<String>of()).allocationState(AllocationState.ENABLED).clusterId("1").clusterName("Xen Clust 1").podId("1"));
assertEquals(actual, expected);
}
@ -131,7 +130,7 @@ public class GlobalHostClientExpectTest extends BaseCloudStackRestClientExpectTe
Date created = makeDate(2011, Calendar.NOVEMBER, 26, 23, 28, 36, "GMT+02:00");
Host expected = Host.builder().id("1").name("cs2-xevsrv.alucloud.local").state(Host.State.UP).type(Host.Type.ROUTING).ipAddress("10.26.26.107").zoneId("1").zoneName("Dev Zone 1").podId("1").podName("Dev Pod 1").version("2.2.12.20110928142833").hypervisor("XenServer").cpuNumber(24).cpuSpeed(2266).cpuAllocated("2.76%").cpuUsed("0.1%").cpuWithOverProvisioning(54384.0F).networkKbsRead(4443).networkKbsWrite(15048).memoryTotal(100549733760L).memoryAllocated(3623878656L).memoryUsed(3623878656L).capabilities("xen-3.0-x86_64 , xen-3.0-x86_32p , hvm-3.0-x86_32 , hvm-3.0-x86_32p , hvm-3.0-x86_64").lastPinged(lastPinged).managementServerId("223098941760041").clusterId("1").clusterName("Xen Clust 1").clusterType(Host.ClusterType.CLOUD_MANAGED).localStorageActive(false).created(created).events("PrepareUnmanaged; HypervisorVersionChanged; ManagementServerDown; PingTimeout; AgentDisconnected; MaintenanceRequested; HostDown; AgentConnected; StartAgentRebalance; ShutdownRequested; Ping").hasEnoughCapacity(false).allocationState(AllocationState.ENABLED).build();
Host actual = requestSendsResponse(request, response).updateHost("1", UpdateHostOptions.Builder.allocationState(AllocationState.ENABLED).hostTags(Collections.<String>emptySet()).osCategoryId("5"));
Host actual = requestSendsResponse(request, response).updateHost("1", UpdateHostOptions.Builder.allocationState(AllocationState.ENABLED).hostTags(ImmutableSet.<String>of()).osCategoryId("5"));
assertEquals(actual, expected);
}

View File

@ -21,7 +21,7 @@ package org.jclouds.deltacloud.options;
import static org.jclouds.deltacloud.options.CreateInstanceOptions.Builder.named;
import static org.testng.Assert.assertEquals;
import java.util.Collections;
import com.google.common.collect.ImmutableList;
import org.jclouds.http.options.HttpRequestOptions;
import org.testng.annotations.Test;
@ -43,19 +43,19 @@ public class CreateInstanceOptionsTest {
public void testWithNamed() {
CreateInstanceOptions options = new CreateInstanceOptions();
options.named("test");
assertEquals(options.buildFormParameters().get("name"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("name"), ImmutableList.of("test"));
}
@Test
public void testNullWithNamed() {
CreateInstanceOptions options = new CreateInstanceOptions();
assertEquals(options.buildFormParameters().get("name"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("name"), ImmutableList.of());
}
@Test
public void testWithNamedStatic() {
CreateInstanceOptions options = named("test");
assertEquals(options.buildFormParameters().get("name"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("name"), ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)

View File

@ -23,7 +23,6 @@ import static com.google.common.collect.Iterables.transform;
import static org.jclouds.ec2.options.DescribeImagesOptions.Builder.ownedBy;
import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_AMI_OWNERS;
import java.util.Collections;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
@ -83,7 +82,7 @@ public class EC2ImageSupplier implements Supplier<Set<? extends Image>> {
public Set<? extends Image> get() {
if (amiOwners.length == 0) {
logger.debug(">> no owners specified, skipping image parsing");
return Collections.emptySet();
return ImmutableSet.of();
} else {
logger.debug(">> providing images");

View File

@ -18,11 +18,11 @@
*/
package org.jclouds.ec2.options;
import static java.util.Collections.EMPTY_LIST;
import static java.util.Collections.singleton;
import static org.jclouds.ec2.options.BundleInstanceS3StorageOptions.Builder.bucketOwnedBy;
import static org.testng.Assert.assertEquals;
import com.google.common.collect.ImmutableList;
import org.jclouds.http.options.HttpRequestOptions;
import org.testng.annotations.Test;
@ -44,26 +44,26 @@ public class BundleInstanceS3StorageOptionsTest {
public void testBucketOwnedBy() {
BundleInstanceS3StorageOptions options = new BundleInstanceS3StorageOptions();
options.bucketOwnedBy("test");
assertEquals(options.buildFormParameters().get("Storage.S3.AWSAccessKeyId"), singleton("test"));
assertEquals(options.buildFormParameters().get("Storage.S3.AWSAccessKeyId"), ImmutableList.of("test"));
}
@Test(expectedExceptions = IllegalStateException.class)
public void testNullBucketOwnedByNotInjected() {
BundleInstanceS3StorageOptions options = new BundleInstanceS3StorageOptions();
assertEquals(options.buildFormParameters().get("Storage.S3.AWSAccessKeyId"), EMPTY_LIST);
assertEquals(options.buildFormParameters().get("Storage.S3.AWSAccessKeyId"), ImmutableList.of());
}
@Test
public void testNullBucketOwnedBy() {
BundleInstanceS3StorageOptions options = new BundleInstanceS3StorageOptions();
options.currentAwsAccessKeyId = "foo";
assertEquals(options.buildFormParameters().get("Storage.S3.AWSAccessKeyId"), singleton("foo"));
assertEquals(options.buildFormParameters().get("Storage.S3.AWSAccessKeyId"), ImmutableList.of("foo"));
}
@Test
public void testBucketOwnedByStatic() {
BundleInstanceS3StorageOptions options = bucketOwnedBy("test");
assertEquals(options.buildFormParameters().get("Storage.S3.AWSAccessKeyId"), singleton("test"));
assertEquals(options.buildFormParameters().get("Storage.S3.AWSAccessKeyId"), ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)

View File

@ -22,7 +22,7 @@ import static org.jclouds.ec2.options.CreateImageOptions.Builder.noReboot;
import static org.jclouds.ec2.options.CreateImageOptions.Builder.withDescription;
import static org.testng.Assert.assertEquals;
import java.util.Collections;
import com.google.common.collect.ImmutableList;
import org.jclouds.http.options.HttpRequestOptions;
import org.testng.annotations.Test;
@ -44,21 +44,21 @@ public class CreateImageOptionsTest {
public void testWithDescription() {
CreateImageOptions options = new CreateImageOptions();
options.withDescription("test");
assertEquals(options.buildFormParameters().get("Description"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("Description"),
ImmutableList.of("test"));
}
@Test
public void testNullWithDescription() {
CreateImageOptions options = new CreateImageOptions();
assertEquals(options.buildFormParameters().get("Description"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("Description"), ImmutableList.of());
}
@Test
public void testWithDescriptionStatic() {
CreateImageOptions options = withDescription("test");
assertEquals(options.buildFormParameters().get("Description"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("Description"),
ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -70,13 +70,13 @@ public class CreateImageOptionsTest {
public void testNoReboot() {
CreateImageOptions options = new CreateImageOptions();
options.noReboot();
assertEquals(options.buildFormParameters().get("NoReboot"), Collections.singletonList("true"));
assertEquals(options.buildFormParameters().get("NoReboot"), ImmutableList.of("true"));
}
@Test
public void testNoRebootStatic() {
CreateImageOptions options = noReboot();
assertEquals(options.buildFormParameters().get("NoReboot"), Collections.singletonList("true"));
assertEquals(options.buildFormParameters().get("NoReboot"), ImmutableList.of("true"));
}
}

View File

@ -21,7 +21,7 @@ package org.jclouds.ec2.options;
import static org.jclouds.ec2.options.CreateSnapshotOptions.Builder.withDescription;
import static org.testng.Assert.assertEquals;
import java.util.Collections;
import com.google.common.collect.ImmutableList;
import org.jclouds.http.options.HttpRequestOptions;
import org.testng.annotations.Test;
@ -43,21 +43,21 @@ public class CreateSnapshotOptionsTest {
public void testWithDescription() {
CreateSnapshotOptions options = new CreateSnapshotOptions();
options.withDescription("test");
assertEquals(options.buildFormParameters().get("Description"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("Description"),
ImmutableList.of("test"));
}
@Test
public void testNullWithDescription() {
CreateSnapshotOptions options = new CreateSnapshotOptions();
assertEquals(options.buildFormParameters().get("Description"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("Description"), ImmutableList.of());
}
@Test
public void testWithDescriptionStatic() {
CreateSnapshotOptions options = withDescription("test");
assertEquals(options.buildFormParameters().get("Description"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("Description"),
ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)

View File

@ -23,7 +23,7 @@ import static org.jclouds.ec2.options.DescribeImagesOptions.Builder.imageIds;
import static org.jclouds.ec2.options.DescribeImagesOptions.Builder.ownedBy;
import static org.testng.Assert.assertEquals;
import java.util.Collections;
import com.google.common.collect.ImmutableList;
import org.jclouds.http.options.HttpRequestOptions;
import org.testng.annotations.Test;
@ -45,21 +45,21 @@ public class DescribeImagesOptionsTest {
public void testExecutableBy() {
DescribeImagesOptions options = new DescribeImagesOptions();
options.executableBy("test");
assertEquals(options.buildFormParameters().get("ExecutableBy"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("ExecutableBy"),
ImmutableList.of("test"));
}
@Test
public void testNullExecutableBy() {
DescribeImagesOptions options = new DescribeImagesOptions();
assertEquals(options.buildFormParameters().get("ExecutableBy"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("ExecutableBy"), ImmutableList.of());
}
@Test
public void testExecutableByStatic() {
DescribeImagesOptions options = executableBy("test");
assertEquals(options.buildFormParameters().get("ExecutableBy"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("ExecutableBy"),
ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -71,28 +71,28 @@ public class DescribeImagesOptionsTest {
public void testOwners() {
DescribeImagesOptions options = new DescribeImagesOptions();
options.ownedBy("test");
assertEquals(options.buildFormParameters().get("Owner.1"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("Owner.1"), ImmutableList.of("test"));
}
@Test
public void testMultipleOwners() {
DescribeImagesOptions options = new DescribeImagesOptions();
options.ownedBy("test", "trouble");
assertEquals(options.buildFormParameters().get("Owner.1"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("Owner.2"), Collections
.singletonList("trouble"));
assertEquals(options.buildFormParameters().get("Owner.1"), ImmutableList.of("test"));
assertEquals(options.buildFormParameters().get("Owner.2"),
ImmutableList.of("trouble"));
}
@Test
public void testNullOwners() {
DescribeImagesOptions options = new DescribeImagesOptions();
assertEquals(options.buildFormParameters().get("Owner.1"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("Owner.1"), ImmutableList.of());
}
@Test
public void testOwnersStatic() {
DescribeImagesOptions options = ownedBy("test");
assertEquals(options.buildFormParameters().get("Owner.1"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("Owner.1"), ImmutableList.of("test"));
}
public void testNoOwners() {
@ -103,31 +103,31 @@ public class DescribeImagesOptionsTest {
public void testImageIds() {
DescribeImagesOptions options = new DescribeImagesOptions();
options.imageIds("test");
assertEquals(options.buildFormParameters().get("ImageId.1"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("ImageId.1"),
ImmutableList.of("test"));
}
@Test
public void testMultipleImageIds() {
DescribeImagesOptions options = new DescribeImagesOptions();
options.imageIds("test", "trouble");
assertEquals(options.buildFormParameters().get("ImageId.1"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("ImageId.2"), Collections
.singletonList("trouble"));
assertEquals(options.buildFormParameters().get("ImageId.1"),
ImmutableList.of("test"));
assertEquals(options.buildFormParameters().get("ImageId.2"),
ImmutableList.of("trouble"));
}
@Test
public void testNullImageIds() {
DescribeImagesOptions options = new DescribeImagesOptions();
assertEquals(options.buildFormParameters().get("ImageId.1"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("ImageId.1"), ImmutableList.of());
}
@Test
public void testImageIdsStatic() {
DescribeImagesOptions options = imageIds("test");
assertEquals(options.buildFormParameters().get("ImageId.1"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("ImageId.1"),
ImmutableList.of("test"));
}
public void testNoImageIds() {

View File

@ -23,7 +23,7 @@ import static org.jclouds.ec2.options.DescribeSnapshotsOptions.Builder.restorabl
import static org.jclouds.ec2.options.DescribeSnapshotsOptions.Builder.snapshotIds;
import static org.testng.Assert.assertEquals;
import java.util.Collections;
import com.google.common.collect.ImmutableList;
import org.jclouds.http.options.HttpRequestOptions;
import org.testng.annotations.Test;
@ -45,49 +45,49 @@ public class DescribeSnapshotsOptionsTest {
public void testRestorableBy() {
DescribeSnapshotsOptions options = new DescribeSnapshotsOptions();
options.restorableBy("test");
assertEquals(options.buildFormParameters().get("RestorableBy.1"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("RestorableBy.1"),
ImmutableList.of("test"));
}
@Test
public void testNullRestorableBy() {
DescribeSnapshotsOptions options = new DescribeSnapshotsOptions();
assertEquals(options.buildFormParameters().get("RestorableBy.1"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("RestorableBy.1"), ImmutableList.of());
}
@Test
public void testRestorableByStatic() {
DescribeSnapshotsOptions options = restorableBy("test");
assertEquals(options.buildFormParameters().get("RestorableBy.1"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("RestorableBy.1"),
ImmutableList.of("test"));
}
@Test
public void testOwners() {
DescribeSnapshotsOptions options = new DescribeSnapshotsOptions();
options.ownedBy("test");
assertEquals(options.buildFormParameters().get("Owner.1"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("Owner.1"), ImmutableList.of("test"));
}
@Test
public void testMultipleOwners() {
DescribeSnapshotsOptions options = new DescribeSnapshotsOptions();
options.ownedBy("test", "trouble");
assertEquals(options.buildFormParameters().get("Owner.1"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("Owner.2"), Collections
.singletonList("trouble"));
assertEquals(options.buildFormParameters().get("Owner.1"), ImmutableList.of("test"));
assertEquals(options.buildFormParameters().get("Owner.2"),
ImmutableList.of("trouble"));
}
@Test
public void testNullOwners() {
DescribeSnapshotsOptions options = new DescribeSnapshotsOptions();
assertEquals(options.buildFormParameters().get("Owner.1"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("Owner.1"), ImmutableList.of());
}
@Test
public void testOwnersStatic() {
DescribeSnapshotsOptions options = ownedBy("test");
assertEquals(options.buildFormParameters().get("Owner.1"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("Owner.1"), ImmutableList.of("test"));
}
public void testNoOwners() {
@ -98,31 +98,31 @@ public class DescribeSnapshotsOptionsTest {
public void testSnapshotIds() {
DescribeSnapshotsOptions options = new DescribeSnapshotsOptions();
options.snapshotIds("test");
assertEquals(options.buildFormParameters().get("SnapshotId.1"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("SnapshotId.1"),
ImmutableList.of("test"));
}
@Test
public void testMultipleSnapshotIds() {
DescribeSnapshotsOptions options = new DescribeSnapshotsOptions();
options.snapshotIds("test", "trouble");
assertEquals(options.buildFormParameters().get("SnapshotId.1"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("SnapshotId.2"), Collections
.singletonList("trouble"));
assertEquals(options.buildFormParameters().get("SnapshotId.1"),
ImmutableList.of("test"));
assertEquals(options.buildFormParameters().get("SnapshotId.2"),
ImmutableList.of("trouble"));
}
@Test
public void testNullSnapshotIds() {
DescribeSnapshotsOptions options = new DescribeSnapshotsOptions();
assertEquals(options.buildFormParameters().get("SnapshotId.1"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("SnapshotId.1"), ImmutableList.of());
}
@Test
public void testSnapshotIdsStatic() {
DescribeSnapshotsOptions options = snapshotIds("test");
assertEquals(options.buildFormParameters().get("SnapshotId.1"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("SnapshotId.1"),
ImmutableList.of("test"));
}
public void testNoSnapshotIds() {

View File

@ -22,7 +22,7 @@ import static org.jclouds.ec2.options.DetachVolumeOptions.Builder.fromDevice;
import static org.jclouds.ec2.options.DetachVolumeOptions.Builder.fromInstance;
import static org.testng.Assert.assertEquals;
import java.util.Collections;
import com.google.common.collect.ImmutableList;
import org.jclouds.http.options.HttpRequestOptions;
import org.testng.annotations.Test;
@ -44,19 +44,19 @@ public class DetachVolumeOptionsTest {
public void testFromDevice() {
DetachVolumeOptions options = new DetachVolumeOptions();
options.fromDevice("test");
assertEquals(options.buildFormParameters().get("Device"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("Device"), ImmutableList.of("test"));
}
@Test
public void testNullFromDevice() {
DetachVolumeOptions options = new DetachVolumeOptions();
assertEquals(options.buildFormParameters().get("Device"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("Device"), ImmutableList.of());
}
@Test
public void testFromDeviceStatic() {
DetachVolumeOptions options = fromDevice("test");
assertEquals(options.buildFormParameters().get("Device"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("Device"), ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -68,21 +68,21 @@ public class DetachVolumeOptionsTest {
public void testFromInstance() {
DetachVolumeOptions options = new DetachVolumeOptions();
options.fromInstance("test");
assertEquals(options.buildFormParameters().get("InstanceId"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("InstanceId"),
ImmutableList.of("test"));
}
@Test
public void testNullFromInstance() {
DetachVolumeOptions options = new DetachVolumeOptions();
assertEquals(options.buildFormParameters().get("InstanceId"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("InstanceId"), ImmutableList.of());
}
@Test
public void testFromInstanceStatic() {
DetachVolumeOptions options = fromInstance("test");
assertEquals(options.buildFormParameters().get("InstanceId"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("InstanceId"),
ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)

View File

@ -28,12 +28,11 @@ import static org.jclouds.ec2.options.RegisterImageBackedByEbsOptions.Builder.wi
import static org.jclouds.ec2.options.RegisterImageBackedByEbsOptions.Builder.withRamdisk;
import static org.testng.Assert.assertEquals;
import java.util.Collections;
import org.jclouds.ec2.domain.Image.Architecture;
import org.jclouds.http.options.HttpRequestOptions;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMultimap;
/**
@ -54,21 +53,21 @@ public class RegisterImageBackedByEbsOptionsTest {
public void testWithDescription() {
RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
options.withDescription("test");
assertEquals(options.buildFormParameters().get("Description"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("Description"),
ImmutableList.of("test"));
}
@Test
public void testNullWithDescription() {
RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
assertEquals(options.buildFormParameters().get("Description"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("Description"), ImmutableList.of());
}
@Test
public void testWithDescriptionStatic() {
RegisterImageBackedByEbsOptions options = withDescription("test");
assertEquals(options.buildFormParameters().get("Description"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("Description"),
ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -80,21 +79,21 @@ public class RegisterImageBackedByEbsOptionsTest {
public void testWithArchitecture() {
RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
options.asArchitecture(Architecture.I386);
assertEquals(options.buildFormParameters().get("Architecture"), Collections
.singletonList("i386"));
assertEquals(options.buildFormParameters().get("Architecture"),
ImmutableList.of("i386"));
}
@Test
public void testNullWithArchitecture() {
RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
assertEquals(options.buildFormParameters().get("Architecture"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("Architecture"), ImmutableList.of());
}
@Test
public void testWithArchitectureStatic() {
RegisterImageBackedByEbsOptions options = asArchitecture(Architecture.I386);
assertEquals(options.buildFormParameters().get("Architecture"), Collections
.singletonList("i386"));
assertEquals(options.buildFormParameters().get("Architecture"),
ImmutableList.of("i386"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -106,19 +105,19 @@ public class RegisterImageBackedByEbsOptionsTest {
public void testWithKernelId() {
RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
options.withKernelId("test");
assertEquals(options.buildFormParameters().get("KernelId"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("KernelId"), ImmutableList.of("test"));
}
@Test
public void testNullWithKernelId() {
RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
assertEquals(options.buildFormParameters().get("KernelId"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("KernelId"), ImmutableList.of());
}
@Test
public void testWithKernelIdStatic() {
RegisterImageBackedByEbsOptions options = withKernelId("test");
assertEquals(options.buildFormParameters().get("KernelId"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("KernelId"), ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -130,21 +129,21 @@ public class RegisterImageBackedByEbsOptionsTest {
public void testWithRamdisk() {
RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
options.withRamdisk("test");
assertEquals(options.buildFormParameters().get("RamdiskId"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("RamdiskId"),
ImmutableList.of("test"));
}
@Test
public void testNullWithRamdisk() {
RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
assertEquals(options.buildFormParameters().get("RamdiskId"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("RamdiskId"), ImmutableList.of());
}
@Test
public void testWithRamdiskStatic() {
RegisterImageBackedByEbsOptions options = withRamdisk("test");
assertEquals(options.buildFormParameters().get("RamdiskId"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("RamdiskId"),
ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)

View File

@ -24,7 +24,7 @@ import static org.jclouds.ec2.options.RegisterImageOptions.Builder.withKernelId;
import static org.jclouds.ec2.options.RegisterImageOptions.Builder.withRamdisk;
import static org.testng.Assert.assertEquals;
import java.util.Collections;
import com.google.common.collect.ImmutableList;
import org.jclouds.ec2.domain.Image.Architecture;
import org.jclouds.http.options.HttpRequestOptions;
@ -47,21 +47,21 @@ public class RegisterImageOptionsTest {
public void testWithDescription() {
RegisterImageOptions options = new RegisterImageOptions();
options.withDescription("test");
assertEquals(options.buildFormParameters().get("Description"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("Description"),
ImmutableList.of("test"));
}
@Test
public void testNullWithDescription() {
RegisterImageOptions options = new RegisterImageOptions();
assertEquals(options.buildFormParameters().get("Description"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("Description"), ImmutableList.of());
}
@Test
public void testWithDescriptionStatic() {
RegisterImageOptions options = withDescription("test");
assertEquals(options.buildFormParameters().get("Description"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("Description"),
ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -73,21 +73,21 @@ public class RegisterImageOptionsTest {
public void testWithArchitecture() {
RegisterImageOptions options = new RegisterImageOptions();
options.asArchitecture(Architecture.I386);
assertEquals(options.buildFormParameters().get("Architecture"), Collections
.singletonList("i386"));
assertEquals(options.buildFormParameters().get("Architecture"),
ImmutableList.of("i386"));
}
@Test
public void testNullWithArchitecture() {
RegisterImageOptions options = new RegisterImageOptions();
assertEquals(options.buildFormParameters().get("Architecture"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("Architecture"), ImmutableList.of());
}
@Test
public void testWithArchitectureStatic() {
RegisterImageOptions options = asArchitecture(Architecture.I386);
assertEquals(options.buildFormParameters().get("Architecture"), Collections
.singletonList("i386"));
assertEquals(options.buildFormParameters().get("Architecture"),
ImmutableList.of("i386"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -99,19 +99,19 @@ public class RegisterImageOptionsTest {
public void testWithKernelId() {
RegisterImageOptions options = new RegisterImageOptions();
options.withKernelId("test");
assertEquals(options.buildFormParameters().get("KernelId"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("KernelId"), ImmutableList.of("test"));
}
@Test
public void testNullWithKernelId() {
RegisterImageOptions options = new RegisterImageOptions();
assertEquals(options.buildFormParameters().get("KernelId"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("KernelId"), ImmutableList.of());
}
@Test
public void testWithKernelIdStatic() {
RegisterImageOptions options = withKernelId("test");
assertEquals(options.buildFormParameters().get("KernelId"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("KernelId"), ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -123,21 +123,21 @@ public class RegisterImageOptionsTest {
public void testWithRamdisk() {
RegisterImageOptions options = new RegisterImageOptions();
options.withRamdisk("test");
assertEquals(options.buildFormParameters().get("RamdiskId"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("RamdiskId"),
ImmutableList.of("test"));
}
@Test
public void testNullWithRamdisk() {
RegisterImageOptions options = new RegisterImageOptions();
assertEquals(options.buildFormParameters().get("RamdiskId"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("RamdiskId"), ImmutableList.of());
}
@Test
public void testWithRamdiskStatic() {
RegisterImageOptions options = withRamdisk("test");
assertEquals(options.buildFormParameters().get("RamdiskId"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("RamdiskId"),
ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)

View File

@ -27,13 +27,12 @@ import static org.jclouds.ec2.options.RunInstancesOptions.Builder.withSecurityGr
import static org.jclouds.ec2.options.RunInstancesOptions.Builder.withUserData;
import static org.testng.Assert.assertEquals;
import java.util.Collections;
import org.jclouds.ec2.domain.BlockDeviceMapping;
import org.jclouds.ec2.domain.InstanceType;
import org.jclouds.http.options.HttpRequestOptions;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
/**
@ -53,19 +52,19 @@ public class RunInstancesOptionsTest {
public void testWithKeyName() {
RunInstancesOptions options = new RunInstancesOptions();
options.withKeyName("test");
assertEquals(options.buildFormParameters().get("KeyName"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("KeyName"), ImmutableList.of("test"));
}
@Test
public void testNullWithKeyName() {
RunInstancesOptions options = new RunInstancesOptions();
assertEquals(options.buildFormParameters().get("KeyName"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("KeyName"), ImmutableList.of());
}
@Test
public void testWithKeyNameStatic() {
RunInstancesOptions options = withKeyName("test");
assertEquals(options.buildFormParameters().get("KeyName"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("KeyName"), ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -77,19 +76,19 @@ public class RunInstancesOptionsTest {
public void testWithSecurityGroup() {
RunInstancesOptions options = new RunInstancesOptions();
options.withSecurityGroup("test");
assertEquals(options.buildFormParameters().get("SecurityGroup.1"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("SecurityGroup.1"), ImmutableList.of("test"));
}
@Test
public void testNullWithSecurityGroup() {
RunInstancesOptions options = new RunInstancesOptions();
assertEquals(options.buildFormParameters().get("SecurityGroup"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("SecurityGroup"), ImmutableList.of());
}
@Test
public void testWithSecurityGroupStatic() {
RunInstancesOptions options = withSecurityGroup("test");
assertEquals(options.buildFormParameters().get("SecurityGroup.1"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("SecurityGroup.1"), ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -100,26 +99,26 @@ public class RunInstancesOptionsTest {
@Test
public void testNullWithAdditionalInfo() {
RunInstancesOptions options = new RunInstancesOptions();
assertEquals(options.buildFormParameters().get("AdditionalInfo"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("AdditionalInfo"), ImmutableList.of());
}
@Test
public void testWithUserData() {
RunInstancesOptions options = new RunInstancesOptions();
options.withUserData("test".getBytes());
assertEquals(options.buildFormParameters().get("UserData"), Collections.singletonList("dGVzdA=="));
assertEquals(options.buildFormParameters().get("UserData"), ImmutableList.of("dGVzdA=="));
}
@Test
public void testNullWithUserData() {
RunInstancesOptions options = new RunInstancesOptions();
assertEquals(options.buildFormParameters().get("UserData"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("UserData"), ImmutableList.of());
}
@Test
public void testWithUserDataStatic() {
RunInstancesOptions options = withUserData("test".getBytes());
assertEquals(options.buildFormParameters().get("UserData"), Collections.singletonList("dGVzdA=="));
assertEquals(options.buildFormParameters().get("UserData"), ImmutableList.of("dGVzdA=="));
}
@Test(expectedExceptions = NullPointerException.class)
@ -136,19 +135,19 @@ public class RunInstancesOptionsTest {
public void testWithInstanceType() {
RunInstancesOptions options = new RunInstancesOptions();
options.asType(InstanceType.C1_XLARGE);
assertEquals(options.buildFormParameters().get("InstanceType"), Collections.singletonList("c1.xlarge"));
assertEquals(options.buildFormParameters().get("InstanceType"), ImmutableList.of("c1.xlarge"));
}
@Test
public void testNullWithInstanceType() {
RunInstancesOptions options = new RunInstancesOptions();
assertEquals(options.buildFormParameters().get("InstanceType"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("InstanceType"), ImmutableList.of());
}
@Test
public void testWithInstanceTypeStatic() {
RunInstancesOptions options = asType(InstanceType.C1_XLARGE);
assertEquals(options.buildFormParameters().get("InstanceType"), Collections.singletonList("c1.xlarge"));
assertEquals(options.buildFormParameters().get("InstanceType"), ImmutableList.of("c1.xlarge"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -160,19 +159,19 @@ public class RunInstancesOptionsTest {
public void testWithKernelId() {
RunInstancesOptions options = new RunInstancesOptions();
options.withKernelId("test");
assertEquals(options.buildFormParameters().get("KernelId"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("KernelId"), ImmutableList.of("test"));
}
@Test
public void testNullWithKernelId() {
RunInstancesOptions options = new RunInstancesOptions();
assertEquals(options.buildFormParameters().get("KernelId"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("KernelId"), ImmutableList.of());
}
@Test
public void testWithKernelIdStatic() {
RunInstancesOptions options = withKernelId("test");
assertEquals(options.buildFormParameters().get("KernelId"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("KernelId"), ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -184,19 +183,19 @@ public class RunInstancesOptionsTest {
public void testWithRamdisk() {
RunInstancesOptions options = new RunInstancesOptions();
options.withRamdisk("test");
assertEquals(options.buildFormParameters().get("RamdiskId"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("RamdiskId"), ImmutableList.of("test"));
}
@Test
public void testNullWithRamdisk() {
RunInstancesOptions options = new RunInstancesOptions();
assertEquals(options.buildFormParameters().get("RamdiskId"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("RamdiskId"), ImmutableList.of());
}
@Test
public void testWithRamdiskStatic() {
RunInstancesOptions options = withRamdisk("test");
assertEquals(options.buildFormParameters().get("RamdiskId"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("RamdiskId"), ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -207,7 +206,7 @@ public class RunInstancesOptionsTest {
@Test
public void testNullWithVirtualName() {
RunInstancesOptions options = new RunInstancesOptions();
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.VirtualName"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.VirtualName"), ImmutableList.of());
}
@Test
@ -215,18 +214,18 @@ public class RunInstancesOptionsTest {
BlockDeviceMapping mapping = new BlockDeviceMapping.MapNewVolumeToDevice("/dev/sda1", 120, true);
RunInstancesOptions options = new RunInstancesOptions().withBlockDeviceMappings(ImmutableSet
.<BlockDeviceMapping> of(mapping));
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.DeviceName"), Collections
.singletonList("/dev/sda1"));
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.VolumeSize"), Collections
.singletonList("120"));
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.DeleteOnTermination"), Collections
.singletonList("true"));
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.DeviceName"),
ImmutableList.of("/dev/sda1"));
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.VolumeSize"),
ImmutableList.of("120"));
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.DeleteOnTermination"),
ImmutableList.of("true"));
}
@Test
public void testNullWithBlockDeviceMapping() {
RunInstancesOptions options = new RunInstancesOptions();
assertEquals(options.buildFormParameters().get("BlockDeviceMapping"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("BlockDeviceMapping"), ImmutableList.of());
}
@Test
@ -234,12 +233,12 @@ public class RunInstancesOptionsTest {
BlockDeviceMapping mapping = new BlockDeviceMapping.MapNewVolumeToDevice("/dev/sda1", 120, true);
RunInstancesOptions options = withBlockDeviceMappings(ImmutableSet
.<BlockDeviceMapping> of(mapping));
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.DeviceName"), Collections
.singletonList("/dev/sda1"));
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.VolumeSize"), Collections
.singletonList("120"));
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.DeleteOnTermination"), Collections
.singletonList("true"));
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.DeviceName"),
ImmutableList.of("/dev/sda1"));
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.VolumeSize"),
ImmutableList.of("120"));
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.DeleteOnTermination"),
ImmutableList.of("true"));
}
@Test(expectedExceptions = NullPointerException.class)

View File

@ -23,7 +23,6 @@ import static org.easymock.classextension.EasyMock.createControl;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.fail;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
@ -59,10 +58,10 @@ public class DescribeAvailabilityZonesInRegionTest {
expect(client.getAvailabilityZoneAndRegionServices()).andStubReturn(regionClient);
expect(regionClient.describeAvailabilityZonesInRegion("accessibleRegion1")).andReturn(
Collections.singleton(info1));
ImmutableSet.of(info1));
expect(regionClient.describeAvailabilityZonesInRegion("inaccessibleRegion")).andThrow(exception);
expect(regionClient.describeAvailabilityZonesInRegion("accessibleRegion2")).andReturn(
Collections.singleton(info2));
ImmutableSet.of(info2));
expect(info1.getZone()).andStubReturn("zone1");
expect(info2.getZone()).andStubReturn("zone2");
@ -113,14 +112,14 @@ public class DescribeAvailabilityZonesInRegionTest {
expect(client.getAvailabilityZoneAndRegionServices()).andStubReturn(regionClient);
expect(regionClient.describeAvailabilityZonesInRegion("emptyRegion")).andReturn(
Collections.<AvailabilityZoneInfo> emptySet());
ImmutableSet.<AvailabilityZoneInfo> of());
Set<String> regions = ImmutableSet.of("emptyRegion");
control.replay();
DescribeAvailabilityZonesInRegion regionIdToZoneId = new DescribeAvailabilityZonesInRegion(client, Suppliers
.ofInstance(regions));
assertEquals(regionIdToZoneId.get(), Collections.<String, String> emptyMap());
assertEquals(regionIdToZoneId.get(), ImmutableMap.<String, String> of());
control.verify();
}
}

View File

@ -24,12 +24,11 @@ import static org.jclouds.s3.options.ListBucketOptions.Builder.maxResults;
import static org.jclouds.s3.options.ListBucketOptions.Builder.withPrefix;
import static org.testng.Assert.assertEquals;
import java.util.Collections;
import org.jclouds.http.options.HttpRequestOptions;
import org.jclouds.s3.reference.S3Constants;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Multimap;
/**
@ -49,8 +48,8 @@ public class ListBucketOptionsTest {
public void testPrefix() {
ListBucketOptions options = new ListBucketOptions();
options.withPrefix("test");
assertEquals(options.buildQueryParameters().get(S3Constants.PREFIX), Collections
.singletonList("test"));
assertEquals(options.buildQueryParameters().get(S3Constants.PREFIX),
ImmutableList.of("test"));
}
@Test
@ -65,7 +64,7 @@ public class ListBucketOptionsTest {
options.withPrefix("test");
Multimap<String, String> map = options.buildQueryParameters();
assertEquals(map.size(), 1);
assertEquals(map.get("prefix"), Collections.singletonList("test"));
assertEquals(map.get("prefix"), ImmutableList.of("test"));
}
@Test
@ -74,8 +73,8 @@ public class ListBucketOptionsTest {
options.withPrefix("test").maxResults(1);
Multimap<String, String> map = options.buildQueryParameters();
assertEquals(map.size(), 2);
assertEquals(map.get("prefix"), Collections.singletonList("test"));
assertEquals(map.get("max-keys"), Collections.singletonList("1"));
assertEquals(map.get("prefix"), ImmutableList.of("test"));
assertEquals(map.get("max-keys"), ImmutableList.of("1"));
}
@Test
@ -84,22 +83,22 @@ public class ListBucketOptionsTest {
options.withPrefix("/test").delimiter("/");
Multimap<String, String> map = options.buildQueryParameters();
assertEquals(map.size(), 2);
assertEquals(map.get("prefix"), Collections.singletonList("/test"));
assertEquals(map.get("delimiter"), Collections.singletonList("/"));
assertEquals(map.get("prefix"), ImmutableList.of("/test"));
assertEquals(map.get("delimiter"), ImmutableList.of("/"));
}
@Test
public void testNullPrefix() {
ListBucketOptions options = new ListBucketOptions();
assertEquals(options.buildQueryParameters().get(S3Constants.PREFIX), Collections.EMPTY_LIST);
assertEquals(options.buildQueryParameters().get(S3Constants.PREFIX), ImmutableList.of());
}
@Test
public void testPrefixStatic() {
ListBucketOptions options = withPrefix("test");
assertEquals(options.buildQueryParameters().get(S3Constants.PREFIX), Collections
.singletonList("test"));
assertEquals(options.buildQueryParameters().get(S3Constants.PREFIX),
ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -111,21 +110,21 @@ public class ListBucketOptionsTest {
public void testMarker() {
ListBucketOptions options = new ListBucketOptions();
options.afterMarker("test");
assertEquals(options.buildQueryParameters().get(S3Constants.MARKER), Collections
.singletonList("test"));
assertEquals(options.buildQueryParameters().get(S3Constants.MARKER),
ImmutableList.of("test"));
}
@Test
public void testNullMarker() {
ListBucketOptions options = new ListBucketOptions();
assertEquals(options.buildQueryParameters().get(S3Constants.MARKER), Collections.EMPTY_LIST);
assertEquals(options.buildQueryParameters().get(S3Constants.MARKER), ImmutableList.of());
}
@Test
public void testMarkerStatic() {
ListBucketOptions options = afterMarker("test");
assertEquals(options.buildQueryParameters().get(S3Constants.MARKER), Collections
.singletonList("test"));
assertEquals(options.buildQueryParameters().get(S3Constants.MARKER),
ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -137,21 +136,21 @@ public class ListBucketOptionsTest {
public void testMaxKeys() {
ListBucketOptions options = new ListBucketOptions();
options.maxResults(1000);
assertEquals(options.buildQueryParameters().get(S3Constants.MAX_KEYS), Collections
.singletonList("1000"));
assertEquals(options.buildQueryParameters().get(S3Constants.MAX_KEYS),
ImmutableList.of("1000"));
}
@Test
public void testNullMaxKeys() {
ListBucketOptions options = new ListBucketOptions();
assertEquals(options.buildQueryParameters().get(S3Constants.MAX_KEYS), Collections.EMPTY_LIST);
assertEquals(options.buildQueryParameters().get(S3Constants.MAX_KEYS), ImmutableList.of());
}
@Test
public void testMaxKeysStatic() {
ListBucketOptions options = maxResults(1000);
assertEquals(options.buildQueryParameters().get(S3Constants.MAX_KEYS), Collections
.singletonList("1000"));
assertEquals(options.buildQueryParameters().get(S3Constants.MAX_KEYS),
ImmutableList.of("1000"));
}
@Test(expectedExceptions = IllegalStateException.class)
@ -163,22 +162,22 @@ public class ListBucketOptionsTest {
public void testDelimiter() {
ListBucketOptions options = new ListBucketOptions();
options.delimiter("test");
assertEquals(options.buildQueryParameters().get(S3Constants.DELIMITER), Collections
.singletonList("test"));
assertEquals(options.buildQueryParameters().get(S3Constants.DELIMITER),
ImmutableList.of("test"));
}
@Test
public void testNullDelimiter() {
ListBucketOptions options = new ListBucketOptions();
assertEquals(options.buildQueryParameters().get(S3Constants.DELIMITER),
Collections.EMPTY_LIST);
ImmutableList.of());
}
@Test
public void testDelimiterStatic() {
ListBucketOptions options = delimiter("test");
assertEquals(options.buildQueryParameters().get(S3Constants.DELIMITER), Collections
.singletonList("test"));
assertEquals(options.buildQueryParameters().get(S3Constants.DELIMITER),
ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)

View File

@ -21,7 +21,7 @@ package org.jclouds.sqs.options;
import static org.jclouds.sqs.options.ListQueuesOptions.Builder.queuePrefix;
import static org.testng.Assert.assertEquals;
import java.util.Collections;
import com.google.common.collect.ImmutableList;
import org.jclouds.http.options.HttpRequestOptions;
import org.testng.annotations.Test;
@ -43,21 +43,19 @@ public class ListQueuesOptionsTest {
public void testPrefix() {
ListQueuesOptions options = new ListQueuesOptions();
options.queuePrefix("test");
assertEquals(options.buildFormParameters().get("QueueNamePrefix"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("QueueNamePrefix"), ImmutableList.of("test"));
}
@Test
public void testNullPrefix() {
ListQueuesOptions options = new ListQueuesOptions();
assertEquals(options.buildFormParameters().get("QueueNamePrefix"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("QueueNamePrefix"), ImmutableList.of());
}
@Test
public void testPrefixStatic() {
ListQueuesOptions options = queuePrefix("test");
assertEquals(options.buildFormParameters().get("QueueNamePrefix"), Collections
.singletonList("test"));
assertEquals(options.buildFormParameters().get("QueueNamePrefix"), ImmutableList.of("test"));
}
public void testNoPrefix() {

View File

@ -24,12 +24,11 @@ import static org.jclouds.openstack.swift.options.ListContainerOptions.Builder.u
import static org.jclouds.openstack.swift.options.ListContainerOptions.Builder.withPrefix;
import static org.testng.Assert.assertEquals;
import java.util.Collections;
import org.jclouds.http.options.HttpRequestOptions;
import org.jclouds.openstack.swift.reference.SwiftConstants;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Multimap;
/**
@ -49,7 +48,7 @@ public class ListContainerOptionsTest {
public void testPrefix() {
ListContainerOptions options = new ListContainerOptions();
options.withPrefix("test");
assertEquals(options.buildQueryParameters().get(SwiftConstants.PREFIX), Collections.singletonList("test"));
assertEquals(options.buildQueryParameters().get(SwiftConstants.PREFIX), ImmutableList.of("test"));
}
@Test
@ -64,7 +63,7 @@ public class ListContainerOptionsTest {
options.withPrefix("test");
Multimap<String, String> map = options.buildQueryParameters();
assertEquals(map.size(), 1);
assertEquals(map.get("prefix"), Collections.singletonList("test"));
assertEquals(map.get("prefix"), ImmutableList.of("test"));
}
@Test
@ -73,8 +72,8 @@ public class ListContainerOptionsTest {
options.withPrefix("test").maxResults(1);
Multimap<String, String> map = options.buildQueryParameters();
assertEquals(map.size(), 2);
assertEquals(map.get("prefix"), Collections.singletonList("test"));
assertEquals(map.get("limit"), Collections.singletonList("1"));
assertEquals(map.get("prefix"), ImmutableList.of("test"));
assertEquals(map.get("limit"), ImmutableList.of("1"));
}
@Test
@ -83,21 +82,21 @@ public class ListContainerOptionsTest {
options.withPrefix("/cloudfiles/test").underPath("/");
Multimap<String, String> map = options.buildQueryParameters();
assertEquals(map.size(), 2);
assertEquals(map.get("prefix"), Collections.singletonList("/cloudfiles/test"));
assertEquals(map.get("path"), Collections.singletonList("/"));
assertEquals(map.get("prefix"), ImmutableList.of("/cloudfiles/test"));
assertEquals(map.get("path"), ImmutableList.of("/"));
}
@Test
public void testNullPrefix() {
ListContainerOptions options = new ListContainerOptions();
assertEquals(options.buildQueryParameters().get(SwiftConstants.PREFIX), Collections.EMPTY_LIST);
assertEquals(options.buildQueryParameters().get(SwiftConstants.PREFIX), ImmutableList.of());
}
@Test
public void testPrefixStatic() {
ListContainerOptions options = withPrefix("test");
assertEquals(options.buildQueryParameters().get(SwiftConstants.PREFIX), Collections.singletonList("test"));
assertEquals(options.buildQueryParameters().get(SwiftConstants.PREFIX), ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -109,19 +108,19 @@ public class ListContainerOptionsTest {
public void testMarker() {
ListContainerOptions options = new ListContainerOptions();
options.afterMarker("test");
assertEquals(options.buildQueryParameters().get(SwiftConstants.MARKER), Collections.singletonList("test"));
assertEquals(options.buildQueryParameters().get(SwiftConstants.MARKER), ImmutableList.of("test"));
}
@Test
public void testNullMarker() {
ListContainerOptions options = new ListContainerOptions();
assertEquals(options.buildQueryParameters().get(SwiftConstants.MARKER), Collections.EMPTY_LIST);
assertEquals(options.buildQueryParameters().get(SwiftConstants.MARKER), ImmutableList.of());
}
@Test
public void testMarkerStatic() {
ListContainerOptions options = afterMarker("test");
assertEquals(options.buildQueryParameters().get(SwiftConstants.MARKER), Collections.singletonList("test"));
assertEquals(options.buildQueryParameters().get(SwiftConstants.MARKER), ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -133,19 +132,19 @@ public class ListContainerOptionsTest {
public void testMaxKeys() {
ListContainerOptions options = new ListContainerOptions();
options.maxResults(1000);
assertEquals(options.buildQueryParameters().get(SwiftConstants.LIMIT), Collections.singletonList("1000"));
assertEquals(options.buildQueryParameters().get(SwiftConstants.LIMIT), ImmutableList.of("1000"));
}
@Test
public void testNullMaxKeys() {
ListContainerOptions options = new ListContainerOptions();
assertEquals(options.buildQueryParameters().get(SwiftConstants.LIMIT), Collections.EMPTY_LIST);
assertEquals(options.buildQueryParameters().get(SwiftConstants.LIMIT), ImmutableList.of());
}
@Test
public void testMaxKeysStatic() {
ListContainerOptions options = maxResults(1000);
assertEquals(options.buildQueryParameters().get(SwiftConstants.LIMIT), Collections.singletonList("1000"));
assertEquals(options.buildQueryParameters().get(SwiftConstants.LIMIT), ImmutableList.of("1000"));
}
@Test(expectedExceptions = IllegalStateException.class)
@ -157,19 +156,19 @@ public class ListContainerOptionsTest {
public void testPath() {
ListContainerOptions options = new ListContainerOptions();
options.underPath("test");
assertEquals(options.buildQueryParameters().get(SwiftConstants.PATH), Collections.singletonList("test"));
assertEquals(options.buildQueryParameters().get(SwiftConstants.PATH), ImmutableList.of("test"));
}
@Test
public void testNullPath() {
ListContainerOptions options = new ListContainerOptions();
assertEquals(options.buildQueryParameters().get(SwiftConstants.PATH), Collections.EMPTY_LIST);
assertEquals(options.buildQueryParameters().get(SwiftConstants.PATH), ImmutableList.of());
}
@Test
public void testPathStatic() {
ListContainerOptions options = underPath("test");
assertEquals(options.buildQueryParameters().get(SwiftConstants.PATH), Collections.singletonList("test"));
assertEquals(options.buildQueryParameters().get(SwiftConstants.PATH), ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)

View File

@ -3,7 +3,6 @@ package org.jclouds.vcloud.compute.strategy;
import static org.testng.Assert.assertEquals;
import java.net.URI;
import java.util.Collections;
import org.jclouds.compute.ComputeService;
import org.jclouds.http.HttpRequest;
@ -69,6 +68,6 @@ public class VCloudComputeServiceAdapterTest extends BaseVCloudComputeServiceExp
Iterable<VAppTemplate> hardwareProfiles = adapter.listHardwareProfiles();
assertEquals(ImmutableSet.copyOf(hardwareProfiles), Collections.emptySet());
assertEquals(ImmutableSet.copyOf(hardwareProfiles), ImmutableSet.of());
}
}

View File

@ -22,7 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Collections;
import java.util.Date;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@ -35,6 +34,7 @@ import javax.ws.rs.core.UriBuilder;
import com.google.common.base.Preconditions;
import com.google.common.base.Supplier;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Multimaps;
import org.jclouds.blobstore.domain.Blob;
@ -191,8 +191,8 @@ public class TransientStorageStrategy implements LocalStorageStrategy {
blob.getMetadata().setETag(eTag);
// Set HTTP headers to match metadata
blob.getAllHeaders().replaceValues(HttpHeaders.LAST_MODIFIED,
Collections.singleton(dateService.rfc822DateFormat(blob.getMetadata().getLastModified())));
blob.getAllHeaders().replaceValues(HttpHeaders.ETAG, Collections.singleton(eTag));
ImmutableList.of(dateService.rfc822DateFormat(blob.getMetadata().getLastModified())));
blob.getAllHeaders().replaceValues(HttpHeaders.ETAG, ImmutableList.of(eTag));
copyPayloadHeadersToBlob(payload, blob);
blob.getAllHeaders().putAll(Multimaps.forMap(blob.getMetadata().getUserMetadata()));
return blob;

View File

@ -21,7 +21,6 @@ package org.jclouds.blobstore;
import static org.easymock.EasyMock.createMock;
import static org.testng.Assert.assertEquals;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@ -132,7 +131,7 @@ public class BlobStoresTest {
BlobStore blobStore = createMock(BlobStore.class);
ListContainerOptions options = ListContainerOptions.NONE;
StorageMetadata v1 = createMock(StorageMetadata.class);
PageSet<StorageMetadata> pageSet = new PageSetImpl<StorageMetadata>(Collections.singletonList(v1), null);
PageSet<StorageMetadata> pageSet = new PageSetImpl<StorageMetadata>(ImmutableList.of(v1), null);
EasyMock.<PageSet<? extends StorageMetadata>> expect(blobStore.list(containerName, options)).andReturn(pageSet)
.once();
@ -149,8 +148,8 @@ public class BlobStoresTest {
ListContainerOptions options2 = ListContainerOptions.Builder.afterMarker("marker1");
StorageMetadata v1 = createMock(StorageMetadata.class);
StorageMetadata v2 = createMock(StorageMetadata.class);
PageSet<StorageMetadata> pageSet = new PageSetImpl<StorageMetadata>(Collections.singletonList(v1), "marker1");
PageSet<StorageMetadata> pageSet2 = new PageSetImpl<StorageMetadata>(Collections.singletonList(v2), null);
PageSet<StorageMetadata> pageSet = new PageSetImpl<StorageMetadata>(ImmutableList.of(v1), "marker1");
PageSet<StorageMetadata> pageSet2 = new PageSetImpl<StorageMetadata>(ImmutableList.of(v2), null);
EasyMock.<PageSet<? extends StorageMetadata>> expect(blobStore.list(containerName, options)).andReturn(pageSet)
.once();

View File

@ -23,8 +23,6 @@ import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.testng.Assert.assertEquals;
import java.util.Collections;
import javax.inject.Provider;
import javax.ws.rs.core.MediaType;
@ -37,6 +35,7 @@ import org.jclouds.http.HttpResponse;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableList;
import com.google.inject.Guice;
/**
@ -86,7 +85,7 @@ public class ParseBlobFromHeadersAndHttpContentTest {
Blob object = callable.apply(response);
assertEquals(object.getPayload().getContentMetadata().getContentLength(), Long.valueOf(10485760));
assertEquals(object.getAllHeaders().get("Content-Range"), Collections.singletonList("0-10485759/20232760"));
assertEquals(object.getAllHeaders().get("Content-Range"), ImmutableList.of("0-10485759/20232760"));
}

View File

@ -34,7 +34,6 @@
package org.jclouds.concurrent;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.AbstractExecutorService;
import java.util.concurrent.ExecutorService;
@ -46,6 +45,7 @@ import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import com.google.common.annotations.Beta;
import com.google.common.collect.ImmutableList;
/**
* functions related to or replacing those in
@ -146,7 +146,7 @@ public class MoreExecutors {
@Override
public List<Runnable> shutdownNow() {
shutdown();
return Collections.emptyList();
return ImmutableList.of();
}
@Override

View File

@ -26,7 +26,6 @@ import static org.jclouds.io.Payloads.newUrlEncodedFormPayload;
import static org.jclouds.util.Multimaps2.replaceEntries;
import java.net.URI;
import java.util.Collections;
import java.util.List;
import org.jclouds.io.Payload;
@ -35,6 +34,7 @@ import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Multimap;
@ -138,7 +138,7 @@ public class HttpRequest extends HttpMessage {
private T replaceQuery(Multimap<String, String> map) {
URI oldURI = endpoint;
String query = makeQueryLine(map, null, Chars.toArray(skips.build()));
endpoint = new UriBuilderImpl().uri(oldURI).replaceQuery(query).buildFromEncodedMap(Collections.EMPTY_MAP);
endpoint = new UriBuilderImpl().uri(oldURI).replaceQuery(query).buildFromEncodedMap(ImmutableMap.<String, Object>of());
return self();
}
@ -150,7 +150,7 @@ public class HttpRequest extends HttpMessage {
checkNotNull(endpoint, "endpoint");
checkNotNull(path, "path");
URI oldURI = endpoint;
endpoint = new UriBuilderImpl().uri(oldURI).replacePath(path).buildFromEncodedMap(Collections.EMPTY_MAP);
endpoint = new UriBuilderImpl().uri(oldURI).replacePath(path).buildFromEncodedMap(ImmutableMap.<String, Object>of());
return self();
}

View File

@ -68,8 +68,8 @@ import com.google.gson.stream.JsonWriter;
* new ExtractSerializedName(), new ExtractNamed());
*
* deserializationStrategy = new AnnotationConstructorNamingStrategy(
* Collections.singleton(javax.inject.Inject.class),
* Collections.singleton(new ExtractNamed()));
* ImmutableSet.of(javax.inject.Inject.class),
* ImmutableSet.of(new ExtractNamed()));
*
* factory = new DeserializationConstructorAndReflectiveTypeAdapterFactory(new ConstructorConstructor(),
* serializationStrategy, Excluder.DEFAULT, deserializationStrategy);

View File

@ -43,7 +43,6 @@ import java.lang.reflect.Type;
import java.lang.reflect.WildcardType;
import java.net.URI;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
@ -1087,7 +1086,7 @@ public class RestAnnotationProcessor<T> {
}
private static List<String> getAcceptHeadersOrNull(Method method) {
List<String> accept = Collections.emptyList();
List<String> accept = ImmutableList.of();
if (method.getDeclaringClass().isAnnotationPresent(Consumes.class)) {
Consumes header = method.getDeclaringClass().getAnnotation(Consumes.class);
accept = asList(header.value());

View File

@ -45,6 +45,7 @@ import org.jclouds.util.Throwables2;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Multimap;
import com.google.common.io.Closeables;
@ -195,7 +196,7 @@ public abstract class BaseHttpCommandExecutorServiceIntegrationTest extends Base
payload.getContentMetadata().setContentMD5(digest);
Multimap<String, String> headers = client.postPayloadAndReturnHeaders("", payload);
assertEquals(headers.get("x-Content-MD5"),
Collections.singleton(CryptoStreams.base64(digest)));
ImmutableList.of(CryptoStreams.base64(digest)));
payload.release();
} finally {
if (os != null)
@ -235,7 +236,7 @@ public abstract class BaseHttpCommandExecutorServiceIntegrationTest extends Base
Payload payload = Payloads.newStringPayload("foo");
payload.getContentMetadata().setContentDisposition("attachment; filename=photo.jpg");
Multimap<String, String> headers = client.postPayloadAndReturnHeaders("", payload);
assertEquals(headers.get("x-Content-Disposition"), Collections.singleton("attachment; filename=photo.jpg"));
assertEquals(headers.get("x-Content-Disposition"), ImmutableList.of("attachment; filename=photo.jpg"));
payload.release();
}
@ -244,7 +245,7 @@ public abstract class BaseHttpCommandExecutorServiceIntegrationTest extends Base
Payload payload = Payloads.newStringPayload("foo");
payload.getContentMetadata().setContentEncoding("gzip");
Multimap<String, String> headers = client.postPayloadAndReturnHeaders("", payload);
assertEquals(headers.get("x-Content-Encoding"), Collections.singleton("gzip"));
assertEquals(headers.get("x-Content-Encoding"), ImmutableList.of("gzip"));
payload.release();
}
@ -253,7 +254,7 @@ public abstract class BaseHttpCommandExecutorServiceIntegrationTest extends Base
Payload payload = Payloads.newStringPayload("foo");
payload.getContentMetadata().setContentLanguage("mi, en");
Multimap<String, String> headers = client.postPayloadAndReturnHeaders("", payload);
assertEquals(headers.get("x-Content-Language"), Collections.singleton("mi, en"));
assertEquals(headers.get("x-Content-Language"), ImmutableList.of("mi, en"));
payload.release();
}

View File

@ -40,7 +40,6 @@ import java.net.URI;
import java.net.URLEncoder;
import java.security.NoSuchAlgorithmException;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.Map;
import java.util.NoSuchElementException;
@ -147,6 +146,7 @@ import com.google.common.base.Joiner;
import com.google.common.base.Optional;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSet;
@ -1586,8 +1586,8 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
Multimap<String, String> headers = factory(TestHeader.class).createRequest(oneHeader, new Object[] { "robot" })
.getHeaders();
assertEquals(headers.size(), 2);
assertEquals(headers.get("slash"), Collections.singletonList("/robot"));
assertEquals(headers.get("hyphen"), Collections.singletonList("-robot"));
assertEquals(headers.get("slash"), ImmutableList.of("/robot"));
assertEquals(headers.get("hyphen"), ImmutableList.of("-robot"));
}
@Headers(keys = "x-amz-copy-source", values = "/{bucket}")
@ -1604,7 +1604,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
Multimap<String, String> headers = factory(TestClassHeader.class).createRequest(oneHeader,
new Object[] { "robot" }).getHeaders();
assertEquals(headers.size(), 1);
assertEquals(headers.get("x-amz-copy-source"), Collections.singletonList("/robot"));
assertEquals(headers.get("x-amz-copy-source"), ImmutableList.of("/robot"));
}
@Test
@ -1613,7 +1613,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
Multimap<String, String> headers = factory(TestHeader.class).createRequest(oneHeader, new Object[] { "robot" })
.getHeaders();
assertEquals(headers.size(), 1);
assertEquals(headers.get("x-amz-copy-source"), Collections.singletonList("/robot"));
assertEquals(headers.get("x-amz-copy-source"), ImmutableList.of("/robot"));
}
@Test
@ -1622,7 +1622,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
Multimap<String, String> headers = factory(TestHeader.class).createRequest(twoHeaders,
new Object[] { "robot", "eggs" }).getHeaders();
assertEquals(headers.size(), 1);
assertEquals(headers.get("x-amz-copy-source"), Collections.singletonList("/robot/eggs"));
assertEquals(headers.get("x-amz-copy-source"), ImmutableList.of("/robot/eggs"));
}
@Test
@ -1631,7 +1631,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
Multimap<String, String> headers = factory(TestHeader.class).createRequest(twoHeadersOutOfOrder,
new Object[] { "robot", "eggs" }).getHeaders();
assertEquals(headers.size(), 1);
assertEquals(headers.get("x-amz-copy-source"), Collections.singletonList("/eggs/robot"));
assertEquals(headers.get("x-amz-copy-source"), ImmutableList.of("/eggs/robot"));
}
public class TestReplaceQueryOptions extends BaseHttpRequestOptions {
@ -2099,9 +2099,9 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
assertEquals(request.getEndpoint().getPath(), "/1");
assertEquals(request.getMethod(), HttpMethod.GET);
assertEquals(request.getHeaders().size(), 2);
assertEquals(request.getHeaders().get(HttpHeaders.HOST), Collections.singletonList("localhost:9999"));
assertEquals(request.getHeaders().get(HttpHeaders.HOST), ImmutableList.of("localhost:9999"));
assertEquals(request.getHeaders().get(HttpHeaders.IF_MODIFIED_SINCE),
Collections.singletonList(dateService.rfc822DateFormat(date)));
ImmutableList.of(dateService.rfc822DateFormat(date)));
}
public void testCreateGetOptionsThatProducesHeaders() throws SecurityException, NoSuchMethodException {
@ -2113,9 +2113,9 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
assertEquals(request.getEndpoint().getPath(), "/1");
assertEquals(request.getMethod(), HttpMethod.GET);
assertEquals(request.getHeaders().size(), 2);
assertEquals(request.getHeaders().get(HttpHeaders.HOST), Collections.singletonList("localhost:9999"));
assertEquals(request.getHeaders().get(HttpHeaders.HOST), ImmutableList.of("localhost:9999"));
assertEquals(request.getHeaders().get(HttpHeaders.IF_MODIFIED_SINCE),
Collections.singletonList(dateService.rfc822DateFormat(date)));
ImmutableList.of(dateService.rfc822DateFormat(date)));
}
public class PrefixOptions extends BaseHttpRequestOptions {
@ -2197,7 +2197,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
assertEquals(request.getEndpoint().getPath(), "/" + key);
assertEquals(request.getMethod(), HttpMethod.GET);
assertEquals(request.getHeaders().size(), 1);
assertEquals(request.getHeaders().get(HttpHeaders.HOST), Collections.singletonList("localhost"));
assertEquals(request.getHeaders().get(HttpHeaders.HOST), ImmutableList.of("localhost"));
}
public void testCreatePutRequest() throws SecurityException, NoSuchMethodException, IOException {
@ -2236,7 +2236,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
assertEquals(request.getEndpoint().getPath(), "/1");
assertEquals(request.getMethod(), HttpMethod.GET);
assertEquals(request.getHeaders().size(), 1);
assertEquals(request.getHeaders().get(HttpHeaders.HOST), Collections.singletonList("localhost:9999"));
assertEquals(request.getHeaders().get(HttpHeaders.HOST), ImmutableList.of("localhost:9999"));
}
public interface TestVirtualHost {
@ -2259,7 +2259,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
assertEquals(request.getEndpoint().getPath(), "/1");
assertEquals(request.getMethod(), HttpMethod.GET);
assertEquals(request.getHeaders().size(), 1);
assertEquals(request.getHeaders().get(HttpHeaders.HOST), Collections.singletonList("localhost:9999"));
assertEquals(request.getHeaders().get(HttpHeaders.HOST), ImmutableList.of("localhost:9999"));
}
@Test
@ -2298,7 +2298,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
Multimap<String, String> headers = factory(TestHeaders.class).buildHeaders(
ImmutableMultimap.<String, String> of().entries(), method, "robot");
assertEquals(headers.size(), 1);
assertEquals(headers.get("header"), Collections.singletonList("robot"));
assertEquals(headers.get("header"), ImmutableList.of("robot"));
}
@Test
@ -2307,7 +2307,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
Multimap<String, String> headers = factory(TestHeaders.class).buildHeaders(
ImmutableMultimap.<String, String> of().entries(), method, 1);
assertEquals(headers.size(), 1);
assertEquals(headers.get("header"), Collections.singletonList("1"));
assertEquals(headers.get("header"), ImmutableList.of("1"));
}
@Test
@ -2316,8 +2316,8 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
Multimap<String, String> headers = factory(TestHeaders.class).buildHeaders(
ImmutableMultimap.<String, String> of().entries(), method, "robot", "egg");
assertEquals(headers.size(), 2);
assertEquals(headers.get("header1"), Collections.singletonList("robot"));
assertEquals(headers.get("header2"), Collections.singletonList("egg"));
assertEquals(headers.get("header1"), ImmutableList.of("robot"));
assertEquals(headers.get("header2"), ImmutableList.of("egg"));
}
@Test

View File

@ -19,7 +19,6 @@
package org.jclouds.demo.tweetstore.functions;
import java.net.URI;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
@ -66,8 +65,8 @@ public class ServiceToStoredTweetStatuses implements Function<String, Iterable<S
StoredTweetStatus result = new StoredTweetStatus(service, host, container, null, null,
null, e.getMessage());
logger.error(e, "Error listing service %s", service);
return Collections.singletonList(result);
return ImmutableList.of(result);
}
}
}
}

View File

@ -19,7 +19,6 @@
package org.jclouds.demo.tweetstore.functions;
import java.net.URI;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
@ -66,8 +65,8 @@ public class ServiceToStoredTweetStatuses implements Function<String, Iterable<S
StoredTweetStatus result = new StoredTweetStatus(service, host, container, null, null,
null, e.getMessage());
logger.error(e, "Error listing service %s", service);
return Collections.singletonList(result);
return ImmutableList.of(result);
}
}
}
}

View File

@ -19,7 +19,6 @@
package org.jclouds.demo.tweetstore.functions;
import java.net.URI;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
@ -67,8 +66,8 @@ public class ServiceToStoredTweetStatuses implements Function<String, Iterable<S
StoredTweetStatus result = new StoredTweetStatus(service, host, container, null, null,
null, e.getMessage());
logger.error(e, "Error listing service %s", service);
return Collections.singletonList(result);
return ImmutableList.of(result);
}
}
}
}

View File

@ -19,7 +19,6 @@
package org.jclouds.demo.tweetstore.functions;
import java.net.URI;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
@ -66,8 +65,8 @@ public class ServiceToStoredTweetStatuses implements Function<String, Iterable<S
StoredTweetStatus result = new StoredTweetStatus(service, host, container, null, null,
null, e.getMessage());
logger.error(e, "Error listing service %s", service);
return Collections.singletonList(result);
return ImmutableList.of(result);
}
}
}
}

View File

@ -19,7 +19,6 @@
package org.jclouds.demo.tweetstore.functions;
import java.net.URI;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
@ -66,8 +65,8 @@ public class ServiceToStoredTweetStatuses implements Function<String, Iterable<S
StoredTweetStatus result = new StoredTweetStatus(service, host, container, null, null,
null, e.getMessage());
logger.error(e, "Error listing service %s", service);
return Collections.singletonList(result);
return ImmutableList.of(result);
}
}
}
}

View File

@ -19,7 +19,6 @@
package org.jclouds.demo.tweetstore.functions;
import java.net.URI;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
@ -66,8 +65,8 @@ public class ServiceToStoredTweetStatuses implements Function<String, Iterable<S
StoredTweetStatus result = new StoredTweetStatus(service, host, container, null, null,
null, e.getMessage());
logger.error(e, "Error listing service %s", service);
return Collections.singletonList(result);
return ImmutableList.of(result);
}
}
}
}

View File

@ -35,7 +35,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.ConnectException;
import java.net.SocketTimeoutException;
import java.util.Collections;
import java.util.concurrent.TimeUnit;
import javax.annotation.PreDestroy;
@ -74,6 +73,7 @@ import com.google.common.base.Predicates;
import com.google.common.base.Splitter;
import com.google.common.base.Supplier;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableMap;
import com.google.common.io.Closeables;
import com.google.common.net.HostAndPort;
import com.google.inject.Inject;
@ -412,7 +412,7 @@ public class SshjSshClient implements SshClient {
public Session create() throws Exception {
checkConnected();
session = sshClientConnection.ssh.startSession();
session.allocatePTY("vt100", 80, 24, 0, 0, Collections.<PTYMode, Integer> emptyMap());
session.allocatePTY("vt100", 80, 24, 0, 0, ImmutableMap.<PTYMode, Integer> of());
return session;
}

View File

@ -22,7 +22,7 @@ import static org.jclouds.snia.cdmi.v1.options.ListContainersOptions.Builder.lim
import static org.jclouds.snia.cdmi.v1.options.ListContainersOptions.Builder.marker;
import static org.testng.Assert.assertEquals;
import java.util.Collections;
import com.google.common.collect.ImmutableList;
import org.jclouds.http.options.HttpRequestOptions;
import org.testng.annotations.Test;
@ -51,19 +51,19 @@ public class ListContainersOptionsTest {
public void testMarker() {
ListContainersOptions options = new ListContainersOptions();
options.marker("test");
assertEquals(options.buildQueryParameters().get("marker"), Collections.singletonList("test"));
assertEquals(options.buildQueryParameters().get("marker"), ImmutableList.of("test"));
}
@Test
public void testNullMarker() {
ListContainersOptions options = new ListContainersOptions();
assertEquals(options.buildQueryParameters().get("marker"), Collections.EMPTY_LIST);
assertEquals(options.buildQueryParameters().get("marker"), ImmutableList.of());
}
@Test
public void testMarkerStatic() {
ListContainersOptions options = marker("test");
assertEquals(options.buildQueryParameters().get("marker"), Collections.singletonList("test"));
assertEquals(options.buildQueryParameters().get("marker"), ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -75,19 +75,19 @@ public class ListContainersOptionsTest {
public void testLimit() {
ListContainersOptions options = new ListContainersOptions();
options.limit(1000);
assertEquals(options.buildQueryParameters().get("limit"), Collections.singletonList("1000"));
assertEquals(options.buildQueryParameters().get("limit"), ImmutableList.of("1000"));
}
@Test
public void testNullLimit() {
ListContainersOptions options = new ListContainersOptions();
assertEquals(options.buildQueryParameters().get("limit"), Collections.EMPTY_LIST);
assertEquals(options.buildQueryParameters().get("limit"), ImmutableList.of());
}
@Test
public void testLimitStatic() {
ListContainersOptions options = limit(1000);
assertEquals(options.buildQueryParameters().get("limit"), Collections.singletonList("1000"));
assertEquals(options.buildQueryParameters().get("limit"), ImmutableList.of("1000"));
}
@Test(expectedExceptions = IllegalStateException.class)

View File

@ -24,7 +24,6 @@ import static org.jclouds.dmtf.DMTFConstants.CIM_RASD_NS;
import static org.jclouds.dmtf.DMTFConstants.OVF_NS;
import java.math.BigInteger;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
@ -584,8 +583,8 @@ public class ResourceAllocationSettingData {
this.virtualQuantity = builder.virtualQuantity;
this.virtualQuantityUnits = builder.virtualQuantityUnits;
this.weight = builder.weight;
this.connections = builder.connections != null ? ImmutableSet.copyOf(builder.connections) : Collections.<CimString>emptySet();
this.hostResources = builder.hostResources != null ? ImmutableSet.copyOf(builder.hostResources) : Collections.<CimString>emptySet();
this.connections = builder.connections != null ? ImmutableSet.copyOf(builder.connections) : ImmutableSet.<CimString>of();
this.hostResources = builder.hostResources != null ? ImmutableSet.copyOf(builder.hostResources) : ImmutableSet.<CimString>of();
}
protected ResourceAllocationSettingData() {
@ -904,4 +903,4 @@ public class ResourceAllocationSettingData {
equal(this.weight, that.weight);
}
}
}

View File

@ -22,7 +22,6 @@ import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.dmtf.DMTFConstants.CIM_NS;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
@ -185,7 +184,7 @@ public class ProductSection extends SectionType {
this.productUrl = builder.productUrl;
this.vendorUrl = builder.vendorUrl;
this.appUrl = builder.appUrl;
this.properties = builder.properties != null ? ImmutableSet.copyOf(checkNotNull(builder.properties, "properties")) : Collections.<ProductSectionProperty>emptySet();
this.properties = builder.properties != null ? ImmutableSet.copyOf(checkNotNull(builder.properties, "properties")) : ImmutableSet.<ProductSectionProperty>of();
}
private ProductSection() {

View File

@ -21,7 +21,6 @@ package org.jclouds.dmtf.ovf;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collections;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
@ -94,7 +93,7 @@ public class StartupSection extends SectionType {
public StartupSection(Builder<?> builder) {
super(builder);
this.items = (items != null) ? ImmutableList.<StartupSectionItem>copyOf(builder.items) : Collections.<StartupSectionItem>emptyList();
this.items = (items != null) ? ImmutableList.<StartupSectionItem>copyOf(builder.items) : ImmutableList.<StartupSectionItem>of();
}
/**

View File

@ -23,7 +23,6 @@ import static com.google.common.base.Preconditions.checkState;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
@ -38,6 +37,7 @@ import org.jclouds.util.Strings2;
import com.google.common.base.Supplier;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@ -109,7 +109,7 @@ public class JsonNodeMetadataStore implements NodeMetadataStore {
@Override
public Set<NodeMetadata> loadAll(Set<NodeMetadata> backendNodes) {
if (backendNodes == null || backendNodes.isEmpty()) {
return Collections.emptySet();
return ImmutableSet.of();
}
final Set<NodeMetadata> loadedSet = Sets.newLinkedHashSet();
for (NodeMetadata input : backendNodes) {

View File

@ -22,7 +22,7 @@ import static org.jclouds.openstack.swift.v1.options.ListContainersOptions.Build
import static org.jclouds.openstack.swift.v1.options.ListContainersOptions.Builder.marker;
import static org.testng.Assert.assertEquals;
import java.util.Collections;
import com.google.common.collect.ImmutableList;
import org.jclouds.http.options.HttpRequestOptions;
import org.testng.annotations.Test;
@ -50,19 +50,19 @@ public class ListContainersOptionsTest {
public void testMarker() {
ListContainersOptions options = new ListContainersOptions();
options.marker("test");
assertEquals(options.buildQueryParameters().get("marker"), Collections.singletonList("test"));
assertEquals(options.buildQueryParameters().get("marker"), ImmutableList.of("test"));
}
@Test
public void testNullMarker() {
ListContainersOptions options = new ListContainersOptions();
assertEquals(options.buildQueryParameters().get("marker"), Collections.EMPTY_LIST);
assertEquals(options.buildQueryParameters().get("marker"), ImmutableList.of());
}
@Test
public void testMarkerStatic() {
ListContainersOptions options = marker("test");
assertEquals(options.buildQueryParameters().get("marker"), Collections.singletonList("test"));
assertEquals(options.buildQueryParameters().get("marker"), ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -74,19 +74,19 @@ public class ListContainersOptionsTest {
public void testLimit() {
ListContainersOptions options = new ListContainersOptions();
options.limit(1000);
assertEquals(options.buildQueryParameters().get("limit"), Collections.singletonList("1000"));
assertEquals(options.buildQueryParameters().get("limit"), ImmutableList.of("1000"));
}
@Test
public void testNullLimit() {
ListContainersOptions options = new ListContainersOptions();
assertEquals(options.buildQueryParameters().get("limit"), Collections.EMPTY_LIST);
assertEquals(options.buildQueryParameters().get("limit"), ImmutableList.of());
}
@Test
public void testLimitStatic() {
ListContainersOptions options = limit(1000);
assertEquals(options.buildQueryParameters().get("limit"), Collections.singletonList("1000"));
assertEquals(options.buildQueryParameters().get("limit"), ImmutableList.of("1000"));
}
@Test(expectedExceptions = IllegalStateException.class)

View File

@ -21,7 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
@ -201,7 +200,7 @@ public abstract class AbstractVAppType extends ResourceEntity {
* </ul>
*/
public Set<SectionType> getSections() {
return sections != null ? ImmutableSet.copyOf(sections) : Collections.<SectionType>emptySet();
return sections != null ? ImmutableSet.copyOf(sections) : ImmutableSet.<SectionType>of();
}
/**

View File

@ -22,7 +22,6 @@ import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.Set;
@ -118,7 +117,7 @@ public class ProductSectionList extends Resource implements Set<ProductSection>
* Gets the value of the productSection property.
*/
public Set<ProductSection> getProductSections() {
return productSections != null ? ImmutableSet.copyOf(productSections) : Collections.<ProductSection>emptySet();
return productSections != null ? ImmutableSet.copyOf(productSections) : ImmutableSet.<ProductSection>of();
}
@Override

View File

@ -131,7 +131,7 @@ public class Resource {
protected Resource(Builder<?> builder) {
this.href = builder.href;
this.type = builder.type;
this.links = builder.links == null ? Collections.<Link>emptySet() : builder.links;
this.links = builder.links == null ? ImmutableSet.<Link>of() : builder.links;
}
protected Resource() {

View File

@ -21,7 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
@ -179,7 +178,7 @@ public class VAppTemplate extends ResourceEntity {
protected VAppTemplate(Builder<?> builder) {
super(builder);
this.owner = builder.owner;
this.children = builder.children.isEmpty() ? Collections.<Vm>emptySet() : ImmutableSet.copyOf(builder.children);
this.children = builder.children.isEmpty() ? ImmutableSet.<Vm>of() : ImmutableSet.copyOf(builder.children);
this.sections = builder.sections.isEmpty() ? null : ImmutableSet.copyOf(builder.sections);
this.vAppScopedLocalId = builder.vAppScopedLocalId;
this.ovfDescriptorUploaded = builder.ovfDescriptorUploaded;
@ -229,7 +228,7 @@ public class VAppTemplate extends ResourceEntity {
* </ul>
*/
public Set<SectionType> getSections() {
return sections != null ? ImmutableSet.copyOf(sections) : Collections.<SectionType>emptySet();
return sections != null ? ImmutableSet.copyOf(sections) : ImmutableSet.<SectionType>of();
}
/**

View File

@ -22,7 +22,6 @@ import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
@ -207,7 +206,7 @@ public class CaptureVAppParams extends ParamsType {
* </ul>
*/
public Set<SectionType> getSections() {
return sections != null ? ImmutableSet.copyOf(sections) : Collections.<SectionType>emptySet();
return sections != null ? ImmutableSet.copyOf(sections) : ImmutableSet.<SectionType>of();
}
@Override

View File

@ -21,7 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain.params;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collections;
import java.util.List;
import java.util.Set;
@ -170,7 +169,7 @@ public class ControlAccessParams {
* Required on create and edit if {@link #isSharedToEveryone()} is false.
*/
public List<AccessSetting> getAccessSettings() {
return accessSettings == null ? Collections.<AccessSetting>emptyList() : accessSettings;
return accessSettings == null ? ImmutableList.<AccessSetting>of() : accessSettings;
}
@Override

View File

@ -21,7 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain.params;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlElementRef;
@ -151,7 +150,7 @@ public class InstantiationParams {
* </ul>
*/
public Set<SectionType> getSections() {
return sections != null ? ImmutableSet.copyOf(sections) : Collections.<SectionType>emptySet();
return sections != null ? ImmutableSet.copyOf(sections) : ImmutableSet.<SectionType>of();
}
@Override

View File

@ -33,6 +33,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Task.Status;
import org.jclouds.vcloud.director.v1_5.features.TaskApi;
import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
/**
@ -51,7 +52,7 @@ public class TaskStatusEquals implements Predicate<Task> {
private Collection<Status> failingStatuses;
public TaskStatusEquals(TaskApi taskApi, Status expectedStatus, Set<Status> failingStatuses) {
this(taskApi, Collections.singleton(expectedStatus), failingStatuses);
this(taskApi, ImmutableSet.of(expectedStatus), failingStatuses);
}
public TaskStatusEquals(TaskApi taskApi, Set<Status> expectedStatuses, Set<Status> failingStatuses) {

View File

@ -44,7 +44,6 @@ import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.Set;
import org.jclouds.io.Payloads;
@ -67,6 +66,7 @@ import org.testng.annotations.Test;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
/**
@ -185,7 +185,7 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
public void testGetMediaOwner() {
Owner directOwner = mediaApi.getOwner(media.getId());
assertEquals(owner.toBuilder().user(owner.getUser()).build(),
directOwner.toBuilder().links(Collections.<Link> emptySet()).build(), String.format(
directOwner.toBuilder().links(ImmutableSet.<Link> of()).build(), String.format(
GETTER_RETURNS_SAME_OBJ, "getOwner()", "owner", "media.getOwner()", owner.toString(),
directOwner.toString()));

View File

@ -28,8 +28,6 @@ import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;
import java.util.Collections;
import org.jclouds.vcloud.director.v1_5.domain.AdminCatalog;
import org.jclouds.vcloud.director.v1_5.domain.Checks;
import org.jclouds.vcloud.director.v1_5.domain.Link;
@ -44,6 +42,7 @@ import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
/**
@ -127,7 +126,7 @@ public class AdminCatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
owner = catalogApi.getOwner(catalog.getId());
Checks.checkOwner(owner);
assertTrue(
equal(owner.toBuilder().links(Collections.<Link> emptySet()).build(),
equal(owner.toBuilder().links(ImmutableSet.<Link> of()).build(),
newOwner.toBuilder().user(newOwner.getUser()).build()),
String.format(OBJ_FIELD_UPDATABLE, CATALOG, "owner"));
} finally {

View File

@ -26,7 +26,7 @@ import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.U
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
import java.util.Collections;
import com.google.common.collect.ImmutableSet;
import org.jclouds.vcloud.director.v1_5.domain.Checks;
import org.jclouds.vcloud.director.v1_5.domain.Task;
@ -89,7 +89,7 @@ public class AdminNetworkApiLiveTest extends BaseVCloudDirectorApiLiveTest {
OrgNetwork oldNetwork = Network.<OrgNetwork>toSubType(network)
.toBuilder()
.tasks(Collections.<Task>emptySet())
.tasks(ImmutableSet.<Task>of())
.build();
OrgNetwork editNetwork = getMutatedOrgNetwork(oldNetwork);
@ -153,7 +153,7 @@ public class AdminNetworkApiLiveTest extends BaseVCloudDirectorApiLiveTest {
private static OrgNetwork getMutatedOrgNetwork(OrgNetwork network) {
OrgNetwork.Builder<?> networkBuilder = OrgNetwork.builder().fromNetwork(network)
.tasks(Collections.<Task>emptySet())
.tasks(ImmutableSet.<Task>of())
// .name("new "+network.getName())
.description("new "+network.getDescription())
.configuration(getMutatedNetworkConfiguration(network.getConfiguration()));

View File

@ -26,7 +26,6 @@ import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.USER;
import static org.testng.Assert.assertEquals;
import java.net.URI;
import java.util.Collections;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
@ -39,6 +38,8 @@ import org.jclouds.vcloud.director.v1_5.domain.User;
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorAdminApiExpectTest;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.net.HttpHeaders;
/**
@ -251,7 +252,7 @@ public class UserApiExpectTest extends VCloudDirectorAdminApiExpectTest {
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/role/ff1e0c91-1288-3664-82b7-a6fa303af4d1"))
.build())
.password("password")
.groups(Collections.<Reference>emptyList())
.groups(ImmutableList.<Reference>of())
.build();
}

View File

@ -46,7 +46,6 @@ import static org.testng.Assert.fail;
import java.net.URI;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import java.util.Random;
import java.util.Set;
@ -602,7 +601,7 @@ public abstract class BaseVCloudDirectorApiLiveTest extends BaseContextLiveTest<
protected boolean taskDoneEventually(Task task) {
TaskApi taskApi = context.getApi().getTaskApi();
TaskStatusEquals predicate = new TaskStatusEquals(taskApi, ImmutableSet.of(Task.Status.ABORTED,
Task.Status.CANCELED, Task.Status.ERROR, Task.Status.SUCCESS), Collections.<Task.Status> emptySet());
Task.Status.CANCELED, Task.Status.ERROR, Task.Status.SUCCESS), ImmutableSet.<Task.Status> of());
RetryablePredicate<Task> retryablePredicate = new RetryablePredicate<Task>(predicate,
LONG_TASK_TIMEOUT_SECONDS * 1000L);
return retryablePredicate.apply(task);

View File

@ -41,7 +41,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Iterables.filter;
import static com.google.common.collect.Iterables.transform;
import java.util.Collections;
import java.util.List;
import javax.annotation.Resource;
@ -62,6 +61,7 @@ import org.virtualbox_4_1.VBoxException;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
@Singleton
@ -79,7 +79,7 @@ public class UnregisterMachineIfExistsAndDeleteItsMedia implements Function<IMac
@Override
public Void apply(IMachine machine) {
List<IMedium> mediaToBeDeleted = Collections.emptyList();
List<IMedium> mediaToBeDeleted = ImmutableList.of();
try {
mediaToBeDeleted = machine.unregister(vmSpec.getCleanupMode());
} catch (VBoxException e) {

View File

@ -40,7 +40,6 @@ package org.jclouds.virtualbox.functions.admin;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Iterables.transform;
import java.util.Collections;
import java.util.List;
import javax.annotation.Resource;
@ -59,6 +58,7 @@ import org.virtualbox_4_1.VBoxException;
import com.google.common.base.Function;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
@Singleton
@ -70,7 +70,7 @@ public class UnregisterMachineIfExistsAndForceDeleteItsMedia implements Function
@Override
public Void apply(IMachine machine) {
List<IMedium> mediaToBeDeleted = Collections.emptyList();
List<IMedium> mediaToBeDeleted = ImmutableList.of();
try {
mediaToBeDeleted = machine.unregister(CleanupMode.Full);
} catch (VBoxException e) {

View File

@ -21,7 +21,6 @@ package org.jclouds.aws.ec2.compute;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import java.util.Collections;
import java.util.Set;
import org.jclouds.aws.ec2.AWSEC2ApiMetadata;
@ -157,8 +156,8 @@ public class IncidentalResourcesGetCleanedUpLiveTest extends BaseComputeServiceC
done = securityGroupsAfterDestroyAll.isEmpty() && keyPairsAfterDestroyAll.isEmpty();
} while (!done && stopwatch.elapsedMillis() < TIMEOUT_MS);
assertEquals(securityGroupsAfterDestroyAll, Collections.emptySet());
assertEquals(keyPairsAfterDestroyAll, Collections.emptySet());
assertEquals(securityGroupsAfterDestroyAll, ImmutableSet.of());
assertEquals(keyPairsAfterDestroyAll, ImmutableSet.of());
} finally {
view.getComputeService().destroyNodesMatching(NodePredicates.inGroup(group));

View File

@ -20,7 +20,6 @@ package org.jclouds.aws.ec2.compute.strategy;
import static org.testng.Assert.assertEquals;
import java.util.Collections;
import java.util.Map;
import org.jclouds.compute.config.BaseComputeServiceContextModule;
@ -38,6 +37,8 @@ import org.jclouds.json.config.GsonModule;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Guice;
public class AWSEC2ReviseParsedImageTest {
@ -94,13 +95,13 @@ public class AWSEC2ReviseParsedImageTest {
Image.ImageState imageState = Image.ImageState.AVAILABLE;
Image.ImageType imageType = Image.ImageType.MACHINE;
boolean isPublic = true;
Iterable<String> productCodes = Collections.emptySet();
Iterable<String> productCodes = ImmutableSet.of();
String kernelId = "";
String platform = "";
String ramdiskId = "";
RootDeviceType rootDeviceType = RootDeviceType.EBS;
String rootDeviceName = "";
Map<String, Image.EbsBlockDevice> ebsBlockDevices = Collections.emptyMap();
Map<String, Image.EbsBlockDevice> ebsBlockDevices = ImmutableMap.of();
VirtualizationType virtualizationType = VirtualizationType.HVM;
Hypervisor hypervisor = Hypervisor.XEN;
Image from = new Image(region, architecture, imageName, description, imageId, imageOwnerId + "/" + imageName, imageOwnerId, imageState, "available", imageType, isPublic, productCodes, kernelId, platform, ramdiskId, rootDeviceType, rootDeviceName, ebsBlockDevices, virtualizationType, hypervisor);

View File

@ -24,11 +24,10 @@ import static org.jclouds.aws.ec2.options.AWSDescribeImagesOptions.Builder.image
import static org.jclouds.aws.ec2.options.AWSDescribeImagesOptions.Builder.ownedBy;
import static org.testng.Assert.assertEquals;
import java.util.Collections;
import org.jclouds.http.options.HttpRequestOptions;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultimap;
@ -49,19 +48,19 @@ public class AWSDescribeImagesOptionsTest {
public void testExecutableBy() {
AWSDescribeImagesOptions options = new AWSDescribeImagesOptions();
options.executableBy("test");
assertEquals(options.buildFormParameters().get("ExecutableBy"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("ExecutableBy"), ImmutableList.of("test"));
}
@Test
public void testNullExecutableBy() {
AWSDescribeImagesOptions options = new AWSDescribeImagesOptions();
assertEquals(options.buildFormParameters().get("ExecutableBy"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("ExecutableBy"), ImmutableList.of());
}
@Test
public void testExecutableByStatic() {
AWSDescribeImagesOptions options = executableBy("test");
assertEquals(options.buildFormParameters().get("ExecutableBy"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("ExecutableBy"), ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -73,27 +72,27 @@ public class AWSDescribeImagesOptionsTest {
public void testOwners() {
AWSDescribeImagesOptions options = new AWSDescribeImagesOptions();
options.ownedBy("test");
assertEquals(options.buildFormParameters().get("Owner.1"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("Owner.1"), ImmutableList.of("test"));
}
@Test
public void testMultipleOwners() {
AWSDescribeImagesOptions options = new AWSDescribeImagesOptions();
options.ownedBy("test", "trouble");
assertEquals(options.buildFormParameters().get("Owner.1"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("Owner.2"), Collections.singletonList("trouble"));
assertEquals(options.buildFormParameters().get("Owner.1"), ImmutableList.of("test"));
assertEquals(options.buildFormParameters().get("Owner.2"), ImmutableList.of("trouble"));
}
@Test
public void testNullOwners() {
AWSDescribeImagesOptions options = new AWSDescribeImagesOptions();
assertEquals(options.buildFormParameters().get("Owner.1"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("Owner.1"), ImmutableList.of());
}
@Test
public void testOwnersStatic() {
AWSDescribeImagesOptions options = ownedBy("test");
assertEquals(options.buildFormParameters().get("Owner.1"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("Owner.1"), ImmutableList.of("test"));
}
public void testNoOwners() {
@ -104,27 +103,27 @@ public class AWSDescribeImagesOptionsTest {
public void testImageIds() {
AWSDescribeImagesOptions options = new AWSDescribeImagesOptions();
options.imageIds("test");
assertEquals(options.buildFormParameters().get("ImageId.1"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("ImageId.1"), ImmutableList.of("test"));
}
@Test
public void testMultipleImageIds() {
AWSDescribeImagesOptions options = new AWSDescribeImagesOptions();
options.imageIds("test", "trouble");
assertEquals(options.buildFormParameters().get("ImageId.1"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("ImageId.2"), Collections.singletonList("trouble"));
assertEquals(options.buildFormParameters().get("ImageId.1"), ImmutableList.of("test"));
assertEquals(options.buildFormParameters().get("ImageId.2"), ImmutableList.of("trouble"));
}
@Test
public void testNullImageIds() {
AWSDescribeImagesOptions options = new AWSDescribeImagesOptions();
assertEquals(options.buildFormParameters().get("ImageId.1"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("ImageId.1"), ImmutableList.of());
}
@Test
public void testImageIdsStatic() {
AWSDescribeImagesOptions options = imageIds("test");
assertEquals(options.buildFormParameters().get("ImageId.1"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("ImageId.1"), ImmutableList.of("test"));
}
public void testNoImageIds() {
@ -139,12 +138,12 @@ public class AWSDescribeImagesOptionsTest {
}
private void testMapFilters(AWSDescribeImagesOptions options) {
assertEquals(options.buildFormParameters().get("Filter.1.Name"), Collections.singletonList("is-public"));
assertEquals(options.buildFormParameters().get("Filter.1.Value.1"), Collections.singletonList("true"));
assertEquals(options.buildFormParameters().get("Filter.2.Name"), Collections.singletonList("architecture"));
assertEquals(options.buildFormParameters().get("Filter.2.Value.1"), Collections.singletonList("x86_64"));
assertEquals(options.buildFormParameters().get("Filter.3.Name"), Collections.singletonList("platform"));
assertEquals(options.buildFormParameters().get("Filter.3.Value.1"), Collections.singletonList("windows"));
assertEquals(options.buildFormParameters().get("Filter.1.Name"), ImmutableList.of("is-public"));
assertEquals(options.buildFormParameters().get("Filter.1.Value.1"), ImmutableList.of("true"));
assertEquals(options.buildFormParameters().get("Filter.2.Name"), ImmutableList.of("architecture"));
assertEquals(options.buildFormParameters().get("Filter.2.Value.1"), ImmutableList.of("x86_64"));
assertEquals(options.buildFormParameters().get("Filter.3.Name"), ImmutableList.of("platform"));
assertEquals(options.buildFormParameters().get("Filter.3.Value.1"), ImmutableList.of("windows"));
}
@Test
@ -163,12 +162,12 @@ public class AWSDescribeImagesOptionsTest {
}
private void testMultimapFilters(AWSDescribeImagesOptions options) {
assertEquals(options.buildFormParameters().get("Filter.1.Name"), Collections.singletonList("is-public"));
assertEquals(options.buildFormParameters().get("Filter.1.Value.1"), Collections.singletonList("true"));
assertEquals(options.buildFormParameters().get("Filter.2.Name"), Collections.singletonList("architecture"));
assertEquals(options.buildFormParameters().get("Filter.2.Value.1"), Collections.singletonList("x86_64"));
assertEquals(options.buildFormParameters().get("Filter.3.Name"), Collections.singletonList("platform"));
assertEquals(options.buildFormParameters().get("Filter.3.Value.1"), Collections.singletonList("windows"));
assertEquals(options.buildFormParameters().get("Filter.1.Name"), ImmutableList.of("is-public"));
assertEquals(options.buildFormParameters().get("Filter.1.Value.1"), ImmutableList.of("true"));
assertEquals(options.buildFormParameters().get("Filter.2.Name"), ImmutableList.of("architecture"));
assertEquals(options.buildFormParameters().get("Filter.2.Value.1"), ImmutableList.of("x86_64"));
assertEquals(options.buildFormParameters().get("Filter.3.Name"), ImmutableList.of("platform"));
assertEquals(options.buildFormParameters().get("Filter.3.Value.1"), ImmutableList.of("windows"));
}
@Test

View File

@ -30,13 +30,12 @@ import static org.jclouds.aws.ec2.options.AWSRunInstancesOptions.Builder.withSub
import static org.jclouds.aws.ec2.options.AWSRunInstancesOptions.Builder.withUserData;
import static org.testng.Assert.assertEquals;
import java.util.Collections;
import org.jclouds.ec2.domain.BlockDeviceMapping;
import org.jclouds.ec2.domain.InstanceType;
import org.jclouds.http.options.HttpRequestOptions;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
/**
@ -56,19 +55,19 @@ public class AWSRunInstancesOptionsTest {
public void testWithKeyName() {
AWSRunInstancesOptions options = new AWSRunInstancesOptions();
options.withKeyName("test");
assertEquals(options.buildFormParameters().get("KeyName"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("KeyName"), ImmutableList.of("test"));
}
@Test
public void testNullWithKeyName() {
AWSRunInstancesOptions options = new AWSRunInstancesOptions();
assertEquals(options.buildFormParameters().get("KeyName"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("KeyName"), ImmutableList.of());
}
@Test
public void testWithKeyNameStatic() {
AWSRunInstancesOptions options = withKeyName("test");
assertEquals(options.buildFormParameters().get("KeyName"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("KeyName"), ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -80,19 +79,19 @@ public class AWSRunInstancesOptionsTest {
public void testWithSecurityGroup() {
AWSRunInstancesOptions options = new AWSRunInstancesOptions();
options.withSecurityGroup("test");
assertEquals(options.buildFormParameters().get("SecurityGroup.1"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("SecurityGroup.1"), ImmutableList.of("test"));
}
@Test
public void testNullWithSecurityGroup() {
AWSRunInstancesOptions options = new AWSRunInstancesOptions();
assertEquals(options.buildFormParameters().get("SecurityGroup"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("SecurityGroup"), ImmutableList.of());
}
@Test
public void testWithSecurityGroupStatic() {
AWSRunInstancesOptions options = withSecurityGroup("test");
assertEquals(options.buildFormParameters().get("SecurityGroup.1"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("SecurityGroup.1"), ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -105,19 +104,19 @@ public class AWSRunInstancesOptionsTest {
public void testWithSecurityGroupId() {
AWSRunInstancesOptions options = new AWSRunInstancesOptions();
options.withSecurityGroupId("test");
assertEquals(options.buildFormParameters().get("SecurityGroupId.1"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("SecurityGroupId.1"), ImmutableList.of("test"));
}
@Test
public void testNullWithSecurityGroupId() {
AWSRunInstancesOptions options = new AWSRunInstancesOptions();
assertEquals(options.buildFormParameters().get("SecurityGroupId"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("SecurityGroupId"), ImmutableList.of());
}
@Test
public void testWithSecurityGroupIdStatic() {
AWSRunInstancesOptions options = withSecurityGroupId("test");
assertEquals(options.buildFormParameters().get("SecurityGroupId.1"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("SecurityGroupId.1"), ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -128,26 +127,26 @@ public class AWSRunInstancesOptionsTest {
@Test
public void testNullWithAdditionalInfo() {
AWSRunInstancesOptions options = new AWSRunInstancesOptions();
assertEquals(options.buildFormParameters().get("AdditionalInfo"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("AdditionalInfo"), ImmutableList.of());
}
@Test
public void testWithUserData() {
AWSRunInstancesOptions options = new AWSRunInstancesOptions();
options.withUserData("test".getBytes());
assertEquals(options.buildFormParameters().get("UserData"), Collections.singletonList("dGVzdA=="));
assertEquals(options.buildFormParameters().get("UserData"), ImmutableList.of("dGVzdA=="));
}
@Test
public void testNullWithUserData() {
AWSRunInstancesOptions options = new AWSRunInstancesOptions();
assertEquals(options.buildFormParameters().get("UserData"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("UserData"), ImmutableList.of());
}
@Test
public void testWithUserDataStatic() {
AWSRunInstancesOptions options = withUserData("test".getBytes());
assertEquals(options.buildFormParameters().get("UserData"), Collections.singletonList("dGVzdA=="));
assertEquals(options.buildFormParameters().get("UserData"), ImmutableList.of("dGVzdA=="));
}
@Test(expectedExceptions = NullPointerException.class)
@ -164,19 +163,19 @@ public class AWSRunInstancesOptionsTest {
public void testWithInstanceType() {
AWSRunInstancesOptions options = new AWSRunInstancesOptions();
options.asType(InstanceType.C1_XLARGE);
assertEquals(options.buildFormParameters().get("InstanceType"), Collections.singletonList("c1.xlarge"));
assertEquals(options.buildFormParameters().get("InstanceType"), ImmutableList.of("c1.xlarge"));
}
@Test
public void testNullWithInstanceType() {
AWSRunInstancesOptions options = new AWSRunInstancesOptions();
assertEquals(options.buildFormParameters().get("InstanceType"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("InstanceType"), ImmutableList.of());
}
@Test
public void testWithInstanceTypeStatic() {
AWSRunInstancesOptions options = asType(InstanceType.C1_XLARGE);
assertEquals(options.buildFormParameters().get("InstanceType"), Collections.singletonList("c1.xlarge"));
assertEquals(options.buildFormParameters().get("InstanceType"), ImmutableList.of("c1.xlarge"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -188,19 +187,19 @@ public class AWSRunInstancesOptionsTest {
public void testWithKernelId() {
AWSRunInstancesOptions options = new AWSRunInstancesOptions();
options.withKernelId("test");
assertEquals(options.buildFormParameters().get("KernelId"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("KernelId"), ImmutableList.of("test"));
}
@Test
public void testNullWithKernelId() {
AWSRunInstancesOptions options = new AWSRunInstancesOptions();
assertEquals(options.buildFormParameters().get("KernelId"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("KernelId"), ImmutableList.of());
}
@Test
public void testWithKernelIdStatic() {
AWSRunInstancesOptions options = withKernelId("test");
assertEquals(options.buildFormParameters().get("KernelId"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("KernelId"), ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -212,38 +211,38 @@ public class AWSRunInstancesOptionsTest {
public void testWithMonitoringEnabled() {
AWSRunInstancesOptions options = new AWSRunInstancesOptions();
options.enableMonitoring();
assertEquals(options.buildFormParameters().get("Monitoring.Enabled"), Collections.singletonList("true"));
assertEquals(options.buildFormParameters().get("Monitoring.Enabled"), ImmutableList.of("true"));
}
@Test
public void testNullWithMonitoringEnabled() {
AWSRunInstancesOptions options = new AWSRunInstancesOptions();
assertEquals(options.buildFormParameters().get("Monitoring.Enabled"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("Monitoring.Enabled"), ImmutableList.of());
}
@Test
public void testWithMonitoringEnabledStatic() {
AWSRunInstancesOptions options = enableMonitoring();
assertEquals(options.buildFormParameters().get("Monitoring.Enabled"), Collections.singletonList("true"));
assertEquals(options.buildFormParameters().get("Monitoring.Enabled"), ImmutableList.of("true"));
}
@Test
public void testWithSubnetId() {
AWSRunInstancesOptions options = new AWSRunInstancesOptions();
options.withSubnetId("test");
assertEquals(options.buildFormParameters().get("SubnetId"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("SubnetId"), ImmutableList.of("test"));
}
@Test
public void testNullWithSubnetId() {
AWSRunInstancesOptions options = new AWSRunInstancesOptions();
assertEquals(options.buildFormParameters().get("SubnetId"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("SubnetId"), ImmutableList.of());
}
@Test
public void testWithSubnetIdStatic() {
AWSRunInstancesOptions options = withSubnetId("test");
assertEquals(options.buildFormParameters().get("SubnetId"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("SubnetId"), ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -255,19 +254,19 @@ public class AWSRunInstancesOptionsTest {
public void testWithRamdisk() {
AWSRunInstancesOptions options = new AWSRunInstancesOptions();
options.withRamdisk("test");
assertEquals(options.buildFormParameters().get("RamdiskId"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("RamdiskId"), ImmutableList.of("test"));
}
@Test
public void testNullWithRamdisk() {
AWSRunInstancesOptions options = new AWSRunInstancesOptions();
assertEquals(options.buildFormParameters().get("RamdiskId"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("RamdiskId"), ImmutableList.of());
}
@Test
public void testWithRamdiskStatic() {
AWSRunInstancesOptions options = withRamdisk("test");
assertEquals(options.buildFormParameters().get("RamdiskId"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("RamdiskId"), ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -278,7 +277,7 @@ public class AWSRunInstancesOptionsTest {
@Test
public void testNullWithVirtualName() {
AWSRunInstancesOptions options = new AWSRunInstancesOptions();
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.VirtualName"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.VirtualName"), ImmutableList.of());
}
@Test
@ -286,30 +285,30 @@ public class AWSRunInstancesOptionsTest {
BlockDeviceMapping mapping = new BlockDeviceMapping.MapNewVolumeToDevice("/dev/sda1", 120, true);
AWSRunInstancesOptions options = new AWSRunInstancesOptions().withBlockDeviceMappings(ImmutableSet
.<BlockDeviceMapping> of(mapping));
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.DeviceName"), Collections
.singletonList("/dev/sda1"));
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.VolumeSize"), Collections
.singletonList("120"));
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.DeleteOnTermination"), Collections
.singletonList("true"));
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.DeviceName"),
ImmutableList.of("/dev/sda1"));
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.VolumeSize"),
ImmutableList.of("120"));
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.DeleteOnTermination"),
ImmutableList.of("true"));
}
@Test
public void testNullWithBlockDeviceMapping() {
AWSRunInstancesOptions options = new AWSRunInstancesOptions();
assertEquals(options.buildFormParameters().get("BlockDeviceMapping"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("BlockDeviceMapping"), ImmutableList.of());
}
@Test
public void testWithBlockDeviceMappingStatic() {
BlockDeviceMapping mapping = new BlockDeviceMapping.MapNewVolumeToDevice("/dev/sda1", 120, true);
AWSRunInstancesOptions options = withBlockDeviceMappings(ImmutableSet.<BlockDeviceMapping> of(mapping));
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.DeviceName"), Collections
.singletonList("/dev/sda1"));
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.VolumeSize"), Collections
.singletonList("120"));
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.DeleteOnTermination"), Collections
.singletonList("true"));
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.DeviceName"),
ImmutableList.of("/dev/sda1"));
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.VolumeSize"),
ImmutableList.of("120"));
assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.DeleteOnTermination"),
ImmutableList.of("true"));
}
@Test(expectedExceptions = NullPointerException.class)

View File

@ -24,9 +24,9 @@ import static org.jclouds.aws.ec2.options.DescribeSpotPriceHistoryOptions.Builde
import static org.jclouds.aws.ec2.options.DescribeSpotPriceHistoryOptions.Builder.to;
import static org.testng.Assert.assertEquals;
import java.util.Collections;
import java.util.Date;
import com.google.common.collect.ImmutableList;
import org.jclouds.http.options.HttpRequestOptions;
import org.testng.annotations.Test;
@ -48,13 +48,13 @@ public class DescribeSpotPriceHistoryOptionsTest {
public void testDescription() {
DescribeSpotPriceHistoryOptions options = new DescribeSpotPriceHistoryOptions();
options.productDescription("test");
assertEquals(options.buildFormParameters().get("ProductDescription"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("ProductDescription"), ImmutableList.of("test"));
}
@Test
public void testDescriptionStatic() {
DescribeSpotPriceHistoryOptions options = productDescription("test");
assertEquals(options.buildFormParameters().get("ProductDescription"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("ProductDescription"), ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -66,13 +66,13 @@ public class DescribeSpotPriceHistoryOptionsTest {
public void testInstanceType() {
DescribeSpotPriceHistoryOptions options = new DescribeSpotPriceHistoryOptions();
options.instanceType("test");
assertEquals(options.buildFormParameters().get("InstanceType.1"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("InstanceType.1"), ImmutableList.of("test"));
}
@Test
public void testInstanceTypeStatic() {
DescribeSpotPriceHistoryOptions options = instanceType("test");
assertEquals(options.buildFormParameters().get("InstanceType.1"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("InstanceType.1"), ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -84,7 +84,7 @@ public class DescribeSpotPriceHistoryOptionsTest {
public void testFrom() {
DescribeSpotPriceHistoryOptions options = new DescribeSpotPriceHistoryOptions();
options.from(test);
assertEquals(options.buildFormParameters().get("StartTime"), Collections.singletonList("1970-05-23T21:21:18.910Z"));
assertEquals(options.buildFormParameters().get("StartTime"), ImmutableList.of("1970-05-23T21:21:18.910Z"));
}
Date test = new Date(12345678910l);
@ -92,7 +92,7 @@ public class DescribeSpotPriceHistoryOptionsTest {
@Test
public void testFromStatic() {
DescribeSpotPriceHistoryOptions options = from(test);
assertEquals(options.buildFormParameters().get("StartTime"), Collections.singletonList("1970-05-23T21:21:18.910Z"));
assertEquals(options.buildFormParameters().get("StartTime"), ImmutableList.of("1970-05-23T21:21:18.910Z"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -104,13 +104,13 @@ public class DescribeSpotPriceHistoryOptionsTest {
public void testTo() {
DescribeSpotPriceHistoryOptions options = new DescribeSpotPriceHistoryOptions();
options.to(test);
assertEquals(options.buildFormParameters().get("EndTime"), Collections.singletonList("1970-05-23T21:21:18.910Z"));
assertEquals(options.buildFormParameters().get("EndTime"), ImmutableList.of("1970-05-23T21:21:18.910Z"));
}
@Test
public void testToStatic() {
DescribeSpotPriceHistoryOptions options = to(test);
assertEquals(options.buildFormParameters().get("EndTime"), Collections.singletonList("1970-05-23T21:21:18.910Z"));
assertEquals(options.buildFormParameters().get("EndTime"), ImmutableList.of("1970-05-23T21:21:18.910Z"));
}
@Test(expectedExceptions = NullPointerException.class)

View File

@ -25,9 +25,10 @@ import static org.jclouds.aws.ec2.options.RequestSpotInstancesOptions.Builder.va
import static org.jclouds.aws.ec2.options.RequestSpotInstancesOptions.Builder.validUntil;
import static org.testng.Assert.assertEquals;
import java.util.Collections;
import java.util.Date;
import com.google.common.collect.ImmutableList;
import org.jclouds.aws.ec2.domain.SpotInstanceRequest;
import org.jclouds.http.options.HttpRequestOptions;
import org.testng.annotations.Test;
@ -49,13 +50,13 @@ public class RequestSpotInstancesOptionsTest {
public void testAvailabilityZoneGroup() {
RequestSpotInstancesOptions options = new RequestSpotInstancesOptions();
options.availabilityZoneGroup("test");
assertEquals(options.buildFormParameters().get("AvailabilityZoneGroup"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("AvailabilityZoneGroup"), ImmutableList.of("test"));
}
@Test
public void testAvailabilityZoneGroupStatic() {
RequestSpotInstancesOptions options = availabilityZoneGroup("test");
assertEquals(options.buildFormParameters().get("AvailabilityZoneGroup"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("AvailabilityZoneGroup"), ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -67,13 +68,13 @@ public class RequestSpotInstancesOptionsTest {
public void testLaunchGroup() {
RequestSpotInstancesOptions options = new RequestSpotInstancesOptions();
options.launchGroup("test");
assertEquals(options.buildFormParameters().get("LaunchGroup"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("LaunchGroup"), ImmutableList.of("test"));
}
@Test
public void testLaunchGroupStatic() {
RequestSpotInstancesOptions options = launchGroup("test");
assertEquals(options.buildFormParameters().get("LaunchGroup"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("LaunchGroup"), ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -85,13 +86,13 @@ public class RequestSpotInstancesOptionsTest {
public void testInstanceType() {
RequestSpotInstancesOptions options = new RequestSpotInstancesOptions();
options.type(SpotInstanceRequest.Type.PERSISTENT);
assertEquals(options.buildFormParameters().get("Type"), Collections.singletonList("persistent"));
assertEquals(options.buildFormParameters().get("Type"), ImmutableList.of("persistent"));
}
@Test
public void testInstanceTypeStatic() {
RequestSpotInstancesOptions options = type(SpotInstanceRequest.Type.PERSISTENT);
assertEquals(options.buildFormParameters().get("Type"), Collections.singletonList("persistent"));
assertEquals(options.buildFormParameters().get("Type"), ImmutableList.of("persistent"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -104,7 +105,7 @@ public class RequestSpotInstancesOptionsTest {
RequestSpotInstancesOptions options = new RequestSpotInstancesOptions();
options.validFrom(test);
assertEquals(options.buildFormParameters().get("ValidFrom"),
Collections.singletonList("1970-05-23T21:21:18Z"));
ImmutableList.of("1970-05-23T21:21:18Z"));
}
Date test = new Date(12345678910l);
@ -113,7 +114,7 @@ public class RequestSpotInstancesOptionsTest {
public void testFromStatic() {
RequestSpotInstancesOptions options = validFrom(test);
assertEquals(options.buildFormParameters().get("ValidFrom"),
Collections.singletonList("1970-05-23T21:21:18Z"));
ImmutableList.of("1970-05-23T21:21:18Z"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -126,14 +127,14 @@ public class RequestSpotInstancesOptionsTest {
RequestSpotInstancesOptions options = new RequestSpotInstancesOptions();
options.validUntil(test);
assertEquals(options.buildFormParameters().get("ValidUntil"),
Collections.singletonList("1970-05-23T21:21:18Z"));
ImmutableList.of("1970-05-23T21:21:18Z"));
}
@Test
public void testToStatic() {
RequestSpotInstancesOptions options = validUntil(test);
assertEquals(options.buildFormParameters().get("ValidUntil"),
Collections.singletonList("1970-05-23T21:21:18Z"));
ImmutableList.of("1970-05-23T21:21:18Z"));
}
@Test(expectedExceptions = NullPointerException.class)

View File

@ -18,7 +18,6 @@
*/
package org.jclouds.glesys.features;
import static java.util.Collections.emptySet;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
@ -170,7 +169,7 @@ public class IpApiExpectTest extends BaseGleSYSApiExpectTest {
HttpResponse.builder().statusCode(404).build())
.getIpApi();
assertEquals(api.listFree(6, "Falkenberg", "OpenVZ").toImmutableSet(), emptySet());
assertEquals(api.listFree(6, "Falkenberg", "OpenVZ").toImmutableSet(), ImmutableSet.of());
}
public void testAddWhenResponseIs2xx() {

View File

@ -22,7 +22,7 @@ import static org.jclouds.gogrid.options.AddServerOptions.Builder.asSandboxType;
import static org.jclouds.gogrid.options.AddServerOptions.Builder.withDescription;
import static org.testng.Assert.assertEquals;
import java.util.Collections;
import com.google.common.collect.ImmutableList;
import org.jclouds.http.options.HttpRequestOptions;
import org.testng.annotations.Test;
@ -46,8 +46,8 @@ public class AddServerOptionsTest {
public void testWithDescription() {
AddServerOptions options = new AddServerOptions();
options.withDescription("test");
assertEquals(options.buildQueryParameters().get("description"), Collections
.singletonList("test"));
assertEquals(options.buildQueryParameters().get("description"),
ImmutableList.of("test"));
}
@Test(expectedExceptions = IllegalArgumentException.class)
@ -75,21 +75,21 @@ public class AddServerOptionsTest {
String description = builder.toString();
options.withDescription(description);
assertEquals(options.buildQueryParameters().get("description"), Collections
.singletonList(description));
assertEquals(options.buildQueryParameters().get("description"),
ImmutableList.of(description));
}
@Test
public void testNullWithDescription() {
AddServerOptions options = new AddServerOptions();
assertEquals(options.buildQueryParameters().get("description"), Collections.EMPTY_LIST);
assertEquals(options.buildQueryParameters().get("description"), ImmutableList.of());
}
@Test
public void testWithDescriptionStatic() {
AddServerOptions options = withDescription("test");
assertEquals(options.buildQueryParameters().get("description"), Collections
.singletonList("test"));
assertEquals(options.buildQueryParameters().get("description"),
ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)
@ -101,15 +101,15 @@ public class AddServerOptionsTest {
public void testAsSandboxType() {
AddServerOptions options = new AddServerOptions();
options.asSandboxType();
assertEquals(options.buildQueryParameters().get("isSandbox"), Collections
.singletonList("true"));
assertEquals(options.buildQueryParameters().get("isSandbox"),
ImmutableList.of("true"));
}
@Test
public void testAsSandboxTypeStatic() {
AddServerOptions options = asSandboxType();
assertEquals(options.buildQueryParameters().get("isSandbox"), Collections
.singletonList("true"));
assertEquals(options.buildQueryParameters().get("isSandbox"),
ImmutableList.of("true"));
}
}

View File

@ -21,7 +21,7 @@ package org.jclouds.gogrid.options;
import static org.jclouds.gogrid.options.SaveImageOptions.Builder.withDescription;
import static org.testng.Assert.assertEquals;
import java.util.Collections;
import com.google.common.collect.ImmutableList;
import org.jclouds.http.options.HttpRequestOptions;
import org.testng.annotations.Test;
@ -45,8 +45,8 @@ public class SaveImageOptionsTest {
public void testWithDescription() {
SaveImageOptions options = new SaveImageOptions();
options.withDescription("test");
assertEquals(options.buildQueryParameters().get("description"), Collections
.singletonList("test"));
assertEquals(options.buildQueryParameters().get("description"),
ImmutableList.of("test"));
}
@Test(expectedExceptions = IllegalArgumentException.class)
@ -74,21 +74,21 @@ public class SaveImageOptionsTest {
String description = builder.toString();
options.withDescription(description);
assertEquals(options.buildQueryParameters().get("description"), Collections
.singletonList(description));
assertEquals(options.buildQueryParameters().get("description"),
ImmutableList.of(description));
}
@Test
public void testNullWithDescription() {
SaveImageOptions options = new SaveImageOptions();
assertEquals(options.buildQueryParameters().get("description"), Collections.EMPTY_LIST);
assertEquals(options.buildQueryParameters().get("description"), ImmutableList.of());
}
@Test
public void testWithDescriptionStatic() {
SaveImageOptions options = withDescription("test");
assertEquals(options.buildQueryParameters().get("description"), Collections
.singletonList("test"));
assertEquals(options.buildQueryParameters().get("description"),
ImmutableList.of("test"));
}
@Test(expectedExceptions = NullPointerException.class)

View File

@ -22,8 +22,6 @@ import static org.jclouds.simpledb.options.ListDomainsOptions.Builder.maxNumberO
import static org.jclouds.simpledb.options.ListDomainsOptions.Builder.nextToken;
import static org.testng.Assert.assertEquals;
import java.util.Collections;
import org.jclouds.http.options.HttpRequestOptions;
import org.testng.annotations.Test;
@ -44,19 +42,19 @@ public class ListDomainsOptionsTest {
public void testNextToken() {
ListDomainsOptions options = new ListDomainsOptions();
options.nextToken("test");
assertEquals(options.buildFormParameters().get("NextToken"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("NextToken"), ImmutableList.of("test"));
}
@Test
public void testNullNextToken() {
ListDomainsOptions options = new ListDomainsOptions();
assertEquals(options.buildFormParameters().get("NextToken"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("NextToken"), ImmutableList.of());
}
@Test
public void testNextTokenStatic() {
ListDomainsOptions options = nextToken("test");
assertEquals(options.buildFormParameters().get("NextToken"), Collections.singletonList("test"));
assertEquals(options.buildFormParameters().get("NextToken"), ImmutableList.of("test"));
}
public void testInvalidMaxNumberOfDomainsZero() {
@ -71,19 +69,19 @@ public class ListDomainsOptionsTest {
public void testMaxNumberOfDomains() {
ListDomainsOptions options = new ListDomainsOptions();
options.maxNumberOfDomains(1);
assertEquals(options.buildFormParameters().get("MaxNumberOfDomains"), Collections.singletonList("1"));
assertEquals(options.buildFormParameters().get("MaxNumberOfDomains"), ImmutableList.of("1"));
}
@Test
public void testNullMaxNumberOfDomains() {
ListDomainsOptions options = new ListDomainsOptions();
assertEquals(options.buildFormParameters().get("MaxNumberOfDomains"), Collections.EMPTY_LIST);
assertEquals(options.buildFormParameters().get("MaxNumberOfDomains"), ImmutableList.of());
}
@Test
public void testMaxNumberOfDomainsStatic() {
ListDomainsOptions options = maxNumberOfDomains(1);
assertEquals(options.buildFormParameters().get("MaxNumberOfDomains"), Collections.singletonList("1"));
assertEquals(options.buildFormParameters().get("MaxNumberOfDomains"), ImmutableList.of("1"));
}
}

View File

@ -20,8 +20,6 @@ package org.jclouds.azurequeue.options;
import static com.google.common.base.Preconditions.checkArgument;
import java.util.Collections;
import org.jclouds.http.options.BaseHttpRequestOptions;
/**
@ -51,7 +49,7 @@ public class GetOptions extends BaseHttpRequestOptions {
*/
public GetOptions maxMessages(int count) {
checkArgument(count > 0&& count <= 32, "count must be a positive number; max 32");
queryParameters.replaceValues("numofmessages", Collections.singletonList(count + ""));
queryParameters.replaceValues("numofmessages", ImmutableList.of(count + ""));
return this;
}
@ -62,7 +60,7 @@ public class GetOptions extends BaseHttpRequestOptions {
public GetOptions visibilityTimeout(int timeout) {
checkArgument(timeout > 0 && timeout <= 2 * 60 * 60,
"timeout is in seconds; must be positive and maximum 2 hours");
queryParameters.replaceValues("visibilitytimeout", Collections.singletonList(timeout + ""));
queryParameters.replaceValues("visibilitytimeout", ImmutableList.of(timeout + ""));
return this;
}

View File

@ -22,7 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
import static org.jclouds.scriptbuilder.domain.Statements.interpret;
import java.util.Collections;
import java.util.Map;
import java.util.Map.Entry;
@ -115,7 +114,7 @@ public class AppendFile implements Statement {
@Override
public Iterable<String> functionDependencies(OsFamily family) {
return Collections.emptyList();
return ImmutableList.of();
}
@Override

View File

@ -28,7 +28,6 @@ import static org.jclouds.scriptbuilder.domain.Statements.createOrOverwriteFile;
import static org.jclouds.scriptbuilder.domain.Statements.exec;
import static org.jclouds.scriptbuilder.domain.Statements.interpret;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@ -40,8 +39,8 @@ import com.google.common.base.Function;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.ImmutableList.Builder;
import com.google.common.collect.Iterables;
/**
* Creates a run script
@ -83,7 +82,7 @@ public class CreateRunScript extends StatementList {
@Override
public Iterable<String> functionDependencies(OsFamily family) {
return Collections.emptyList();
return ImmutableList.of();
}
@Override
@ -95,7 +94,7 @@ public class CreateRunScript extends StatementList {
@Override
public Iterable<String> functionDependencies(OsFamily family) {
return Collections.emptyList();
return ImmutableList.of();
}
@Override

View File

@ -22,7 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.scriptbuilder.domain.Statements.appendFile;
import static org.jclouds.scriptbuilder.domain.Statements.exec;
import java.util.Collections;
import java.util.List;
import org.jclouds.scriptbuilder.domain.OsFamily;
@ -53,7 +52,7 @@ public class AuthorizeRSAPublicKeys implements Statement {
@Override
public Iterable<String> functionDependencies(OsFamily family) {
return Collections.emptyList();
return ImmutableList.of();
}
@Override

View File

@ -22,8 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.scriptbuilder.domain.Statements.appendFile;
import static org.jclouds.scriptbuilder.domain.Statements.exec;
import java.util.Collections;
import org.jclouds.scriptbuilder.domain.OsFamily;
import org.jclouds.scriptbuilder.domain.Statement;
import org.jclouds.scriptbuilder.domain.StatementList;
@ -51,7 +49,7 @@ public class InstallRSAPrivateKey implements Statement {
@Override
public Iterable<String> functionDependencies(OsFamily family) {
return Collections.emptyList();
return ImmutableList.of();
}
@Override

View File

@ -27,6 +27,7 @@ import java.util.Collections;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
/**
@ -37,7 +38,7 @@ public class SwitchArgTest {
public void testSwitchArgUNIX() {
assertEquals(new SwitchArg(1, ImmutableMap.of("0", newStatementList(appendFile(
"{tmp}{fs}{uid}{fs}scripttest{fs}temp.txt", Collections.singleton("hello world")),
"{tmp}{fs}{uid}{fs}scripttest{fs}temp.txt", ImmutableList.of("hello world")),
interpret("echo hello zero{lf}")), "1", interpret("echo hello one{lf}"))).render(OsFamily.UNIX),
"case $1 in\n"+
"0)\n"+