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

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

CxfRsEndpoint endpoint =
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(
    at org.eclipse.jetty.server.Request.getSession(
    at com.incomm.imp.neo.core.authentication.context.SpringSecurityUserContext.getSession(
    at com.incomm.imp.neo.core.incoming.handlers.FrameworkHandler.handshake(
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
    at java.lang.reflect.Method.invoke(

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