camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r761612 - in /camel/branches/camel-1.x: ./ components/camel-restlet/src/main/java/org/apache/camel/component/restlet/ components/camel-restlet/src/test/java/org/apache/camel/component/restlet/ components/camel-xmpp/src/test/resources/
Date Fri, 03 Apr 2009 11:05:11 GMT
Author: ningjiang
Date: Fri Apr  3 11:05:11 2009
New Revision: 761612

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

........
  r761607 | ningjiang | 2009-04-03 18:52:52 +0800 (Fri, 03 Apr 2009) | 1 line
  
  CAMEL-1516 set the context to the Restlet client in RestletProducer
........

Modified:
    camel/branches/camel-1.x/   (props changed)
    camel/branches/camel-1.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletProducer.java
    camel/branches/camel-1.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletResponseTest.java
    camel/branches/camel-1.x/components/camel-xmpp/src/test/resources/   (props changed)

Propchange: camel/branches/camel-1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Apr  3 11:05:11 2009
@@ -1 +1 @@
-/camel/trunk:736980,739733,739904,740251,740295,740306,740596,740663,741848,742231,742705,742739,742854,742856,742898,742906,743613,743762,743773,743920,743959-743960,744123,745105,745367,745541,745751,745826,745978,746269,746872,746895,746962,747258,747678-747704,748392,748436,748821,749563-749564,749574,749628-749629,749936,749956,750017,750334,750396,750761,750796,752068,752117,752418,752751-752755,752764-752773,752956,753087,753101,753175,755136,755487,756313,756348,756870,756939,757636,757693,757743,757865,758539,758563,758600,758617,758692,758990,759362,759453,759887,759931,760003,760890,760909,760937,761194,761536,761583
+/camel/trunk:736980,739733,739904,740251,740295,740306,740596,740663,741848,742231,742705,742739,742854,742856,742898,742906,743613,743762,743773,743920,743959-743960,744123,745105,745367,745541,745751,745826,745978,746269,746872,746895,746962,747258,747678-747704,748392,748436,748821,749563-749564,749574,749628-749629,749936,749956,750017,750334,750396,750761,750796,752068,752117,752418,752751-752755,752764-752773,752956,753087,753101,753175,755136,755487,756313,756348,756870,756939,757636,757693,757743,757865,758539,758563,758600,758617,758692,758990,759362,759453,759887,759931,760003,760890,760909,760937,761194,761536,761583,761607

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

Modified: camel/branches/camel-1.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletProducer.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletProducer.java?rev=761612&r1=761611&r2=761612&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletProducer.java
(original)
+++ camel/branches/camel-1.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletProducer.java
Fri Apr  3 11:05:11 2009
@@ -21,6 +21,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.restlet.Client;
+import org.restlet.Context;
 import org.restlet.data.Request;
 import org.restlet.data.Response;
 
@@ -36,6 +37,7 @@
     public RestletProducer(RestletEndpoint endpoint) throws Exception {
         super(endpoint);
         client = new Client(endpoint.getProtocol());
+        client.setContext(new Context());
     }
 
     @Override

Modified: camel/branches/camel-1.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletResponseTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletResponseTest.java?rev=761612&r1=761611&r2=761612&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletResponseTest.java
(original)
+++ camel/branches/camel-1.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletResponseTest.java
Fri Apr  3 11:05:11 2009
@@ -16,6 +16,9 @@
  */
 package org.apache.camel.component.restlet;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
@@ -38,6 +41,9 @@
             public void configure() throws Exception {
                 from("restlet:http://localhost:9080/users/{username}?restletMethod=POST").process(new
Processor() {
                     public void process(Exchange exchange) throws Exception {
+                        String userName = exchange.getIn().getHeader("username", String.class);
                       
+                        assertNotNull("userName should not be null", userName);
+                        exchange.getOut().setBody("{" + userName + "}");
                         exchange.getOut().setHeader(RestletConstants.RESPONSE_CODE, "417");
                         exchange.getOut().setHeader(RestletConstants.MEDIA_TYPE, "application/JSON");
                     }        
@@ -56,6 +62,12 @@
         } finally {
             method.releaseConnection();
         }
-
+    }
+    
+    public void testRestletProducer() throws Exception {
+        Map<String, Object> headers = new HashMap<String, Object>();        
+        headers.put("username", "homer");
+        String response = (String)template.requestBodyAndHeaders("restlet:http://localhost:9080/users/{username}?restletMethod=POST",
"<request>message</request>", headers);
+        assertEquals("The response is wrong ", response, "{homer}");
     }
 }

Propchange: camel/branches/camel-1.x/components/camel-xmpp/src/test/resources/
            ('svn:mergeinfo' removed)



Mime
View raw message