Repository: camel Updated Branches: refs/heads/master 1ba5aa2f4 -> b4701df4d
[Spring Boot] Renamed test package to avoid ambiguity. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b4701df4 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b4701df4 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b4701df4 Branch: refs/heads/master Commit: b4701df4dca07c4afacc759b8f49a3d81b6f4ffb Parents: 1ba5aa2 Author: Henryk Konsek <hekon...@gmail.com> Authored: Mon Feb 16 15:11:25 2015 +0100 Committer: Henryk Konsek <hekon...@gmail.com> Committed: Mon Feb 16 15:11:37 2015 +0100 ---------------------------------------------------------------------- .../fatjarrouter/JUnitFatJarRouterTest.java | 52 ----------------- .../StandaloneFatJarRouterTest.java | 61 -------------------- .../boot/fatjarrouter/TestFatJarRouter.java | 36 ------------ .../JUnitFatJarRouterTest.java | 52 +++++++++++++++++ .../StandaloneFatJarRouterTest.java | 61 ++++++++++++++++++++ .../fatjarroutertests/TestFatJarRouter.java | 36 ++++++++++++ 6 files changed, 149 insertions(+), 149 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/b4701df4/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarrouter/JUnitFatJarRouterTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarrouter/JUnitFatJarRouterTest.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarrouter/JUnitFatJarRouterTest.java deleted file mode 100644 index 322eb40..0000000 --- a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarrouter/JUnitFatJarRouterTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.spring.boot.fatjarrouter; - -import java.io.IOException; -import java.net.URL; - -import org.apache.commons.io.IOUtils; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.IntegrationTest; -import org.springframework.boot.test.SpringApplicationConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.util.SocketUtils; - -@RunWith(SpringJUnit4ClassRunner.class) -@SpringApplicationConfiguration(classes = TestFatJarRouter.class) -@IntegrationTest("spring.main.sources=org.apache.camel.spring.boot.fatjarrouter") -public class JUnitFatJarRouterTest extends Assert { - - static int port = SocketUtils.findAvailableTcpPort(); - - @BeforeClass - public static void beforeClass() { - System.setProperty("http.port", port + ""); - } - - @Test - public void shouldStartCamelRoute() throws InterruptedException, IOException { - String response = IOUtils.toString(new URL("http://localhost:" + port)); - - assertEquals("stringBean", response); - } - -} - http://git-wip-us.apache.org/repos/asf/camel/blob/b4701df4/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarrouter/StandaloneFatJarRouterTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarrouter/StandaloneFatJarRouterTest.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarrouter/StandaloneFatJarRouterTest.java deleted file mode 100644 index 5576fa1..0000000 --- a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarrouter/StandaloneFatJarRouterTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.spring.boot.fatjarrouter; - -import java.io.IOException; -import java.net.ConnectException; -import java.net.URL; -import java.util.concurrent.Callable; - -import static java.util.concurrent.TimeUnit.MINUTES; - -import org.apache.commons.io.IOUtils; -import org.junit.Assert; -import org.junit.Test; -import org.springframework.util.SocketUtils; - -import static com.jayway.awaitility.Awaitility.await; - -public class StandaloneFatJarRouterTest extends Assert { - - @Test - public void shouldStartCamelRoute() throws InterruptedException, IOException { - // Given - final int port = SocketUtils.findAvailableTcpPort(); - final URL httpEndpoint = new URL("http://localhost:" + port); - TestFatJarRouter.main("--spring.main.sources=org.apache.camel.spring.boot.fatjarrouter.TestFatJarRouter", "--http.port=" + port); - 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); - } - -} - http://git-wip-us.apache.org/repos/asf/camel/blob/b4701df4/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarrouter/TestFatJarRouter.java ---------------------------------------------------------------------- diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarrouter/TestFatJarRouter.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarrouter/TestFatJarRouter.java deleted file mode 100644 index 87ae366..0000000 --- a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarrouter/TestFatJarRouter.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.spring.boot.fatjarrouter; - -import org.apache.camel.spring.boot.FatJarRouter; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; - -@SpringBootApplication -public class TestFatJarRouter extends FatJarRouter { - - @Override - public void configure() throws Exception { - from("netty-http:http://0.0.0.0:{{http.port}}").setBody().simple("ref:stringBean"); - } - - @Bean - String stringBean() { - return "stringBean"; - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/b4701df4/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarroutertests/JUnitFatJarRouterTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarroutertests/JUnitFatJarRouterTest.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarroutertests/JUnitFatJarRouterTest.java new file mode 100644 index 0000000..6014580 --- /dev/null +++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarroutertests/JUnitFatJarRouterTest.java @@ -0,0 +1,52 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.spring.boot.fatjarroutertests; + +import java.io.IOException; +import java.net.URL; + +import org.apache.commons.io.IOUtils; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.IntegrationTest; +import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.util.SocketUtils; + +@RunWith(SpringJUnit4ClassRunner.class) +@SpringApplicationConfiguration(classes = TestFatJarRouter.class) +@IntegrationTest("spring.main.sources=org.apache.camel.spring.boot.fatjarroutertests") +public class JUnitFatJarRouterTest extends Assert { + + static int port = SocketUtils.findAvailableTcpPort(); + + @BeforeClass + public static void beforeClass() { + System.setProperty("http.port", port + ""); + } + + @Test + public void shouldStartCamelRoute() throws InterruptedException, IOException { + String response = IOUtils.toString(new URL("http://localhost:" + port)); + + assertEquals("stringBean", response); + } + +} + http://git-wip-us.apache.org/repos/asf/camel/blob/b4701df4/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarroutertests/StandaloneFatJarRouterTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarroutertests/StandaloneFatJarRouterTest.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarroutertests/StandaloneFatJarRouterTest.java new file mode 100644 index 0000000..af8916b --- /dev/null +++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarroutertests/StandaloneFatJarRouterTest.java @@ -0,0 +1,61 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.spring.boot.fatjarroutertests; + +import java.io.IOException; +import java.net.ConnectException; +import java.net.URL; +import java.util.concurrent.Callable; + +import static java.util.concurrent.TimeUnit.MINUTES; + +import org.apache.commons.io.IOUtils; +import org.junit.Assert; +import org.junit.Test; +import org.springframework.util.SocketUtils; + +import static com.jayway.awaitility.Awaitility.await; + +public class StandaloneFatJarRouterTest extends Assert { + + @Test + public void shouldStartCamelRoute() throws InterruptedException, IOException { + // Given + final int port = SocketUtils.findAvailableTcpPort(); + final URL httpEndpoint = new URL("http://localhost:" + port); + TestFatJarRouter.main("--spring.main.sources=org.apache.camel.spring.boot.fatjarroutertests.TestFatJarRouter", "--http.port=" + port); + 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); + } + +} + http://git-wip-us.apache.org/repos/asf/camel/blob/b4701df4/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarroutertests/TestFatJarRouter.java ---------------------------------------------------------------------- diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarroutertests/TestFatJarRouter.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarroutertests/TestFatJarRouter.java new file mode 100644 index 0000000..9770024 --- /dev/null +++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarroutertests/TestFatJarRouter.java @@ -0,0 +1,36 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.spring.boot.fatjarroutertests; + +import org.apache.camel.spring.boot.FatJarRouter; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; + +@SpringBootApplication +public class TestFatJarRouter extends FatJarRouter { + + @Override + public void configure() throws Exception { + from("netty-http:http://0.0.0.0:{{http.port}}").setBody().simple("ref:stringBean"); + } + + @Bean + String stringBean() { + return "stringBean"; + } + +}