use of org.apache.accumulo.core.client.mapred.AccumuloInputFormat in project accumulo by apache.
the class AccumuloInputFormatIT method testCorrectRangeInputSplits.
@Test
public void testCorrectRangeInputSplits() throws Exception {
JobConf job = new JobConf();
String table = getUniqueNames(1)[0];
Authorizations auths = new Authorizations("foo");
Collection<Pair<Text, Text>> fetchColumns = Collections.singleton(new Pair<>(new Text("foo"), new Text("bar")));
boolean isolated = true, localIters = true;
Level level = Level.WARN;
Connector connector = getConnector();
connector.tableOperations().create(table);
AccumuloInputFormat.setConnectionInfo(job, getConnectionInfo());
AccumuloInputFormat.setInputTableName(job, table);
AccumuloInputFormat.setScanAuthorizations(job, auths);
AccumuloInputFormat.setScanIsolation(job, isolated);
AccumuloInputFormat.setLocalIterators(job, localIters);
AccumuloInputFormat.fetchColumns(job, fetchColumns);
AccumuloInputFormat.setLogLevel(job, level);
AccumuloInputFormat aif = new AccumuloInputFormat();
InputSplit[] splits = aif.getSplits(job, 1);
Assert.assertEquals(1, splits.length);
InputSplit split = splits[0];
Assert.assertEquals(RangeInputSplit.class, split.getClass());
RangeInputSplit risplit = (RangeInputSplit) split;
Assert.assertEquals(getAdminPrincipal(), risplit.getPrincipal());
Assert.assertEquals(table, risplit.getTableName());
Assert.assertEquals(getAdminToken(), risplit.getToken());
Assert.assertEquals(auths, risplit.getAuths());
Assert.assertEquals(getConnector().getInstance().getInstanceName(), risplit.getInstanceName());
Assert.assertEquals(isolated, risplit.isIsolatedScan());
Assert.assertEquals(localIters, risplit.usesLocalIterators());
Assert.assertEquals(fetchColumns, risplit.getFetchedColumns());
Assert.assertEquals(level, risplit.getLogLevel());
}
Aggregations