use of org.apache.cxf.ext.logging.LoggingFeature in project cxf by apache.
the class SimpleEventingIntegrationTest method setUpBeforeClass.
/**
* Prepares the Event Source and Subscription Manager services
*/
@BeforeClass
public static void setUpBeforeClass() throws Exception {
bus = BusFactory.getDefaultBus();
// create and publish event source
JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
factory.setBus(bus);
factory.setServiceBean(new TestingEventSource());
factory.setAddress(URL_EVENT_SOURCE);
factory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
eventSource = factory.create();
// create and publish subscription manager
factory = new JaxWsServerFactoryBean();
factory.setBus(bus);
factory.setServiceBean(new TestingSubscriptionManager());
factory.setAddress(URL_SUBSCRIPTION_MANAGER);
factory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
subscriptionManager = factory.create();
new LoggingFeature().initialize(subscriptionManager, bus);
}
use of org.apache.cxf.ext.logging.LoggingFeature in project cxf by apache.
the class JAXRSClientServerBookTest method testEchoForm.
@Test
public void testEchoForm() throws Exception {
String address = "http://localhost:" + PORT + "/bookstore/form";
WebClient wc = WebClient.create(address, Collections.singletonList(new LoggingFeature()));
Form formOut = new Form().param("a", "aValue").param("b", "b value").param("c%", "cValue");
Form formIn = wc.post(formOut, Form.class);
assertEquals(3, formIn.asMap().size());
assertEquals("aValue", formIn.asMap().getFirst("a"));
assertEquals("b value", formIn.asMap().getFirst("b"));
assertEquals("cValue", formIn.asMap().getFirst("c%"));
}
use of org.apache.cxf.ext.logging.LoggingFeature in project cxf by apache.
the class SampleRestApplication method rsServer.
@Bean
public Server rsServer() {
JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean();
endpoint.setBus(bus);
endpoint.setServiceBeans(Arrays.<Object>asList(new HelloServiceImpl1(), new HelloServiceImpl2()));
endpoint.setAddress("/");
endpoint.setFeatures(Arrays.asList(createOpenApiFeature(), new LoggingFeature()));
return endpoint.create();
}
use of org.apache.cxf.ext.logging.LoggingFeature in project cxf by apache.
the class RESTLoggingTest method testSlf4j.
@Test
public void testSlf4j() throws IOException {
LoggingFeature loggingFeature = new LoggingFeature();
Server server = createService(SERVICE_URI, new TestServiceRest(), loggingFeature);
server.start();
WebClient client = createClient(SERVICE_URI, loggingFeature);
String result = client.get(String.class);
server.destroy();
Assert.assertEquals("test1", result);
}
use of org.apache.cxf.ext.logging.LoggingFeature in project cxf by apache.
the class RESTLoggingTest method testBinary.
@Test
public void testBinary() throws IOException, InterruptedException {
LoggingFeature loggingFeature = new LoggingFeature();
TestEventSender sender = new TestEventSender();
loggingFeature.setSender(sender);
Server server = createService(SERVICE_URI_BINARY, new TestServiceRestBinary(), loggingFeature);
server.start();
WebClient client = createClient(SERVICE_URI_BINARY, loggingFeature);
client.get(InputStream.class).close();
loggingFeature.setLogBinary(true);
client.get(InputStream.class).close();
client.close();
List<LogEvent> events = sender.getEvents();
await().until(() -> events.size(), is(8));
server.stop();
server.destroy();
// First call with binary logging false
assertContentLogged(events.get(0));
assertContentLogged(events.get(1));
assertContentNotLogged(events.get(2));
assertContentNotLogged(events.get(3));
// Second call with binary logging true
assertContentLogged(events.get(4));
assertContentLogged(events.get(5));
assertContentLogged(events.get(6));
assertContentLogged(events.get(7));
}
Aggregations