Search in sources :

Example 1 with AegisDatabinding

use of org.apache.cxf.aegis.databinding.AegisDatabinding in project cxf by apache.

the class DocLitBareTest method testNamespaceCrash.

@Test
public void testNamespaceCrash() {
    ServerFactoryBean svrFactory = new ServerFactoryBean();
    svrFactory.setServiceClass(University.class);
    svrFactory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
    svrFactory.setAddress("local://dlbTest");
    svrFactory.setServiceBean(new UniversityImpl());
    svrFactory.getServiceFactory().setDataBinding(new AegisDatabinding());
    svrFactory.create();
    ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
    factory.getServiceFactory().setDataBinding(new AegisDatabinding());
    factory.setServiceClass(University.class);
    factory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
    factory.setAddress("local://dlbTest");
    University client = (University) factory.create();
    Teacher tr = client.getTeacher(new Course(40, "Intro to CS", "Introductory Comp Sci"));
    assertNotNull(tr);
    assertEquals(52, tr.getAge());
    assertEquals("Mr. Tom", tr.getName());
}
Also used : ClientProxyFactoryBean(org.apache.cxf.frontend.ClientProxyFactoryBean) ServerFactoryBean(org.apache.cxf.frontend.ServerFactoryBean) AegisDatabinding(org.apache.cxf.aegis.databinding.AegisDatabinding) AbstractCXFTest(org.apache.cxf.test.AbstractCXFTest) Test(org.junit.Test)

Example 2 with AegisDatabinding

use of org.apache.cxf.aegis.databinding.AegisDatabinding in project cxf by apache.

the class ProxyTest method testProxy.

@Test
public void testProxy() throws Exception {
    ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
    proxyFac.setAddress("local://HelloProxyService");
    proxyFac.setBus(getBus());
    AegisContext aegisContext = new AegisContext();
    aegisContext.getBeanImplementationMap().put(Hello.class, MyHello.class.getName());
    AegisDatabinding binding = new AegisDatabinding();
    binding.setAegisContext(aegisContext);
    setupAegis(proxyFac.getClientFactoryBean(), binding);
    HelloProxyService client = proxyFac.create(HelloProxyService.class);
    Hello h = client.sayHiWithProxy();
    assertTrue(h instanceof MyHello);
}
Also used : ClientProxyFactoryBean(org.apache.cxf.frontend.ClientProxyFactoryBean) AegisContext(org.apache.cxf.aegis.AegisContext) AegisDatabinding(org.apache.cxf.aegis.databinding.AegisDatabinding) Test(org.junit.Test) AbstractAegisTest(org.apache.cxf.aegis.AbstractAegisTest)

Example 3 with AegisDatabinding

use of org.apache.cxf.aegis.databinding.AegisDatabinding in project cxf by apache.

the class DuplicateArrayTest method testServiceStart.

@Test
public void testServiceStart() throws Exception {
    AegisDatabinding binder = new AegisDatabinding();
    JaxWsServerFactoryBean serviceFactory = new JaxWsServerFactoryBean();
    serviceFactory.getServiceFactory().setDataBinding(binder);
    TypeCreationOptions configuration = binder.getAegisContext().getTypeCreationOptions();
    configuration.setDefaultMinOccurs(1);
    configuration.setDefaultNillable(false);
    binder.getAegisContext().setWriteXsiTypes(true);
    serviceFactory.setAddress("local://DuplicateArrayService");
    serviceFactory.setServiceBean(new DuplicateArrayServiceBean());
    serviceFactory.setServiceClass(DuplicateArrayService.class);
    Document doc = this.getWSDLDocument(serviceFactory.create());
    this.assertValid("//wsdl:definitions/wsdl:types" + "/xsd:schema[@targetNamespace='http://cxf.apache.org/arrays']" + "/xsd:complexType[@name='ArrayOfAnyType']", doc.getDocumentElement());
}
Also used : AegisDatabinding(org.apache.cxf.aegis.databinding.AegisDatabinding) Document(org.w3c.dom.Document) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) TypeCreationOptions(org.apache.cxf.aegis.type.TypeCreationOptions) Test(org.junit.Test) AbstractAegisTest(org.apache.cxf.aegis.AbstractAegisTest)

Example 4 with AegisDatabinding

use of org.apache.cxf.aegis.databinding.AegisDatabinding in project cxf by apache.

the class FlatArrayTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    service = new FlatArrayService();
    ServerFactoryBean sf = new ServerFactoryBean();
    // use full parameter names.
    sf.setServiceClass(FlatArrayServiceInterface.class);
    sf.setServiceBean(service);
    sf.setAddress("local://FlatArray");
    sf.setDataBinding(new AegisDatabinding());
    sf.create();
    arrayWsdlDoc = getWSDLDocument("FlatArrayServiceInterface");
}
Also used : ServerFactoryBean(org.apache.cxf.frontend.ServerFactoryBean) AegisDatabinding(org.apache.cxf.aegis.databinding.AegisDatabinding) Before(org.junit.Before)

Example 5 with AegisDatabinding

use of org.apache.cxf.aegis.databinding.AegisDatabinding in project cxf by apache.

the class FlatArrayTest method testFlatCollection.

@Test
public void testFlatCollection() throws Exception {
    ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
    proxyFac.setDataBinding(new AegisDatabinding());
    proxyFac.setAddress("local://FlatArray");
    proxyFac.setBus(getBus());
    FlatArrayServiceInterface client = proxyFac.create(FlatArrayServiceInterface.class);
    BeanWithFlatCollection bwfc = new BeanWithFlatCollection();
    bwfc.getValues().add(1);
    bwfc.getValues().add(2);
    bwfc.getValues().add(3);
    bwfc = client.echoBeanWithFlatCollection(bwfc);
    assertEquals(3, bwfc.getValues().size());
    assertEquals(Integer.valueOf(1), bwfc.getValues().get(0));
    assertEquals(Integer.valueOf(2), bwfc.getValues().get(1));
    assertEquals(Integer.valueOf(3), bwfc.getValues().get(2));
}
Also used : ClientProxyFactoryBean(org.apache.cxf.frontend.ClientProxyFactoryBean) AegisDatabinding(org.apache.cxf.aegis.databinding.AegisDatabinding) Test(org.junit.Test) AbstractAegisTest(org.apache.cxf.aegis.AbstractAegisTest)

Aggregations

AegisDatabinding (org.apache.cxf.aegis.databinding.AegisDatabinding)37 Test (org.junit.Test)21 JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)14 ClientProxyFactoryBean (org.apache.cxf.frontend.ClientProxyFactoryBean)12 AbstractAegisTest (org.apache.cxf.aegis.AbstractAegisTest)10 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)7 LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)7 Before (org.junit.Before)7 ServerFactoryBean (org.apache.cxf.frontend.ServerFactoryBean)6 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)5 AegisContext (org.apache.cxf.aegis.AegisContext)4 Server (org.apache.cxf.endpoint.Server)4 BeanInvoker (org.apache.cxf.service.invoker.BeanInvoker)4 HashSet (java.util.HashSet)3 ReflectionServiceFactoryBean (org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean)3 QName (javax.xml.namespace.QName)2 XFireCompatibilityServiceConfiguration (org.apache.cxf.aegis.databinding.XFireCompatibilityServiceConfiguration)2 AuthService (org.apache.cxf.authservice.AuthService)2 Authenticate (org.apache.cxf.authservice.Authenticate)2 Service (org.apache.cxf.service.Service)2