Package redis.reply

Examples of redis.reply.ErrorReply


      assertEquals(message, receive.data());
    }
    {
      os = new ByteArrayOutputStream();
      String message = "OK";
      new ErrorReply(message).write(os);
      receive = RedisProtocol.receive(new ByteArrayInputStream(os.toByteArray()));
      assertTrue(receive instanceof ErrorReply);
      assertEquals(message, receive.data());
    }
    {
      os = new ByteArrayOutputStream();
      String message = "OK";
      new BulkReply(message.getBytes()).write(os);
      receive = RedisProtocol.receive(new ByteArrayInputStream(os.toByteArray()));
      assertTrue(receive instanceof BulkReply);
      assertEquals(message, new String((byte[]) receive.data()));
    }
    {
      os = new ByteArrayOutputStream();
      long integer = 999;
      new IntegerReply(integer).write(os);
      receive = RedisProtocol.receive(new ByteArrayInputStream(os.toByteArray()));
      assertTrue(receive instanceof IntegerReply);
      assertEquals(integer, receive.data());
    }
    {
      os = new ByteArrayOutputStream();
      String message = "OK";
      long integer = 999;
      new MultiBulkReply(new Reply[] {
              new StatusReply(message),
              new ErrorReply(message),
              new MultiBulkReply(new Reply[] { new StatusReply(message)}),
              new BulkReply(message.getBytes()),
              new IntegerReply(integer)}).write(os);
      receive = RedisProtocol.receive(new ByteArrayInputStream(os.toByteArray()));
      assertTrue(receive instanceof MultiBulkReply);
View Full Code Here


    assertTrue(execResults.get());

    // The result of restore is supposed to be a ListenableFuture<StatusReply>, which I can't cast
    // to ErrorReply. Should get() throw an Exception instead?
    try {
      ErrorReply reply = (ErrorReply) restoreResults.get();
      fail("Should have thrown an exception");
    } catch (ExecutionException re) {
      Assert.assertTrue(re.getCause() instanceof RedisException);
    } catch (Exception e) {
      fail("Should have thrown an ExecutionException");
View Full Code Here

    switch (code) {
      case StatusReply.MARKER: {
        return new StatusReply(new DataInputStream(is).readLine());
      }
      case ErrorReply.MARKER: {
        return new ErrorReply(new DataInputStream(is).readLine());
      }
      case IntegerReply.MARKER: {
        return new IntegerReply(readLong(is));
      }
      case BulkReply.MARKER: {
View Full Code Here

TOP

Related Classes of redis.reply.ErrorReply

Copyright © 2018 www.massapicom. 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.