Search in sources :

Example 1 with GetReplicaResult

use of com.couchbase.client.java.kv.GetReplicaResult in project couchbase-jvm-clients by couchbase.

the class ReplicaReadIntegrationTest method reactiveGetAnyReturnsResult.

@Test
void reactiveGetAnyReturnsResult() throws Exception {
    String id = UUID.randomUUID().toString();
    collection.upsert(id, "Hello, World!");
    GetReplicaResult result = collection.reactive().getAnyReplica(id).block();
    assertNotNull(result);
    assertEquals("Hello, World!", result.contentAs(String.class));
}
Also used : GetReplicaResult(com.couchbase.client.java.kv.GetReplicaResult) JavaIntegrationTest(com.couchbase.client.java.util.JavaIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 2 with GetReplicaResult

use of com.couchbase.client.java.kv.GetReplicaResult in project couchbase-jvm-clients by couchbase.

the class ReplicaReadIntegrationTest method reactiveGetAllReturnsResult.

@Test
void reactiveGetAllReturnsResult() throws Exception {
    String id = UUID.randomUUID().toString();
    collection.upsert(id, "Hello, World!");
    List<GetReplicaResult> results = collection.reactive().getAllReplicas(id).collectList().block();
    assertNotNull(results);
    assertNotEquals(0, results.size());
    int primaryCount = 0;
    for (GetReplicaResult result : results) {
        if (!result.isReplica()) {
            primaryCount++;
        }
        assertEquals("Hello, World!", result.contentAs(String.class));
    }
    assertEquals(1, primaryCount);
}
Also used : GetReplicaResult(com.couchbase.client.java.kv.GetReplicaResult) JavaIntegrationTest(com.couchbase.client.java.util.JavaIntegrationTest) Test(org.junit.jupiter.api.Test)

Aggregations

GetReplicaResult (com.couchbase.client.java.kv.GetReplicaResult)2 JavaIntegrationTest (com.couchbase.client.java.util.JavaIntegrationTest)2 Test (org.junit.jupiter.api.Test)2