mirror of https://github.com/apache/jclouds.git
Issue 108
git-svn-id: http://jclouds.googlecode.com/svn/trunk@1942 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
a1ca5773c7
commit
e95e8f3429
|
@ -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<BlobMetadata> implements
|
||||
public class TreeSetListBlobsResponse extends BoundedTreeSet<BlobMetadata> implements
|
||||
ListBlobsResponse {
|
||||
/** The serialVersionUID */
|
||||
private static final long serialVersionUID = -4475709781001190244L;
|
||||
|
@ -43,9 +43,9 @@ public class ArrayListBlobsResponse extends BoundedTreeSet<BlobMetadata> 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<BlobMetadata> 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<BlobMetadata> impleme
|
|||
return true;
|
||||
}
|
||||
|
||||
public ArrayListBlobsResponse(URI containerUrl, List<BlobMetadata> contents, String prefix,
|
||||
String marker, int maxResults, String nextMarker, String delimiter, String blobPrefix) {
|
||||
public TreeSetListBlobsResponse(URI containerUrl, SortedSet<BlobMetadata> 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;
|
|
@ -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<BoundedSortedSet<ContainerMetadata>> {
|
||||
|
||||
private List<ContainerMetadata> containerMetadata = new ArrayList<ContainerMetadata>();
|
||||
private SortedSet<ContainerMetadata> containerMetadata = Sets.newTreeSet();
|
||||
private String prefix;
|
||||
private String marker;
|
||||
private int maxResults;
|
||||
|
|
|
@ -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<ListBlobsResponse> {
|
||||
|
||||
private List<BlobMetadata> blobMetadata = new ArrayList<BlobMetadata>();
|
||||
private SortedSet<BlobMetadata> 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<ContainerMetadata, BlobMet
|
|||
}
|
||||
}));
|
||||
|
||||
return new ArrayListBlobsResponse(URI.create("http://localhost"), Lists
|
||||
.newArrayList(contents), null, null, 5000, null, null, null);
|
||||
return new TreeSetListBlobsResponse(URI.create("http://localhost"), contents, null,
|
||||
null, 5000, null, null, null);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -29,15 +29,15 @@ import java.io.InputStream;
|
|||
import java.net.URI;
|
||||
|
||||
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.BaseHandlerTest;
|
||||
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 ParseFlavorListFromGsonResponseTest}
|
||||
|
@ -60,9 +60,9 @@ public class AccountNameEnumerationResultsHandlerTest extends BaseHandlerTest {
|
|||
@SuppressWarnings("unchecked")
|
||||
public void testApplyInputStream() {
|
||||
InputStream is = getClass().getResourceAsStream("/test_list_containers.xml");
|
||||
BoundedSortedSet<ContainerMetadata> list = new BoundedTreeSet<ContainerMetadata>(ImmutableList
|
||||
.of(new ContainerMetadata(
|
||||
URI.create("http://myaccount.blob.core.windows.net/audio"), dateService
|
||||
BoundedSortedSet<ContainerMetadata> list = new BoundedTreeSet<ContainerMetadata>(
|
||||
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
|
||||
|
@ -74,8 +74,8 @@ public class AccountNameEnumerationResultsHandlerTest extends BaseHandlerTest {
|
|||
|
||||
), null, null, 3, "video");
|
||||
|
||||
BoundedSortedSet<ContainerMetadata> result = (BoundedSortedSet<ContainerMetadata>) factory.create(
|
||||
injector.getInstance(AccountNameEnumerationResultsHandler.class)).parse(is);
|
||||
BoundedSortedSet<ContainerMetadata> result = (BoundedSortedSet<ContainerMetadata>) factory
|
||||
.create(injector.getInstance(AccountNameEnumerationResultsHandler.class)).parse(is);
|
||||
|
||||
assertEquals(result, list);
|
||||
}
|
||||
|
@ -83,9 +83,9 @@ public class AccountNameEnumerationResultsHandlerTest extends BaseHandlerTest {
|
|||
@SuppressWarnings("unchecked")
|
||||
public void testApplyInputStreamWithOptions() {
|
||||
InputStream is = getClass().getResourceAsStream("/test_list_containers_options.xml");
|
||||
BoundedSortedSet<ContainerMetadata> list = new BoundedTreeSet<ContainerMetadata>(ImmutableList
|
||||
.of(new ContainerMetadata(
|
||||
URI.create("http://myaccount.blob.core.windows.net/audio"), dateService
|
||||
BoundedSortedSet<ContainerMetadata> list = new BoundedTreeSet<ContainerMetadata>(
|
||||
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
|
||||
|
@ -96,8 +96,8 @@ public class AccountNameEnumerationResultsHandlerTest extends BaseHandlerTest {
|
|||
.fromHexString("0x8CACB9BD7BACAC3"))
|
||||
|
||||
), "prefix", "marker", 1, "video");
|
||||
BoundedSortedSet<ContainerMetadata> result = (BoundedSortedSet<ContainerMetadata>) factory.create(
|
||||
injector.getInstance(AccountNameEnumerationResultsHandler.class)).parse(is);
|
||||
BoundedSortedSet<ContainerMetadata> result = (BoundedSortedSet<ContainerMetadata>) factory
|
||||
.create(injector.getInstance(AccountNameEnumerationResultsHandler.class)).parse(is);
|
||||
assertEquals(result, list);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,27 +60,40 @@ 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
|
||||
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,
|
||||
dateService
|
||||
.rfc822DateParse("Thu, 18 Sep 2008 18:41:57 GMT"),
|
||||
HttpUtils.fromHexString("0x8CAE7D55D050B8B"), 8,
|
||||
"text/plain; charset=UTF-8", null, null, null),
|
||||
new BlobMetadata("newblob1.txt", URI
|
||||
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,
|
||||
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<ListBlobsResponse> result = (BoundedSortedSet<ListBlobsResponse>) factory.create(
|
||||
injector.getInstance(ContainerNameEnumerationResultsHandler.class)).parse(is);
|
||||
BoundedSortedSet<ListBlobsResponse> result = (BoundedSortedSet<ListBlobsResponse>) factory
|
||||
.create(injector.getInstance(ContainerNameEnumerationResultsHandler.class))
|
||||
.parse(is);
|
||||
|
||||
assertEquals(result, list);
|
||||
}
|
||||
|
|
|
@ -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<T> extends org.jclouds.rest.BoundedTreeSet<T> implem
|
|||
+ maxResults + ", prefix=" + prefix + "]";
|
||||
}
|
||||
|
||||
public BoundedTreeSet(List<T> contents, String prefix, String marker, int maxResults,
|
||||
public BoundedTreeSet(SortedSet<T> contents, String prefix, String marker, int maxResults,
|
||||
String nextMarker) {
|
||||
super(contents, prefix, marker, maxResults);
|
||||
this.nextMarker = nextMarker;
|
||||
|
|
|
@ -30,7 +30,7 @@ import java.net.URI;
|
|||
* @author Adrian Cole
|
||||
*
|
||||
*/
|
||||
public class QueueMetadata {
|
||||
public class QueueMetadata implements Comparable<QueueMetadata> {
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
* <p/>
|
||||
|
@ -45,7 +45,7 @@ import javax.inject.Inject;
|
|||
public class AccountNameEnumerationResultsHandler extends
|
||||
ParseSax.HandlerWithResult<BoundedSortedSet<QueueMetadata>> {
|
||||
|
||||
private List<QueueMetadata> metadata = new ArrayList<QueueMetadata>();
|
||||
private SortedSet<QueueMetadata> metadata = new TreeSet<QueueMetadata>();
|
||||
private String prefix;
|
||||
private String marker;
|
||||
private int maxResults;
|
||||
|
|
|
@ -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<QueueMetadata> list = new BoundedTreeSet<QueueMetadata>(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<QueueMetadata> list = new BoundedTreeSet<QueueMetadata>(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<QueueMetadata> result = (BoundedSortedSet<QueueMetadata>) 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<QueueMetadata> list = new BoundedTreeSet<QueueMetadata>(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<QueueMetadata> list = new BoundedTreeSet<QueueMetadata>(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<QueueMetadata> result = (BoundedSortedSet<QueueMetadata>) factory.create(
|
||||
injector.getInstance(AccountNameEnumerationResultsHandler.class)).parse(is);
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
*/
|
||||
package org.jclouds.rest;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
public class BoundedTreeSet<T> extends TreeSet<T> implements BoundedSortedSet<T> {
|
||||
|
@ -34,7 +34,7 @@ public class BoundedTreeSet<T> extends TreeSet<T> implements BoundedSortedSet<T>
|
|||
protected final String marker;
|
||||
protected final int maxResults;
|
||||
|
||||
public BoundedTreeSet(List<T> contents, String prefix, String marker, int maxResults) {
|
||||
public BoundedTreeSet(SortedSet<T> contents, String prefix, String marker, int maxResults) {
|
||||
this.addAll(contents);
|
||||
this.prefix = prefix;
|
||||
this.marker = marker;
|
||||
|
|
Loading…
Reference in New Issue