Search in sources :

Example 1 with ClientProxy

use of org.apache.cxf.frontend.ClientProxy in project cxf by apache.

the class ServiceImplTest method testJAXBCachedOnRepeatGetPort.

@Test
public void testJAXBCachedOnRepeatGetPort() {
    System.gc();
    System.gc();
    URL wsdl1 = getClass().getResource("/wsdl/calculator.wsdl");
    assertNotNull(wsdl1);
    ServiceImpl service = new ServiceImpl(getBus(), wsdl1, SERVICE_1, ServiceImpl.class);
    CalculatorPortType cal1 = service.getPort(PORT_1, CalculatorPortType.class);
    assertNotNull(cal1);
    ClientProxy cp = (ClientProxy) Proxy.getInvocationHandler(cal1);
    JAXBDataBinding db1 = (JAXBDataBinding) cp.getClient().getEndpoint().getService().getDataBinding();
    assertNotNull(db1);
    System.gc();
    System.gc();
    System.gc();
    System.gc();
    CalculatorPortType cal2 = service.getPort(PORT_1, CalculatorPortType.class);
    assertNotNull(cal2);
    cp = (ClientProxy) Proxy.getInvocationHandler(cal2);
    JAXBDataBinding db2 = (JAXBDataBinding) cp.getClient().getEndpoint().getService().getDataBinding();
    assertNotNull(db2);
    assertEquals("got cached JAXBContext", db1.getContext(), db2.getContext());
}
Also used : CalculatorPortType(org.apache.cxf.calculator.CalculatorPortType) ClientProxy(org.apache.cxf.frontend.ClientProxy) JAXBDataBinding(org.apache.cxf.jaxb.JAXBDataBinding) URL(java.net.URL) Test(org.junit.Test)

Aggregations

URL (java.net.URL)1 CalculatorPortType (org.apache.cxf.calculator.CalculatorPortType)1 ClientProxy (org.apache.cxf.frontend.ClientProxy)1 JAXBDataBinding (org.apache.cxf.jaxb.JAXBDataBinding)1 Test (org.junit.Test)1