You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by za...@apache.org on 2014/03/03 22:38:45 UTC
[3/5] JCLOUDS-423 - Adds support for Rackspace Cloud Files API - Added support for CloudFilesApi/CDNApi - Added mock/live tests - Refactored listFirstPage() and listAt() API methods to list() and listWithOptions(…) - General Swift API cleanup: docs and t
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/43aa5b3a/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/ObjectApiLiveTest.java
----------------------------------------------------------------------
diff --git a/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/ObjectApiLiveTest.java b/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/ObjectApiLiveTest.java
index 4559983..db835fd 100644
--- a/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/ObjectApiLiveTest.java
+++ b/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/ObjectApiLiveTest.java
@@ -35,6 +35,7 @@ import org.jclouds.http.options.GetOptions;
import org.jclouds.io.Payload;
import org.jclouds.io.Payloads;
import org.jclouds.openstack.swift.v1.CopyObjectException;
+import org.jclouds.openstack.swift.v1.SwiftApi;
import org.jclouds.openstack.swift.v1.domain.ObjectList;
import org.jclouds.openstack.swift.v1.domain.SwiftObject;
import org.jclouds.openstack.swift.v1.internal.BaseSwiftApiLiveTest;
@@ -48,18 +49,22 @@ import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap;
/**
+ * Provides live tests for the {@link ObjectApi}.
+ *
* @author Adrian Cole
+ * @author Jeremy Daggett
*/
-@Test(groups = "live", testName = "ObjectApiLiveTest")
-public class ObjectApiLiveTest extends BaseSwiftApiLiveTest {
+@Test(groups = "live", testName = "ObjectApiLiveTest", singleThreaded = true)
+public class ObjectApiLiveTest extends BaseSwiftApiLiveTest<SwiftApi> {
+
private String name = getClass().getSimpleName();
private String containerName = getClass().getSimpleName() + "Container";
- public void copyObject() throws Exception {
- for (String regionId : regions) {
+ public void testCopyObject() throws Exception {
+ for (String regionId : regions) {
// source
String sourceContainer = "src" + containerName;
- String sourceObject = "original.txt";
+ String sourceObjectName = "original.txt";
String badSource = "badSource";
// destination
@@ -81,29 +86,29 @@ public class ObjectApiLiveTest extends BaseSwiftApiLiveTest {
ObjectApi destApi = api.objectApiInRegionForContainer(regionId, destinationContainer);
// Create source object
- assertNotNull(srcApi.replace(sourceObject, data, ImmutableMap.<String, String> of()));
- SwiftObject object = srcApi.get(sourceObject, GetOptions.NONE);
- checkObject(object);
+ assertNotNull(srcApi.replace(sourceObjectName, data, ImmutableMap.<String, String> of()));
+ SwiftObject sourceObject = srcApi.get(sourceObjectName, GetOptions.NONE);
+ checkObject(sourceObject);
// Create the destination object
assertNotNull(destApi.replace(destinationObject, data, ImmutableMap.<String, String> of()));
- object = destApi.get(destinationObject, GetOptions.NONE);
- checkObject(destApi.get(destinationObject, GetOptions.NONE));
+ SwiftObject object = destApi.get(destinationObject, GetOptions.NONE);
+ checkObject(object);
// check the copy operation
- assertTrue(destApi.copy(destinationObject, sourceContainer, sourceObject));
+ assertTrue(destApi.copy(destinationObject, sourceContainer, sourceObjectName));
assertNotNull(destApi.head(destinationObject));
// now get a real SwiftObject
SwiftObject destSwiftObject = destApi.get(destinationObject, GetOptions.NONE);
- assertEquals(Strings2.toString(destSwiftObject.payload()), stringPayload);
+ assertEquals(Strings2.toString(destSwiftObject.getPayload()), stringPayload);
// test exception thrown on bad source name
try {
- destApi.copy(destinationObject, badSource, sourceObject);
+ destApi.copy(destinationObject, badSource, sourceObjectName);
fail("Expected CopyObjectException");
- } catch (CopyObjectException e) {
- assertEquals(e.getSourcePath(), "/" + badSource + "/" + sourceObject);
+ } catch (CopyObjectException e) {
+ assertEquals(e.getSourcePath(), "/" + badSource + "/" + sourceObjectName);
assertEquals(e.getDestinationPath(), destinationPath);
}
@@ -115,11 +120,11 @@ public class ObjectApiLiveTest extends BaseSwiftApiLiveTest {
}
}
- public void list() throws Exception {
+ public void testList() throws Exception {
for (String regionId : regions) {
ObjectApi objectApi = api.objectApiInRegionForContainer(regionId, containerName);
- ObjectList response = objectApi.list(new ListContainerOptions());
- assertEquals(response.container(), api.containerApiInRegion(regionId).get(containerName));
+ ObjectList response = objectApi.list(ListContainerOptions.NONE);
+ assertEquals(response.getContainer(), api.containerApiInRegion(regionId).get(containerName));
assertNotNull(response);
for (SwiftObject object : response) {
checkObject(object);
@@ -127,97 +132,81 @@ public class ObjectApiLiveTest extends BaseSwiftApiLiveTest {
}
}
- static void checkObject(SwiftObject object) {
- assertNotNull(object.name());
- assertNotNull(object.uri());
- assertNotNull(object.etag());
- assertTrue(object.lastModified().getTime() <= System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(5));
- assertNotNull(object.payload().getContentMetadata().getContentLength());
- assertNotNull(object.payload().getContentMetadata().getContentType());
- }
-
- public void metadata() throws Exception {
+ public void testMetadata() throws Exception {
for (String regionId : regions) {
SwiftObject object = api.objectApiInRegionForContainer(regionId, containerName).head(name);
- assertEquals(object.name(), name);
+ assertEquals(object.getName(), name);
checkObject(object);
- assertEquals(toStringAndClose(object.payload().getInput()), "");
+ assertEquals(toStringAndClose(object.getPayload().getInput()), "");
}
}
- public void get() throws Exception {
+ public void testUpdateMetadata() throws Exception {
+ for (String regionId : regions) {
+ ObjectApi objectApi = api.objectApiInRegionForContainer(regionId, containerName);
+
+ Map<String, String> meta = ImmutableMap.of("MyAdd1", "foo", "MyAdd2", "bar");
+ assertTrue(objectApi.updateMetadata(name, meta));
+
+ SwiftObject object = objectApi.head(name);
+ for (Entry<String, String> entry : meta.entrySet()) {
+ // note keys are returned in lower-case!
+ assertEquals(object.getMetadata().get(entry.getKey().toLowerCase()), entry.getValue(),
+ object + " didn't have metadata: " + entry);
+ }
+ }
+ }
+
+ public void testGet() throws Exception {
for (String regionId : regions) {
SwiftObject object = api.objectApiInRegionForContainer(regionId, containerName).get(name, GetOptions.NONE);
- assertEquals(object.name(), name);
+ assertEquals(object.getName(), name);
checkObject(object);
- assertEquals(toStringAndClose(object.payload().getInput()), "swifty");
+ assertEquals(toStringAndClose(object.getPayload().getInput()), "swifty");
}
}
- public void privateByDefault() throws Exception {
+ public void testPrivateByDefault() throws Exception {
for (String regionId : regions) {
SwiftObject object = api.objectApiInRegionForContainer(regionId, containerName).head(name);
try {
- object.uri().toURL().openStream();
+ object.getUri().toURL().openStream();
fail("shouldn't be able to access " + object);
} catch (IOException expected) {
}
}
}
- public void getOptions() throws Exception {
+ public void testGetOptions() throws Exception {
for (String regionId : regions) {
SwiftObject object = api.objectApiInRegionForContainer(regionId, containerName).get(name, tail(1));
- assertEquals(object.name(), name);
+ assertEquals(object.getName(), name);
checkObject(object);
- assertEquals(toStringAndClose(object.payload().getInput()), "y");
+ assertEquals(toStringAndClose(object.getPayload().getInput()), "y");
}
}
- public void listOptions() throws Exception {
+ public void testListOptions() throws Exception {
String lexicographicallyBeforeName = name.substring(0, name.length() - 1);
for (String regionId : regions) {
SwiftObject object = api.objectApiInRegionForContainer(regionId, containerName)
.list(marker(lexicographicallyBeforeName)).get(0);
- assertEquals(object.name(), name);
+ assertEquals(object.getName(), name);
checkObject(object);
}
}
- public void updateMetadata() throws Exception {
- for (String regionId : regions) {
- ObjectApi objectApi = api.objectApiInRegionForContainer(regionId, containerName);
-
- Map<String, String> meta = ImmutableMap.of("MyAdd1", "foo", "MyAdd2", "bar");
- assertTrue(objectApi.updateMetadata(name, meta));
- containerHasMetadata(objectApi, name, meta);
- }
- }
-
- public void deleteMetadata() throws Exception {
+ public void testDeleteMetadata() throws Exception {
for (String regionId : regions) {
ObjectApi objectApi = api.objectApiInRegionForContainer(regionId, containerName);
Map<String, String> meta = ImmutableMap.of("MyDelete1", "foo", "MyDelete2", "bar");
-
+
assertTrue(objectApi.updateMetadata(name, meta));
- containerHasMetadata(objectApi, name, meta);
-
+ assertFalse(objectApi.head(name).getMetadata().isEmpty());
+
assertTrue(objectApi.deleteMetadata(name, meta));
- SwiftObject object = objectApi.head(name);
- for (Entry<String, String> entry : meta.entrySet()) {
- // note keys are returned in lower-case!
- assertFalse(object.metadata().containsKey(entry.getKey().toLowerCase()));
- }
- }
- }
-
- static void containerHasMetadata(ObjectApi objectApi, String name, Map<String, String> meta) {
- SwiftObject object = objectApi.head(name);
- for (Entry<String, String> entry : meta.entrySet()) {
- // note keys are returned in lower-case!
- assertEquals(object.metadata().get(entry.getKey().toLowerCase()), entry.getValue(), //
- object + " didn't have metadata: " + entry);
+ assertTrue(objectApi.head(name).getMetadata().isEmpty());
}
}
@@ -240,6 +229,16 @@ public class ObjectApiLiveTest extends BaseSwiftApiLiveTest {
api.objectApiInRegionForContainer(regionId, containerName).delete(name);
api.containerApiInRegion(regionId).deleteIfEmpty(containerName);
}
+
super.tearDown();
}
+
+ static void checkObject(SwiftObject object) {
+ assertNotNull(object.getName());
+ assertNotNull(object.getUri());
+ assertNotNull(object.getEtag());
+ assertTrue(object.getLastModified().getTime() <= System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(5));
+ assertNotNull(object.getPayload().getContentMetadata().getContentLength());
+ assertNotNull(object.getPayload().getContentMetadata().getContentType());
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/43aa5b3a/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/ObjectApiMockTest.java
----------------------------------------------------------------------
diff --git a/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/ObjectApiMockTest.java b/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/ObjectApiMockTest.java
index 7ceb21a..d44e308 100644
--- a/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/ObjectApiMockTest.java
+++ b/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/ObjectApiMockTest.java
@@ -22,7 +22,10 @@ import static org.jclouds.http.options.GetOptions.Builder.tail;
import static org.jclouds.io.Payloads.newStringPayload;
import static org.jclouds.openstack.swift.v1.features.ContainerApiMockTest.containerResponse;
import static org.jclouds.openstack.swift.v1.options.ListContainerOptions.Builder.marker;
-import static org.jclouds.openstack.swift.v1.reference.SwiftHeaders.OBJECT_COPY_FROM;
+import static org.jclouds.openstack.swift.v1.reference.SwiftHeaders.CONTAINER_ACL_ANYBODY_READ;
+import static org.jclouds.openstack.swift.v1.reference.SwiftHeaders.CONTAINER_READ;
+import static org.jclouds.openstack.swift.v1.reference.SwiftHeaders.OBJECT_METADATA_PREFIX;
+import static org.jclouds.openstack.swift.v1.reference.SwiftHeaders.OBJECT_REMOVE_METADATA_PREFIX;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
@@ -31,12 +34,6 @@ import java.net.URI;
import java.util.Map;
import java.util.Map.Entry;
-import javax.inject.Named;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-
-import org.jclouds.blobstore.BlobStoreFallbacks.FalseOnContainerNotFound;
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.io.Payload;
import org.jclouds.io.Payloads;
@@ -47,8 +44,6 @@ import org.jclouds.openstack.swift.v1.domain.SwiftObject;
import org.jclouds.openstack.swift.v1.options.ListContainerOptions;
import org.jclouds.openstack.swift.v1.reference.SwiftHeaders;
import org.jclouds.openstack.v2_0.internal.BaseOpenStackMockTest;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.Headers;
import org.jclouds.util.Strings2;
import org.testng.annotations.Test;
@@ -58,68 +53,59 @@ import com.squareup.okhttp.mockwebserver.MockResponse;
import com.squareup.okhttp.mockwebserver.MockWebServer;
import com.squareup.okhttp.mockwebserver.RecordedRequest;
-@Test
+/**
+ * Provides mock tests for the {@link ObjectApi}.
+ *
+ * @author Adrian Cole
+ * @author Jeremy Daggett
+ */
+@Test(groups = "unit", testName = "ObjectApiMockTest")
public class ObjectApiMockTest extends BaseOpenStackMockTest<SwiftApi> {
SimpleDateFormatDateService dates = new SimpleDateFormatDateService();
- String objectList = "" //
- + "[\n" //
- + " {\"name\":\"test_obj_1\",\n" //
- + " \"hash\":\"4281c348eaf83e70ddce0e07221c3d28\",\n" //
- + " \"bytes\":14,\n" //
- + " \"content_type\":\"application\\/octet-stream\",\n" //
- + " \"last_modified\":\"2009-02-03T05:26:32.612278\"},\n" //
- + " {\"name\":\"test_obj_2\",\n" //
- + " \"hash\":\"b039efe731ad111bc1b0ef221c3849d0\",\n" //
- + " \"bytes\":64,\n" //
- + " \"content_type\":\"application\\/octet-stream\",\n" //
- + " \"last_modified\":\"2009-02-03T05:26:32.612278\"},\n" //
- + "]";
-
protected ImmutableList<SwiftObject> parsedObjectsForUrl(String baseUri) {
baseUri += "v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/myContainer";
- return ImmutableList.of(//
- SwiftObject.builder() //
- .name("test_obj_1") //
- .uri(URI.create(baseUri + "/test_obj_1")) //
- .etag("4281c348eaf83e70ddce0e07221c3d28") //
- .payload(payload(14, "application/octet-stream")) //
- .lastModified(dates.iso8601DateParse("2009-02-03T05:26:32.612278")).build(), //
- SwiftObject.builder() //
- .name("test_obj_2") //
- .uri(URI.create(baseUri + "/test_obj_2")) //
- .etag("b039efe731ad111bc1b0ef221c3849d0") //
- .payload(payload(64l, "application/octet-stream")) //
+ return ImmutableList.of(
+ SwiftObject.builder()
+ .name("test_obj_1")
+ .uri(URI.create(baseUri + "/test_obj_1"))
+ .etag("4281c348eaf83e70ddce0e07221c3d28")
+ .payload(payload(14, "application/octet-stream"))
+ .lastModified(dates.iso8601DateParse("2009-02-03T05:26:32.612278")).build(),
+ SwiftObject.builder()
+ .name("test_obj_2")
+ .uri(URI.create(baseUri + "/test_obj_2"))
+ .etag("b039efe731ad111bc1b0ef221c3849d0")
+ .payload(payload(64l, "application/octet-stream"))
.lastModified(dates.iso8601DateParse("2009-02-03T05:26:32.612278")).build());
}
- public void list() throws Exception {
+ public void testList() throws Exception {
MockWebServer server = mockOpenStackServer();
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
- server.enqueue(addCommonHeaders(containerResponse() //
- .addHeader("X-Container-Read", ".r:*,.rlistings") //
- .setBody(objectList)));
+ server.enqueue(addCommonHeaders(containerResponse()
+ .addHeader(CONTAINER_READ, CONTAINER_ACL_ANYBODY_READ)
+ .setBody(stringFromResource("/object_list.json"))));
try {
SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
ObjectList objects = api.objectApiInRegionForContainer("DFW", "myContainer").list(new ListContainerOptions());
assertEquals(objects, parsedObjectsForUrl(server.getUrl("/").toString()));
- assertEquals(objects.container().name(), "myContainer");
- assertTrue(objects.container().anybodyRead().get());
+ assertEquals(objects.getContainer().getName(), "myContainer");
+ assertTrue(objects.getContainer().getAnybodyRead().get());
assertEquals(server.getRequestCount(), 2);
- assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1");
- assertEquals(server.takeRequest().getRequestLine(),
- "GET /v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/myContainer/?format=json HTTP/1.1");
+ assertAuthentication(server);
+ assertRequest(server.takeRequest(), "GET", "/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/myContainer/?format=json");
} finally {
server.shutdown();
}
}
- public void listOptions() throws Exception {
+ public void testListOptions() throws Exception {
MockWebServer server = mockOpenStackServer();
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
- server.enqueue(addCommonHeaders(containerResponse().setBody(objectList)));
+ server.enqueue(addCommonHeaders(containerResponse().setBody(stringFromResource("/object_list.json"))));
try {
SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
@@ -127,19 +113,18 @@ public class ObjectApiMockTest extends BaseOpenStackMockTest<SwiftApi> {
assertEquals(objects, parsedObjectsForUrl(server.getUrl("/").toString()));
assertEquals(server.getRequestCount(), 2);
- assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1");
- assertEquals(server.takeRequest().getRequestLine(),
- "GET /v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/myContainer/?format=json&marker=test HTTP/1.1");
+ assertAuthentication(server);
+ assertRequest(server.takeRequest(), "GET", "/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/myContainer/?format=json&marker=test");
} finally {
server.shutdown();
}
}
- public void replace() throws Exception {
+ public void testReplace() throws Exception {
MockWebServer server = mockOpenStackServer();
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
- server.enqueue(addCommonHeaders(new MockResponse() //
- .setResponseCode(201) //
+ server.enqueue(addCommonHeaders(new MockResponse()
+ .setResponseCode(201)
.addHeader("ETag", "d9f5eb4bba4e2f2f046e54611bc8196b")));
try {
@@ -149,13 +134,13 @@ public class ObjectApiMockTest extends BaseOpenStackMockTest<SwiftApi> {
newStringPayload("swifty"), metadata), "d9f5eb4bba4e2f2f046e54611bc8196b");
assertEquals(server.getRequestCount(), 2);
- assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1");
+ assertAuthentication(server);
RecordedRequest replace = server.takeRequest();
- assertEquals(replace.getRequestLine(),
- "PUT /v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/myContainer/myObject HTTP/1.1");
+ assertRequest(replace, "PUT", "/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/myContainer/myObject");
+
assertEquals(new String(replace.getBody()), "swifty");
for (Entry<String, String> entry : metadata.entrySet()) {
- assertEquals(replace.getHeader("x-object-meta-" + entry.getKey().toLowerCase()), entry.getValue());
+ assertEquals(replace.getHeader(OBJECT_METADATA_PREFIX + entry.getKey().toLowerCase()), entry.getValue());
}
} finally {
server.shutdown();
@@ -163,31 +148,30 @@ public class ObjectApiMockTest extends BaseOpenStackMockTest<SwiftApi> {
}
/** upper-cases first char, and lower-cases rest!! **/
- public void headKnowingServerMessesWithMetadataKeyCaseFormat() throws Exception {
+ public void testHeadKnowingServerMessesWithMetadataKeyCaseFormat() throws Exception {
MockWebServer server = mockOpenStackServer();
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
- server.enqueue(addCommonHeaders(objectResponse() //
+ server.enqueue(addCommonHeaders(objectResponse()
// note silly casing
- .addHeader("X-Object-Meta-Apiname", "swift") //
- .addHeader("X-Object-Meta-Apiversion", "v1.1")));
+ .addHeader(OBJECT_METADATA_PREFIX + "Apiname", "swift")
+ .addHeader(OBJECT_METADATA_PREFIX + "Apiversion", "v1.1")));
try {
SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
SwiftObject object = api.objectApiInRegionForContainer("DFW", "myContainer").head("myObject");
- assertEquals(object.name(), "myObject");
- assertEquals(object.etag(), "8a964ee2a5e88be344f36c22562a6486");
- assertEquals(object.lastModified(), dates.rfc822DateParse("Fri, 12 Jun 2010 13:40:18 GMT"));
- for (Entry<String, String> entry : object.metadata().entrySet()) {
- assertEquals(object.metadata().get(entry.getKey().toLowerCase()), entry.getValue());
+ assertEquals(object.getName(), "myObject");
+ assertEquals(object.getEtag(), "8a964ee2a5e88be344f36c22562a6486");
+ assertEquals(object.getLastModified(), dates.rfc822DateParse("Fri, 12 Jun 2010 13:40:18 GMT"));
+ for (Entry<String, String> entry : object.getMetadata().entrySet()) {
+ assertEquals(object.getMetadata().get(entry.getKey().toLowerCase()), entry.getValue());
}
- assertEquals(object.payload().getContentMetadata().getContentLength(), new Long(4));
- assertEquals(object.payload().getContentMetadata().getContentType(), "text/plain; charset=UTF-8");
- assertEquals(Strings2.toStringAndClose(object.payload().getInput()), "");
+ assertEquals(object.getPayload().getContentMetadata().getContentLength(), new Long(4));
+ assertEquals(object.getPayload().getContentMetadata().getContentType(), "text/plain; charset=UTF-8");
+ assertEquals(Strings2.toStringAndClose(object.getPayload().getInput()), "");
assertEquals(server.getRequestCount(), 2);
- assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1");
- assertEquals(server.takeRequest().getRequestLine(),
- "HEAD /v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/myContainer/myObject HTTP/1.1");
+ assertAuthentication(server);
+ assertRequest(server.takeRequest(), "HEAD", "/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/myContainer/myObject");
} finally {
server.shutdown();
}
@@ -196,24 +180,24 @@ public class ObjectApiMockTest extends BaseOpenStackMockTest<SwiftApi> {
public void get() throws Exception {
MockWebServer server = mockOpenStackServer();
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
- server.enqueue(addCommonHeaders(objectResponse() //
+ server.enqueue(addCommonHeaders(objectResponse()
// note silly casing
- .addHeader("X-Object-Meta-Apiname", "swift") //
- .addHeader("X-Object-Meta-Apiversion", "v1.1")));
+ .addHeader(OBJECT_METADATA_PREFIX + "Apiname", "swift")
+ .addHeader(OBJECT_METADATA_PREFIX + "Apiversion", "v1.1")));
try {
SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
SwiftObject object = api.objectApiInRegionForContainer("DFW", "myContainer").get("myObject", tail(1));
- assertEquals(object.name(), "myObject");
- assertEquals(object.etag(), "8a964ee2a5e88be344f36c22562a6486");
- assertEquals(object.lastModified(), dates.rfc822DateParse("Fri, 12 Jun 2010 13:40:18 GMT"));
- for (Entry<String, String> entry : object.metadata().entrySet()) {
- assertEquals(object.metadata().get(entry.getKey().toLowerCase()), entry.getValue());
+ assertEquals(object.getName(), "myObject");
+ assertEquals(object.getEtag(), "8a964ee2a5e88be344f36c22562a6486");
+ assertEquals(object.getLastModified(), dates.rfc822DateParse("Fri, 12 Jun 2010 13:40:18 GMT"));
+ for (Entry<String, String> entry : object.getMetadata().entrySet()) {
+ assertEquals(object.getMetadata().get(entry.getKey().toLowerCase()), entry.getValue());
}
- assertEquals(object.payload().getContentMetadata().getContentLength(), new Long(4));
- assertEquals(object.payload().getContentMetadata().getContentType(), "text/plain; charset=UTF-8");
+ assertEquals(object.getPayload().getContentMetadata().getContentLength(), new Long(4));
+ assertEquals(object.getPayload().getContentMetadata().getContentType(), "text/plain; charset=UTF-8");
// note MWS doesn't process Range header at the moment
- assertEquals(Strings2.toStringAndClose(object.payload().getInput()), "ABCD");
+ assertEquals(Strings2.toStringAndClose(object.getPayload().getInput()), "ABCD");
assertEquals(server.getRequestCount(), 2);
assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1");
@@ -229,9 +213,9 @@ public class ObjectApiMockTest extends BaseOpenStackMockTest<SwiftApi> {
public void updateMetadata() throws Exception {
MockWebServer server = mockOpenStackServer();
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
- server.enqueue(addCommonHeaders(objectResponse() //
- .addHeader("X-Object-Meta-ApiName", "swift") //
- .addHeader("X-Object-Meta-ApiVersion", "v1.1")));
+ server.enqueue(addCommonHeaders(objectResponse()
+ .addHeader(OBJECT_METADATA_PREFIX + "ApiName", "swift")
+ .addHeader(OBJECT_METADATA_PREFIX + "ApiVersion", "v1.1")));
try {
SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
@@ -243,7 +227,7 @@ public class ObjectApiMockTest extends BaseOpenStackMockTest<SwiftApi> {
assertEquals(replaceRequest.getRequestLine(),
"POST /v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/myContainer/myObject HTTP/1.1");
for (Entry<String, String> entry : metadata.entrySet()) {
- assertEquals(replaceRequest.getHeader("x-object-meta-" + entry.getKey().toLowerCase()), entry.getValue());
+ assertEquals(replaceRequest.getHeader(OBJECT_METADATA_PREFIX + entry.getKey().toLowerCase()), entry.getValue());
}
} finally {
server.shutdown();
@@ -265,7 +249,7 @@ public class ObjectApiMockTest extends BaseOpenStackMockTest<SwiftApi> {
assertEquals(deleteRequest.getRequestLine(),
"POST /v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/myContainer/myObject HTTP/1.1");
for (String key : metadata.keySet()) {
- assertEquals(deleteRequest.getHeader("x-remove-object-meta-" + key.toLowerCase()), "ignored");
+ assertEquals(deleteRequest.getHeader(OBJECT_REMOVE_METADATA_PREFIX + key.toLowerCase()), "ignored");
}
} finally {
server.shutdown();
@@ -350,12 +334,12 @@ public class ObjectApiMockTest extends BaseOpenStackMockTest<SwiftApi> {
private static final Map<String, String> metadata = ImmutableMap.of("ApiName", "swift", "ApiVersion", "v1.1");
public static MockResponse objectResponse() {
- return new MockResponse() //
- .addHeader("Last-Modified", "Fri, 12 Jun 2010 13:40:18 GMT") //
- .addHeader("ETag", "8a964ee2a5e88be344f36c22562a6486") //
+ return new MockResponse()
+ .addHeader("Last-Modified", "Fri, 12 Jun 2010 13:40:18 GMT")
+ .addHeader("ETag", "8a964ee2a5e88be344f36c22562a6486")
// TODO: MWS doesn't allow you to return content length w/o content
// on HEAD!
- .setBody("ABCD".getBytes(US_ASCII)) //
+ .setBody("ABCD".getBytes(US_ASCII))
.addHeader("Content-Length", "4").addHeader("Content-Type", "text/plain; charset=UTF-8");
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/43aa5b3a/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/StaticLargeObjectApiLiveTest.java
----------------------------------------------------------------------
diff --git a/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/StaticLargeObjectApiLiveTest.java b/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/StaticLargeObjectApiLiveTest.java
index eb08f76..aa6f434 100644
--- a/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/StaticLargeObjectApiLiveTest.java
+++ b/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/StaticLargeObjectApiLiveTest.java
@@ -19,12 +19,12 @@ package org.jclouds.openstack.swift.v1.features;
import static java.lang.String.format;
import static org.jclouds.io.Payloads.newPayload;
import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotEquals;
import static org.testng.Assert.assertNotNull;
import java.util.List;
import java.util.UUID;
+import org.jclouds.openstack.swift.v1.SwiftApi;
import org.jclouds.openstack.swift.v1.domain.Segment;
import org.jclouds.openstack.swift.v1.domain.SwiftObject;
import org.jclouds.openstack.swift.v1.internal.BaseSwiftApiLiveTest;
@@ -37,20 +37,20 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@Test(groups = "live", testName = "StaticLargeObjectApiLiveTest")
-public class StaticLargeObjectApiLiveTest extends BaseSwiftApiLiveTest {
+public class StaticLargeObjectApiLiveTest extends BaseSwiftApiLiveTest<SwiftApi> {
private String name = getClass().getSimpleName();
private String containerName = getClass().getSimpleName() + "Container";
private byte[] megOf1s;
private byte[] megOf2s;
- public void notPresentWhenDeleting() throws Exception {
+ public void testNotPresentWhenDeleting() throws Exception {
for (String regionId : regions) {
api.staticLargeObjectApiInRegionForContainer(regionId, containerName).delete(UUID.randomUUID().toString());
}
}
- public void replaceManifest() throws Exception {
+ public void testReplaceManifest() throws Exception {
for (String regionId : regions) {
ObjectApi objectApi = api.objectApiInRegionForContainer(regionId, containerName);
String etag1s = objectApi.replace(name + "/1", newPayload(megOf1s), ImmutableMap.<String, String> of());
@@ -74,23 +74,29 @@ public class StaticLargeObjectApiLiveTest extends BaseSwiftApiLiveTest {
assertNotNull(etagOfEtags);
SwiftObject bigObject = api.objectApiInRegionForContainer(regionId, containerName).head(name);
- assertNotEquals(bigObject.etag(), etagOfEtags);
- assertEquals(bigObject.payload().getContentMetadata().getContentLength(), new Long(2 * 1024 * 1024));
- assertEquals(bigObject.metadata(), ImmutableMap.of("myfoo", "Bar"));
+ assertEquals(bigObject.getEtag(), etagOfEtags);
+ assertEquals(bigObject.getPayload().getContentMetadata().getContentLength(), new Long(2 * 1024 * 1024));
+ assertEquals(bigObject.getMetadata(), ImmutableMap.of("myfoo", "Bar"));
// segments are visible
- assertEquals(api.containerApiInRegion(regionId).get(containerName).objectCount(), 3);
+ assertEquals(api.containerApiInRegion(regionId).get(containerName).getObjectCount(), 3);
}
}
- @Test(dependsOnMethods = "replaceManifest")
- public void delete() throws Exception {
+ @Test(dependsOnMethods = "testReplaceManifest")
+ public void testDelete() throws Exception {
for (String regionId : regions) {
api.staticLargeObjectApiInRegionForContainer(regionId, containerName).delete(name);
- assertEquals(api.containerApiInRegion(regionId).get(containerName).objectCount(), 0);
+ assertEquals(api.containerApiInRegion(regionId).get(containerName).getObjectCount(), 0);
}
}
+ protected void assertMegabyteAndETagMatches(String regionId, String name, String etag1s) {
+ SwiftObject object1s = api.objectApiInRegionForContainer(regionId, containerName).head(name);
+ assertEquals(object1s.getEtag(), etag1s);
+ assertEquals(object1s.getPayload().getContentMetadata().getContentLength(), new Long(1024 * 1024));
+ }
+
@Override
@BeforeClass(groups = "live")
public void setup() {
@@ -119,10 +125,4 @@ public class StaticLargeObjectApiLiveTest extends BaseSwiftApiLiveTest {
}
super.tearDown();
}
-
- protected void assertMegabyteAndETagMatches(String regionId, String name, String etag1s) {
- SwiftObject object1s = api.objectApiInRegionForContainer(regionId, containerName).head(name);
- assertEquals(object1s.etag(), etag1s);
- assertEquals(object1s.payload().getContentMetadata().getContentLength(), new Long(1024 * 1024));
- }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/43aa5b3a/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/StaticLargeObjectApiMockTest.java
----------------------------------------------------------------------
diff --git a/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/StaticLargeObjectApiMockTest.java b/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/StaticLargeObjectApiMockTest.java
index 4da10a9..a10c340 100644
--- a/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/StaticLargeObjectApiMockTest.java
+++ b/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/StaticLargeObjectApiMockTest.java
@@ -16,6 +16,7 @@
*/
package org.jclouds.openstack.swift.v1.features;
+import static org.jclouds.openstack.swift.v1.reference.SwiftHeaders.OBJECT_METADATA_PREFIX;
import static org.testng.Assert.assertEquals;
import org.jclouds.openstack.swift.v1.SwiftApi;
@@ -30,10 +31,10 @@ import com.squareup.okhttp.mockwebserver.MockResponse;
import com.squareup.okhttp.mockwebserver.MockWebServer;
import com.squareup.okhttp.mockwebserver.RecordedRequest;
-@Test
+@Test(groups = "unit", testName = "StaticLargeObjectApiMockTest")
public class StaticLargeObjectApiMockTest extends BaseOpenStackMockTest<SwiftApi> {
- public void replaceManifest() throws Exception {
+ public void testReplaceManifest() throws Exception {
MockWebServer server = mockOpenStackServer();
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
server.enqueue(addCommonHeaders(new MockResponse().addHeader(HttpHeaders.ETAG, "\"abcd\"")));
@@ -54,11 +55,11 @@ public class StaticLargeObjectApiMockTest extends BaseOpenStackMockTest<SwiftApi
ImmutableMap.of("MyFoo", "Bar")), "abcd");
assertEquals(server.getRequestCount(), 2);
- assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1");
+ assertAuthentication(server);
+
RecordedRequest replaceRequest = server.takeRequest();
- assertEquals(replaceRequest.getRequestLine(),
- "PUT /v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/myContainer/myObject?multipart-manifest=put HTTP/1.1");
- assertEquals(replaceRequest.getHeader("x-object-meta-myfoo"), "Bar");
+ assertRequest(replaceRequest, "PUT", "/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/myContainer/myObject?multipart-manifest=put");
+ assertEquals(replaceRequest.getHeader(OBJECT_METADATA_PREFIX + "myfoo"), "Bar");
assertEquals(
new String(replaceRequest.getBody()),
"[{\"path\":\"/mycontainer/objseg1\",\"etag\":\"0228c7926b8b642dfb29554cd1f00963\",\"size_bytes\":1468006}," +
@@ -69,7 +70,7 @@ public class StaticLargeObjectApiMockTest extends BaseOpenStackMockTest<SwiftApi
}
}
- public void delete() throws Exception {
+ public void testDelete() throws Exception {
MockWebServer server = mockOpenStackServer();
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(204)));
@@ -79,16 +80,15 @@ public class StaticLargeObjectApiMockTest extends BaseOpenStackMockTest<SwiftApi
api.staticLargeObjectApiInRegionForContainer("DFW", "myContainer").delete("myObject");
assertEquals(server.getRequestCount(), 2);
- assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1");
- RecordedRequest deleteRequest = server.takeRequest();
- assertEquals(deleteRequest.getRequestLine(),
- "DELETE /v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/myContainer/myObject?multipart-manifest=delete HTTP/1.1");
+ assertAuthentication(server);
+ assertRequest(server.takeRequest(), "DELETE", "/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/myContainer/myObject?multipart-manifest=delete");
+
} finally {
server.shutdown();
}
}
- public void alreadyDeleted() throws Exception {
+ public void testAlreadyDeleted() throws Exception {
MockWebServer server = mockOpenStackServer();
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(404)));
@@ -98,10 +98,8 @@ public class StaticLargeObjectApiMockTest extends BaseOpenStackMockTest<SwiftApi
api.staticLargeObjectApiInRegionForContainer("DFW", "myContainer").delete("myObject");
assertEquals(server.getRequestCount(), 2);
- assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1");
- RecordedRequest deleteRequest = server.takeRequest();
- assertEquals(deleteRequest.getRequestLine(),
- "DELETE /v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/myContainer/myObject?multipart-manifest=delete HTTP/1.1");
+ assertAuthentication(server);
+ assertRequest(server.takeRequest(), "DELETE", "/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/myContainer/myObject?multipart-manifest=delete");
} finally {
server.shutdown();
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/43aa5b3a/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/UrlEncodeAndJoinOnNewlineTest.java
----------------------------------------------------------------------
diff --git a/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/UrlEncodeAndJoinOnNewlineTest.java b/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/UrlEncodeAndJoinOnNewlineTest.java
index a45386b..c811571 100644
--- a/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/UrlEncodeAndJoinOnNewlineTest.java
+++ b/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/UrlEncodeAndJoinOnNewlineTest.java
@@ -24,7 +24,7 @@ import org.testng.annotations.Test;
import com.google.common.collect.ImmutableList;
-@Test
+@Test(groups = "unit", testName = "UrlEncodeAndJoinOnNewlineTest")
public class UrlEncodeAndJoinOnNewlineTest {
UrlEncodeAndJoinOnNewline binder = new UrlEncodeAndJoinOnNewline();
@@ -38,8 +38,7 @@ public class UrlEncodeAndJoinOnNewlineTest {
.add("/v1/12345678912345/mycontainer/home/xx<yy")
.add("/v1/12345678912345/mycontainer/../image.gif").build());
- assertEquals(request.getPayload().getRawContent(), "" //
- + "/v1/12345678912345/mycontainer/home/xx%3Cyy\n" //
+ assertEquals(request.getPayload().getRawContent(), "/v1/12345678912345/mycontainer/home/xx%3Cyy\n"
+ "/v1/12345678912345/mycontainer/../image.gif");
}
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/43aa5b3a/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/internal/BaseSwiftApiLiveTest.java
----------------------------------------------------------------------
diff --git a/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/internal/BaseSwiftApiLiveTest.java b/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/internal/BaseSwiftApiLiveTest.java
index 239177c..6be7907 100644
--- a/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/internal/BaseSwiftApiLiveTest.java
+++ b/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/internal/BaseSwiftApiLiveTest.java
@@ -21,6 +21,7 @@ import static com.google.common.base.Preconditions.checkState;
import java.util.List;
import java.util.Properties;
import java.util.Set;
+import java.util.concurrent.TimeUnit;
import org.jclouds.apis.BaseApiLiveTest;
import org.jclouds.location.reference.LocationConstants;
@@ -31,19 +32,22 @@ import org.jclouds.openstack.swift.v1.domain.ObjectList;
import org.jclouds.openstack.swift.v1.domain.SwiftObject;
import org.jclouds.openstack.swift.v1.options.ListContainerOptions;
import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
+import com.google.common.util.concurrent.Uninterruptibles;
-public class BaseSwiftApiLiveTest extends BaseApiLiveTest<SwiftApi> {
+@Test(groups = "live", testName = "BaseSwiftApiLiveTest")
+public abstract class BaseSwiftApiLiveTest<A extends SwiftApi> extends BaseApiLiveTest<A> {
protected Set<String> regions;
- public BaseSwiftApiLiveTest() {
+ protected BaseSwiftApiLiveTest() {
provider = "openstack-swift";
}
-
+
@Override
@BeforeClass(groups = "live")
public void setup() {
@@ -55,7 +59,7 @@ public class BaseSwiftApiLiveTest extends BaseApiLiveTest<SwiftApi> {
regions = api.configuredRegions();
}
}
-
+
@Override
protected Properties setupProperties() {
Properties props = super.setupProperties();
@@ -65,18 +69,20 @@ public class BaseSwiftApiLiveTest extends BaseApiLiveTest<SwiftApi> {
}
protected void deleteAllObjectsInContainer(String regionId, final String containerName) {
+ Uninterruptibles.sleepUninterruptibly(10, TimeUnit.SECONDS);
+
ObjectList objects = api.objectApiInRegionForContainer(regionId, containerName).list(new ListContainerOptions());
if (objects == null) {
return;
}
List<String> pathsToDelete = Lists.transform(objects, new Function<SwiftObject, String>() {
public String apply(SwiftObject input) {
- return containerName + "/" + input.name();
+ return containerName + "/" + input.getName();
}
});
if (!pathsToDelete.isEmpty()) {
BulkDeleteResponse response = api.bulkApiInRegion(regionId).bulkDelete(pathsToDelete);
- checkState(response.errors().isEmpty(), "Errors deleting paths %s: %s", pathsToDelete, response);
+ checkState(response.getErrors().isEmpty(), "Errors deleting paths %s: %s", pathsToDelete, response);
}
}
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/43aa5b3a/openstack-swift/src/test/resources/container_list.json
----------------------------------------------------------------------
diff --git a/openstack-swift/src/test/resources/container_list.json b/openstack-swift/src/test/resources/container_list.json
new file mode 100644
index 0000000..554f5de
--- /dev/null
+++ b/openstack-swift/src/test/resources/container_list.json
@@ -0,0 +1,12 @@
+[
+ {
+ "name": "test_container_1",
+ "count": 2,
+ "bytes": 78
+ },
+ {
+ "name": "test_container_2",
+ "count": 1,
+ "bytes": 17
+ }
+]
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/43aa5b3a/openstack-swift/src/test/resources/object_list.json
----------------------------------------------------------------------
diff --git a/openstack-swift/src/test/resources/object_list.json b/openstack-swift/src/test/resources/object_list.json
new file mode 100644
index 0000000..9cac144
--- /dev/null
+++ b/openstack-swift/src/test/resources/object_list.json
@@ -0,0 +1,16 @@
+[
+ {
+ "name": "test_obj_1",
+ "hash": "4281c348eaf83e70ddce0e07221c3d28",
+ "bytes": 14,
+ "content_type": "application/octet-stream",
+ "last_modified": "2009-02-03T05:26:32.612278"
+ },
+ {
+ "name": "test_obj_2",
+ "hash": "b039efe731ad111bc1b0ef221c3849d0",
+ "bytes": 64,
+ "content_type": "application/octet-stream",
+ "last_modified": "2009-02-03T05:26:32.612278"
+ }
+]
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/43aa5b3a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 1f900d6..b888796 100644
--- a/pom.xml
+++ b/pom.xml
@@ -63,6 +63,8 @@
<module>rackspace-cloudqueues-uk</module>
<module>rackspace-cloudbigdata</module>
<module>rackspace-cloudbigdata-us</module>
+ <module>rackspace-cloudfiles</module>
+ <module>rackspace-cloudfiles-us</module>
</modules>
<build>
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/43aa5b3a/rackspace-cloudfiles-us/README.md
----------------------------------------------------------------------
diff --git a/rackspace-cloudfiles-us/README.md b/rackspace-cloudfiles-us/README.md
new file mode 100644
index 0000000..25ded8c
--- /dev/null
+++ b/rackspace-cloudfiles-us/README.md
@@ -0,0 +1,20 @@
+Rackspace Cloud Files US
+========================
+
+The new Rackspace Cloud Files US multi-region based provider.
+
+This new "rackspace-cloudfiles-us" provider supercedes the jclouds "cloudfiles-us" provider, which will eventually be deprecated.
+
+With this multi-region support, each BlobStore can be isolated to a specific region:
+
+ RegionScopedBlobStoreContext ctx =
+ contextBuilder.buildView(RegionScopedBlobStoreContext.class);
+
+ Set<String> regionIds = ctx.configuredRegions();
+
+ // isolated to a specific region
+ BlobStore dfwBlobStore = ctx.blobStoreInRegion("DFW");
+ BlobStore iadBlobStore = ctx.blobStoreInRegion("IAD");
+
+Production ready?
+No
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/43aa5b3a/rackspace-cloudfiles-us/pom.xml
----------------------------------------------------------------------
diff --git a/rackspace-cloudfiles-us/pom.xml b/rackspace-cloudfiles-us/pom.xml
new file mode 100644
index 0000000..b882ed3
--- /dev/null
+++ b/rackspace-cloudfiles-us/pom.xml
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-project</artifactId>
+ <version>1.8.0-SNAPSHOT</version>
+ </parent>
+
+ <!-- TODO: when out of labs, switch to org.jclouds.provider -->
+ <groupId>org.apache.jclouds.labs</groupId>
+ <artifactId>rackspace-cloudfiles-us</artifactId>
+ <version>1.8.0-SNAPSHOT</version>
+ <name>jclouds Rackspace Cloud Files US provider</name>
+ <description>OpenStack Object Storage implementation targeted to Rackspace Cloud Files US</description>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <!-- identity endpoint -->
+ <test.rackspace-cloudfiles-us.endpoint>https://identity.api.rackspacecloud.com/v2.0/</test.rackspace-cloudfiles-us.endpoint>
+ <test.rackspace-cloudfiles-us.api-version>1</test.rackspace-cloudfiles-us.api-version>
+ <test.rackspace-cloudfiles-us.build-version />
+ <test.rackspace-cloudfiles-us.identity>${test.rackspace-us.identity}</test.rackspace-cloudfiles-us.identity>
+ <test.rackspace-cloudfiles-us.credential>${test.rackspace-us.credential}</test.rackspace-cloudfiles-us.credential>
+ <jclouds.osgi.export>org.jclouds.rackspace.cloudfiles.us*;version="${project.version}"</jclouds.osgi.export>
+ <jclouds.osgi.import>
+ org.jclouds.rest.internal;version="${jclouds.version}",
+ org.jclouds.labs*;version="${project.version}",
+ org.jclouds*;version="${jclouds.version}",
+ *
+ </jclouds.osgi.import>
+ </properties>
+
+ <repositories>
+ <repository>
+ <id>apache-snapshots</id>
+ <url>https://repository.apache.org/content/repositories/snapshots</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.jclouds.labs</groupId>
+ <artifactId>openstack-swift</artifactId>
+ <version>${project.parent.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.labs</groupId>
+ <artifactId>openstack-swift</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.labs</groupId>
+ <artifactId>rackspace-cloudfiles</artifactId>
+ <version>${project.parent.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.labs</groupId>
+ <artifactId>rackspace-cloudfiles</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.api</groupId>
+ <artifactId>openstack-keystone</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.api</groupId>
+ <artifactId>openstack-keystone</artifactId>
+ <version>${project.parent.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-blobstore</artifactId>
+ <version>${project.parent.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-core</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-core</artifactId>
+ <version>${project.parent.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-slf4j</artifactId>
+ <version>${project.parent.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.api</groupId>
+ <artifactId>rackspace-cloudidentity</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>live</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>integration</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <forkCount>5</forkCount>
+ <reuseForks>true</reuseForks>
+ <parallel>classes</parallel>
+ <systemPropertyVariables>
+ <test.rackspace-cloudfiles-us.endpoint>${test.rackspace-cloudfiles-us.endpoint}</test.rackspace-cloudfiles-us.endpoint>
+ <test.rackspace-cloudfiles-us.api-version>${test.rackspace-cloudfiles-us.api-version}</test.rackspace-cloudfiles-us.api-version>
+ <test.rackspace-cloudfiles-us.build-version>${test.rackspace-cloudfiles-us.build-version}</test.rackspace-cloudfiles-us.build-version>
+ <test.rackspace-cloudfiles-us.identity>${test.rackspace-cloudfiles-us.identity}</test.rackspace-cloudfiles-us.identity>
+ <test.rackspace-cloudfiles-us.credential>${test.rackspace-cloudfiles-us.credential}</test.rackspace-cloudfiles-us.credential>
+ <jclouds.blobstore.httpstream.url>${jclouds.blobstore.httpstream.url}</jclouds.blobstore.httpstream.url>
+ <jclouds.blobstore.httpstream.md5>${jclouds.blobstore.httpstream.md5}</jclouds.blobstore.httpstream.md5>
+ </systemPropertyVariables>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/43aa5b3a/rackspace-cloudfiles-us/src/main/java/org/jclouds/rackspace/cloudfiles/us/CloudFilesUSProviderMetadata.java
----------------------------------------------------------------------
diff --git a/rackspace-cloudfiles-us/src/main/java/org/jclouds/rackspace/cloudfiles/us/CloudFilesUSProviderMetadata.java b/rackspace-cloudfiles-us/src/main/java/org/jclouds/rackspace/cloudfiles/us/CloudFilesUSProviderMetadata.java
new file mode 100644
index 0000000..beb9521
--- /dev/null
+++ b/rackspace-cloudfiles-us/src/main/java/org/jclouds/rackspace/cloudfiles/us/CloudFilesUSProviderMetadata.java
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.rackspace.cloudfiles.us;
+
+import static org.jclouds.location.reference.LocationConstants.ISO3166_CODES;
+import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGION;
+import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS;
+import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE;
+import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.SERVICE_TYPE;
+import static org.jclouds.reflect.Reflection2.typeToken;
+
+import java.net.URI;
+import java.util.Properties;
+
+import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.RegionModule;
+import org.jclouds.openstack.swift.v1.blobstore.RegionScopedBlobStoreContext;
+import org.jclouds.openstack.swift.v1.blobstore.config.SignUsingTemporaryUrls;
+import org.jclouds.openstack.swift.v1.blobstore.config.SwiftBlobStoreContextModule;
+import org.jclouds.openstack.swift.v1.config.SwiftTypeAdapters;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.providers.ProviderMetadata;
+import org.jclouds.providers.internal.BaseProviderMetadata;
+import org.jclouds.rackspace.cloudfiles.v1.CloudFilesApiMetadata;
+import org.jclouds.rackspace.cloudfiles.v1.config.CloudFilesHttpApiModule;
+import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityAuthenticationApiModule;
+import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityAuthenticationModule;
+import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityCredentialTypes;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Module;
+
+/**
+ * Implementation of {@link ProviderMetadata} for Rackspace Cloud Files US regions.
+ *
+ * @author Jeremy Daggett
+ */
+public class CloudFilesUSProviderMetadata extends BaseProviderMetadata {
+
+ /**
+ * @return The Builder object.
+ */
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ @Override
+ public Builder toBuilder() {
+ return builder().fromProviderMetadata(this);
+ }
+
+ /**
+ * Provider constructor.
+ */
+ public CloudFilesUSProviderMetadata() {
+ this(new Builder());
+ }
+
+ /**
+ * @param builder the Builder for the provider.
+ */
+ protected CloudFilesUSProviderMetadata(Builder builder) {
+ super(builder);
+ }
+
+ /**
+ * @return a {@link Properties} object containing the default provider properties.
+ */
+ public static Properties defaultProperties() {
+ Properties properties = new Properties();
+ properties.setProperty(CREDENTIAL_TYPE, CloudIdentityCredentialTypes.API_KEY_CREDENTIALS);
+ properties.setProperty(SERVICE_TYPE, ServiceType.OBJECT_STORE);
+
+ properties.setProperty(PROPERTY_REGIONS, "ORD,DFW,IAD,SYD,HKG");
+ properties.setProperty(PROPERTY_REGION + ".ORD." + ISO3166_CODES, "US-IL");
+ properties.setProperty(PROPERTY_REGION + ".DFW." + ISO3166_CODES, "US-TX");
+ properties.setProperty(PROPERTY_REGION + ".IAD." + ISO3166_CODES, "US-VA");
+ properties.setProperty(PROPERTY_REGION + ".SYD." + ISO3166_CODES, "AU-NSW");
+ properties.setProperty(PROPERTY_REGION + ".HKG." + ISO3166_CODES, "HK");
+
+ return properties;
+ }
+
+ /**
+ * Builder pattern class.
+ */
+ public static class Builder extends BaseProviderMetadata.Builder {
+
+ protected Builder() {
+ id("rackspace-cloudfiles-us")
+ .name("Rackspace Cloud Files US")
+ .apiMetadata(new CloudFilesApiMetadata().toBuilder()
+ .identityName("${userName}")
+ .credentialName("${apiKey}")
+ .defaultEndpoint("https://identity.api.rackspacecloud.com/v2.0/")
+ .documentation(URI.create("http://docs.rackspace.com/files/api/v1/cf-devguide/content/index.html"))
+ .endpointName("Rackspace Cloud Identity service URL ending in /v2.0/")
+ .version("1.0")
+ .view(typeToken(RegionScopedBlobStoreContext.class))
+ .defaultModules(ImmutableSet.<Class<? extends Module>>builder()
+ .add(CloudIdentityAuthenticationApiModule.class)
+ .add(CloudIdentityAuthenticationModule.class)
+ .add(RegionModule.class)
+ .add(SwiftTypeAdapters.class)
+ .add(CloudFilesHttpApiModule.class)
+ .add(SwiftBlobStoreContextModule.class)
+ .add(SignUsingTemporaryUrls.class)
+ .build())
+ .build())
+ .homepage(URI.create("http://www.rackspace.com/cloud/files"))
+ .console(URI.create("https://mycloud.rackspace.com"))
+ .linkedServices("rackspace-autoscale-us", "rackspace-cloudblockstorage-us",
+ "rackspace-clouddatabases-us", "rackspace-clouddns-us",
+ "rackspace-cloudidentity", "rackspace-cloudloadbalancers-us",
+ "rackspace-cloudqueues-us")
+ .iso3166Codes("US-IL", "US-TX", "US-VA", "AU-NSW", "HK")
+ .defaultProperties(CloudFilesUSProviderMetadata.defaultProperties());
+
+ }
+
+ @Override
+ public CloudFilesUSProviderMetadata build() {
+ return new CloudFilesUSProviderMetadata(this);
+ }
+
+ @Override
+ public Builder fromProviderMetadata(ProviderMetadata in) {
+ super.fromProviderMetadata(in);
+ return this;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/43aa5b3a/rackspace-cloudfiles-us/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata
----------------------------------------------------------------------
diff --git a/rackspace-cloudfiles-us/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata b/rackspace-cloudfiles-us/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata
new file mode 100644
index 0000000..cf4c3b4
--- /dev/null
+++ b/rackspace-cloudfiles-us/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+org.jclouds.rackspace.cloudfiles.us.CloudFilesUSProviderMetadata
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/43aa5b3a/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/CloudFilesUSProviderTest.java
----------------------------------------------------------------------
diff --git a/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/CloudFilesUSProviderTest.java b/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/CloudFilesUSProviderTest.java
new file mode 100644
index 0000000..05d036a
--- /dev/null
+++ b/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/CloudFilesUSProviderTest.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.rackspace.cloudfiles.us;
+
+import org.jclouds.providers.internal.BaseProviderMetadataTest;
+import org.jclouds.rackspace.cloudfiles.us.CloudFilesUSProviderMetadata;
+import org.jclouds.rackspace.cloudfiles.v1.CloudFilesApiMetadata;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "CloudFilesUSProviderTest")
+public class CloudFilesUSProviderTest extends BaseProviderMetadataTest {
+ public CloudFilesUSProviderTest() {
+ super(new CloudFilesUSProviderMetadata(), new CloudFilesApiMetadata());
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/43aa5b3a/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/blobstore/integration/CloudFilesUSBlobIntegrationLiveTest.java
----------------------------------------------------------------------
diff --git a/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/blobstore/integration/CloudFilesUSBlobIntegrationLiveTest.java b/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/blobstore/integration/CloudFilesUSBlobIntegrationLiveTest.java
new file mode 100644
index 0000000..b684e89
--- /dev/null
+++ b/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/blobstore/integration/CloudFilesUSBlobIntegrationLiveTest.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.rackspace.cloudfiles.us.blobstore.integration;
+
+import org.jclouds.rackspace.cloudfiles.v1.blobstore.integration.CloudFilesBlobIntegrationLiveTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "live", testName = "CloudFilesUSBlobIntegrationLiveTest")
+public class CloudFilesUSBlobIntegrationLiveTest extends CloudFilesBlobIntegrationLiveTest {
+ public CloudFilesUSBlobIntegrationLiveTest() {
+ provider = "rackspace-cloudfiles-us";
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/43aa5b3a/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/blobstore/integration/CloudFilesUSBlobLiveTest.java
----------------------------------------------------------------------
diff --git a/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/blobstore/integration/CloudFilesUSBlobLiveTest.java b/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/blobstore/integration/CloudFilesUSBlobLiveTest.java
new file mode 100644
index 0000000..8eb5385
--- /dev/null
+++ b/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/blobstore/integration/CloudFilesUSBlobLiveTest.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.rackspace.cloudfiles.us.blobstore.integration;
+
+import org.jclouds.rackspace.cloudfiles.v1.blobstore.integration.CloudFilesBlobLiveTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "live", testName = "CloudFilesUSBlobLiveTest")
+public class CloudFilesUSBlobLiveTest extends CloudFilesBlobLiveTest {
+ public CloudFilesUSBlobLiveTest() {
+ provider = "rackspace-cloudfiles-us";
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/43aa5b3a/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/blobstore/integration/CloudFilesUSBlobSignerLiveTest.java
----------------------------------------------------------------------
diff --git a/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/blobstore/integration/CloudFilesUSBlobSignerLiveTest.java b/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/blobstore/integration/CloudFilesUSBlobSignerLiveTest.java
new file mode 100644
index 0000000..5255de2
--- /dev/null
+++ b/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/blobstore/integration/CloudFilesUSBlobSignerLiveTest.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.rackspace.cloudfiles.us.blobstore.integration;
+
+import org.jclouds.rackspace.cloudfiles.v1.blobstore.integration.CloudFilesBlobSignerLiveTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "live", testName = "CloudFilesUSBlobSignerLiveTest")
+public class CloudFilesUSBlobSignerLiveTest extends CloudFilesBlobSignerLiveTest {
+ public CloudFilesUSBlobSignerLiveTest() {
+ provider = "rackspace-cloudfiles-us";
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/43aa5b3a/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/blobstore/integration/CloudFilesUSContainerIntegrationLiveTest.java
----------------------------------------------------------------------
diff --git a/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/blobstore/integration/CloudFilesUSContainerIntegrationLiveTest.java b/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/blobstore/integration/CloudFilesUSContainerIntegrationLiveTest.java
new file mode 100644
index 0000000..2fe511e
--- /dev/null
+++ b/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/blobstore/integration/CloudFilesUSContainerIntegrationLiveTest.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.rackspace.cloudfiles.us.blobstore.integration;
+
+import org.jclouds.rackspace.cloudfiles.v1.blobstore.integration.CloudFilesContainerIntegrationLiveTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "live", testName = "CloudFilesUSContainerIntegrationLiveTest")
+public class CloudFilesUSContainerIntegrationLiveTest extends CloudFilesContainerIntegrationLiveTest {
+ public CloudFilesUSContainerIntegrationLiveTest() {
+ provider = "rackspace-cloudfiles-us";
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/43aa5b3a/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/blobstore/integration/CloudFilesUSContainerLiveTest.java
----------------------------------------------------------------------
diff --git a/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/blobstore/integration/CloudFilesUSContainerLiveTest.java b/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/blobstore/integration/CloudFilesUSContainerLiveTest.java
new file mode 100644
index 0000000..44daffd
--- /dev/null
+++ b/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/blobstore/integration/CloudFilesUSContainerLiveTest.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.rackspace.cloudfiles.us.blobstore.integration;
+
+import org.jclouds.rackspace.cloudfiles.v1.blobstore.integration.CloudFilesContainerLiveTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "live", testName = "CloudFilesUSContainerLiveTest")
+public class CloudFilesUSContainerLiveTest extends CloudFilesContainerLiveTest {
+ public CloudFilesUSContainerLiveTest() {
+ provider = "rackspace-cloudfiles-us";
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/43aa5b3a/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/blobstore/integration/CloudFilesUSServiceIntegrationLiveTest.java
----------------------------------------------------------------------
diff --git a/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/blobstore/integration/CloudFilesUSServiceIntegrationLiveTest.java b/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/blobstore/integration/CloudFilesUSServiceIntegrationLiveTest.java
new file mode 100644
index 0000000..698b733
--- /dev/null
+++ b/rackspace-cloudfiles-us/src/test/java/org/jclouds/rackspace/cloudfiles/us/blobstore/integration/CloudFilesUSServiceIntegrationLiveTest.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.rackspace.cloudfiles.us.blobstore.integration;
+
+import java.util.Set;
+
+import org.jclouds.rackspace.cloudfiles.v1.blobstore.integration.CloudFilesServiceIntegrationLiveTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+@Test(groups = "live", testName = "CloudFilesUSServiceIntegrationLiveTest")
+public class CloudFilesUSServiceIntegrationLiveTest extends CloudFilesServiceIntegrationLiveTest {
+ public CloudFilesUSServiceIntegrationLiveTest() {
+ provider = "rackspace-cloudfiles-us";
+ }
+
+ @Override
+ protected Set<String> getIso3166Codes() {
+ return ImmutableSet.<String> of("US-IL", "US-TX", "US-VA", "AU-NSW", "HK");
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/43aa5b3a/rackspace-cloudfiles-us/src/test/resources/logback.xml
----------------------------------------------------------------------
diff --git a/rackspace-cloudfiles-us/src/test/resources/logback.xml b/rackspace-cloudfiles-us/src/test/resources/logback.xml
new file mode 100644
index 0000000..ce891f1
--- /dev/null
+++ b/rackspace-cloudfiles-us/src/test/resources/logback.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<configuration scan="false">
+ <appender name="FILE" class="ch.qos.logback.core.FileAppender">
+ <file>target/test-data/jclouds.log</file>
+
+ <encoder>
+ <Pattern>%d %-5p [%c] [%thread] %m%n</Pattern>
+ </encoder>
+ </appender>
+
+ <appender name="WIREFILE" class="ch.qos.logback.core.FileAppender">
+ <file>target/test-data/jclouds-wire.log</file>
+
+ <encoder>
+ <Pattern>%d %-5p [%c] [%thread] %m%n</Pattern>
+ </encoder>
+ </appender>
+
+ <appender name="BLOBSTOREFILE" class="ch.qos.logback.core.FileAppender">
+ <file>target/test-data/jclouds-blobstore.log</file>
+
+ <encoder>
+ <Pattern>%d %-5p [%c] [%thread] %m%n</Pattern>
+ </encoder>
+ </appender>
+
+ <root>
+ <level value="warn" />
+ </root>
+
+ <logger name="org.jclouds">
+ <level value="DEBUG" />
+ <appender-ref ref="FILE" />
+ </logger>
+
+<!--
+ <logger name="jclouds.wire">
+ <level value="DEBUG" />
+ <appender-ref ref="WIREFILE" />
+ </logger>
+-->
+
+ <logger name="jclouds.headers">
+ <level value="DEBUG" />
+ <appender-ref ref="WIREFILE" />
+ </logger>
+
+ <logger name="jclouds.blobstore">
+ <level value="DEBUG" />
+ <appender-ref ref="BLOBSTOREFILE" />
+ </logger>
+
+</configuration>
http://git-wip-us.apache.org/repos/asf/jclouds-labs-openstack/blob/43aa5b3a/rackspace-cloudfiles/README.md
----------------------------------------------------------------------
diff --git a/rackspace-cloudfiles/README.md b/rackspace-cloudfiles/README.md
new file mode 100644
index 0000000..1142323
--- /dev/null
+++ b/rackspace-cloudfiles/README.md
@@ -0,0 +1,20 @@
+Rackspace Cloud Files
+==========================
+
+The new Rackspace Cloud Files multi-region based service API.
+
+This new "rackspace-cloudfiles" API supercedes the jclouds "cloudfiles" API, which will eventually be deprecated.
+
+With this multi-region support, each BlobStore can be isolated to a specific region:
+
+ RegionScopedBlobStoreContext ctx =
+ contextBuilder.buildView(RegionScopedBlobStoreContext.class);
+
+ Set<String> regionIds = ctx.configuredRegions();
+
+ // isolated to a specific region
+ BlobStore dfwBlobStore = ctx.blobStoreInRegion("DFW");
+ BlobStore iadBlobStore = ctx.blobStoreInRegion("IAD");
+
+Production ready?
+No