Search in sources :

Example 16 with AsyncBucket

use of com.couchbase.client.java.AsyncBucket in project samza by apache.

the class TestCouchbaseTableReadFunction method testGetAsyncNonExistingKey.

@Test
public void testGetAsyncNonExistingKey() throws Exception {
    String key = "NonExistingKey";
    Bucket bucket = mock(Bucket.class);
    AsyncBucket asyncBucket = mock(AsyncBucket.class);
    CouchbaseTableReadFunction readFunction = createAndInit(String.class, new StringSerde(), bucket, asyncBucket);
    when(asyncBucket.get(eq(key), anyObject(), anyLong(), any(TimeUnit.class))).thenReturn(Observable.empty());
    assertNull(readFunction.getAsync(key).get());
}
Also used : StringSerde(org.apache.samza.serializers.StringSerde) AsyncBucket(com.couchbase.client.java.AsyncBucket) Bucket(com.couchbase.client.java.Bucket) AsyncBucket(com.couchbase.client.java.AsyncBucket) TimeUnit(java.util.concurrent.TimeUnit) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

AsyncBucket (com.couchbase.client.java.AsyncBucket)16 Bucket (com.couchbase.client.java.Bucket)12 TimeUnit (java.util.concurrent.TimeUnit)12 Test (org.junit.Test)12 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)12 StringSerde (org.apache.samza.serializers.StringSerde)6 JsonObject (com.couchbase.client.java.document.json.JsonObject)5 JsonDocument (com.couchbase.client.java.document.JsonDocument)4 CouchbaseException (com.couchbase.client.core.CouchbaseException)3 Document (com.couchbase.client.java.document.Document)3 Func1 (rx.functions.Func1)3 BackpressureException (com.couchbase.client.core.BackpressureException)1 ArrayList (java.util.ArrayList)1 Observable (rx.Observable)1