Package net.rubyeye.xmemcached.command

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


        this.delta, this.initial, this.exp, CommandType.DECR, false);
    buffer = constructResponse(OpCode.DECREMENT.fieldValue(), (short) 0,
        (byte) 0, (byte) 0, (short) 0, 0x00000008, 0, 5L, null, null,
        this.transcoderUtils.encodeLong(9999L));
    assertEquals(32,buffer.capacity());
    assertTrue(command.decode(null, buffer));
    assertEquals(9999L,command.getResult());
    assertEquals(0,buffer.remaining());

  }
View Full Code Here


  public void testIssue128() {
    // store command
    Command command = this.commandFactory.createSetCommand(key, key
        .getBytes(), exp, value, false, transcoder);
    command.decode(null, ByteBuffer
        .wrap("SERVER_ERROR out of memory storing object\r\n"
            .getBytes()));
    Exception e = command.getException();
    assertNotNull(e);
    assertEquals("out of memory storing object,key=test", e.getMessage());
View Full Code Here

    assertEquals("out of memory storing object,key=test", e.getMessage());

    // cas command
    command = this.commandFactory.createCASCommand(key, key.getBytes(),
        exp, value, cas, false, transcoder);
    command.decode(null, ByteBuffer
        .wrap("SERVER_ERROR out of memory storing object\r\n"
            .getBytes()));
    e = command.getException();
    assertNotNull(e);
    assertEquals("out of memory storing object,key=test", e.getMessage());
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

    ByteBuffer buffer = constructResponse(OpCode.ADD.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.ADD.fieldValue(), (short) 0,
        (byte) 0, (byte) 0, (short) 0x0005, 0, 0, 1L, null, null, null);
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 999\r\n10\r\n".getBytes())));
    assertNull(command.getResult());
    checkDecodeValidLine(command, "VALUE test 0 2 999\r\n10\r\nEND\r\n");

    assertEquals("10", new String(((CachedData) command.getResult())
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.