From 99ba4498eca6d75787f329d43f827e6e9b3813b8 Mon Sep 17 00:00:00 2001 From: "adrian.f.cole" Date: Mon, 9 Nov 2009 03:27:10 +0000 Subject: [PATCH] changed to Linked Lists so that unit tests are predictable across JDKs git-svn-id: http://jclouds.googlecode.com/svn/trunk@2234 3d8758e0-26b5-11de-8745-db77d3ebf521 --- .../atmosonline/saas/domain/internal/AtmosObjectImpl.java | 4 ++-- .../azure/storage/blob/domain/internal/AzureBlobImpl.java | 4 ++-- .../jclouds/azure/storage/blob/AzureBlobClientLiveTest.java | 2 +- .../java/org/jclouds/blobstore/domain/internal/BlobImpl.java | 4 ++-- .../org/jclouds/mezeo/pcs2/domain/internal/PCSFileImpl.java | 4 ++-- .../nirvanix/sdn/binders/BindMetadataToQueryParams.java | 3 +-- .../nirvanix/sdn/filters/AddSessionTokenToRequest.java | 2 +- .../nirvanix/sdn/binders/BindMetadataToQueryParamsTest.java | 2 +- .../rackspace/cloudfiles/domain/internal/CFObjectImpl.java | 4 ++-- 9 files changed, 14 insertions(+), 15 deletions(-) diff --git a/atmosonline/saas/core/src/main/java/org/jclouds/atmosonline/saas/domain/internal/AtmosObjectImpl.java b/atmosonline/saas/core/src/main/java/org/jclouds/atmosonline/saas/domain/internal/AtmosObjectImpl.java index ba0b14f6cf..df97caf112 100644 --- a/atmosonline/saas/core/src/main/java/org/jclouds/atmosonline/saas/domain/internal/AtmosObjectImpl.java +++ b/atmosonline/saas/core/src/main/java/org/jclouds/atmosonline/saas/domain/internal/AtmosObjectImpl.java @@ -37,7 +37,7 @@ import org.jclouds.blobstore.functions.CalculateSize; import org.jclouds.blobstore.functions.GenerateMD5; import org.jclouds.blobstore.functions.GenerateMD5Result; -import com.google.common.collect.HashMultimap; +import com.google.common.collect.LinkedHashMultimap; import com.google.common.collect.Multimap; /** @@ -54,7 +54,7 @@ public class AtmosObjectImpl implements AtmosObject, Comparable { private final SystemMetadata systemMetadata; private Object data; - private Multimap allHeaders = HashMultimap.create(); + private Multimap allHeaders = LinkedHashMultimap.create(); public AtmosObjectImpl(GenerateMD5Result generateMD5Result, GenerateMD5 generateMD5, CalculateSize calculateSize, MutableContentMetadata contentMetadata) { diff --git a/azure/storage/blob/core/src/main/java/org/jclouds/azure/storage/blob/domain/internal/AzureBlobImpl.java b/azure/storage/blob/core/src/main/java/org/jclouds/azure/storage/blob/domain/internal/AzureBlobImpl.java index fb5d86c088..d824ee683e 100644 --- a/azure/storage/blob/core/src/main/java/org/jclouds/azure/storage/blob/domain/internal/AzureBlobImpl.java +++ b/azure/storage/blob/core/src/main/java/org/jclouds/azure/storage/blob/domain/internal/AzureBlobImpl.java @@ -37,7 +37,7 @@ import org.jclouds.blobstore.functions.CalculateSize; import org.jclouds.blobstore.functions.GenerateMD5; import org.jclouds.blobstore.functions.GenerateMD5Result; -import com.google.common.collect.HashMultimap; +import com.google.common.collect.LinkedHashMultimap; import com.google.common.collect.Multimap; /** @@ -51,7 +51,7 @@ public class AzureBlobImpl implements AzureBlob, Comparable { private final CalculateSize calculateSize; private final MutableBlobProperties properties; private Object data; - private Multimap allHeaders = HashMultimap.create(); + private Multimap allHeaders = LinkedHashMultimap.create(); private Long contentLength; @Inject diff --git a/azure/storage/blob/core/src/test/java/org/jclouds/azure/storage/blob/AzureBlobClientLiveTest.java b/azure/storage/blob/core/src/test/java/org/jclouds/azure/storage/blob/AzureBlobClientLiveTest.java index eb5e21ead0..63d7a3a9c6 100644 --- a/azure/storage/blob/core/src/test/java/org/jclouds/azure/storage/blob/AzureBlobClientLiveTest.java +++ b/azure/storage/blob/core/src/test/java/org/jclouds/azure/storage/blob/AzureBlobClientLiveTest.java @@ -277,7 +277,7 @@ public class AzureBlobClientLiveTest { assertEquals(metadata.getMetadata().get("metadata"), "metadata-value"); // // Test POST to update object's metadata - // Multimap userMetadata = HashMultimap.create(); + // Multimap userMetadata = LinkedHashMultimap.create(); // userMetadata.put("New-Metadata-1", "value-1"); // userMetadata.put("New-Metadata-2", "value-2"); // assertTrue(connection.setBlobProperties(privateContainer, object.getProperties().getName(), diff --git a/blobstore/core/src/main/java/org/jclouds/blobstore/domain/internal/BlobImpl.java b/blobstore/core/src/main/java/org/jclouds/blobstore/domain/internal/BlobImpl.java index 9b8922c477..38315401e9 100644 --- a/blobstore/core/src/main/java/org/jclouds/blobstore/domain/internal/BlobImpl.java +++ b/blobstore/core/src/main/java/org/jclouds/blobstore/domain/internal/BlobImpl.java @@ -38,7 +38,7 @@ import org.jclouds.blobstore.functions.CalculateSize; import org.jclouds.blobstore.functions.GenerateMD5; import org.jclouds.blobstore.functions.GenerateMD5Result; -import com.google.common.collect.HashMultimap; +import com.google.common.collect.LinkedHashMultimap; import com.google.common.collect.Multimap; /** @@ -55,7 +55,7 @@ public class BlobImpl implements Blob, Comparable { private final CalculateSize calculateSize; private final MutableBlobMetadata metadata; private Object data; - private Multimap allHeaders = HashMultimap.create(); + private Multimap allHeaders = LinkedHashMultimap.create(); private Long contentLength; @Inject diff --git a/mezeo/pcs2/core/src/main/java/org/jclouds/mezeo/pcs2/domain/internal/PCSFileImpl.java b/mezeo/pcs2/core/src/main/java/org/jclouds/mezeo/pcs2/domain/internal/PCSFileImpl.java index 312a376520..21fc1c4f2e 100644 --- a/mezeo/pcs2/core/src/main/java/org/jclouds/mezeo/pcs2/domain/internal/PCSFileImpl.java +++ b/mezeo/pcs2/core/src/main/java/org/jclouds/mezeo/pcs2/domain/internal/PCSFileImpl.java @@ -31,7 +31,7 @@ import org.jclouds.blobstore.functions.CalculateSize; import org.jclouds.mezeo.pcs2.domain.MutableFileInfo; import org.jclouds.mezeo.pcs2.domain.PCSFile; -import com.google.common.collect.HashMultimap; +import com.google.common.collect.LinkedHashMultimap; import com.google.common.collect.Multimap; /** @@ -44,7 +44,7 @@ public class PCSFileImpl implements PCSFile, Comparable { private final CalculateSize calculateSize; private final MutableFileInfo metadata; private Object data; - private Multimap allHeaders = HashMultimap.create(); + private Multimap allHeaders = LinkedHashMultimap.create(); private Long contentLength; @Inject diff --git a/nirvanix/sdn/core/src/main/java/org/jclouds/nirvanix/sdn/binders/BindMetadataToQueryParams.java b/nirvanix/sdn/core/src/main/java/org/jclouds/nirvanix/sdn/binders/BindMetadataToQueryParams.java index d61300875f..a58df0245a 100644 --- a/nirvanix/sdn/core/src/main/java/org/jclouds/nirvanix/sdn/binders/BindMetadataToQueryParams.java +++ b/nirvanix/sdn/core/src/main/java/org/jclouds/nirvanix/sdn/binders/BindMetadataToQueryParams.java @@ -49,7 +49,6 @@ public class BindMetadataToQueryParams implements Binder { for (Entry entry : userMetadata.entrySet()) { metadata.add(String.format("%s:%s", entry.getKey().toLowerCase(), entry.getValue())); } - ((GeneratedHttpRequest) request).replaceQueryParam("metadata", metadata.toArray()); + ((GeneratedHttpRequest) request).addQueryParam("metadata", metadata.toArray(new String[] {})); } - } diff --git a/nirvanix/sdn/core/src/main/java/org/jclouds/nirvanix/sdn/filters/AddSessionTokenToRequest.java b/nirvanix/sdn/core/src/main/java/org/jclouds/nirvanix/sdn/filters/AddSessionTokenToRequest.java index 46185ea1c2..c8af135340 100644 --- a/nirvanix/sdn/core/src/main/java/org/jclouds/nirvanix/sdn/filters/AddSessionTokenToRequest.java +++ b/nirvanix/sdn/core/src/main/java/org/jclouds/nirvanix/sdn/filters/AddSessionTokenToRequest.java @@ -93,7 +93,7 @@ public class AddSessionTokenToRequest implements HttpRequestFilter { public void filter(HttpRequest request) throws HttpException { checkArgument(checkNotNull(request, "input") instanceof GeneratedHttpRequest, "this decorator is only valid for GeneratedHttpRequests!"); - ((GeneratedHttpRequest) request).replaceQueryParam(SDNQueryParams.SESSIONTOKEN, + ((GeneratedHttpRequest) request).addQueryParam(SDNQueryParams.SESSIONTOKEN, getSessionToken()); } diff --git a/nirvanix/sdn/core/src/test/java/org/jclouds/nirvanix/sdn/binders/BindMetadataToQueryParamsTest.java b/nirvanix/sdn/core/src/test/java/org/jclouds/nirvanix/sdn/binders/BindMetadataToQueryParamsTest.java index e8b392c69a..72a28e786e 100644 --- a/nirvanix/sdn/core/src/test/java/org/jclouds/nirvanix/sdn/binders/BindMetadataToQueryParamsTest.java +++ b/nirvanix/sdn/core/src/test/java/org/jclouds/nirvanix/sdn/binders/BindMetadataToQueryParamsTest.java @@ -62,7 +62,7 @@ public class BindMetadataToQueryParamsTest { BindMetadataToQueryParams binder = new BindMetadataToQueryParams(); GeneratedHttpRequest request = createMock(GeneratedHttpRequest.class); - request.replaceQueryParam("metadata", "imagename:foo", "serverid:2"); + request.addQueryParam("metadata", "imagename:foo", "serverid:2"); replay(request); binder.bindToRequest(request, ImmutableMap.of("imageName", "foo", "serverId", "2")); } diff --git a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/domain/internal/CFObjectImpl.java b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/domain/internal/CFObjectImpl.java index 192cc7e7b0..39887ce977 100644 --- a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/domain/internal/CFObjectImpl.java +++ b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/domain/internal/CFObjectImpl.java @@ -37,7 +37,7 @@ import org.jclouds.blobstore.functions.GenerateMD5Result; import org.jclouds.rackspace.cloudfiles.domain.CFObject; import org.jclouds.rackspace.cloudfiles.domain.MutableObjectInfoWithMetadata; -import com.google.common.collect.HashMultimap; +import com.google.common.collect.LinkedHashMultimap; import com.google.common.collect.Multimap; /** @@ -51,7 +51,7 @@ public class CFObjectImpl implements CFObject, Comparable { private final CalculateSize calculateSize; private final MutableObjectInfoWithMetadata info; private Object data; - private Multimap allHeaders = HashMultimap.create(); + private Multimap allHeaders = LinkedHashMultimap.create(); private Long contentLength; @Inject