You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ff...@apache.org on 2019/09/05 13:55:02 UTC

[camel] branch camel-2.24.x updated (3247bb9 -> 241ad96)

This is an automated email from the ASF dual-hosted git repository.

ffang pushed a change to branch camel-2.24.x
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 3247bb9  CAMEL-13931 tempFileName directory is not auto-created if it is relative before the endpoint path
     new 5746bbf  [CAMEL-13942]UnitOfWork should be done after send back response
     new 241ad96  remove unnecessary comment code

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel/component/undertow/UndertowConsumer.java |  5 +++
 ...est.java => UndertowHttpStreamCachingTest.java} | 45 +++++++++++++---------
 2 files changed, 31 insertions(+), 19 deletions(-)
 copy components/camel-undertow/src/test/java/org/apache/camel/component/undertow/{UndertowError500Test.java => UndertowHttpStreamCachingTest.java} (53%)


[camel] 01/02: [CAMEL-13942]UnitOfWork should be done after send back response

Posted by ff...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ffang pushed a commit to branch camel-2.24.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 5746bbfe720f6449a73f43bc108c499965fcc14c
Author: Freeman Fang <fr...@gmail.com>
AuthorDate: Wed Sep 4 15:55:43 2019 -0400

    [CAMEL-13942]UnitOfWork should be done after send back response
    
    (cherry picked from commit 101c4eb80b4d1aa6bd267a72d8fe315f74d917a9)
    (cherry picked from commit 4b176b5a3b7cbff552312fb443d3b4d98eb7d43d)
    
    Conflicts:
    	components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowConsumer.java
---
 .../camel/component/undertow/UndertowConsumer.java |  5 ++
 .../undertow/UndertowHttpStreamCachingTest.java    | 61 ++++++++++++++++++++++
 2 files changed, 66 insertions(+)

diff --git a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowConsumer.java b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowConsumer.java
index bcdec14..e15e3a9 100644
--- a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowConsumer.java
+++ b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowConsumer.java
@@ -142,12 +142,17 @@ public class UndertowConsumer extends DefaultConsumer implements HttpHandler {
         createUoW(camelExchange);
         try {
             getProcessor().process(camelExchange);
+            sendResponse(httpExchange, camelExchange);
         } catch (Exception e) {
             getExceptionHandler().handleException(e);
         } finally {
             doneUoW(camelExchange);
         }
 
+        
+    }
+
+    private void sendResponse(HttpServerExchange httpExchange, Exchange camelExchange) throws IOException {
         Object body = getResponseBody(httpExchange, camelExchange);
         TypeConverter tc = getEndpoint().getCamelContext().getTypeConverter();
 
diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowHttpStreamCachingTest.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowHttpStreamCachingTest.java
new file mode 100644
index 0000000..e9bcfaa
--- /dev/null
+++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowHttpStreamCachingTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.apache.camel.component.http.HttpMethods;
+import org.junit.Test;
+
+public class UndertowHttpStreamCachingTest extends BaseUndertowTest {
+    
+    private String data = "abcdefg";
+
+
+    @Test
+    public void testTwoWayStreaming() throws Exception {
+        Exchange exchange = template.request("undertow:http://localhost:{{port}}/client", null);
+        
+        assertTrue(new String((byte[])exchange.getMessage().getBody()).equals(data));
+    }
+
+    
+
+    
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                
+                getContext().setStreamCaching(true);
+                getContext().getStreamCachingStrategy().setSpoolThreshold(3);
+
+                
+
+                //from("undertow:http://localhost:8080/client?useStreaming=true")
+                from("undertow:http://localhost:{{port}}/client")
+                    .setHeader(Exchange.HTTP_METHOD, constant(HttpMethods.POST))
+                    .to("http://localhost:{{port}}/server?bridgeEndpoint=true").to("log:lgName?showBody=true")
+                    .end();
+                from("undertow:http://localhost:{{port}}/server?httpMethodRestrict=POST").setBody(simple(data))
+                    .to("log:lgName?showBody=true").end();
+            }
+        };
+    }
+
+}


[camel] 02/02: remove unnecessary comment code

Posted by ff...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ffang pushed a commit to branch camel-2.24.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 241ad96dd8083f740605eaa4857c4057bfe5469a
Author: Freeman Fang <fr...@gmail.com>
AuthorDate: Thu Sep 5 09:34:20 2019 -0400

    remove unnecessary comment code
    
    (cherry picked from commit 33c143b257ae3da43f6a9f4177e8993772baaf37)
    (cherry picked from commit 81a7b9a467dcabbbb0c327fa2656b280b87b6541)
---
 .../apache/camel/component/undertow/UndertowHttpStreamCachingTest.java   | 1 -
 1 file changed, 1 deletion(-)

diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowHttpStreamCachingTest.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowHttpStreamCachingTest.java
index e9bcfaa..f064504 100644
--- a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowHttpStreamCachingTest.java
+++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowHttpStreamCachingTest.java
@@ -47,7 +47,6 @@ public class UndertowHttpStreamCachingTest extends BaseUndertowTest {
 
                 
 
-                //from("undertow:http://localhost:8080/client?useStreaming=true")
                 from("undertow:http://localhost:{{port}}/client")
                     .setHeader(Exchange.HTTP_METHOD, constant(HttpMethods.POST))
                     .to("http://localhost:{{port}}/server?bridgeEndpoint=true").to("log:lgName?showBody=true")