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 e9998840238aa8397698f692c827b29520606666
Author: Andrea Cosentino <anco...@gmail.com>
AuthorDate: Wed Mar 21 15:33:00 2018 +0100

    CAMEL-12388 - Camel AWS-KMS: Add describeKey operation - Spring test
---
 .../component/aws/kms/KMSProducerSpringTest.java    | 21 +++++++++++++++++++++
 .../aws/kms/KMSComponentSpringTest-context.xml      |  5 +++++
 2 files changed, 26 insertions(+)

diff --git 
a/components/camel-aws/src/test/java/org/apache/camel/component/aws/kms/KMSProducerSpringTest.java
 
b/components/camel-aws/src/test/java/org/apache/camel/component/aws/kms/KMSProducerSpringTest.java
index 740e6dc..f58cf3b 100644
--- 
a/components/camel-aws/src/test/java/org/apache/camel/component/aws/kms/KMSProducerSpringTest.java
+++ 
b/components/camel-aws/src/test/java/org/apache/camel/component/aws/kms/KMSProducerSpringTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.aws.kms;
 
 import com.amazonaws.services.kms.model.CreateKeyResult;
+import com.amazonaws.services.kms.model.DescribeKeyResult;
 import com.amazonaws.services.kms.model.ListKeysResult;
 import com.amazonaws.services.kms.model.ScheduleKeyDeletionResult;
 
@@ -102,6 +103,26 @@ public class KMSProducerSpringTest extends 
CamelSpringTestSupport {
         ScheduleKeyDeletionResult resultGet = (ScheduleKeyDeletionResult) 
exchange.getIn().getBody();
         assertEquals("test", resultGet.getKeyId());
     }
+    
+    @Test
+    public void kmsDescribeKeyTest() throws Exception {
+
+        mock.expectedMessageCount(1);
+        Exchange exchange = template.request("direct:describeKey", new 
Processor() {
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setHeader(KMSConstants.OPERATION, 
KMSOperations.describeKey);
+                exchange.getIn().setHeader(KMSConstants.KEY_ID, "test");
+            }
+        });
+
+        assertMockEndpointsSatisfied();
+        
+        DescribeKeyResult resultGet = 
exchange.getIn().getBody(DescribeKeyResult.class);
+        assertEquals("test", resultGet.getKeyMetadata().getKeyId());
+        assertEquals("MyCamelKey", 
resultGet.getKeyMetadata().getDescription());
+        assertFalse(resultGet.getKeyMetadata().isEnabled());
+    }
 
     @Override
     protected ClassPathXmlApplicationContext createApplicationContext() {
diff --git 
a/components/camel-aws/src/test/resources/org/apache/camel/component/aws/kms/KMSComponentSpringTest-context.xml
 
b/components/camel-aws/src/test/resources/org/apache/camel/component/aws/kms/KMSComponentSpringTest-context.xml
index 9e99fe0..eaeaa41 100644
--- 
a/components/camel-aws/src/test/resources/org/apache/camel/component/aws/kms/KMSComponentSpringTest-context.xml
+++ 
b/components/camel-aws/src/test/resources/org/apache/camel/component/aws/kms/KMSComponentSpringTest-context.xml
@@ -44,6 +44,11 @@
             <to 
uri="aws-kms://Test?kmsClient=#amazonKmsClient&amp;operation=scheduleKeyDeletion"/>
             <to uri="mock:result"/>
         </route>
+        <route>
+            <from uri="direct:describeKey"/>
+            <to 
uri="aws-kms://Test?kmsClient=#amazonKmsClient&amp;operation=describeKey"/>
+            <to uri="mock:result"/>
+        </route>
     </camelContext>
 
     <bean id="amazonKmsClient" 
class="org.apache.camel.component.aws.kms.AmazonKMSClientMock"/>

-- 
To stop receiving notification emails like this one, please contact
acosent...@apache.org.

Reply via email to