Package java.beans

Examples of java.beans.XMLDecoder.readObject()


        // Read array with wrong type, it should return null,
        // and throw a java.lang.IllegalArgumentException
        dec = new XMLDecoder(this.getClass().getResourceAsStream(
                "/xml/Array_Illegal.xml"));
        array = (Object[]) dec.readObject();
        assertNull(array);
    }

    public void testReadObject_PropertyDependency() {
        XMLDecoder dec = new XMLDecoder(this.getClass().getResourceAsStream(
View Full Code Here


    }

    public void testReadObject_PropertyDependency() {
        XMLDecoder dec = new XMLDecoder(this.getClass().getResourceAsStream(
                "/xml/DependencyBean.xml"));
        DependencyBean b = (DependencyBean) dec.readObject();
        assertEquals(888, b.getInts()[0]);
        assertSame(b.getInts(), b.getRef());
    }

    public void testReadObject_NoChange() {
View Full Code Here

    }

    public void testReadObject_NoChange() {
        XMLDecoder dec = new XMLDecoder(this.getClass().getResourceAsStream(
                "/xml/MockBean4Codec_NoChange.xml"));
        dec.readObject();
    }

    public void testReadObject_BornFriendChange() {
        XMLDecoder dec = new XMLDecoder(this.getClass().getResourceAsStream(
                "/xml/MockBean4Codec_BornFriendChange.xml"));
View Full Code Here

    }

    public void testReadObject_BornFriendChange() {
        XMLDecoder dec = new XMLDecoder(this.getClass().getResourceAsStream(
                "/xml/MockBean4Codec_BornFriendChange.xml"));
        MockBean4Codec b = (MockBean4Codec) dec.readObject();
        assertEquals(888, b.getBornFriend().getZarr()[0]);
        assertEquals(b.getBornFriend(), b.getNill());
    }

    public void testReadObject_ManyChanges() {
View Full Code Here

    }

    public void testReadObject_ManyChanges() {
        XMLDecoder dec = new XMLDecoder(this.getClass().getResourceAsStream(
                "/xml/MockBean4Codec_ManyChanges.xml"));
        MockBean4Codec b = (MockBean4Codec) dec.readObject();
        assertEquals(127, b.getB());
        assertSame(b, b.getBackRef());
        assertEquals(new Byte((byte) 127), b.getBobj());
        assertFalse(b.isBool());
        assertEquals(Boolean.TRUE, b.getBoolobj());
View Full Code Here

    }

    public void testReadObject_StaticField() {
        XMLDecoder dec1 = new XMLDecoder(this.getClass().getResourceAsStream(
                "/xml/MockBean4StaticField_Original.xml"));
        MockBean4StaticField o1 = (MockBean4StaticField) dec1.readObject();

        XMLDecoder dec2 = new XMLDecoder(this.getClass().getResourceAsStream(
                "/xml/MockBean4StaticField.xml"));
        MockBean4StaticField o2 = (MockBean4StaticField) dec2.readObject();
View Full Code Here

                "/xml/MockBean4StaticField_Original.xml"));
        MockBean4StaticField o1 = (MockBean4StaticField) dec1.readObject();

        XMLDecoder dec2 = new XMLDecoder(this.getClass().getResourceAsStream(
                "/xml/MockBean4StaticField.xml"));
        MockBean4StaticField o2 = (MockBean4StaticField) dec2.readObject();

        if (!o1.equals(o2)) {
            System.out
                    .println("Loading object with static field, original xml: "
                            + o1.getV());
View Full Code Here

    public void testReadObject_Owner() {
        MockBean4Owner_Owner o1 = new MockBean4Owner_Owner();
        XMLDecoder dec1 = new XMLDecoder(this.getClass().getResourceAsStream(
                "/xml/MockBean4Owner_SetOwner.xml"), o1);
        MockBean4Owner_Target t1 = (MockBean4Owner_Target) dec1.readObject();

        assertEquals(1, o1.getV());
        assertEquals(o1, t1.getV());
    }
   
View Full Code Here

        HashMap map = new HashMap();
        map.put("key", expectedValue);
       
        XMLDecoder decoder = new XMLDecoder(this.getClass().getResourceAsStream(
                "/xml/MockOwner.xml"), map);
        String actualValue = (String) decoder.readObject();
        assertEquals(expectedValue,actualValue);
       
        MockOwnerClass mock = new MockOwnerClass();
        expectedValue = "I_Ljava.lang.String";
        decoder = new XMLDecoder(this.getClass().getResourceAsStream(
View Full Code Here

       
        MockOwnerClass mock = new MockOwnerClass();
        expectedValue = "I_Ljava.lang.String";
        decoder = new XMLDecoder(this.getClass().getResourceAsStream(
        "/xml/MockOwner_Specific.xml"), mock);
        actualValue = (String) decoder.readObject();
        assertEquals(expectedValue,actualValue);
       
        decoder = new XMLDecoder(this.getClass().getResourceAsStream(
        "/xml/MockOwner_Ambiguous.xml"), mock);
        actualValue = (String) decoder.readObject();
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.