You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2021/04/19 13:40:26 UTC

[camel] branch master updated: CAMEL-16400: split unit and integration tests for camel-soroush (#5426)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new f437dbd  CAMEL-16400: split unit and integration tests for camel-soroush (#5426)
f437dbd is described below

commit f437dbdc1112077da1db36882226373467a7fb1c
Author: Otavio Rodolfo Piske <or...@users.noreply.github.com>
AuthorDate: Mon Apr 19 15:39:55 2021 +0200

    CAMEL-16400: split unit and integration tests for camel-soroush (#5426)
---
 components/camel-soroush/pom.xml                   | 24 ++++++----------------
 .../component/ConsumerAutoDownloadFileTest.java    |  2 ++
 .../ConsumerAutoReconnectAfterIdleTimeoutTest.java |  2 ++
 .../component/ConsumerCamelConcurrentTest.java     |  2 ++
 ...nsumerExceptionHandledWithErrorHandlerTest.java |  2 ++
 .../component/ConsumerMultiThreadTest.java         |  2 ++
 .../component/ConsumerNativeConcurrentTest.java    |  2 ++
 .../ConsumerQueueCapacityPerThreadTest.java        |  2 ++
 .../ConsumerRetryOnConnectionFailureTest.java      |  2 ++
 .../soroushbot/component/ConsumerTest.java         |  2 ++
 .../HandleExceptionWithErrorHandlerTest.java       |  2 ++
 ...roushServiceTest.java => SoroushServiceIT.java} | 18 +++++++++-------
 12 files changed, 37 insertions(+), 25 deletions(-)

diff --git a/components/camel-soroush/pom.xml b/components/camel-soroush/pom.xml
index ded7ef6..e925a5c 100644
--- a/components/camel-soroush/pom.xml
+++ b/components/camel-soroush/pom.xml
@@ -131,31 +131,19 @@
         </dependency>
     </dependencies>
 
-    <profiles>
-        <profile>
-            <id>soroush-test</id>
-            <build>
-                <plugins>
-                    <plugin>
-                        <artifactId>maven-surefire-plugin</artifactId>
-                        <configuration>
-                            <skipTests>false</skipTests>
-                            <forkedProcessTimeoutInSeconds>300</forkedProcessTimeoutInSeconds>
-                        </configuration>
-                    </plugin>
-                </plugins>
-            </build>
-        </profile>
-    </profiles>
-
     <build>
         <plugins>
             <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>
-                    <skipTests>true</skipTests>
+                    <forkedProcessTimeoutInSeconds>300</forkedProcessTimeoutInSeconds>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-failsafe-plugin</artifactId>
+            </plugin>
         </plugins>
     </build>
 
diff --git a/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerAutoDownloadFileTest.java b/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerAutoDownloadFileTest.java
index 6d13d09..ffc1e9f 100644
--- a/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerAutoDownloadFileTest.java
+++ b/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerAutoDownloadFileTest.java
@@ -25,11 +25,13 @@ import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.component.soroushbot.models.SoroushAction;
 import org.apache.camel.component.soroushbot.models.SoroushMessage;
 import org.apache.camel.component.soroushbot.support.SoroushBotTestSupport;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
+@Disabled("Flaky test")
 public class ConsumerAutoDownloadFileTest extends SoroushBotTestSupport {
     @Override
     public RouteBuilder createRouteBuilder() {
diff --git a/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerAutoReconnectAfterIdleTimeoutTest.java b/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerAutoReconnectAfterIdleTimeoutTest.java
index 4872418..a75484b 100644
--- a/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerAutoReconnectAfterIdleTimeoutTest.java
+++ b/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerAutoReconnectAfterIdleTimeoutTest.java
@@ -22,8 +22,10 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.component.soroushbot.models.SoroushAction;
 import org.apache.camel.component.soroushbot.support.SoroushBotTestSupport;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
+@Disabled("Flaky test")
 public class ConsumerAutoReconnectAfterIdleTimeoutTest extends SoroushBotTestSupport {
 
     @Override
diff --git a/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerCamelConcurrentTest.java b/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerCamelConcurrentTest.java
index 7687494..5a7a703 100644
--- a/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerCamelConcurrentTest.java
+++ b/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerCamelConcurrentTest.java
@@ -26,10 +26,12 @@ import org.apache.camel.component.soroushbot.models.SoroushAction;
 import org.apache.camel.component.soroushbot.models.SoroushMessage;
 import org.apache.camel.component.soroushbot.support.SoroushBotTestSupport;
 import org.apache.logging.log4j.LogManager;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
+@Disabled("Flaky test")
 public class ConsumerCamelConcurrentTest extends SoroushBotTestSupport {
     final List<String> fromOrder = new ArrayList<>();
 
diff --git a/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerExceptionHandledWithErrorHandlerTest.java b/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerExceptionHandledWithErrorHandlerTest.java
index 7aa634f..a3d015f 100644
--- a/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerExceptionHandledWithErrorHandlerTest.java
+++ b/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerExceptionHandledWithErrorHandlerTest.java
@@ -24,8 +24,10 @@ import org.apache.camel.component.soroushbot.models.SoroushAction;
 import org.apache.camel.component.soroushbot.models.SoroushMessage;
 import org.apache.camel.component.soroushbot.support.SoroushBotTestSupport;
 import org.apache.camel.component.soroushbot.utils.CongestionException;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
+@Disabled("Flaky test")
 public class ConsumerExceptionHandledWithErrorHandlerTest extends SoroushBotTestSupport {
     @Override
     protected RoutesBuilder createRouteBuilder() {
diff --git a/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerMultiThreadTest.java b/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerMultiThreadTest.java
index f7072b6..80620ee 100644
--- a/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerMultiThreadTest.java
+++ b/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerMultiThreadTest.java
@@ -21,8 +21,10 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.component.soroushbot.models.SoroushAction;
 import org.apache.camel.component.soroushbot.support.SoroushBotTestSupport;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
+@Disabled("Flaky test")
 public class ConsumerMultiThreadTest extends SoroushBotTestSupport {
 
     @Test
diff --git a/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerNativeConcurrentTest.java b/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerNativeConcurrentTest.java
index dc6aae0..627e801 100644
--- a/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerNativeConcurrentTest.java
+++ b/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerNativeConcurrentTest.java
@@ -27,11 +27,13 @@ import org.apache.camel.component.soroushbot.models.SoroushAction;
 import org.apache.camel.component.soroushbot.models.SoroushMessage;
 import org.apache.camel.component.soroushbot.support.SoroushBotTestSupport;
 import org.apache.logging.log4j.LogManager;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
+@Disabled("Flaky test")
 public class ConsumerNativeConcurrentTest extends SoroushBotTestSupport {
     ConcurrentHashMap<String, Thread> userToThread;
     AtomicInteger badThread = new AtomicInteger();
diff --git a/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerQueueCapacityPerThreadTest.java b/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerQueueCapacityPerThreadTest.java
index 5cadcd1..d55a2c6 100644
--- a/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerQueueCapacityPerThreadTest.java
+++ b/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerQueueCapacityPerThreadTest.java
@@ -21,8 +21,10 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.component.soroushbot.models.SoroushAction;
 import org.apache.camel.component.soroushbot.support.SoroushBotTestSupport;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
+@Disabled("Flaky test")
 public class ConsumerQueueCapacityPerThreadTest extends SoroushBotTestSupport {
     @Override
     protected RoutesBuilder createRouteBuilder() throws Exception {
diff --git a/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerRetryOnConnectionFailureTest.java b/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerRetryOnConnectionFailureTest.java
index 31a5699..b80db03 100644
--- a/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerRetryOnConnectionFailureTest.java
+++ b/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerRetryOnConnectionFailureTest.java
@@ -21,8 +21,10 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.component.soroushbot.models.SoroushAction;
 import org.apache.camel.component.soroushbot.support.SoroushBotTestSupport;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
+@Disabled("Flaky test")
 public class ConsumerRetryOnConnectionFailureTest extends SoroushBotTestSupport {
     @Override
     protected RoutesBuilder createRouteBuilder() throws Exception {
diff --git a/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerTest.java b/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerTest.java
index 5e32763..7917b78 100644
--- a/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerTest.java
+++ b/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/ConsumerTest.java
@@ -23,10 +23,12 @@ import org.apache.camel.component.soroushbot.models.SoroushAction;
 import org.apache.camel.component.soroushbot.models.SoroushMessage;
 import org.apache.camel.component.soroushbot.support.SoroushBotTestSupport;
 import org.apache.logging.log4j.LogManager;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
+@Disabled("Flaky test")
 public class ConsumerTest extends SoroushBotTestSupport {
 
     private int messageCount;
diff --git a/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/HandleExceptionWithErrorHandlerTest.java b/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/HandleExceptionWithErrorHandlerTest.java
index d19979f..5ebfe0a 100644
--- a/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/HandleExceptionWithErrorHandlerTest.java
+++ b/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/component/HandleExceptionWithErrorHandlerTest.java
@@ -25,10 +25,12 @@ import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.component.soroushbot.models.SoroushAction;
 import org.apache.camel.component.soroushbot.models.SoroushMessage;
 import org.apache.camel.component.soroushbot.support.SoroushBotTestSupport;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
 import static org.junit.jupiter.api.Assertions.assertFalse;
 
+@Disabled("Flaky test")
 public class HandleExceptionWithErrorHandlerTest extends SoroushBotTestSupport {
     @Override
     protected RoutesBuilder createRouteBuilder() {
diff --git a/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/service/SoroushServiceTest.java b/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/service/SoroushServiceIT.java
similarity index 90%
rename from components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/service/SoroushServiceTest.java
rename to components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/service/SoroushServiceIT.java
index 0b576fc..7ead4c2 100644
--- a/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/service/SoroushServiceTest.java
+++ b/components/camel-soroush/src/test/java/org/apache/camel/component/soroushbot/service/SoroushServiceIT.java
@@ -40,20 +40,26 @@ import org.glassfish.jersey.media.sse.EventInput;
 import org.glassfish.jersey.media.sse.InboundEvent;
 import org.glassfish.jersey.media.sse.SseFeature;
 import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
+import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariables;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * check if soroush BOT Api work as expected
  */
-@Disabled("Need the token to work")
-public class SoroushServiceTest {
+@EnabledIfEnvironmentVariables({
+        @EnabledIfEnvironmentVariable(named = "soroushBotAuthorizationToken", matches = ".*",
+                                      disabledReason = "Bot authorization token is required"),
+        @EnabledIfEnvironmentVariable(named = "soroushBotReceiverId", matches = ".*",
+                                      disabledReason = "Bot receiver ID is required")
+})
+
+public class SoroushServiceIT {
     static String authorizationToken;
     static String receiverId;
     private static SoroushService soroushService;
@@ -62,9 +68,7 @@ public class SoroushServiceTest {
     public static void setUp() {
         authorizationToken = System.getenv("soroushBotAuthorizationToken");
         receiverId = System.getenv("soroushBotReceiverId");
-        assertTrue(authorizationToken != null && receiverId != null,
-                "you need to define `soroushBotAuthorizationToken` and "
-                                                                     + "`soroushBotReceiverId` environment variable in order to do integration test ");
+
         soroushService = SoroushService.get();
         soroushService.setAlternativeUrl(null);
     }