Search in sources :

Example 21 with Context

use of org.apache.cxf.aegis.Context in project cxf by apache.

the class SoapArrayTypeTest method testSimpleArray.

@Test
public void testSimpleArray() throws Exception {
    Context context = getContext();
    // xsd:int[2]
    ElementReader reader = new ElementReader(getClass().getResourceAsStream("arraySimple.xml"));
    int[] numbers = (int[]) createArrayType(int[].class).readObject(reader, context);
    reader.getXMLStreamReader().close();
    assertArrayEquals(new int[] { 3, 4 }, numbers);
    // round trip tests
    numbers = readWriteReadRef("arraySimple.xml", int[].class);
    assertArrayEquals(new int[] { 3, 4 }, numbers);
}
Also used : Context(org.apache.cxf.aegis.Context) ElementReader(org.apache.cxf.aegis.xml.stax.ElementReader) Test(org.junit.Test)

Aggregations

Context (org.apache.cxf.aegis.Context)21 Test (org.junit.Test)13 AegisContext (org.apache.cxf.aegis.AegisContext)11 ElementReader (org.apache.cxf.aegis.xml.stax.ElementReader)11 AegisType (org.apache.cxf.aegis.type.AegisType)10 Element (org.w3c.dom.Element)7 QName (javax.xml.namespace.QName)5 AbstractAegisTest (org.apache.cxf.aegis.AbstractAegisTest)5 MapNamespaceContext (org.apache.cxf.helpers.MapNamespaceContext)5 XmlMappedAttributeBean (org.apache.cxf.aegis.services.XmlMappedAttributeBean)4 TypeMapping (org.apache.cxf.aegis.type.TypeMapping)4 DatabindingException (org.apache.cxf.aegis.DatabindingException)3 MessageWriter (org.apache.cxf.aegis.xml.MessageWriter)3 ElementWriter (org.apache.cxf.aegis.xml.stax.ElementWriter)3 BigDecimal (java.math.BigDecimal)2 AttributeBean (org.apache.cxf.aegis.services.AttributeBean)2 TypeCreationOptions (org.apache.cxf.aegis.type.TypeCreationOptions)2 Message (org.apache.cxf.common.i18n.Message)2 Fault (org.apache.cxf.interceptor.Fault)2 XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)2