[
https://issues.apache.org/jira/browse/JCLOUDS-1173?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15572858#comment-15572858
]
Andrew Gaul commented on JCLOUDS-1173:
--------------------------------------
[[email protected]] Can you test with 2.0.0-SNAPSHOT? It includes
several fixes for listing.
> 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
> 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)