Hi,

I'm looking to implement some tests cases to test Cross Origin Resource
Sharing (CORS) with camel-websocket. Until now, we have used the lib Async
HTTP of the ning project (https://github.com/sonatype/async-http-client) to
design our client tests cases. Unfortunately, the existing code does not
provide like this Jetty Class
(http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/CrossOriginFilterTest.java?id=a6b41a7deb9ae919c2e5a9c8838bc44f079d8f1f)
object + method to check response status and content

        FilterHolder filterHolder = new FilterHolder(new
CrossOriginFilter());
        String origin = "http://localhost";;
       
filterHolder.setInitParameter(CrossOriginFilter.ALLOWED_ORIGINS_PARAM,
origin);
        tester.getContext().addFilter(filterHolder, "/*",
FilterMapping.DEFAULT);

        CountDownLatch latch = new CountDownLatch(1);
        tester.getContext().addServlet(new ServletHolder(new
ResourceServlet(latch)), "/*");

        String request = "" +
                "GET / HTTP/1.1\r\n" +
                "Host: localhost\r\n" +
                "Origin: " + origin + "\r\n" +
                "\r\n";
        String response = tester.getResponses(request);
        Assert.assertTrue(response.contains("HTTP/1.1 200"));
       
Assert.assertTrue(response.contains(CrossOriginFilter.ACCESS_CONTROL_ALLOW_ORIGIN_HEADER));
       
Assert.assertTrue(response.contains(CrossOriginFilter.ACCESS_CONTROL_ALLOW_CREDENTIALS_HEADER));
 

Question : Does anybody has an idea How to get HTTP Response with Async HTTP
Client ?

Regards,

Charles  

-----
Apache Committer / Sr. Pr. Consultant at FuseSource.com
Email: [hidden email]
Twitter : @cmoulliard, @fusenews
Blog : http://cmoulliard.blogspot.com
--
View this message in context: 
http://camel.465427.n5.nabble.com/Question-WebSocket-Test-Client-with-CORS-tp5715710.html
Sent from the Camel Development mailing list archive at Nabble.com.

Reply via email to