// Logger logger = Logger.getLogger(Constants.CORE_PACKAGE_NAME);
// logger.setLevel(Level.TRACE);
getConnector().tableOperations().create("tt");
getConnector().tableOperations().addAggregators("tt",
Collections.singletonList(new AggregatorConfiguration(new Text("acf"), BadAggregator.class.getName())));
BatchWriter bw = getConnector().createBatchWriter("tt", 1000000, 60000l, 2);
Mutation m = new Mutation(new Text("r1"));
m.put(new Text("acf"), new Text("foo"), new Value("1".getBytes()));
bw.addMutation(m);
bw.close();
// try to scan table
Scanner scanner = getConnector().createScanner("tt", Constants.NO_AUTHS);
boolean caught = false;
try {
for (Entry<Key,Value> entry : scanner) {
entry.getKey();
}
} catch (Exception e) {
caught = true;
}
if (!caught)
throw new Exception("Scan did not fail");
// try to batch scan the table
BatchScanner bs = getConnector().createBatchScanner("tt", Constants.NO_AUTHS, 2);
bs.setRanges(Collections.singleton(new Range()));
caught = false;
try {
for (Entry<Key,Value> entry : bs) {
entry.getKey();
}
} catch (Exception e) {
caught = true;
}
if (!caught)
throw new Exception("batch scan did not fail");
List<AggregatorConfiguration> aggConfig = new ArrayList<AggregatorConfiguration>();
aggConfig.add(new AggregatorConfiguration(new Text("acf"), BadAggregator.class.getName()));
Map<String,String> props = IteratorUtil.generateInitialTableProperties(aggConfig);
// remove the bad agg so accumulo can shutdown
for (Entry<String,String> e : props.entrySet()) {
getConnector().tableOperations().removeProperty("tt", e.getKey());