Package net.rubyeye.xmemcached

Examples of net.rubyeye.xmemcached.Counter.incrementAndGet()


  public void testCounter() throws Exception {
    Counter counter = memcachedClient.getCounter("a");
    Assert.assertEquals(0, counter.get());
    Assert.assertEquals(0, counter.get());

    Assert.assertEquals(1, counter.incrementAndGet());
    Assert.assertEquals(2, counter.incrementAndGet());
    Assert.assertEquals(3, counter.incrementAndGet());

    Assert.assertEquals(2, counter.decrementAndGet());
    Assert.assertEquals(1, counter.decrementAndGet());
View Full Code Here


    Counter counter = memcachedClient.getCounter("a");
    Assert.assertEquals(0, counter.get());
    Assert.assertEquals(0, counter.get());

    Assert.assertEquals(1, counter.incrementAndGet());
    Assert.assertEquals(2, counter.incrementAndGet());
    Assert.assertEquals(3, counter.incrementAndGet());

    Assert.assertEquals(2, counter.decrementAndGet());
    Assert.assertEquals(1, counter.decrementAndGet());
    Assert.assertEquals(0, counter.decrementAndGet());
View Full Code Here

    Assert.assertEquals(0, counter.get());
    Assert.assertEquals(0, counter.get());

    Assert.assertEquals(1, counter.incrementAndGet());
    Assert.assertEquals(2, counter.incrementAndGet());
    Assert.assertEquals(3, counter.incrementAndGet());

    Assert.assertEquals(2, counter.decrementAndGet());
    Assert.assertEquals(1, counter.decrementAndGet());
    Assert.assertEquals(0, counter.decrementAndGet());
    Assert.assertEquals(0, counter.decrementAndGet());
View Full Code Here

    Assert.assertEquals(7, counter.addAndGet(3));
    Assert.assertEquals(0, counter.addAndGet(-7));

    counter.set(1000);
    Assert.assertEquals(1000, counter.get());
    Assert.assertEquals(1001, counter.incrementAndGet());

    counter = memcachedClient.getCounter("b", 100);
    Assert.assertEquals(101, counter.incrementAndGet());
    Assert.assertEquals(102, counter.incrementAndGet());
    Assert.assertEquals(101, counter.decrementAndGet());
View Full Code Here

    counter.set(1000);
    Assert.assertEquals(1000, counter.get());
    Assert.assertEquals(1001, counter.incrementAndGet());

    counter = memcachedClient.getCounter("b", 100);
    Assert.assertEquals(101, counter.incrementAndGet());
    Assert.assertEquals(102, counter.incrementAndGet());
    Assert.assertEquals(101, counter.decrementAndGet());

    // test issue 74
    counter = memcachedClient.getCounter("issue74", 0);
View Full Code Here

    Assert.assertEquals(1000, counter.get());
    Assert.assertEquals(1001, counter.incrementAndGet());

    counter = memcachedClient.getCounter("b", 100);
    Assert.assertEquals(101, counter.incrementAndGet());
    Assert.assertEquals(102, counter.incrementAndGet());
    Assert.assertEquals(101, counter.decrementAndGet());

    // test issue 74
    counter = memcachedClient.getCounter("issue74", 0);
    for (int i = 0; i < 100; i++) {
View Full Code Here

    Assert.assertEquals(101, counter.decrementAndGet());

    // test issue 74
    counter = memcachedClient.getCounter("issue74", 0);
    for (int i = 0; i < 100; i++) {
      Assert.assertEquals(i + 1, counter.incrementAndGet());
    }
    for (int i = 0; i < 100; i++) {
      counter.decrementAndGet();
    }
    Assert.assertEquals(0, counter.get());
View Full Code Here

  }

  public void testIssue142() throws Exception {
    Counter counter = this.memcachedClient.getCounter("counter", 6);
    counter.get(); //
    counter.incrementAndGet(); // counter=7
    counter.decrementAndGet(); // counter=6
    counter.addAndGet(2);// counter=8
    assertEquals(8, counter.get()); // counter=8
    assertTrue(this.memcachedClient.delete("counter"));
  }
View Full Code Here

  public void testCounter() throws Exception {
    Counter counter = memcachedClient.getCounter("a");
    Assert.assertEquals(0, counter.get());
    Assert.assertEquals(0, counter.get());

    Assert.assertEquals(1, counter.incrementAndGet());
    Assert.assertEquals(2, counter.incrementAndGet());
    Assert.assertEquals(3, counter.incrementAndGet());

    Assert.assertEquals(2, counter.decrementAndGet());
    Assert.assertEquals(1, counter.decrementAndGet());
View Full Code Here

    Counter counter = memcachedClient.getCounter("a");
    Assert.assertEquals(0, counter.get());
    Assert.assertEquals(0, counter.get());

    Assert.assertEquals(1, counter.incrementAndGet());
    Assert.assertEquals(2, counter.incrementAndGet());
    Assert.assertEquals(3, counter.incrementAndGet());

    Assert.assertEquals(2, counter.decrementAndGet());
    Assert.assertEquals(1, counter.decrementAndGet());
    Assert.assertEquals(0, counter.decrementAndGet());
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.