You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by zh...@apache.org on 2022/04/15 00:43:24 UTC
[camel-quarkus] branch main updated: Fix #3728 AWS S3 integration test should remove all objects in finally block (#3729)
This is an automated email from the ASF dual-hosted git repository.
zhfeng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/main by this push:
new ec671ceb29 Fix #3728 AWS S3 integration test should remove all objects in finally block (#3729)
ec671ceb29 is described below
commit ec671ceb29c7479745f26c31ae6c73c970d16f81
Author: Amos Feng <zh...@gmail.com>
AuthorDate: Fri Apr 15 08:43:18 2022 +0800
Fix #3728 AWS S3 integration test should remove all objects in finally block (#3729)
---
.../quarkus/component/aws2/s3/it/Aws2S3Test.java | 117 +++++++++++----------
1 file changed, 63 insertions(+), 54 deletions(-)
diff --git a/integration-test-groups/aws2/aws2-s3/src/test/java/org/apache/camel/quarkus/component/aws2/s3/it/Aws2S3Test.java b/integration-test-groups/aws2/aws2-s3/src/test/java/org/apache/camel/quarkus/component/aws2/s3/it/Aws2S3Test.java
index faa494fd17..fd81560af9 100644
--- a/integration-test-groups/aws2/aws2-s3/src/test/java/org/apache/camel/quarkus/component/aws2/s3/it/Aws2S3Test.java
+++ b/integration-test-groups/aws2/aws2-s3/src/test/java/org/apache/camel/quarkus/component/aws2/s3/it/Aws2S3Test.java
@@ -164,22 +164,24 @@ class Aws2S3Test {
final String oid = UUID.randomUUID().toString();
final String blobContent = "Hello KMS " + oid;
- // Create
- RestAssured.given()
- .contentType(ContentType.TEXT)
- .body(blobContent)
- .post("/aws2/s3/object/" + oid + "?useKms=true")
- .then()
- .statusCode(201);
-
- // Read
- RestAssured.get("/aws2/s3/object/" + oid + "?useKms=true")
- .then()
- .statusCode(200)
- .body(is(blobContent));
+ try {
+ // Create
+ RestAssured.given()
+ .contentType(ContentType.TEXT)
+ .body(blobContent)
+ .post("/aws2/s3/object/" + oid + "?useKms=true")
+ .then()
+ .statusCode(201);
- // Delete
- deleteObject(oid);
+ // Read
+ RestAssured.get("/aws2/s3/object/" + oid + "?useKms=true")
+ .then()
+ .statusCode(200)
+ .body(is(blobContent));
+ } finally {
+ // Delete
+ deleteObject(oid);
+ }
}
@Test
@@ -187,24 +189,26 @@ class Aws2S3Test {
final String oid = UUID.randomUUID().toString();
final String content = RandomStringUtils.randomAlphabetic(8 * 1024 * 1024);
- RestAssured.given()
- .contentType(ContentType.TEXT)
- .body(content)
- .post("/aws2/s3/upload/" + oid)
- .then()
- .statusCode(200);
-
- String result = RestAssured.get("/aws2/s3/object/" + oid)
- .then()
- .statusCode(200)
- .extract().asString();
+ try {
+ RestAssured.given()
+ .contentType(ContentType.TEXT)
+ .body(content)
+ .post("/aws2/s3/upload/" + oid)
+ .then()
+ .statusCode(200);
- // Delete
- deleteObject(oid);
+ String result = RestAssured.get("/aws2/s3/object/" + oid)
+ .then()
+ .statusCode(200)
+ .extract().asString();
- // strip the chuck-signature
- result = result.replaceAll("\\s*[0-9]+;chunk-signature=\\w{64}\\s*", "");
- assertEquals(content, result);
+ // strip the chuck-signature
+ result = result.replaceAll("\\s*[0-9]+;chunk-signature=\\w{64}\\s*", "");
+ assertEquals(content, result);
+ } finally {
+ // Delete
+ deleteObject(oid);
+ }
}
@Test
@@ -284,18 +288,21 @@ class Aws2S3Test {
final String oid = UUID.randomUUID().toString();
final String blobContent = "Hello " + oid;
- // Create
- createObject(oid, blobContent);
+ try {
+ // Create
+ createObject(oid, blobContent);
- // Download link
- RestAssured.given()
- .contentType(ContentType.TEXT)
- .get("/aws2/s3/downloadlink/" + oid)
- .then()
- .statusCode(200);
+ // Download link
+ RestAssured.given()
+ .contentType(ContentType.TEXT)
+ .get("/aws2/s3/downloadlink/" + oid)
+ .then()
+ .statusCode(200);
- // Delete
- deleteObject(oid);
+ } finally {
+ // Delete
+ deleteObject(oid);
+ }
}
@Test
@@ -303,20 +310,22 @@ class Aws2S3Test {
final String oid = UUID.randomUUID().toString();
final String blobContent = "Hello " + oid;
- // Create
- createObject(oid, blobContent);
-
- // Object range
- RestAssured.given()
- .contentType(ContentType.TEXT)
- .param("start", "0").param("end", "4")
- .get("/aws2/s3/object/range/" + oid)
- .then()
- .statusCode(200)
- .body(is("Hello"));
+ try {
+ // Create
+ createObject(oid, blobContent);
- // Delete
- deleteObject(oid);
+ // Object range
+ RestAssured.given()
+ .contentType(ContentType.TEXT)
+ .param("start", "0").param("end", "4")
+ .get("/aws2/s3/object/range/" + oid)
+ .then()
+ .statusCode(200)
+ .body(is("Hello"));
+ } finally {
+ // Delete
+ deleteObject(oid);
+ }
}
private void createObject(String oid, String blobContent) {