jclouds-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Gaul <g...@apache.org>
Subject Re: Directory Name - 2.0.0-SNAPSHOT
Date Thu, 27 Oct 2016 05:13:37 GMT
You did not provide an exact test case so I will provide one for you.  I
successfully tested the following against aws-s3, azureblob, and
filesystem:

   @Test(groups = { "integration", "live" })
   public void testListRecursive() throws Exception {
      BlobStore blobStore = view.getBlobStore();
      String containerName = getContainerName();
      try {
         blobStore.putBlob(containerName, blobStore.blobBuilder("blob-1").payload("").build());
         blobStore.putBlob(containerName, blobStore.blobBuilder("blob-2").payload("").build());
         blobStore.putBlob(containerName, blobStore.blobBuilder("dir/blob-3").payload("").build());

         ListContainerOptions options = new ListContainerOptions().recursive();
         PageSet<? extends StorageMetadata> pageSet = view.getBlobStore().list(containerName,
options);
         assertThat(pageSet).hasSize(3);
         assertThat(pageSet.getNextMarker()).isNull();

         Iterator<? extends StorageMetadata> it = pageSet.iterator();
         assertThat(it.next().getName()).isEqualTo("blob-1");
         assertThat(it.next().getName()).isEqualTo("blob-2");
         assertThat(it.next().getName()).isEqualTo("dir/blob-3");
      } finally {
         returnContainer(containerName);
      }
   }

If you use the fake directory support in 1.9, your mileage may vary, and
jclouds 2.0 deprecated this misfeature and 2.1 will remove it:

https://issues.apache.org/jira/browse/JCLOUDS-1066

Prefix and delimiter support added in jclouds 2.0 replaces directories.

On Wed, Oct 26, 2016 at 04:05:33PM +0000, Paya, Ashkan wrote:
> Thank you for your response Andrew. So Im trying to construct the structure I mentioned
earlier and then perform the container listing on it using ListContainerOptions.Builder.recursive().
Here is the result from different providers:
> 
> * Filesystem:
> 	- blob-1
> 	- blob-2
> 	- dir/blob-3
> 
> * AWS-S3:
> 	- blob-1
> 	- blob-2
> 	- dir/
> 	- dir/blob-3
> 
> * Azureblob
> 	- blob-1
> 	- blob-2
> 	- dir
> 	- dir/blob-3
> 
> On a separate note, there is a discrepancy between aws and azure directories since we
have ‘/‘ in the returned results of the former. This was not the case in 1.9.2.
> 
> Thank you,
> Ashkan
> 
> 
> 
> 
> 
> On 10/25/16, 9:43 PM, "Andrew Gaul" <gaul@apache.org> wrote:
> 
> >[Moving to jclouds-user list]
> >
> >Can you provide the exact test case, including ListContainerOptions, and
> >results from both the filesystem and s3 providers?  2.0 includes many
> >changes to align the former with the latter.
> >
> >For what it is worth, directories are a jclouds fiction and something we
> >deprecated in 2.0 and will remove in 2.1.  The new prefix and delimiter
> >support in 2.0 matches how real providers work.
> >
> >On Wed, Oct 26, 2016 at 12:52:34AM +0000, Paya, Ashkan wrote:
> >> Hello,
> >> 
> >> When I create a directory within a container in Filesystem, blobstore.list()
does not show the directory name separately. For example, when I generate the following structure
and call blobstore.list, I do not get the ‘dir/‘ as a separate element:
> >> 
> >> Container
> >>     |___blob1
> >>     |___blob2
> >>     |___dir
> >>               |__ blob3
> >> 
> >> => blobstore.list returns:
> >> 
> >>   *   blob1
> >>   *   blob2
> >>   *   dir/blob3
> >> 
> >> Thank you,
> >> Ashkan
> >
> >-- 
> >Andrew Gaul
> >http://gaul.org/

-- 
Andrew Gaul
http://gaul.org/

Mime
View raw message