Search in sources :

Example 1 with Employee

use of org.apache.cxf.aegis.inheritance.Employee in project cxf by apache.

the class OverrideTypeTest method testOverrideBean.

@Test
public void testOverrideBean() throws Exception {
    AegisDatabinding aegisDatabinding = new AegisDatabinding();
    Set<String> types = new HashSet<>();
    types.add("org.apache.cxf.aegis.inheritance.Employee");
    aegisDatabinding.setOverrideTypes(types);
    DataReader<XMLStreamReader> dataReader = aegisDatabinding.createReader(XMLStreamReader.class);
    InputStream employeeBytes = testUtilities.getResourceAsStream("/org/apache/cxf/aegis/override/employee.xml");
    XMLInputFactory readerFactory = XMLInputFactory.newInstance();
    XMLStreamReader reader = readerFactory.createXMLStreamReader(employeeBytes);
    Object objectRead = dataReader.read(reader);
    assertNotNull(objectRead);
    assertTrue(objectRead instanceof Employee);
    Employee e = (Employee) objectRead;
    assertEquals("long", e.getDivision());
}
Also used : XMLStreamReader(javax.xml.stream.XMLStreamReader) Employee(org.apache.cxf.aegis.inheritance.Employee) InputStream(java.io.InputStream) AegisDatabinding(org.apache.cxf.aegis.databinding.AegisDatabinding) XMLInputFactory(javax.xml.stream.XMLInputFactory) HashSet(java.util.HashSet) Test(org.junit.Test) AbstractAegisTest(org.apache.cxf.aegis.AbstractAegisTest)

Aggregations

InputStream (java.io.InputStream)1 HashSet (java.util.HashSet)1 XMLInputFactory (javax.xml.stream.XMLInputFactory)1 XMLStreamReader (javax.xml.stream.XMLStreamReader)1 AbstractAegisTest (org.apache.cxf.aegis.AbstractAegisTest)1 AegisDatabinding (org.apache.cxf.aegis.databinding.AegisDatabinding)1 Employee (org.apache.cxf.aegis.inheritance.Employee)1 Test (org.junit.Test)1