use of org.apache.camel.component.reactive.streams.api.CamelReactiveStreamsService in project camel by apache.
the class CamelReactiveStreamsTest method testSameServiceReturnedFromRegistry.
@Test
public void testSameServiceReturnedFromRegistry() {
CamelReactiveStreamsService service1 = CamelReactiveStreams.get(context);
CamelReactiveStreamsService service2 = CamelReactiveStreams.get(context);
assertEquals(service1, service2);
assertTrue(service1 instanceof ReactiveStreamsTestService);
assertEquals("from-registry", ((ReactiveStreamsTestService) service1).getName());
}
use of org.apache.camel.component.reactive.streams.api.CamelReactiveStreamsService in project camel by apache.
the class CamelReactiveStreamsTest method testNamedServiceResolvedUsingFactory.
@Test
public void testNamedServiceResolvedUsingFactory() {
CamelReactiveStreamsService service1 = CamelReactiveStreams.get(context, "test-service");
assertTrue(service1 instanceof ReactiveStreamsTestService);
assertNull(((ReactiveStreamsTestService) service1).getName());
}
use of org.apache.camel.component.reactive.streams.api.CamelReactiveStreamsService in project camel by apache.
the class CamelReactiveStreamsTest method testSameNamedServiceReturnedFromRegistry.
@Test
public void testSameNamedServiceReturnedFromRegistry() {
CamelReactiveStreamsService service1 = CamelReactiveStreams.get(context, "dummy");
CamelReactiveStreamsService service2 = CamelReactiveStreams.get(context, "dummy");
assertEquals(service1, service2);
assertTrue(service1 instanceof ReactiveStreamsTestService);
assertEquals("from-registry", ((ReactiveStreamsTestService) service1).getName());
}
use of org.apache.camel.component.reactive.streams.api.CamelReactiveStreamsService in project camel by apache.
the class CamelReactiveStreamsTest method testSameDefaultServiceReturned.
@Test
public void testSameDefaultServiceReturned() {
CamelReactiveStreamsService service1 = CamelReactiveStreams.get(context, "default-service");
CamelReactiveStreamsService service2 = CamelReactiveStreams.get(context, "default-service");
assertTrue(service1 instanceof CamelReactiveStreamsServiceImpl);
assertEquals(service1, service2);
}
use of org.apache.camel.component.reactive.streams.api.CamelReactiveStreamsService in project camel by apache.
the class AbstractPlatformTestSupport method testPublisher.
@Test
public void testPublisher() throws Exception {
int num = 20;
new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:endpoint").to("reactive-streams:integers");
}
}.addRoutesToCamelContext(context);
CamelReactiveStreamsService camel = CamelReactiveStreams.get(context);
List<Integer> elements = new LinkedList<>();
CountDownLatch latch = new CountDownLatch(num);
this.changeSign(camel.fromStream("integers", Integer.class), i -> {
elements.add(i);
latch.countDown();
});
context.start();
for (int i = 1; i <= num; i++) {
template.sendBody("direct:endpoint", i);
}
assertTrue(latch.await(5, TimeUnit.SECONDS));
for (Integer number : elements) {
assertTrue(number < 0);
}
}
Aggregations