public class HiveTestFixture extends Object
Below is example of usage HiveTestFixture along with ClusterFixture:
// Note that HiveTestFixture doesn't require extension of ClusterTest,
// this is just the simplest way for configuring test drillbit
public class HiveTestExample extends ClusterTest {
private static HiveTestFixture hiveTestFixture;
@BeforeClass
public static void setUp() throws Exception {
startCluster(ClusterFixture.builder(dirTestWatcher));
// Below is minimal config which uses defaults from HiveTestFixture.Builder
// constructor, but any option for driver or storage plugin may be
// overridden using builder's methods
hiveTestFixture = HiveTestFixture.builder(dirTestWatcher).build();
// Use driver manager to configure test data in Hive metastore
hiveTestFixture.getDriverManager().runWithinSession(HiveTestExample::generateData);
// Use plugin manager to add, remove, update hive storage plugin of one or many test drillbits
hiveTestFixture.getPluginManager().addHivePluginTo(cluster.drillbits());
}
private static void generateData(Driver driver) {
// Set up data using HiveTestUtilities.executeQuery(driver, sql)
}
@AfterClass
public static void tearDown() throws Exception {
if (nonNull(hiveTestFixture)) {
hiveTestFixture.getPluginManager().removeHivePluginFrom(cluster.drillbits());
}
}
}
| Modifier and Type | Class and Description |
|---|---|
static class |
HiveTestFixture.Builder |
class |
HiveTestFixture.HiveDriverManager
Implements method for initialization and passing
of Hive to consumer instances in order to be used
for test data generation within session.
|
class |
HiveTestFixture.HivePluginManager
Implements addition, update and deletion of
Hive storage plugin for drillbits passed from outside.
|
| Modifier and Type | Method and Description |
|---|---|
static HiveTestFixture.Builder |
builder(BaseDirTestWatcher dirWatcher) |
static HiveTestFixture.Builder |
builder(File baseDir) |
HiveTestFixture.HiveDriverManager |
getDriverManager() |
HiveTestFixture.HivePluginManager |
getPluginManager() |
String |
getWarehouseDir()
Returns current value of 'hive.metastore.warehouse.dir' option
which expected to represent location of metastore warehouse directory.
|
public static HiveTestFixture.Builder builder(BaseDirTestWatcher dirWatcher)
public static HiveTestFixture.Builder builder(File baseDir)
public HiveTestFixture.HivePluginManager getPluginManager()
public HiveTestFixture.HiveDriverManager getDriverManager()
public String getWarehouseDir()
Copyright © 2021 The Apache Software Foundation. All rights reserved.