use of org.apache.cxf.ext.logging.event.DefaultLogEventMapper in project cxf by apache.
the class SOAPLoggingTest method testSoap.
@Test
public void testSoap() {
DefaultLogEventMapper mapper = new DefaultLogEventMapper();
Message message = new MessageImpl();
ExchangeImpl exchange = new ExchangeImpl();
ServiceInfo service = new ServiceInfo();
BindingInfo info = new BindingInfo(service, "bindingId");
SoapBinding value = new SoapBinding(info);
exchange.put(Binding.class, value);
OperationInfo opInfo = new OperationInfo();
opInfo.setName(new QName("http://my", "Operation"));
BindingOperationInfo boi = new BindingOperationInfo(info, opInfo);
exchange.put(BindingOperationInfo.class, boi);
message.setExchange(exchange);
LogEvent event = mapper.map(message, Collections.emptySet());
Assert.assertEquals("{http://my}Operation", event.getOperationName());
}
use of org.apache.cxf.ext.logging.event.DefaultLogEventMapper 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.ext.logging.event.DefaultLogEventMapper 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.ext.logging.event.DefaultLogEventMapper 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.ext.logging.event.DefaultLogEventMapper in project cxf by apache.
the class DefaultLogEventMapperTest method testMapNullSensitiveProtocolHeaders.
@Test
public void testMapNullSensitiveProtocolHeaders() {
DefaultLogEventMapper mapper = new DefaultLogEventMapper();
Message message = new MessageImpl();
message.put(Message.HTTP_REQUEST_METHOD, "POST");
message.put(Message.REQUEST_URI, "nullTest");
Exchange exchange = new ExchangeImpl();
message.setExchange(exchange);
LogEvent event = mapper.map(message, null);
assertEquals("POST[nullTest]", event.getOperationName());
}
Aggregations