org.apache.phoenix.jdbc.PhoenixTestDriver Java Examples

The following examples show how to use org.apache.phoenix.jdbc.PhoenixTestDriver. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractPhoenixConnectionlessTest.java    From ambari-metrics with Apache License 2.0 5 votes vote down vote up
@After
public void tearDown() throws Exception {
  if (driver != null) {
    try {
      driver.close();
    } finally {
      PhoenixTestDriver phoenixTestDriver = driver;
      driver = null;
      DriverManager.deregisterDriver(phoenixTestDriver);
    }
  }
}
 
Example #2
Source File: BaseTest.java    From phoenix with Apache License 2.0 5 votes vote down vote up
/**
 * Create a {@link PhoenixTestDriver} and register it.
 * @return an initialized and registered {@link PhoenixTestDriver} 
 */
protected static PhoenixTestDriver initAndRegisterDriver(String url, ReadOnlyProps props) throws Exception {
    PhoenixTestDriver newDriver = new PhoenixTestDriver(props);
    DriverManager.registerDriver(newDriver);
    Driver oldDriver = DriverManager.getDriver(url); 
    if (oldDriver != newDriver) {
        destroyDriver(oldDriver);
    }
    Connection conn = newDriver.connect(url, PropertiesUtil.deepCopy(TEST_PROPERTIES));
    conn.close();
    return newDriver;
}
 
Example #3
Source File: BaseTest.java    From phoenix with Apache License 2.0 5 votes vote down vote up
/**
 * Create a {@link PhoenixTestDriver} and register it.
 * @return an initialized and registered {@link PhoenixTestDriver} 
 */
public static PhoenixTestDriver initAndRegisterTestDriver(String url, ReadOnlyProps props) throws Exception {
    PhoenixTestDriver newDriver = newTestDriver(props);
    DriverManager.registerDriver(newDriver);
    Driver oldDriver = DriverManager.getDriver(url); 
    if (oldDriver != newDriver) {
        destroyDriver(oldDriver);
    }
    Properties driverProps = PropertiesUtil.deepCopy(TEST_PROPERTIES);
    Connection conn = newDriver.connect(url, driverProps);
    conn.close();
    return newDriver;
}