use of alluxio.table.common.udb.UdbContext in project alluxio by Alluxio.
the class HiveDatabaseTest method createEmptyName.
@Test
public void createEmptyName() {
mExpection.expect(IllegalArgumentException.class);
UdbContext udbContext = new UdbContext(null, null, "hive", "thrift://not_running:9083", "", DB_NAME);
assertEquals(DB_NAME, HiveDatabase.create(udbContext, new UdbConfiguration(ImmutableMap.of())).getName());
}
use of alluxio.table.common.udb.UdbContext in project alluxio by Alluxio.
the class HiveDatabaseTest method createEmptyConnectionUri.
@Test
public void createEmptyConnectionUri() {
mExpection.expect(IllegalArgumentException.class);
UdbContext udbContext = new UdbContext(null, null, "hive", "", DB_NAME, DB_NAME);
assertEquals(DB_NAME, HiveDatabase.create(udbContext, new UdbConfiguration(ImmutableMap.of())).getName());
}
use of alluxio.table.common.udb.UdbContext in project alluxio by Alluxio.
the class HiveDatabaseTest method createNullName.
@Test
public void createNullName() {
mExpection.expect(IllegalArgumentException.class);
UdbContext udbContext = new UdbContext(null, null, "hive", "thrift://not_running:9083", null, DB_NAME);
assertEquals(DB_NAME, HiveDatabase.create(udbContext, new UdbConfiguration(ImmutableMap.of())).getName());
}
use of alluxio.table.common.udb.UdbContext in project alluxio by Alluxio.
the class HiveDatabaseTest method before.
@Before
public void before() {
mUdbContext = new UdbContext(null, null, "hive", "thrift://not_running:9083", DB_NAME, DB_NAME);
mUdbConf = new UdbConfiguration(CONF);
}
use of alluxio.table.common.udb.UdbContext in project alluxio by Alluxio.
the class AlluxioCatalog method getDbIterator.
private Iterator<Journal.JournalEntry> getDbIterator() {
final Iterator<Map.Entry<String, Database>> it = mDBs.entrySet().iterator();
return new Iterator<Journal.JournalEntry>() {
private Map.Entry<String, Database> mEntry = null;
@Override
public boolean hasNext() {
if (mEntry != null) {
return true;
}
if (it.hasNext()) {
mEntry = it.next();
return true;
}
return false;
}
@Override
public Journal.JournalEntry next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
String dbName = mEntry.getKey();
Database database = mEntry.getValue();
UdbContext udbContext = database.getUdb().getUdbContext();
mEntry = null;
return Journal.JournalEntry.newBuilder().setAttachDb(alluxio.proto.journal.Table.AttachDbEntry.newBuilder().setUdbType(database.getType()).setUdbConnectionUri(udbContext.getConnectionUri()).setUdbDbName(udbContext.getUdbDbName()).setDbName(dbName).putAllConfig(database.getConfig()).build()).build();
}
@Override
public void remove() {
throw new UnsupportedOperationException("GetDbIteratorr#Iterator#remove is not supported.");
}
};
}
Aggregations