Package net.rubyeye.xmemcached.test.unittest.mock

Examples of net.rubyeye.xmemcached.test.unittest.mock.MockErrorCommand


    final String key = "name";
    memcachedClient.set(key, 0, "dennis");
    assertEquals("dennis", memcachedClient.get(key));
    CountDownLatch latch = new CountDownLatch(1);
    int currentServerCount = memcachedClient.getAvaliableServers().size();
    MockErrorCommand errorCommand = null;
    if (memcachedClient.getProtocol() == Protocol.Text) {
      errorCommand = new MockErrorTextGetOneCommand(key, key.getBytes(),
          CommandType.GET_ONE, latch);
    } else {
      errorCommand = new MockErrorBinaryGetOneCommand(key,
          key.getBytes(), CommandType.GET_ONE, latch, OpCode.GET,
          false);
    }
    memcachedClient.getConnector().send((Command) errorCommand);
    latch.await(MemcachedClient.DEFAULT_OP_TIMEOUT, TimeUnit.MILLISECONDS);
    assertTrue(errorCommand.isDecoded());
    // wait for reconnecting
    Thread.sleep(2000 * 3);
    assertEquals(currentServerCount, memcachedClient.getAvaliableServers()
        .size());
    // It works
View Full Code Here


    final String key = "name";
    memcachedClient.set(key, 0, "dennis");
    assertEquals("dennis", memcachedClient.get(key));
    CountDownLatch latch = new CountDownLatch(1);
    int currentServerCount = memcachedClient.getAvaliableServers().size();
    MockErrorCommand errorCommand = null;
    if (memcachedClient.getProtocol() == Protocol.Text) {
      errorCommand = new MockErrorTextGetOneCommand(key, key.getBytes(),
          CommandType.GET_ONE, latch);
    } else {
      errorCommand = new MockErrorBinaryGetOneCommand(key,
          key.getBytes(), CommandType.GET_ONE, latch, OpCode.GET,
          false);
    }
    memcachedClient.getConnector().send((Command) errorCommand);
    latch.await(MemcachedClient.DEFAULT_OP_TIMEOUT, TimeUnit.MILLISECONDS);
    assertTrue(errorCommand.isDecoded());
    // wait for reconnecting
    Thread.sleep(2000 * 3);
    assertEquals(currentServerCount, memcachedClient.getAvaliableServers()
        .size());
    // It works
View Full Code Here

TOP

Related Classes of net.rubyeye.xmemcached.test.unittest.mock.MockErrorCommand

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.