@Override public Result[] answer(InvocationOnMock invocation) throws Throwable { ScannerCallableWithReplicas callable = invocation.getArgument(0); switch (count) { case 0: // initialize count++; callable.currentScannerCallable.setMoreResultsInRegion(MoreResults.YES); return results1; case 1: count++; // The server reports back false WRT more results callable.currentScannerCallable.setMoreResultsInRegion(MoreResults.NO); return results2; case 2: // close count++; return null; default: throw new RuntimeException("Expected only 3 invocations"); } } });
@Override public Result[] answer(InvocationOnMock invocation) throws Throwable { ScannerCallableWithReplicas callable = invocation.getArgument(0); switch (count) { case 0: // initialize count++; callable.currentScannerCallable.setMoreResultsInRegion(MoreResults.NO); return results; case 1: // close count++; return null; default: throw new RuntimeException("Expected only 2 invocations"); } } });
@Override public Result[] answer(InvocationOnMock invocation) throws Throwable { ScannerCallableWithReplicas callable = invocation.getArgument(0); switch (count) { case 0: // initialize count++; // if we set no here the implementation will trigger a close callable.currentScannerCallable.setMoreResultsInRegion(MoreResults.YES); return results; case 1: // close count++; return null; default: throw new RuntimeException("Expected only 2 invocations"); } } });
@Override public Result[] answer(InvocationOnMock invocation) throws Throwable { ScannerCallableWithReplicas callable = invocation.getArgument(0); switch (count) { case 0: // initialize count++; callable.currentScannerCallable.setMoreResultsInRegion(MoreResults.UNKNOWN); return results; case 1: // detect no more results case 2: // close count++; return new Result[0]; default: throw new RuntimeException("Expected only 2 invocations"); } } });
@Override public Result[] answer(InvocationOnMock invocation) throws Throwable { ScannerCallableWithReplicas callable = invocation.getArgument(0); switch (count) { case 0: // initialize count++; // if we set no here the implementation will trigger a close callable.currentScannerCallable.setMoreResultsInRegion(MoreResults.YES); return results; case 1: // close count++; return null; default: throw new RuntimeException("Expected only 2 invocations"); } } });
setMoreResultsInRegion(MoreResults.YES); } else { setMoreResultsInRegion(MoreResults.NO); setAlreadyClosed(); setMoreResultsInRegion(MoreResults.UNKNOWN);
@Override public Result[] answer(InvocationOnMock invocation) throws Throwable { ScannerCallableWithReplicas callable = invocation.getArgument(0); switch (count) { case 0: // initialize count++; callable.currentScannerCallable.setMoreResultsInRegion(MoreResults.NO); return results; case 1: // close count++; return null; default: throw new RuntimeException("Expected only 2 invocations"); } } });
@Override public Result[] answer(InvocationOnMock invocation) throws Throwable { ScannerCallableWithReplicas callable = invocation.getArgument(0); switch (count) { case 0: // initialize count++; callable.currentScannerCallable.setMoreResultsInRegion(MoreResults.YES); return results1; case 1: count++; // The server reports back false WRT more results callable.currentScannerCallable.setMoreResultsInRegion(MoreResults.NO); return results2; case 2: // close count++; return null; default: throw new RuntimeException("Expected only 3 invocations"); } } });
@Override public Result[] answer(InvocationOnMock invocation) throws Throwable { ScannerCallableWithReplicas callable = invocation.getArgument(0); switch (count) { case 0: // initialize count++; callable.currentScannerCallable.setMoreResultsInRegion(MoreResults.UNKNOWN); return results; case 1: // detect no more results case 2: // close count++; return new Result[0]; default: throw new RuntimeException("Expected only 2 invocations"); } } });
@Override public Result[] answer(InvocationOnMock invocation) throws Throwable { ScannerCallableWithReplicas callable = invocation.getArgument(0); switch (count) { case 0: // initialize count++; // if we set no here the implementation will trigger a close callable.currentScannerCallable.setMoreResultsInRegion(MoreResults.YES); return results; case 1: // close count++; return null; default: throw new RuntimeException("Expected only 2 invocations"); } } });
@Override public Result[] answer(InvocationOnMock invocation) throws Throwable { ScannerCallableWithReplicas callable = invocation.getArgument(0); switch (count) { case 0: // initialize count++; // if we set no here the implementation will trigger a close callable.currentScannerCallable.setMoreResultsInRegion(MoreResults.YES); return results; case 1: // close count++; return null; default: throw new RuntimeException("Expected only 2 invocations"); } } });
setMoreResultsInRegion(MoreResults.YES); } else { setMoreResultsInRegion(MoreResults.NO); setAlreadyClosed(); setMoreResultsInRegion(MoreResults.UNKNOWN);
setMoreResultsInRegion(MoreResults.YES); } else { setMoreResultsInRegion(MoreResults.NO); setAlreadyClosed(); setMoreResultsInRegion(MoreResults.UNKNOWN);