Search in sources :

Example 6 with UpsertResponse

use of com.couchbase.client.core.msg.kv.UpsertResponse in project couchbase-jvm-clients by couchbase.

the class MutationTokenIntegrationTest method tokenOnAppend.

@Test
void tokenOnAppend() throws Exception {
    String id = UUID.randomUUID().toString();
    byte[] content = "hello".getBytes(UTF_8);
    UpsertRequest upsertRequest = new UpsertRequest(id, content, 0, false, 0, kvTimeout, core.context(), collectionIdentifier, env.retryStrategy(), Optional.empty(), null);
    core.send(upsertRequest);
    UpsertResponse upsertResponse = upsertRequest.response().get();
    assertTrue(upsertResponse.status().success());
    assertMutationToken(upsertResponse.mutationToken());
    AppendRequest appendRequest = new AppendRequest(kvTimeout, core.context(), collectionIdentifier, env.retryStrategy(), id, ", world".getBytes(UTF_8), upsertResponse.cas(), Optional.empty(), null);
    core.send(appendRequest);
    AppendResponse appendResponse = appendRequest.response().get();
    assertTrue(appendResponse.status().success());
    assertMutationToken(appendResponse.mutationToken());
}
Also used : UpsertResponse(com.couchbase.client.core.msg.kv.UpsertResponse) UpsertRequest(com.couchbase.client.core.msg.kv.UpsertRequest) AppendResponse(com.couchbase.client.core.msg.kv.AppendResponse) AppendRequest(com.couchbase.client.core.msg.kv.AppendRequest) CoreIntegrationTest(com.couchbase.client.core.util.CoreIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 7 with UpsertResponse

use of com.couchbase.client.core.msg.kv.UpsertResponse in project couchbase-jvm-clients by couchbase.

the class MutationTokenIntegrationTest method tokenOnUpsert.

@Test
void tokenOnUpsert() throws Exception {
    String id = UUID.randomUUID().toString();
    byte[] content = "hello, world".getBytes(UTF_8);
    UpsertRequest upsertRequest = new UpsertRequest(id, content, 0, false, 0, kvTimeout, core.context(), collectionIdentifier, env.retryStrategy(), Optional.empty(), null);
    core.send(upsertRequest);
    UpsertResponse upsertResponse = upsertRequest.response().get();
    assertTrue(upsertResponse.status().success());
    assertMutationToken(upsertResponse.mutationToken());
}
Also used : UpsertResponse(com.couchbase.client.core.msg.kv.UpsertResponse) UpsertRequest(com.couchbase.client.core.msg.kv.UpsertRequest) CoreIntegrationTest(com.couchbase.client.core.util.CoreIntegrationTest) Test(org.junit.jupiter.api.Test)

Aggregations

UpsertRequest (com.couchbase.client.core.msg.kv.UpsertRequest)7 UpsertResponse (com.couchbase.client.core.msg.kv.UpsertResponse)7 CoreIntegrationTest (com.couchbase.client.core.util.CoreIntegrationTest)7 Test (org.junit.jupiter.api.Test)7 AppendRequest (com.couchbase.client.core.msg.kv.AppendRequest)1 AppendResponse (com.couchbase.client.core.msg.kv.AppendResponse)1 PrependRequest (com.couchbase.client.core.msg.kv.PrependRequest)1 PrependResponse (com.couchbase.client.core.msg.kv.PrependResponse)1 RemoveRequest (com.couchbase.client.core.msg.kv.RemoveRequest)1 RemoveResponse (com.couchbase.client.core.msg.kv.RemoveResponse)1 ReplaceRequest (com.couchbase.client.core.msg.kv.ReplaceRequest)1 ReplaceResponse (com.couchbase.client.core.msg.kv.ReplaceResponse)1 SubdocMutateRequest (com.couchbase.client.core.msg.kv.SubdocMutateRequest)1 SubdocMutateResponse (com.couchbase.client.core.msg.kv.SubdocMutateResponse)1 IgnoreWhen (com.couchbase.client.test.IgnoreWhen)1 ArrayList (java.util.ArrayList)1