You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/06/11 06:14:34 UTC
[1/2] git commit: CAMEL-7380 Added test support for Spring
ContextHierarchy
Repository: camel
Updated Branches:
refs/heads/master 0c9fbb62b -> aa9e4ce5e
CAMEL-7380 Added test support for Spring ContextHierarchy
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b4bb8fa2
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b4bb8fa2
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b4bb8fa2
Branch: refs/heads/master
Commit: b4bb8fa2da0625077d2118de311333ffddd29676
Parents: 0c9fbb6
Author: Willem Jiang <wi...@gmail.com>
Authored: Wed Jun 11 12:09:45 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Wed Jun 11 12:09:45 2014 +0800
----------------------------------------------------------------------
.../spring/CamelSpringTestContextLoader.java | 24 ++++++++++++++++----
1 file changed, 19 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/b4bb8fa2/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoader.java
----------------------------------------------------------------------
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoader.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoader.java
index 18fa9c3..e973b44 100644
--- a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoader.java
+++ b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoader.java
@@ -79,7 +79,7 @@ public class CamelSpringTestContextLoader extends AbstractContextLoader {
}
try {
- GenericApplicationContext context = createContext(testClass);
+ GenericApplicationContext context = createContext(testClass, mergedConfig);
context.getEnvironment().setActiveProfiles(mergedConfig.getActiveProfiles());
loadBeanDefinitions(context, mergedConfig);
return loadContext(context, testClass);
@@ -111,7 +111,7 @@ public class CamelSpringTestContextLoader extends AbstractContextLoader {
}
try {
- GenericApplicationContext context = createContext(testClass);
+ GenericApplicationContext context = createContext(testClass, null);
loadBeanDefinitions(context, locations);
return loadContext(context, testClass);
} finally {
@@ -196,9 +196,15 @@ public class CamelSpringTestContextLoader extends AbstractContextLoader {
* @param testClass the test class that is being executed
* @return the loaded Spring context
*/
- protected GenericApplicationContext createContext(Class<?> testClass) {
+ protected GenericApplicationContext createContext(Class<?> testClass, MergedContextConfiguration mergedConfig) {
+ ApplicationContext parentContext = null;
GenericApplicationContext routeExcludingContext = null;
+ if (mergedConfig != null) {
+ parentContext = mergedConfig.getParentApplicationContext();
+
+ }
+
if (testClass.isAnnotationPresent(ExcludeRoutes.class)) {
Class<?>[] excludedClasses = testClass.getAnnotation(ExcludeRoutes.class).value();
@@ -208,7 +214,11 @@ public class CamelSpringTestContextLoader extends AbstractContextLoader {
+ "annotation was found. Excluding [" + StringUtils.arrayToCommaDelimitedString(excludedClasses) + "].");
}
- routeExcludingContext = new GenericApplicationContext();
+ if (parentContext == null) {
+ routeExcludingContext = new GenericApplicationContext();
+ } else {
+ routeExcludingContext = new GenericApplicationContext(parentContext);
+ }
routeExcludingContext.registerBeanDefinition("excludingResolver", new RootBeanDefinition(ExcludingPackageScanClassResolver.class));
routeExcludingContext.refresh();
@@ -228,7 +238,11 @@ public class CamelSpringTestContextLoader extends AbstractContextLoader {
if (routeExcludingContext != null) {
context = new GenericApplicationContext(routeExcludingContext);
} else {
- context = new GenericApplicationContext();
+ if (parentContext != null) {
+ context = new GenericApplicationContext(parentContext);
+ } else {
+ context = new GenericApplicationContext();
+ }
}
return context;
[2/2] git commit: Changed the spring version range to support spring4
Posted by ni...@apache.org.
Changed the spring version range to support spring4
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/aa9e4ce5
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/aa9e4ce5
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/aa9e4ce5
Branch: refs/heads/master
Commit: aa9e4ce5ef3df5c5ddefb4fed5dd9fa81b6a92b6
Parents: b4bb8fa
Author: Willem Jiang <wi...@gmail.com>
Authored: Wed Jun 11 12:14:24 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Wed Jun 11 12:14:24 2014 +0800
----------------------------------------------------------------------
parent/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/aa9e4ce5/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 8acc316..2f33d88 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -382,7 +382,7 @@
<spring-ldap-version>1.3.1.RELEASE</spring-ldap-version>
<spring-ldap-bundle-version>1.3.1.RELEASE_2</spring-ldap-bundle-version>
<spring-retry-version>1.0.3.RELEASE</spring-retry-version>
- <spring-version-range>[3.2,4)</spring-version-range>
+ <spring-version-range>[3.2,5)</spring-version-range>
<spring-version>${spring32-version}</spring-version>
<spring32-version>3.2.9.RELEASE</spring32-version>
<spring4-version>4.0.5.RELEASE</spring4-version>