Uploaded image for project: 'jclouds'
  1. jclouds
  2. JCLOUDS-1173

List method has different behavior on different cloud providers

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.9.2
    • 2.0.0
    • jclouds-blobstore
    • None

    Description

      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.

      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());
      	}
      }
      

      Attachments

        1. ListTest.java
          2 kB
          Ryan MacDowell

        Activity

          People

            gaul Andrew Gaul
            ryanmacdowell@gmail.com Ryan MacDowell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: