[
https://issues.apache.org/jira/browse/CAMEL-12025?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16265210#comment-16265210
]
ASF GitHub Bot commented on CAMEL-12025:
----------------------------------------
ppalaga closed pull request #2110: CAMEL-12025: Possible Intermittent failures
in ReactorStreamsServiceTest
URL: https://github.com/apache/camel/pull/2110
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/components/camel-reactor/src/test/java/org/apache/camel/component/reactor/engine/ReactorStreamsServiceTest.java
b/components/camel-reactor/src/test/java/org/apache/camel/component/reactor/engine/ReactorStreamsServiceTest.java
index 19a1f5ce997..9b9df6b3a30 100644
---
a/components/camel-reactor/src/test/java/org/apache/camel/component/reactor/engine/ReactorStreamsServiceTest.java
+++
b/components/camel-reactor/src/test/java/org/apache/camel/component/reactor/engine/ReactorStreamsServiceTest.java
@@ -16,6 +16,10 @@
*/
package org.apache.camel.component.reactor.engine;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Set;
+import java.util.TreeSet;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
@@ -35,7 +39,7 @@
import reactor.core.publisher.Flux;
public class ReactorStreamsServiceTest extends
ReactorStreamsServiceTestSupport {
-
+
// ************************************************
// Setup
// ************************************************
@@ -287,70 +291,74 @@ public void configure() {
public void testTo() throws Exception {
context.start();
- AtomicInteger value = new AtomicInteger(0);
- CountDownLatch latch = new CountDownLatch(1);
+ Set<String> values = Collections.synchronizedSet(new TreeSet<>());
+ CountDownLatch latch = new CountDownLatch(3);
Flux.just(1, 2, 3)
.flatMap(e -> crs.to("bean:hello", e, String.class))
- .doOnNext(res -> Assert.assertEquals("Hello " +
value.incrementAndGet(), res))
+ .doOnNext(res -> values.add(res))
.doOnNext(res -> latch.countDown())
.subscribe();
Assert.assertTrue(latch.await(2, TimeUnit.SECONDS));
+ Assert.assertEquals(new TreeSet<>(Arrays.asList("Hello 1", "Hello 2",
"Hello 3")), values);
}
@Test
public void testToWithExchange() throws Exception {
context.start();
- AtomicInteger value = new AtomicInteger(0);
- CountDownLatch latch = new CountDownLatch(1);
+ Set<String> values = Collections.synchronizedSet(new TreeSet<>());
+ CountDownLatch latch = new CountDownLatch(3);
Flux.just(1, 2, 3)
.flatMap(e -> crs.to("bean:hello", e))
.map(e -> e.getOut())
.map(e -> e.getBody(String.class))
- .doOnNext(res -> Assert.assertEquals("Hello " +
value.incrementAndGet(), res))
+ .doOnNext(res -> values.add(res))
.doOnNext(res -> latch.countDown())
.subscribe();
Assert.assertTrue(latch.await(2, TimeUnit.SECONDS));
+ Assert.assertEquals(new TreeSet<>(Arrays.asList("Hello 1", "Hello 2",
"Hello 3")), values);
}
@Test
public void testToFunction() throws Exception {
context.start();
- AtomicInteger value = new AtomicInteger(0);
- CountDownLatch latch = new CountDownLatch(1);
+ Set<String> values = Collections.synchronizedSet(new TreeSet<>());
+ CountDownLatch latch = new CountDownLatch(3);
Function<Object, Publisher<String>> fun = crs.to("bean:hello",
String.class);
Flux.just(1, 2, 3)
.flatMap(fun)
- .doOnNext(res -> Assert.assertEquals("Hello " +
value.incrementAndGet(), res))
+ .doOnNext(res -> values.add(res))
.doOnNext(res -> latch.countDown())
.subscribe();
Assert.assertTrue(latch.await(2, TimeUnit.SECONDS));
+ Assert.assertEquals(new TreeSet<>(Arrays.asList("Hello 1", "Hello 2",
"Hello 3")), values);
}
@Test
public void testToFunctionWithExchange() throws Exception {
context.start();
- AtomicInteger value = new AtomicInteger(0);
- CountDownLatch latch = new CountDownLatch(1);
+ Set<String> values = Collections.synchronizedSet(new TreeSet<>());
+ CountDownLatch latch = new CountDownLatch(3);
Function<Object, Publisher<Exchange>> fun = crs.to("bean:hello");
Flux.just(1, 2, 3)
.flatMap(fun)
.map(e -> e.getOut())
.map(e -> e.getBody(String.class))
- .doOnNext(res -> Assert.assertEquals("Hello " +
value.incrementAndGet(), res))
+ .doOnNext(res -> values.add(res))
.doOnNext(res -> latch.countDown())
.subscribe();
Assert.assertTrue(latch.await(2, TimeUnit.SECONDS));
+ Assert.assertEquals(new TreeSet<>(Arrays.asList("Hello 1", "Hello 2",
"Hello 3")), values);
}
// ************************************************
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Possible Intermittent failures in ReactorStreamsServiceTest
> -----------------------------------------------------------
>
> Key: CAMEL-12025
> URL: https://issues.apache.org/jira/browse/CAMEL-12025
> Project: Camel
> Issue Type: Bug
> Components: camel-reactor
> Reporter: Peter Palaga
> Assignee: Peter Palaga
> Fix For: 2.20.2, 2.21.0
>
>
> The copy of the test we have in WildFly Camel fails intermittently - see
> https://github.com/wildfly-extras/wildfly-camel/issues/2320
> The fix available in
> https://github.com/wildfly-extras/wildfly-camel/pull/2324 just needs to be
> ported back to Camel.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)