Package net.rubyeye.xmemcached.command

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


    buffer = constructResponse(OpCode.ADD.fieldValue(), (short) 0,
        (byte) 0, (byte) 0, (short) 0x0005, 0, 0, 1L, null, null, null);
    command = this.commandFactory.createAddCommand(this.key, this.keyBytes, 0, this.value,
        this.noreply, this.transcoder);
    assertTrue(command.decode(null, buffer));
    assertFalse((Boolean) command.getResult());
    assertEquals(0, buffer.remaining());
  }

  public void testReplaceEncodeAndDecode() {
View Full Code Here


    ByteBuffer buffer = constructResponse(OpCode.REPLACE.fieldValue(),
        (short) 0, (byte) 0, (byte) 0, (short) 0, 0, 0, 1L, null, null,
        null);

    assertTrue(command.decode(null, buffer));
    assertTrue((Boolean) command.getResult());
    assertEquals(0, buffer.remaining());

    buffer = constructResponse(OpCode.REPLACE.fieldValue(), (short) 0,
        (byte) 0, (byte) 0, (short) 0x0005, 0, 0, 1L, null, null, null);
View Full Code Here

    buffer = constructResponse(OpCode.REPLACE.fieldValue(), (short) 0,
        (byte) 0, (byte) 0, (short) 0x0005, 0, 0, 1L, null, null, null);
    command = this.commandFactory.createReplaceCommand(this.key, this.keyBytes, 0, this.value,
        this.noreply, this.transcoder);
    assertTrue(command.decode(null, buffer));
    assertFalse((Boolean) command.getResult());
    assertEquals(0, buffer.remaining());
  }

  public void testSetEncodeAndDecode() {
View Full Code Here

    ByteBuffer buffer = constructResponse(OpCode.SET.fieldValue(),
        (short) 0, (byte) 0, (byte) 0, (short) 0, 0, 0, 1L, null, null,
        null);

    assertTrue(command.decode(null, buffer));
    assertTrue((Boolean) command.getResult());
    assertEquals(0, buffer.remaining());

    buffer = constructResponse(OpCode.SET.fieldValue(), (short) 0,
        (byte) 0, (byte) 0, (short) 0x0005, 0, 0, 1L, null, null, null);
View Full Code Here

    buffer = constructResponse(OpCode.SET.fieldValue(), (short) 0,
        (byte) 0, (byte) 0, (short) 0x0005, 0, 0, 1L, null, null, null);
    command = this.commandFactory.createSetCommand(this.key, this.keyBytes, 0, this.value,
        this.noreply, this.transcoder);
    assertTrue(command.decode(null, buffer));
    assertFalse((Boolean) command.getResult());
    assertEquals(0, buffer.remaining());
  }

}
View Full Code Here

    ByteBuffer buffer = this.constructResponse(OpCode.DELETE.fieldValue(),
        (short) 0, (byte) 0, (byte) 0, (short) 0, 0, 0, 1L, null, null,
        null);

    assertTrue(command.decode(null, buffer));
    assertTrue((Boolean) command.getResult());
    assertEquals(0, buffer.remaining());

    buffer = this.constructResponse(OpCode.DELETE.fieldValue(), (short) 0,
        (byte) 0, (byte) 0, (short) 0x0005, 0, 0, 1L, null, null, null);
View Full Code Here

    buffer = this.constructResponse(OpCode.DELETE.fieldValue(), (short) 0,
        (byte) 0, (byte) 0, (short) 0x0005, 0, 0, 1L, null, null, null);
    command = this.commandFactory.createDeleteCommand(this.key,
        this.keyBytes, 0, 999L,
        this.noreply);
    assertTrue(command.decode(null, buffer));
    assertFalse((Boolean) command.getResult());
    assertEquals(0, buffer.remaining());
  }

}
View Full Code Here

    ByteBuffer buffer = constructResponse(OpCode.GAT.fieldValue(),
        (short) 0, (byte) 0x04, (byte) 0, (short) 0, 0x00000009, 0, 1L,
        this.transcoderUtils.encodeInt(0), null, "world".getBytes());

    assertEquals(33, buffer.capacity());
    assertTrue(command.decode(null, buffer));
    assertEquals("world", this.transcoder.decode((CachedData) command
        .getResult()));
    assertEquals(0, buffer.remaining());

    buffer = constructResponse(OpCode.GAT.fieldValue(), (short) 0,
View Full Code Here

        (byte) 0x04, (byte) 0, (short) 0, 0x00000004, 0, 1L,
        this.transcoderUtils.encodeInt(0), null, null);
    assertEquals(28, buffer.capacity());
    command = this.commandFactory.createGetAndTouchCommand(this.key,
        this.keyBytes, null, 10, false);
    assertTrue(command.decode(null, buffer));
    assertEquals(0, ((CachedData) command.getResult()).getData().length);
    assertEquals(0, buffer.remaining());
  }
}
View Full Code Here

    }
    totalBuffer.put(constructResponse(OpCode.STAT.fieldValue(), (short) 0,
        (byte) 0, (byte) 0, (short) 0, 0, 0, 0L, null, null, null));
    totalBuffer.flip();

    assertTrue(command.decode(null, totalBuffer));
    Map<String, String> result = (Map<String, String>) command
        .getResult();

    assertNotNull(result);
    assertTrue(result.size() > 0);
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.