use of org.apache.camel.component.routebox.demo.Book in project camel by apache.
the class RouteboxDefaultContextAndRouteBuilderTest method testRouteboxUsingDefaultContextAndRouteBuilder.
@Test
public void testRouteboxUsingDefaultContextAndRouteBuilder() throws Exception {
template = new DefaultProducerTemplate(context);
template.start();
context.addRoutes(new RouteBuilder() {
public void configure() {
from(routeboxUri).to("log:Routes operation performed?showAll=true");
}
});
context.start();
LOG.debug("Beginning Test ---> testRouteboxUsingDefaultContextAndRouteBuilder()");
Book book = new Book("Sir Arthur Conan Doyle", "The Adventures of Sherlock Holmes");
String response = sendAddToCatalogRequest(template, routeboxUri, "addToCatalog", book);
assertEquals("Book with Author " + book.getAuthor() + " and title " + book.getTitle() + " added to Catalog", response);
book = sendFindBookRequest(template, routeboxUri, "findBook", "Sir Arthur Conan Doyle");
LOG.debug("Received book with author {} and title {}", book.getAuthor(), book.getTitle());
assertEquals("The Adventures of Sherlock Holmes", book.getTitle());
LOG.debug("Completed Test ---> testRouteboxUsingDefaultContextAndRouteBuilder()");
context.stop();
}
use of org.apache.camel.component.routebox.demo.Book in project camel by apache.
the class RouteboxDirectProducerOnlyTest method testRouteboxDirectProducerOnlyRequests.
@Test
public void testRouteboxDirectProducerOnlyRequests() throws Exception {
template = new DefaultProducerTemplate(context);
template.start();
context.addRoutes(new RouteBuilder() {
public void configure() {
from("direct:start").to(routeboxUri).to("log:Routes operation performed?showAll=true");
}
});
context.start();
LOG.debug("Beginning Test ---> testRouteboxDirectSyncRequests()");
Book book = new Book("Sir Arthur Conan Doyle", "The Adventures of Sherlock Holmes");
String response = sendAddToCatalogRequest(template, "direct:start", "addToCatalog", book);
assertEquals("Book with Author " + book.getAuthor() + " and title " + book.getTitle() + " added to Catalog", response);
//Thread.sleep(2000);
book = sendFindBookRequest(template, "direct:start", "findBook", "Sir Arthur Conan Doyle");
LOG.debug("Received book with author {} and title {}", book.getAuthor(), book.getTitle());
assertEquals("The Adventures of Sherlock Holmes", book.getTitle());
LOG.debug("Completed Test ---> testRouteboxDirectSyncRequests()");
context.stop();
}
use of org.apache.camel.component.routebox.demo.Book in project camel by apache.
the class RouteboxDirectTest method testRouteboxDirectAsyncRequests.
@Test
public void testRouteboxDirectAsyncRequests() throws Exception {
template = new DefaultProducerTemplate(context);
template.start();
context.addRoutes(new RouteBuilder() {
public void configure() {
from(routeboxUri).to("log:Routes operation performed?showAll=true");
}
});
context.start();
LOG.debug("Beginning Test ---> testRouteboxDirectAsyncRequests()");
Book book = new Book("Sir Arthur Conan Doyle", "The Adventures of Sherlock Holmes");
String response = sendAddToCatalogRequest(template, routeboxUri, "addToCatalog", book);
assertEquals("Book with Author " + book.getAuthor() + " and title " + book.getTitle() + " added to Catalog", response);
// Wait for 2 seconds before a follow-on request if the requests are sent in async mode
// to allow the earlier request to take effect
//Thread.sleep(2000);
book = sendFindBookRequest(template, routeboxUri, "findBook", "Sir Arthur Conan Doyle");
LOG.debug("Received book with author {} and title {}", book.getAuthor(), book.getTitle());
assertEquals("The Adventures of Sherlock Holmes", book.getTitle());
LOG.debug("Completed Test ---> testRouteboxDirectAsyncRequests()");
context.stop();
}
use of org.apache.camel.component.routebox.demo.Book in project camel by apache.
the class RouteboxDispatchMapTest method testRouteboxUsingDispatchMap.
@Test
public void testRouteboxUsingDispatchMap() throws Exception {
template = new DefaultProducerTemplate(context);
template.start();
context.addRoutes(new RouteBuilder() {
public void configure() {
from(routeboxUri).to("log:Routes operation performed?showAll=true");
}
});
context.start();
LOG.debug("Beginning Test ---> testRouteboxUsingDispatchMap()");
Book book = new Book("Sir Arthur Conan Doyle", "The Adventures of Sherlock Holmes");
String response = sendAddToCatalogRequest(template, routeboxUri, "addToCatalog", book);
assertEquals("Book with Author " + book.getAuthor() + " and title " + book.getTitle() + " added to Catalog", response);
book = sendFindBookRequest(template, routeboxUri, "findBook", "Sir Arthur Conan Doyle");
LOG.debug("Received book with author {} and title {}", book.getAuthor(), book.getTitle());
assertEquals("The Adventures of Sherlock Holmes", book.getTitle());
LOG.debug("Completed Test ---> testRouteboxUsingDispatchMap()");
context.stop();
}
use of org.apache.camel.component.routebox.demo.Book in project camel by apache.
the class RouteboxSedaTest method testRouteboxSedaAsyncRequests.
@Test
public void testRouteboxSedaAsyncRequests() throws Exception {
template = new DefaultProducerTemplate(context);
template.start();
context.addRoutes(new RouteBuilder() {
public void configure() {
from(routeboxUri).to("log:Routes operation performed?showAll=true");
}
});
context.start();
LOG.debug("Beginning Test ---> testRouteboxSedaAsyncRequests()");
Book book = new Book("Sir Arthur Conan Doyle", "The Adventures of Sherlock Holmes");
String response = sendAddToCatalogRequest(template, routeboxUri, "addToCatalog", book);
assertEquals("Book with Author " + book.getAuthor() + " and title " + book.getTitle() + " added to Catalog", response);
// Wait for 2 seconds before a follow-on request if the requests are sent in async mode
// to allow the earlier request to take effect
//Thread.sleep(2000);
book = sendFindBookRequest(template, routeboxUri, "findBook", "Sir Arthur Conan Doyle");
LOG.debug("Received book with author {} and title {}", book.getAuthor(), book.getTitle());
assertEquals("The Adventures of Sherlock Holmes", book.getTitle());
LOG.debug("Completed Test ---> testRouteboxSedaAsyncRequests()");
context.stop();
}
Aggregations