org.apache.camel.Navigate Java Examples
The following examples show how to use
org.apache.camel.Navigate.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HystrixMultiConfigurationTest.java From camel-spring-boot with Apache License 2.0 | 5 votes |
private HystrixProcessor findHystrixProcessor(Navigate<Processor> navigate) throws Exception { for (Processor processor : navigate.next()) { if (processor instanceof HystrixProcessor) { return (HystrixProcessor)processor; } if (processor instanceof Navigate) { return findHystrixProcessor((Navigate<Processor>) processor); } } throw new IllegalStateException("Unable to find an HystrixProcessor instance"); }
Example #2
Source File: RibbonLoadBalancerTest.java From camel-spring-boot with Apache License 2.0 | 5 votes |
protected Optional<DefaultServiceCallProcessor> findServiceCallProcessor(Navigate<Processor> navigate) { for (Processor processor : navigate.next()) { if (processor instanceof DefaultServiceCallProcessor) { return Optional.ofNullable((DefaultServiceCallProcessor)processor); } if (processor instanceof Navigate) { return findServiceCallProcessor((Navigate<Processor>)processor); } } return Optional.empty(); }
Example #3
Source File: WebhookConnectorCustomizerTest.java From syndesis with Apache License 2.0 | 5 votes |
@Test public void shouldAddWrapperProcessorIfSyndesisJsonSchemaGiven() throws Exception { final WebhookConnectorCustomizer customizer = new WebhookConnectorCustomizer(); final ExtendedCamelContext context = mock(ExtendedCamelContext.class); customizer.setCamelContext(context); when(context.adapt(ExtendedCamelContext.class)).thenReturn(context); customizer.setOutputDataShape(new DataShape.Builder().kind(DataShapeKinds.JSON_SCHEMA).specification(SIMPLE_SCHEMA).build()); customizer.customize(component, Collections.emptyMap()); final Processor beforeConsumer = component.getBeforeConsumer(); assertThat(beforeConsumer).isInstanceOf(Pipeline.class); final Pipeline pipeline = (Pipeline) beforeConsumer; final Collection<Processor> processors = pipeline.next(); assertThat(processors).hasSize(3); assertThat(processors).anySatisfy(containsInstanceOf(HttpRequestWrapperProcessor.class)); assertThat(processors).anySatisfy(containsInstanceOf(HttpMessageToDefaultMessageProcessor.class)); final HttpRequestWrapperProcessor wrapper = (HttpRequestWrapperProcessor) processors.stream() .map(n -> ((Navigate<?>) n).next().get(0)) .filter(HttpRequestWrapperProcessor.class::isInstance) .findFirst().get(); assertThat(wrapper.getParameters()).containsOnly("source", "status"); final Processor removeHeader = processors.stream().filter(p -> !(p instanceof HttpRequestWrapperProcessor)).findFirst().get(); final Exchange exchange = mock(Exchange.class); final Message in = mock(Message.class); when(exchange.getIn()).thenReturn(in); removeHeader.process(exchange); verify(in).removeHeader(Exchange.HTTP_URI); }
Example #4
Source File: WebhookConnectorCustomizerTest.java From syndesis with Apache License 2.0 | 5 votes |
private static Consumer<Processor> containsInstanceOf(Class<?> type) { return p -> { assertThat(p).isInstanceOf(Navigate.class); final List<?> next = ((Navigate) p).next(); assertThat(next).hasOnlyOneElementSatisfying(n -> type.isInstance(n)); }; }