camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/2] camel git commit: CAMEL-9672: ClassCastException with interceptFrom and using when with JMX. Thanks to Stephan Siano for the patch.
Date Mon, 07 Mar 2016 08:58:30 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.16.x 3660437ae -> 064005c0a
  refs/heads/master 7944093fd -> 849226990


CAMEL-9672: ClassCastException with interceptFrom and using when with JMX. Thanks to Stephan
Siano for the patch.


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

Branch: refs/heads/master
Commit: 84922699039ddf69423b998505a8046bb0e0a5cb
Parents: 7944093
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Mon Mar 7 09:25:38 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Mon Mar 7 09:25:38 2016 +0100

----------------------------------------------------------------------
 .../DefaultManagementObjectStrategy.java        |  3 +-
 .../camel/management/mbean/ManagedFilter.java   |  8 +--
 .../management/ManagedInterceptFromTest.java    | 54 ++++++++++++++++++++
 3 files changed, 60 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/84922699/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java
b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java
index d30e4fe..c53cffb 100644
--- a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java
+++ b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java
@@ -96,6 +96,7 @@ import org.apache.camel.management.mbean.ManagedUnmarshal;
 import org.apache.camel.management.mbean.ManagedValidate;
 import org.apache.camel.management.mbean.ManagedWeightedLoadBalancer;
 import org.apache.camel.management.mbean.ManagedWireTapProcessor;
+import org.apache.camel.model.ExpressionNode;
 import org.apache.camel.model.LoadBalanceDefinition;
 import org.apache.camel.model.ModelCamelContext;
 import org.apache.camel.model.ProcessDefinition;
@@ -307,7 +308,7 @@ public class DefaultManagementObjectStrategy implements ManagementObjectStrategy
             } else if (target instanceof RoutingSlip) {
                 answer = new ManagedRoutingSlip(context, (RoutingSlip) target, (org.apache.camel.model.RoutingSlipDefinition)
definition);
             } else if (target instanceof FilterProcessor) {
-                answer = new ManagedFilter(context, (FilterProcessor) target, (org.apache.camel.model.FilterDefinition)
definition);
+                answer = new ManagedFilter(context, (FilterProcessor) target, (ExpressionNode)definition);
             } else if (target instanceof LogProcessor) {
                 answer = new ManagedLog(context, (LogProcessor) target, definition);
             } else if (target instanceof LoopProcessor) {

http://git-wip-us.apache.org/repos/asf/camel/blob/84922699/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedFilter.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedFilter.java
b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedFilter.java
index 9d9ae5a..2d253b6 100644
--- a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedFilter.java
+++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedFilter.java
@@ -19,7 +19,7 @@ package org.apache.camel.management.mbean;
 import org.apache.camel.CamelContext;
 import org.apache.camel.api.management.ManagedResource;
 import org.apache.camel.api.management.mbean.ManagedFilterMBean;
-import org.apache.camel.model.FilterDefinition;
+import org.apache.camel.model.ExpressionNode;
 import org.apache.camel.processor.FilterProcessor;
 
 /**
@@ -29,14 +29,14 @@ import org.apache.camel.processor.FilterProcessor;
 public class ManagedFilter extends ManagedProcessor implements ManagedFilterMBean {
     private final FilterProcessor processor;
 
-    public ManagedFilter(CamelContext context, FilterProcessor processor, FilterDefinition
definition) {
+    public ManagedFilter(CamelContext context, FilterProcessor processor, ExpressionNode
definition) {
         super(context, processor, definition);
         this.processor = processor;
     }
 
     @Override
-    public FilterDefinition getDefinition() {
-        return (FilterDefinition) super.getDefinition();
+    public ExpressionNode getDefinition() {
+        return (ExpressionNode) super.getDefinition();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/84922699/camel-core/src/test/java/org/apache/camel/management/ManagedInterceptFromTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/management/ManagedInterceptFromTest.java
b/camel-core/src/test/java/org/apache/camel/management/ManagedInterceptFromTest.java
new file mode 100644
index 0000000..0ea3050
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/management/ManagedInterceptFromTest.java
@@ -0,0 +1,54 @@
+/**
+ * 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.management;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+
+/**
+ * @version 
+ */
+public class ManagedInterceptFromTest extends ManagementTestSupport {
+
+    public void testManageWithInterceptFrom() throws Exception {
+        // JMX tests dont work well on AIX CI servers (hangs them)
+        if (isPlatform("aix")) {
+            return;
+        }
+
+        MockEndpoint foo = getMockEndpoint("mock:foo");
+        foo.expectedMessageCount(1);
+        MockEndpoint intercepted = getMockEndpoint("mock:intercepted");
+        intercepted.setExpectedMessageCount(1);
+
+        template.sendBodyAndHeader("direct:start", "Hello World", "foo", "123");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                interceptFrom().when(simple("${header.foo} == '123'")).to("mock:intercepted");
+                from("direct:start").to("mock:foo");
+            }
+        };
+    }
+
+}


Mime
View raw message