@VisibleForTesting ResponseInfo buildResponseInfo(HttpRequest request, int statusCode, String statusMessage) { ResponseInfo.Builder responseBuilder = new ResponseInfo.Builder(); // Include all response headers + the redacted token for the response body. StringBuilder payloadBuilder = new StringBuilder(); payloadBuilder.append(String.format("%d %s%n", statusCode, statusMessage)); appendMapAsString(payloadBuilder, request.getResponseHeaders()); payloadBuilder.append(String.format("%nContent:%n%s", REDACTED_REPORT_DATA)); return responseBuilder.withPayload(payloadBuilder.toString()).build(); }
@VisibleForTesting ResponseInfo buildResponseInfo(HttpRequest request, int statusCode, String statusMessage) { ResponseInfo.Builder responseBuilder = new ResponseInfo.Builder(); // Include all response headers + the redacted token for the response body. StringBuilder payloadBuilder = new StringBuilder(); payloadBuilder.append(String.format("%d %s%n", statusCode, statusMessage)); appendMapAsString(payloadBuilder, request.getResponseHeaders()); payloadBuilder.append(String.format("%nContent:%n%s", REDACTED_REPORT_DATA)); return responseBuilder.withPayload(payloadBuilder.toString()).build(); }
@Inject public JaxWsSoapContextHandler( RequestInfoXPathSet requestInfoXPathSet, ResponseInfoXPathSet responseInfoXPathSet) { this.requestInfoXPathSet = requestInfoXPathSet; this.responseInfoXPathSet = responseInfoXPathSet; this.lastRequestInfo = new RequestInfo.Builder(); this.lastResponseInfo = new ResponseInfo.Builder(); }
ResponseInfo.Builder responseInfoBuilder = new ResponseInfo.Builder(); if (batchJobUploadResponse != null) { responseInfoBuilder.withPayload(
ResponseInfo.Builder responseInfoBuilder = new ResponseInfo.Builder(); if (batchJobUploadResponse != null) { responseInfoBuilder.withPayload(
new ResponseInfo.Builder() .withPayload(String.format("Results count: %d", resultsCount)) .build();
new ResponseInfo.Builder() .withPayload(String.format("Results count: %d", resultsCount)) .build();
builder.withRequestInfo(requestInfoBuilder .build()); ResponseInfo.Builder responseInfoBuilder = new ResponseInfo.Builder(); responseInfoXPathSet.parseMessage(responseInfoBuilder, messageContext.getResponseMessage()); builder.withResponseInfo(responseInfoBuilder.build());
builder.withRequestInfo(requestInfoBuilder .build()); ResponseInfo.Builder responseInfoBuilder = new ResponseInfo.Builder(); responseInfoXPathSet.parseMessage(responseInfoBuilder, messageContext.getResponseMessage()); builder.withResponseInfo(responseInfoBuilder.build());
lastResponseInfo = new ResponseInfo.Builder(); SOAPMessage soapMessage = context.getMessage(); try {
lastResponseInfo = new ResponseInfo.Builder(); SOAPMessage soapMessage = context.getMessage(); try {
@Test public void testParseActualMessage() throws SOAPException, IOException { Builder builder = new Builder(); SOAPMessage message = Mockito.mock(SOAPMessage.class); SOAPHeader header = Mockito.mock(SOAPHeader.class); when(message.getSOAPHeader()).thenReturn(header); final String payload = "<foo><bar>MyBar</bar></foo>"; doAnswer( invocation -> { OutputStream outputStream = (OutputStream) invocation.getArguments()[0]; outputStream.write(payload.getBytes(StandardCharsets.UTF_8)); return null; }) .when(message) .writeTo(org.mockito.Matchers.any(OutputStream.class)); assertSame( "parseMessage should return the same builder passed in", builder, xPathSet.parseMessage(builder, message)); ResponseInfo responseInfo = builder.build(); assertEquals("Payload doesn't match", payload, responseInfo.getPayload()); }
@Inject public JaxWsSoapContextHandler( RequestInfoXPathSet requestInfoXPathSet, ResponseInfoXPathSet responseInfoXPathSet) { this.requestInfoXPathSet = requestInfoXPathSet; this.responseInfoXPathSet = responseInfoXPathSet; this.lastRequestInfo = new RequestInfo.Builder(); this.lastResponseInfo = new ResponseInfo.Builder(); }