Package com.taobao.gecko.core.buffer

Examples of com.taobao.gecko.core.buffer.IoBuffer.position()


        IoBuffer buf = IoBuffer.wrap("put test 1 5 0 10\r\nhel".getBytes());

        PutCommand decodedCmd = (PutCommand) this.decoder.decode(buf, null);
        assertNull(decodedCmd);
        assertEquals(0, buf.position());
        assertEquals(buf.capacity(), buf.remaining());

        buf = IoBuffer.wrap("put test 1 5 0 10\r\nhello".getBytes());
        decodedCmd = (PutCommand) this.decoder.decode(buf, null);
        assertNotNull(decodedCmd);
View Full Code Here


public class GetCommandUnitTest {
    @Test
    public void testEncode() {
        final GetCommand cmd = new GetCommand("test", "boyan-group", 1, 1000L, 1024 * 1024, -3);
        final IoBuffer buf = cmd.encode();
        assertEquals(0, buf.position());
        assertEquals("get test boyan-group 1 1000 1048576 -3\r\n", new String(buf.array()));
    }
}
View Full Code Here

public class OffsetCommandUnitTest {
    @Test
    public void testEncode() {
        final OffsetCommand cmd = new OffsetCommand("test", "boyan-test", 1, 1000L, -1);
        final IoBuffer buf = cmd.encode();
        assertEquals(0, buf.position());
        assertEquals("offset test boyan-test 1 1000 -1\r\n", new String(buf.array()));
    }

}
View Full Code Here

public class VersionCommandUnitTest {
    @Test
    public void testEncode() {
        final VersionCommand cmd = new VersionCommand(999);
        final IoBuffer buf = cmd.encode();
        assertEquals(0, buf.position());
        assertEquals("version 999\r\n", new String(buf.array()));
    }
}
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.