public static void main(String... args) { // Create a one-time task that will open a url to config page in a browser // after the application has been given a couple of seconds to start up. new Timer().schedule(new TimerTask() { @Override public void run() { LOG.info("============= Open URL in Browser"); // Open a Browser window for the user BareBonesBrowserLaunch.openURL("http://localhost:8082/index.html"); LOG.info("============= After Open URL in Browser"); } }, 9000); LOG.info("============= Call Fat Jar Router Main"); // Call Fat Jar Router main last because it never returns FatJarRouter.main(args); LOG.info("============= Returned from Fat Jar Router Main"); }
@Test public void shouldStartCamelRoute() throws InterruptedException, IOException { // Given final int port = SocketUtils.findAvailableTcpPort(); final URL httpEndpoint = new URL("http://localhost:" + port); new Thread() { @Override public void run() { FatJarRouter.main("--spring.main.sources=org.apache.camel.spring.boot.fatjarroutertests.TestFatJarRouter", "--http.port=" + port); } }.start(); await().atMost(1, MINUTES).until(new Callable<Boolean>() { @Override public Boolean call() throws Exception { try { httpEndpoint.openStream(); } catch (ConnectException ex) { return false; } return true; } }); // When String response = IOUtils.toString(httpEndpoint); // Then assertEquals("stringBean", response); }
@Override protected Class<? extends FatJarRouter> routerClass() { return MySpringBootRouter.class; }
@Override protected Class<? extends FatJarRouter> routerClass() { return T5FatJarRouter.class; }
@Override protected Class<? extends FatJarRouter> routerClass() { return MainSpringBootCamelRouter.class; }