use of com.sun.xml.ws.api.pipe.ServerTubeAssemblerContext in project metro-jax-ws by eclipse-ee4j.
the class ClientProxyTest method testNullResponseFromTube.
@SuppressWarnings("unchecked")
public void testNullResponseFromTube() 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();
}
};
if (TubelineAssemblerFactory.class.equals(spiType))
return (S) new TubelineAssemblerFactory() {
public TubelineAssembler doCreate(BindingID bindingId) {
return new TubelineAssembler() {
public Tube createClient(ClientTubeAssemblerContext context) {
final Tube head = context.createTransportTube();
return new EchoTube() {
public NextAction processRequest(Packet request) {
NextAction na = new NextAction();
na.invoke(head, request);
return na;
}
public NextAction processResponse(Packet response) {
NextAction na = new NextAction();
na.returnWith(new Packet());
return na;
}
};
}
public Tube createServer(ServerTubeAssemblerContext context) {
return null;
}
};
}
};
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(wsdlURL.toString()));
fail();
} catch (Exception e) {
assertFalse(e instanceof NullPointerException);
assertTrue(e instanceof WebServiceException);
}
}
Aggregations