use of org.apache.hadoop.hive.metastore.RawStore in project hive by apache.
the class TestHBaseImport method importOneRole.
// TODO test for bogus function name
// TODO test for bogus table name
// TODO test for non-existent items
@Test
public void importOneRole() throws Exception {
RawStore rdbms;
rdbms = new ObjectStore();
rdbms.setConf(conf);
String[] dbNames = new String[] { "oneroledb1", "oneroledb2" };
String[] roles = new String[] { "onerolerole1", "onerolerole2" };
String[] tokenIds = new String[] { "oneroletokenid1", "oneroletokenid2" };
String[] tokens = new String[] { "oneroletoken1", "oneroletoken2" };
String[] masterKeys = new String[] { "onerolemk1", "onerolemk2" };
int now = (int) System.currentTimeMillis() / 1000;
setupObjectStore(rdbms, roles, dbNames, tokenIds, tokens, masterKeys, now);
int baseNumRoles = store.listRoleNames() == null ? 0 : store.listRoleNames().size();
int baseNumDbs = store.getAllDatabases() == null ? 0 : store.getAllDatabases().size();
int baseNumToks = store.getAllTokenIdentifiers() == null ? 0 : store.getAllTokenIdentifiers().size();
int baseNumKeys = store.getMasterKeys() == null ? 0 : store.getMasterKeys().length;
HBaseImport importer = new HBaseImport("-r", roles[0]);
importer.setConnections(rdbms, store);
importer.run();
Role role = store.getRole(roles[0]);
Assert.assertNotNull(role);
Assert.assertEquals(roles[0], role.getRoleName());
// Make sure there aren't any extra roles
Assert.assertEquals(baseNumRoles + 1, store.listRoleNames().size());
Assert.assertEquals(baseNumDbs, store.getAllDatabases().size());
Assert.assertEquals(baseNumToks, store.getAllTokenIdentifiers().size());
String[] hbaseKeys = store.getMasterKeys();
Assert.assertEquals(baseNumKeys, hbaseKeys.length);
// Have to do this last as it will throw an exception
thrown.expect(NoSuchObjectException.class);
store.getRole(roles[1]);
}
use of org.apache.hadoop.hive.metastore.RawStore in project hive by apache.
the class EventCleanerTask method run.
@Override
public void run() {
try {
RawStore ms = handler.getMS();
long deleteCnt = ms.cleanupEvents();
if (deleteCnt > 0L) {
LOG.info("Number of events deleted from event Table: " + deleteCnt);
}
} catch (Exception e) {
LOG.error("Exception while trying to delete events ", e);
}
}
Aggregations