org.mockserver.model.Header Java Examples

The following examples show how to use org.mockserver.model.Header. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HealthCheckServiceUnitTest.java    From galeb with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setupClass() {
    environmentVariables.set("ENVIRONMENT_NAME", "env1");
    environmentVariables.set("ZONE_ID", "zone1");
    
    mockServer = ClientAndServer.startClientAndServer(BACKEND_PORT);

    mockServer.when(HttpRequest.request()
                    .withMethod("GET")
                    .withPath("/")
                    .withHeaders(
                            Header.header("user-agent", "Galeb_HealthChecker/1.0"),
                            Header.header(NottableString.not("cookie")))
                    .withKeepAlive(true))
              .respond(HttpResponse.response()
                    .withCookie(new Cookie("session", "test-cookie"))
                    .withStatusCode(HttpStatus.OK.value()));
    
    mockTCPOnlyServer();
}
 
Example #2
Source File: RegistryClientTest.java    From titus-control-plane with Apache License 2.0 6 votes vote down vote up
@Test
public void getDigestTest() {
    final String repo = "titusops/alpine";
    final String tag = "latest";
    final String digest = "sha256:f9f5bb506406b80454a4255b33ed2e4383b9e4a32fb94d6f7e51922704e818fa";

    mockServer
            .when(
                    HttpRequest.request()
                            .withMethod("GET")
                            .withPath("/v2/" + repo + "/manifests/" + tag)
            )
            .respond(
                    HttpResponse.response()
                            .withStatusCode(HttpResponseStatus.OK.code())
                            .withHeader(
                                    new Header("Docker-Content-Digest", digest)
                            )
                            .withBody("{\"schemaVersion\": 2}")
            );

    String retrievedDigest = registryClient.getImageDigest(repo, tag).timeout(TIMEOUT).block();
    assertThat(retrievedDigest).isEqualTo(digest);
}
 
Example #3
Source File: SparkRestClientMockServerTest.java    From spark-jobs-rest-client with Apache License 2.0 6 votes vote down vote up
private void mockServerJobSubmit(String expectedRequestBody) {
    final String responseBody = "{\n" +
            "  \"action\" : \"CreateSubmissionResponse\",\n" +
            "  \"message\" : \"Driver successfully submitted as driver-20151008145126-0000\",\n" +
            "  \"serverSparkVersion\" : \"1.5.0\",\n" +
            "  \"submissionId\" : \"driver-20151008145126-0000\",\n" +
            "  \"success\" : true,\n" +
            "  \"workerHostPort\": \"127.0.0.1:7078\",\n" +
            "  \"workerId\": \"worker-20170130102812-7078\"\n" +
            "}";
    mockServerClient
            .when(
                    request()
                            .withMethod("POST")
                            .withPath("/v1/submissions/create")
                            .withHeader(new Header("Content-Type", "application/json;charset=UTF-8"))
                            .withBody(json((expectedRequestBody))),
                    exactly(1)
            )
            .respond(
                    response()
                            .withStatusCode(200)
                            .withBody(responseBody)
            );
}
 
Example #4
Source File: MockServerUtils.java    From pagerduty-client with MIT License 6 votes vote down vote up
private static void prepareMockServer(MockServerClient mockServerClient, Incident incident, int statusCode, String responseBody) throws JsonProcessingException {
    ObjectMapper mapper = new ObjectMapper();
    mockServerClient
            .when(request()
                            .withMethod("POST")
                            .withPath(EVENT_END_POINT)
                            .withBody(exact(mapper.writeValueAsString(incident))),
                    exactly(1))
            .respond(response()
                            .withStatusCode(statusCode)
                            .withHeaders(
                                    new Header("Server", "MockServer"),
                                    new Header("Date", new Date().toString()),
                                    new Header("Content-Type", "application/json; charset=utf-8")
                            )
                            .withBody(responseBody)
                            .withDelay(new Delay(TimeUnit.SECONDS, 1))
            );
}
 
Example #5
Source File: AbstractS3ClientTest.java    From vertx-s3-client with Apache License 2.0 6 votes vote down vote up
void mock(Map<String, List<String>> expectedQueryParams, String method, String path, Integer statusCode, Body requestBody, Body responseBody, List<Header> responseHeaders, Header... expectedHeaders) throws IOException {
    final HttpRequest httpRequest = request()
            .withMethod(method)
            .withPath(path)
            .withHeaders(expectedHeaders)
            .withQueryStringParameters(expectedQueryParams);

    if (requestBody != null) {
        httpRequest.withBody(requestBody);
    }

    getMockServerClient().when(
            httpRequest
    ).respond(
            response()
                    .withStatusCode(statusCode)
                    .withHeaders(responseHeaders)
                    .withHeader(Header.header("Content-Type", "application/xml;charset=UTF-8"))
                    .withBody(responseBody)
    );
}
 
Example #6
Source File: S3ClientSignedContentTest.java    From vertx-s3-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testDeleteObjectError(TestContext testContext) throws IOException {
    mockDeleteObjectErrorResponse(
            Header.header("X-Amz-Date", "20161110T130214Z"),
            Header.header("X-Amz-Content-Sha256", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"),
            Header.header("Authorization", "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20161110/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=bc61c03c7fbd958aa69920984856ca9ec5454c6714524b39fa637e1837e96355")
    );

    verifyDeleteObjectErrorResponse(testContext);
}
 
Example #7
Source File: S3ClientSignedContentTest.java    From vertx-s3-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testPutObject(TestContext testContext) throws IOException {
    mockPutObject(
            Header.header("X-Amz-Date", "20161110T130214Z"),
            Header.header("X-Amz-Content-Sha256", "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"),
            Header.header("Authorization", "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20161110/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=ec91365b21b715a7f981a89f61e2ef2c0a73cce5998b4272272f68a82d94e055")
    );

    verifyPutObject(testContext);
}
 
Example #8
Source File: S3ClientSignedContentTest.java    From vertx-s3-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testPutObjectError(TestContext testContext) throws IOException {
    mockPutObjectErrorResponse(
            Header.header("X-Amz-Date", "20161110T130214Z"),
            Header.header("X-Amz-Content-Sha256", "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"),
            Header.header("Authorization", "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20161110/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=ec91365b21b715a7f981a89f61e2ef2c0a73cce5998b4272272f68a82d94e055")
    );

    verifyPutObjectErrorResponse(testContext);
}
 
Example #9
Source File: S3ClientSignedContentTest.java    From vertx-s3-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testPutObjectAclWithHeaders(TestContext testContext) throws IOException {
    mockPutObjectAclWithHeaders(
            Header.header("X-Amz-Date", "20161110T130214Z"),
            Header.header("X-Amz-Content-Sha256", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"),
            Header.header("Authorization", "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20161110/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-acl;x-amz-date, Signature=7365ade7156bdd7e804f064495b189e5a305508a12538c244324f8fa4704624c"),
            Header.header("X-Amz-Acl", "private")
    );

    verifyPutObjectAclWithHeaders(testContext);
}
 
Example #10
Source File: S3ClientSignedContentTest.java    From vertx-s3-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testPutObjectAclWithHeadersError(TestContext testContext) throws IOException {
    mockPutObjectAclWithHeadersErrorResponse(
            Header.header("X-Amz-Date", "20161110T130214Z"),
            Header.header("X-Amz-Content-Sha256", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"),
            Header.header("Authorization", "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20161110/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-acl;x-amz-date, Signature=7365ade7156bdd7e804f064495b189e5a305508a12538c244324f8fa4704624c"),
            Header.header("X-Amz-Acl", "private")
    );

    verifyPutObjectAclWithHeadersErrorResponse(testContext);
}
 
Example #11
Source File: S3ClientSignedContentTest.java    From vertx-s3-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testPutObjectAclWithBody(TestContext testContext) throws IOException {
    final AccessControlPolicy accessControlPolicy = new AccessControlPolicy(new Owner("someid", "somedisplayname"), Collections.singletonList(new Grant(new Grantee("id", "displayname"), Permission.FULL_CONTROL)));
    mockPutObjectAclWithBody(
            accessControlPolicy,
            Header.header("X-Amz-Date", "20161110T130214Z"),
            Header.header("X-Amz-Content-Sha256", "0f34495cc4a765bd15a14ef867ac12f7c842a27d10aecc92f3cb442377a63aed"),
            Header.header("Authorization", "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20161110/us-east-1/service/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature=d81ccb9bc9f7bfaf3fb5780100cc820a32494fb054d8b82549066b0484c7f4b7")
    );

    verifyPutObjectAclWithBody(accessControlPolicy, testContext);
}
 
Example #12
Source File: S3ClientSignedContentTest.java    From vertx-s3-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetBucket(TestContext testContext) throws IOException {
    mockGetBucket(
            ImmutableMap.of(
                    "list-type", Collections.singletonList("2"),
                    "continuation-token", Collections.singletonList("14HF6Dfbr92F1EYlZIrMwxPYKQl5lD/mbwiw5+Nlrn1lYIZX3YGzo16Dgz+dxbxFeNGmLsnzwnbbuQM0CMl0krVwh8TBj8nCmNtq/iQCK6gzln8z3U4C71Mh2HyEMHcMgrZGR/akosVql7/AIctj6rA==")
            ),
            Header.header("X-Amz-Date", "20161110T130214Z"),
            Header.header("X-Amz-Content-Sha256", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"),
            Header.header("Authorization", "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20161110/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=62c51118953e03169f4d723c3ffc4fdcc3a30831b898f962dffd423264dae75b")
    );

    verifyGetBucket(testContext);
}
 
Example #13
Source File: S3ClientSignedContentTest.java    From vertx-s3-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testDeleteObject(TestContext testContext) throws IOException {
    mockDeleteObject(
            Header.header("X-Amz-Date", "20161110T130214Z"),
            Header.header("X-Amz-Content-Sha256", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"),
            Header.header("Authorization", "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20161110/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=bc61c03c7fbd958aa69920984856ca9ec5454c6714524b39fa637e1837e96355")
    );

    verifyDeleteObject(testContext);
}
 
Example #14
Source File: S3ClientSignedContentTest.java    From vertx-s3-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetObjectAclError(TestContext testContext) throws IOException {
    mockGetObjectAclErrorResponse(
            Header.header("X-Amz-Date", "20161110T130214Z"),
            Header.header("X-Amz-Content-Sha256", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"),
            Header.header("Authorization", "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20161110/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=e934d94af24578657a02c3ef1ee1d8d946c12f6e5ec11f3637fc99e5c118492e")
    );

    verifyGetObjectAclErrorResponse(testContext);
}
 
Example #15
Source File: S3ClientSignedContentTest.java    From vertx-s3-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testCopyObject(TestContext testContext) throws IOException {
    mockCopyObject(
            Header.header("X-Amz-Date", "20161110T130214Z"),
            Header.header("X-Amz-Content-Sha256", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"),
            Header.header("Authorization", "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20161110/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-copy-source;x-amz-date, Signature=f852af4f877c4f1522af892d11a4bd9a6a42327a67877916a8d57c3339f46d0b")
    );

    verifyCopyObject(testContext);
}
 
Example #16
Source File: S3ClientSignedContentTest.java    From vertx-s3-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testCopyObjectError(TestContext testContext) throws IOException {
    mockCopyObjectErrorResponse(
            Header.header("X-Amz-Date", "20161110T130214Z"),
            Header.header("X-Amz-Content-Sha256", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"),
            Header.header("Authorization", "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20161110/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-copy-source;x-amz-date, Signature=f852af4f877c4f1522af892d11a4bd9a6a42327a67877916a8d57c3339f46d0b")
    );

    verifyCopyObjectErrorResponse(testContext);
}
 
Example #17
Source File: DownloaderTest.java    From phoenicis with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test
public void testGetDownloadFileFileIsDownloaded() throws Exception {
    mockServer.when(request().withMethod("GET").withPath("/test.txt")).respond(response().withStatusCode(200)
            .withHeaders(new Header("Content-Type", "application/config")).withBody("Content file to download"));

    File temporaryFile = File.createTempFile("test", "txt");
    temporaryFile.deleteOnExit();
    new Downloader(new FileSizeUtilities()).get(mockServerURL, temporaryFile, e -> {
    });

    String fileContent = IOUtils.toString(new FileReader(temporaryFile));

    assertEquals("Content file to download", fileContent);
}
 
Example #18
Source File: DownloaderTest.java    From phoenicis with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test
public void testGetDownloadFileInAStringFileIsDownloaded() throws Exception {
    mockServer.when(request().withMethod("GET").withPath("/test2.txt")).respond(response().withStatusCode(200)
            .withHeaders(new Header("Content-Type", "application/config")).withBody("Content file to download 2"));

    String result = new Downloader(new FileSizeUtilities()).get(mockServerURLFile2, e -> {
    });

    assertEquals("Content file to download 2", result);
}
 
Example #19
Source File: S3ClientSignedContentTest.java    From vertx-s3-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testHeadObjectError(TestContext testContext) throws IOException {
    mockHeadObjectErrorResponse(
            Header.header("X-Amz-Date", "20161110T130214Z"),
            Header.header("X-Amz-Content-Sha256", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"),
            Header.header("Authorization", "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20161110/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=5f5f4166a85b6963678cc951d1b851223869717a10d77465c85278f717e3073d")
    );

    verifyHeadObjectErrorResponse(testContext);
}
 
Example #20
Source File: S3ClientSignedContentTest.java    From vertx-s3-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testHeadObject(TestContext testContext) throws IOException {
    mockHeadObject(
            Header.header("X-Amz-Date", "20161110T130214Z"),
            Header.header("X-Amz-Content-Sha256", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"),
            Header.header("Authorization", "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20161110/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=5f5f4166a85b6963678cc951d1b851223869717a10d77465c85278f717e3073d")
    );

    verifyHeadObject(testContext);
}
 
Example #21
Source File: S3ClientSignedContentTest.java    From vertx-s3-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testInitMultipartUploadError(TestContext testContext) throws IOException {
    mockInitMultipartUploadErrorResponse(
            Header.header("X-Amz-Date", "20161110T130214Z"),
            Header.header("X-Amz-Content-Sha256", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"),
            Header.header("Authorization", "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20161110/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=592f1e6154deaa7d9b4e3dce4b4b4df68ebc3f92aa66d6eec83ee65150c31012")
    );

    verifyInitMultipartUploadErrorResponse(testContext);
}
 
Example #22
Source File: S3ClientSignedContentTest.java    From vertx-s3-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetObjectAcl(TestContext testContext) throws IOException {
    final AccessControlPolicy accessControlPolicy = new AccessControlPolicy(new Owner("someid", "somedisplayname"), Collections.singletonList(new Grant(new Grantee("id", "displayname"), Permission.FULL_CONTROL)));
    mockGetObjectAcl(
            accessControlPolicy,
            Header.header("X-Amz-Date", "20161110T130214Z"),
            Header.header("X-Amz-Content-Sha256", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"),
            Header.header("Authorization", "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20161110/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=e934d94af24578657a02c3ef1ee1d8d946c12f6e5ec11f3637fc99e5c118492e")
    );

    verifyGetObjectAcl(testContext, accessControlPolicy);
}
 
Example #23
Source File: S3ClientSignedContentTest.java    From vertx-s3-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetObjectError(TestContext testContext) throws IOException {
    mockGetObjectErrorResponse(
            Header.header("X-Amz-Date", "20161110T130214Z"),
            Header.header("X-Amz-Content-Sha256", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"),
            Header.header("Authorization", "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20161110/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=1312c94db8c2ad1d2d56d4c6bb16cdb7c0485b100b2baf2d8aabbb3fec0075fb")
    );

    verifyGetObjectErrorResponse(testContext);
}
 
Example #24
Source File: S3ClientSignedContentTest.java    From vertx-s3-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetObject(TestContext testContext) throws IOException {
    mockGetObject(
            Header.header("X-Amz-Date", "20161110T130214Z"),
            Header.header("X-Amz-Content-Sha256", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"),
            Header.header("Authorization", "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20161110/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=1312c94db8c2ad1d2d56d4c6bb16cdb7c0485b100b2baf2d8aabbb3fec0075fb")
    );

    verifyGetObject(testContext);
}
 
Example #25
Source File: S3ClientWithCredentialsTest.java    From vertx-s3-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testCopyObject(TestContext testContext) throws IOException {
    mockCopyObject(
            Header.header("X-Amz-Date", "20161110T130214Z"),
            Header.header("X-Amz-Content-Sha256", "UNSIGNED-PAYLOAD"),
            Header.header("Authorization", "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20161110/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-copy-source;x-amz-date, Signature=f4fb57b90ec37c3bb9b437cff5f3fd164d81cbe2ff13f9223b20d3c899f50036")
    );

    verifyCopyObject(testContext);
}
 
Example #26
Source File: S3ClientWithCredentialsTest.java    From vertx-s3-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testDeleteObject(TestContext testContext) throws IOException {
    mockDeleteObject(
            Header.header("X-Amz-Date", "20161110T130214Z"),
            Header.header("X-Amz-Content-Sha256", "UNSIGNED-PAYLOAD"),
            Header.header("Authorization", "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20161110/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=7a119f6c4ce49d2a0eaffd7511d203523b1e2435837f5916d0bd8c08123d4eaa")
    );

    verifyDeleteObject(testContext);
}
 
Example #27
Source File: S3ClientWithCredentialsTest.java    From vertx-s3-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testAbortMultipartUpload(TestContext testContext) throws IOException {
    mockAbortMultipartUpload(
            "someid",
            Header.header("X-Amz-Date", "20161110T130214Z"),
            Header.header("X-Amz-Content-Sha256", "UNSIGNED-PAYLOAD"),
            Header.header("Authorization", "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20161110/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=f5b73d8b2a130264055219a27f1e9dece8f955431b282a5f8c930846aeabd59a")
    );

    verifyAbortMultipartUpload(testContext, "someid");
}
 
Example #28
Source File: S3ClientWithCredentialsTest.java    From vertx-s3-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testCompleteMultipartUpload(TestContext testContext) throws IOException {
    mockCompleteMultipartUpload(
            "someid",
            Header.header("X-Amz-Date", "20161110T130214Z"),
            Header.header("X-Amz-Content-Sha256", "UNSIGNED-PAYLOAD"),
            Header.header("Authorization", "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20161110/us-east-1/service/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature=bd1a4688a9f54536517dbb4a2a3ddfcd762f955950170a1dad75085a990586e4")
    );

    verifyCompleteMultipartUpload(testContext, "someid");
}
 
Example #29
Source File: S3ClientWithCredentialsTest.java    From vertx-s3-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testContinueMultipartUpload(TestContext testContext) throws IOException {
    mockContinueMultipartUpload(
            1,
            "someid",
            Header.header("X-Amz-Date", "20161110T130214Z"),
            Header.header("X-Amz-Content-Sha256", "UNSIGNED-PAYLOAD"),
            Header.header("Authorization", "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20161110/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=2e50b12ee253fa9e8be77d64d3a06adbf066fe9eef3d97332676bdacf5860e2a")
    );

    verifyContinueMultipartUpload(testContext, 1, "someid");
}
 
Example #30
Source File: S3ClientWithCredentialsTest.java    From vertx-s3-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testInitMultipartUpload(TestContext testContext) throws IOException {
    mockInitMultipartUpload(
            UUID.randomUUID().toString(),
            Header.header("X-Amz-Date", "20161110T130214Z"),
            Header.header("X-Amz-Content-Sha256", "UNSIGNED-PAYLOAD"),
            Header.header("Authorization", "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20161110/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=18d1d5fe4511763bc95c86e532e492467848c80c1b8f0cab745cf2ac2a7dcc5f")
    );

    verifyInitMultipartUpload(testContext);
}