Package org.apache.cxf.aegis

Examples of org.apache.cxf.aegis.Context


        MapNamespaceContext namespaces = new MapNamespaceContext();
        for (Map.Entry<String, String> entry : getNamespaces().entrySet()) {
            namespaces.addNamespace(entry.getKey(), entry.getValue());
        }
        ElementWriter rootWriter = getElementWriter(element, namespaces);
        Context context = getContext();

        // get AegisType based on the object instance
        assertNotNull("type is null", type);

        // write the ref
View Full Code Here


    public void verifyInvalid(String resourceName, Class<?> expectedType) throws XMLStreamException {
        AegisType type = mapping.getType(expectedType);
        assertNotNull("type is null", type);

        Context context = getContext();

        ElementReader reader = new ElementReader(getClass().getResourceAsStream(resourceName));
        try {
            type.readObject(reader, context);
            fail("expected DatabindingException");
View Full Code Here

        mapping.register(arrayOfAny);
    }

    @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();
View Full Code Here

        assertArrayEquals(new int[]{3, 4}, numbers);
    }

    @Test
    public void testUrTypeArray() throws Exception {
        Context context = getContext();

        // ur-type[4] nested elements have xsi:type
        ElementReader reader = new ElementReader(getClass().getResourceAsStream("arrayUrType1.xml"));
        Object[] objects = (Object[]) createArrayType(Object[].class).readObject(reader, context);
        reader.getXMLStreamReader().close();
View Full Code Here

       
    }

    @Test
    public void testAnyTypeArray() throws Exception {
        Context context = getContext();

        // ur-type[4] nested elements have xsi:type
        ElementReader reader = new ElementReader(getClass().getResourceAsStream("arrayAnyType1.xml"));
        Object[] objects = (Object[]) createArrayType(Object[].class).readObject(reader, context);
        reader.getXMLStreamReader().close();
View Full Code Here

        assertArrayEquals(new Object[]{42, new BigDecimal("42.42"), "Forty Two"}, objects);
    }

    @Test
    public void testStructArray() throws Exception {
        Context context = getContext();

        // b:address[2]
        ElementReader reader = new ElementReader(getClass().getResourceAsStream("arrayStructs.xml"));
        Address[] addresses = (Address[]) createArrayType(Address[].class).readObject(reader, context);
        reader.getXMLStreamReader().close();
View Full Code Here

        StructTypeTest.validateBillingAddress(addresses[1]);
    }

    @Test
    public void testSquareArray() throws Exception {
        Context context = getContext();

        // xsd:string[2,3,4]
        ElementReader reader = new ElementReader(getClass().getResourceAsStream("arraySquare.xml"));
        String[][][] strings = (String[][][]) createArrayType(String[][][].class).readObject(reader, context);
        reader.getXMLStreamReader().close();
View Full Code Here

        assertArrayEquals(ARRAY_2_3_4, strings);
    }

    @Test
    public void testArrayOfArrays() throws Exception {
        Context context = getContext();

        // xsd:string[,][2]
        ElementReader reader = new ElementReader(getClass().getResourceAsStream("arrayArrayOfArrays1.xml"));
        String[][][] strings = (String[][][]) createArrayType(String[][][].class).readObject(reader, context);
        reader.getXMLStreamReader().close();
View Full Code Here

        assertArrayEquals(ARRAY_2_3_4, strings);
    }

    @Test
    public void testPartiallyTransmitted() throws Exception {
        Context context = getContext();

        // xsd:int[5] offset="[2]"
        ElementReader reader = new ElementReader(
                getClass().getResourceAsStream("arrayPartiallyTransmitted.xml"));
        int[] numbers = (int[]) createArrayType(int[].class).readObject(reader, context);
View Full Code Here

        assertArrayEquals(new int[]{0, 0, 3, 4, 0}, numbers);
    }

    @Test
    public void testSparseArray() throws Exception {
        Context context = getContext();

        // xsd:string[2,3,4]
        ElementReader reader = new ElementReader(getClass().getResourceAsStream("arraySparse1.xml"));
        String[][][] strings = (String[][][]) createArrayType(String[][][].class).readObject(reader, context);
        reader.getXMLStreamReader().close();
View Full Code Here

TOP

Related Classes of org.apache.cxf.aegis.Context

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.