You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by wt...@apache.org on 2009/01/01 21:24:09 UTC
svn commit: r730600 - in /activemq/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-restlet/src/test/java...
Author: wtam
Date: Thu Jan 1 12:24:08 2009
New Revision: 730600
URL: http://svn.apache.org/viewvc?rev=730600&view=rev
Log:
Merged revisions 730599 via svnmerge from
https://svn.apache.org/repos/asf/activemq/camel/trunk
........
r730599 | wtam | 2009-01-01 15:21:15 -0500 (Thu, 01 Jan 2009) | 1 line
[CAMEL-1203] Restlet component update with snippet tags
........
Modified:
activemq/camel/branches/camel-1.x/ (props changed)
activemq/camel/branches/camel-1.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
activemq/camel/branches/camel-1.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletConstants.java
activemq/camel/branches/camel-1.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRouteBuilderAuthTest.java
activemq/camel/branches/camel-1.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/route/TestRouteBuilder.java
activemq/camel/branches/camel-1.x/components/camel-restlet/src/test/resources/org/apache/camel/component/restlet/camel-context.xml
Propchange: activemq/camel/branches/camel-1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jan 1 12:24:08 2009
@@ -1 +1 @@
-/activemq/camel/trunk:709850,711200,711206,711219-711220,711523,711531,711756,711784,711859,711874,711962,711971,712064,712119,712148,712662,712692,712925,713013,713107,713136,713273,713290,713292,713295,713314,713475,713625,713932,713944,714032,717965,717989,718242,718273,718312-718515,719163-719184,719334,719339,719524,719662,719848,719851,719855,719864,719978-719979,720207,720435-720437,720806,721272,721331,721333-721334,721360,721669,721764,721813,721985,722005,722070,722110,722415,722438,722726,722845,722878,723264,723314,723325-723327,723409,723835,723966,724122,724619,724681,725040,725309-725320,725340,725351,725569-725572,725612,725652-725660,725715,725883,726339,726640-726645,726932,727113,727375,727377,727624,727713,727946,729401,729892,730069,730154,730275,730299,730504-730505,730508,730571
+/activemq/camel/trunk:709850,711200,711206,711219-711220,711523,711531,711756,711784,711859,711874,711962,711971,712064,712119,712148,712662,712692,712925,713013,713107,713136,713273,713290,713292,713295,713314,713475,713625,713932,713944,714032,717965,717989,718242,718273,718312-718515,719163-719184,719334,719339,719524,719662,719848,719851,719855,719864,719978-719979,720207,720435-720437,720806,721272,721331,721333-721334,721360,721669,721764,721813,721985,722005,722070,722110,722415,722438,722726,722845,722878,723264,723314,723325-723327,723409,723835,723966,724122,724619,724681,725040,725309-725320,725340,725351,725569-725572,725612,725652-725660,725715,725883,726339,726640-726645,726932,727113,727375,727377,727624,727713,727946,729401,729892,730069,730154,730275,730299,730504-730505,730508,730571,730599
Propchange: activemq/camel/branches/camel-1.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: activemq/camel/branches/camel-1.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java?rev=730600&r1=730599&r2=730600&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java (original)
+++ activemq/camel/branches/camel-1.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java Thu Jan 1 12:24:08 2009
@@ -176,7 +176,7 @@
}
}
- private String buildKey(RestletEndpoint endpoint) {
+ private static String buildKey(RestletEndpoint endpoint) {
return endpoint.getHost() + ":" + endpoint.getPort();
}
Modified: activemq/camel/branches/camel-1.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletConstants.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletConstants.java?rev=730600&r1=730599&r2=730600&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletConstants.java (original)
+++ activemq/camel/branches/camel-1.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletConstants.java Thu Jan 1 12:24:08 2009
@@ -23,8 +23,8 @@
*/
public final class RestletConstants {
- public static final String LOGIN = "camel.restlet.auth.login";
- public static final String PASSWORD = "camel.restlet.auth.password";
+ public static final String LOGIN = "org.apache.camel.restlet.auth.login";
+ public static final String PASSWORD = "org.apache.camel.restlet.auth.password";
private RestletConstants() {
}
Modified: activemq/camel/branches/camel-1.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRouteBuilderAuthTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRouteBuilderAuthTest.java?rev=730600&r1=730599&r2=730600&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRouteBuilderAuthTest.java (original)
+++ activemq/camel/branches/camel-1.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRouteBuilderAuthTest.java Thu Jan 1 12:24:08 2009
@@ -17,6 +17,8 @@
package org.apache.camel.component.restlet;
import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.spring.SpringTestSupport;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -24,15 +26,30 @@
public class RestletRouteBuilderAuthTest extends SpringTestSupport {
public void testBasicAuth() throws IOException {
- String response = (String) template.requestBody("direct:start-auth",
- "<order foo='1'/>");
- assertEquals("received [<order foo='1'/>] as an order id = " + 89531,
+
+ // START SNIPPET: auth_request
+ final String id = "89531";
+
+ Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put(RestletConstants.LOGIN, "admin");
+ headers.put(RestletConstants.PASSWORD, "foo");
+ headers.put("id", id);
+
+ String response = (String) template.requestBodyAndHeaders("direct:start-auth",
+ "<order foo='1'/>", headers);
+ // END SNIPPET: auth_request
+
+ assertEquals("received [<order foo='1'/>] as an order id = " + id,
response);
}
public void testhBasicAuthError() throws IOException {
- String response = (String) template.requestBody("direct:start-bad-auth",
- "<order foo='1'/>");
+ Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put(RestletConstants.LOGIN, "admin");
+ headers.put(RestletConstants.PASSWORD, "bad");
+ headers.put("id", "xyz");
+ String response = (String) template.requestBodyAndHeaders("direct:start-auth",
+ "<order foo='1'/>", headers);
assertTrue(response.contains("requires user authentication"));
}
Modified: activemq/camel/branches/camel-1.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/route/TestRouteBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/route/TestRouteBuilder.java?rev=730600&r1=730599&r2=730600&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/route/TestRouteBuilder.java (original)
+++ activemq/camel/branches/camel-1.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/route/TestRouteBuilder.java Thu Jan 1 12:24:08 2009
@@ -19,7 +19,6 @@
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.restlet.RestletConstants;
/**
* Route builder for RestletRouteBuilderAuthTest
@@ -27,25 +26,11 @@
* @version $Revision$
*/
public class TestRouteBuilder extends RouteBuilder {
- private static final String ID = "89531";
@Override
public void configure() throws Exception {
- // Note: restletMethod and restletRealmRef are stripped
- // from the query before a request is sent as they are
- // only processed by Camel.
-
- from("direct:start-auth").setHeader("id", constant(ID))
- .setHeader(RestletConstants.LOGIN, constant("admin"))
- .setHeader(RestletConstants.PASSWORD, constant("foo"))
- .to("restlet:http://localhost:8080/securedOrders?restletMethod=post");
-
- from("direct:start-bad-auth").setHeader("id", constant(ID))
- .setHeader(RestletConstants.LOGIN, constant("admizzzn"))
- .setHeader(RestletConstants.PASSWORD, constant("fozzzo"))
- .to("restlet:http://localhost:8080/securedOrders?restletMethod=post");
-
+ // START SNIPPET: consumer_route
from("restlet:http://localhost:8080/securedOrders?restletMethod=post&restletRealmRef=realm").process(new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getOut().setBody(
@@ -54,6 +39,15 @@
+ exchange.getIn().getHeader("id"));
}
});
+ // END SNIPPET: consumer_route
+
+ // START SNIPPET: producer_route
+ // Note: restletMethod and restletRealmRef are stripped
+ // from the query before a request is sent as they are
+ // only processed by Camel.
+ from("direct:start-auth").to("restlet:http://localhost:8080/securedOrders?restletMethod=post");
+ // END SNIPPET: producer_route
+
}
}
Modified: activemq/camel/branches/camel-1.x/components/camel-restlet/src/test/resources/org/apache/camel/component/restlet/camel-context.xml
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-restlet/src/test/resources/org/apache/camel/component/restlet/camel-context.xml?rev=730600&r1=730599&r2=730600&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/components/camel-restlet/src/test/resources/org/apache/camel/component/restlet/camel-context.xml (original)
+++ activemq/camel/branches/camel-1.x/components/camel-restlet/src/test/resources/org/apache/camel/component/restlet/camel-context.xml Thu Jan 1 12:24:08 2009
@@ -12,7 +12,7 @@
CONDITIONS OF ANY KIND, either express or implied. See the License for
the specific language governing permissions and limitations under the
License.
- -->
+ -->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
@@ -28,8 +28,12 @@
<camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
<package>org.apache.camel.component.restlet.route</package>
</camelContext>
+
+ <!-- START SNIPPET: realm -->
<util:map id="realm">
<entry key="admin" value="foo" />
<entry key="bar" value="foo" />
</util:map>
+ <!-- END SNIPPET: realm -->
+
</beans>
\ No newline at end of file