You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "orpiske (via GitHub)" <gi...@apache.org> on 2023/07/14 14:01:35 UTC

[GitHub] [camel] orpiske opened a new pull request, #10691: (chores) camel-core: test fixes and cleanups

orpiske opened a new pull request, #10691:
URL: https://github.com/apache/camel/pull/10691

   (no comment)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] orpiske commented on a diff in pull request #10691: (chores) camel-core: test fixes and cleanups

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on code in PR #10691:
URL: https://github.com/apache/camel/pull/10691#discussion_r1263774971


##########
core/camel-core/src/test/java/org/apache/camel/processor/RecipientListWithSimpleExpressionTest.java:
##########
@@ -16,108 +16,72 @@
  */
 package org.apache.camel.processor;
 
-import java.util.concurrent.ExecutorService;
+import java.time.Duration;
 import java.util.concurrent.Executors;
+import java.util.concurrent.Phaser;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 
 import org.apache.camel.ContextTestSupport;
-import org.apache.camel.Header;
 import org.apache.camel.builder.RouteBuilder;
+import org.awaitility.Awaitility;
+import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Isolated;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
+@Isolated("This test creates a larger thread pool, which may be too much on slower hosts")
 public class RecipientListWithSimpleExpressionTest extends ContextTestSupport {
+    private static final Logger LOG = LoggerFactory.getLogger(RecipientListWithSimpleExpressionTest.class);
+    private final ScheduledExecutorService executors = Executors.newScheduledThreadPool(10);
+    private final Phaser phaser = new Phaser(50);
 
     @Override
-    public boolean isUseRouteBuilder() {
-        return false;
-    }
-
-    @Test
-    public void testRecipientList() throws Exception {
-        context.addRoutes(new RouteBuilder() {
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
             @Override
-            public void configure() throws Exception {
+            public void configure() {
                 from("direct:start").recipientList(simple("mock:${in.header.queue}"));
             }
-        });
-        context.start();
-        template.start();
+        };
+    }
 
-        for (int i = 0; i < 10; i++) {
-            getMockEndpoint("mock:" + i).expectedMessageCount(50);
-        }
+    @BeforeEach
+    void sendMessages() {
+        // it may take a little while for the context to start on slower hosts
+        Awaitility.await().atMost(Duration.ofSeconds(2)).until(() -> context.getUptimeMillis() > 1000);
 
         // use concurrent producers to send a lot of messages
-        ExecutorService executors = Executors.newFixedThreadPool(10);
         for (int i = 0; i < 50; i++) {
-            executors.execute(new Runnable() {
+            final Runnable runOverRunnable = new Runnable() {
+                int i;
+
+                @Override
                 public void run() {
-                    for (int i = 0; i < 10; i++) {
-                        try {
-                            template.sendBodyAndHeader("direct:start", "Hello " + i, "queue", i);
-                            Thread.sleep(5);
-                        } catch (Exception e) {
-                            // ignore
-                        }
+                    System.out.println("Sending " + i);

Review Comment:
   Leftover ... will remove.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] github-actions[bot] commented on pull request #10691: (chores) camel-core: test fixes and cleanups

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10691:
URL: https://github.com/apache/camel/pull/10691#issuecomment-1635909897

   :star2: Thank you for your contribution to the Apache Camel project! :star2: 
   
   :camel: Maintainers, please note that first-time contributors *require manual approval* for the GitHub Actions to run.
   
   :warning: Please note that the changes on this PR may be **tested automatically** if they change components.
   
   :robot: Use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot.
   
   If necessary Apache Camel Committers may access logs and test results in the job summaries!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] orpiske merged pull request #10691: (chores) camel-core: test fixes and cleanups

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske merged PR #10691:
URL: https://github.com/apache/camel/pull/10691


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org