Package net.rubyeye.xmemcached.command

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


  public void testDecode() {
    Command command = this.commandFactory.createIncrDecrCommand("test",
        "test".getBytes(), 10, 0,0, CommandType.DECR, false);
    checkDecodeNullAndNotLineByteBuffer(command);
    try {
      command.decode(null, ByteBuffer.wrap("NOT_STORED\r\n".getBytes()));
      fail();
    } catch (NumberFormatException e) {
      assertEquals("For input string: \"NOT_STORED\"", e.getMessage());
    }
    try {
View Full Code Here


      fail();
    } catch (NumberFormatException e) {
      assertEquals("For input string: \"NOT_STORED\"", e.getMessage());
    }
    try {
      command.decode(null, ByteBuffer.wrap("test\r\n".getBytes()));
      fail();
    } catch (NumberFormatException e) {
      assertEquals("For input string: \"test\"", e.getMessage());
    }
    try {
View Full Code Here

      fail();
    } catch (NumberFormatException e) {
      assertEquals("For input string: \"test\"", e.getMessage());
    }
    try {
      command.decode(null, ByteBuffer.wrap("STORED\r\n".getBytes()));
      fail();
    } catch (NumberFormatException e) {
      assertEquals("For input string: \"STORED\"", e.getMessage());
    }
    try {
View Full Code Here

      fail();
    } catch (NumberFormatException e) {
      assertEquals("For input string: \"STORED\"", e.getMessage());
    }
    try {
      command.decode(null, ByteBuffer.wrap("VALUE test\r\n".getBytes()));
      fail();
    } catch (NumberFormatException e) {
      assertEquals("For input string: \"VALUE test\"", e.getMessage());
    }
    checkDecodeValidLine(command, "NOT_FOUND\r\n");
View Full Code Here

    Command command = this.commandFactory.createStatsCommand(null,
        new CountDownLatch(1), null);
    checkDecodeNullAndNotLineByteBuffer(command);
    checkDecodeInvalidLine(command, "OK\r\n");
    checkDecodeValidLine(command, "END\r\n");
    assertFalse(command.decode(null, ByteBuffer
        .wrap("STAT bytes 100\r\nSTAT threads 1\r\n".getBytes())));
    Map<String, String> result = (Map<String, String>) command.getResult();
    assertEquals("100", result.get("bytes"));
    assertEquals("1", result.get("threads"));
    checkDecodeValidLine(command, "STAT connections 5\r\nEND\r\n");
View Full Code Here

    assertNull(command.getResult());
    assertEquals(0, command.getLatch().getCount());

    command = this.commandFactory.createGetCommand("test", "test"
        .getBytes(), CommandType.GET_ONE, null);
    assertFalse(command.decode(null, ByteBuffer
        .wrap("VALUE test 0 2\r\n10\r\n".getBytes())));
    assertNull(command.getResult());

    assertFalse(command.decode(null, ByteBuffer.wrap("VALUE test 0 4\r\n1"
        .getBytes())));
View Full Code Here

        .getBytes(), CommandType.GET_ONE, null);
    assertFalse(command.decode(null, ByteBuffer
        .wrap("VALUE test 0 2\r\n10\r\n".getBytes())));
    assertNull(command.getResult());

    assertFalse(command.decode(null, ByteBuffer.wrap("VALUE test 0 4\r\n1"
        .getBytes())));
    assertFalse(command.decode(null, ByteBuffer.wrap("0".getBytes())));
    assertFalse(command.decode(null, ByteBuffer.wrap("0".getBytes())));
    assertFalse(command.decode(null, ByteBuffer.wrap("0".getBytes())));
    checkDecodeValidLine(command, "\r\nEND\r\n");
View Full Code Here

        .wrap("VALUE test 0 2\r\n10\r\n".getBytes())));
    assertNull(command.getResult());

    assertFalse(command.decode(null, ByteBuffer.wrap("VALUE test 0 4\r\n1"
        .getBytes())));
    assertFalse(command.decode(null, ByteBuffer.wrap("0".getBytes())));
    assertFalse(command.decode(null, ByteBuffer.wrap("0".getBytes())));
    assertFalse(command.decode(null, ByteBuffer.wrap("0".getBytes())));
    checkDecodeValidLine(command, "\r\nEND\r\n");

    assertEquals("1000", new String(((CachedData) command.getResult())
View Full Code Here

    assertNull(command.getResult());

    assertFalse(command.decode(null, ByteBuffer.wrap("VALUE test 0 4\r\n1"
        .getBytes())));
    assertFalse(command.decode(null, ByteBuffer.wrap("0".getBytes())));
    assertFalse(command.decode(null, ByteBuffer.wrap("0".getBytes())));
    assertFalse(command.decode(null, ByteBuffer.wrap("0".getBytes())));
    checkDecodeValidLine(command, "\r\nEND\r\n");

    assertEquals("1000", new String(((CachedData) command.getResult())
        .getData()));
View Full Code Here

    assertFalse(command.decode(null, ByteBuffer.wrap("VALUE test 0 4\r\n1"
        .getBytes())));
    assertFalse(command.decode(null, ByteBuffer.wrap("0".getBytes())));
    assertFalse(command.decode(null, ByteBuffer.wrap("0".getBytes())));
    assertFalse(command.decode(null, ByteBuffer.wrap("0".getBytes())));
    checkDecodeValidLine(command, "\r\nEND\r\n");

    assertEquals("1000", new String(((CachedData) command.getResult())
        .getData()));
  }
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.