camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Huston <shus...@riverace.com>
Subject Not seeing query params on REST DSL
Date Wed, 20 Apr 2016 21:12:46 GMT
I am using the REST DSL in a Camel SCR unit test. I have a route (being tested) that will initiate
a http request at this URL:

	@Test
	public void testRoutes() throws Exception {
        context.addRoutes(new RouteBuilder() {
        	@Override
        	public void configure() throws Exception {
        		restConfiguration().component("restlet").port(9000);
        		rest("/asset")
        			.put("/{addr}/pong") .param().name("id").type(RestParamType.query).endParam()
        			.to("log:steve?showAll=true")
        			.to("mock:result");
        	}
        });

        MockEndpoint resultEndpoint = context.getEndpoint("mock:result", MockEndpoint.class);
        resultEndpoint.expectedMessageCount(1);
        resultEndpoint.message(0).header("addr").isEqualTo("my_test_value");
        resultEndpoint.message(0).header("id").isEqualTo("abcd1234");


At run time, the request does arrive as a PUT to http://127.0.0.1:9000/asset/my_test_value/pong?id=abcd1234

However, I am only getting the "addr" path parameter in the header. The query param "id" is
missing.
Am I doing something wrong on the definition? I pieced together the way to do it from disparate
tidbits on the net.

Thanks,
-Steve

Mime
View raw message