Repository: jclouds
Updated Branches:
  refs/heads/master c34935dcd -> 019ccb743


Pinning down JCLOUDS-1401 fix behavior with a unit test which is able to 
distinguish URI.query from URI.rawQuery.


Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/019ccb74
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/019ccb74
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/019ccb74

Branch: refs/heads/master
Commit: 019ccb74316374498f9fdac0339621b2a3b6ad76
Parents: 9a65be7
Author: Jesse Glick <jgl...@cloudbees.com>
Authored: Wed Jul 11 10:41:50 2018 -0400
Committer: Ignasi Barrera <n...@apache.org>
Committed: Wed Jul 11 09:35:34 2018 -0700

----------------------------------------------------------------------
 .../RequestAuthorizeSignatureV4Test.java        | 25 ++++++++++++++++++++
 1 file changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/019ccb74/apis/s3/src/test/java/org/jclouds/s3/filters/RequestAuthorizeSignatureV4Test.java
----------------------------------------------------------------------
diff --git 
a/apis/s3/src/test/java/org/jclouds/s3/filters/RequestAuthorizeSignatureV4Test.java
 
b/apis/s3/src/test/java/org/jclouds/s3/filters/RequestAuthorizeSignatureV4Test.java
index 9494a86..b59a26b 100644
--- 
a/apis/s3/src/test/java/org/jclouds/s3/filters/RequestAuthorizeSignatureV4Test.java
+++ 
b/apis/s3/src/test/java/org/jclouds/s3/filters/RequestAuthorizeSignatureV4Test.java
@@ -41,6 +41,7 @@ import org.jclouds.s3.S3ApiMetadata;
 import org.jclouds.s3.S3Client;
 import org.jclouds.s3.config.S3HttpApiModule;
 import org.jclouds.s3.domain.S3Object;
+import org.jclouds.s3.options.ListBucketOptions;
 import org.jclouds.s3.options.PutObjectOptions;
 import org.testng.annotations.Test;
 
@@ -83,6 +84,11 @@ public class RequestAuthorizeSignatureV4Test {
          + 
"SignedHeaders=content-length;content-type;host;x-amz-content-sha256;x-amz-date;x-amz-storage-class,
 "
          + 
"Signature=090f1bb1db984221ae1a20c5d12a82820a0d74b4be85f20daa1431604f41df08";
 
+   private static final String LIST_BUCKET_RESULT = "AWS4-HMAC-SHA256 "
+         + 
"Credential=AKIAPAEBI3QI4EXAMPLE/20150203/cn-north-1/s3/aws4_request, "
+         + "SignedHeaders=host;x-amz-content-sha256;x-amz-date, "
+         + 
"Signature=6cc5d0758e2599be7cb172fd57cefab2828201a2b4d372972a83dc304de93958";
+
    private static final String BUCKET_NAME = "test-bucket";
    private static final String OBJECT_NAME = "ExampleObject.txt";
 
@@ -190,4 +196,23 @@ public class RequestAuthorizeSignatureV4Test {
       assertEquals(filtered.getFirstHeaderOrNull("Authorization"), 
PUT_OBJECT_RESULT);
 
    }
+
+   // JCLOUDS-1401
+   @Test
+   void testListBucketFunnyCharactersSignature() {
+      Invocation invocation = Invocation.create(method(S3Client.class, 
"listBucket", String.class,
+                  ListBucketOptions[].class),
+            // Simulating ListBucketOptions.Builder.withPrefix("foo%2Fbar") 
with manual endpoint:
+            ImmutableList.<Object>of(BUCKET_NAME, new ListBucketOptions[0]));
+
+      HttpRequest getObject = GeneratedHttpRequest.builder().method("GET")
+            .invocation(invocation)
+            .endpoint("https://"; + BUCKET_NAME + 
".s3.cn-north-1.amazonaws.com.cn/?delimiter=/&prefix=foo%252Fbar")
+            .addHeader(HttpHeaders.HOST, BUCKET_NAME + 
".s3.cn-north-1.amazonaws.com.cn")
+            .build();
+
+      HttpRequest filtered = filter(temporaryCredentials).filter(getObject);
+      assertEquals(filtered.getFirstHeaderOrNull("Authorization"), 
LIST_BUCKET_RESULT);
+   }
+
 }

Reply via email to