Repository: camel
Updated Branches:
  refs/heads/master 151dd78ba -> a3dfb07c4


"CAMEL-11617:spring-boot - service-call tests uses hardcoded port numbers"


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

Branch: refs/heads/master
Commit: a3dfb07c4685e5537da32edacfa256d7213e11b0
Parents: 151dd78
Author: Ramu <kkaka...@redhat.com>
Authored: Thu Aug 3 21:34:18 2017 +0530
Committer: Ramu <kkaka...@redhat.com>
Committed: Mon Aug 7 15:26:56 2017 +0530

----------------------------------------------------------------------
 ...CloudServiceCallGlobalConfigurationTest.java | 82 +++++++++++++-------
 .../CamelCloudServiceCallRefExpressionTest.java | 72 ++++++++++++-----
 ...melCloudServiceCallSimpleExpressionTest.java | 74 +++++++++++++-----
 .../boot/cloud/CamelCloudServiceCallTest.java   | 72 +++++++++++++----
 .../boot/cloud/SpringBootPropertyUtil.java      | 57 ++++++++++++++
 5 files changed, 275 insertions(+), 82 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a3dfb07c/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallGlobalConfigurationTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallGlobalConfigurationTest.java
 
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallGlobalConfigurationTest.java
index e8b08cb..62946f7 100644
--- 
a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallGlobalConfigurationTest.java
+++ 
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallGlobalConfigurationTest.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.spring.boot.cloud;
 
+import java.util.Properties;
+
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.spring.boot.CamelAutoConfiguration;
@@ -27,6 +29,10 @@ import 
org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.core.env.ConfigurableEnvironment;
+import org.springframework.core.env.MutablePropertySources;
+import org.springframework.core.env.PropertiesPropertySource;
 import org.springframework.test.annotation.DirtiesContext;
 import org.springframework.test.context.junit4.SpringRunner;
 
@@ -36,25 +42,10 @@ import org.springframework.test.context.junit4.SpringRunner;
 @SpringBootTest(
     classes = {
         CamelAutoConfiguration.class,
-        CamelCloudServiceCallGlobalConfigurationTest.TestConfiguration.class
-    },
-    properties = {
-        "service.name=custom-svc-list",
-        "camel.cloud.load-balancer.enabled=false",
-        "camel.cloud.service-call.uri=jetty:http://${service.name}/hello";,
-        "camel.cloud.service-call.service-discovery=sd",
-        "camel.cloud.service-call.service-filter=sf",
-        // this should not be taken into account
-        
"camel.cloud.service-discovery.services[custom-svc-list]=localhost:8090,localhost:8091,localhost:8092",
-        // this should be used
-        
"camel.cloud.service-discovery.configurations[sd].services[custom-svc-list]=localhost:9090,localhost:9091,localhost:9092",
-        // this should not be taken into account
-        "camel.cloud.service-filter.blacklist[custom-svc-list]=localhost:9090",
-        // this should be used
-        
"camel.cloud.service-filter.configurations[sf].blacklist[custom-svc-list]=localhost:9091",
-        "ribbon.enabled=false",
-        "debug=true"
+        CamelCloudServiceCallGlobalConfigurationTest.TestConfiguration.class,
+        
CamelCloudServiceCallGlobalConfigurationTest.SpringBootPropertySourceConfig.class,
     }
+   
 )
 public class CamelCloudServiceCallGlobalConfigurationTest {
     @Autowired
@@ -62,8 +53,8 @@ public class CamelCloudServiceCallGlobalConfigurationTest {
 
     @Test
     public void testServiceCall() throws Exception {
-        Assert.assertEquals("9090", template.requestBody("direct:start", null, 
String.class));
-        Assert.assertEquals("9092", template.requestBody("direct:start", null, 
String.class));
+        Assert.assertEquals(String.valueOf(SpringBootPropertyUtil.PORT1), 
template.requestBody("direct:start", null, String.class));
+        Assert.assertEquals(String.valueOf(SpringBootPropertyUtil.PORT3), 
template.requestBody("direct:start", null, String.class));
     }
 
     // *************************************
@@ -80,18 +71,57 @@ public class CamelCloudServiceCallGlobalConfigurationTest {
                     from("direct:start")
                         .serviceCall("{{service.name}}");
 
-                    from("jetty:http://localhost:9090/hello";)
+                    fromF("jetty:http://localhost:%d/hello";, 
SpringBootPropertyUtil.PORT1)
                         .transform()
-                        .constant("9090");
-                    from("jetty:http://localhost:9091/hello";)
+                        .constant(SpringBootPropertyUtil.PORT1);
+                    fromF("jetty:http://localhost:%d/hello";, 
SpringBootPropertyUtil.PORT2)
                         .transform()
-                        .constant("9091");
-                    from("jetty:http://localhost:9092/hello";)
+                        .constant(SpringBootPropertyUtil.PORT2);
+                    fromF("jetty:http://localhost:%d/hello";, 
SpringBootPropertyUtil.PORT3)
                         .transform()
-                        .constant("9092");
+                        .constant(SpringBootPropertyUtil.PORT3);
                 }
             };
         }
     }
+    
+    private static Properties getAllProperties() {
+        
+        Properties prop = new Properties();
+        prop.put("service.name", "custom-svc-list");
+        prop.put("camel.cloud.load-balancer.enabled", false);
+        prop.put("camel.cloud.service-call.uri", 
"jetty:http://${service.name}/hello";);
+        prop.put("camel.cloud.service-call.service-discovery", "sd");
+        prop.put("camel.cloud.service-call.service-filter", "sf");
+        
prop.put("camel.cloud.service-discovery.configurations[sd].services[custom-svc-list]",
 SpringBootPropertyUtil.getDiscoveryServices());
+        
prop.put("camel.cloud.service-filter.configurations[sf].blacklist[custom-svc-list]",
 SpringBootPropertyUtil.getServiceFilterBlacklist());
+        prop.put("ribbon.enabled", false);
+        prop.put("debug", false);
+        return prop;
+    }
+    
+   
+   
+    // *************************************
+    // Config
+    // 
+    
+    @Configuration
+    public static class SpringBootPropertySourceConfig {
+
+        @Autowired
+        private ConfigurableEnvironment env;
+
+        @Bean
+        @Lazy(false)
+        public MutablePropertySources springBootPropertySource() {
+
+            MutablePropertySources sources = env.getPropertySources();
+            sources.addFirst(new 
PropertiesPropertySource("boot-test-property", 
CamelCloudServiceCallGlobalConfigurationTest.getAllProperties()));
+            return sources;
+
+        }
+    }
+    
 }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/a3dfb07c/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallRefExpressionTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallRefExpressionTest.java
 
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallRefExpressionTest.java
index 3d47b03..c363367 100644
--- 
a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallRefExpressionTest.java
+++ 
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallRefExpressionTest.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.spring.boot.cloud;
 
+import java.util.Properties;
+
 import org.apache.camel.Expression;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
@@ -29,6 +31,10 @@ import 
org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.core.env.ConfigurableEnvironment;
+import org.springframework.core.env.MutablePropertySources;
+import org.springframework.core.env.PropertiesPropertySource;
 import org.springframework.test.annotation.DirtiesContext;
 import org.springframework.test.context.junit4.SpringRunner;
 
@@ -38,18 +44,10 @@ import org.springframework.test.context.junit4.SpringRunner;
 @SpringBootTest(
     classes = {
         CamelAutoConfiguration.class,
-        CamelCloudServiceCallRefExpressionTest.TestConfiguration.class
-    },
-    properties = {
-        "service.name=custom-svc-list",
-        "camel.cloud.load-balancer.enabled=false",
-        "camel.cloud.service-call.component=jetty",
-        "camel.cloud.service-call.expression=myExpression",
-        
"camel.cloud.service-discovery.services[custom-svc-list]=localhost:9090,localhost:9091,localhost:9092",
-        "camel.cloud.service-filter.blacklist[custom-svc-list]=localhost:9091",
-        "ribbon.enabled=false",
-        "debug=true"
+        CamelCloudServiceCallRefExpressionTest.TestConfiguration.class,
+        
CamelCloudServiceCallRefExpressionTest.SpringBootPropertySourceConfig.class
     }
+    
 )
 public class CamelCloudServiceCallRefExpressionTest {
     @Autowired
@@ -57,8 +55,8 @@ public class CamelCloudServiceCallRefExpressionTest {
 
     @Test
     public void testServiceCall() throws Exception {
-        Assert.assertEquals("9090", template.requestBody("direct:start", null, 
String.class));
-        Assert.assertEquals("9092", template.requestBody("direct:start", null, 
String.class));
+        Assert.assertEquals(String.valueOf(SpringBootPropertyUtil.PORT1), 
template.requestBody("direct:start", null, String.class));
+        Assert.assertEquals(String.valueOf(SpringBootPropertyUtil.PORT3), 
template.requestBody("direct:start", null, String.class));
     }
 
     // *************************************
@@ -82,18 +80,54 @@ public class CamelCloudServiceCallRefExpressionTest {
                     from("direct:start")
                         .serviceCall("{{service.name}}");
 
-                    from("jetty:http://localhost:9090/hello";)
+                    fromF("jetty:http://localhost:%d/hello";, 
SpringBootPropertyUtil.PORT1)
                         .transform()
-                        .constant("9090");
-                    from("jetty:http://localhost:9091/hello";)
+                        .constant(SpringBootPropertyUtil.PORT1);
+                    fromF("jetty:http://localhost:%d/hello";, 
SpringBootPropertyUtil.PORT2)
                         .transform()
-                        .constant("9091");
-                    from("jetty:http://localhost:9092/hello";)
+                        .constant(SpringBootPropertyUtil.PORT2);
+                    fromF("jetty:http://localhost:%d/hello";, 
SpringBootPropertyUtil.PORT3)
                         .transform()
-                        .constant("9092");
+                        .constant(SpringBootPropertyUtil.PORT3);
                 }
             };
         }
     }
+    
+    // *************************************
+    // Config
+    // *************************************
+    
+    @Configuration
+    public static class SpringBootPropertySourceConfig {
+
+        @Autowired
+        private ConfigurableEnvironment env;
+
+        @Bean
+        @Lazy(false)
+        public MutablePropertySources springBootPropertySource() {
+
+            MutablePropertySources sources = env.getPropertySources();
+            sources.addFirst(new 
PropertiesPropertySource("boot-test-property", 
CamelCloudServiceCallRefExpressionTest.getAllProperties()));
+            return sources;
+
+        }
+    }
+    
+    private static Properties getAllProperties() {
+        
+        Properties prop = new Properties();
+        prop.put("service.name", "custom-svc-list");
+        prop.put("camel.cloud.service-call.expression", "myExpression");
+        prop.put("camel.cloud.load-balancer.enabled", false);
+        prop.put("camel.cloud.service-call.component", "jetty");
+        prop.put("camel.cloud.service-discovery.services[custom-svc-list]", 
SpringBootPropertyUtil.getDiscoveryServices());
+        prop.put("camel.cloud.service-filter.blacklist[custom-svc-list]", 
SpringBootPropertyUtil.getServiceFilterBlacklist());
+        prop.put("ribbon.enabled", false);
+        prop.put("debug", false);
+        return prop;
+    }
+    
 }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/a3dfb07c/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallSimpleExpressionTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallSimpleExpressionTest.java
 
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallSimpleExpressionTest.java
index 82824e3..8e76419 100644
--- 
a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallSimpleExpressionTest.java
+++ 
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallSimpleExpressionTest.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.spring.boot.cloud;
 
+import java.util.Properties;
+
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.spring.boot.CamelAutoConfiguration;
@@ -27,6 +29,10 @@ import 
org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.core.env.ConfigurableEnvironment;
+import org.springframework.core.env.MutablePropertySources;
+import org.springframework.core.env.PropertiesPropertySource;
 import org.springframework.test.annotation.DirtiesContext;
 import org.springframework.test.context.junit4.SpringRunner;
 
@@ -36,18 +42,8 @@ import org.springframework.test.context.junit4.SpringRunner;
 @SpringBootTest(
     classes = {
         CamelAutoConfiguration.class,
-        CamelCloudServiceCallSimpleExpressionTest.TestConfiguration.class
-    },
-    properties = {
-        "service.name=custom-svc-list",
-        "camel.cloud.load-balancer.enabled=false",
-        "camel.cloud.service-call.component=jetty",
-        
"camel.cloud.service-call.expression=${header.CamelServiceCallScheme}:http://${header.CamelServiceCallServiceHost}:${header.CamelServiceCallServicePort}/hello";,
-        "camel.cloud.service-call.expression-language=simple",
-        
"camel.cloud.service-discovery.services[custom-svc-list]=localhost:9090,localhost:9091,localhost:9092",
-        "camel.cloud.service-filter.blacklist[custom-svc-list]=localhost:9091",
-        "ribbon.enabled=false",
-        "debug=true"
+        CamelCloudServiceCallSimpleExpressionTest.TestConfiguration.class,
+        
CamelCloudServiceCallSimpleExpressionTest.SpringBootPropertySourceConfig.class
     }
 )
 public class CamelCloudServiceCallSimpleExpressionTest {
@@ -56,8 +52,8 @@ public class CamelCloudServiceCallSimpleExpressionTest {
 
     @Test
     public void testServiceCall() throws Exception {
-        Assert.assertEquals("9090", template.requestBody("direct:start", null, 
String.class));
-        Assert.assertEquals("9092", template.requestBody("direct:start", null, 
String.class));
+        Assert.assertEquals(String.valueOf(SpringBootPropertyUtil.PORT1), 
template.requestBody("direct:start", null, String.class));
+        Assert.assertEquals(String.valueOf(SpringBootPropertyUtil.PORT3), 
template.requestBody("direct:start", null, String.class));
     }
 
     // *************************************
@@ -74,18 +70,56 @@ public class CamelCloudServiceCallSimpleExpressionTest {
                     from("direct:start")
                         .serviceCall("{{service.name}}");
 
-                    from("jetty:http://localhost:9090/hello";)
+                    fromF("jetty:http://localhost:%d/hello";, 
SpringBootPropertyUtil.PORT1)
                         .transform()
-                        .constant("9090");
-                    from("jetty:http://localhost:9091/hello";)
+                        .constant(SpringBootPropertyUtil.PORT1);
+                    fromF("jetty:http://localhost:%d/hello";, 
SpringBootPropertyUtil.PORT2)
                         .transform()
-                        .constant("9091");
-                    from("jetty:http://localhost:9092/hello";)
+                        .constant(SpringBootPropertyUtil.PORT2);
+                    fromF("jetty:http://localhost:%d/hello";, 
SpringBootPropertyUtil.PORT3)
                         .transform()
-                        .constant("9092");
+                        .constant(SpringBootPropertyUtil.PORT3);
                 }
             };
         }
     }
+    
+    private static Properties getAllProperties() {
+        
+        Properties prop = new Properties();
+        prop.put("service.name", "custom-svc-list");
+        prop.put("camel.cloud.load-balancer.enabled", false);
+        prop.put("camel.cloud.service-call.component", "jetty");
+        prop.put("camel.cloud.service-call.expression", 
"${header.CamelServiceCallScheme}:http://${header.CamelServiceCallServiceHost}:${header.CamelServiceCallServicePort}/hello";);
+        prop.put("camel.cloud.service-call.expression-language", "simple");
+        prop.put("camel.cloud.service-discovery.services[custom-svc-list]", 
SpringBootPropertyUtil.getDiscoveryServices());
+        prop.put("camel.cloud.service-filter.blacklist[custom-svc-list]", 
SpringBootPropertyUtil.getServiceFilterBlacklist());
+        prop.put("ribbon.enabled", false);
+        prop.put("debug", false);
+        return prop;
+    }
+    
+   
+   
+    // *************************************
+    // Config
+    // 
+    
+    @Configuration
+    public static class SpringBootPropertySourceConfig {
+
+        @Autowired
+        private ConfigurableEnvironment env;
+
+        @Bean
+        @Lazy(false)
+        public MutablePropertySources springBootPropertySource() {
+
+            MutablePropertySources sources = env.getPropertySources();
+            sources.addFirst(new 
PropertiesPropertySource("boot-test-property", 
CamelCloudServiceCallSimpleExpressionTest.getAllProperties()));
+            return sources;
+
+        }
+    }
 }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/a3dfb07c/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallTest.java
 
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallTest.java
index 1c1dd48..cf85d8f 100644
--- 
a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallTest.java
+++ 
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallTest.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.spring.boot.cloud;
 
+import java.util.Properties;
+
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.spring.boot.CamelAutoConfiguration;
@@ -27,6 +29,10 @@ import 
org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.core.env.ConfigurableEnvironment;
+import org.springframework.core.env.MutablePropertySources;
+import org.springframework.core.env.PropertiesPropertySource;
 import org.springframework.test.annotation.DirtiesContext;
 import org.springframework.test.context.junit4.SpringRunner;
 
@@ -36,16 +42,10 @@ import org.springframework.test.context.junit4.SpringRunner;
 @SpringBootTest(
     classes = {
         CamelAutoConfiguration.class,
-        CamelCloudServiceCallTest.TestConfiguration.class
-    },
-    properties = {
-        "camel.cloud.load-balancer.enabled=false",
-        "camel.cloud.service-call.component=jetty",
-        
"camel.cloud.service-discovery.services[custom-svc-list]=localhost:9090,localhost:9091,localhost:9092",
-        "camel.cloud.service-filter.blacklist[custom-svc-list]=localhost:9091",
-        "ribbon.enabled=false",
-        "debug=false"
+        CamelCloudServiceCallTest.TestConfiguration.class,
+        CamelCloudServiceCallTest.SpringBootPropertySourceConfig.class
     }
+   
 )
 public class CamelCloudServiceCallTest {
     @Autowired
@@ -53,8 +53,8 @@ public class CamelCloudServiceCallTest {
 
     @Test
     public void testServiceCall() throws Exception {
-        Assert.assertEquals("9090", template.requestBody("direct:start", null, 
String.class));
-        Assert.assertEquals("9092", template.requestBody("direct:start", null, 
String.class));
+        Assert.assertEquals(String.valueOf(SpringBootPropertyUtil.PORT1), 
template.requestBody("direct:start", null, String.class));
+        Assert.assertEquals(String.valueOf(SpringBootPropertyUtil.PORT3), 
template.requestBody("direct:start", null, String.class));
     }
 
     // *************************************
@@ -71,18 +71,56 @@ public class CamelCloudServiceCallTest {
                     from("direct:start")
                         .serviceCall("custom-svc-list/hello");
 
-                    from("jetty:http://localhost:9090/hello";)
+                    fromF("jetty:http://localhost:%d/hello";, 
SpringBootPropertyUtil.PORT1)
                         .transform()
-                        .constant("9090");
-                    from("jetty:http://localhost:9091/hello";)
+                        .constant(SpringBootPropertyUtil.PORT1);
+                    fromF("jetty:http://localhost:%d/hello";, 
SpringBootPropertyUtil.PORT2)
                         .transform()
-                        .constant("9091");
-                    from("jetty:http://localhost:9092/hello";)
+                        .constant(SpringBootPropertyUtil.PORT2);
+                    fromF("jetty:http://localhost:%d/hello";, 
SpringBootPropertyUtil.PORT3)
                         .transform()
-                        .constant("9092");
+                        .constant(SpringBootPropertyUtil.PORT3);
                 }
             };
         }
     }
+    
+    private static Properties getAllProperties() {
+        
+        Properties prop = new Properties();
+        prop.put("service.name", "custom-svc-list");
+        prop.put("camel.cloud.load-balancer.enabled", false);
+        prop.put("camel.cloud.service-call.component", "jetty");
+        prop.put("camel.cloud.service-discovery.services[custom-svc-list]", 
SpringBootPropertyUtil.getDiscoveryServices());
+        prop.put("camel.cloud.service-filter.blacklist[custom-svc-list]", 
SpringBootPropertyUtil.getServiceFilterBlacklist());
+        prop.put("ribbon.enabled", false);
+        prop.put("debug", false);
+        return prop;
+    }
+    
+   
+   
+    // *************************************
+    // Config
+    // 
+    
+    @Configuration
+    public static class SpringBootPropertySourceConfig {
+
+        @Autowired
+        private ConfigurableEnvironment env;
+
+        @Bean
+        @Lazy(false)
+        public MutablePropertySources springBootPropertySource() {
+
+            MutablePropertySources sources = env.getPropertySources();
+            sources.addFirst(new 
PropertiesPropertySource("boot-test-property", 
CamelCloudServiceCallTest.getAllProperties()));
+            return sources;
+
+        }
+    }
+    
+   
 }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/a3dfb07c/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/SpringBootPropertyUtil.java
----------------------------------------------------------------------
diff --git 
a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/SpringBootPropertyUtil.java
 
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/SpringBootPropertyUtil.java
new file mode 100644
index 0000000..59a5c9f
--- /dev/null
+++ 
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/SpringBootPropertyUtil.java
@@ -0,0 +1,57 @@
+/**
+ * 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.cloud;
+
+import org.apache.camel.test.AvailablePortFinder;
+
+public final class SpringBootPropertyUtil {
+
+    public static final int PORT1 = AvailablePortFinder.getNextAvailable();
+    public static final int PORT2 = AvailablePortFinder.getNextAvailable();
+    public static final int PORT3 = AvailablePortFinder.getNextAvailable();
+    public static final String HOSTNAME = "localhost:";
+    
+    private SpringBootPropertyUtil() {
+
+    }
+
+    
+    public static  String getDiscoveryServices() {    
+
+        StringBuffer dservice = new StringBuffer();
+        dservice.append(HOSTNAME);
+        dservice.append(PORT1);
+        dservice.append(",");
+        dservice.append(HOSTNAME);
+        dservice.append(PORT2);
+        dservice.append(",");
+        dservice.append(HOSTNAME);
+        dservice.append(PORT3);
+        return dservice.toString();
+
+    }
+
+    public static String getServiceFilterBlacklist() {
+
+        StringBuffer filterBlacklistString = new StringBuffer();
+        filterBlacklistString.append(HOSTNAME);
+        filterBlacklistString.append(PORT2);
+        return filterBlacklistString.toString();
+
+    }
+
+}

Reply via email to