camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [5/5] camel git commit: CAMEL-10770: Upgrade to Spring Boot 1.5.1
Date Tue, 31 Jan 2017 10:36:53 GMT
CAMEL-10770: Upgrade to Spring Boot 1.5.1


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4e719f2f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4e719f2f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4e719f2f

Branch: refs/heads/master
Commit: 4e719f2fd066ee28119f95dc34cf8b049b761567
Parents: 6828e74
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Tue Jan 31 10:40:55 2017 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Jan 31 11:36:39 2017 +0100

----------------------------------------------------------------------
 .../src/main/docs/spring-boot.adoc              | 85 --------------------
 .../apache/camel/spring/boot/FatJarRouter.java  | 38 ---------
 .../camel/spring/boot/FatWarInitializer.java    | 32 --------
 .../camel/spring/boot/RoutesCollector.java      |  4 +-
 .../spring/boot/SpringTypeConverterTest.java    |  9 +--
 .../JUnitFatJarRouterTest.java                  | 61 --------------
 .../StandaloneFatJarRouterTest.java             | 78 ------------------
 .../fatjarroutertests/TestFatJarRouter.java     | 39 ---------
 8 files changed, 2 insertions(+), 344 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/4e719f2f/components/camel-spring-boot/src/main/docs/spring-boot.adoc
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/docs/spring-boot.adoc b/components/camel-spring-boot/src/main/docs/spring-boot.adoc
index 094214b..9f148a6 100644
--- a/components/camel-spring-boot/src/main/docs/spring-boot.adoc
+++ b/components/camel-spring-boot/src/main/docs/spring-boot.adoc
@@ -347,91 +347,6 @@ features (like `TypeConverter` instance or Spring bridge) set the
 camel.springboot.typeConversion = false
 ---------------------------------------
 
-[[SpringBoot-Fatjarsandfatwars]]
-Fat jars and fat wars
-^^^^^^^^^^^^^^^^^^^^^
-
-The easiest way to create a Camel-aware Spring Boot fat jar/war is to
-extend the `org.apache.camel.spring.boot.FatJarRouter` class...
-
- 
-
-[source,java]
---------------------------------------------------
-package com.example;
- 
-... // imports
- 
-@SpringBootApplication
-public class MyFatJarRouter extends FatJarRouter {
-
-    @Override
-    public void configure() throws Exception {
-        from("netty-http:http://0.0.0.0:18080").
-            setBody().simple("ref:helloWorld");
-    }
-
-    @Bean
-    String helloWorld() {
-        return "helloWorld";
-    }
-
-}
---------------------------------------------------
-
- 
-
-...and add the following property to your `application.properties` file:
-
- 
-
-[source,xml]
-------------------------------------------------
-spring.main.sources = com.example.MyFatJarRouter
-------------------------------------------------
-
-It is also recommended to define your main class explicitly in the
-Spring Boot Maven plugin configuration: 
-
-[source,xml]
-----------------------------------------------------------------------
- <plugin>
-    <groupId>org.springframework.boot</groupId>
-    <artifactId>spring-boot-maven-plugin</artifactId>
-    <version>${spring-boot.version}</version>
-    <configuration>
-      <mainClass>org.apache.camel.spring.boot.FatJarRouter</mainClass>
-    </configuration>
-    <executions>
-      <execution>
-        <goals>
-          <goal>repackage</goal>
-        </goals>
-      </execution>
-    </executions>
-</plugin>
-----------------------------------------------------------------------
-
-In order to turn your fat jar into fat war, add the following class
-extending  `org.apache.camel.spring.boot.FatWarInitializer` to your
-project:
-
-[source,java]
----------------------------------------------------------------------
-package com.example;
- 
-... // imports
-
-public class MyFatJarRouterWarInitializer extends FatWarInitializer {
-
-
-  @Override
-  protected Class<? extends FatJarRouter> routerClass() {
-    return MyFatJarRouter.class;
-  }
-
-}
----------------------------------------------------------------------
 
 [[SpringBoot-Blockingmainthread]]
 Blocking main thread

http://git-wip-us.apache.org/repos/asf/camel/blob/4e719f2f/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/FatJarRouter.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/FatJarRouter.java
b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/FatJarRouter.java
deleted file mode 100644
index f0b9101..0000000
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/FatJarRouter.java
+++ /dev/null
@@ -1,38 +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;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.springframework.boot.SpringApplication;
-import org.springframework.context.ApplicationContext;
-
-@Deprecated
-public class FatJarRouter extends RouteBuilder {
-
-    public static void main(String... args) {
-        ApplicationContext applicationContext = new SpringApplication(FatJarRouter.class).run(args);
-        CamelSpringBootApplicationController applicationController =
-                applicationContext.getBean(CamelSpringBootApplicationController.class);
-        applicationController.run();
-    }
-
-    @Override
-    public void configure() throws Exception {
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/4e719f2f/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/FatWarInitializer.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/FatWarInitializer.java
b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/FatWarInitializer.java
deleted file mode 100644
index e4c5200..0000000
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/FatWarInitializer.java
+++ /dev/null
@@ -1,32 +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;
-
-import org.springframework.boot.builder.SpringApplicationBuilder;
-import org.springframework.boot.context.web.SpringBootServletInitializer;
-
-@Deprecated
-public abstract class FatWarInitializer extends SpringBootServletInitializer {
-
-    @Override
-    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
-        return application.sources(routerClass());
-    }
-
-    protected abstract Class<? extends FatJarRouter> routerClass();
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/4e719f2f/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java
b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java
index d5a90d0..e0b8a88 100644
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java
@@ -78,9 +78,7 @@ public class RoutesCollector implements ApplicationListener<ContextRefreshedEven
                 for (RoutesBuilder routesBuilder : applicationContext.getBeansOfType(RoutesBuilder.class,
configurationProperties.isIncludeNonSingletons(), true).values()) {
                     // filter out abstract classes
                     boolean abs = Modifier.isAbstract(routesBuilder.getClass().getModifiers());
-                    // filter out FatJarRouter which can be in the spring app context
-                    boolean farJarRouter = FatJarRouter.class.equals(routesBuilder.getClass());
-                    if (!abs && !farJarRouter) {
+                    if (!abs) {
                         try {
                             LOG.debug("Injecting following route into the CamelContext: {}",
routesBuilder);
                             camelContext.addRoutes(routesBuilder);

http://git-wip-us.apache.org/repos/asf/camel/blob/4e719f2f/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/SpringTypeConverterTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/SpringTypeConverterTest.java
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/SpringTypeConverterTest.java
index 4814374..ac76c8a 100644
--- a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/SpringTypeConverterTest.java
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/SpringTypeConverterTest.java
@@ -26,7 +26,6 @@ import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.annotation.Bean;
@@ -39,6 +38,7 @@ import org.springframework.core.convert.support.DefaultConversionService;
 import org.springframework.test.context.junit4.SpringRunner;
 
 @RunWith(SpringRunner.class)
+@EnableAutoConfiguration
 @SpringBootTest(classes = SpringTypeConverterTest.SpringTypeConversionConfiguration.class)
 public class SpringTypeConverterTest {
     @Autowired
@@ -106,13 +106,6 @@ public class SpringTypeConverterTest {
     }
 
     @Configuration
-    @EnableAutoConfiguration(
-        exclude = {
-            CamelAutoConfiguration.class, 
-            TypeConversionConfiguration.class, 
-            WebMvcAutoConfiguration.class
-        }
-    )
     public static class SpringTypeConversionConfiguration {
         @Bean
         ConversionService camelSpringConversionService(ApplicationContext applicationContext)
{

http://git-wip-us.apache.org/repos/asf/camel/blob/4e719f2f/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
deleted file mode 100644
index 33fb5ba..0000000
--- a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarroutertests/JUnitFatJarRouterTest.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.fatjarroutertests;
-
-import java.io.IOException;
-import java.lang.management.ManagementFactory;
-import java.net.URL;
-import java.util.Set;
-
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-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.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-import org.springframework.util.SocketUtils;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = TestFatJarRouter.class, properties = "spring.main.sources=org.apache.camel.spring.boot.fatjarroutertests")
-public class JUnitFatJarRouterTest extends Assert {
-
-    static int port = SocketUtils.findAvailableTcpPort(20000);
-
-    @BeforeClass
-    public static void beforeClass() {
-        System.setProperty("http.port", port + "");
-    }
-
-    @Test
-    public void shouldStartCamelRoute() throws InterruptedException, IOException, MalformedObjectNameException
{
-        String response = IOUtils.toString(new URL("http://localhost:" + port));
-
-        assertEquals("stringBean", response);
-
-        // There should be 3 routes running..
-        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
-        Set<ObjectName> objectNames = mbs.queryNames(new ObjectName("org.apache.camel:type=routes,*"),
null);
-        assertEquals(3, objectNames.size());
-    }
-
-}
-

http://git-wip-us.apache.org/repos/asf/camel/blob/4e719f2f/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
deleted file mode 100644
index 4e6dd70..0000000
--- a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarroutertests/StandaloneFatJarRouterTest.java
+++ /dev/null
@@ -1,78 +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.fatjarroutertests;
-
-import java.io.IOException;
-import java.lang.management.ManagementFactory;
-import java.net.ConnectException;
-import java.net.URL;
-import java.util.Set;
-import java.util.concurrent.Callable;
-
-import static java.util.concurrent.TimeUnit.MINUTES;
-
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-import org.apache.camel.spring.boot.FatJarRouter;
-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, MalformedObjectNameException
{
-        // Given
-        final int port = SocketUtils.findAvailableTcpPort(20000);
-        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);
-
-        // There should be 3 routes running..
-        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
-        Set<ObjectName> objectNames = mbs.queryNames(new ObjectName("org.apache.camel:type=routes,*"),
null);
-        assertEquals(3, objectNames.size());
-    }
-
-}
-

http://git-wip-us.apache.org/repos/asf/camel/blob/4e719f2f/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
deleted file mode 100644
index 1609f49..0000000
--- a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/fatjarroutertests/TestFatJarRouter.java
+++ /dev/null
@@ -1,39 +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.fatjarroutertests;
-
-import org.apache.camel.spring.boot.FatJarRouter;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ImportResource;
-
-@SpringBootApplication
-@ImportResource({"classpath:test-camel-context.xml"})
-public class TestFatJarRouter extends FatJarRouter {
-
-    @Override
-    public void configure() throws Exception {
-        from("netty4-http:http://0.0.0.0:{{http.port}}").
-                setBody().simple("ref:stringBean");
-    }
-
-    @Bean
-    String stringBean() {
-        return "stringBean";
-    }
-
-}


Mime
View raw message