@Test public void testNotAccept() throws Exception { Driver driver = new PhoenixDriver(); assertFalse(driver.acceptsURL("jdbc:phoenix: assertFalse(driver.acceptsURL("jdbc:phoenix:localhost;test=true;bar=foo")); assertFalse(driver.acceptsURL("jdbc:phoenix:localhost;test=true")); assertTrue(driver.acceptsURL("jdbc:phoenix:localhost:123")); assertTrue(driver.acceptsURL("jdbc:phoenix:localhost:123;untest=true")); assertTrue(driver.acceptsURL("jdbc:phoenix:localhost:123;untest=true;foo=bar")); DriverManager.deregisterDriver(driver); }
@Override public boolean acceptsURL(String url) throws SQLException { if (url.startsWith(PhoenixRuntime.JDBC_PROTOCOL)) { if (url.length() == PhoenixRuntime.JDBC_PROTOCOL.length()) { return true; } if (PhoenixRuntime.JDBC_PROTOCOL_TERMINATOR == url.charAt(PhoenixRuntime.JDBC_PROTOCOL.length())) { return true; } if (PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR == url.charAt(PhoenixRuntime.JDBC_PROTOCOL.length())) { int protoLength = PhoenixRuntime.JDBC_PROTOCOL.length() + 1; if (url.length() == protoLength) { return true; } if (!url.startsWith(DNC_JDBC_PROTOCOL_SUFFIX, protoLength)) { return true; } } } return false; }
PhoenixEmbeddedDriver implements Driver, com.salesforce.phoenix.jdbc.Jdbc7Shim.Driver, SQLCloseable { @Override public boolean acceptsURL(String url) throws SQLException { if (url.startsWith(PhoenixRuntime.JDBC_PROTOCOL)) { if (url.length() == PhoenixRuntime.JDBC_PROTOCOL.length()) { return true; } if (PhoenixRuntime.JDBC_PROTOCOL_TERMINATOR == url.charAt(PhoenixRuntime.JDBC_PROTOCOL.length())) { return true; } if (PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR == url.charAt(PhoenixRuntime.JDBC_PROTOCOL.length())) { int protoLength = PhoenixRuntime.JDBC_PROTOCOL.length() + 1; if (url.length() == protoLength) { return true; } if (!url.startsWith(DNC_JDBC_PROTOCOL_SUFFIX, protoLength)) { return true; } } } return false; } }
PhoenixEmbeddedDriver implements Driver, com.salesforce.phoenix.jdbc.Jdbc7Shim.Driver, SQLCloseable { @Override public boolean acceptsURL(String url) throws SQLException { if (url.startsWith(PhoenixRuntime.JDBC_PROTOCOL)) { if (url.length() == PhoenixRuntime.JDBC_PROTOCOL.length()) { return true; } if (PhoenixRuntime.JDBC_PROTOCOL_TERMINATOR == url.charAt(PhoenixRuntime.JDBC_PROTOCOL.length())) { return true; } if (PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR == url.charAt(PhoenixRuntime.JDBC_PROTOCOL.length())) { int protoLength = PhoenixRuntime.JDBC_PROTOCOL.length() + 1; if (url.length() == protoLength) { return true; } if (!url.startsWith(DNC_JDBC_PROTOCOL_SUFFIX, protoLength)) { return true; } } } return false; } PhoenixEmbeddedDriver(QueryServices queryServices); }
PhoenixEmbeddedDriver implements Driver, com.salesforce.phoenix.jdbc.Jdbc7Shim.Driver, SQLCloseable { @Override public boolean acceptsURL(String url) throws SQLException { if (url.startsWith(PhoenixRuntime.JDBC_PROTOCOL)) { if (url.length() == PhoenixRuntime.JDBC_PROTOCOL.length()) { return true; } if (PhoenixRuntime.JDBC_PROTOCOL_TERMINATOR == url.charAt(PhoenixRuntime.JDBC_PROTOCOL.length())) { return true; } if (PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR == url.charAt(PhoenixRuntime.JDBC_PROTOCOL.length())) { int protoLength = PhoenixRuntime.JDBC_PROTOCOL.length() + 1; if (url.length() == protoLength) { return true; } if (!url.startsWith(DNC_JDBC_PROTOCOL_SUFFIX, protoLength)) { return true; } } } return false; } PhoenixEmbeddedDriver(QueryServices queryServices); QueryServices getQueryServices(); @Override boolean acceptsURL(String url); @Override Connection connect(String url, Properties info); @Override int getMajorVersion(); @Override int getMinorVersion(); @Override DriverPropertyInfo[] getPropertyInfo(String url, Properties info); @Override boolean jdbcCompliant(); @Override Logger getParentLogger(); @Override void close(); static boolean isTestUrl(String url); }
PhoenixEmbeddedDriver implements Driver, com.salesforce.phoenix.jdbc.Jdbc7Shim.Driver, SQLCloseable { @Override public boolean acceptsURL(String url) throws SQLException { if (url.startsWith(PhoenixRuntime.JDBC_PROTOCOL)) { if (url.length() == PhoenixRuntime.JDBC_PROTOCOL.length()) { return true; } if (PhoenixRuntime.JDBC_PROTOCOL_TERMINATOR == url.charAt(PhoenixRuntime.JDBC_PROTOCOL.length())) { return true; } if (PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR == url.charAt(PhoenixRuntime.JDBC_PROTOCOL.length())) { int protoLength = PhoenixRuntime.JDBC_PROTOCOL.length() + 1; if (url.length() == protoLength) { return true; } if (!url.startsWith(DNC_JDBC_PROTOCOL_SUFFIX, protoLength)) { return true; } } } return false; } PhoenixEmbeddedDriver(QueryServices queryServices); QueryServices getQueryServices(); @Override boolean acceptsURL(String url); @Override Connection connect(String url, Properties info); @Override int getMajorVersion(); @Override int getMinorVersion(); @Override DriverPropertyInfo[] getPropertyInfo(String url, Properties info); @Override boolean jdbcCompliant(); @Override Logger getParentLogger(); @Override void close(); static boolean isTestUrl(String url); final static String MAJOR_VERSION_PROP; final static String MINOR_VERSION_PROP; final static String DRIVER_NAME_PROP; }