Search in sources :

Example 1 with PutOption

use of com.coreos.jetcd.options.PutOption in project jetcd by coreos.

the class KVTest method testPutWithNotExistLease.

@Test
public void testPutWithNotExistLease() throws Exception {
    ByteString sampleKey = ByteString.copyFrom("sample_key", "UTF-8");
    ByteString sampleValue = ByteString.copyFrom("sample_value", "UTF-8");
    PutOption option = PutOption.newBuilder().withLeaseId(99999).build();
    ListenableFuture<PutResponse> feature = kvClient.put(sampleKey, sampleValue, option);
    try {
        PutResponse response = feature.get();
        test.assertTrue(response.hasHeader());
    } catch (Exception e) {
    // empty
    }
}
Also used : ByteString(com.google.protobuf.ByteString) PutOption(com.coreos.jetcd.options.PutOption) PutResponse(com.coreos.jetcd.api.PutResponse) ExecutionException(java.util.concurrent.ExecutionException) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest)

Aggregations

PutResponse (com.coreos.jetcd.api.PutResponse)1 PutOption (com.coreos.jetcd.options.PutOption)1 ByteString (com.google.protobuf.ByteString)1 ExecutionException (java.util.concurrent.ExecutionException)1 BeforeTest (org.testng.annotations.BeforeTest)1 Test (org.testng.annotations.Test)1