mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernd Fondermann <bf_...@brainlounge.de>
Subject Re: [Vysper] Porting to MINA 2.0.X (Some errors)
Date Mon, 15 Jun 2009 10:13:35 GMT
Hi,

Vysper/MINA2.0Mx is now in svn on a branch.
server is still coming up and running.

MINA core devs, please review if you find the time and energy.

Ashish, does this go along well with you local port?

Thanks everyone,

  Bernd

Ashish wrote:
> Back again with the topic. Did most of the porting on local copy, to
> see how much time does it take :-)
> 
> One Observation
> 
> When using this code snippet in class XMLStreamTokenizerTestCase.java
> 
> private IoBuffer createByteBuffer() {
>         return IoBuffer.allocate(0, false).setAutoExpand(true);
>     }
> 
> was getting this error "Derived buffers and their parent can't be expanded."
> 
> When I changed the code to
> 
> private IoBuffer createByteBuffer() {
>         return IoBuffer.allocate(1, false).setAutoExpand(true);
> }
> 
> it worked fine. I guess I am missing something here
> 
> 
> 
> Errors
> 
> Most of the code has been ported, stuck with 2 Test Cases
> Now stuck with testing the Decoder part
> 
> The test case code is below (XMLStreamTokenizerTestCase.java). Used
> ProtocolCodeSession, as used in  CumulativeProtocolDecoderTest
> 
> It fails at first assert, expected is 4, but it gets 1.
> 
> public void testDecoderSimple() throws Exception {
>         XMLStreamTokenizer decoder = new XMLStreamTokenizer();
>         IoSession session = new ProtocolCodecSession();
>         IoBuffer firstByteBuffer = createByteBuffer();
>         IoBuffer secondByteBuffer = createByteBuffer();
> 
>         String stanza = StanzaWriter.XML_PROLOG + "\n\r" +
>                 "<stream:stream to='example.com' xmlns='jabber:client'
> xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>" +
>                 "<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);
>         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
>         assertEquals("plain termination", 6, protocolDecoderOutput.size());
> 
>     }
> 
> Will continue to debug this, meanwhile any pointers are appreciated.
> 


Mime
View raw message