You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by aravind r <ar...@gmail.com> on 2016/10/09 03:40:15 UTC

Error when using session during camel Junit testing

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