You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ga...@apache.org on 2013/10/12 23:10:40 UTC

git commit: Get container name before creating with metadata

Updated Branches:
  refs/heads/master f468a951b -> 4aeaf5f5b


Get container name before creating with metadata


Project: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/commit/4aeaf5f5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/tree/4aeaf5f5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/diff/4aeaf5f5

Branch: refs/heads/master
Commit: 4aeaf5f5bd3f88691af0e3ce0094b05d00c4956c
Parents: f468a95
Author: Andrew Gaul <ga...@apache.org>
Authored: Sat Oct 12 14:09:20 2013 -0700
Committer: Andrew Gaul <ga...@apache.org>
Committed: Sat Oct 12 14:10:17 2013 -0700

----------------------------------------------------------------------
 .../SwiftContainerIntegrationLiveTest.java      | 30 ++++++++++++--------
 1 file changed, 18 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/4aeaf5f5/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftContainerIntegrationLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftContainerIntegrationLiveTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftContainerIntegrationLiveTest.java
index 5836d3f..39074ed 100644
--- a/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftContainerIntegrationLiveTest.java
+++ b/apis/swift/src/test/java/org/jclouds/openstack/swift/blobstore/integration/SwiftContainerIntegrationLiveTest.java
@@ -71,7 +71,6 @@ public class SwiftContainerIntegrationLiveTest extends BaseContainerIntegrationT
    public void testCreateDeleteContainerMetadata() throws InterruptedException {
       CommonSwiftClient swift = view.utils().injector().getInstance(CommonSwiftClient.class);
 
-      String containerName = getContainerName();
       CreateContainerOptions options = CreateContainerOptions.Builder
          .withPublicAccess()
          .withMetadata(ImmutableMap.<String, String> of(
@@ -79,18 +78,25 @@ public class SwiftContainerIntegrationLiveTest extends BaseContainerIntegrationT
             "key2", "value2",
             "key3", "value3")); 
       
-      ContainerMetadata containerMetadata = swift.getContainerMetadata(containerName);
-      
-      assertEquals(containerMetadata.getMetadata().size(), 3);
-      assertEquals(containerMetadata.getMetadata().get("key1"), "value1");
-      assertEquals(containerMetadata.getMetadata().get("key2"), "value2");
-      assertEquals(containerMetadata.getMetadata().get("key3"), "value3");
+      String containerName = getScratchContainerName();
+      assertTrue(swift.createContainer(containerName, options));
 
-      assertTrue(swift.deleteContainerMetadata(containerName, ImmutableList.<String> of("key2","key3")));
+      try {
+         ContainerMetadata containerMetadata = swift.getContainerMetadata(containerName);
 
-      containerMetadata = swift.getContainerMetadata(containerName);
-      
-      assertEquals(containerMetadata.getMetadata().size(), 1);
-      assertEquals(containerMetadata.getMetadata().get("key1"), "value1");
+         assertEquals(containerMetadata.getMetadata().size(), 3);
+         assertEquals(containerMetadata.getMetadata().get("key1"), "value1");
+         assertEquals(containerMetadata.getMetadata().get("key2"), "value2");
+         assertEquals(containerMetadata.getMetadata().get("key3"), "value3");
+
+         assertTrue(swift.deleteContainerMetadata(containerName, ImmutableList.<String> of("key2","key3")));
+
+         containerMetadata = swift.getContainerMetadata(containerName);
+
+         assertEquals(containerMetadata.getMetadata().size(), 1);
+         assertEquals(containerMetadata.getMetadata().get("key1"), "value1");
+      } finally {
+         returnContainer(containerName);
+      }
    }
 }