Examples of XppReader


Examples of com.thoughtworks.xstream.io.xml.XppReader

        final CompactWriter compactWriter = new CompactWriter(writer);
        new TreeMarshaller(compactWriter, converterLookup, mapper).start(name, null);
        compactWriter.flush();
        assertEquals("<software>XStream</software>", writer.toString());

        final HierarchicalStreamReader reader = new XppReader(new StringReader(
            writer.toString()));
        assertEquals(
            name, new TreeUnmarshaller(null, reader, converterLookup, mapper).start(null));
    }
View Full Code Here

Examples of com.thoughtworks.xstream.io.xml.XppReader

        compactWriter.flush();
        assertEquals(
            "<open-source vendor=\"Codehaus\" license=\"BSD\">XStream</open-source>",
            writer.toString());

        final HierarchicalStreamReader reader = new XppReader(new StringReader(
            writer.toString()));
        assertEquals(
            software, new TreeUnmarshaller(null, reader, converterLookup, mapper).start(null));
    }
View Full Code Here

Examples of com.thoughtworks.xstream.io.xml.XppReader

            + "<software-array>\n"
            + "  <software vendor=\"Microsoft\">Windows</software>\n"
            + "  <open-source vendor=\"Codehaus\" name=\"XStream\">BSD</open-source>\n"
            + "</software-array>", writer.toString());

        final HierarchicalStreamReader reader = new XppReader(new StringReader(
            writer.toString()));
        Software[] array = (Software[])new TreeUnmarshaller(
            null, reader, converterLookup, mapper).start(null);
        assertEquals(software[0], array[0]);
        assertEquals(software[1], array[1]);
View Full Code Here

Examples of com.thoughtworks.xstream.io.xml.XppReader

        final CompactWriter compactWriter = new CompactWriter(writer);
        new TreeMarshaller(compactWriter, converterLookup, mapper).start(software, null);
        compactWriter.flush();
        assertEquals("<software/>", writer.toString());

        final HierarchicalStreamReader reader = new XppReader(new StringReader(
            writer.toString()));
        assertEquals(
            "",
            ((Software)new TreeUnmarshaller(null, reader, converterLookup, mapper).start(null)).name);
    }
View Full Code Here

Examples of com.thoughtworks.xstream.io.xml.XppReader

        final CompactWriter compactWriter = new CompactWriter(writer);
        new TreeMarshaller(compactWriter, converterLookup, mapper).start(software, null);
        compactWriter.flush();
        assertEquals("<software vendor=\"Codehaus\" name=\"XStream\"/>", writer.toString());

        final HierarchicalStreamReader reader = new XppReader(new StringReader(
            writer.toString()));
        assertEquals(
            software, new TreeUnmarshaller(null, reader, converterLookup, mapper).start(null));
    }
View Full Code Here

Examples of com.thoughtworks.xstream.io.xml.XppReader

        new TreeMarshaller(compactWriter, converterLookup, mapper).start(x, null);
        compactWriter.flush();
        assertEquals(
            "<x aStr=\"xXx\" anInt=\"42\"><yField>inner</yField></x>", writer.toString());

        final HierarchicalStreamReader reader = new XppReader(new StringReader(
            writer.toString()));
        assertEquals(x, new TreeUnmarshaller(null, reader, converterLookup, mapper).start(null));
    }
View Full Code Here

Examples of com.thoughtworks.xstream.io.xml.XppReader

            + "    <lastName>Winky</lastName>\n"
            + "  </person>\n"
            + "</people>", buffer.toString());

        // deserialize
        HierarchicalStreamReader reader = new XppReader(new StringReader(buffer.toString()));

        assertTrue("should be another object to read (1)", reader.hasMoreChildren());
        reader.moveDown();
        assertEquals(new Person("Postman", "Pat"), xstream.unmarshal(reader));
        reader.moveUp();

        assertTrue("should be another object to read (2)", reader.hasMoreChildren());
        reader.moveDown();
        assertEquals(new Person("Bob", "Builder"), xstream.unmarshal(reader));
        reader.moveUp();

        assertTrue("should be another object to read (3)", reader.hasMoreChildren());
        reader.moveDown();
        assertEquals(new Person("Tinky", "Winky"), xstream.unmarshal(reader));
        reader.moveUp();

        assertFalse("should be no more objects", reader.hasMoreChildren());
    }
View Full Code Here

Examples of com.thoughtworks.xstream.io.xml.XppReader

                "  </brother>\n" +
                "</personHolder>";

        // execute
        SamplePersonHolder alreadyInstantiated = new SamplePersonHolder();
        xstream.unmarshal(new XppReader(new StringReader(xml)), alreadyInstantiated);

        // verify
        SamplePersonHolder expectedResult = new SamplePersonHolder();
        expectedResult.aString = "hello world";
View Full Code Here

Examples of com.thoughtworks.xstream.io.xml.XppReader

        xstream.registerConverter(new StringWithPrefixConverter());
        DataHolder dataHolder = xstream.newDataHolder();

        // execute
        String xml = "<string can-you-see-me=\"yes\">something</string>";
        Object result = xstream.unmarshal(new XppReader(new StringReader(xml)), null, dataHolder);

        // verify
        assertEquals("something", result);
        assertEquals("yes", dataHolder.get("saw-this"));
    }
View Full Code Here

Examples of com.thoughtworks.xstream.io.xml.XppReader

    /**
     * Unmarshalls the XML encoded message in the {@link TextMessage} to an
     * Object
     */
    protected Object unmarshall(Session session, TextMessage textMessage) throws JMSException {
        HierarchicalStreamReader in = new XppReader(new StringReader(textMessage.getText()));
        return getXStream().unmarshal(in);
    }
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.