@Test public void testMultiFlowIntegrationRouteBuilder() throws Exception { String configurationLocation = "classpath:syndesis/integration/multi-flow-integration.json"; IntegrationRouteBuilder routeBuilder = new IntegrationRouteBuilder(configurationLocation, Resources.loadServices(IntegrationStepHandler.class), policyFactories); routeBuilder.configure(); dumpRoutes(new DefaultCamelContext(), routeBuilder.getRouteCollection()); RoutesDefinition routes = routeBuilder.getRouteCollection(); assertThat(routes.getRoutes()).hasSize(3); RouteDefinition primaryRoute = routes.getRoutes().get(0); assertThat(primaryRoute.getRoutePolicies()).hasSize(1); assertThat(primaryRoute.getRoutePolicies().get(0)).isInstanceOf(IntegrationActivityTrackingPolicy.class); assertThat(primaryRoute.getInput()).isNotNull(); assertThat(primaryRoute.getInput()).hasFieldOrPropertyWithValue("uri", "direct:expression"); assertThat(primaryRoute.getOutputs()).hasSize(2); assertThat(getOutput(primaryRoute, 0)).isInstanceOf(PipelineDefinition.class); assertThat(getOutput(primaryRoute, 0).getOutputs()).hasSize(2); assertThat(getOutput(primaryRoute, 0).getOutputs().get(0)).isInstanceOf(SetHeaderDefinition.class); assertThat(getOutput(primaryRoute, 0).getOutputs().get(1)).isInstanceOf(SetHeaderDefinition.class); assertThat(getOutput(primaryRoute, 1)).isInstanceOf(SplitDefinition.class); assertThat(getOutput(primaryRoute, 1).getOutputs()).hasSize(5); assertThat(getOutput(primaryRoute, 1, 0)).isInstanceOf(SetHeaderDefinition.class); assertThat(getOutput(primaryRoute, 1, 1)).isInstanceOf(ProcessDefinition.class); assertThat(getOutput(primaryRoute, 1, 2)).isInstanceOf(PipelineDefinition.class); assertThat(getOutput(primaryRoute, 1, 2).getOutputs()).hasSize(2); assertThat(getOutput(primaryRoute, 1, 2, 0)).isInstanceOf(SetHeaderDefinition.class); assertThat(getOutput(primaryRoute, 1, 2, 1)).isInstanceOf(LogDefinition.class); assertThat(getOutput(primaryRoute, 1, 2, 1)).hasFieldOrPropertyWithValue("message", "Body: [${bean:bodyLogger}] Before"); assertThat(getOutput(primaryRoute, 1, 3)).isInstanceOf(PipelineDefinition.class); assertThat(getOutput(primaryRoute, 1, 3).getOutputs()).hasSize(3); assertThat(getOutput(primaryRoute, 1, 3, 0)).isInstanceOf(SetHeaderDefinition.class); assertThat(getOutput(primaryRoute, 1, 3, 1)).isInstanceOf(ChoiceDefinition.class); assertThat(getOutput(primaryRoute, 1, 3, 2)).isInstanceOf(ProcessDefinition.class); assertThat(getOutput(primaryRoute, 1, 4)).isInstanceOf(PipelineDefinition.class); assertThat(getOutput(primaryRoute, 1, 4).getOutputs()).hasSize(2); assertThat(getOutput(primaryRoute, 1, 4, 0)).isInstanceOf(SetHeaderDefinition.class); assertThat(getOutput(primaryRoute, 1, 4, 1)).isInstanceOf(LogDefinition.class); assertThat(getOutput(primaryRoute, 1, 4, 1)).hasFieldOrPropertyWithValue("message", "Body: [${bean:bodyLogger}] Finished"); RouteDefinition conditionalRoute = routes.getRoutes().get(1); assertThat(conditionalRoute.getRoutePolicies()).hasSize(1); assertThat(conditionalRoute.getRoutePolicies().get(0)).isInstanceOf(FlowActivityTrackingPolicy.class); assertThat(conditionalRoute.getInput()).isNotNull(); assertThat(conditionalRoute.getInput()).hasFieldOrPropertyWithValue("uri", "direct"); assertThat(conditionalRoute.getOutputs()).hasSize(5); assertThat(getOutput(conditionalRoute, 0)).isInstanceOf(PipelineDefinition.class); assertThat(getOutput(conditionalRoute, 0).getOutputs()).hasSize(2); assertThat(getOutput(conditionalRoute, 0).getOutputs().get(0)).isInstanceOf(SetHeaderDefinition.class); assertThat(getOutput(conditionalRoute, 0).getOutputs().get(1)).isInstanceOf(SetHeaderDefinition.class); assertThat(getOutput(conditionalRoute, 1)).isInstanceOf(SetHeaderDefinition.class); assertThat(getOutput(conditionalRoute, 2)).isInstanceOf(ProcessDefinition.class); assertThat(getOutput(conditionalRoute, 3)).isInstanceOf(PipelineDefinition.class); assertThat(getOutput(conditionalRoute, 3).getOutputs()).hasSize(2); assertThat(getOutput(conditionalRoute, 3, 0)).isInstanceOf(SetHeaderDefinition.class); assertThat(getOutput(conditionalRoute, 3, 1)).isInstanceOf(LogDefinition.class); assertThat(getOutput(conditionalRoute, 3, 1)).hasFieldOrPropertyWithValue("message", "Body: [${bean:bodyLogger}] Found <Play>"); assertThat(getOutput(conditionalRoute, 4)).isInstanceOf(PipelineDefinition.class); assertThat(getOutput(conditionalRoute, 4).getOutputs()).hasSize(3); assertThat(getOutput(conditionalRoute, 4, 0)).isInstanceOf(SetHeaderDefinition.class); assertThat(getOutput(conditionalRoute, 4, 1)).isInstanceOf(ToDefinition.class); assertThat(getOutput(conditionalRoute, 4, 1)).hasFieldOrPropertyWithValue("uri", "bean:io.syndesis.connector.flow.NoOpBean?method=process"); assertThat(getOutput(conditionalRoute, 4, 2)).isInstanceOf(ProcessDefinition.class); }
@Override public void configure() throws Exception { final Integration integration = loadIntegration(); final List<Flow> flows = integration.getFlows(); for (int f = 0; f < flows.size(); f++) { configureFlow(flows.get(f), String.valueOf(f)); } }
IntegrationRouteBuilder extends RouteBuilder { @Override public void configure() throws Exception { final Integration integration = loadIntegration(); final List<Flow> flows = integration.getFlows(); for (int f = 0; f < flows.size(); f++) { configureFlow(flows.get(f), String.valueOf(f)); } } }
IntegrationRouteBuilder extends RouteBuilder { @Override public void configure() throws Exception { final Integration integration = loadIntegration(); final List<Flow> flows = integration.getFlows(); for (int f = 0; f < flows.size(); f++) { configureFlow(flows.get(f), String.valueOf(f)); } } IntegrationRouteBuilder(String configurationUri);  IntegrationRouteBuilder(String configurationUri, Collection<IntegrationStepHandler> handlers);  IntegrationRouteBuilder(String configurationUri, Collection<IntegrationStepHandler> handlers, List<ActivityTrackingPolicyFactory> activityTrackingPolicyFactories);  IntegrationRouteBuilder(SourceProvider sourceProvider, Collection<IntegrationStepHandler> handlers, List<ActivityTrackingPolicyFactory> activityTrackingPolicyFactories); }
IntegrationRouteBuilder extends RouteBuilder { @Override public void configure() throws Exception { final Integration integration = loadIntegration(); final List<Flow> flows = integration.getFlows(); for (int f = 0; f < flows.size(); f++) { configureFlow(flows.get(f), String.valueOf(f)); } } IntegrationRouteBuilder(String configurationUri);  IntegrationRouteBuilder(String configurationUri, Collection<IntegrationStepHandler> handlers);  IntegrationRouteBuilder(String configurationUri, Collection<IntegrationStepHandler> handlers, List<ActivityTrackingPolicyFactory> activityTrackingPolicyFactories);  IntegrationRouteBuilder(SourceProvider sourceProvider, Collection<IntegrationStepHandler> handlers, List<ActivityTrackingPolicyFactory> activityTrackingPolicyFactories); @Override ModelCamelContext getContext(); @Override void configure(); }
IntegrationRouteBuilder extends RouteBuilder { @Override public void configure() throws Exception { final Integration integration = loadIntegration(); final List<Flow> flows = integration.getFlows(); for (int f = 0; f < flows.size(); f++) { configureFlow(flows.get(f), String.valueOf(f)); } } IntegrationRouteBuilder(String configurationUri);  IntegrationRouteBuilder(String configurationUri, Collection<IntegrationStepHandler> handlers);  IntegrationRouteBuilder(String configurationUri, Collection<IntegrationStepHandler> handlers, List<ActivityTrackingPolicyFactory> activityTrackingPolicyFactories);  IntegrationRouteBuilder(SourceProvider sourceProvider, Collection<IntegrationStepHandler> handlers, List<ActivityTrackingPolicyFactory> activityTrackingPolicyFactories); @Override ModelCamelContext getContext(); @Override void configure();  }