Examples of cas()


Examples of com.couchbase.client.java.document.JsonDocument.cas()

        JsonDocument removed = bucket().remove(doc);
        assertEquals(doc.id(), removed.id());
        assertNull(removed.content());
        assertEquals(0, removed.expiry());
        assertTrue(removed.cas() != 0);

        assertNull(bucket().get("upsert"));
    }

    @Test
View Full Code Here

Examples of com.couchbase.client.java.document.JsonDocument.cas()

        assertEquals(content.getString("hello"), response.content().getString("hello"));

        JsonDocument removed = bucket().remove(response);
        assertEquals(removed.id(), response.id());
        assertNull(removed.content());
        assertTrue(removed.cas() != 0);
        assertNotEquals(response.cas(), removed.cas());

        assertNull(bucket().get(id));
    }
View Full Code Here

Examples of com.couchbase.client.java.document.JsonDocument.cas()

        JsonDocument removed = bucket().remove(response);
        assertEquals(removed.id(), response.id());
        assertNull(removed.content());
        assertTrue(removed.cas() != 0);
        assertNotEquals(response.cas(), removed.cas());

        assertNull(bucket().get(id));
    }

  @Test
View Full Code Here

Examples of com.couchbase.client.java.document.JsonDocument.cas()

            assertTrue(false);
        } catch(CASMismatchException ex) {
            assertTrue(true);
        }

        boolean unlocked = bucket().unlock(key, locked.cas());
        assertTrue(unlocked);

        bucket().upsert(JsonDocument.create(key, JsonObject.empty().put("k", "v")));
    }
View Full Code Here

Examples of com.couchbase.client.java.document.JsonDocument.cas()

            ViewRow row = rows.next();

            assertNotNull(row);
            JsonDocument doc = row.document();
            assertTrue(doc.id().startsWith("user-"));
            assertTrue(doc.cas() != 0);
            assertTrue(doc.expiry() == 0);

            assertTrue(doc.content().getString("name").startsWith("Mr. Foo Bar"));
            assertTrue(doc.content().getString("type").equals("user"));
        }
View Full Code Here

Examples of com.couchbase.client.java.document.JsonLongDocument.cas()

        JsonLongDocument doc3 = bucket().counter("incr-key", 10, 0, 0);
        assertEquals(20L, (long) doc3.content());

        assertTrue(doc1.cas() != doc2.cas());
        assertTrue(doc1.cas() != doc3.cas());
        assertTrue(doc2.cas() != doc3.cas());
    }

    @Test
    public void shouldDecrementFromCounter() throws Exception {
View Full Code Here

Examples of com.couchbase.client.java.document.JsonLongDocument.cas()

        JsonLongDocument doc3 = bucket().counter("incr-key", 10, 0, 0);
        assertEquals(20L, (long) doc3.content());

        assertTrue(doc1.cas() != doc2.cas());
        assertTrue(doc1.cas() != doc3.cas());
        assertTrue(doc2.cas() != doc3.cas());
    }

    @Test
    public void shouldDecrementFromCounter() throws Exception {
        JsonLongDocument doc1 = bucket().counter("decr-key", -10, 100, 0);
View Full Code Here

Examples of com.couchbase.client.java.document.JsonLongDocument.cas()

        JsonLongDocument doc3 = bucket().counter("decr-key", -10, 0, 0);
        assertEquals(80L, (long) doc3.content());

        assertTrue(doc1.cas() != doc2.cas());
        assertTrue(doc1.cas() != doc3.cas());
        assertTrue(doc2.cas() != doc3.cas());
    }

    @Test
    public void shouldGetAndTouch() throws Exception {
View Full Code Here

Examples of com.couchbase.client.java.document.JsonLongDocument.cas()

        JsonLongDocument doc3 = bucket().counter("decr-key", -10, 0, 0);
        assertEquals(80L, (long) doc3.content());

        assertTrue(doc1.cas() != doc2.cas());
        assertTrue(doc1.cas() != doc3.cas());
        assertTrue(doc2.cas() != doc3.cas());
    }

    @Test
    public void shouldGetAndTouch() throws Exception {
        String id = "get-and-touch";
View Full Code Here

Examples of com.couchbase.client.java.document.LegacyDocument.cas()

        bucket().upsert(doc);

        LegacyDocument stored = bucket().append(LegacyDocument.create(id, "bar"));
        assertEquals(id, stored.id());
        assertNull(stored.content());
        assertTrue(stored.cas() != 0);
        assertTrue(stored.expiry() == 0);

        LegacyDocument found = bucket().get(id, LegacyDocument.class);
        assertEquals("foobar", found.content());
    }
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.