Search in sources :

Example 1 with CASResponse

use of net.spy.memcached.CASResponse 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);
}
Also used : MemcachedClient(net.spy.memcached.MemcachedClient) CASResponse(net.spy.memcached.CASResponse) Test(org.junit.Test) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Aggregations

CASResponse (net.spy.memcached.CASResponse)1 MemcachedClient (net.spy.memcached.MemcachedClient)1 FlakyTest (org.apache.geode.test.junit.categories.FlakyTest)1 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)1 Test (org.junit.Test)1