Package java.beans

Examples of java.beans.XMLDecoder.readObject()


        actualValue = (String) decoder.readObject();
        assertEquals(expectedValue,actualValue);
       
        decoder = new XMLDecoder(this.getClass().getResourceAsStream(
        "/xml/MockOwner_Ambiguous.xml"), mock);
        actualValue = (String) decoder.readObject();
        assertNull(actualValue);
       
        decoder = new XMLDecoder(this.getClass().getResourceAsStream(
        "/xml/MockOwner_Null.xml"), mock);
        actualValue = (String) decoder.readObject();
View Full Code Here


        actualValue = (String) decoder.readObject();
        assertNull(actualValue);
       
        decoder = new XMLDecoder(this.getClass().getResourceAsStream(
        "/xml/MockOwner_Null.xml"), mock);
        actualValue = (String) decoder.readObject();
        assertNull(actualValue);
    }

    public void testReadObject_Owner_WithWriteStatement() {
        MockBean4Owner_Owner o2 = new MockBean4Owner_Owner();
View Full Code Here

    public void testReadObject_Owner_WithWriteStatement() {
        MockBean4Owner_Owner o2 = new MockBean4Owner_Owner();
        XMLDecoder dec2 = new XMLDecoder(this.getClass().getResourceAsStream(
                "/xml/MockBean4Owner_SetOwnerWithWriteStatement.xml"), o2);
        MockBean4Owner_Target t2 = (MockBean4Owner_Target) dec2.readObject();

        assertEquals(999, o2.getV());
        assertEquals(o2, t2.getV());
    }
View Full Code Here

        };

        XMLDecoder xmlDecoder = new XMLDecoder(new ByteArrayInputStream(
                xml123bytes));
        xmlDecoder.setExceptionListener(exceptionListener);
        assertEquals(new Integer(1), xmlDecoder.readObject());
        assertEquals(new Integer(2), xmlDecoder.readObject());
        assertEquals(new Integer(3), xmlDecoder.readObject());
        xmlDecoder.close();
        assertEquals(0, exceptionList.size());
    }
View Full Code Here

        XMLDecoder xmlDecoder = new XMLDecoder(new ByteArrayInputStream(
                xml123bytes));
        xmlDecoder.setExceptionListener(exceptionListener);
        assertEquals(new Integer(1), xmlDecoder.readObject());
        assertEquals(new Integer(2), xmlDecoder.readObject());
        assertEquals(new Integer(3), xmlDecoder.readObject());
        xmlDecoder.close();
        assertEquals(0, exceptionList.size());
    }
View Full Code Here

        XMLDecoder xmlDecoder = new XMLDecoder(new ByteArrayInputStream(
                xml123bytes));
        xmlDecoder.setExceptionListener(exceptionListener);
        assertEquals(new Integer(1), xmlDecoder.readObject());
        assertEquals(new Integer(2), xmlDecoder.readObject());
        assertEquals(new Integer(3), xmlDecoder.readObject());
        xmlDecoder.close();
        assertEquals(0, exceptionList.size());
    }

    public void testSetExceptionListener_Called() throws Exception {
View Full Code Here

        MockExceptionListener mockListener = new MockExceptionListener();
        xmlDecoder.setExceptionListener(mockListener);
       
        assertFalse(mockListener.isCalled());       
        // Real Parsing should occur in method of ReadObject rather constructor.
        assertNotNull(xmlDecoder.readObject());
        assertTrue(mockListener.isCalled());
    }

    public void testSetExceptionListener() {
        XMLDecoder dec = new XMLDecoder(new ByteArrayInputStream(xml123bytes));
View Full Code Here

        encoder.writeObject(new String[10]);
        encoder.close();

        decoder = new XMLDecoder(new ByteArrayInputStream(out.toByteArray()));
        obj = decoder.readObject();
        decoder.close();
       
        assertTrue("Returned object is not array", obj.getClass().isArray());
        assertSame("String type expected", String.class,
                obj.getClass().getComponentType());
View Full Code Here

        try {
            Introspector.setBeanInfoSearchPath(new String[] {});
            d = new XMLDecoder(new BufferedInputStream(ClassLoader
                    .getSystemClassLoader().getResourceAsStream(resourceName)));
            while (true) {
                d.readObject();
            }
        } catch (ArrayIndexOutOfBoundsException aibe) {
            assertTrue(true);
        } finally {
            if (d != null) {
View Full Code Here

    ByteArrayInputStream bais = new ByteArrayInputStream(bytes);

    XMLDecoder decoder = new XMLDecoder(bais, null, null);
    try {
      ExprNodeDesc expr = (ExprNodeDesc) decoder.readObject();
      return expr;
    } finally {
      decoder.close();
    }
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.