You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/08/04 13:09:29 UTC
[GitHub] [camel-quarkus] JiriOndrusek opened a new pull request #2988: Expand AWS DDB tests #2776
JiriOndrusek opened a new pull request #2988:
URL: https://github.com/apache/camel-quarkus/pull/2988
fixes https://github.com/apache/camel-quarkus/issues/2776
There are several items, which has to be handled separately:
1. Test for aws2-ddbstream **Batch consumer** is not prepared, because camel component does not implement batch consumer interface correctly. Reported as a [CAMEL-16837](https://issues.apache.org/jira/browse/CAMEL-16837). Reminder issue in camel-quarkus will be created.
2. Usage of `quarkus-amazon-dynamodb` is possible. There is a limitation in the current camel-quarkus extension implementation. It is possible to laverage `quarkus-apache-httpclient`, but it is not possible to use `url-connection-client`. It could be doable, but new ticket reporting this issue will be created.
3. New issue to document current status (see item 2) will be created.
<!-- Uncomment and fill this section if your PR is not trivial
[ ] An issue should be filed for the change unless this is a trivial change (fixing a typo or similar). One issue should ideally be fixed by not more than one commit and the other way round, each commit should fix just one issue, without pulling in other changes.
[ ] Each commit in the pull request should have a meaningful and properly spelled subject line and body. Copying the title of the associated issue is typically enough. Please include the issue number in the commit message prefixed by #.
[ ] The pull request description should explain what the pull request does, how, and why. If the info is available in the associated issue or some other external document, a link is enough.
[ ] Phrases like Fix #<issueNumber> or Fixes #<issueNumber> will auto-close the named issue upon merging the pull request. Using them is typically a good idea.
[ ] Please run mvn process-resources -Pformat (and amend the changes if necessary) before sending the pull request.
[ ] Contributor guide is your good friend: https://camel.apache.org/camel-quarkus/latest/contributor-guide.html
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #2988: Expand AWS DDB tests #2776
Posted by GitBox <gi...@apache.org>.
ppalaga commented on a change in pull request #2988:
URL: https://github.com/apache/camel-quarkus/pull/2988#discussion_r683162597
##########
File path: integration-test-groups/aws2/aws2-ddb/src/test/java/org/apache/camel/quarkus/component/aws2/ddb/it/Aws2DdbTest.java
##########
@@ -139,31 +111,183 @@ public void crud() {
},
Matchers.is(204));
- Awaitility.await().atMost(120, TimeUnit.SECONDS).until(
+ }
+
+ @Test
+ public void operations() {
+
+ final String key1 = "key-1-" + UUID.randomUUID().toString().replace("-", "");
+ final String msg1 = "val-1-" + UUID.randomUUID().toString().replace("-", "");
+ final String key2 = "key-2-" + UUID.randomUUID().toString().replace("-", "");
+ final String msg2 = "val-2-" + UUID.randomUUID().toString().replace("-", "");
+ final String key3 = "key-3-" + UUID.randomUUID().toString().replace("-", "");
+ final String msg3 = "val-3-" + UUID.randomUUID().toString().replace("-", "");
+
+ RestAssured.given()
+ .contentType(ContentType.TEXT)
+ .queryParam("table", Table.operations)
+ .body(msg1)
+ .post("/aws2-ddb/item/" + key1)
+ .then()
+ .statusCode(201);
+
+ RestAssured.given()
+ .contentType(ContentType.TEXT)
+ .body(msg2)
+ .queryParam("table", Table.operations)
+ .post("/aws2-ddb/item/" + key2)
+ .then()
+ .statusCode(201);
+
+ RestAssured.given()
+ .contentType(ContentType.TEXT)
+ .body(msg3)
+ .queryParam("table", Table.operations)
+ .post("/aws2-ddb/item/" + key3)
+ .then()
+ .statusCode(201);
+
+ /* Batch items */
+ Awaitility.await().pollInterval(1, TimeUnit.SECONDS).atMost(120, TimeUnit.SECONDS).until(
+ () -> {
+
+ ExtractableResponse<Response> result = RestAssured.given()
+ .contentType(ContentType.JSON)
+ .body(Stream.of(key1, key2).collect(Collectors.toList()))
+ .post("/aws2-ddb/batchItems")
+ .then()
+ .statusCode(200)
+ .extract();
+
+ LOG.info("Expecting 2 items, got " + result.statusCode() + ": " + result.body().asString());
+
+ return result.jsonPath().getMap("$");
+ },
+ /* Both inserted pairs have to be returned */
+ map -> map.size() == 2
+ && msg1.equals(map.get(key1))
+ && msg2.equals(map.get(key2)));
+
+ /* Query */
+ Awaitility.await().pollInterval(1, TimeUnit.SECONDS).atMost(120, TimeUnit.SECONDS).until(
() -> {
- ExtractableResponse<Response> result = RestAssured.get("/aws2-ddbstream/change")
+ ExtractableResponse<Response> result = RestAssured.given()
+ .contentType(ContentType.JSON)
+ .body(key3)
+ .post("/aws2-ddb/query")
.then()
.statusCode(200)
.extract();
- LOG.info("Expecting 3 events got " + result.statusCode() + ": " + result.body().asString());
- List<Map> retVal = result.jsonPath().getList("$", Map.class);
- //remove init events
- return retVal.stream().filter(m -> !String.valueOf(m.get("key")).startsWith("initKey"))
- .collect(Collectors.toList());
+ LOG.info("Expecting 1 item, got " + result.statusCode() + ": " + result.body().asString());
+
+ return result.jsonPath().getMap("$");
},
- /* The above actions should trigger the following three change events (initEvent is also present) */
- list -> list.size() == 3
+ map -> map.size() == 1
+ && msg3.equals(map.get(key3)));
+
+ /* Scan */
+ Awaitility.await().pollInterval(1, TimeUnit.SECONDS).atMost(120, TimeUnit.SECONDS).until(
+ () -> {
+ ExtractableResponse<Response> result = RestAssured.get("/aws2-ddb/scan")
+ .then()
+ .statusCode(200)
+ .extract();
- && key.equals(list.get(0).get("key"))
- && msg.equals(list.get(0).get("new"))
+ LOG.info("Expecting 3 items, got " + result.statusCode() + ": " + result.body().asString());
- && key.equals(list.get(1).get("key"))
- && msg.equals(list.get(1).get("old"))
- && newMsg.equals(list.get(1).get("new"))
+ return result.jsonPath().getMap("$");
+ },
+ map -> map.size() == 3
+ && msg1.equals(map.get(key1))
+ && msg2.equals(map.get(key2))
+ && msg3.equals(map.get(key3)));
- && key.equals(list.get(2).get("key"))
- && newMsg.equals(list.get(2).get("old")));
+ /* Describe table */
+ Awaitility.await().pollInterval(1, TimeUnit.SECONDS).atMost(120, TimeUnit.SECONDS).until(
+ () -> {
+ ExtractableResponse<Response> result = RestAssured.given()
+ .contentType(ContentType.JSON)
+ .body(Ddb2Operations.DescribeTable)
+ .post("/aws2-ddb/operation")
+ .then()
+ .statusCode(200)
+ .extract();
+
+ LOG.info("Expecting table description, got " + result.statusCode() + ": " + result.body().asString());
+
+ return result.jsonPath().getMap("$");
+ },
+ map -> map.size() == 8
+ && map.containsKey(Ddb2Constants.CREATION_DATE)
+ && map.containsKey(Ddb2Constants.READ_CAPACITY)
+ && TableStatus.ACTIVE.name().equals(map.get(Ddb2Constants.TABLE_STATUS))
+ && map.containsKey(Ddb2Constants.WRITE_CAPACITY)
+ && map.containsKey(Ddb2Constants.TABLE_SIZE)
+ && map.containsKey(Ddb2Constants.KEY_SCHEMA)
+ && map.containsKey(Ddb2Constants.ITEM_COUNT)
+ && Table.operations == Table.valueOf((String) map.get(Ddb2Constants.TABLE_NAME)));
Review comment:
Does DescribeTable need to be enclosed in await()? Maybe TableStatus is not active initially?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] JiriOndrusek edited a comment on pull request #2988: Expand AWS DDB tests #2776
Posted by GitBox <gi...@apache.org>.
JiriOndrusek edited a comment on pull request #2988:
URL: https://github.com/apache/camel-quarkus/pull/2988#issuecomment-892739650
Item 4 is not valid anymore. Current PR **doesn't verify that extension works when quarkus-amazon-dynamodb is in the class path.**, because using `@Inject DynamoDbClient` causes problem in integration-tests/aws (grouped tests). I'll add task to investigate how to solve this problem in existing [issue #2990](https://github.com/apache/camel-quarkus/issues/2990).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #2988: Expand AWS DDB tests #2776
Posted by GitBox <gi...@apache.org>.
ppalaga commented on a change in pull request #2988:
URL: https://github.com/apache/camel-quarkus/pull/2988#discussion_r683162597
##########
File path: integration-test-groups/aws2/aws2-ddb/src/test/java/org/apache/camel/quarkus/component/aws2/ddb/it/Aws2DdbTest.java
##########
@@ -139,31 +111,183 @@ public void crud() {
},
Matchers.is(204));
- Awaitility.await().atMost(120, TimeUnit.SECONDS).until(
+ }
+
+ @Test
+ public void operations() {
+
+ final String key1 = "key-1-" + UUID.randomUUID().toString().replace("-", "");
+ final String msg1 = "val-1-" + UUID.randomUUID().toString().replace("-", "");
+ final String key2 = "key-2-" + UUID.randomUUID().toString().replace("-", "");
+ final String msg2 = "val-2-" + UUID.randomUUID().toString().replace("-", "");
+ final String key3 = "key-3-" + UUID.randomUUID().toString().replace("-", "");
+ final String msg3 = "val-3-" + UUID.randomUUID().toString().replace("-", "");
+
+ RestAssured.given()
+ .contentType(ContentType.TEXT)
+ .queryParam("table", Table.operations)
+ .body(msg1)
+ .post("/aws2-ddb/item/" + key1)
+ .then()
+ .statusCode(201);
+
+ RestAssured.given()
+ .contentType(ContentType.TEXT)
+ .body(msg2)
+ .queryParam("table", Table.operations)
+ .post("/aws2-ddb/item/" + key2)
+ .then()
+ .statusCode(201);
+
+ RestAssured.given()
+ .contentType(ContentType.TEXT)
+ .body(msg3)
+ .queryParam("table", Table.operations)
+ .post("/aws2-ddb/item/" + key3)
+ .then()
+ .statusCode(201);
+
+ /* Batch items */
+ Awaitility.await().pollInterval(1, TimeUnit.SECONDS).atMost(120, TimeUnit.SECONDS).until(
+ () -> {
+
+ ExtractableResponse<Response> result = RestAssured.given()
+ .contentType(ContentType.JSON)
+ .body(Stream.of(key1, key2).collect(Collectors.toList()))
+ .post("/aws2-ddb/batchItems")
+ .then()
+ .statusCode(200)
+ .extract();
+
+ LOG.info("Expecting 2 items, got " + result.statusCode() + ": " + result.body().asString());
+
+ return result.jsonPath().getMap("$");
+ },
+ /* Both inserted pairs have to be returned */
+ map -> map.size() == 2
+ && msg1.equals(map.get(key1))
+ && msg2.equals(map.get(key2)));
+
+ /* Query */
+ Awaitility.await().pollInterval(1, TimeUnit.SECONDS).atMost(120, TimeUnit.SECONDS).until(
() -> {
- ExtractableResponse<Response> result = RestAssured.get("/aws2-ddbstream/change")
+ ExtractableResponse<Response> result = RestAssured.given()
+ .contentType(ContentType.JSON)
+ .body(key3)
+ .post("/aws2-ddb/query")
.then()
.statusCode(200)
.extract();
- LOG.info("Expecting 3 events got " + result.statusCode() + ": " + result.body().asString());
- List<Map> retVal = result.jsonPath().getList("$", Map.class);
- //remove init events
- return retVal.stream().filter(m -> !String.valueOf(m.get("key")).startsWith("initKey"))
- .collect(Collectors.toList());
+ LOG.info("Expecting 1 item, got " + result.statusCode() + ": " + result.body().asString());
+
+ return result.jsonPath().getMap("$");
},
- /* The above actions should trigger the following three change events (initEvent is also present) */
- list -> list.size() == 3
+ map -> map.size() == 1
+ && msg3.equals(map.get(key3)));
+
+ /* Scan */
+ Awaitility.await().pollInterval(1, TimeUnit.SECONDS).atMost(120, TimeUnit.SECONDS).until(
+ () -> {
+ ExtractableResponse<Response> result = RestAssured.get("/aws2-ddb/scan")
+ .then()
+ .statusCode(200)
+ .extract();
- && key.equals(list.get(0).get("key"))
- && msg.equals(list.get(0).get("new"))
+ LOG.info("Expecting 3 items, got " + result.statusCode() + ": " + result.body().asString());
- && key.equals(list.get(1).get("key"))
- && msg.equals(list.get(1).get("old"))
- && newMsg.equals(list.get(1).get("new"))
+ return result.jsonPath().getMap("$");
+ },
+ map -> map.size() == 3
+ && msg1.equals(map.get(key1))
+ && msg2.equals(map.get(key2))
+ && msg3.equals(map.get(key3)));
- && key.equals(list.get(2).get("key"))
- && newMsg.equals(list.get(2).get("old")));
+ /* Describe table */
+ Awaitility.await().pollInterval(1, TimeUnit.SECONDS).atMost(120, TimeUnit.SECONDS).until(
+ () -> {
+ ExtractableResponse<Response> result = RestAssured.given()
+ .contentType(ContentType.JSON)
+ .body(Ddb2Operations.DescribeTable)
+ .post("/aws2-ddb/operation")
+ .then()
+ .statusCode(200)
+ .extract();
+
+ LOG.info("Expecting table description, got " + result.statusCode() + ": " + result.body().asString());
+
+ return result.jsonPath().getMap("$");
+ },
+ map -> map.size() == 8
+ && map.containsKey(Ddb2Constants.CREATION_DATE)
+ && map.containsKey(Ddb2Constants.READ_CAPACITY)
+ && TableStatus.ACTIVE.name().equals(map.get(Ddb2Constants.TABLE_STATUS))
+ && map.containsKey(Ddb2Constants.WRITE_CAPACITY)
+ && map.containsKey(Ddb2Constants.TABLE_SIZE)
+ && map.containsKey(Ddb2Constants.KEY_SCHEMA)
+ && map.containsKey(Ddb2Constants.ITEM_COUNT)
+ && Table.operations == Table.valueOf((String) map.get(Ddb2Constants.TABLE_NAME)));
Review comment:
Does DescribeTable need to be enclosed in await()? Maybe TableStatus is not active initially?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #2988: Expand AWS DDB tests #2776
Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on pull request #2988:
URL: https://github.com/apache/camel-quarkus/pull/2988#issuecomment-892739650
Item 4 is not valid anymore. Current PT**doesn't verify that extension works when quarkus-amazon-dynamodb is in the class path.**, because using `@Inject DynamoDbClient` causes problem in integration-tests/aws (grouped tests). I'll add task to investigate how to solve this problem in existing [issue #2990](https://github.com/apache/camel-quarkus/issues/2990).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] JiriOndrusek edited a comment on pull request #2988: Expand AWS DDB tests #2776
Posted by GitBox <gi...@apache.org>.
JiriOndrusek edited a comment on pull request #2988:
URL: https://github.com/apache/camel-quarkus/pull/2988#issuecomment-892739650
Item 4 is not valid anymore. Current PR **doesn't verify that extension works when quarkus-amazon-dynamodb is in the class path.**, because using `@Inject DynamoDbClient` causes problem in integration-tests/aws (grouped tests). I'll add task to investigate how to solve this problem in existing [issue #2990](https://github.com/apache/camel-quarkus/issues/2990).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #2988: Expand AWS DDB tests #2776
Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on pull request #2988:
URL: https://github.com/apache/camel-quarkus/pull/2988#issuecomment-892660675
@ppalaga Item 4 is not nice, we can document it. Do you think that it is enough? (it seems that autowiring of the client doesn't trigger condition required for `quarkus-amazon-dynamodb`)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #2988: Expand AWS DDB tests #2776
Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on pull request #2988:
URL: https://github.com/apache/camel-quarkus/pull/2988#issuecomment-892660675
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] ppalaga merged pull request #2988: Expand AWS DDB tests #2776
Posted by GitBox <gi...@apache.org>.
ppalaga merged pull request #2988:
URL: https://github.com/apache/camel-quarkus/pull/2988
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #2988: Expand AWS DDB tests #2776
Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on pull request #2988:
URL: https://github.com/apache/camel-quarkus/pull/2988#issuecomment-892661605
Or we can ask quarkus team to allow creation of the client even if there is no obvious registration of such a bean.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] ppalaga merged pull request #2988: Expand AWS DDB tests #2776
Posted by GitBox <gi...@apache.org>.
ppalaga merged pull request #2988:
URL: https://github.com/apache/camel-quarkus/pull/2988
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org