Examples of StreamParser


Examples of bm.core.tools.StreamParser

     */
    public void compile()
            throws CompilerException,
                   SerializationException
    {
        parser = new StreamParser( in );

        try
        {
// First we want a "class" token
            String token = parser.next( WS, false, true, false );
View Full Code Here

Examples of com.mapr.storm.streamparser.StreamParser

            public List<String> getOutputFields() {
                throw new UnsupportedOperationException("Default operation");
            }
        });

        StreamParser parser = factory.createParser(new FileInputStream(file));

        assertTrue(file.length() > 30);

        assertEquals(0, parser.currentOffset());
        List<Object> t = parser.nextRecord();

        assertEquals(2, t.size());
        assertEquals("test", t.get(0));
        assertEquals("1", t.get(1));

        t = parser.nextRecord();

        assertEquals(2, t.size());
        assertEquals("test", t.get(0));
        assertEquals("2", t.get(1));

        // time critical section starts here ... delay > 50ms can cause failure

        // first read doesn't see a full record and thus returns null
        t = parser.nextRecord();
        assertNull(t);

        // write the remainder now
        out.write(bytes, 6, bytes.length - 6);

        // so that the repeated read succeeds
        t = parser.nextRecord();
        // end of time critical section

        assertEquals(2, t.size());
        assertEquals("test", t.get(0));
        assertEquals("3", t.get(1));

        assertNull(parser.nextRecord());

        out.close();
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.parser.StreamParser

        sessionContext = new TestSessionContext(context, sessionStateHolder);
    }

    public void testAquireSimpleStanza() {

        StreamParser streamParser = new StringStreamParser("<ProtocolHandlerTestStanzaHandler xmlns='testNSURI' ></ProtocolHandlerTestStanzaHandler>");
        Stanza stanza = protocolWorker.aquireStanza(sessionContext, streamParser);
        assertNotNull(stanza);

        Stanza expectedStanza = new StanzaBuilder("ProtocolHandlerTestStanzaHandler", "testNSURI").addNamespaceAttribute("testNSURI").build();
        assertEquals("stanza full match", expectedStanza, stanza);
View Full Code Here

Examples of org.apache.vysper.xmpp.parser.StreamParser

    }

    public void testAquireXMLNotWellformedStanza() {

        StreamParser streamParser = new StringStreamParser("<ProtocolHandlerTestStanzaHandler><inner_not_closed></ProtocolHandlerTestStanzaHandler>");
        Stanza stanza = protocolWorker.aquireStanza(sessionContext, streamParser);
        assertNull(stanza);

        assertErrorResponse();
View Full Code Here

Examples of org.apache.vysper.xmpp.parser.StreamParser

    }

    public void testAquireXMLIncomplete() {

        StreamParser streamParser = new StringStreamParser("<ProtocolHandlerTestStanzaHandler></Pro");
        Stanza stanza = protocolWorker.aquireStanza(sessionContext, streamParser);
        assertNull(stanza);

        assertErrorResponse();
View Full Code Here

Examples of org.apache.vysper.xmpp.parser.StreamParser

        assertTrue("bad format", recordedResponse.getVerifier().subElementPresent("bad-format"));
    }

    public void testAquireNoNextStanza() {

        StreamParser streamParser = new StringStreamParser("<ProtocolHandlerTestStanzaHandler ></ProtocolHandlerTestStanzaHandler>");
        Stanza stanza = protocolWorker.aquireStanza(sessionContext, streamParser);
        assertNotNull(stanza);

        stanza = protocolWorker.aquireStanza(sessionContext, streamParser);
        assertNull("no next", stanza);
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.