Skip to content

Commit

Permalink
add slist.getMember for async client (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
ou-taku14 authored and jovany-wang committed Dec 16, 2019
1 parent bb8f6b4 commit 89a5cc1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,15 @@ public CompletableFuture<SortedListProtocol.PutMemberResponse> putMember(
service.putMember(requestBuilder.build());
return future;
}

public CompletableFuture<SortedListProtocol.GetMemberResponse> getMember(
String key, String member) {
SortedListProtocol.GetMemberRequest.Builder requestBuilder =
SortedListProtocol.GetMemberRequest.newBuilder();
requestBuilder.setKey(key);
requestBuilder.setMember(member);
CompletableFuture<SortedListProtocol.GetMemberResponse> future =
service.getMember(requestBuilder.build());
return future;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ public void testAsyncSortedList() throws ExecutionException, InterruptedExceptio
Assert.assertEquals(r.getList(1).getMember(), "wlll");
});

// TestGetMember
CompletableFuture<SortedListProtocol.GetMemberResponse> getMemberFuture =
client.sortedLists().getMember("k1", "55");
getMemberFuture.whenComplete((r, t) -> {
Assert.assertEquals(r.getEntity().getMember(), "55");
Assert.assertEquals(r.getEntity().getScore(), 6);
Assert.assertEquals(r.getCount(), 4);
});

//TestDrop
CompletableFuture<CommonProtocol.DropResponse> dropFuture =
client.sortedLists().drop("k1");
Expand All @@ -71,6 +80,7 @@ public void testAsyncSortedList() throws ExecutionException, InterruptedExceptio
putItemFuture.get();
removeFuture.get();
topFuture.get();
getMemberFuture.get();
dropFuture.get();
client.disconnect();
}
Expand Down

0 comments on commit 89a5cc1

Please sign in to comment.