Repository: camel
Updated Branches:
  refs/heads/master e3139a014 -> f30040249


http://git-wip-us.apache.org/repos/asf/camel/blob/f3004024/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheConfigurationCustomizerNotEnabledGlobalTest.java
----------------------------------------------------------------------
diff --git 
a/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheConfigurationCustomizerNotEnabledGlobalTest.java
 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheConfigurationCustomizerNotEnabledGlobalTest.java
new file mode 100644
index 0000000..88b3b2f
--- /dev/null
+++ 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheConfigurationCustomizerNotEnabledGlobalTest.java
@@ -0,0 +1,37 @@
+/**
+ * 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.component.ehcache.springboot.customizer;
+
+import org.junit.runner.RunWith;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@DirtiesContext
+@SpringBootApplication
+@SpringBootTest(
+    classes = {
+        CacheConfigurationCustomizerNotEnabledTestBase.TestConfiguration.class
+    },
+    properties = {
+        "debug=false",
+        "camel.component.customizer.enabled=false"
+    })
+public class CacheConfigurationCustomizerNotEnabledGlobalTest extends 
CacheConfigurationCustomizerNotEnabledTestBase {
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/f3004024/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheConfigurationCustomizerNotEnabledOnComponentTest.java
----------------------------------------------------------------------
diff --git 
a/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheConfigurationCustomizerNotEnabledOnComponentTest.java
 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheConfigurationCustomizerNotEnabledOnComponentTest.java
new file mode 100644
index 0000000..5541577
--- /dev/null
+++ 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheConfigurationCustomizerNotEnabledOnComponentTest.java
@@ -0,0 +1,38 @@
+/**
+ * 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.component.ehcache.springboot.customizer;
+
+import org.junit.runner.RunWith;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@DirtiesContext
+@SpringBootApplication
+@SpringBootTest(
+    classes = {
+        CacheConfigurationCustomizerNotEnabledTestBase.TestConfiguration.class
+    },
+    properties = {
+        "debug=false",
+        "camel.component.customizer.enabled=true",
+        "camel.component.ehcache.customizer.enabled=false"
+    })
+public class CacheConfigurationCustomizerNotEnabledOnComponentTest extends 
CacheConfigurationCustomizerNotEnabledTestBase {
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/f3004024/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheConfigurationCustomizerNotEnabledTest.java
----------------------------------------------------------------------
diff --git 
a/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheConfigurationCustomizerNotEnabledTest.java
 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheConfigurationCustomizerNotEnabledTest.java
new file mode 100644
index 0000000..3b6a2b3
--- /dev/null
+++ 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheConfigurationCustomizerNotEnabledTest.java
@@ -0,0 +1,37 @@
+/**
+ * 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.component.ehcache.springboot.customizer;
+
+import org.junit.runner.RunWith;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@DirtiesContext
+@SpringBootApplication
+@SpringBootTest(
+    classes = {
+        CacheConfigurationCustomizerNotEnabledTestBase.TestConfiguration.class
+    },
+    properties = {
+        "debug=false",
+        "camel.component.ehcache.customizer.cache-configuration.enabled=false"
+    })
+public class CacheConfigurationCustomizerNotEnabledTest extends 
CacheConfigurationCustomizerNotEnabledTestBase {
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/f3004024/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheConfigurationCustomizerNotEnabledTestBase.java
----------------------------------------------------------------------
diff --git 
a/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheConfigurationCustomizerNotEnabledTestBase.java
 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheConfigurationCustomizerNotEnabledTestBase.java
new file mode 100644
index 0000000..d7ae8a7
--- /dev/null
+++ 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheConfigurationCustomizerNotEnabledTestBase.java
@@ -0,0 +1,70 @@
+/**
+ * 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.component.ehcache.springboot.customizer;
+
+import java.util.Map;
+
+import org.apache.camel.component.ehcache.EhcacheComponent;
+import org.ehcache.config.CacheConfiguration;
+import org.ehcache.config.builders.CacheConfigurationBuilder;
+import org.ehcache.config.builders.ResourcePoolsBuilder;
+import org.ehcache.config.units.EntryUnit;
+import org.ehcache.config.units.MemoryUnit;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+class CacheConfigurationCustomizerNotEnabledTestBase {
+    @Autowired
+    Map<String, CacheConfiguration<?, ?>> configurations;
+    @Autowired
+    EhcacheComponent component;
+
+    @Test
+    public void testComponentConfiguration() throws Exception {
+        Assert.assertNotNull(configurations);
+        Assert.assertEquals(2, configurations.size());
+        Assert.assertNotNull(component);
+        Assert.assertNull(component.getCachesConfigurations());
+    }
+
+    @Configuration
+    public static class TestConfiguration {
+        @Bean
+        public CacheConfiguration<?, ?> myConfig1() {
+            return CacheConfigurationBuilder.newCacheConfigurationBuilder(
+                String.class,
+                String.class,
+                ResourcePoolsBuilder.newResourcePoolsBuilder()
+                    .heap(100, EntryUnit.ENTRIES)
+                    .offheap(1, MemoryUnit.MB))
+                .build();
+        }
+        @Bean
+        public CacheConfiguration<?, ?> myConfig2() {
+            return CacheConfigurationBuilder.newCacheConfigurationBuilder(
+                String.class,
+                String.class,
+                ResourcePoolsBuilder.newResourcePoolsBuilder()
+                    .heap(2100, EntryUnit.ENTRIES)
+                    .offheap(2, MemoryUnit.MB))
+                .build();
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/f3004024/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerEnabledOnComponentTest.java
----------------------------------------------------------------------
diff --git 
a/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerEnabledOnComponentTest.java
 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerEnabledOnComponentTest.java
new file mode 100644
index 0000000..9d8c9fc
--- /dev/null
+++ 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerEnabledOnComponentTest.java
@@ -0,0 +1,38 @@
+/**
+ * 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.component.ehcache.springboot.customizer;
+
+import org.junit.runner.RunWith;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@DirtiesContext
+@SpringBootApplication
+@SpringBootTest(
+    classes = {
+        CacheManagerCustomizerEnabledTestBase.TestConfiguration.class
+    },
+    properties = {
+        "debug=false",
+        "camel.component.customizer.enabled=false",
+        "camel.component.ehcache.customizer.enabled=true"
+    })
+public class CacheManagerCustomizerEnabledOnComponentTest extends 
CacheManagerCustomizerEnabledTestBase {
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/f3004024/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerEnabledTest.java
----------------------------------------------------------------------
diff --git 
a/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerEnabledTest.java
 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerEnabledTest.java
new file mode 100644
index 0000000..dc5d2a2
--- /dev/null
+++ 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerEnabledTest.java
@@ -0,0 +1,39 @@
+/**
+ * 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.component.ehcache.springboot.customizer;
+
+import org.junit.runner.RunWith;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@DirtiesContext
+@SpringBootApplication
+@SpringBootTest(
+    classes = {
+        CacheManagerCustomizerEnabledTestBase.TestConfiguration.class
+    },
+    properties = {
+        "debug=false",
+        "camel.component.customizer.enabled=false",
+        "camel.component.ehcache.customizer.enabled=false",
+        "camel.component.ehcache.customizer.cache-manager.enabled=true"
+    })
+public class CacheManagerCustomizerEnabledTest extends 
CacheManagerCustomizerEnabledTestBase {
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/f3004024/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerEnabledTestBase.java
----------------------------------------------------------------------
diff --git 
a/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerEnabledTestBase.java
 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerEnabledTestBase.java
new file mode 100644
index 0000000..58bb399
--- /dev/null
+++ 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerEnabledTestBase.java
@@ -0,0 +1,48 @@
+/**
+ * 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.component.ehcache.springboot.customizer;
+
+import org.apache.camel.component.ehcache.EhcacheComponent;
+import org.ehcache.CacheManager;
+import org.ehcache.config.builders.CacheManagerBuilder;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+class CacheManagerCustomizerEnabledTestBase {
+    @Autowired
+    CacheManager cacheManager;
+    @Autowired
+    EhcacheComponent component;
+
+    @Test
+    public void testComponentConfiguration() throws Exception {
+        Assert.assertNotNull(cacheManager);
+        Assert.assertNotNull(component);
+        Assert.assertNotNull(component.getCacheManager());
+    }
+
+    @Configuration
+    public static class TestConfiguration {
+        @Bean(initMethod = "init", destroyMethod = "close")
+        public CacheManager cacheManager() {
+            return CacheManagerBuilder.newCacheManagerBuilder().build();
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/f3004024/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerNoOverrideTest.java
----------------------------------------------------------------------
diff --git 
a/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerNoOverrideTest.java
 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerNoOverrideTest.java
new file mode 100644
index 0000000..ac98e16
--- /dev/null
+++ 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerNoOverrideTest.java
@@ -0,0 +1,88 @@
+/**
+ * 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.component.ehcache.springboot.customizer;
+
+import org.apache.camel.component.ehcache.EhcacheComponent;
+import 
org.apache.camel.component.ehcache.springboot.EhcacheComponentAutoConfiguration;
+import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.ehcache.CacheManager;
+import org.ehcache.config.builders.CacheManagerBuilder;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.AutoConfigureAfter;
+import org.springframework.boot.autoconfigure.AutoConfigureBefore;
+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.core.Ordered;
+import org.springframework.core.annotation.Order;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@DirtiesContext
+@SpringBootApplication
+@SpringBootTest(
+    classes = {
+        CacheManagerCustomizerNoOverrideTest.TestConfiguration.class
+    },
+    properties = {
+        "debug=false",
+        "camel.component.ehcache.customizer.cache-manager.enabled=true",
+        "camel.component.ehcache.customizer.cache-manager.override=false"
+    })
+public class CacheManagerCustomizerNoOverrideTest {
+    private static final CacheManager CACHE_MANAGER = 
CacheManagerBuilder.newCacheManagerBuilder().build();
+    @Autowired
+    CacheManager cacheManager;
+    @Autowired
+    EhcacheComponent component;
+
+    @Test
+    public void testComponentConfiguration() throws Exception {
+        Assert.assertNotNull(cacheManager);
+        Assert.assertNotNull(component);
+        Assert.assertNotNull(component.getCacheManager());
+        Assert.assertEquals(CACHE_MANAGER, component.getCacheManager());
+    }
+
+    @Configuration
+    @AutoConfigureAfter(CamelAutoConfiguration.class)
+    @AutoConfigureBefore(EhcacheComponentAutoConfiguration.class)
+    public static class TestConfiguration {
+
+        @Order(Ordered.HIGHEST_PRECEDENCE)
+        @Bean
+        public ComponentCustomizer<EhcacheComponent> customizer() {
+            return new ComponentCustomizer<EhcacheComponent>() {
+                @Override
+                public void customize(EhcacheComponent component) {
+                    component.setCacheManager(CACHE_MANAGER);
+                }
+            };
+        }
+
+        @Bean(initMethod = "init", destroyMethod = "close")
+        public CacheManager cacheManager() {
+            return CacheManagerBuilder.newCacheManagerBuilder().build();
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/f3004024/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerNotEnabledGlobalTest.java
----------------------------------------------------------------------
diff --git 
a/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerNotEnabledGlobalTest.java
 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerNotEnabledGlobalTest.java
new file mode 100644
index 0000000..019fad3
--- /dev/null
+++ 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerNotEnabledGlobalTest.java
@@ -0,0 +1,37 @@
+/**
+ * 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.component.ehcache.springboot.customizer;
+
+import org.junit.runner.RunWith;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@DirtiesContext
+@SpringBootApplication
+@SpringBootTest(
+    classes = {
+        CacheManagerCustomizerNotEnabledTestBase.TestConfiguration.class
+    },
+    properties = {
+        "debug=false",
+        "camel.component.customizer.enabled=false"
+    })
+public class CacheManagerCustomizerNotEnabledGlobalTest extends 
CacheManagerCustomizerNotEnabledTestBase {
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/f3004024/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerNotEnabledOnComponentTest.java
----------------------------------------------------------------------
diff --git 
a/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerNotEnabledOnComponentTest.java
 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerNotEnabledOnComponentTest.java
new file mode 100644
index 0000000..3c3a2dc
--- /dev/null
+++ 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerNotEnabledOnComponentTest.java
@@ -0,0 +1,38 @@
+/**
+ * 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.component.ehcache.springboot.customizer;
+
+import org.junit.runner.RunWith;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@DirtiesContext
+@SpringBootApplication
+@SpringBootTest(
+    classes = {
+        CacheManagerCustomizerNotEnabledTestBase.TestConfiguration.class
+    },
+    properties = {
+        "debug=false",
+        "camel.component.customizer.enabled=true",
+        "camel.component.ehcache.customizer.enabled=false"
+    })
+public class CacheManagerCustomizerNotEnabledOnComponentTest extends 
CacheManagerCustomizerNotEnabledTestBase {
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/f3004024/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerNotEnabledTest.java
----------------------------------------------------------------------
diff --git 
a/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerNotEnabledTest.java
 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerNotEnabledTest.java
new file mode 100644
index 0000000..dd0cc4f
--- /dev/null
+++ 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerNotEnabledTest.java
@@ -0,0 +1,37 @@
+/**
+ * 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.component.ehcache.springboot.customizer;
+
+import org.junit.runner.RunWith;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@DirtiesContext
+@SpringBootApplication
+@SpringBootTest(
+    classes = {
+        CacheManagerCustomizerNotEnabledTestBase.TestConfiguration.class
+    },
+    properties = {
+        "debug=false",
+        "camel.component.ehcache.customizer.cache-manager.enabled=false"
+    })
+public class CacheManagerCustomizerNotEnabledTest extends 
CacheManagerCustomizerNotEnabledTestBase {
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/f3004024/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerNotEnabledTestBase.java
----------------------------------------------------------------------
diff --git 
a/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerNotEnabledTestBase.java
 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerNotEnabledTestBase.java
new file mode 100644
index 0000000..658fb18
--- /dev/null
+++ 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerNotEnabledTestBase.java
@@ -0,0 +1,48 @@
+/**
+ * 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.component.ehcache.springboot.customizer;
+
+import org.apache.camel.component.ehcache.EhcacheComponent;
+import org.ehcache.CacheManager;
+import org.ehcache.config.builders.CacheManagerBuilder;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+class CacheManagerCustomizerNotEnabledTestBase {
+    @Autowired
+    CacheManager cacheManager;
+    @Autowired
+    EhcacheComponent component;
+
+    @Test
+    public void testComponentConfiguration() throws Exception {
+        Assert.assertNotNull(cacheManager);
+        Assert.assertNotNull(component);
+        Assert.assertNull(component.getCacheManager());
+    }
+
+    @Configuration
+    public static class TestConfiguration {
+        @Bean(initMethod = "init", destroyMethod = "close")
+        public CacheManager cacheManager() {
+            return CacheManagerBuilder.newCacheManagerBuilder().build();
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/f3004024/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerOverrideTest.java
----------------------------------------------------------------------
diff --git 
a/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerOverrideTest.java
 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerOverrideTest.java
new file mode 100644
index 0000000..68bab4d
--- /dev/null
+++ 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerOverrideTest.java
@@ -0,0 +1,88 @@
+/**
+ * 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.component.ehcache.springboot.customizer;
+
+import org.apache.camel.component.ehcache.EhcacheComponent;
+import 
org.apache.camel.component.ehcache.springboot.EhcacheComponentAutoConfiguration;
+import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.ehcache.CacheManager;
+import org.ehcache.config.builders.CacheManagerBuilder;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.AutoConfigureAfter;
+import org.springframework.boot.autoconfigure.AutoConfigureBefore;
+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.core.Ordered;
+import org.springframework.core.annotation.Order;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@DirtiesContext
+@SpringBootApplication
+@SpringBootTest(
+    classes = {
+        CacheManagerCustomizerOverrideTest.TestConfiguration.class
+    },
+    properties = {
+        "debug=false",
+        "camel.component.ehcache.customizer.cache-manager.enabled=true",
+        "camel.component.ehcache.customizer.cache-manager.override=true"
+    })
+public class CacheManagerCustomizerOverrideTest {
+    private static final CacheManager CACHE_MANAGER = 
CacheManagerBuilder.newCacheManagerBuilder().build();
+    @Autowired
+    CacheManager cacheManager;
+    @Autowired
+    EhcacheComponent component;
+
+    @Test
+    public void testComponentConfiguration() throws Exception {
+        Assert.assertNotNull(cacheManager);
+        Assert.assertNotNull(component);
+        Assert.assertNotNull(component.getCacheManager());
+        Assert.assertEquals(cacheManager, component.getCacheManager());
+    }
+
+    @Configuration
+    @AutoConfigureAfter(CamelAutoConfiguration.class)
+    @AutoConfigureBefore(EhcacheComponentAutoConfiguration.class)
+    public static class TestConfiguration {
+
+        @Order(Ordered.HIGHEST_PRECEDENCE)
+        @Bean
+        public ComponentCustomizer<EhcacheComponent> customizer() {
+            return new ComponentCustomizer<EhcacheComponent>() {
+                @Override
+                public void customize(EhcacheComponent component) {
+                    component.setCacheManager(CACHE_MANAGER);
+                }
+            };
+        }
+
+        @Bean(initMethod = "init", destroyMethod = "close")
+        public CacheManager cacheManager() {
+            return CacheManagerBuilder.newCacheManagerBuilder().build();
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/f3004024/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerTest.java
----------------------------------------------------------------------
diff --git 
a/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerTest.java
 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerTest.java
new file mode 100644
index 0000000..131661d
--- /dev/null
+++ 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerTest.java
@@ -0,0 +1,63 @@
+/**
+ * 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.component.ehcache.springboot.customizer;
+
+import org.apache.camel.component.ehcache.EhcacheComponent;
+import org.ehcache.CacheManager;
+import org.ehcache.config.builders.CacheManagerBuilder;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+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.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@DirtiesContext
+@SpringBootApplication
+@SpringBootTest(
+    classes = {
+        CacheManagerCustomizerTest.TestConfiguration.class
+    },
+    properties = {
+        "debug=false",
+    })
+public class CacheManagerCustomizerTest {
+    @Autowired
+    CacheManager cacheManager;
+    @Autowired
+    EhcacheComponent component;
+
+    @Test
+    public void testComponentConfiguration() throws Exception {
+        Assert.assertNotNull(cacheManager);
+        Assert.assertNotNull(component);
+        Assert.assertEquals(cacheManager, component.getCacheManager());
+    }
+
+    @Configuration
+    public static class TestConfiguration {
+        @Bean(initMethod = "init", destroyMethod = "close")
+        public CacheManager cacheManager() {
+            return CacheManagerBuilder.newCacheManagerBuilder().build();
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/f3004024/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerWithoutCacheManagerTest.java
----------------------------------------------------------------------
diff --git 
a/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerWithoutCacheManagerTest.java
 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerWithoutCacheManagerTest.java
new file mode 100644
index 0000000..5dd9c07
--- /dev/null
+++ 
b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizerWithoutCacheManagerTest.java
@@ -0,0 +1,53 @@
+/**
+ * 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.component.ehcache.springboot.customizer;
+
+import org.apache.camel.component.ehcache.EhcacheComponent;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@DirtiesContext
+@SpringBootApplication
+@SpringBootTest(
+    classes = {
+        CacheManagerCustomizerWithoutCacheManagerTest.TestConfiguration.class
+    },
+    properties = {
+        "debug=false",
+    })
+public class CacheManagerCustomizerWithoutCacheManagerTest {
+    @Autowired
+    EhcacheComponent component;
+
+    @Test
+    public void testComponentConfiguration() throws Exception {
+        Assert.assertNotNull(component);
+        Assert.assertNull(component.getCacheManager());
+    }
+
+    @Configuration
+    public static class TestConfiguration {
+    }
+}
\ No newline at end of file

Reply via email to