PhoenixDriver extends PhoenixEmbeddedDriver { @Override public Connection connect(String url, Properties info) throws SQLException { try { closeLock.readLock().lock(); checkClosed(); return super.connect(url, info); } finally { closeLock.readLock().unlock(); } } PhoenixDriver(); @Override QueryServices getQueryServices(); @Override boolean acceptsURL(String url); @Override Connection connect(String url, Properties info); @Override synchronized void close(); static final PhoenixDriver INSTANCE; }
@Test public void testFirstConnectionWhenPropsHasTenantId() throws Exception { Properties props = new Properties(); final String tenantId = "00Dxx0000001234"; props.put(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId); Connection connection = new PhoenixTestDriver().connect(getUrl(), props); assertEquals(tenantId, connection.getClientInfo(PhoenixRuntime.TENANT_ID_ATTRIB)); }
@Test public void testFirstConnectionWhenUrlHasTenantId() throws Exception { final String tenantId = "00Dxx0000001234"; String url = getUrl() + ";" + PhoenixRuntime.TENANT_ID_ATTRIB + "=" + tenantId; Driver driver = new PhoenixTestDriver(); driver.connect(url, new Properties()); }