Search in sources :

Example 1 with StringListTest

use of org.apache.stringarray.StringListTest in project cxf by apache.

the class StringArrayTest method testStringArrayList.

@Test
public void testStringArrayList() throws Exception {
    SpringBusFactory factory = new SpringBusFactory();
    Bus bus = factory.createBus();
    BusFactory.setDefaultBus(bus);
    setBus(bus);
    StringWriter swin = new java.io.StringWriter();
    java.io.PrintWriter pwin = new java.io.PrintWriter(swin);
    LoggingInInterceptor logIn = new LoggingInInterceptor(new PrintWriterEventSender(pwin));
    StringWriter swout = new java.io.StringWriter();
    java.io.PrintWriter pwout = new java.io.PrintWriter(swout);
    LoggingOutInterceptor logOut = new LoggingOutInterceptor(new PrintWriterEventSender(pwout));
    getBus().getInInterceptors().add(logIn);
    getBus().getOutInterceptors().add(logOut);
    SOAPServiceRPCLit service = new SOAPServiceRPCLit();
    StringListTest port = service.getSoapPortRPCLit();
    updateAddressPort(port, PORT);
    String[] strs = new String[] { "org", "apache", "cxf" };
    String[] res = port.stringListTest(strs);
    assertArrayEquals(strs, res);
    assertTrue("Request message is not marshalled correctly and @XmlList does not take effect:\n" + swout.toString(), swout.toString().indexOf("<in>org apache cxf</in>") > -1);
    assertTrue("Response message is not marshalled correctly and @XmlList does not take effect\n" + swin.toString(), swin.toString().indexOf("<out>org apache cxf</out>") > -1);
}
Also used : Bus(org.apache.cxf.Bus) PrintWriterEventSender(org.apache.cxf.ext.logging.event.PrintWriterEventSender) SOAPServiceRPCLit(org.apache.stringarray.SOAPServiceRPCLit) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) StringWriter(java.io.StringWriter) LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) StringListTest(org.apache.stringarray.StringListTest) LoggingInInterceptor(org.apache.cxf.ext.logging.LoggingInInterceptor) Test(org.junit.Test) StringListTest(org.apache.stringarray.StringListTest)

Aggregations

StringWriter (java.io.StringWriter)1 Bus (org.apache.cxf.Bus)1 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)1 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)1 LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)1 PrintWriterEventSender (org.apache.cxf.ext.logging.event.PrintWriterEventSender)1 SOAPServiceRPCLit (org.apache.stringarray.SOAPServiceRPCLit)1 StringListTest (org.apache.stringarray.StringListTest)1 Test (org.junit.Test)1