I am trying to figure out how to write a JUnittest case that can test my service endpoint outside of the servlet container. My axis service endpoint extends springs ServletEndpointSupport but I cannot seem to find any mock objects that will help me initialize this object correctly.
To initialize the servlet, I need to call the init method from the ServiceLifecycle Interface:
Trouble is, the context here is of the type javax.xml.rpc.server.ServletEndpointContext. As I mentioned earlier, I have been unable to find any Mock objects for this class. Can someone point me to an example?
I'm not familiar with ServletEndpointSupport, but most WS are at the core based on a Java POJO that has no dependencies on external objects (only the libraries it needs to complete its service). Wouldn't it make more sense to unit-test that?
posted 10 years ago
Normally it would. This class however makes use of the Spring Context to get some of its dependencies. If this was a normal Spring servlet, I could create a spring context and insert it into a mock servlet context and initialize the servlet with that. Unfortunately, because this class implements ServiceLifecycle, the init method is now looking for ServletEndpointContext instead.
Any other ideas?
machines help you to do more, but experience less. Experience this tiny ad: