camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1165160 - in /camel/branches/camel-2.8.x: ./ components/camel-servlet/src/main/java/org/apache/camel/component/servlet/ServletEndpoint.java components/camel-servlet/src/test/java/org/apache/camel/component/servlet/HttpClientRouteTest.java
Date Mon, 05 Sep 2011 04:38:13 GMT
Author: ningjiang
Date: Mon Sep  5 04:38:13 2011
New Revision: 1165160

URL: http://svn.apache.org/viewvc?rev=1165160&view=rev
Log:
Merged revisions 1165157 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r1165157 | ningjiang | 2011-09-05 11:45:18 +0800 (Mon, 05 Sep 2011) | 1 line
  
  CAMEL-4412 ServletEndpoint doesn't support to create the producer
........

Modified:
    camel/branches/camel-2.8.x/   (props changed)
    camel/branches/camel-2.8.x/components/camel-servlet/src/main/java/org/apache/camel/component/servlet/ServletEndpoint.java
    camel/branches/camel-2.8.x/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/HttpClientRouteTest.java

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep  5 04:38:13 2011
@@ -1 +1 @@
-/camel/trunk:1148706,1148710,1149570,1150651,1151000,1151054,1151087,1151362,1152170,1152755,1153620,1153812,1153829,1154684,1155230,1156108,1156260,1156277,1156479,1156524,1157348,1157749,1157798,1157831,1157878,1158153,1159171,1159174,1159326,1159457,1159460,1159606,1159682-1159683,1159867,1160547,1160637,1161010,1161082,1161524,1162309,1162395,1163420,1164557,1164633,1164973-1165000,1165152
+/camel/trunk:1148706,1148710,1149570,1150651,1151000,1151054,1151087,1151362,1152170,1152755,1153620,1153812,1153829,1154684,1155230,1156108,1156260,1156277,1156479,1156524,1157348,1157749,1157798,1157831,1157878,1158153,1159171,1159174,1159326,1159457,1159460,1159606,1159682-1159683,1159867,1160547,1160637,1161010,1161082,1161524,1162309,1162395,1163420,1164557,1164633,1164973-1165000,1165152,1165157

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.8.x/components/camel-servlet/src/main/java/org/apache/camel/component/servlet/ServletEndpoint.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-servlet/src/main/java/org/apache/camel/component/servlet/ServletEndpoint.java?rev=1165160&r1=1165159&r2=1165160&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-servlet/src/main/java/org/apache/camel/component/servlet/ServletEndpoint.java
(original)
+++ camel/branches/camel-2.8.x/components/camel-servlet/src/main/java/org/apache/camel/component/servlet/ServletEndpoint.java
Mon Sep  5 04:38:13 2011
@@ -21,6 +21,7 @@ import java.net.URISyntaxException;
 
 import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
+import org.apache.camel.Producer;
 import org.apache.camel.component.http.HttpClientConfigurer;
 import org.apache.camel.component.http.HttpConsumer;
 import org.apache.camel.component.http.HttpEndpoint;
@@ -49,6 +50,11 @@ public class ServletEndpoint extends Htt
     }
 
     @Override
+    public Producer createProducer() throws Exception {
+        throw new UnsupportedOperationException("You cannot create producer with servlet
endpoint, please consider to use http or http4 endpoint.");
+    }
+
+    @Override
     public Consumer createConsumer(Processor processor) throws Exception {
         return new HttpConsumer(this, processor);
     }

Modified: camel/branches/camel-2.8.x/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/HttpClientRouteTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/HttpClientRouteTest.java?rev=1165160&r1=1165159&r2=1165160&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/HttpClientRouteTest.java
(original)
+++ camel/branches/camel-2.8.x/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/HttpClientRouteTest.java
Mon Sep  5 04:38:13 2011
@@ -25,6 +25,7 @@ import com.meterware.httpunit.WebRequest
 import com.meterware.httpunit.WebResponse;
 import com.meterware.servletunit.ServletUnitClient;
 import org.apache.camel.Exchange;
+import org.apache.camel.FailedToCreateProducerException;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.junit.Test;
@@ -63,6 +64,26 @@ public class HttpClientRouteTest extends
         assertEquals("The response message is wrong ", "OK", response.getResponseMessage());
         assertEquals("The response body is wrong", "Bye World", response.getText());
     }
+
+    @Test
+    public void testCreateSerlvetEndpointProducer() throws Exception {
+        if (!startCamelContext) {
+            // don't test it with web.xml configure
+            return;
+        }
+        try {
+            context.addRoutes(new RouteBuilder() {
+                @Override
+                public void configure() throws Exception {
+                    from("direct:start").to("servlet:///testworld");
+                }
+            });
+            fail("Excepts exception here");
+        } catch (Exception ex) {
+            assertTrue("Get a wrong exception." , ex instanceof FailedToCreateProducerException);
+            assertTrue("Get a wrong cause of exception.", ex.getCause() instanceof UnsupportedOperationException);
+        }
+    }
     
     public static class MyServletRoute extends RouteBuilder {
 



Mime
View raw message