You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by al...@apache.org on 2019/08/19 15:01:23 UTC

[camel] 02/09: CAMEL-13826: Removed deprecated methods and class

This is an automated email from the ASF dual-hosted git repository.

aldettinger pushed a commit to branch CAMEL-13826
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 0685f2a45eb3872c9749d8818d4f00faac109c9a
Author: aldettinger <al...@gmail.com>
AuthorDate: Mon Aug 12 14:50:52 2019 +0200

    CAMEL-13826: Removed deprecated methods and class
---
 .../apache/camel/test/junit5/CamelTestSupport.java | 85 +---------------------
 .../patterns/DebugNoLazyTypeConverterTest.java     |  5 --
 .../src/test/resources/jndi.properties             | 22 ------
 3 files changed, 1 insertion(+), 111 deletions(-)

diff --git a/components/camel-test-junit5/src/main/java/org/apache/camel/test/junit5/CamelTestSupport.java b/components/camel-test-junit5/src/main/java/org/apache/camel/test/junit5/CamelTestSupport.java
index d324389..c7f24d8 100644
--- a/components/camel-test-junit5/src/main/java/org/apache/camel/test/junit5/CamelTestSupport.java
+++ b/components/camel-test-junit5/src/main/java/org/apache/camel/test/junit5/CamelTestSupport.java
@@ -26,7 +26,6 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
-import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -42,8 +41,6 @@ import javax.management.MBeanServer;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 import javax.management.ReflectionException;
-import javax.naming.Context;
-import javax.naming.InitialContext;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.ConsumerTemplate;
@@ -73,7 +70,6 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.component.properties.PropertiesComponent;
 import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.impl.JndiRegistry;
 import org.apache.camel.impl.engine.InterceptSendToMockEndpointStrategy;
 import org.apache.camel.model.Model;
 import org.apache.camel.model.ModelCamelContext;
@@ -753,17 +749,6 @@ public abstract class CamelTestSupport implements BeforeEachCallback, AfterAllCa
     }
 
     /**
-     * Whether or not type converters should be lazy loaded (notice core
-     * converters is always loaded)
-     *
-     * @return <tt>false</tt> by default.
-     */
-    @Deprecated
-    protected boolean isLazyLoadingTypeConverter() {
-        return false;
-    }
-
-    /**
      * Override this method to include and override properties with the Camel
      * {@link PropertiesComponent}.
      *
@@ -884,22 +869,7 @@ public abstract class CamelTestSupport implements BeforeEachCallback, AfterAllCa
     }
 
     protected CamelContext createCamelContext() throws Exception {
-        // for backwards compatibility
-        Registry registry = createRegistry();
-        if (registry instanceof FakeJndiRegistry) {
-            boolean inUse = ((FakeJndiRegistry)registry).isInUse();
-            if (!inUse) {
-                registry = null;
-            }
-        }
-        if (registry != null) {
-            String msg = "createRegistry() from camel-test is deprecated. Use createCamelRegistry if you want to control which registry to use, however"
-                         + " if you need to bind beans to the registry then this is possible already with the bind method on registry,"
-                         + " and there is no need to override this method.";
-            LOG.warn(msg);
-        } else {
-            registry = createCamelRegistry();
-        }
+        Registry registry = createCamelRegistry();
 
         CamelContext context;
         if (registry != null) {
@@ -929,59 +899,6 @@ public abstract class CamelTestSupport implements BeforeEachCallback, AfterAllCa
     }
 
     /**
-     * @deprecated use createCamelRegistry if you want to control which registry
-     *             to use, however if you need to bind beans to the registry
-     *             then this is possible already with the bind method on
-     *             registry, and there is no need to override this method.
-     */
-    @Deprecated
-    protected JndiRegistry createRegistry() throws Exception {
-        return new FakeJndiRegistry(createJndiContext());
-    }
-
-    /**
-     * @deprecated use createCamelRegistry if you want to control which registry
-     *             to use, however if you need to bind beans to the registry
-     *             then this is possible already with the bind method on
-     *             registry, and there is no need to use JndiRegistry and
-     *             override this method.
-     */
-    @Deprecated
-    protected Context createJndiContext() throws Exception {
-        Properties properties = new Properties();
-
-        // jndi.properties is optional
-        InputStream in = getClass().getClassLoader().getResourceAsStream("jndi.properties");
-        if (in != null) {
-            LOG.debug("Using jndi.properties from classpath root");
-            properties.load(in);
-        } else {
-            properties.put("java.naming.factory.initial", "org.apache.camel.support.jndi.CamelInitialContextFactory");
-        }
-        return new InitialContext(new Hashtable<>(properties));
-    }
-
-    private class FakeJndiRegistry extends JndiRegistry {
-
-        private boolean inUse;
-
-        public FakeJndiRegistry(Context context) {
-            super(context);
-        }
-
-        @Override
-        public void bind(String name, Object object) {
-            super.bind(name, object);
-            inUse = true;
-        }
-
-        public boolean isInUse() {
-            // only if the end user bind beans then its in use
-            return inUse;
-        }
-    }
-
-    /**
      * Factory method which derived classes can use to create a
      * {@link RouteBuilder} to define the routes for testing
      */
diff --git a/components/camel-test-junit5/src/test/java/org/apache/camel/test/junit5/patterns/DebugNoLazyTypeConverterTest.java b/components/camel-test-junit5/src/test/java/org/apache/camel/test/junit5/patterns/DebugNoLazyTypeConverterTest.java
index a9cb78f..056efae 100644
--- a/components/camel-test-junit5/src/test/java/org/apache/camel/test/junit5/patterns/DebugNoLazyTypeConverterTest.java
+++ b/components/camel-test-junit5/src/test/java/org/apache/camel/test/junit5/patterns/DebugNoLazyTypeConverterTest.java
@@ -29,11 +29,6 @@ public class DebugNoLazyTypeConverterTest extends CamelTestSupport {
 
     private static final Logger LOG = LoggerFactory.getLogger(DebugNoLazyTypeConverterTest.class);
 
-    @Override
-    protected boolean isLazyLoadingTypeConverter() {
-        return false;
-    }
-
     // START SNIPPET: e1
     @Override
     public boolean isUseDebugger() {
diff --git a/components/camel-test-junit5/src/test/resources/jndi.properties b/components/camel-test-junit5/src/test/resources/jndi.properties
deleted file mode 100644
index 7f9b32b..0000000
--- a/components/camel-test-junit5/src/test/resources/jndi.properties
+++ /dev/null
@@ -1,22 +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.
-## ---------------------------------------------------------------------------
-
-# START SNIPPET: jndi
-
-java.naming.factory.initial = org.apache.camel.support.jndi.CamelInitialContextFactory
-
-# END SNIPPET: jndi