use of org.apache.zookeeper.AsyncCallback.DataCallback in project bookkeeper by apache.
the class MockZooKeeperTestCase method mockZkGetData.
protected void mockZkGetData(String expectedLedgerPath, boolean expectedWatcher, int retCode, byte[] retData, Stat retStat) throws Exception {
doAnswer(invocationOnMock -> {
String path = invocationOnMock.getArgument(0);
Watcher watcher = invocationOnMock.getArgument(1);
DataCallback callback = invocationOnMock.getArgument(2);
Object ctx = invocationOnMock.getArgument(3);
if (Code.OK == retCode) {
addWatcher(path, watcher);
}
callback.processResult(retCode, path, ctx, retData, retStat);
return null;
}).when(mockZk).getData(eq(expectedLedgerPath), expectedWatcher ? any(Watcher.class) : eq(null), any(DataCallback.class), any());
}
Aggregations