use of net.spy.memcached.MemcachedClient in project geode by apache.
the class GemcachedDevelopmentJUnitTest method testExpiration.
// GEODE-1140: time sensitive, thread sleep
@Category(FlakyTest.class)
@Test
public void testExpiration() throws Exception {
MemcachedClient client = bootstrapClient();
// we add with expiration 10 seconds
Thread.sleep(15 * 1000);
assertNull(client.get("key"));
}
use of net.spy.memcached.MemcachedClient in project geode by apache.
the class GemcachedDevelopmentJUnitTest method testPrepend.
@Test
public void testPrepend() throws Exception {
MemcachedClient client = bootstrapClient();
Future<Boolean> b = client.prepend(0, "key", "prepended");
assertTrue(b.get());
assertEquals("prependedmyStringValue", client.get("key"));
b = client.prepend(0, "prependkey", "val");
assertFalse(b.get());
assertNull(client.get("prependkey"));
}
use of net.spy.memcached.MemcachedClient in project geode by apache.
the class GemcachedDevelopmentJUnitTest method testIncr.
@Test
public void testIncr() throws Exception {
MemcachedClient client = bootstrapClient();
client.add("incrkey", 10, 99).get();
assertEquals(104, client.incr("incrkey", 5));
assertEquals(105, client.incr("incrkey", 1));
assertEquals(-1, client.incr("inckey1", 10));
}
use of net.spy.memcached.MemcachedClient in project geode by apache.
the class GemcachedDevelopmentJUnitTest method testCas.
@Test
public void testCas() throws Exception {
MemcachedClient client = bootstrapClient();
client.add("caskey", 10, "casValue").get();
CASValue<Object> val = client.gets("caskey");
assertEquals("casValue", val.getValue());
CASResponse r = client.cas("caskey", val.getCas(), "newValue");
assertEquals(CASResponse.OK, r);
r = client.cas("caskey", val.getCas(), "newValue2");
assertEquals(CASResponse.EXISTS, r);
}
use of net.spy.memcached.MemcachedClient in project geode by apache.
the class GemcachedDevelopmentJUnitTest method testDelete.
@Test
public void testDelete() throws Exception {
MemcachedClient client = bootstrapClient();
Future<Boolean> b = client.delete("key");
assertTrue(b.get());
b = client.delete("nonExistentkey");
assertFalse(b.get());
}
Aggregations