You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/02/25 10:08:15 UTC
[camel-spring-boot] branch master updated: CAMEL-16258:
camel-spring-boot - @ExcludeRoutes not working anymore
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
The following commit(s) were added to refs/heads/master by this push:
new d0f8d1f CAMEL-16258: camel-spring-boot - @ExcludeRoutes not working anymore
d0f8d1f is described below
commit d0f8d1f42fdab50bfe5dcf487124f02f03e63f4b
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Feb 25 11:07:00 2021 +0100
CAMEL-16258: camel-spring-boot - @ExcludeRoutes not working anymore
---
.../camel/spring/boot/SpringBootRoutesCollector.java | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SpringBootRoutesCollector.java b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SpringBootRoutesCollector.java
index 12ce738..6775a53 100644
--- a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SpringBootRoutesCollector.java
+++ b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SpringBootRoutesCollector.java
@@ -22,6 +22,7 @@ import java.util.List;
import java.util.Set;
import org.apache.camel.CamelContext;
+import org.apache.camel.ExtendedCamelContext;
import org.apache.camel.RoutesBuilder;
import org.apache.camel.builder.LambdaRouteBuilder;
import org.apache.camel.builder.RouteBuilder;
@@ -66,10 +67,16 @@ public class SpringBootRoutesCollector extends DefaultRoutesCollector {
name = name.replace('.', '/');
boolean match = !"false".equals(includePattern);
+
+ // special support for testing with @ExcludeRoutes annotation with camel-test modules
+ String exclude = camelContext.adapt(ExtendedCamelContext.class).getTestExcludeRoutes();
// exclude take precedence over include
- if (match && ObjectHelper.isNotEmpty(excludePattern)) {
+ if (match && ObjectHelper.isNotEmpty(exclude)) {
+ // this property is a comma separated list of FQN class names, so we need to make
+ // name as path so we can use ant patch matcher
+ exclude = exclude.replace('.', '/');
// there may be multiple separated by comma
- String[] parts = excludePattern.split(",");
+ String[] parts = exclude.split(",");
for (String part : parts) {
// must negate when excluding, and hence !
match = !matcher.match(part, name);
@@ -79,15 +86,10 @@ public class SpringBootRoutesCollector extends DefaultRoutesCollector {
}
}
}
- // special support for testing with @ExcludeRoutes annotation with camel-test-spring
- String sysExcludePattern = System.getProperty("CamelTestSpringExcludeRoutes");
// exclude take precedence over include
- if (match && ObjectHelper.isNotEmpty(sysExcludePattern)) {
- // this property is a comma separated list of FQN class names, so we need to make
- // name as path so we can use ant patch matcher
- sysExcludePattern = sysExcludePattern.replace('.', '/');
+ if (match && ObjectHelper.isNotEmpty(excludePattern)) {
// there may be multiple separated by comma
- String[] parts = sysExcludePattern.split(",");
+ String[] parts = excludePattern.split(",");
for (String part : parts) {
// must negate when excluding, and hence !
match = !matcher.match(part, name);