use of com.couchbase.client.core.msg.kv.GetResponse in project couchbase-jvm-clients by couchbase.
the class TransportEncryptionIntegrationTest method runKeyValueOperation.
private void runKeyValueOperation(Core core, CoreEnvironment env) throws Exception {
String id = UUID.randomUUID().toString();
byte[] content = "hello, world".getBytes(UTF_8);
InsertRequest insertRequest = new InsertRequest(id, content, 0, 0, kvTimeout, core.context(), CollectionIdentifier.fromDefault(config().bucketname()), env.retryStrategy(), Optional.empty(), null);
core.send(insertRequest);
InsertResponse insertResponse = insertRequest.response().get();
assertTrue(insertResponse.status().success());
GetRequest getRequest = new GetRequest(id, kvTimeout, core.context(), CollectionIdentifier.fromDefault(config().bucketname()), env.retryStrategy(), null);
core.send(getRequest);
GetResponse getResponse = getRequest.response().get();
assertTrue(getResponse.status().success());
assertArrayEquals(content, getResponse.content());
assertTrue(getResponse.cas() != 0);
}
use of com.couchbase.client.core.msg.kv.GetResponse in project couchbase-jvm-clients by couchbase.
the class KeyValueIntegrationTest method insertAndGet.
/**
* Validate that an inserted document can be read subsequently.
*/
@Test
void insertAndGet() throws Exception {
String id = UUID.randomUUID().toString();
byte[] content = "hello, world".getBytes(UTF_8);
InsertRequest insertRequest = new InsertRequest(id, content, 0, 0, kvTimeout, core.context(), CollectionIdentifier.fromDefault(config().bucketname()), env.retryStrategy(), Optional.empty(), null);
core.send(insertRequest);
InsertResponse insertResponse = insertRequest.response().get();
assertTrue(insertResponse.status().success());
GetRequest getRequest = new GetRequest(id, kvTimeout, core.context(), CollectionIdentifier.fromDefault(config().bucketname()), env.retryStrategy(), null);
core.send(getRequest);
GetResponse getResponse = getRequest.response().get();
assertTrue(getResponse.status().success());
assertArrayEquals(content, getResponse.content());
assertTrue(getResponse.cas() != 0);
}
Aggregations