mirror of https://github.com/apache/jclouds.git
Merge pull request #1369 from shrinandj/fix_s3_directory_suffix
Make AWS-S3 use the right directory suffix.
This commit is contained in:
commit
d84231cc8a
|
@ -22,7 +22,6 @@ import static org.jclouds.Constants.PROPERTY_API_VERSION;
|
|||
import static org.jclouds.Constants.PROPERTY_RELAX_HOSTNAME;
|
||||
import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AUTH_TAG;
|
||||
import static org.jclouds.aws.reference.AWSConstants.PROPERTY_HEADER_TAG;
|
||||
import static org.jclouds.blobstore.reference.BlobStoreConstants.DIRECTORY_SUFFIX_FOLDER;
|
||||
import static org.jclouds.blobstore.reference.BlobStoreConstants.PROPERTY_BLOBSTORE_DIRECTORY_SUFFIX;
|
||||
import static org.jclouds.blobstore.reference.BlobStoreConstants.PROPERTY_USER_METADATA_PREFIX;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
|
@ -88,7 +87,7 @@ public class S3ApiMetadata extends BaseRestApiMetadata {
|
|||
properties.setProperty(PROPERTY_S3_SERVICE_PATH, "/");
|
||||
properties.setProperty(PROPERTY_S3_VIRTUAL_HOST_BUCKETS, "true");
|
||||
properties.setProperty(PROPERTY_RELAX_HOSTNAME, "true");
|
||||
properties.setProperty(PROPERTY_BLOBSTORE_DIRECTORY_SUFFIX, DIRECTORY_SUFFIX_FOLDER);
|
||||
properties.setProperty(PROPERTY_BLOBSTORE_DIRECTORY_SUFFIX, "/");
|
||||
properties.setProperty(PROPERTY_USER_METADATA_PREFIX, String.format("x-${%s}-meta-", PROPERTY_HEADER_TAG));
|
||||
return properties;
|
||||
}
|
||||
|
|
|
@ -81,4 +81,22 @@ public class S3ClientMockTest {
|
|||
assertEquals(request.getHeaders(CONTENT_LENGTH), ImmutableList.of("0"));
|
||||
server.shutdown();
|
||||
}
|
||||
|
||||
public void testDirectorySeparator() throws IOException, InterruptedException {
|
||||
MockWebServer server = new MockWebServer();
|
||||
server.enqueue(new MockResponse().setBody("").addHeader(ETAG, "ABCDEF"));
|
||||
server.play();
|
||||
|
||||
S3Client client = getContext(server.getUrl("/")).getApi();
|
||||
S3Object fileInDir = client.newS3Object();
|
||||
fileInDir.getMetadata().setKey("someDir/fileName");
|
||||
fileInDir.setPayload(new byte[] {});
|
||||
|
||||
assertEquals(client.putObject("bucket", fileInDir), "ABCDEF");
|
||||
|
||||
RecordedRequest request = server.takeRequest();
|
||||
assertEquals(request.getRequestLine(), "PUT /bucket/someDir/fileName HTTP/1.1");
|
||||
|
||||
server.shutdown();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue