use of org.apache.cxf.ext.logging.LoggingFeature in project cxf by apache.
the class SoapUDPTest method startServers.
@BeforeClass
public static void startServers() throws Exception {
staticBus = BusFactory.getDefaultBus();
new LoggingFeature().initialize(staticBus);
BusFactory.setThreadDefaultBus(staticBus);
assertTrue("server did not launch correctly", launchServer(Server.class, true));
}
use of org.apache.cxf.ext.logging.LoggingFeature in project cxf by apache.
the class WSAFromJavaTest method testNoRelatesToHeader.
@Test
public void testNoRelatesToHeader() throws Exception {
new LoggingFeature().initialize(this.getBus());
AddNumberImpl port = getPort();
Client c = ClientProxy.getClient(port);
c.getInInterceptors().add(new RemoveRelatesToHeaderInterceptor());
long start = System.currentTimeMillis();
port.addNumbers(1, 2);
try {
port.addNumbers3(-1, -1);
} catch (Exception ex) {
// ignore, expected
}
long end = System.currentTimeMillis();
assertTrue((end - start) < 50000);
}
use of org.apache.cxf.ext.logging.LoggingFeature in project cxf by apache.
the class WSAFromJavaTest method testFaultFromNonAddressService.
@Test
public void testFaultFromNonAddressService() throws Exception {
new LoggingFeature().initialize(this.getBus());
AddNumberImpl port = getPort();
java.util.Map<String, Object> requestContext = ((BindingProvider) port).getRequestContext();
requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + PORT + "/AddNumberImplPort-noaddr");
long start = System.currentTimeMillis();
port.addNumbers(1, 2);
try {
port.addNumbers3(-1, -1);
} catch (Exception ex) {
// ignore, expected
}
long end = System.currentTimeMillis();
assertTrue((end - start) < 50000);
}
use of org.apache.cxf.ext.logging.LoggingFeature in project cxf by apache.
the class CodeFirstTest method testClient.
@Test
public void testClient() throws Exception {
Hello serviceImpl = new Hello();
try (EndpointImpl ep = new EndpointImpl(getBus(), serviceImpl, (String) null)) {
ep.publish("local://localhost:9090/hello");
QName serviceName = new QName("http://service.jaxws.cxf.apache.org/", "HelloService");
QName portName = new QName("http://service.jaxws.cxf.apache.org/", "HelloPort");
// need to set the same bus with service , so use the ServiceImpl
ServiceImpl service = new ServiceImpl(getBus(), (URL) null, serviceName, null);
service.addPort(portName, "http://schemas.xmlsoap.org/soap/", "local://localhost:9090/hello");
HelloInterface proxy = service.getPort(portName, HelloInterface.class, new LoggingFeature());
Client client = ClientProxy.getClient(proxy);
boolean found = false;
for (Interceptor<? extends Message> i : client.getOutInterceptors()) {
if (i instanceof LoggingOutInterceptor) {
found = true;
}
}
assertTrue(found);
assertEquals("Get the wrong result", "hello", proxy.sayHi("hello"));
String[] strInput = new String[2];
strInput[0] = "Hello";
strInput[1] = "Bonjour";
String[] strings = proxy.getStringArray(strInput);
assertEquals(strings.length, 2);
assertEquals(strings[0], "HelloHello");
assertEquals(strings[1], "BonjourBonjour");
List<String> listInput = new ArrayList<>();
listInput.add("Hello");
listInput.add("Bonjour");
List<String> list = proxy.getStringList(listInput);
assertEquals(list.size(), 2);
assertEquals(list.get(0), "HelloHello");
assertEquals(list.get(1), "BonjourBonjour");
// now the client side can't unmarshal the complex type without binding types annoutation
List<String> result = proxy.getGreetings();
assertEquals(2, result.size());
}
}
use of org.apache.cxf.ext.logging.LoggingFeature in project cxf by apache.
the class SOAPLoggingTest method testSlf4j.
@Test
public void testSlf4j() throws MalformedURLException {
TestService serviceImpl = new TestServiceImplementation();
LoggingFeature loggingFeature = new LoggingFeature();
loggingFeature.setPrettyLogging(true);
// Setting the limit should omit parts of the body but the result should still be well formed xml
loggingFeature.setLimit(140);
Endpoint ep = Endpoint.publish(SERVICE_URI, serviceImpl, loggingFeature);
TestService client = createTestClient(loggingFeature);
client.echo("test");
ep.stop();
}
Aggregations