Matcher matcher = ETAG_CONTENT_MD5_PATTERN.matcher(currentETag); if (matcher.matches()) { builder.contentMD5(base16().lowerCase().decode(matcher.group(1)));
Matcher matcher = ETAG_CONTENT_MD5_PATTERN.matcher(currentETag); if (matcher.matches()) { builder.contentMD5(base16().lowerCase().decode(matcher.group(1)));
Matcher matcher = ETAG_CONTENT_MD5_PATTERN.matcher(currentETag); if (matcher.matches()) { builder.contentMD5(base16().lowerCase().decode(matcher.group(1)));
currentETag = Strings2.replaceAll(currentETag, '"', ""); if (!MULTIPART_BLOB_ETAG.matcher(currentETag).matches()) { builder.contentMD5(base16().lowerCase().decode(currentETag));
currentETag = Strings2.replaceAll(currentETag, '"', ""); if (!MULTIPART_BLOB_ETAG.matcher(currentETag).matches()) { builder.contentMD5(base16().lowerCase().decode(currentETag));
new ObjectMetadataBuilder().key("apps/0").bucket(bucket).uri(URI.create("http://bucket.com/apps/0")) .lastModified(dateService.iso8601DateParse("2009-05-07T18:27:08.000Z")).eTag( "\"c82e6a0025c31c5de5947fda62ac51ab\"").owner(owner).contentMD5( base16().lowerCase().decode("c82e6a0025c31c5de5947fda62ac51ab")).contentLength(8l).build(), new ObjectMetadataBuilder().key("apps/1").bucket(bucket).uri(URI.create("http://bucket.com/apps/1")) .lastModified(dateService.iso8601DateParse("2009-05-07T18:27:09.000Z")).eTag( "\"944fab2c5a9a6bacf07db5e688310d7a\"").owner(owner).contentMD5( base16().lowerCase().decode("944fab2c5a9a6bacf07db5e688310d7a")).contentLength(8l).build(), new ObjectMetadataBuilder().key("apps/2").bucket(bucket).uri(URI.create("http://bucket.com/apps/2")) .lastModified(dateService.iso8601DateParse("2009-05-07T18:27:09.000Z")).eTag( "\"a227b8888045c8fd159fb495214000f0\"").owner(owner).contentMD5( base16().lowerCase().decode("a227b8888045c8fd159fb495214000f0")).contentLength(8l).build(), new ObjectMetadataBuilder().key("apps/3").bucket(bucket).uri(URI.create("http://bucket.com/apps/3")) .lastModified(dateService.iso8601DateParse("2009-05-07T18:27:09.000Z")).eTag( "\"c9caa76c3dec53e2a192608ce73eef03\"").owner(owner).contentMD5( base16().lowerCase().decode("c9caa76c3dec53e2a192608ce73eef03")).contentLength(8l).build(), new ObjectMetadataBuilder().key("apps/4").bucket(bucket).uri(URI.create("http://bucket.com/apps/4")) .lastModified(dateService.iso8601DateParse("2009-05-07T18:27:09.000Z")).eTag( "\"1ce5d0dcc6154a647ea90c7bdf82a224\"").owner(owner).contentMD5( base16().lowerCase().decode("1ce5d0dcc6154a647ea90c7bdf82a224")).contentLength(8l).build(), new ObjectMetadataBuilder().key("apps/5").bucket(bucket).uri(URI.create("http://bucket.com/apps/5")) .lastModified(dateService.iso8601DateParse("2009-05-07T18:27:09.000Z")).eTag( "\"79433524d87462ee05708a8ef894ed55\"").owner(owner).contentMD5( base16().lowerCase().decode("79433524d87462ee05708a8ef894ed55")).contentLength(8l).build(), new ObjectMetadataBuilder().key("apps/6").bucket(bucket).uri(URI.create("http://bucket.com/apps/6")) .lastModified(dateService.iso8601DateParse("2009-05-07T18:27:10.000Z")).eTag( "\"dd00a060b28ddca8bc5a21a49e306f67\"").owner(owner).contentMD5( base16().lowerCase().decode("dd00a060b28ddca8bc5a21a49e306f67")).contentLength(8l).build(), new ObjectMetadataBuilder().key("apps/7").bucket(bucket).uri(URI.create("http://bucket.com/apps/7"))
new ObjectMetadataBuilder().key("apps/0").bucket(bucket).uri(URI.create("http://bucket.com/apps/0")) .lastModified(dateService.iso8601DateParse("2009-05-07T18:27:08.000Z")).eTag( "\"c82e6a0025c31c5de5947fda62ac51ab\"").owner(owner).contentMD5( base16().lowerCase().decode("c82e6a0025c31c5de5947fda62ac51ab")).contentLength(8L).build(), new ObjectMetadataBuilder().key("apps/1").bucket(bucket).uri(URI.create("http://bucket.com/apps/1")) .lastModified(dateService.iso8601DateParse("2009-05-07T18:27:09.000Z")).eTag( "\"944fab2c5a9a6bacf07db5e688310d7a\"").owner(owner).contentMD5( base16().lowerCase().decode("944fab2c5a9a6bacf07db5e688310d7a")).contentLength(8L).build(), new ObjectMetadataBuilder().key("apps/2").bucket(bucket).uri(URI.create("http://bucket.com/apps/2")) .lastModified(dateService.iso8601DateParse("2009-05-07T18:27:09.000Z")).eTag( "\"a227b8888045c8fd159fb495214000f0\"").owner(owner).contentMD5( base16().lowerCase().decode("a227b8888045c8fd159fb495214000f0")).contentLength(8L).build(), new ObjectMetadataBuilder().key("apps/3").bucket(bucket).uri(URI.create("http://bucket.com/apps/3")) .lastModified(dateService.iso8601DateParse("2009-05-07T18:27:09.000Z")).eTag( "\"c9caa76c3dec53e2a192608ce73eef03\"").owner(owner).contentMD5( base16().lowerCase().decode("c9caa76c3dec53e2a192608ce73eef03")).contentLength(8L).build(), new ObjectMetadataBuilder().key("apps/4").bucket(bucket).uri(URI.create("http://bucket.com/apps/4")) .lastModified(dateService.iso8601DateParse("2009-05-07T18:27:09.000Z")).eTag( "\"1ce5d0dcc6154a647ea90c7bdf82a224\"").owner(owner).contentMD5( base16().lowerCase().decode("1ce5d0dcc6154a647ea90c7bdf82a224")).contentLength(8L).build(), new ObjectMetadataBuilder().key("apps/5").bucket(bucket).uri(URI.create("http://bucket.com/apps/5")) .lastModified(dateService.iso8601DateParse("2009-05-07T18:27:09.000Z")).eTag( "\"79433524d87462ee05708a8ef894ed55\"").owner(owner).contentMD5( base16().lowerCase().decode("79433524d87462ee05708a8ef894ed55")).contentLength(8L).build(), new ObjectMetadataBuilder().key("apps/6").bucket(bucket).uri(URI.create("http://bucket.com/apps/6")) .lastModified(dateService.iso8601DateParse("2009-05-07T18:27:10.000Z")).eTag( "\"dd00a060b28ddca8bc5a21a49e306f67\"").owner(owner).contentMD5( base16().lowerCase().decode("dd00a060b28ddca8bc5a21a49e306f67")).contentLength(8L).build(), new ObjectMetadataBuilder().key("apps/7").bucket(bucket).uri(URI.create("http://bucket.com/apps/7"))
String key = "constitution.txt"; String uploadId = getApi().initiateMultipartUpload(containerName, ObjectMetadataBuilder.create().key(key).contentMD5(oneHundredOneConstitutionsMD5.asBytes()).build()); assertThat(getApi().listMultipartPartsFull(containerName, key, uploadId)).isEmpty();
String key = "constitution.txt"; String uploadId = getApi().initiateMultipartUpload(containerName, ObjectMetadataBuilder.create().key(key).contentMD5(oneHundredOneConstitutionsMD5).build()); byte[] buffer = toByteArray(oneHundredOneConstitutions); assertEquals(oneHundredOneConstitutionsLength, (long) buffer.length);
public void testInitiateMultipartUpload() throws SecurityException, NegativeArraySizeException, NoSuchMethodException { Invokable<?, ?> method = method(AWSS3AsyncClient.class, "initiateMultipartUpload", String.class, ObjectMetadata.class, PutObjectOptions[].class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", ObjectMetadataBuilder.create().key("foo") .contentMD5(new byte[] { 1, 2, 3, 4 }).build())); assertRequestLineEquals(request, "POST https://bucket." + url + "/foo?uploads HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Content-MD5: AQIDBA==\nContent-Type: binary/octet-stream\nHost: bucket." + url + "\n"); assertPayloadEquals(request, null, null, false); // as this is a payload-related command, but with no payload, be careful // that we check // filtering and do not ignore if this fails later. request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request); assertRequestLineEquals(request, "POST https://bucket." + url + "/foo?uploads HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Authorization: AWS identity:Sp1FX4svL9P2u2bFJwroaYpSANo=\nContent-MD5: AQIDBA==\n" + "Content-Type: binary/octet-stream\nDate: 2009-11-08T15:54:08.897Z\nHost: bucket." + url + "\n"); assertPayloadEquals(request, null, null, false); assertResponseParserClassEquals(method, request, UploadIdFromHttpResponseViaRegex.class); assertSaxResponseParserClassEquals(method, null); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class); checkFilters(request); }
public void testInitiateMultipartUpload() throws SecurityException, NegativeArraySizeException, NoSuchMethodException { Invokable<?, ?> method = method(S3Client.class, "initiateMultipartUpload", String.class, ObjectMetadata.class, PutObjectOptions[].class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", ObjectMetadataBuilder.create().key("foo") .contentMD5(new byte[16]).build())); assertRequestLineEquals(request, "POST https://bucket." + url + "/foo?uploads HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Content-MD5: AAAAAAAAAAAAAAAAAAAAAA==\n" + "Content-Type: binary/octet-stream\n" + "Host: bucket." + url + "\n"); assertPayloadEquals(request, null, null, false); // as this is a payload-related command, but with no payload, be careful // that we check // filtering and do not ignore if this fails later. request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request); assertRequestLineEquals(request, "POST https://bucket." + url + "/foo?uploads HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Authorization: AWS identity:972m/Bqn2L5FIaB+wWDeY83mGvU=\n" + "Content-MD5: AAAAAAAAAAAAAAAAAAAAAA==\n" + "Content-Type: binary/octet-stream\n" + "Date: 2009-11-08T15:54:08.897Z\n" + "Host: bucket." + url + "\n"); assertPayloadEquals(request, null, null, false); assertResponseParserClassEquals(method, request, UploadIdFromHttpResponseViaRegex.class); assertSaxResponseParserClassEquals(method, null); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class); checkFilters(request); }