You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2020/04/16 07:42:51 UTC
[camel] 09/09: CAMEL-14868 - Camel-AWS2-*: Where possible,
give the possiblity to the end user to pass an AWS Request pojo as
body, aws2-msk add spring test
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 8e97606740aab2913886e8e6fd4f36383b525ed6
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Apr 16 09:41:34 2020 +0200
CAMEL-14868 - Camel-AWS2-*: Where possible, give the possiblity to the end user to pass an AWS Request pojo as body, aws2-msk add spring test
---
.../component/aws2/msk/MSKProducerSpringTest.java | 19 +++++++++++++++++++
.../aws2/msk/MSKComponentSpringTest-context.xml | 6 ++++++
2 files changed, 25 insertions(+)
diff --git a/components/camel-aws2-msk/src/test/java/org/apache/camel/component/aws2/msk/MSKProducerSpringTest.java b/components/camel-aws2-msk/src/test/java/org/apache/camel/component/aws2/msk/MSKProducerSpringTest.java
index a3c4276..f282c2a 100644
--- a/components/camel-aws2-msk/src/test/java/org/apache/camel/component/aws2/msk/MSKProducerSpringTest.java
+++ b/components/camel-aws2-msk/src/test/java/org/apache/camel/component/aws2/msk/MSKProducerSpringTest.java
@@ -28,6 +28,7 @@ import software.amazon.awssdk.services.kafka.model.ClusterState;
import software.amazon.awssdk.services.kafka.model.CreateClusterResponse;
import software.amazon.awssdk.services.kafka.model.DeleteClusterResponse;
import software.amazon.awssdk.services.kafka.model.DescribeClusterResponse;
+import software.amazon.awssdk.services.kafka.model.ListClustersRequest;
import software.amazon.awssdk.services.kafka.model.ListClustersResponse;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -53,6 +54,24 @@ public class MSKProducerSpringTest extends CamelSpringTestSupport {
assertEquals(1, resultGet.clusterInfoList().size());
assertEquals("test-kafka", resultGet.clusterInfoList().get(0).clusterName());
}
+
+ @Test
+ public void mskListKeysPojoTest() throws Exception {
+
+ mock.expectedMessageCount(1);
+ Exchange exchange = template.request("direct:listClustersPojo", new Processor() {
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ exchange.getIn().setBody(ListClustersRequest.builder().maxResults(10).build());
+ }
+ });
+
+ assertMockEndpointsSatisfied();
+
+ ListClustersResponse resultGet = (ListClustersResponse)exchange.getIn().getBody();
+ assertEquals(1, resultGet.clusterInfoList().size());
+ assertEquals("test-kafka", resultGet.clusterInfoList().get(0).clusterName());
+ }
@Test
public void mskCreateClusterTest() throws Exception {
diff --git a/components/camel-aws2-msk/src/test/resources/org/apache/camel/component/aws2/msk/MSKComponentSpringTest-context.xml b/components/camel-aws2-msk/src/test/resources/org/apache/camel/component/aws2/msk/MSKComponentSpringTest-context.xml
index 39287e5..dece2c2 100644
--- a/components/camel-aws2-msk/src/test/resources/org/apache/camel/component/aws2/msk/MSKComponentSpringTest-context.xml
+++ b/components/camel-aws2-msk/src/test/resources/org/apache/camel/component/aws2/msk/MSKComponentSpringTest-context.xml
@@ -29,6 +29,12 @@
<to uri="aws2-msk://Test?mskClient=#amazonMskClient&operation=listClusters"/>
<to uri="mock:result"/>
</route>
+
+ <route>
+ <from uri="direct:listClustersPojo"/>
+ <to uri="aws2-msk://Test?mskClient=#amazonMskClient&operation=listClusters&pojoRequest=true"/>
+ <to uri="mock:result"/>
+ </route>
<route>
<from uri="direct:createCluster"/>