Package net.rubyeye.xmemcached.command

Examples of net.rubyeye.xmemcached.command.Command.encode()


public class TextVersionCommandUnitTest extends BaseTextCommandUnitTest {
  public void testEncode() {
    Command versionCommand = this.commandFactory.createVersionCommand(new CountDownLatch(1),null);
    assertNull(versionCommand.getIoBuffer());
    versionCommand.encode();
    assertEquals(ServerAddressAware.VERSION, versionCommand.getIoBuffer()
        .buf());
  }

  public void testDecode() {
View Full Code Here


  public void testCASEncode() {
    Command command = this.commandFactory.createCASCommand(key, key
        .getBytes(), exp, value, cas, false, transcoder);
    assertNull(command.getIoBuffer());
    command.encode();
    checkByteBufferEquals(command, "cas test 0 0 2 999\r\n10\r\n");
    command = this.commandFactory.createCASCommand(key, key.getBytes(),
        exp, value, cas, true, transcoder);
    command.encode();
    checkByteBufferEquals(command, "cas test 0 0 2 999 noreply\r\n10\r\n");
View Full Code Here

  int exp = 2 * 3600;

  public void testIncrementEncodeDecode() {
    Command command = this.commandFactory.createIncrDecrCommand(this.key, this.keyBytes,
        this.delta, this.initial, this.exp, CommandType.INCR, false);
    command.encode();
    ByteBuffer encodeBuffer = command.getIoBuffer().buf();
    assertNotNull(encodeBuffer);
    assertEquals(51, encodeBuffer.capacity());
    byte opCode = encodeBuffer.get(1);
    assertEquals(OpCode.INCREMENT.fieldValue(), opCode);
View Full Code Here

    assertNull(command.getIoBuffer());
    command.encode();
    checkByteBufferEquals(command, "cas test 0 0 2 999\r\n10\r\n");
    command = this.commandFactory.createCASCommand(key, key.getBytes(),
        exp, value, cas, true, transcoder);
    command.encode();
    checkByteBufferEquals(command, "cas test 0 0 2 999 noreply\r\n10\r\n");
  }

  public void testSetEncode() {
    Command command = this.commandFactory.createSetCommand(key, key
View Full Code Here

  public void testSetEncode() {
    Command command = this.commandFactory.createSetCommand(key, key
        .getBytes(), exp, value, false, transcoder);
    assertNull(command.getIoBuffer());
    command.encode();
    checkByteBufferEquals(command, "set test 0 0 2\r\n10\r\n");
    command = this.commandFactory.createSetCommand(key, key.getBytes(),
        exp, value, true, transcoder);
    command.encode();
    checkByteBufferEquals(command, "set test 0 0 2 noreply\r\n10\r\n");
View Full Code Here

    assertNull(command.getIoBuffer());
    command.encode();
    checkByteBufferEquals(command, "set test 0 0 2\r\n10\r\n");
    command = this.commandFactory.createSetCommand(key, key.getBytes(),
        exp, value, true, transcoder);
    command.encode();
    checkByteBufferEquals(command, "set test 0 0 2 noreply\r\n10\r\n");
  }

  public void testAddEncode() {
    Command command = this.commandFactory.createAddCommand(key, key
View Full Code Here

  }
 
  public void testDecrementEncodeDecode() {
    Command command = this.commandFactory.createIncrDecrCommand(this.key, this.keyBytes,
        this.delta, this.initial, this.exp, CommandType.DECR, false);
    command.encode();
    ByteBuffer encodeBuffer = command.getIoBuffer().buf();
    assertNotNull(encodeBuffer);
    assertEquals(51, encodeBuffer.capacity());
    byte opCode = encodeBuffer.get(1);
    assertEquals(OpCode.DECREMENT.fieldValue(), opCode);
View Full Code Here

  public void testAddEncode() {
    Command command = this.commandFactory.createAddCommand(key, key
        .getBytes(), exp, value, false, transcoder);
    assertNull(command.getIoBuffer());
    command.encode();
    checkByteBufferEquals(command, "add test 0 0 2\r\n10\r\n");

    command = this.commandFactory.createAddCommand(key, key.getBytes(),
        exp, value, true, transcoder);
    assertNull(command.getIoBuffer());
View Full Code Here

    checkByteBufferEquals(command, "add test 0 0 2\r\n10\r\n");

    command = this.commandFactory.createAddCommand(key, key.getBytes(),
        exp, value, true, transcoder);
    assertNull(command.getIoBuffer());
    command.encode();
    checkByteBufferEquals(command, "add test 0 0 2 noreply\r\n10\r\n");
  }

  public void testReplaceEncode() {
    Command command = this.commandFactory.createReplaceCommand(key, key
View Full Code Here

  public void testReplaceEncode() {
    Command command = this.commandFactory.createReplaceCommand(key, key
        .getBytes(), exp, value, false, transcoder);
    assertNull(command.getIoBuffer());
    command.encode();
    checkByteBufferEquals(command, "replace test 0 0 2\r\n10\r\n");

    command = this.commandFactory.createReplaceCommand(key, key.getBytes(),
        exp, value, true, transcoder);
    assertNull(command.getIoBuffer());
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.