UtilWaitThread.sleep(2000);
assertEquals(0, client.listConstraints(creds, TABLE_TEST).size());
client.updateAndFlush(creds, TABLE_TEST, mutation("row1", "cf", "cq", "x"));
String scanner = client.createScanner(creds, TABLE_TEST, null);
ScanResult more = client.nextK(scanner, 2);
client.closeScanner(scanner);
assertFalse(more.isMore());
assertEquals(1, more.getResults().size());
assertEquals(s2bb("x"), more.getResults().get(0).value);
// splits, merge
client.addSplits(creds, TABLE_TEST, new HashSet<ByteBuffer>(Arrays.asList(s2bb("a"), s2bb("m"), s2bb("z"))));
List<ByteBuffer> splits = client.listSplits(creds, TABLE_TEST, 1);
assertEquals(Arrays.asList(s2bb("m")), splits);
client.mergeTablets(creds, TABLE_TEST, null, s2bb("m"));
splits = client.listSplits(creds, TABLE_TEST, 10);
assertEquals(Arrays.asList(s2bb("m"), s2bb("z")), splits);
client.mergeTablets(creds, TABLE_TEST, null, null);
splits = client.listSplits(creds, TABLE_TEST, 10);
List<ByteBuffer> empty = Collections.emptyList();
assertEquals(empty, splits);
// iterators
client.deleteTable(creds, TABLE_TEST);
client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
HashMap<String,String> options = new HashMap<String,String>();
options.put("type", "STRING");
options.put("columns", "cf");
IteratorSetting setting = new IteratorSetting(10, TABLE_TEST, SummingCombiner.class.getName(), options);
client.attachIterator(creds, TABLE_TEST, setting, EnumSet.allOf(IteratorScope.class));
for (int i = 0; i < 10; i++) {
client.updateAndFlush(creds, TABLE_TEST, mutation("row1", "cf", "cq", "1"));
}
scanner = client.createScanner(creds, TABLE_TEST, null);
more = client.nextK(scanner, 2);
client.closeScanner(scanner);
assertEquals("10", new String(more.getResults().get(0).getValue()));
try {
client.checkIteratorConflicts(creds, TABLE_TEST, setting, EnumSet.allOf(IteratorScope.class));
fail("checkIteratorConflicts did not throw and exception");
} catch (AccumuloException ex) {}
client.deleteRows(creds, TABLE_TEST, null, null);
client.removeIterator(creds, TABLE_TEST, "test", EnumSet.allOf(IteratorScope.class));
for (int i = 0; i < 10; i++) {
client.updateAndFlush(creds, TABLE_TEST, mutation("row" + i, "cf", "cq", "" + i));
client.flushTable(creds, TABLE_TEST, null, null, true);
}
scanner = client.createScanner(creds, TABLE_TEST, null);
more = client.nextK(scanner, 100);
client.closeScanner(scanner);
assertEquals(10, more.getResults().size());
// clone
client.cloneTable(creds, TABLE_TEST, "test2", true, null, null);
scanner = client.createScanner(creds, "test2", null);
more = client.nextK(scanner, 100);
client.closeScanner(scanner);
assertEquals(10, more.getResults().size());
client.deleteTable(creds, "test2");
// don't know how to test this, call it just for fun
client.clearLocatorCache(creds, TABLE_TEST);