use of org.apache.camel.parser.ParserResult in project camel by apache.
the class RoasterSimpleToFTest method parse.
@Test
public void parse() throws Exception {
JavaClassSource clazz = (JavaClassSource) Roaster.parse(new File("src/test/java/org/apache/camel/parser/java/MySimpleToFRoute.java"));
MethodSource<JavaClassSource> method = CamelJavaParserHelper.findConfigureMethod(clazz);
List<CamelEndpointDetails> details = new ArrayList<>();
RouteBuilderParser.parseRouteBuilderEndpoints(clazz, ".", "src/test/java/org/apache/camel/parser/java/MySimpleToFRoute.java", details);
LOG.info("{}", details);
List<ParserResult> list = CamelJavaParserHelper.parseCamelConsumerUris(method, true, true);
for (ParserResult result : list) {
LOG.info("Consumer: " + result.getElement());
}
Assert.assertEquals("direct:start", list.get(0).getElement());
list = CamelJavaParserHelper.parseCamelProducerUris(method, true, true);
for (ParserResult result : list) {
LOG.info("Producer: " + result.getElement());
}
Assert.assertEquals("toF", list.get(0).getNode());
Assert.assertEquals("log:a?level={{%s}}", list.get(0).getElement());
Assert.assertEquals(1, list.size());
Assert.assertEquals(2, details.size());
Assert.assertEquals("direct:start", details.get(0).getEndpointUri());
Assert.assertEquals("log:a?level={{%s}}", details.get(1).getEndpointUri());
}
use of org.apache.camel.parser.ParserResult in project camel by apache.
the class RoasterSplitTokenizeTest method parse.
@Test
public void parse() throws Exception {
JavaClassSource clazz = (JavaClassSource) Roaster.parse(new File("src/test/java/org/apache/camel/parser/java/SplitTokenizeTest.java"));
MethodSource<JavaClassSource> method = CamelJavaParserHelper.findConfigureMethod(clazz);
List<CamelEndpointDetails> details = new ArrayList<>();
RouteBuilderParser.parseRouteBuilderEndpoints(clazz, "src/test/java", "org/apache/camel/parser/SplitTokenizeTest.java", details);
LOG.info("{}", details);
List<ParserResult> list = CamelJavaParserHelper.parseCamelConsumerUris(method, true, true);
for (ParserResult result : list) {
LOG.info("Consumer: " + result.getElement());
}
Assert.assertEquals("direct:a", list.get(0).getElement());
Assert.assertEquals("direct:b", list.get(1).getElement());
Assert.assertEquals("direct:c", list.get(2).getElement());
Assert.assertEquals("direct:d", list.get(3).getElement());
Assert.assertEquals("direct:e", list.get(4).getElement());
Assert.assertEquals("direct:f", list.get(5).getElement());
list = CamelJavaParserHelper.parseCamelProducerUris(method, true, true);
for (ParserResult result : list) {
LOG.info("Producer: " + result.getElement());
}
Assert.assertEquals("mock:split", list.get(0).getElement());
Assert.assertEquals("mock:split", list.get(1).getElement());
Assert.assertEquals("mock:split", list.get(2).getElement());
Assert.assertEquals("mock:split", list.get(3).getElement());
Assert.assertEquals("mock:split", list.get(4).getElement());
Assert.assertEquals("mock:split", list.get(5).getElement());
Assert.assertEquals(12, details.size());
Assert.assertEquals("direct:a", details.get(0).getEndpointUri());
Assert.assertEquals("mock:split", details.get(11).getEndpointUri());
}
use of org.apache.camel.parser.ParserResult in project camel by apache.
the class RoasterCdiConcatRouteBuilderConfigureTest method parse.
@Test
public void parse() throws Exception {
JavaClassSource clazz = (JavaClassSource) Roaster.parse(new File("src/test/java/org/apache/camel/parser/java/MyCdiConcatRouteBuilder.java"));
MethodSource<JavaClassSource> method = clazz.getMethod("configure");
List<ParserResult> list = CamelJavaParserHelper.parseCamelConsumerUris(method, true, true);
for (ParserResult result : list) {
LOG.info("Consumer: " + result.getElement());
}
Assert.assertEquals("timer:foo?period=4999", list.get(0).getElement());
list = CamelJavaParserHelper.parseCamelProducerUris(method, true, true);
for (ParserResult result : list) {
LOG.info("Producer: " + result.getElement());
}
Assert.assertEquals("log:a", list.get(0).getElement());
Assert.assertEquals("netty4-http:http:someserver:80/hello", list.get(1).getElement());
}
use of org.apache.camel.parser.ParserResult in project camel by apache.
the class RoasterCdiRouteBuilderConfigureTest method parse.
@Test
public void parse() throws Exception {
JavaClassSource clazz = (JavaClassSource) Roaster.parse(new File("src/test/java/org/apache/camel/parser/java/MyCdiRouteBuilder.java"));
MethodSource<JavaClassSource> method = clazz.getMethod("configure");
List<ParserResult> list = CamelJavaParserHelper.parseCamelConsumerUris(method, true, true);
for (ParserResult result : list) {
LOG.info("Consumer: " + result.getElement());
}
Assert.assertEquals("timer:foo?period=4999", list.get(0).getElement());
list = CamelJavaParserHelper.parseCamelProducerUris(method, true, true);
for (ParserResult result : list) {
LOG.info("Producer: " + result.getElement());
}
Assert.assertEquals("log:a", list.get(0).getElement());
Assert.assertEquals("netty4-http:http:someserver:80/hello", list.get(1).getElement());
}
use of org.apache.camel.parser.ParserResult in project camel by apache.
the class RoasterConcatFieldRouteBuilderConfigureTest method parse.
@Test
public void parse() throws Exception {
JavaClassSource clazz = (JavaClassSource) Roaster.parse(new File("src/test/java/org/apache/camel/parser/java/MyConcatFieldRouteBuilder.java"));
MethodSource<JavaClassSource> method = clazz.getMethod("configure");
List<ParserResult> list = CamelJavaParserHelper.parseCamelConsumerUris(method, true, true);
for (ParserResult result : list) {
LOG.info("Consumer: " + result.getElement());
}
Assert.assertEquals("ftp:localhost:{{ftpPort}}/myapp?password=admin&username=admin", list.get(0).getElement());
list = CamelJavaParserHelper.parseCamelProducerUris(method, true, true);
for (ParserResult result : list) {
LOG.info("Producer: " + result.getElement());
}
Assert.assertEquals("log:b", list.get(0).getElement());
}
Aggregations