MCPcopy Index your code
hub / github.com/OpenTSDB/opentsdb / setupMockScanners

Method setupMockScanners

test/core/TestSaltScanner.java:455–481  ·  view source on GitHub ↗

Sets up a pair of scanners with either a list of values or no data @param no_data Whether or not to return 0 data.

(final boolean no_data)

Source from the content-addressed store, hash-verified

453 * @param no_data Whether or not to return 0 data.
454 */
455 protected void setupMockScanners(final boolean no_data) throws Exception {
456 if (Const.SALT_WIDTH() > 0) {
457 scanners = new ArrayList<Scanner>(Const.SALT_BUCKETS());
458 scanner_a = mock(Scanner.class);
459 scanner_b = mock(Scanner.class);
460 if (no_data) {
461 when(scanner_a.nextRows()).thenReturn(
462 Deferred.<ArrayList<ArrayList<KeyValue>>>fromResult(null));
463 when(scanner_b.nextRows()).thenReturn(
464 Deferred.<ArrayList<ArrayList<KeyValue>>>fromResult(null));
465 } else {
466 setupValues();
467 }
468 scanners.add(scanner_a);
469 scanners.add(scanner_b);
470 } else {
471 scanners = new ArrayList<Scanner>(1);
472 scanner_a = mock(Scanner.class);
473 if (no_data) {
474 when(scanner_a.nextRows()).thenReturn(
475 Deferred.<ArrayList<ArrayList<KeyValue>>>fromResult(null));
476 } else {
477 setupValues();
478 }
479 scanners.add(scanner_a);
480 }
481 }
482
483 /**
484 * This method sets up some row keys and values to pass to the scanners.

Callers 15

beforeLocalMethod · 0.95
scanMethod · 0.95
scanWithFilterMethod · 0.95
scanWithTwoFilterMethod · 0.95
scanWithFilterNoMatchMethod · 0.95
scanBadRowKeyMethod · 0.95

Calls 4

SALT_WIDTHMethod · 0.95
SALT_BUCKETSMethod · 0.95
setupValuesMethod · 0.95
addMethod · 0.45

Tested by

no test coverage detected