Package net.rubyeye.xmemcached.helper

Examples of net.rubyeye.xmemcached.helper.BlankKeyChecker


    }.check();
    Thread.sleep(2000);
    // expire
    assertNull(memcachedClient.get("name"));
    // blank key
    new BlankKeyChecker() {
      @Override
      public void call() throws Exception {
        memcachedClient.get("");
      }
    }.check();
    // null key
    new BlankKeyChecker() {
      @Override
      public void call() throws Exception {
        memcachedClient.get((String) null);
      }
    }.check();
View Full Code Here


    memcachedClient.delete("name");
    assertFalse(memcachedClient.prepend("name", "hello ", 2000));
    assertFalse(memcachedClient.append("name", " zhuang", 2000));
    // append test
    // blank key
    new BlankKeyChecker() {
      @Override
      public void call() throws Exception {
        memcachedClient.append("", 0, 1);
      }
    }.check();
    // null key
    new BlankKeyChecker() {
      @Override
      public void call() throws Exception {
        memcachedClient.append((String) null, 0, 1);
      }
    }.check();

    // invalid key
    new InValidKeyChecker() {
      @Override
      public void call() throws Exception {
        memcachedClient.append("test\r\n", 0, 1);
      }
    }.check();
    new InValidKeyChecker() {
      @Override
      public void call() throws Exception {
        memcachedClient.append("test test2", 0, 1);
      }
    }.check();

    // key is too long
    new TooLongKeyChecker(memcachedClient) {
      @Override
      public void call() throws Exception {
        int keyLength = memcachedClient.getProtocol() == Protocol.Text ? 256
            : 65536;
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < keyLength; i++) {
          sb.append(i);
        }
        memcachedClient.append(sb.toString(), 0, 1);
      }
    }.check();

    // prepend test
    // blank key
    new BlankKeyChecker() {
      @Override
      public void call() throws Exception {
        memcachedClient.prepend("", 0, 1);
      }
    }.check();
    // null key
    new BlankKeyChecker() {
      @Override
      public void call() throws Exception {
        memcachedClient.prepend((String) null, 0, 1);
      }
    }.check();
View Full Code Here

    Thread.sleep(2000);
    // expired
    assertNull(memcachedClient.get("zhuang"));

    // blank key
    new BlankKeyChecker() {
      @Override
      public void call() throws Exception {
        memcachedClient.set("", 0, 1);
      }
    }.check();
    // null key
    new BlankKeyChecker() {
      @Override
      public void call() throws Exception {
        memcachedClient.set((String) null, 0, 1);
      }
    }.check();
View Full Code Here

    Thread.sleep(2000);
    // expire
    assertNull(memcachedClient.get("name"));

    // blank key
    new BlankKeyChecker() {
      @Override
      public void call() throws Exception {
        memcachedClient.replace("", 0, 1);
      }
    }.check();
    // null key
    new BlankKeyChecker() {
      @Override
      public void call() throws Exception {
        memcachedClient.replace((String) null, 0, 1);
      }
    }.check();
View Full Code Here

    assertTrue(memcachedClient.add("name", 0, "dennis"));
    assertFalse(memcachedClient.add("name", 0, "dennis"));
    assertEquals("dennis", memcachedClient.get("name", 2000));

    // blank key
    new BlankKeyChecker() {
      @Override
      public void call() throws Exception {
        memcachedClient.add("", 0, 1);
      }
    }.check();
    // null key
    new BlankKeyChecker() {
      @Override
      public void call() throws Exception {
        memcachedClient.add((String) null, 0, 1);
      }
    }.check();
View Full Code Here

    getsResponse = memcachedClient.gets("name", 2000);
    assertEquals("zhuang", getsResponse.getValue());
    assertFalse(oldCas == getsResponse.getCas());

    // blank key
    new BlankKeyChecker() {
      @Override
      public void call() throws Exception {
        memcachedClient.gets("");
      }
    }.check();
    // null key
    new BlankKeyChecker() {
      @Override
      public void call() throws Exception {
        memcachedClient.gets((String) null);
      }
    }.check();
View Full Code Here

    assertEquals(1, memcachedClient.incr("娴��", 5, 1, 1000, 0));
    assertEquals(6, memcachedClient.incr("娴��", 5));
    assertEquals(10, memcachedClient.incr("娴��", 4));

    // blank key
    new BlankKeyChecker() {
      @Override
      public void call() throws Exception {
        memcachedClient.incr("", 0, 1);
      }
    }.check();
    // null key
    new BlankKeyChecker() {
      @Override
      public void call() throws Exception {
        memcachedClient.incr((String) null, 0, 1);
      }
    }.check();
View Full Code Here

    assertEquals(1, memcachedClient.decr("a", 5, 1, 1000, 1));
    Thread.sleep(2000);
    assertNull(memcachedClient.get("a"));

    // blank key
    new BlankKeyChecker() {
      @Override
      public void call() throws Exception {
        memcachedClient.decr("", 0, 1);
      }
    }.check();
    // null key
    new BlankKeyChecker() {
      @Override
      public void call() throws Exception {
        memcachedClient.decr((String) null, 0, 1);
      }
    }.check();
View Full Code Here

    assertFalse(memcachedClient.cas("name", 0, "zhuang",
        getsResponse.getCas()));
    assertEquals("dennis", memcachedClient.get("name"));

    // blank key
    new BlankKeyChecker() {
      @Override
      public void call() throws Exception {
        memcachedClient.cas("", operation);
      }
    }.check();
    // null key
    new BlankKeyChecker() {
      @Override
      public void call() throws Exception {
        memcachedClient.cas((String) null, operation);
      }
    }.check();
View Full Code Here

    }.check();
    Thread.sleep(2000);
    // expire
    assertNull(memcachedClient.get("name"));
    // blank key
    new BlankKeyChecker() {
      @Override
      public void call() throws Exception {
        memcachedClient.get("");
      }
    }.check();
    // null key
    new BlankKeyChecker() {
      @Override
      public void call() throws Exception {
        memcachedClient.get((String) null);
      }
    }.check();
View Full Code Here

TOP

Related Classes of net.rubyeye.xmemcached.helper.BlankKeyChecker

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.