Error when using session during camel Junit testing

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Error when using session during camel Junit testing

Aravind Rajasekharan Pillai
Hi

I am trying to unit test my camel CXF-RS endpoint and below is my test
code snippet


CxfRsEndpoint endpoint =
resolveMandatoryEndpoint("cxfrs:bean:coreEndPointClient",
CxfRsEndpoint.class); endpoint.start(); final ServiceStatus status =
endpoint.getStatus(); final Producer producer =
endpoint.createProducer(); final Exchange exchange =
endpoint.createExchange(); //populate Exchange final Exchange send =
coreEndpoint.send(endpoint, exchange);

The End point is invoked fine however I am using session in my code
and when it hits request.getSession fails with below stack trace.

java.lang.IllegalStateException: No SessionManager
    at org.eclipse.jetty.server.Request.getSession(Request.java:1402)
    at org.eclipse.jetty.server.Request.getSession(Request.java:1377)
    at com.incomm.imp.neo.core.authentication.context.SpringSecurityUserContext.getSession(SpringSecurityUserContext.java:109)
    at com.incomm.imp.neo.core.incoming.handlers.FrameworkHandler.handshake(FrameworkHandler.java:29)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)

How to unit test a code that uses session in camel routes.

Regards,
Aravind