[ 
https://issues.apache.org/jira/browse/JCLOUDS-1173?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrew Gaul resolved JCLOUDS-1173.
----------------------------------
       Resolution: Fixed
         Assignee: Andrew Gaul
    Fix Version/s: 2.0.0

Glad 2.0.0-SNAPSHOT works for you.  Note that you do not have to call 
{{createDirectory}} -- directories are largely a jclouds fiction and blobstores 
actually support this functionality via prefix and delimiter.  Directories will 
go away in 2.1.0.

> List method has different behavior on different cloud providers
> ---------------------------------------------------------------
>
>                 Key: JCLOUDS-1173
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-1173
>             Project: jclouds
>          Issue Type: Bug
>          Components: jclouds-blobstore
>    Affects Versions: 1.9.2
>            Reporter: Ryan MacDowell
>            Assignee: Andrew Gaul
>             Fix For: 2.0.0
>
>         Attachments: ListTest.java
>
>
> I'm seeing different behavior for the BlobStore list method of aws-s3 and 
> transient.  On aws-s3 the PageSet contains the directory itself and on azure 
> and transient it does not.  
> The example below shows that transient gives a size of 1 and aws-s3 gives a 
> size of 2 even though they are setup exactly the same.  
> {code:title=ListTest.java}
> import org.jclouds.ContextBuilder;
> import org.jclouds.blobstore.BlobStore;
> import org.jclouds.blobstore.BlobStoreContext;
> import org.jclouds.blobstore.domain.Blob;
> import com.amazonaws.auth.AWSCredentials;
> import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
> public class ListTest {
>       public static void main(String[] args) {
>               String containerName = "test.container";
>               String dataString = "testData";
>               String testDirectory = "testDirectory";
>               String blobName = "blob1";
>               AWSCredentials creds = new 
> DefaultAWSCredentialsProviderChain().getCredentials();
>               //Setup the contexts
>               BlobStoreContext transientContext = 
> ContextBuilder.newBuilder("transient")
>                               .credentials(creds.getAWSAccessKeyId(), 
> creds.getAWSSecretKey())
>                               .build(BlobStoreContext.class);
>               BlobStoreContext awsS3Context = 
> ContextBuilder.newBuilder("aws-s3")
>                               .credentials(creds.getAWSAccessKeyId(), 
> creds.getAWSSecretKey())
>                               .build(BlobStoreContext.class);
>               //Setup the blobstores
>               BlobStore transientStore = transientContext.getBlobStore();
>               BlobStore awsStore = awsS3Context.getBlobStore();
>               //Setup the container
>               transientStore.createContainerInLocation(null, containerName);
>               awsStore.createContainerInLocation(null, containerName);
>               //Setup the directories
>               transientStore.createDirectory(containerName, testDirectory);
>               awsStore.createDirectory(containerName, testDirectory);
>               //setup the blobs
>               Blob transientBlob = transientStore.blobBuilder(testDirectory 
> +"/" + blobName).build();
>               Blob awsBlob = awsStore.blobBuilder(testDirectory +"/" + 
> blobName).build();
>               //create the payloads
>               byte[] transientPayload = dataString.getBytes();
>               byte[] awsPayload = dataString.getBytes();
>               //set the payloads
>               transientBlob.setPayload(transientPayload);
>               awsBlob.setPayload(awsPayload);
>               //Upload the blobs
>               transientStore.putBlob(containerName, transientBlob);
>               awsStore.putBlob(containerName, awsBlob);
>               System.out.println("Directory size should be the same but is 
> not: transient + " + transientStore.list(containerName).size()
>                               + ", aws = " + 
> awsStore.list(containerName).size());
>       }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to