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 2015/07/12 20:14:33 UTC
[3/4] camel git commit: CAMEL-6646: Added unit test
CAMEL-6646: Added unit test
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3ba81beb
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3ba81beb
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3ba81beb
Branch: refs/heads/master
Commit: 3ba81bebb3422fe83d71d95bf3ac7ff4d15b5b98
Parents: 8efac41
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Jul 12 18:17:07 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Jul 12 20:16:16 2015 +0200
----------------------------------------------------------------------
.../bean/BeanOnglStaticMethodTest.java | 49 ++++++++++++++++++++
.../camel/component/bean/CamelCustomer.java | 24 ++++++++++
2 files changed, 73 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/3ba81beb/camel-core/src/test/java/org/apache/camel/component/bean/BeanOnglStaticMethodTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/BeanOnglStaticMethodTest.java b/camel-core/src/test/java/org/apache/camel/component/bean/BeanOnglStaticMethodTest.java
new file mode 100644
index 0000000..7a0162a
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/BeanOnglStaticMethodTest.java
@@ -0,0 +1,49 @@
+/**
+ * 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.component.bean;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+
+public class BeanOnglStaticMethodTest extends ContextTestSupport {
+
+ public void testBeanOnglStaticMethod() throws Exception {
+ getMockEndpoint("mock:result").expectedBodiesReceived("Hello Camel");
+
+ template.sendBody("direct:start", "Hello World");
+ template.sendBody("direct:start", "Hello Camel");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start")
+ .filter().method(BeanOnglStaticMethodTest.class, "asCustomer.isGoldCustomer")
+ .to("mock:result");
+ }
+ };
+ }
+
+ public static CamelCustomer asCustomer() {
+ return new CamelCustomer();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/3ba81beb/camel-core/src/test/java/org/apache/camel/component/bean/CamelCustomer.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/CamelCustomer.java b/camel-core/src/test/java/org/apache/camel/component/bean/CamelCustomer.java
new file mode 100644
index 0000000..1464280
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/CamelCustomer.java
@@ -0,0 +1,24 @@
+/**
+ * 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.component.bean;
+
+public class CamelCustomer {
+
+ public static boolean isGoldCustomer(String body) {
+ return body.contains("Camel");
+ }
+}