use of org.apache.cxf.message.MessageImpl in project cxf by apache.
the class DefaultLogEventMapperTest method testUriValue.
/**
* Test for address concatenation in CXF-8127
*/
@Test
public void testUriValue() {
DefaultLogEventMapper mapper = new DefaultLogEventMapper();
Message message = new MessageImpl();
message.put(Message.ENDPOINT_ADDRESS, "http://localhost:9001/");
message.put(Message.REQUEST_URI, "/api");
Exchange exchange = new ExchangeImpl();
message.setExchange(exchange);
LogEvent event = mapper.map(message, Collections.emptySet());
assertEquals("http://localhost:9001/api", event.getAddress());
}
use of org.apache.cxf.message.MessageImpl in project cxf by apache.
the class DefaultLogEventMapperTest method testRest.
@Test
public void testRest() {
DefaultLogEventMapper mapper = new DefaultLogEventMapper();
Message message = new MessageImpl();
message.put(Message.HTTP_REQUEST_METHOD, "GET");
message.put(Message.REQUEST_URI, "test");
Exchange exchange = new ExchangeImpl();
message.setExchange(exchange);
LogEvent event = mapper.map(message, Collections.emptySet());
assertEquals("GET[test]", event.getOperationName());
}
use of org.apache.cxf.message.MessageImpl in project cxf by apache.
the class DefaultLogEventMapperTest method shouldMaskHeaders.
@Test
public void shouldMaskHeaders() {
final DefaultLogEventMapper mapper = new DefaultLogEventMapper();
final Message message = new MessageImpl();
message.put(Message.ENDPOINT_ADDRESS, "http://localhost:9001/");
message.put(Message.REQUEST_URI, "/api");
Exchange exchange = new ExchangeImpl();
message.setExchange(exchange);
final Map<String, Object> headers = new HashMap<>();
headers.put(TEST_HEADER_NAME, Arrays.asList(TEST_HEADER_VALUE));
final Set<String> sensitiveHeaders = new HashSet<>();
sensitiveHeaders.add(TEST_HEADER_NAME);
message.put(Message.PROTOCOL_HEADERS, headers);
LogEvent event = mapper.map(message, sensitiveHeaders);
assertEquals(MASKED_HEADER_VALUE, event.getHeaders().get(TEST_HEADER_NAME));
}
use of org.apache.cxf.message.MessageImpl in project cxf by apache.
the class MaskSensitiveHelperTest method prepareInMessage.
private Message prepareInMessage() {
Message message = new MessageImpl();
ByteArrayInputStream inputStream = new ByteArrayInputStream(loggingContent.getBytes(StandardCharsets.UTF_8));
message.put(Message.CONTENT_TYPE, contentType);
message.setContent(InputStream.class, inputStream);
Exchange exchange = new ExchangeImpl();
message.setExchange(exchange);
return message;
}
use of org.apache.cxf.message.MessageImpl in project cxf by apache.
the class MaskSensitiveHelperTest method prepareOutMessage.
private Message prepareOutMessage() {
Message message = new MessageImpl();
message.put(Message.CONTENT_TYPE, contentType);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
message.setContent(OutputStream.class, outputStream);
Exchange exchange = new ExchangeImpl();
message.setExchange(exchange);
return message;
}
Aggregations