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

Transient and Azure blob do not filter out marker blobs from blob exists

    XMLWordPrintableJSON

Details

    Description

      If you create a directory in azureblob or transient, blobexists will return true for that directory name. It does not seem to filter out the marker blobs. If you create a directory in aws-s3 and call blobexists on that directory name it will return false.

      Example code below

      import org.jclouds.ContextBuilder;
      import org.jclouds.blobstore.BlobStore;
      import org.jclouds.blobstore.BlobStoreContext;
      
      import com.amazonaws.auth.AWSCredentials;
      import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
      //Test for equals behavior
      public class DirectoryExistsTest {
      	public static void main(String[] args) {
      		String containerName = "test.container";
      		String testDirectory = "testDirectory";
      		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 awsS3Store = awsS3Context.getBlobStore();
      		//Setup the containers
      		transientStore.createContainerInLocation(null, containerName);
      		awsS3Store.createContainerInLocation(null, containerName);
      		//Setup the directories
      		transientStore.createDirectory(containerName, testDirectory);
      		awsS3Store.createDirectory(containerName, testDirectory);
      
      		System.out.println("Transient directory should exist " + transientStore.directoryExists(containerName, testDirectory));
      		System.out.println("Transient blob should not exist " + transientStore.blobExists(containerName, testDirectory));
      		System.out.println("aws-s3 directory should exist " + awsS3Store.directoryExists(containerName, testDirectory));
      		System.out.println("aws-s3 blob should not exist " + awsS3Store.blobExists(containerName, testDirectory));
      	}
      }
      

      Attachments

        1. DirectoryExistsTest.java
          2 kB
          Ryan MacDowell

        Activity

          People

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

            Dates

              Created:
              Updated: