Package net.rubyeye.xmemcached.command

Examples of net.rubyeye.xmemcached.command.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());
    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

    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());
    command.encode();
    checkByteBufferEquals(command, "replace test 0 0 2 noreply\r\n10\r\n");
  }

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

  @Override
  protected WriteMessage preprocessWriteMessage(WriteMessage writeMessage) {
    Command currentCommand = (Command) writeMessage;
    // Check if IoBuffer is null
    if (currentCommand.getIoBuffer() == null) {
      currentCommand.encode();
    }
    if (currentCommand.getStatus() == OperationStatus.SENDING) {
      /**
       * optimieze commands
       */
 
View Full Code Here

public class TextGetOneCommandUnitTest extends BaseTextCommandUnitTest {
  public void testGetOneEncode() {
    Command command = this.commandFactory.createGetCommand("test", "test"
        .getBytes(), CommandType.GET_ONE, null);
    assertNull(command.getIoBuffer());
    command.encode();
    checkByteBufferEquals(command, "get test\r\n");
  }

  public void testGetsOneEncode() {
    Command command = this.commandFactory.createGetCommand("test", "test"
View Full Code Here

  public void testGetsOneEncode() {
    Command command = this.commandFactory.createGetCommand("test", "test"
        .getBytes(), CommandType.GETS_ONE, null);
    assertNull(command.getIoBuffer());
    command.encode();
    checkByteBufferEquals(command, "gets test\r\n");
  }

  public void testGetOneDecode() {
    Command command = this.commandFactory.createGetCommand("test", "test"
View Full Code Here

  public void testGetManyEncode() {
    Command command = this.commandFactory.createGetMultiCommand(keys,
        new CountDownLatch(1), CommandType.GET_MANY, transcoder);
    assertNull(command.getIoBuffer());
    command.encode();

    checkByteBufferEquals(command, "get test1 test2 test3 test4\r\n");

  }
View Full Code Here

  public void testGetsManyEncode() {
    Command command = this.commandFactory.createGetMultiCommand(keys,
        new CountDownLatch(1), CommandType.GETS_MANY, transcoder);
    assertNull(command.getIoBuffer());
    command.encode();

    checkByteBufferEquals(command, "gets test1 test2 test3 test4\r\n");
  }

  public void testGetManyDecode() {
View Full Code Here

      if (prevCommand != null) {
        // first n-1 send getq command
        Command getqCommand = new BinaryGetCommand(
            prevCommand.getKey(), prevCommand.getKeyBytes(), null,
            null, OpCode.GET_KEY_QUIETLY, true);
        getqCommand.encode();
        totalBytes += getqCommand.getIoBuffer().remaining();
        bufferList.add(getqCommand.getIoBuffer());
      }
      prevCommand = command;
    }
View Full Code Here

      // getq commands send response back
      Command lastGetKCommand = new BinaryGetCommand(
          prevCommand.getKey(), prevCommand.getKeyBytes(),
          CommandType.GET_ONE, new CountDownLatch(1), OpCode.GET_KEY,
          false);
      lastGetKCommand.encode();
      bufferList.add(lastGetKCommand.getIoBuffer());
      totalBytes += lastGetKCommand.getIoBuffer().remaining();
    }

  }
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.