[camel] branch master updated (36140f5 -> fbe6416)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[camel] branch master updated (36140f5 -> fbe6416)

acosentino
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 36140f5  Camel-Infinispan: more Cleanup
     new dd98738  Camel-AWS2-SNS: Migrated tests to Junit5
     new fbe6416  Camel-AWS2-SNS: Fixed CS

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 components/camel-aws2-sns/pom.xml                  | 24 +++++++++++++++-------
 .../component/aws2/sns/AmazonSNSClientMock.java    |  9 ++++----
 .../aws2/sns/SNSComponentClientRegistryTest.java   | 13 ++++++++----
 .../aws2/sns/SnsComponentConfigurationTest.java    | 21 +++++++++++++------
 .../component/aws2/sns/SnsComponentSpringTest.java |  6 ++++--
 .../camel/component/aws2/sns/SnsComponentTest.java |  6 ++++--
 .../sns/SnsComponentVerifierExtensionTest.java     | 11 +++++-----
 .../camel/component/aws2/sns/SnsProducerTest.java  | 14 ++++++-------
 .../integration/SnsComponentIntegrationTest.java   | 10 +++++----
 .../SnsTopicWithKmsEncryptionIntegrationTest.java  | 10 +++++----
 .../component/jcache/policy/hazelcast-spring.xml   |  2 +-
 11 files changed, 80 insertions(+), 46 deletions(-)

Reply | Threaded
Open this post in threaded view
|

[camel] 01/02: Camel-AWS2-SNS: Migrated tests to Junit5

acosentino
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 dd98738053ac7e140bd5ab850f385e9a2f5a4496
Author: Andrea Cosentino <[hidden email]>
AuthorDate: Fri Mar 13 15:31:12 2020 +0100

    Camel-AWS2-SNS: Migrated tests to Junit5
---
 components/camel-aws2-sns/pom.xml                  | 24 +++++++++++++++-------
 .../component/aws2/sns/AmazonSNSClientMock.java    |  9 ++++----
 .../aws2/sns/SNSComponentClientRegistryTest.java   | 13 ++++++++----
 .../aws2/sns/SnsComponentConfigurationTest.java    | 21 +++++++++++++------
 .../component/aws2/sns/SnsComponentSpringTest.java |  6 ++++--
 .../camel/component/aws2/sns/SnsComponentTest.java |  6 ++++--
 .../sns/SnsComponentVerifierExtensionTest.java     | 11 +++++-----
 .../camel/component/aws2/sns/SnsProducerTest.java  | 15 +++++++-------
 .../integration/SnsComponentIntegrationTest.java   | 11 ++++++----
 .../SnsTopicWithKmsEncryptionIntegrationTest.java  | 10 +++++----
 .../component/jcache/policy/hazelcast-spring.xml   |  2 +-
 11 files changed, 82 insertions(+), 46 deletions(-)

diff --git a/components/camel-aws2-sns/pom.xml b/components/camel-aws2-sns/pom.xml
index e86cc1d..a804e92 100644
--- a/components/camel-aws2-sns/pom.xml
+++ b/components/camel-aws2-sns/pom.xml
@@ -58,13 +58,8 @@
 
         <!-- for testing -->
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-spring</artifactId>
+            <artifactId>camel-test-spring-junit5</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -83,8 +78,23 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-api</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.mockito</groupId>
-            <artifactId>mockito-core</artifactId>
+            <artifactId>mockito-junit-jupiter</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>hamcrest</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/AmazonSNSClientMock.java b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/AmazonSNSClientMock.java
index 48142ec..7be08c5 100644
--- a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/AmazonSNSClientMock.java
+++ b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/AmazonSNSClientMock.java
@@ -19,7 +19,6 @@ package org.apache.camel.component.aws2.sns;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.junit.Assert;
 import software.amazon.awssdk.services.sns.SnsClient;
 import software.amazon.awssdk.services.sns.model.CreateTopicRequest;
 import software.amazon.awssdk.services.sns.model.CreateTopicResponse;
@@ -31,6 +30,8 @@ import software.amazon.awssdk.services.sns.model.SetTopicAttributesRequest;
 import software.amazon.awssdk.services.sns.model.SetTopicAttributesResponse;
 import software.amazon.awssdk.services.sns.model.Topic;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
 public class AmazonSNSClientMock implements SnsClient {
 
     private static final String DEFAULT_TOPIC_ARN = "arn:aws:sns:us-east-1:541925086079:MyTopic";
@@ -40,9 +41,9 @@ public class AmazonSNSClientMock implements SnsClient {
 
     @Override
     public SetTopicAttributesResponse setTopicAttributes(SetTopicAttributesRequest setTopicAttributesRequest) {
-        Assert.assertEquals(DEFAULT_TOPIC_ARN, setTopicAttributesRequest.topicArn());
-        Assert.assertEquals("Policy", setTopicAttributesRequest.attributeName());
-        Assert.assertEquals("XXX", setTopicAttributesRequest.attributeValue());
+        assertEquals(DEFAULT_TOPIC_ARN, setTopicAttributesRequest.topicArn());
+        assertEquals("Policy", setTopicAttributesRequest.attributeName());
+        assertEquals("XXX", setTopicAttributesRequest.attributeValue());
         return SetTopicAttributesResponse.builder().build();
     }
 
diff --git a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SNSComponentClientRegistryTest.java b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SNSComponentClientRegistryTest.java
index f4c19e4..55a60c1 100644
--- a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SNSComponentClientRegistryTest.java
+++ b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SNSComponentClientRegistryTest.java
@@ -16,8 +16,11 @@
  */
 package org.apache.camel.component.aws2.sns;
 
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 public class SNSComponentClientRegistryTest extends CamelTestSupport {
 
@@ -32,10 +35,12 @@ public class SNSComponentClientRegistryTest extends CamelTestSupport {
         assertNotNull(endpoint.getConfiguration().getAmazonSNSClient());
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test
     public void createEndpointWithMinimalSNSClientMisconfiguration() throws Exception {
 
         Sns2Component component = context.getComponent("aws2-sns", Sns2Component.class);
-        Sns2Endpoint endpoint = (Sns2Endpoint)component.createEndpoint("aws2-sns://MyTopic");
+        assertThrows(IllegalArgumentException.class, () -> {
+            Sns2Endpoint endpoint = (Sns2Endpoint)component.createEndpoint("aws2-sns://MyTopic");
+        });
     }
 }
diff --git a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsComponentConfigurationTest.java b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsComponentConfigurationTest.java
index 431c717..0e44779 100644
--- a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsComponentConfigurationTest.java
+++ b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsComponentConfigurationTest.java
@@ -16,11 +16,16 @@
  */
 package org.apache.camel.component.aws2.sns;
 
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Test;
 import software.amazon.awssdk.core.Protocol;
 import software.amazon.awssdk.regions.Region;
 
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
 public class SnsComponentConfigurationTest extends CamelTestSupport {
 
     @Test
@@ -133,16 +138,20 @@ public class SnsComponentConfigurationTest extends CamelTestSupport {
         assertNull(endpoint.getConfiguration().getPolicy());
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test
     public void createEndpointWithoutAccessKeyConfiguration() throws Exception {
         Sns2Component component = context.getComponent("aws2-sns", Sns2Component.class);
-        component.createEndpoint("aws2-sns://MyTopic?secretKey=yyy");
+        assertThrows(IllegalArgumentException.class, () -> {
+            component.createEndpoint("aws2-sns://MyTopic?secretKey=yyy");
+        });
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test
     public void createEndpointWithoutSecretKeyConfiguration() throws Exception {
         Sns2Component component = new Sns2Component(context);
-        component.createEndpoint("aws2-sns://MyTopic?accessKey=xxx");
+        assertThrows(IllegalArgumentException.class, () -> {
+            component.createEndpoint("aws2-sns://MyTopic?accessKey=xxx");
+        });
     }
 
     @Test
diff --git a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsComponentSpringTest.java b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsComponentSpringTest.java
index eb17fe5..7817c45 100644
--- a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsComponentSpringTest.java
+++ b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsComponentSpringTest.java
@@ -19,10 +19,12 @@ package org.apache.camel.component.aws2.sns;
 import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
 import org.apache.camel.Processor;
-import org.apache.camel.test.spring.CamelSpringTestSupport;
-import org.junit.Test;
+import org.apache.camel.test.spring.junit5.CamelSpringTestSupport;
+import org.junit.jupiter.api.Test;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
 public class SnsComponentSpringTest extends CamelSpringTestSupport {
 
     @Test
diff --git a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsComponentTest.java b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsComponentTest.java
index ebf1fdb..cd0c15a 100644
--- a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsComponentTest.java
+++ b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsComponentTest.java
@@ -21,8 +21,10 @@ import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class SnsComponentTest extends CamelTestSupport {
 
diff --git a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsComponentVerifierExtensionTest.java b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsComponentVerifierExtensionTest.java
index 9df1ad4..99a962b 100644
--- a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsComponentVerifierExtensionTest.java
+++ b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsComponentVerifierExtensionTest.java
@@ -21,9 +21,10 @@ import java.util.Map;
 
 import org.apache.camel.Component;
 import org.apache.camel.component.extension.ComponentVerifierExtension;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Assert;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class SnsComponentVerifierExtensionTest extends CamelTestSupport {
 
@@ -49,7 +50,7 @@ public class SnsComponentVerifierExtensionTest extends CamelTestSupport {
 
         ComponentVerifierExtension.Result result = verifier.verify(ComponentVerifierExtension.Scope.PARAMETERS, parameters);
 
-        Assert.assertEquals(ComponentVerifierExtension.Result.Status.OK, result.getStatus());
+        assertEquals(ComponentVerifierExtension.Result.Status.OK, result.getStatus());
     }
 
     @Test
@@ -65,7 +66,7 @@ public class SnsComponentVerifierExtensionTest extends CamelTestSupport {
 
         ComponentVerifierExtension.Result result = verifier.verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters);
 
-        Assert.assertEquals(ComponentVerifierExtension.Result.Status.ERROR, result.getStatus());
+        assertEquals(ComponentVerifierExtension.Result.Status.ERROR, result.getStatus());
     }
 
 }
diff --git a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsProducerTest.java b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsProducerTest.java
index c268c01..0f2e4e6 100644
--- a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsProducerTest.java
+++ b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsProducerTest.java
@@ -21,18 +21,19 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.camel.Exchange;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
 import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
+
 import software.amazon.awssdk.services.sns.model.MessageAttributeValue;
 
 import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
 import static org.mockito.Mockito.when;
+import static org.hamcrest.MatcherAssert.assertThat;
 
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
 public class SnsProducerTest {
 
     @Mock
@@ -41,7 +42,7 @@ public class SnsProducerTest {
     private Sns2Endpoint endpoint;
     private Sns2Producer producer;
 
-    @Before
+    @BeforeEach
     public void setUp() {
         producer = new Sns2Producer(endpoint);
 
diff --git a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/integration/SnsComponentIntegrationTest.java b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/integration/SnsComponentIntegrationTest.java
index f43f942..5f8a419 100644
--- a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/integration/SnsComponentIntegrationTest.java
+++ b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/integration/SnsComponentIntegrationTest.java
@@ -21,11 +21,14 @@ import org.apache.camel.ExchangePattern;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.aws2.sns.Sns2Constants;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Ignore;
-import org.junit.Test;
 
-@Ignore("Must be manually tested. Provide your own accessKey and secretKey!")
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+@Disabled("Must be manually tested. Provide your own accessKey and secretKey!")
 public class SnsComponentIntegrationTest extends CamelTestSupport {
 
     @Test
diff --git a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/integration/SnsTopicWithKmsEncryptionIntegrationTest.java b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/integration/SnsTopicWithKmsEncryptionIntegrationTest.java
index 6388684..cdf3142 100644
--- a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/integration/SnsTopicWithKmsEncryptionIntegrationTest.java
+++ b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/integration/SnsTopicWithKmsEncryptionIntegrationTest.java
@@ -21,11 +21,13 @@ import org.apache.camel.ExchangePattern;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.aws2.sns.Sns2Constants;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 
-@Ignore("Must be manually tested. Provide your own accessKey and secretKey!")
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+@Disabled("Must be manually tested. Provide your own accessKey and secretKey!")
 public class SnsTopicWithKmsEncryptionIntegrationTest extends CamelTestSupport {
 
     @Test
diff --git a/components/camel-jcache/src/test/resources/org/apache/camel/component/jcache/policy/hazelcast-spring.xml b/components/camel-jcache/src/test/resources/org/apache/camel/component/jcache/policy/hazelcast-spring.xml
index 97cecbc..058335d 100644
--- a/components/camel-jcache/src/test/resources/org/apache/camel/component/jcache/policy/hazelcast-spring.xml
+++ b/components/camel-jcache/src/test/resources/org/apache/camel/component/jcache/policy/hazelcast-spring.xml
@@ -19,7 +19,7 @@
 -->
 <hazelcast xmlns="http://www.hazelcast.com/schema/config"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-           xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.11.xsd" >
+           xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-4.0.xsd" >
 
     <cache name="spring">
         <key-type class-name="java.lang.String"/>

Reply | Threaded
Open this post in threaded view
|

[camel] 02/02: Camel-AWS2-SNS: Fixed CS

acosentino
In reply to this post by acosentino
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 fbe64167d34a6165d22497718ea7ba0ec98252c6
Author: Andrea Cosentino <[hidden email]>
AuthorDate: Fri Mar 13 15:32:49 2020 +0100

    Camel-AWS2-SNS: Fixed CS
---
 .../test/java/org/apache/camel/component/aws2/sns/SnsProducerTest.java   | 1 -
 .../component/aws2/sns/integration/SnsComponentIntegrationTest.java      | 1 -
 2 files changed, 2 deletions(-)

diff --git a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsProducerTest.java b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsProducerTest.java
index 0f2e4e6..1e1ace0 100644
--- a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsProducerTest.java
+++ b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsProducerTest.java
@@ -26,7 +26,6 @@ import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
 import org.mockito.Mock;
 import org.mockito.junit.jupiter.MockitoExtension;
-
 import software.amazon.awssdk.services.sns.model.MessageAttributeValue;
 
 import static org.hamcrest.CoreMatchers.is;
diff --git a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/integration/SnsComponentIntegrationTest.java b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/integration/SnsComponentIntegrationTest.java
index 5f8a419..2a588b7 100644
--- a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/integration/SnsComponentIntegrationTest.java
+++ b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/integration/SnsComponentIntegrationTest.java
@@ -21,7 +21,6 @@ import org.apache.camel.ExchangePattern;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.aws2.sns.Sns2Constants;
-
 import org.apache.camel.test.junit5.CamelTestSupport;
 import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;