You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by "Ryan MacDowell (JIRA)" <ji...@apache.org> on 2016/09/07 05:39:20 UTC

[jira] [Created] (JCLOUDS-1173) List method has different behavior on different cloud providers

Ryan MacDowell created JCLOUDS-1173:
---------------------------------------

             Summary: 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


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;
//Test for equals behavior
public class ListTest {
	public static void main(String[] args) {
		String containerName = "pega.engineering.ci.automatedtesting";
		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)