Created
May 12, 2011 14:33
-
-
Save davsclaus/968611 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LocalCamelFacadeTest extends TestCase { | |
private CamelContext camelContext; | |
private LocalCamelFacade local; | |
@Before | |
public void setUp() throws Exception { | |
camelContext = createCamelContext("myCamel"); | |
local = new LocalCamelFacade(camelContext); | |
} | |
@Test | |
public void testGetName() throws Exception { | |
String name = local.getCamelContextName(); | |
assertEquals(camelContext.getName(), name); | |
assertEquals("myCamel", name); | |
} | |
@Test | |
public void testGetRoutes() throws Exception { | |
int size = camelContext.getRoutes().size(); | |
assertEquals(size, local.getRoutes().size()); | |
CamelRouteMBean route = local.getRoutes().iterator().next(); | |
assertNotNull(route); | |
System.out.println(route.getRouteId()); | |
System.out.println(route.getEndpointUri()); | |
} | |
private CamelContext createCamelContext(String name) throws Exception { | |
// JMX is enabled by default in CamelContext | |
DefaultCamelContext answer = new DefaultCamelContext(); | |
answer.setName(name); | |
answer.addRoutes(new RouteBuilder() { | |
@Override | |
public void configure() throws Exception { | |
from("seda:in").routeId("in-route") | |
.to("log:in") | |
.to("seda:out"); | |
} | |
}); | |
answer.start(); | |
return answer; | |
} | |
} | |
// | |
and the console outputs | |
in-route | |
seda://in |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment