Package net.rubyeye.xmemcached.command

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


  byte[] keyBytes = ByteUtils.getBytes(this.key);

  public void testEncodeDecode() {
    Command command = this.commandFactory.createTouchCommand(key, keyBytes,
        null, 10, false);
    command.encode();
    ByteBuffer encodeBuffer = command.getIoBuffer().buf();
    assertNotNull(encodeBuffer);
    assertEquals(24 + 4 + 5, encodeBuffer.capacity());

    byte opCode = encodeBuffer.get(1);
View Full Code Here


  public void testAppendEncodeAndDecode() {

    Command command = this.commandFactory.createAppendCommand(this.key,
        this.keyBytes, this.value, this.noreply, this.transcoder);
    command.encode();
    ByteBuffer encodeBuffer = command.getIoBuffer().buf();
    assertNotNull(encodeBuffer);
    assertEquals(30, encodeBuffer.capacity());

    byte opCode = encodeBuffer.get(1);
View Full Code Here

  public void testPrependEncodeAndDecode() {

    Command command = this.commandFactory.createPrependCommand(this.key,
        this.keyBytes, this.value, this.noreply, this.transcoder);
    command.encode();
    ByteBuffer encodeBuffer = command.getIoBuffer().buf();
    assertNotNull(encodeBuffer);
    assertEquals(30, encodeBuffer.capacity());

    byte opCode = encodeBuffer.get(1);
View Full Code Here

  public void testAddEncodeAndDecode() {

    Command command = this.commandFactory.createCASCommand(this.key, this.keyBytes,
        0, this.value, 9L, this.noreply, this.transcoder);

    command.encode();
    ByteBuffer encodeBuffer = command.getIoBuffer().buf();
    assertNotNull(encodeBuffer);
    assertEquals(42, encodeBuffer.capacity());

    byte opCode = encodeBuffer.get(1);
View Full Code Here

      if (it.hasNext()) {
        // first n-1 send gatq command
        Command command = this.commandFactory.createGetAndTouchCommand(
            key, ByteUtils.getBytes(key), null, innerKeyExpMap
                .get(key), true);
        command.encode();
        totalLength += command.getIoBuffer().remaining();
        bufferList.add(command.getIoBuffer());
      }
    }
    // last key,create a gat command
View Full Code Here

      }
    }
    // last key,create a gat command
    Command lastCommand = this.commandFactory.createGetAndTouchCommand(key,
        ByteUtils.getBytes(key), null, innerKeyExpMap.get(key), false);
    lastCommand.encode();
    bufferList.add(lastCommand.getIoBuffer());
    totalLength += lastCommand.getIoBuffer().remaining();

    IoBuffer mergedBuffer = IoBuffer.allocate(totalLength);
    for (IoBuffer buffer : bufferList) {
View Full Code Here

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

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

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

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

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

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

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

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

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

  public void testCASDecode() {
    Command command = this.commandFactory.createCASCommand(key, key
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.