@Override public boolean handleRequest(MessageContext messageContext) throws WebServiceClientException { TransportContext tc = TransportContextHolder.getTransportContext(); if (tc != null) { try { this.lastUri = tc.getConnection().getUri(); } catch (URISyntaxException e) { throw new IllegalStateException(e); } } else { throw new IllegalStateException("expected WebServiceConnection in the TransportContext"); } return true; }
public static WebServiceMessageSender createMockMessageSender(final String mockResponseMessage) throws Exception { WebServiceMessageSender messageSender = Mockito.mock(WebServiceMessageSender.class); WebServiceConnection wsConnection = Mockito.mock(WebServiceConnection.class); Mockito.when(messageSender.createConnection(Mockito.any(URI.class))).thenReturn(wsConnection); Mockito.when(messageSender.supports(Mockito.any(URI.class))).thenReturn(true); Mockito.doAnswer(invocation -> { Object[] args = invocation.getArguments(); WebServiceMessageFactory factory = (WebServiceMessageFactory) args[0]; return factory.createWebServiceMessage(new ByteArrayInputStream(mockResponseMessage.getBytes())); }).when(wsConnection).receive(Mockito.any(WebServiceMessageFactory.class)); return messageSender; }
@Override protected final TransportInputStream createTransportInputStream() throws IOException { if (hasResponse()) { if (responseInputStream == null) { responseInputStream = new ResponseTransportInputStream(); } return responseInputStream; } else { return null; } }
Mockito.when(messageSender.createConnection(Mockito.any(URI.class))).thenReturn(wsConnection); Mockito.when(messageSender.supports(Mockito.any(URI.class))).thenReturn(true); .send(Mockito.any(WebServiceMessage.class)); }).when(wsConnection).receive(Mockito.any(WebServiceMessageFactory.class));
Mockito.verify(this.jmsMessageSender).createConnection(uri);
@Override protected OutputStream createOutputStream() throws IOException { return getRequestOutputStream(); } }
@Override protected final TransportInputStream createTransportInputStream() throws IOException { if (requestInputStream == null) { requestInputStream = new RequestTransportInputStream(); } return requestInputStream; }
@Override protected final TransportOutputStream createTransportOutputStream() throws IOException { if (requestOutputStream == null) { requestOutputStream = new RequestTransportOutputStream(); } return requestOutputStream; }
@Override protected final TransportOutputStream createTransportOutputStream() throws IOException { if (responseOutputStream == null) { responseOutputStream = new ResponseTransportOutputStream(); } return responseOutputStream; }
@Override protected final TransportInputStream createTransportInputStream() throws IOException { if (hasResponse()) { if (responseInputStream == null) { responseInputStream = new ResponseTransportInputStream(); } return responseInputStream; } else { return null; } }
@Override protected OutputStream createOutputStream() throws IOException { return getRequestOutputStream(); } }
@Override protected final TransportInputStream createTransportInputStream() throws IOException { if (requestInputStream == null) { requestInputStream = new RequestTransportInputStream(); } return requestInputStream; }
@Override protected final TransportOutputStream createTransportOutputStream() throws IOException { if (requestOutputStream == null) { requestOutputStream = new RequestTransportOutputStream(); } return requestOutputStream; }
@Override protected final TransportOutputStream createTransportOutputStream() throws IOException { if (responseOutputStream == null) { responseOutputStream = new ResponseTransportOutputStream(); } return responseOutputStream; }
@Override protected final TransportInputStream createTransportInputStream() throws IOException { if (hasResponse()) { if (responseInputStream == null) { responseInputStream = new ResponseTransportInputStream(); } return responseInputStream; } else { return null; } }
@Override protected OutputStream createOutputStream() throws IOException { return getRequestOutputStream(); } }
@Override protected final TransportInputStream createTransportInputStream() throws IOException { if (requestInputStream == null) { requestInputStream = new RequestTransportInputStream(); } return requestInputStream; }
@Override protected final TransportOutputStream createTransportOutputStream() throws IOException { if (requestOutputStream == null) { requestOutputStream = new RequestTransportOutputStream(); } return requestOutputStream; }
@Override protected final TransportInputStream createTransportInputStream() throws IOException { if (hasResponse()) { if (responseInputStream == null) { responseInputStream = new ResponseTransportInputStream(); } return responseInputStream; } else { return null; } }