CAMEL-8298 Remove the spring-test dependency from camel-spring-javaconfig

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

Branch: refs/heads/master
Commit: 17f31529b1625dbc61e43a81ceb38dc24665acc0
Parents: 0541880
Author: Willem Jiang <willem.ji...@gmail.com>
Authored: Fri Jan 30 11:33:44 2015 +0800
Committer: Willem Jiang <willem.ji...@gmail.com>
Committed: Fri Jan 30 12:51:52 2015 +0800

----------------------------------------------------------------------
 components/camel-spring-javaconfig/pom.xml      |   4 +-
 .../test/JavaConfigContextLoader.java           | 130 -------------------
 2 files changed, 2 insertions(+), 132 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/17f31529/components/camel-spring-javaconfig/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring-javaconfig/pom.xml 
b/components/camel-spring-javaconfig/pom.xml
index a266677..93a4d10 100644
--- a/components/camel-spring-javaconfig/pom.xml
+++ b/components/camel-spring-javaconfig/pom.xml
@@ -17,7 +17,7 @@
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
   <modelVersion>4.0.0</modelVersion>
-  
+
   <parent>
     <artifactId>components</artifactId>
     <groupId>org.apache.camel</groupId>
@@ -32,7 +32,7 @@
   <properties>
     
<camel.osgi.export.pkg>org.apache.camel.spring.javaconfig.*</camel.osgi.export.pkg>
   </properties>
-  
+
   <dependencies>
     <dependency>
       <groupId>org.apache.camel</groupId>

http://git-wip-us.apache.org/repos/asf/camel/blob/17f31529/components/camel-spring-javaconfig/src/main/java/org/apache/camel/spring/javaconfig/test/JavaConfigContextLoader.java
----------------------------------------------------------------------
diff --git 
a/components/camel-spring-javaconfig/src/main/java/org/apache/camel/spring/javaconfig/test/JavaConfigContextLoader.java
 
b/components/camel-spring-javaconfig/src/main/java/org/apache/camel/spring/javaconfig/test/JavaConfigContextLoader.java
deleted file mode 100644
index 274296c..0000000
--- 
a/components/camel-spring-javaconfig/src/main/java/org/apache/camel/spring/javaconfig/test/JavaConfigContextLoader.java
+++ /dev/null
@@ -1,130 +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.javaconfig.test;
-
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.ApplicationContext;
-import 
org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.test.context.ContextLoader;
-
-/**
- * Implementation of the {@link ContextLoader} strategy for creating a
- * {@link 
org.springframework.context.annotation.AnnotationConfigApplicationContext} for 
a test's
- * {@link org.springframework.test.context.ContextConfiguration 
&#064;ContextConfiguration}
- * <p/>
- *
- * Example usage: <p/>
- * <pre class="code">
- * &#064;RunWith(SpringJUnit4ClassRunner.class)
- * &#064;ContextConfiguration(locations = 
{"com.myco.TestDatabaseConfiguration", "com.myco.config"},
- *                       loader = JavaConfigContextLoader.class)
- * public MyTests { ... }
- * </pre>
- * <p/>
- *
- * Implementation note: At this time, due to restrictions in Java annotations 
and Spring's
- * TestContext framework, locations of classes / packages must be specified as 
strings to
- * the ContextConfiguration annotation.  It is understood that this has a 
detrimental effect
- * on type safety, discoverability and refactoring, and for these reasons may 
change in
- * future revisions, possibly with a customized version of the 
ContextConfiguration annotation
- * that accepts an array of class literals to load.
- *
- * @see org.springframework.test.context.ContextConfiguration
- * @deprecated Use 
org.apache.camel.test.spring.CamelSpringDelegatingTestContextLoader from
- * camel-test-spring jar instead.
- */
-@Deprecated
-public class JavaConfigContextLoader implements ContextLoader {
-
-    protected final Logger logger = LoggerFactory.getLogger(getClass());
-
-    /**
-     * Simply returns the supplied <var>locations</var> unchanged.
-     * <p/>
-     *
-     * @param clazz the class with which the locations are associated: used to 
determine how to
-     *            process the supplied locations.
-     * @param locations the unmodified locations to use for loading the 
application context; can be
-     *            {@code null} or empty.
-     * @return an array of application context resource locations
-     * @see 
org.springframework.test.context.ContextLoader#processLocations(Class, String[])
-     */
-    public String[] processLocations(Class<?> clazz, String... locations) {
-        return locations;
-    }
-
-    /**
-     * Loads a new {@link ApplicationContext context} based on the supplied 
{@code locations},
-     * configures the context, and finally returns the context in fully 
<em>refreshed</em> state.
-     * <p/>
-     *
-     * Configuration locations are either fully-qualified class names or base 
package names. These
-     * locations will be given to a {@link AnnotationConfigApplicationContext} 
for configuration via the
-     * {@link AnnotationConfigApplicationContext#register(Class[])} and
-     * {@link AnnotationConfigApplicationContext#scan(String...)} methods.
-     *
-     * @param locations the locations to use to load the application context
-     * @return a new application context
-     * @throws IllegalArgumentException if any of <var>locations</var> are not 
valid fully-qualified
-     * Class or Package names
-     */
-    public ApplicationContext loadContext(String... locations) {
-        if (logger.isDebugEnabled()) {
-            logger.debug("Creating a JavaConfigApplicationContext for {}", 
Arrays.asList(locations));
-        }
-
-        AnnotationConfigApplicationContext context = new 
AnnotationConfigApplicationContext();
-
-        List<Class<?>> configClasses = new ArrayList<Class<?>>();
-        List<String> basePackages = new ArrayList<String>();
-        for (String location : locations) {
-            // if the location refers to a class, use it. Otherwise assume 
it's a base package name
-            try {
-                final Class<?> aClass = 
this.getClass().getClassLoader().loadClass(location);
-                configClasses.add(aClass);
-            } catch (ClassNotFoundException e) {
-                if (Package.getPackage(location) == null) {
-                    throw new IllegalArgumentException(
-                            String.format("A non-existent class or package 
name was specified: [%s]", location));
-                }
-                basePackages.add(location);
-            }
-        }
-
-        logger.debug("Setting config classes to {}", configClasses);
-        logger.debug("Setting base packages to {}", basePackages);
-
-        for (Class<?> configClass : configClasses) {
-            context.register(configClass);
-        }
-        
-        for (String basePackage : basePackages) {
-            context.scan(basePackage);
-        }
-        
-        context.refresh();
-        
-        return context;
-    }
-
-}

Reply via email to