Search in sources :

Example 1 with SubTypeA

use of org.apache.cxf.tests.inherit.objects.SubTypeA in project cxf by apache.

the class ClientServerMiscTest method testInheritedTypesInOtherPackage.

@Test
public void testInheritedTypesInOtherPackage() throws Exception {
    InheritService serv = new InheritService();
    Inherit port = serv.getInheritPort();
    updateAddressPort(port, PORT);
    ObjectInfo obj = port.getObject(0);
    assertNotNull(obj);
    assertNotNull(obj.getBaseObject());
    assertEquals("A", obj.getBaseObject().getName());
    assertTrue(obj.getBaseObject() instanceof SubTypeA);
    obj = port.getObject(1);
    assertNotNull(obj);
    assertNotNull(obj.getBaseObject());
    assertEquals("B", obj.getBaseObject().getName());
    assertTrue(obj.getBaseObject() instanceof SubTypeB);
}
Also used : InheritService(org.apache.cxf.tests.inherit.InheritService) SubTypeB(org.apache.cxf.tests.inherit.objects.SubTypeB) SubTypeA(org.apache.cxf.tests.inherit.objects.SubTypeA) Inherit(org.apache.cxf.tests.inherit.Inherit) ObjectInfo(org.apache.cxf.tests.inherit.types.ObjectInfo) JaxbElementTest(org.apache.cxf.jaxb_element_test.JaxbElementTest) Test(org.junit.Test)

Example 2 with SubTypeA

use of org.apache.cxf.tests.inherit.objects.SubTypeA in project cxf by apache.

the class InheritImpl method getObject.

public ObjectInfo getObject(int type) {
    ObjectInfo info = new ObjectInfo();
    info.setType("Type: " + type);
    BaseType ba = null;
    switch(type) {
        case 0:
            ba = new SubTypeA();
            ba.setName("A");
            ((SubTypeA) ba).setAvalue("A");
            break;
        case 1:
            ba = new SubTypeB();
            ba.setName("B");
            ((SubTypeB) ba).setBvalue("B");
            break;
        default:
    }
    info.setBaseObject(ba);
    return info;
}
Also used : BaseType(org.apache.cxf.tests.inherit.objects.BaseType) SubTypeB(org.apache.cxf.tests.inherit.objects.SubTypeB) SubTypeA(org.apache.cxf.tests.inherit.objects.SubTypeA) ObjectInfo(org.apache.cxf.tests.inherit.types.ObjectInfo)

Aggregations

SubTypeA (org.apache.cxf.tests.inherit.objects.SubTypeA)2 SubTypeB (org.apache.cxf.tests.inherit.objects.SubTypeB)2 ObjectInfo (org.apache.cxf.tests.inherit.types.ObjectInfo)2 JaxbElementTest (org.apache.cxf.jaxb_element_test.JaxbElementTest)1 Inherit (org.apache.cxf.tests.inherit.Inherit)1 InheritService (org.apache.cxf.tests.inherit.InheritService)1 BaseType (org.apache.cxf.tests.inherit.objects.BaseType)1 Test (org.junit.Test)1