use of org.apache.cxf.ext.logging.event.DefaultLogEventMapper in project cxf by apache.
the class DefaultLogEventMapperTest method testNullValues.
/**
* Test for NPE described in CXF-6436
*/
@Test
public void testNullValues() {
DefaultLogEventMapper mapper = new DefaultLogEventMapper();
Message message = new MessageImpl();
message.put(Message.HTTP_REQUEST_METHOD, null);
message.put(Message.REQUEST_URI, null);
Exchange exchange = new ExchangeImpl();
message.setExchange(exchange);
LogEvent event = mapper.map(message, Collections.emptySet());
assertEquals("", event.getOperationName());
}
use of org.apache.cxf.ext.logging.event.DefaultLogEventMapper in project cxf by apache.
the class DefaultLogEventMapperTest method testPreflightRequestEventType.
@Test
public void testPreflightRequestEventType() {
DefaultLogEventMapper mapper = new DefaultLogEventMapper();
Message message = new MessageImpl();
message.put(Message.HTTP_REQUEST_METHOD, "OPTIONS");
message.put(Message.REQUEST_URI, "test");
message.put(Message.RESPONSE_CODE, 200);
Exchange exchange = new ExchangeImpl();
// operation name not included
exchange.put("org.apache.cxf.rs.security.cors.CrossOriginResourceSharingFilter", "preflight_passed");
message.setExchange(exchange);
exchange.setOutMessage(message);
LogEvent event = mapper.map(message, Collections.emptySet());
assertEquals(EventType.RESP_OUT, event.getType());
}
use of org.apache.cxf.ext.logging.event.DefaultLogEventMapper in project cxf by apache.
the class DefaultLogEventMapperTest method testMap.
@Test
public void testMap() {
DefaultLogEventMapper mapper = new DefaultLogEventMapper();
Message message = new MessageImpl();
message.put(Message.HTTP_REQUEST_METHOD, "PUT");
message.put(Message.REQUEST_URI, "test");
Exchange exchange = new ExchangeImpl();
message.setExchange(exchange);
LogEvent event = mapper.map(message);
assertEquals("PUT[test]", event.getOperationName());
}
Aggregations