use of org.apache.accumulo.core.client.Connector in project accumulo by apache.
the class DeleteEverythingIT method updateMajcDelay.
@Before
public void updateMajcDelay() throws Exception {
Connector c = getConnector();
majcDelay = c.instanceOperations().getSystemConfiguration().get(Property.TSERV_MAJC_DELAY.getKey());
c.instanceOperations().setProperty(Property.TSERV_MAJC_DELAY.getKey(), "1s");
if (getClusterType() == ClusterType.STANDALONE) {
// Gotta wait for the cluster to get out of the default sleep value
Thread.sleep(ConfigurationTypeHelper.getTimeInMillis(majcDelay));
}
}
use of org.apache.accumulo.core.client.Connector in project accumulo by apache.
the class DeleteEverythingIT method run.
@Test
public void run() throws Exception {
Connector c = getConnector();
String tableName = getUniqueNames(1)[0];
c.tableOperations().create(tableName);
BatchWriter bw = getConnector().createBatchWriter(tableName, new BatchWriterConfig());
Mutation m = new Mutation(new Text("foo"));
m.put(new Text("bar"), new Text("1910"), new Value("5".getBytes(UTF_8)));
bw.addMutation(m);
bw.flush();
getConnector().tableOperations().flush(tableName, null, null, true);
FunctionalTestUtils.checkRFiles(c, tableName, 1, 1, 1, 1);
m = new Mutation(new Text("foo"));
m.putDelete(new Text("bar"), new Text("1910"));
bw.addMutation(m);
bw.flush();
try (Scanner scanner = getConnector().createScanner(tableName, Authorizations.EMPTY)) {
scanner.setRange(new Range());
int count = Iterators.size(scanner.iterator());
assertEquals("count == " + count, 0, count);
getConnector().tableOperations().flush(tableName, null, null, true);
getConnector().tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "1.0");
sleepUninterruptibly(4, TimeUnit.SECONDS);
FunctionalTestUtils.checkRFiles(c, tableName, 1, 1, 0, 0);
bw.close();
count = Iterables.size(scanner);
if (count != 0) {
throw new Exception("count == " + count);
}
}
}
use of org.apache.accumulo.core.client.Connector in project accumulo by apache.
the class DeleteEverythingIT method resetMajcDelay.
@After
public void resetMajcDelay() throws Exception {
Connector c = getConnector();
c.instanceOperations().setProperty(Property.TSERV_MAJC_DELAY.getKey(), majcDelay);
}
use of org.apache.accumulo.core.client.Connector in project accumulo by apache.
the class DeleteIT method test.
@Test
public void test() throws Exception {
Connector c = getConnector();
String tableName = getUniqueNames(1)[0];
c.tableOperations().create(tableName);
AuthenticationToken token = getAdminToken();
if (token instanceof KerberosToken) {
deleteTest(c, getCluster(), getAdminPrincipal(), null, tableName, getAdminUser().getKeytab().getAbsolutePath());
} else if (token instanceof PasswordToken) {
PasswordToken passwdToken = (PasswordToken) token;
deleteTest(c, getCluster(), getAdminPrincipal(), new String(passwdToken.getPassword(), UTF_8), tableName, null);
}
}
use of org.apache.accumulo.core.client.Connector in project accumulo by apache.
the class DeleteRowsIT method testDeleteAllRows.
@Test(timeout = 5 * 60 * 1000)
public void testDeleteAllRows() throws Exception {
Connector c = getConnector();
String[] tableNames = this.getUniqueNames(20);
for (String tableName : tableNames) {
c.tableOperations().create(tableName);
c.tableOperations().deleteRows(tableName, null, null);
try (Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY)) {
assertEquals(0, Iterators.size(scanner.iterator()));
}
}
}
Aggregations