RequestAuthorizeSignature implements HttpRequestFilter, RequestSigner { @VisibleForTesting void appendBucketName(HttpRequest req, StringBuilder toSign) { String bucketName = S3Utils.getBucketName(req); if (isVhostStyle && bucketName!= null && bucketName.equals(bucketName.toLowerCase())) toSign.append(servicePath).append(bucketName); } @Inject  RequestAuthorizeSignature(SignatureWire signatureWire, @Named(PROPERTY_AUTH_TAG) String authTag,
            @Named(PROPERTY_S3_VIRTUAL_HOST_BUCKETS) boolean isVhostStyle,
            @Named(PROPERTY_S3_SERVICE_PATH) String servicePath, @Named(PROPERTY_HEADER_TAG) String headerTag,
            @org.jclouds.location.Provider Supplier<Credentials> creds,
            @TimeStamp Provider<String> timeStampProvider, Crypto crypto, HttpUtils utils); HttpRequest filter(HttpRequest request); String createStringToSign(HttpRequest request); String sign(String toSign);  }
@Test void testAppendBucketNameHostHeader() throws SecurityException, NoSuchMethodException { GeneratedHttpRequest request = processor.createRequest( method(S3AsyncClient.class, "getBucketLocation", String.class), ImmutableList.<Object> of("bucket")); StringBuilder builder = new StringBuilder(); filter.appendBucketName(request, builder); assertEquals(builder.toString(), "/bucket"); }
@Test void testAppendBucketNameHostHeaderService() throws SecurityException, NoSuchMethodException { HttpRequest request = listOwnedBuckets(); StringBuilder builder = new StringBuilder(); filter.appendBucketName(request, builder); assertEquals(builder.toString(), ""); }