From 32f8d8d3cae6c574d7e1db669210384f3b429b91 Mon Sep 17 00:00:00 2001 From: Shri Javadekar Date: Wed, 27 Feb 2013 22:52:44 -0800 Subject: [PATCH] Add directory specific live test to AWS-S3. This patch adds a test to the AWS live test suite for making sure that a directory is basically a blob with a trailing '/'. --- .../jclouds/aws/s3/AWSS3ClientLiveTest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientLiveTest.java b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientLiveTest.java index b20566ec55..d204aaf7fe 100644 --- a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientLiveTest.java +++ b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientLiveTest.java @@ -288,4 +288,23 @@ public class AWSS3ClientLiveTest extends S3ClientLiveTest { } } + public void testDirectoryEndingWithSlash() throws InterruptedException { + String containerName = getContainerName(); + try { + BlobStore blobStore = view.getBlobStore(); + blobStore.createDirectory(containerName, "someDir"); + + // According to the S3 documentation, a directory is nothing but a blob + // whose name ends with a '/'. So let's try to remove the blob we just + // created. + blobStore.removeBlob(containerName, "someDir/"); + + // The directory "someDir" shouldn't exist since we removed it. If this + // test succeeds, it confirms that a directory (or folder) is nothing + // but a blob with a name ending in '/'. + assertEquals(blobStore.directoryExists(containerName, "someDir"), false); + } finally { + returnContainer(containerName); + } + } }