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 2017/04/07 11:24:00 UTC
[1/2] camel git commit: CAMEL-11111: added unit test for
throwExceptionOnFailure
Repository: camel
Updated Branches:
refs/heads/master 5fa359bc5 -> 2f3b023e5
CAMEL-11111: added unit test for throwExceptionOnFailure
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/643c3e3e
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/643c3e3e
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/643c3e3e
Branch: refs/heads/master
Commit: 643c3e3e0059c80b067814dffb4df41d003906ce
Parents: 5fa359b
Author: Scott Cranton <sc...@cranton.com>
Authored: Wed Apr 5 07:49:04 2017 -0400
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Apr 7 13:18:04 2017 +0200
----------------------------------------------------------------------
...HttpProducerThrowExceptionOnFailureTest.java | 58 +++++++++++++++++++
...rtowProducerThrowExceptionOnFailureTest.java | 60 ++++++++++++++++++++
2 files changed, 118 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/643c3e3e/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpProducerThrowExceptionOnFailureTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpProducerThrowExceptionOnFailureTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpProducerThrowExceptionOnFailureTest.java
new file mode 100644
index 0000000..d5b7a60
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpProducerThrowExceptionOnFailureTest.java
@@ -0,0 +1,58 @@
+/**
+ * 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.netty4.http;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class NettyHttpProducerThrowExceptionOnFailureTest extends BaseNettyTest {
+
+ @Test
+ public void testFailWithoutException() throws Exception {
+ try {
+ String out = template().requestBody("netty4-http:http://localhost:{{port}}/fail?throwExceptionOnFailure=false", null, String.class);
+ assertEquals("Fail", out);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ fail("Should not throw an exception");
+ }
+ }
+
+ @Test
+ public void testFailWithException() throws Exception {
+ try {
+ String out = template().requestBody("netty4-http:http://localhost:{{port}}/fail?throwExceptionOnFailure=true", null, String.class);
+ fail("Should throw an exception");
+ } catch (Throwable t) {
+ //t.printStackTrace();
+ assertNotNull(t);
+ }
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("netty4-http:http://localhost:{{port}}/fail")
+ .setHeader(Exchange.HTTP_RESPONSE_CODE).constant(404)
+ .transform(constant("Fail"));
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/643c3e3e/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowProducerThrowExceptionOnFailureTest.java
----------------------------------------------------------------------
diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowProducerThrowExceptionOnFailureTest.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowProducerThrowExceptionOnFailureTest.java
new file mode 100644
index 0000000..074590b
--- /dev/null
+++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowProducerThrowExceptionOnFailureTest.java
@@ -0,0 +1,60 @@
+/**
+ * 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.undertow;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+import java.util.concurrent.TimeUnit;
+
+public class UndertowProducerThrowExceptionOnFailureTest extends BaseUndertowTest {
+
+ @Test
+ public void testFailWithoutException() throws Exception {
+ try {
+ String out = template().requestBody("undertow:http://localhost:{{port}}/fail?throwExceptionOnFailure=false", null, String.class);
+ assertEquals("Fail", out);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ fail("Should not throw an exception");
+ }
+ }
+
+ @Test
+ public void testFailWithException() throws Exception {
+ try {
+ String out = template().requestBody("undertow:http://localhost:{{port}}/fail?throwExceptionOnFailure=true", null, String.class);
+ } catch (Throwable t) {
+ //t.printStackTrace();
+ assertNotNull(t);
+ }
+ fail("Should throw an exception");
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("undertow:http://localhost:{{port}}/fail")
+ .setHeader(Exchange.HTTP_RESPONSE_CODE).constant(404)
+ .transform(constant("Fail"));
+ }
+ };
+ }
+}
[2/2] camel git commit: CAMEL-11111: Disabled test until its
implemented
Posted by da...@apache.org.
CAMEL-11111: Disabled test until its implemented
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2f3b023e
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2f3b023e
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2f3b023e
Branch: refs/heads/master
Commit: 2f3b023e5ad12a1d068bd2ebcd5189ed0f20ec5f
Parents: 643c3e3
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Apr 7 13:23:52 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Apr 7 13:23:52 2017 +0200
----------------------------------------------------------------------
.../undertow/UndertowProducerThrowExceptionOnFailureTest.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/2f3b023e/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowProducerThrowExceptionOnFailureTest.java
----------------------------------------------------------------------
diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowProducerThrowExceptionOnFailureTest.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowProducerThrowExceptionOnFailureTest.java
index 074590b..f0d2472 100644
--- a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowProducerThrowExceptionOnFailureTest.java
+++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowProducerThrowExceptionOnFailureTest.java
@@ -18,10 +18,12 @@ package org.apache.camel.component.undertow;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
+import org.junit.Ignore;
import org.junit.Test;
import java.util.concurrent.TimeUnit;
+@Ignore("CAMEL-11111")
public class UndertowProducerThrowExceptionOnFailureTest extends BaseUndertowTest {
@Test