private ToDefinition getDroolsNode(ProcessorDefinition nav) { if ( !nav.getOutputs().isEmpty() ) { List<ProcessorDefinition> children = nav.getOutputs(); for ( ProcessorDefinition child : children ) { if ( child instanceof ToDefinition ) { ToDefinition to = (ToDefinition) child; if ( to.getUri().trim().startsWith( "drools:" ) ) { return to; } } getDroolsNode( child ); } } return null; }
private ToDefinition getDroolsNode(ProcessorDefinition nav) { if ( !nav.getOutputs().isEmpty() ) { List<ProcessorDefinition> children = nav.getOutputs(); for ( ProcessorDefinition child : children ) { if ( child instanceof ToDefinition ) { ToDefinition to = (ToDefinition) child; if ( to.getUri().trim().startsWith( "drools:" ) ) { return to; } } getDroolsNode( child ); } } return null; }
protected ProcessorDefinition<?> getOutput(RouteDefinition definition, int... indices) { ProcessorDefinition<?> output = definition; for (int index : indices) { output = output.getOutputs().get(index); } return output; }
public static void augmentNodes(RouteContext routeContext, ProcessorDefinition<?> nav, Set visited) { if ( !nav.getOutputs().isEmpty() ) { List<ProcessorDefinition> outputs = nav.getOutputs(); for ( int i = 0; i < outputs.size(); i++ ) { for ( Iterator<ProcessorDefinition> it = nav.getOutputs().iterator(); it.hasNext(); ) { ProcessorDefinition child = it.next(); augmentNodes( routeContext,
public static void augmentNodes(RouteContext routeContext, ProcessorDefinition<?> nav, Set visited) { if ( !nav.getOutputs().isEmpty() ) { List<ProcessorDefinition> outputs = nav.getOutputs(); for ( int i = 0; i < outputs.size(); i++ ) { for ( Iterator<ProcessorDefinition> it = nav.getOutputs().iterator(); it.hasNext(); ) { ProcessorDefinition child = it.next(); augmentNodes( routeContext,
@Test public void testBuilder() throws Exception { IntegrationRuntimeConfiguration configuration = new IntegrationRuntimeConfiguration(); IntegrationRouteBuilder routeBuilder = new IntegrationRouteBuilder(configuration.getConfigurationLocation(), Collections.emptyList()); // initialize routes routeBuilder.configure(); // Dump routes as XML for troubleshooting dumpRoutes(new DefaultCamelContext(), routeBuilder.getRouteCollection()); RoutesDefinition routes = routeBuilder.getRouteCollection(); assertThat(routes.getRoutes()).hasSize(1); RouteDefinition route = routes.getRoutes().get(0); assertThat(route.getInputs()).hasSize(1); assertThat(route.getInputs().get(0)).hasFieldOrPropertyWithValue("uri", "direct:expression"); assertThat(route.getOutputs()).hasSize(4); assertThat(getOutput(route, 0)).isInstanceOf(SetHeaderDefinition.class); assertThat(getOutput(route, 1)).isInstanceOf(SetHeaderDefinition.class); assertThat(getOutput(route, 2)).isInstanceOf(ProcessDefinition.class); assertThat(getOutput(route, 3)).isInstanceOf(PipelineDefinition.class); assertThat(getOutput(route, 3).getOutputs()).hasSize(2); assertThat(getOutput(route, 3, 0)).isInstanceOf(SetHeaderDefinition.class); assertThat(getOutput(route, 3, 1)).isInstanceOf(SplitDefinition.class); assertThat(getOutput(route, 3, 1).getOutputs()).hasSize(2); assertThat(getOutput(route, 3, 1, 0)).isInstanceOf(ProcessDefinition.class); assertThat(getOutput(route, 3, 1, 1)).isInstanceOf(PipelineDefinition.class); assertThat(getOutput(route, 3, 1, 1).getOutputs()).hasSize(3); assertThat(getOutput(route, 3, 1, 1, 0)).isInstanceOf(SetHeaderDefinition.class); assertThat(getOutput(route, 3, 1, 1, 1)).isInstanceOf(ToDefinition.class); assertThat(getOutput(route, 3, 1, 1, 1)).hasFieldOrPropertyWithValue("uri", "mock:expression"); assertThat(getOutput(route, 3, 1, 1, 2)).isInstanceOf(ProcessDefinition.class); }
assertThat(route.getOutputs().get(2)).isInstanceOf(ProcessDefinition.class); assertThat(route.getOutputs().get(3)).isInstanceOf(PipelineDefinition.class); assertThat(route.getOutputs().get(3).getOutputs()).hasSize(5); assertThat(route.getOutputs().get(3).getOutputs().get(0)).isInstanceOf(SetHeaderDefinition.class); assertThat(route.getOutputs().get(3).getOutputs().get(1)).isInstanceOf(SetHeaderDefinition.class); assertThat(route.getOutputs().get(3).getOutputs().get(1)).hasFieldOrPropertyWithValue("headerName", "Property-1"); assertThat(SetHeaderDefinition.class.cast(route.getOutputs().get(3).getOutputs().get(1)).getExpression()).hasFieldOrPropertyWithValue("expression", "Val-1"); assertThat(route.getOutputs().get(3).getOutputs().get(2)).isInstanceOf(SetHeaderDefinition.class); assertThat(route.getOutputs().get(3).getOutputs().get(2)).hasFieldOrPropertyWithValue("headerName", "Property-2"); assertThat(SetHeaderDefinition.class.cast(route.getOutputs().get(3).getOutputs().get(2)).getExpression()).hasFieldOrPropertyWithValue("expression", "Val-2"); assertThat(route.getOutputs().get(3).getOutputs().get(3)).isInstanceOf(ToDefinition.class); assertThat(route.getOutputs().get(3).getOutputs().get(3)).hasFieldOrPropertyWithValue( "uri", "log:myLog" ); assertThat(route.getOutputs().get(3).getOutputs().get(4)).isInstanceOf(ProcessDefinition.class); assertThat(route.getOutputs().get(4)).isInstanceOf(PipelineDefinition.class); } finally {
assertThat(getOutput(route, 1)).isInstanceOf(ToDefinition.class); assertThat(getOutput(route, 2)).isInstanceOf(SplitDefinition.class); assertThat(getOutput(route, 2).getOutputs()).hasSize(3); assertThat(getOutput(route, 2, 0)).isInstanceOf(SetHeaderDefinition.class); assertThat(getOutput(route, 2, 1)).isInstanceOf(ProcessDefinition.class); assertThat(getOutput(route, 2, 2)).isInstanceOf(PipelineDefinition.class); assertThat(getOutput(route, 2, 2).getOutputs()).hasSize(3); assertThat(getOutput(route, 2, 2, 0)).isInstanceOf(SetHeaderDefinition.class); assertThat(getOutput(route, 2, 2, 1)).isInstanceOf(ToDefinition.class);
assertThat(route.getOutputs().get(2)).isInstanceOf(ProcessDefinition.class); assertThat(route.getOutputs().get(3)).isInstanceOf(PipelineDefinition.class); assertThat(route.getOutputs().get(3).getOutputs()).hasSize(4); assertThat(route.getOutputs().get(3).getOutputs().get(0)).isInstanceOf(SetHeaderDefinition.class); assertThat(route.getOutputs().get(3).getOutputs().get(1)).isInstanceOf(SetHeaderDefinition.class); assertThat(route.getOutputs().get(3).getOutputs().get(1)).hasFieldOrPropertyWithValue("headerName", "param1"); assertThat(SetHeaderDefinition.class.cast(route.getOutputs().get(3).getOutputs().get(1)).getExpression()).hasFieldOrPropertyWithValue("expression", "Val-1"); assertThat(route.getOutputs().get(3).getOutputs().get(2)).isInstanceOf(SetHeaderDefinition.class); assertThat(route.getOutputs().get(3).getOutputs().get(2)).hasFieldOrPropertyWithValue("headerName", "param2"); assertThat(SetHeaderDefinition.class.cast(route.getOutputs().get(3).getOutputs().get(2)).getExpression()).hasFieldOrPropertyWithValue("expression", "Val-2"); assertThat(route.getOutputs().get(3).getOutputs().get(3)).isInstanceOf(ProcessDefinition.class); assertThat(route.getOutputs().get(4)).isInstanceOf(PipelineDefinition.class); } finally {
assertThat(route.getOutputs().get(3).getOutputs()).hasSize(3); assertThat(route.getOutputs().get(3).getOutputs().get(0)).isInstanceOf(SetHeaderDefinition.class); assertThat(route.getOutputs().get(3).getOutputs().get(1)).isInstanceOf(ToDefinition.class); assertThat(route.getOutputs().get(3).getOutputs().get(1)).hasFieldOrPropertyWithValue( "uri", "atlas:mapping-flow-0-step-1.json?encoding=UTF-8&sourceMapName=" + OutMessageCaptureProcessor.CAPTURED_OUT_MESSAGES_MAP ); assertThat(route.getOutputs().get(3).getOutputs().get(2)).isInstanceOf(ProcessDefinition.class); assertThat(route.getOutputs().get(4)).isInstanceOf(PipelineDefinition.class); } finally {
assertThat(getOutput(route, 1)).isInstanceOf(SetHeaderDefinition.class); assertThat(getOutput(route, 2)).isInstanceOf(SplitDefinition.class); assertThat(getOutput(route, 2).getOutputs()).hasSize(3); assertThat(getOutput(route, 2, 0)).isInstanceOf(ProcessDefinition.class); assertThat(getOutput(route, 2, 1)).isInstanceOf(PipelineDefinition.class);
assertThat(getOutput(route, 2)).isInstanceOf(ProcessDefinition.class); assertThat(getOutput(route, 3)).isInstanceOf(PipelineDefinition.class); assertThat(getOutput(route, 3).getOutputs()).hasSize(3); assertThat(getOutput(route, 3, 0)).isInstanceOf(SetHeaderDefinition.class); assertThat(getOutput(route, 3, 1)).isInstanceOf(ToDefinition.class);
assertThat(route.getOutputs().get(2)).isInstanceOf(ProcessDefinition.class); assertThat(route.getOutputs().get(3)).isInstanceOf(PipelineDefinition.class); assertThat(route.getOutputs().get(3).getOutputs()).hasSize(3); assertThat(route.getOutputs().get(3).getOutputs().get(0)).isInstanceOf(SetHeaderDefinition.class); assertThat(route.getOutputs().get(3).getOutputs().get(1)).isInstanceOf(ToDefinition.class); assertThat(route.getOutputs().get(3).getOutputs().get(1)).hasFieldOrPropertyWithValue( "uri", "class:io.syndesis.integration.runtime.handlers.ExtensionStepHandlerTest$MyExtension?method=action&bean.param1=Val-1&bean.param2=Val-2" ); assertThat(route.getOutputs().get(3).getOutputs().get(2)).isInstanceOf(ProcessDefinition.class); assertThat(route.getOutputs().get(4)).isInstanceOf(PipelineDefinition.class); } finally {
findLanguage(((WireTapDefinition<?>) def).getNewExchangeExpression(), languages); findOutputComponents(def.getOutputs(), components, languages, dataformats);