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 4b7ced5c99a1e4365a7aff718e56aa0cd812972e Author: Andrea Cosentino <[email protected]> AuthorDate: Fri Apr 10 14:53:56 2020 +0200 CAMEL-14868 - Camel-AWS2-*: Where possible, give the possiblity to the end user to pass an AWS Request pojo as body, aws2-eks added Spring test --- .../component/aws2/eks/EKS2ProducerSpringTest.java | 22 +++++++++++++++++++++- .../aws2/eks/EKSComponentSpringTest-context.xml | 5 +++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/components/camel-aws2-eks/src/test/java/org/apache/camel/component/aws2/eks/EKS2ProducerSpringTest.java b/components/camel-aws2-eks/src/test/java/org/apache/camel/component/aws2/eks/EKS2ProducerSpringTest.java index d224900..7b25274 100644 --- a/components/camel-aws2-eks/src/test/java/org/apache/camel/component/aws2/eks/EKS2ProducerSpringTest.java +++ b/components/camel-aws2-eks/src/test/java/org/apache/camel/component/aws2/eks/EKS2ProducerSpringTest.java @@ -26,6 +26,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; import software.amazon.awssdk.services.eks.model.CreateClusterResponse; import software.amazon.awssdk.services.eks.model.DeleteClusterResponse; import software.amazon.awssdk.services.eks.model.DescribeClusterResponse; +import software.amazon.awssdk.services.eks.model.ListClustersRequest; import software.amazon.awssdk.services.eks.model.ListClustersResponse; import software.amazon.awssdk.services.eks.model.VpcConfigRequest; @@ -37,7 +38,7 @@ public class EKS2ProducerSpringTest extends CamelSpringTestSupport { private MockEndpoint mock; @Test - public void kmsListClustersTest() throws Exception { + public void eksListClustersTest() throws Exception { mock.expectedMessageCount(1); Exchange exchange = template.request("direct:listClusters", new Processor() { @@ -53,6 +54,25 @@ public class EKS2ProducerSpringTest extends CamelSpringTestSupport { assertEquals(1, resultGet.clusters().size()); assertEquals("Test", resultGet.clusters().get(0)); } + + @Test + public void eksListClustersPojoTest() throws Exception { + + mock.expectedMessageCount(1); + Exchange exchange = template.request("direct:listPojoClusters", new Processor() { + @Override + public void process(Exchange exchange) throws Exception { + exchange.getIn().setHeader(EKS2Constants.OPERATION, EKS2Operations.listClusters); + exchange.getIn().setBody(ListClustersRequest.builder().maxResults(12).build()); + } + }); + + assertMockEndpointsSatisfied(); + + ListClustersResponse resultGet = (ListClustersResponse)exchange.getIn().getBody(); + assertEquals(1, resultGet.clusters().size()); + assertEquals("Test", resultGet.clusters().get(0)); + } @Test public void eksCreateClusterTest() throws Exception { diff --git a/components/camel-aws2-eks/src/test/resources/org/apache/camel/component/aws2/eks/EKSComponentSpringTest-context.xml b/components/camel-aws2-eks/src/test/resources/org/apache/camel/component/aws2/eks/EKSComponentSpringTest-context.xml index dae4097..4fbd666 100644 --- a/components/camel-aws2-eks/src/test/resources/org/apache/camel/component/aws2/eks/EKSComponentSpringTest-context.xml +++ b/components/camel-aws2-eks/src/test/resources/org/apache/camel/component/aws2/eks/EKSComponentSpringTest-context.xml @@ -30,6 +30,11 @@ <to uri="mock:result"/> </route> <route> + <from uri="direct:listPojoClusters"/> + <to uri="aws2-eks://test?eksClient=#amazonEksClient&operation=listClusters&pojoRequest=true"/> + <to uri="mock:result"/> + </route> + <route> <from uri="direct:createCluster"/> <to uri="aws2-eks://test?eksClient=#amazonEksClient&operation=createCluster"/> <to uri="mock:result"/>
