Package org.apache.vysper.xml.decoder

Examples of org.apache.vysper.xml.decoder.XMLStreamTokenizer.decode()


                "<trailing-stanza/>";

        firstByteBuffer.putString(stanza, CHARSET_ENCODER_UTF8).flip();
       
        MockProtocolDecoderOutput protocolDecoderOutput = new MockProtocolDecoderOutput();
        decoder.decode(session, firstByteBuffer, protocolDecoderOutput);
        assertEquals(4, protocolDecoderOutput.size());
       
        secondByteBuffer.putString("<next></next>", CHARSET_ENCODER_UTF8).flip();
       
        decoder.decode(session, secondByteBuffer, protocolDecoderOutput);
View Full Code Here


        decoder.decode(session, firstByteBuffer, protocolDecoderOutput);
        assertEquals(4, protocolDecoderOutput.size());
       
        secondByteBuffer.putString("<next></next>", CHARSET_ENCODER_UTF8).flip();
       
        decoder.decode(session, secondByteBuffer, protocolDecoderOutput);
        assertEquals(5, protocolDecoderOutput.size());

        IoBuffer emptyBuffer = createByteBuffer().putString("eee", CHARSET_ENCODER_UTF8).flip();
        decoder.decode(session, emptyBuffer, protocolDecoderOutput);
        assertEquals("plain must be terminated by <", 5, protocolDecoderOutput.size());
View Full Code Here

       
        decoder.decode(session, secondByteBuffer, protocolDecoderOutput);
        assertEquals(5, protocolDecoderOutput.size());

        IoBuffer emptyBuffer = createByteBuffer().putString("eee", CHARSET_ENCODER_UTF8).flip();
        decoder.decode(session, emptyBuffer, protocolDecoderOutput);
        assertEquals("plain must be terminated by <", 5, protocolDecoderOutput.size());
       
        IoBuffer termBuffer = createByteBuffer().putString("<r>", CHARSET_ENCODER_UTF8).flip();
        decoder.decode(session, termBuffer, protocolDecoderOutput);
        // eee is now terminated, but r is not balanced yet
View Full Code Here

        IoBuffer emptyBuffer = createByteBuffer().putString("eee", CHARSET_ENCODER_UTF8).flip();
        decoder.decode(session, emptyBuffer, protocolDecoderOutput);
        assertEquals("plain must be terminated by <", 5, protocolDecoderOutput.size());
       
        IoBuffer termBuffer = createByteBuffer().putString("<r>", CHARSET_ENCODER_UTF8).flip();
        decoder.decode(session, termBuffer, protocolDecoderOutput);
        // eee is now terminated, but r is not balanced yet
        assertEquals("plain termination", 6, protocolDecoderOutput.size());
       
    }
View Full Code Here

        MockProtocolDecoderOutput protocolDecoderOutput = new MockProtocolDecoderOutput();

        IoBuffer prolog = createByteBuffer();
        prolog.putString(StanzaWriter.XML_PROLOG + "\n\r", CHARSET_ENCODER_UTF8).flip();
        decoder.decode(session, prolog, protocolDecoderOutput);
        assertEquals(1, protocolDecoderOutput.size());
       
        firstByteBuffer.putString(stanzaPart1, CHARSET_ENCODER_UTF8).flip();
        decoder.decode(session, firstByteBuffer, protocolDecoderOutput);
        assertEquals(2, protocolDecoderOutput.size());
View Full Code Here

        prolog.putString(StanzaWriter.XML_PROLOG + "\n\r", CHARSET_ENCODER_UTF8).flip();
        decoder.decode(session, prolog, protocolDecoderOutput);
        assertEquals(1, protocolDecoderOutput.size());
       
        firstByteBuffer.putString(stanzaPart1, CHARSET_ENCODER_UTF8).flip();
        decoder.decode(session, firstByteBuffer, protocolDecoderOutput);
        assertEquals(2, protocolDecoderOutput.size());
        String content = ((XMLText)protocolDecoderOutput.get(1)).getText();
        assertEquals("\n\r", content);

View Full Code Here

        String content = ((XMLText)protocolDecoderOutput.get(1)).getText();
        assertEquals("\n\r", content);


        secondByteBuffer.putString(stanzaPart2, CHARSET_ENCODER_UTF8).flip();
        decoder.decode(session, secondByteBuffer, protocolDecoderOutput);
        assertEquals(3, protocolDecoderOutput.size());
    }

    public void testCRLFInElement() throws Exception {
        XMLStreamTokenizer decoder = new XMLStreamTokenizer();
View Full Code Here

       
        MockProtocolDecoderOutput protocolDecoderOutput = new MockProtocolDecoderOutput();

        byteBuffer.putString(stanza, CHARSET_ENCODER_UTF8).flip();
        try {
            decoder.decode(session, byteBuffer, protocolDecoderOutput);
        } catch(Throwable th) {
            int lkjl = 0;
        }
        assertEquals(1, protocolDecoderOutput.size());
        XMLElement stanzaParsed = (XMLElement) protocolDecoderOutput.get(0);
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.