From e95e8f3429c2dfdce0fef61387e5deb785625ea9 Mon Sep 17 00:00:00 2001 From: "adrian.f.cole" Date: Sat, 3 Oct 2009 22:33:10 +0000 Subject: [PATCH] Issue 108 git-svn-id: http://jclouds.googlecode.com/svn/trunk@1942 3d8758e0-26b5-11de-8745-db77d3ebf521 --- ...nse.java => TreeSetListBlobsResponse.java} | 17 +++--- .../AccountNameEnumerationResultsHandler.java | 11 ++-- ...ontainerNameEnumerationResultsHandler.java | 13 ++-- .../blob/internal/StubAzureBlobStore.java | 7 +-- ...ountNameEnumerationResultsHandlerTest.java | 32 +++++----- ...inerNameEnumerationResultsHandlerTest.java | 59 +++++++++++-------- .../azure/storage/domain/BoundedTreeSet.java | 4 +- .../storage/queue/domain/QueueMetadata.java | 5 +- .../AccountNameEnumerationResultsHandler.java | 16 ++--- ...ountNameEnumerationResultsHandlerTest.java | 29 +++++---- .../java/org/jclouds/rest/BoundedTreeSet.java | 4 +- 11 files changed, 111 insertions(+), 86 deletions(-) rename azure/storage/blob/core/src/main/java/org/jclouds/azure/storage/blob/domain/{ArrayListBlobsResponse.java => TreeSetListBlobsResponse.java} (81%) diff --git a/azure/storage/blob/core/src/main/java/org/jclouds/azure/storage/blob/domain/ArrayListBlobsResponse.java b/azure/storage/blob/core/src/main/java/org/jclouds/azure/storage/blob/domain/TreeSetListBlobsResponse.java similarity index 81% rename from azure/storage/blob/core/src/main/java/org/jclouds/azure/storage/blob/domain/ArrayListBlobsResponse.java rename to azure/storage/blob/core/src/main/java/org/jclouds/azure/storage/blob/domain/TreeSetListBlobsResponse.java index f331cb7f98..d270a7cc82 100644 --- a/azure/storage/blob/core/src/main/java/org/jclouds/azure/storage/blob/domain/ArrayListBlobsResponse.java +++ b/azure/storage/blob/core/src/main/java/org/jclouds/azure/storage/blob/domain/TreeSetListBlobsResponse.java @@ -24,7 +24,7 @@ package org.jclouds.azure.storage.blob.domain; import java.net.URI; -import java.util.List; +import java.util.SortedSet; import org.jclouds.azure.storage.domain.BoundedTreeSet; @@ -33,7 +33,7 @@ import org.jclouds.azure.storage.domain.BoundedTreeSet; * @author Adrian Cole * */ -public class ArrayListBlobsResponse extends BoundedTreeSet implements +public class TreeSetListBlobsResponse extends BoundedTreeSet implements ListBlobsResponse { /** The serialVersionUID */ private static final long serialVersionUID = -4475709781001190244L; @@ -43,9 +43,9 @@ public class ArrayListBlobsResponse extends BoundedTreeSet impleme @Override public String toString() { - return "ArrayListBlobsResponse [blobPrefix=" + blobPrefix + ", containerUrl=" + containerUrl - + ", delimiter=" + delimiter + ", nextMarker=" + nextMarker + ", marker=" + marker - + ", maxResults=" + maxResults + ", prefix=" + prefix + "]"; + return "TreeSetListBlobsResponse [blobPrefix=" + blobPrefix + ", containerUrl=" + + containerUrl + ", delimiter=" + delimiter + ", nextMarker=" + nextMarker + + ", marker=" + marker + ", maxResults=" + maxResults + ", prefix=" + prefix + "]"; } @Override @@ -66,7 +66,7 @@ public class ArrayListBlobsResponse extends BoundedTreeSet impleme return false; if (getClass() != obj.getClass()) return false; - ArrayListBlobsResponse other = (ArrayListBlobsResponse) obj; + TreeSetListBlobsResponse other = (TreeSetListBlobsResponse) obj; if (blobPrefix == null) { if (other.blobPrefix != null) return false; @@ -85,8 +85,9 @@ public class ArrayListBlobsResponse extends BoundedTreeSet impleme return true; } - public ArrayListBlobsResponse(URI containerUrl, List contents, String prefix, - String marker, int maxResults, String nextMarker, String delimiter, String blobPrefix) { + public TreeSetListBlobsResponse(URI containerUrl, SortedSet contents, + String prefix, String marker, int maxResults, String nextMarker, String delimiter, + String blobPrefix) { super(contents, prefix, marker, maxResults, nextMarker); this.containerUrl = containerUrl; this.delimiter = delimiter; diff --git a/azure/storage/blob/core/src/main/java/org/jclouds/azure/storage/blob/xml/AccountNameEnumerationResultsHandler.java b/azure/storage/blob/core/src/main/java/org/jclouds/azure/storage/blob/xml/AccountNameEnumerationResultsHandler.java index 3c2336b6fd..27ce42bb00 100755 --- a/azure/storage/blob/core/src/main/java/org/jclouds/azure/storage/blob/xml/AccountNameEnumerationResultsHandler.java +++ b/azure/storage/blob/core/src/main/java/org/jclouds/azure/storage/blob/xml/AccountNameEnumerationResultsHandler.java @@ -24,18 +24,19 @@ package org.jclouds.azure.storage.blob.xml; import java.net.URI; -import java.util.ArrayList; -import java.util.List; +import java.util.SortedSet; + +import javax.inject.Inject; import org.jclouds.azure.storage.blob.domain.ContainerMetadata; -import org.jclouds.azure.storage.domain.BoundedTreeSet; import org.jclouds.azure.storage.domain.BoundedSortedSet; +import org.jclouds.azure.storage.domain.BoundedTreeSet; import org.jclouds.http.HttpUtils; import org.jclouds.http.functions.ParseSax; import org.jclouds.util.DateService; import org.joda.time.DateTime; -import javax.inject.Inject; +import com.google.common.collect.Sets; /** * Parses the following XML document: @@ -48,7 +49,7 @@ import javax.inject.Inject; public class AccountNameEnumerationResultsHandler extends ParseSax.HandlerWithResult> { - private List containerMetadata = new ArrayList(); + private SortedSet containerMetadata = Sets.newTreeSet(); private String prefix; private String marker; private int maxResults; diff --git a/azure/storage/blob/core/src/main/java/org/jclouds/azure/storage/blob/xml/ContainerNameEnumerationResultsHandler.java b/azure/storage/blob/core/src/main/java/org/jclouds/azure/storage/blob/xml/ContainerNameEnumerationResultsHandler.java index 2561abeb30..8d6d2306a8 100644 --- a/azure/storage/blob/core/src/main/java/org/jclouds/azure/storage/blob/xml/ContainerNameEnumerationResultsHandler.java +++ b/azure/storage/blob/core/src/main/java/org/jclouds/azure/storage/blob/xml/ContainerNameEnumerationResultsHandler.java @@ -24,12 +24,13 @@ package org.jclouds.azure.storage.blob.xml; import java.net.URI; -import java.util.ArrayList; -import java.util.List; +import java.util.SortedSet; + +import javax.inject.Inject; -import org.jclouds.azure.storage.blob.domain.ArrayListBlobsResponse; import org.jclouds.azure.storage.blob.domain.BlobMetadata; import org.jclouds.azure.storage.blob.domain.ListBlobsResponse; +import org.jclouds.azure.storage.blob.domain.TreeSetListBlobsResponse; import org.jclouds.http.HttpUtils; import org.jclouds.http.functions.ParseSax; import org.jclouds.util.DateService; @@ -37,7 +38,7 @@ import org.joda.time.DateTime; import org.xml.sax.Attributes; import org.xml.sax.SAXException; -import javax.inject.Inject; +import com.google.common.collect.Sets; /** * Parses the following XML document: @@ -50,7 +51,7 @@ import javax.inject.Inject; public class ContainerNameEnumerationResultsHandler extends ParseSax.HandlerWithResult { - private List blobMetadata = new ArrayList(); + private SortedSet blobMetadata = Sets.newTreeSet(); private String prefix; private String marker; private int maxResults; @@ -79,7 +80,7 @@ public class ContainerNameEnumerationResultsHandler extends } public ListBlobsResponse getResult() { - return new ArrayListBlobsResponse(containerUrl, blobMetadata, prefix, marker, maxResults, + return new TreeSetListBlobsResponse(containerUrl, blobMetadata, prefix, marker, maxResults, nextMarker, delimiter, blobPrefix); } diff --git a/azure/storage/blob/core/src/test/java/org/jclouds/azure/storage/blob/internal/StubAzureBlobStore.java b/azure/storage/blob/core/src/test/java/org/jclouds/azure/storage/blob/internal/StubAzureBlobStore.java index d8f1f8f808..21ce72884a 100644 --- a/azure/storage/blob/core/src/test/java/org/jclouds/azure/storage/blob/internal/StubAzureBlobStore.java +++ b/azure/storage/blob/core/src/test/java/org/jclouds/azure/storage/blob/internal/StubAzureBlobStore.java @@ -33,11 +33,11 @@ import javax.inject.Inject; import javax.inject.Provider; import org.jclouds.azure.storage.blob.AzureBlobStore; -import org.jclouds.azure.storage.blob.domain.ArrayListBlobsResponse; import org.jclouds.azure.storage.blob.domain.Blob; import org.jclouds.azure.storage.blob.domain.BlobMetadata; import org.jclouds.azure.storage.blob.domain.ContainerMetadata; import org.jclouds.azure.storage.blob.domain.ListBlobsResponse; +import org.jclouds.azure.storage.blob.domain.TreeSetListBlobsResponse; import org.jclouds.azure.storage.blob.options.CreateContainerOptions; import org.jclouds.azure.storage.domain.BoundedSortedSet; import org.jclouds.azure.storage.options.CreateOptions; @@ -48,7 +48,6 @@ import org.jclouds.util.DateService; import com.google.common.base.Function; import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; import com.google.common.collect.Sets; /** @@ -104,8 +103,8 @@ public class StubAzureBlobStore extends StubBlobStore list = new BoundedTreeSet(ImmutableList - .of(new ContainerMetadata( - URI.create("http://myaccount.blob.core.windows.net/audio"), dateService - .rfc822DateParse("Wed, 13 Aug 2008 20:39:39 GMT"), HttpUtils - .fromHexString("0x8CACB9BD7C6B1B2")), new ContainerMetadata(URI + BoundedSortedSet list = new BoundedTreeSet( + ImmutableSortedSet.of(new ContainerMetadata(URI + .create("http://myaccount.blob.core.windows.net/audio"), dateService + .rfc822DateParse("Wed, 13 Aug 2008 20:39:39 GMT"), HttpUtils + .fromHexString("0x8CACB9BD7C6B1B2")), new ContainerMetadata(URI .create("http://myaccount.blob.core.windows.net/images"), dateService .rfc822DateParse("Wed, 14 Aug 2008 20:39:39 GMT"), HttpUtils .fromHexString("0x8CACB9BD7C1EEEC")), new ContainerMetadata(URI @@ -74,8 +74,8 @@ public class AccountNameEnumerationResultsHandlerTest extends BaseHandlerTest { ), null, null, 3, "video"); - BoundedSortedSet result = (BoundedSortedSet) factory.create( - injector.getInstance(AccountNameEnumerationResultsHandler.class)).parse(is); + BoundedSortedSet result = (BoundedSortedSet) factory + .create(injector.getInstance(AccountNameEnumerationResultsHandler.class)).parse(is); assertEquals(result, list); } @@ -83,11 +83,11 @@ public class AccountNameEnumerationResultsHandlerTest extends BaseHandlerTest { @SuppressWarnings("unchecked") public void testApplyInputStreamWithOptions() { InputStream is = getClass().getResourceAsStream("/test_list_containers_options.xml"); - BoundedSortedSet list = new BoundedTreeSet(ImmutableList - .of(new ContainerMetadata( - URI.create("http://myaccount.blob.core.windows.net/audio"), dateService - .rfc822DateParse("Wed, 13 Aug 2008 20:39:39 GMT"), HttpUtils - .fromHexString("0x8CACB9BD7C6B1B2")), new ContainerMetadata(URI + BoundedSortedSet list = new BoundedTreeSet( + ImmutableSortedSet.of(new ContainerMetadata(URI + .create("http://myaccount.blob.core.windows.net/audio"), dateService + .rfc822DateParse("Wed, 13 Aug 2008 20:39:39 GMT"), HttpUtils + .fromHexString("0x8CACB9BD7C6B1B2")), new ContainerMetadata(URI .create("http://myaccount.blob.core.windows.net/images"), dateService .rfc822DateParse("Wed, 14 Aug 2008 20:39:39 GMT"), HttpUtils .fromHexString("0x8CACB9BD7C1EEEC")), new ContainerMetadata(URI @@ -96,8 +96,8 @@ public class AccountNameEnumerationResultsHandlerTest extends BaseHandlerTest { .fromHexString("0x8CACB9BD7BACAC3")) ), "prefix", "marker", 1, "video"); - BoundedSortedSet result = (BoundedSortedSet) factory.create( - injector.getInstance(AccountNameEnumerationResultsHandler.class)).parse(is); + BoundedSortedSet result = (BoundedSortedSet) factory + .create(injector.getInstance(AccountNameEnumerationResultsHandler.class)).parse(is); assertEquals(result, list); } } diff --git a/azure/storage/blob/core/src/test/java/org/jclouds/azure/storage/blob/xml/ContainerNameEnumerationResultsHandlerTest.java b/azure/storage/blob/core/src/test/java/org/jclouds/azure/storage/blob/xml/ContainerNameEnumerationResultsHandlerTest.java index 3eaf599cfa..6c90833727 100644 --- a/azure/storage/blob/core/src/test/java/org/jclouds/azure/storage/blob/xml/ContainerNameEnumerationResultsHandlerTest.java +++ b/azure/storage/blob/core/src/test/java/org/jclouds/azure/storage/blob/xml/ContainerNameEnumerationResultsHandlerTest.java @@ -28,9 +28,9 @@ import static org.testng.Assert.assertEquals; import java.io.InputStream; import java.net.URI; -import org.jclouds.azure.storage.blob.domain.ArrayListBlobsResponse; import org.jclouds.azure.storage.blob.domain.BlobMetadata; import org.jclouds.azure.storage.blob.domain.ListBlobsResponse; +import org.jclouds.azure.storage.blob.domain.TreeSetListBlobsResponse; import org.jclouds.azure.storage.domain.BoundedSortedSet; import org.jclouds.http.HttpUtils; import org.jclouds.http.functions.BaseHandlerTest; @@ -38,7 +38,7 @@ import org.jclouds.util.DateService; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; -import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSortedSet; /** * Tests behavior of {@code ContainerNameEnumerationResultsHandlerTest} @@ -60,28 +60,41 @@ public class ContainerNameEnumerationResultsHandlerTest extends BaseHandlerTest @SuppressWarnings("unchecked") public void testApplyInputStream() { InputStream is = getClass().getResourceAsStream("/test_list_blobs.xml"); - ListBlobsResponse list = new ArrayListBlobsResponse(URI - .create("http://myaccount.blob.core.windows.net/mycontainer"), ImmutableList.of( - new BlobMetadata("blob1.txt", URI - .create("http://myaccount.blob.core.windows.net/mycontainer/blob1.txt"), - dateService.rfc822DateParse("Thu, 18 Sep 2008 18:41:57 GMT"), HttpUtils - .fromHexString("0x8CAE7D55D050B8B"), 8, - "text/plain; charset=UTF-8", null, null, null), new BlobMetadata("blob2.txt", URI - .create("http://myaccount.blob.core.windows.net/mycontainer/blob2.txt"), - dateService.rfc822DateParse("Thu, 18 Sep 2008 18:41:57 GMT"), HttpUtils - .fromHexString("0x8CAE7D55CF6C339"), 14, - "text/plain; charset=UTF-8", null, null, null), - new BlobMetadata("newblob1.txt", URI - .create("http://myaccount.blob.core.windows.net/mycontainer/newblob1.txt"), - dateService.rfc822DateParse("Thu, 18 Sep 2008 18:41:57 GMT"), HttpUtils - .fromHexString("0x8CAE7D55CF6C339"), 25, - "text/plain; charset=UTF-8", null, null, null) + ListBlobsResponse list = new TreeSetListBlobsResponse( + URI.create("http://myaccount.blob.core.windows.net/mycontainer"), + ImmutableSortedSet + .of( + new BlobMetadata( + "blob1.txt", + URI + .create("http://myaccount.blob.core.windows.net/mycontainer/blob1.txt"), + dateService + .rfc822DateParse("Thu, 18 Sep 2008 18:41:57 GMT"), + HttpUtils.fromHexString("0x8CAE7D55D050B8B"), 8, + "text/plain; charset=UTF-8", null, null, null), + new BlobMetadata( + "blob2.txt", + URI + .create("http://myaccount.blob.core.windows.net/mycontainer/blob2.txt"), + dateService + .rfc822DateParse("Thu, 18 Sep 2008 18:41:57 GMT"), + HttpUtils.fromHexString("0x8CAE7D55CF6C339"), 14, + "text/plain; charset=UTF-8", null, null, null), + new BlobMetadata( + "newblob1.txt", + URI + .create("http://myaccount.blob.core.windows.net/mycontainer/newblob1.txt"), + dateService + .rfc822DateParse("Thu, 18 Sep 2008 18:41:57 GMT"), + HttpUtils.fromHexString("0x8CAE7D55CF6C339"), 25, + "text/plain; charset=UTF-8", null, null, null) + + ), null, null, 4, "newblob2.txt", null, "myfolder/"); + + BoundedSortedSet result = (BoundedSortedSet) factory + .create(injector.getInstance(ContainerNameEnumerationResultsHandler.class)) + .parse(is); - ), null, null, 4, "newblob2.txt", null, "myfolder/"); - - BoundedSortedSet result = (BoundedSortedSet) factory.create( - injector.getInstance(ContainerNameEnumerationResultsHandler.class)).parse(is); - assertEquals(result, list); } } diff --git a/azure/storage/core/src/main/java/org/jclouds/azure/storage/domain/BoundedTreeSet.java b/azure/storage/core/src/main/java/org/jclouds/azure/storage/domain/BoundedTreeSet.java index 3182fb17b3..b0a170d97c 100644 --- a/azure/storage/core/src/main/java/org/jclouds/azure/storage/domain/BoundedTreeSet.java +++ b/azure/storage/core/src/main/java/org/jclouds/azure/storage/domain/BoundedTreeSet.java @@ -23,7 +23,7 @@ */ package org.jclouds.azure.storage.domain; -import java.util.List; +import java.util.SortedSet; /** * @@ -68,7 +68,7 @@ public class BoundedTreeSet extends org.jclouds.rest.BoundedTreeSet implem + maxResults + ", prefix=" + prefix + "]"; } - public BoundedTreeSet(List contents, String prefix, String marker, int maxResults, + public BoundedTreeSet(SortedSet contents, String prefix, String marker, int maxResults, String nextMarker) { super(contents, prefix, marker, maxResults); this.nextMarker = nextMarker; diff --git a/azure/storage/queue/core/src/main/java/org/jclouds/azure/storage/queue/domain/QueueMetadata.java b/azure/storage/queue/core/src/main/java/org/jclouds/azure/storage/queue/domain/QueueMetadata.java index adf4436693..10699baada 100755 --- a/azure/storage/queue/core/src/main/java/org/jclouds/azure/storage/queue/domain/QueueMetadata.java +++ b/azure/storage/queue/core/src/main/java/org/jclouds/azure/storage/queue/domain/QueueMetadata.java @@ -30,7 +30,7 @@ import java.net.URI; * @author Adrian Cole * */ -public class QueueMetadata { +public class QueueMetadata implements Comparable { private final String name; private final URI url; @@ -83,4 +83,7 @@ public class QueueMetadata { return url; } + public int compareTo(QueueMetadata o) { + return (this == o) ? 0 : getName().compareTo(o.getName()); + } } diff --git a/azure/storage/queue/core/src/main/java/org/jclouds/azure/storage/queue/xml/AccountNameEnumerationResultsHandler.java b/azure/storage/queue/core/src/main/java/org/jclouds/azure/storage/queue/xml/AccountNameEnumerationResultsHandler.java index d5305d1d15..8bc1d2a5b1 100755 --- a/azure/storage/queue/core/src/main/java/org/jclouds/azure/storage/queue/xml/AccountNameEnumerationResultsHandler.java +++ b/azure/storage/queue/core/src/main/java/org/jclouds/azure/storage/queue/xml/AccountNameEnumerationResultsHandler.java @@ -24,16 +24,16 @@ package org.jclouds.azure.storage.queue.xml; import java.net.URI; -import java.util.ArrayList; -import java.util.List; - -import org.jclouds.azure.storage.domain.BoundedTreeSet; -import org.jclouds.azure.storage.domain.BoundedSortedSet; -import org.jclouds.azure.storage.queue.domain.QueueMetadata; -import org.jclouds.http.functions.ParseSax; +import java.util.SortedSet; +import java.util.TreeSet; import javax.inject.Inject; +import org.jclouds.azure.storage.domain.BoundedSortedSet; +import org.jclouds.azure.storage.domain.BoundedTreeSet; +import org.jclouds.azure.storage.queue.domain.QueueMetadata; +import org.jclouds.http.functions.ParseSax; + /** * Parses the following XML document: *

@@ -45,7 +45,7 @@ import javax.inject.Inject; public class AccountNameEnumerationResultsHandler extends ParseSax.HandlerWithResult> { - private List metadata = new ArrayList(); + private SortedSet metadata = new TreeSet(); private String prefix; private String marker; private int maxResults; diff --git a/azure/storage/queue/core/src/test/java/org/jclouds/azure/storage/queue/xml/AccountNameEnumerationResultsHandlerTest.java b/azure/storage/queue/core/src/test/java/org/jclouds/azure/storage/queue/xml/AccountNameEnumerationResultsHandlerTest.java index 6a7fc6e070..f7be790598 100644 --- a/azure/storage/queue/core/src/test/java/org/jclouds/azure/storage/queue/xml/AccountNameEnumerationResultsHandlerTest.java +++ b/azure/storage/queue/core/src/test/java/org/jclouds/azure/storage/queue/xml/AccountNameEnumerationResultsHandlerTest.java @@ -28,13 +28,13 @@ import static org.testng.Assert.assertEquals; import java.io.InputStream; import java.net.URI; -import org.jclouds.azure.storage.domain.BoundedTreeSet; import org.jclouds.azure.storage.domain.BoundedSortedSet; +import org.jclouds.azure.storage.domain.BoundedTreeSet; import org.jclouds.azure.storage.queue.domain.QueueMetadata; import org.jclouds.http.functions.BaseHandlerTest; import org.testng.annotations.Test; -import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSortedSet; /** * Tests behavior of {@code ParseFlavorListFromGsonResponseTest} @@ -47,11 +47,15 @@ public class AccountNameEnumerationResultsHandlerTest extends BaseHandlerTest { @SuppressWarnings("unchecked") public void testApplyInputStream() { InputStream is = getClass().getResourceAsStream("/test_list_queues.xml"); - BoundedSortedSet list = new BoundedTreeSet(ImmutableList.of( - new QueueMetadata("q1", URI.create("http://myaccount.queue.core.windows.net/q1")), - new QueueMetadata("q2", URI.create("http://myaccount.queue.core.windows.net/q2")), - new QueueMetadata("q3", URI.create("http://myaccount.queue.core.windows.net/q3"))), - "q", null, 3, "q4"); + BoundedSortedSet list = new BoundedTreeSet(ImmutableSortedSet + .of( + new QueueMetadata("q1", URI + .create("http://myaccount.queue.core.windows.net/q1")), + new QueueMetadata("q2", URI + .create("http://myaccount.queue.core.windows.net/q2")), + new QueueMetadata("q3", URI + .create("http://myaccount.queue.core.windows.net/q3"))), "q", + null, 3, "q4"); BoundedSortedSet result = (BoundedSortedSet) factory.create( injector.getInstance(AccountNameEnumerationResultsHandler.class)).parse(is); assertEquals(result, list); @@ -60,10 +64,13 @@ public class AccountNameEnumerationResultsHandlerTest extends BaseHandlerTest { @SuppressWarnings("unchecked") public void testApplyInputStreamWithOptions() { InputStream is = getClass().getResourceAsStream("/test_list_queues_options.xml"); - BoundedSortedSet list = new BoundedTreeSet(ImmutableList.of( - new QueueMetadata("q4", URI.create("http://myaccount.queue.core.windows.net/q4")), - new QueueMetadata("q5", URI.create("http://myaccount.queue.core.windows.net/q5"))), - "q", "q4", 3, null); + BoundedSortedSet list = new BoundedTreeSet(ImmutableSortedSet + .of( + new QueueMetadata("q4", URI + .create("http://myaccount.queue.core.windows.net/q4")), + new QueueMetadata("q5", URI + .create("http://myaccount.queue.core.windows.net/q5"))), "q", + "q4", 3, null); BoundedSortedSet result = (BoundedSortedSet) factory.create( injector.getInstance(AccountNameEnumerationResultsHandler.class)).parse(is); diff --git a/core/src/main/java/org/jclouds/rest/BoundedTreeSet.java b/core/src/main/java/org/jclouds/rest/BoundedTreeSet.java index e91dc21a5d..e686de97db 100644 --- a/core/src/main/java/org/jclouds/rest/BoundedTreeSet.java +++ b/core/src/main/java/org/jclouds/rest/BoundedTreeSet.java @@ -23,7 +23,7 @@ */ package org.jclouds.rest; -import java.util.List; +import java.util.SortedSet; import java.util.TreeSet; public class BoundedTreeSet extends TreeSet implements BoundedSortedSet { @@ -34,7 +34,7 @@ public class BoundedTreeSet extends TreeSet implements BoundedSortedSet protected final String marker; protected final int maxResults; - public BoundedTreeSet(List contents, String prefix, String marker, int maxResults) { + public BoundedTreeSet(SortedSet contents, String prefix, String marker, int maxResults) { this.addAll(contents); this.prefix = prefix; this.marker = marker;