use of org.apache.accumulo.examples.cli.ScannerOpts in project accumulo-examples by apache.
the class TracingExample method main.
public static void main(String[] args) throws Exception {
try {
TracingExample tracingExample = new TracingExample();
Opts opts = new Opts();
ScannerOpts scannerOpts = new ScannerOpts();
opts.parseArgs(TracingExample.class.getName(), args, scannerOpts);
tracingExample.enableTracing(opts);
tracingExample.execute(opts);
} catch (Exception e) {
log.error("Caught exception running TraceExample", e);
System.exit(1);
}
}
use of org.apache.accumulo.examples.cli.ScannerOpts in project accumulo-examples by apache.
the class CountIT method test.
@Test
public void test() throws Exception {
Scanner scanner = conn.createScanner(tableName, new Authorizations());
scanner.fetchColumn(new Text("dir"), new Text("counts"));
assertFalse(scanner.iterator().hasNext());
ScannerOpts scanOpts = new ScannerOpts();
BatchWriterOpts bwOpts = new BatchWriterOpts();
FileCount fc = new FileCount(conn, tableName, Authorizations.EMPTY, new ColumnVisibility(), scanOpts, bwOpts);
fc.run();
ArrayList<Pair<String, String>> expected = new ArrayList<>();
expected.add(new Pair<>(QueryUtil.getRow("").toString(), "1,0,3,3"));
expected.add(new Pair<>(QueryUtil.getRow("/local").toString(), "2,1,2,3"));
expected.add(new Pair<>(QueryUtil.getRow("/local/user1").toString(), "0,2,0,2"));
expected.add(new Pair<>(QueryUtil.getRow("/local/user2").toString(), "0,0,0,0"));
int i = 0;
for (Entry<Key, Value> e : scanner) {
assertEquals(e.getKey().getRow().toString(), expected.get(i).getFirst());
assertEquals(e.getValue().toString(), expected.get(i).getSecond());
i++;
}
assertEquals(i, expected.size());
}
Aggregations