org.apache.camel.model.RouteDefinition Java Examples

The following examples show how to use org.apache.camel.model.RouteDefinition. 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: WeaveByIdTest.java    From camelinaction2 with Apache License 2.0 6 votes vote down vote up
@Test
public void testWeaveById() throws Exception {
    RouteDefinition route = context.getRouteDefinition("quotes");
    route.adviceWith(context, new AdviceWithRouteBuilder() {
        @Override
        public void configure() throws Exception {
            // select the route node with the id=transform
            // and then replace it with the following route parts
            weaveById("transform").replace()
                .transform().simple("${body.toUpperCase()}");

            // and add at the end of the route to route to this mock endpoint
            weaveAddLast().to("mock:result");
        }
    });

    context.start();

    // we have replaced the bean transformer call with a simple expression that
    // performs an upper case
    getMockEndpoint("mock:result").expectedBodiesReceived("HELLO CAMEL");

    template.sendBody("seda:quotes", "Hello Camel");

    assertMockEndpointsSatisfied();
}
 
Example #2
Source File: RoutesLoaderTest.java    From camel-k-runtime with Apache License 2.0 6 votes vote down vote up
@ParameterizedTest
@MethodSource("parameters")
public void testLoaders(String location, Class<? extends SourceLoader> type) throws Exception {
    TestRuntime runtime = new TestRuntime();
    Source source = Sources.fromURI(location);
    SourceLoader loader = RoutesConfigurer.load(runtime, source);

    assertThat(loader).isInstanceOf(type);
    assertThat(runtime.builders).hasSize(1);
    assertThat(runtime.builders).first().isInstanceOf(RouteBuilder.class);

    RouteBuilder builder = (RouteBuilder)runtime.builders.get(0);
    builder.setContext(runtime.getCamelContext());
    builder.configure();

    List<RouteDefinition> routes = builder.getRouteCollection().getRoutes();
    assertThat(routes).hasSize(1);
    assertThat(routes.get(0).getInput().getEndpointUri()).matches("timer:/*tick");
    assertThat(routes.get(0).getOutputs().get(0)).isInstanceOf(ToDefinition.class);
}
 
Example #3
Source File: RoutesLoaderTest.java    From camel-k-runtime with Apache License 2.0 6 votes vote down vote up
@Test
public void testLoadJavaWithNestedClass() throws Exception {
    TestRuntime runtime = new TestRuntime();
    Source source = Sources.fromURI("classpath:MyRoutesWithNestedClass.java");
    SourceLoader loader = RoutesConfigurer.load(runtime, source);

    assertThat(loader).isInstanceOf(JavaSourceLoader.class);
    assertThat(runtime.builders).hasSize(1);
    assertThat(runtime.builders).first().isInstanceOf(RouteBuilder.class);

    RouteBuilder builder = (RouteBuilder)runtime.builders.get(0);
    builder.setContext(runtime.getCamelContext());
    builder.configure();

    List<RouteDefinition> routes = builder.getRouteCollection().getRoutes();
    assertThat(routes).hasSize(1);
    assertThat(routes.get(0).getInput().getEndpointUri()).isEqualTo("timer:tick");
    assertThat(routes.get(0).getOutputs().get(0)).isInstanceOf(SetBodyDefinition.class);
    assertThat(routes.get(0).getOutputs().get(1)).isInstanceOf(ProcessDefinition.class);
    assertThat(routes.get(0).getOutputs().get(2)).isInstanceOf(ToDefinition.class);
}
 
Example #4
Source File: RoutesLoaderTest.java    From camel-k-runtime with Apache License 2.0 6 votes vote down vote up
@ParameterizedTest
@MethodSource("parameters")
public void testLoaders(String location, Class<? extends SourceLoader> type) throws Exception {
    TestRuntime runtime = new TestRuntime();
    Source source = Sources.fromURI(location);
    SourceLoader loader = runtime.load(source);

    assertThat(loader).isInstanceOf(type);
    assertThat(runtime.builders).hasSize(1);
    assertThat(runtime.builders).first().isInstanceOf(RouteBuilder.class);

    RouteBuilder builder = (RouteBuilder)runtime.builders.get(0);
    builder.setContext(runtime.getCamelContext());
    builder.configure();

    List<RouteDefinition> routes = builder.getRouteCollection().getRoutes();
    assertThat(routes).hasSize(1);
    assertThat(routes.get(0).getInput().getEndpointUri()).isEqualTo("timer:tick");
    assertThat(routes.get(0).getOutputs().get(0)).isInstanceOf(ToDefinition.class);
}
 
Example #5
Source File: NamespacePreserveTest.java    From fabric8-forge with Apache License 2.0 6 votes vote down vote up
@Test
public void testUpdateAnXmlAndKeepNamespaces() throws Exception {
    File file = new File(getBaseDir(), "src/test/resources/namespaceRoute.xml");
    XmlModel xm = assertRoutes(file, 1, null);

    // now lets modify the xml
    List<RouteDefinition> definitionList = xm.getRouteDefinitionList();
    RouteDefinition route = new RouteDefinition().from("file:foo").to("file:bar");
    definitionList.add(route);

    System.out.println("Routes now: " + xm.getRouteDefinitionList());

    String text = FileCopyUtils.copyToString(new FileReader(file));

    RouteXml helper = new RouteXml();
    String newText = helper.marshalToText(text, definitionList);

    System.out.println("newText: " + newText);

    assertTrue("Generated XML has missing XML namespace declaration " + "http://acme.com/foo", newText.contains("http://acme.com/foo"));
    assertTrue("Generated XML has missing XML namespace declaration " + "urn:barNamespace", newText.contains("urn:barNamespace"));
}
 
Example #6
Source File: CamelPrefixFromSpringArchetypeTest.java    From fabric8-forge with Apache License 2.0 6 votes vote down vote up
@Test
public void testUpdateAnXmlWhichUsesCamelPrefixOnRootElement() throws Exception {
    String name = "src/test/resources/springArchetypeWithRootCamelPrefix.xml";
    File file = new File(getBaseDir(), name);
    XmlModel x = assertRoutes(file, 1, null);

    // now lets modify the xml
    List<RouteDefinition> definitionList = x.getRouteDefinitionList();
    RouteDefinition route = new RouteDefinition().from("file:foo").to("file:bar");
    definitionList.add(route);

    System.out.println("Routes now: " + x.getRouteDefinitionList());

    String text = FileCopyUtils.copyToString(new FileReader(file));

    RouteXml helper = new RouteXml();
    String newText = helper.marshalToText(text, definitionList);

    System.out.println("newText: " + newText);

    assertTrue(newText.contains("Configures the Camel Context"));

    assertValid(x);
}
 
Example #7
Source File: WhitespacePreserveTest.java    From fabric8-forge with Apache License 2.0 6 votes vote down vote up
public void testWhitespaceXmlFile(String name) throws Exception {
    File file = new File(getBaseDir(), name);
    XmlModel x = assertRoutes(file, 1, null);

    // now lets modify the xml
    List<RouteDefinition> definitionList = x.getRouteDefinitionList();
    RouteDefinition route = new RouteDefinition().from("file:foo").to("file:bar");
    definitionList.add(route);

    System.out.println("Routes now: " + x.getRouteDefinitionList());

    RouteXml helper = new RouteXml();
    String newText = helper.marshalToText(x);

    System.out.println("newText: " + newText);

    assertTrue(newText.contains("a comment before root element"));
}
 
Example #8
Source File: RouteStepParser.java    From camel-k-runtime with Apache License 2.0 6 votes vote down vote up
@Override
public ProcessorDefinition<?> toStartProcessor(Context context) {
    final Definition definition = context.node(Definition.class);

    final ProcessorDefinition<?> root = StartStepParser.invoke(
        ProcessorStepParser.Context.of(context, definition.getRoot().getData()),
        definition.getRoot().getType());

    if (root == null) {
        throw new IllegalStateException("No route definition");
    }
    if (!(root instanceof RouteDefinition)) {
        throw new IllegalStateException("Root definition should be of type RouteDefinition");
    }

    definition.getId().ifPresent(root::routeId);
    definition.getGroup().ifPresent(root::routeGroup);

    return root;
}
 
Example #9
Source File: CamelPrefixOnRootElementTest.java    From fabric8-forge with Apache License 2.0 6 votes vote down vote up
@Test
public void testUpdateAnXmlWhichUsesCamelPrefixOnRootElement() throws Exception {
    String name = "src/test/resources/camelPrefixOnRoot.xml";
    File file = new File(getBaseDir(), name);
    XmlModel x = assertRoutes(file, 1, null);

    // now lets modify the xml
    List<RouteDefinition> definitionList = x.getRouteDefinitionList();
    RouteDefinition route = new RouteDefinition().from("file:foo").to("file:bar");
    definitionList.add(route);

    System.out.println("Routes now: " + x.getRouteDefinitionList());

    String text = FileCopyUtils.copyToString(new FileReader(file));

    RouteXml helper = new RouteXml();
    String newText = helper.marshalToText(text, definitionList);

    System.out.println("newText: " + newText);

    assertTrue(newText.contains("Configures the Camel Context"));

    assertValid(x);
}
 
Example #10
Source File: CamelMailetProcessor.java    From james-project with Apache License 2.0 6 votes vote down vote up
@Override
public void configure() {
    String state = container.getState();
    CamelProcessor terminatingMailetProcessor = new CamelProcessor(metricFactory, container, new TerminatingMailet());

    RouteDefinition processorDef = from(container.getEndpoint())
        .routeId(state)
        .setExchangePattern(ExchangePattern.InOnly);

    for (MatcherMailetPair pair : pairs) {
        CamelProcessor mailetProccessor = new CamelProcessor(metricFactory, container, pair.getMailet());
        MatcherSplitter matcherSplitter = new MatcherSplitter(metricFactory, container, pair);

        processorDef
                // do splitting of the mail based on the stored matcher
                .split().method(matcherSplitter)
                    .aggregationStrategy(new UseLatestAggregationStrategy())
                .process(exchange -> handleMailet(exchange, container, mailetProccessor));
    }

    processorDef
        .process(exchange -> terminateSmoothly(exchange, container, terminatingMailetProcessor));

}
 
Example #11
Source File: CamelXmlHelper.java    From fabric8-forge with Apache License 2.0 6 votes vote down vote up
protected static List<NodeDto> createRouteDtos(CamelCatalog camelCatalog, List<RouteDefinition> routeDefs, ContextDto context) {
    List<NodeDto> answer = new ArrayList<>();
    Map<String, Integer> nodeCounts = new HashMap<>();
    for (RouteDefinition def : routeDefs) {
        RouteDto route = new RouteDto();
        route.setId(def.getId());
        route.setLabel(CamelModelHelper.getDisplayText(def));
        route.setDescription(CamelModelHelper.getDescription(def));
        answer.add(route);
        route.defaultKey(context, nodeCounts);

        addInputs(camelCatalog, route, def.getInputs());
        addOutputs(camelCatalog, route, def.getOutputs());
    }
    return answer;
}
 
Example #12
Source File: CamelXmlHelper.java    From fabric8-forge with Apache License 2.0 6 votes vote down vote up
protected static List<ContextDto> parseCamelContexts(CamelCatalog camelCatalog, File xmlFile) throws Exception {
    List<ContextDto> camelContexts = new ArrayList<>();

    RouteXml routeXml = new RouteXml();
    XmlModel xmlModel = routeXml.unmarshal(xmlFile);

    // TODO we don't handle multiple contexts inside an XML file!
    CamelContextFactoryBean contextElement = xmlModel.getContextElement();
    String name = contextElement.getId();
    List<RouteDefinition> routeDefs = contextElement.getRoutes();
    ContextDto context = new ContextDto(name);
    camelContexts.add(context);
    String key = name;
    if (Strings.isNullOrBlank(key)) {
        key = "_camelContext" + camelContexts.size();
    }
    context.setKey(key);
    List<NodeDto> routes = createRouteDtos(camelCatalog, routeDefs, context);
    context.setChildren(routes);
    return camelContexts;
}
 
Example #13
Source File: IntegrationRouteLoaderTest.java    From syndesis with Apache License 2.0 6 votes vote down vote up
@Test
public void integrationRouteLoaderTest() throws Exception {
    IntegrationRouteLoader irl = new IntegrationRouteLoader();
    TestRuntime runtime = new TestRuntime();

    irl.load(runtime,
        Sources.fromURI("classpath:/syndesis/integration/integration.syndesis?language=syndesis"));

    assertThat(runtime.builders).hasSize(1);
    final RoutesBuilder routeBuilder = runtime.builders.get(0);
    assertThat(routeBuilder).isInstanceOf(RouteBuilder.class);

    RouteBuilder rb = (RouteBuilder) routeBuilder;
    // initialize routes
    rb.configure();
    final RoutesDefinition routeCollection = rb.getRouteCollection();
    final List<RouteDefinition> routes = routeCollection.getRoutes();
    assertThat(routes).hasSize(1);
    final RouteDefinition route = routes.get(0);
    final FromDefinition input = route.getInput();
    assertThat(input).isNotNull();
    assertThat(input.getEndpointUri()).isEqualTo("direct:expression");
}
 
Example #14
Source File: AdviceWithMockEndpointsTest.java    From camelinaction2 with Apache License 2.0 6 votes vote down vote up
@Test
public void testMockEndpoints() throws Exception {
    RouteDefinition route = context.getRouteDefinition("quotes");
    route.adviceWith(context, new AdviceWithRouteBuilder() {
        @Override
        public void configure() throws Exception {
            mockEndpoints();
        }
    });

    // must start Camel after we are done using advice-with
    context.start();

    getMockEndpoint("mock:seda:camel").expectedBodiesReceived("Camel rocks");
    getMockEndpoint("mock:seda:other").expectedBodiesReceived("Bad donkey");

    template.sendBody("seda:quotes", "Camel rocks");
    template.sendBody("seda:quotes", "Bad donkey");

    assertMockEndpointsSatisfied();
}
 
Example #15
Source File: WeaveByToUriTest.java    From camelinaction2 with Apache License 2.0 6 votes vote down vote up
@Test
public void testWeaveByToUri() throws Exception {
    RouteDefinition route = context.getRouteDefinition("quotes");
    route.adviceWith(context, new AdviceWithRouteBuilder() {
        @Override
        public void configure() throws Exception {
            // replace all to("seda:line") with a mock:line instead
            weaveByToUri("seda:line").replace().to("mock:line");
        }
    });

    context.start();

    getMockEndpoint("mock:line").expectedBodiesReceived("camel rules", "donkey is bad");
    getMockEndpoint("mock:combined").expectedMessageCount(1);
    getMockEndpoint("mock:combined").message(0).body().isInstanceOf(List.class);

    template.sendBody("seda:quotes", "Camel Rules,Donkey is Bad");

    assertMockEndpointsSatisfied();
}
 
Example #16
Source File: ReplaceFromTest.java    From camelinaction2 with Apache License 2.0 6 votes vote down vote up
@Test
public void testReplaceFromWithEndpoints() throws Exception {
    RouteDefinition route = context.getRouteDefinition("quotes");
    route.adviceWith(context, new AdviceWithRouteBuilder() {
        @Override
        public void configure() throws Exception {
            // replace the incoming endpoint with a direct endpoint
            // we can easily call from unit test
            replaceFromWith("direct:hitme");
            // and then mock all seda endpoints os we can use mock endpoints
            // to assert the test is correct
            mockEndpoints("seda:*");
        }
    });

    // must start Camel after we are done using advice-with
    context.start();

    getMockEndpoint("mock:seda:camel").expectedBodiesReceived("Camel rocks");
    getMockEndpoint("mock:seda:other").expectedBodiesReceived("Bad donkey");

    template.sendBody("direct:hitme", "Camel rocks");
    template.sendBody("direct:hitme", "Bad donkey");

    assertMockEndpointsSatisfied();
}
 
Example #17
Source File: WeaveByTypeSelectFirstTest.java    From camelinaction2 with Apache License 2.0 6 votes vote down vote up
@Test
public void testWeaveByTypeSelectFirst() throws Exception {
    RouteDefinition route = context.getRouteDefinition("quotes");
    route.adviceWith(context, new AdviceWithRouteBuilder() {
        @Override
        public void configure() throws Exception {
            // find the send to and select the first which gets replaced
            weaveByType(ToDefinition.class).selectFirst().replace().to("mock:line");
        }
    });

    context.start();

    getMockEndpoint("mock:line").expectedBodiesReceived("camel rules", "donkey is bad");
    getMockEndpoint("mock:combined").expectedMessageCount(1);
    getMockEndpoint("mock:combined").message(0).body().isInstanceOf(List.class);

    template.sendBody("seda:quotes", "Camel Rules,Donkey is Bad");

    assertMockEndpointsSatisfied();
}
 
Example #18
Source File: RoutesLoaderTest.java    From camel-k-runtime with Apache License 2.0 6 votes vote down vote up
@ParameterizedTest
@MethodSource("parameters")
public void testLoaders(String location, Class<? extends SourceLoader> type) throws Exception {
    TestRuntime runtime = new TestRuntime();
    Source source = Sources.fromURI(location);
    SourceLoader loader = RoutesConfigurer.load(runtime, source);

    assertThat(loader).isInstanceOf(type);
    assertThat(runtime.builders).hasSize(1);
    assertThat(runtime.builders).first().isInstanceOf(RouteBuilder.class);

    RouteBuilder builder = (RouteBuilder)runtime.builders.get(0);
    builder.setContext(runtime.getCamelContext());
    builder.configure();

    List<RouteDefinition> routes = builder.getRouteCollection().getRoutes();
    assertThat(routes).hasSize(1);
    assertThat(routes.get(0).getInput().getEndpointUri()).matches("timer:/*tick");
    assertThat(routes.get(0).getOutputs().get(0)).isInstanceOf(ToDefinition.class);
}
 
Example #19
Source File: KnativeConverterTest.java    From camel-k-runtime with Apache License 2.0 6 votes vote down vote up
private static void validateSteps(RouteDefinition definition) {
    List<ProcessorDefinition<?>> outputs = definition.getOutputs();

    assertThat(outputs).hasSize(2);

    assertThat(outputs)
        .element(0)
        .isInstanceOfSatisfying(ToDefinition.class, t-> {
            assertThat(t.getEndpointUri()).isEqualTo("log:info");
        });
    assertThat(outputs)
        .element(1)
        .isInstanceOfSatisfying(ToDefinition.class, t-> {
            assertThat(t.getEndpointUri()).isEqualTo("knative:endpoint/to");
        });
}
 
Example #20
Source File: PreserveCommentTest.java    From fabric8-forge with Apache License 2.0 5 votes vote down vote up
@Test
public void testCommentsInRoutePreserved() throws Exception {
    XmlModel x = assertRoundTrip("src/test/resources/commentInRoute.xml", 1);

    RouteDefinition route1 = x.getRouteDefinitionList().get(0);
    DescriptionDefinition desc = route1.getDescription();
    assertNotNull(desc);
    assertEquals("route3 comment", desc.getText());
}
 
Example #21
Source File: IntegrationTestSupport.java    From syndesis with Apache License 2.0 5 votes vote down vote up
public static ProcessorDefinition<?> getOutput(RouteDefinition definition, int... indices) {
    ProcessorDefinition<?> output = definition;
    for (int index : indices) {
        output = output.getOutputs().get(index);
    }

    return output;
}
 
Example #22
Source File: XmlModel.java    From fabric8-forge with Apache License 2.0 5 votes vote down vote up
public boolean hasMissingId() {
    for (RouteDefinition rd : getRouteDefinitionList()) {
        if (rd.getId() == null) {
            return true;
        }
    }
    return false;
}
 
Example #23
Source File: StandAloneRoutesXmlMarshalToTextTest.java    From fabric8-forge with Apache License 2.0 5 votes vote down vote up
@Test
public void testMarshalToText() throws Exception {
    String text = FileCopyUtils.copyToString(new FileReader(new File(getBaseDir(), "src/test/resources/routes.xml")));

    RouteDefinition route = new RouteDefinition();
    route.from("seda:new.in").to("seda:new.out");

    String actual = tool.marshalToText(text, Arrays.asList(route));
    System.out.println("Got " + actual);

    assertTrue("Missing seda:new.in for: " + actual, actual.contains("seda:new.in"));
}
 
Example #24
Source File: SimulateErrorUsingInterceptorTest.java    From camelinaction2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testSimulateErrorUsingInterceptors() throws Exception {
    // first find the route we need to advice. Since we only have one route
    // then just grab the first from the list
    RouteDefinition route = context.getRouteDefinitions().get(0);

    // advice the route by enriching it with the route builder where
    // we add a couple of interceptors to help simulate the error
    route.adviceWith(context, new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // intercept sending to http and detour to our processor instead
            interceptSendToEndpoint("http://*")
                // skip sending to the real http when the detour ends
                .skipSendToOriginalEndpoint()
                .process(new SimulateHttpErrorProcessor());

            // intercept sending to ftp and detour to the mock instead
            interceptSendToEndpoint("ftp://*")
                // skip sending to the real ftp endpoint
                .skipSendToOriginalEndpoint()
                .to("mock:ftp");
        }
    });

    // our mock should receive the message
    MockEndpoint mock = getMockEndpoint("mock:ftp");
    mock.expectedBodiesReceived("Camel rocks");

    // start the test by creating a file that gets picked up by the route
    template.sendBodyAndHeader(file, "Camel rocks", Exchange.FILE_NAME, "hello.txt");

    // assert our test passes
    assertMockEndpointsSatisfied();
}
 
Example #25
Source File: PreserveCommentTest.java    From fabric8-forge with Apache License 2.0 5 votes vote down vote up
@Test
public void testCommentsInRouteWithDescriptionPreserved() throws Exception {
    XmlModel x = assertRoundTrip("src/test/resources/commentInRouteWithDescription.xml", 1);

    RouteDefinition route1 = x.getRouteDefinitionList().get(0);
    DescriptionDefinition desc = route1.getDescription();
    assertNotNull(desc);
    assertEquals("previous description\nnew comment added to previous one", desc.getText());
}
 
Example #26
Source File: WeaveByTypeTest.java    From camelinaction2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testWeaveByType() throws Exception {
    RouteDefinition route = context.getRouteDefinition("quotes");
    route.adviceWith(context, new AdviceWithRouteBuilder() {
        @Override
        public void configure() throws Exception {
            // find the splitter and insert the route snippet before it
            weaveByType(SplitDefinition.class)
                .before()
                    .filter(body().contains("Donkey"))
                    .transform(simple("${body},Mules cannot do this"));
        }
    });

    context.start();

    getMockEndpoint("mock:line").expectedBodiesReceived("camel rules", "donkey is bad", "mules cannot do this");
    getMockEndpoint("mock:combined").expectedMessageCount(1);
    getMockEndpoint("mock:combined").message(0).body().isInstanceOf(List.class);

    template.sendBody("seda:quotes", "Camel Rules,Donkey is Bad");

    assertMockEndpointsSatisfied();

    resetMocks();

    // try again without the donkeys

    getMockEndpoint("mock:line").expectedBodiesReceived("beer is good", "whiskey is better");
    getMockEndpoint("mock:combined").expectedMessageCount(1);
    getMockEndpoint("mock:combined").message(0).body().isInstanceOf(List.class);

    template.sendBody("seda:quotes", "Beer is good,Whiskey is better");

    assertMockEndpointsSatisfied();
}
 
Example #27
Source File: PreserveCommentTest.java    From fabric8-forge with Apache License 2.0 5 votes vote down vote up
private XmlModel assertRoundTrip(String name, int count) throws Exception {
    File file = new File(getBaseDir(), name);
    XmlModel x = assertRoutes(file, count, null);

    // now lets modify the xml
    List<RouteDefinition> definitionList = x.getRouteDefinitionList();
    RouteDefinition route = new RouteDefinition().from("file:foo").to("file:bar");
    definitionList.add(route);

    System.out.println("Round tripped to: " + x);
    return x;
}
 
Example #28
Source File: RouteXml.java    From fabric8-forge with Apache License 2.0 5 votes vote down vote up
/**
 * Loads the given file then updates the route definitions from the given list then stores the file again
 */
public void marshal(File file, final List<RouteDefinition> routeDefinitionList) throws Exception {
    marshal(file, new Model2Model() {
        @Override
        public XmlModel transform(XmlModel model) {
            copyRoutesToElement(routeDefinitionList, model.getContextElement());
            return model;
        }
    });
}
 
Example #29
Source File: RouteXml.java    From fabric8-forge with Apache License 2.0 5 votes vote down vote up
public String marshalToText(String text, final List<RouteDefinition> routeDefinitionList) throws Exception {
    return marshalToText(text, new Model2Model() {
        @Override
        public XmlModel transform(XmlModel model) {
            copyRoutesToElement(routeDefinitionList, model.getContextElement());
            return model;
        }
    });
}
 
Example #30
Source File: RoutesDefinitionRuleSet.java    From mdw with Apache License 2.0 5 votes vote down vote up
public RoutesDefinitionRuleSet(RoutesDefinition routes, Asset ruleSet) {
    this.routesDefinition = routes;
    this.ruleSet = ruleSet;

    for (RouteDefinition routeDef : routesDefinition.getRoutes()) {
        routeIds.add(routeDef.getId());
    }
}