use of com.sun.xml.ws.api.ComponentFeature in project metro-jax-ws by eclipse-ee4j.
the class ClientProxyTest method testNullResponseFromTransprt.
@SuppressWarnings("unchecked")
public void testNullResponseFromTransprt() throws Exception {
URL wsdlURL = Thread.currentThread().getContextClassLoader().getResource("etc/EchoService.wsdl");
EchoService srv = new EchoService(wsdlURL, new ComponentFeature(new com.sun.xml.ws.api.Component() {
public <S> S getSPI(Class<S> spiType) {
if (TransportTubeFactory.class.equals(spiType))
return (S) new TransportTubeFactory() {
public Tube doCreate(ClientTubeAssemblerContext context) {
return new EchoTube() {
public NextAction processRequest(Packet request) {
NextAction na = new NextAction();
na.returnWith(new Packet());
return na;
}
};
}
};
return null;
}
}));
Echo echo = srv.getEchoPort();
try {
int res = echo.add(new NumbersRequest());
fail();
} catch (Exception e) {
assertFalse(e instanceof NullPointerException);
assertTrue(e instanceof WebServiceException);
}
try {
echo.echoString(new Holder<String>(wsdlURL.toString()));
fail();
} catch (Exception e) {
assertFalse(e instanceof NullPointerException);
assertTrue(e instanceof WebServiceException);
}
}
Aggregations