@Disabled @Test void testConnect() throws Exception { Connection connection = DriverManager.getConnection("jdbc:environment:0"); assertNotNull(connection); }
@Override public Connection connect(String url, Properties info) throws SQLException { String name = url.substring("jdbc:environment:".length()); String delegateUrl = null; Properties delegateProperties = new Properties(); for(String key : System.getenv().keySet()) { if (key.startsWith("PIRANHA_ENVIRONMENT." + name + ".URL")) { delegateUrl = System.getenv("PIRANHA_ENVIRONMENT." + name + ".URL"); } } Driver driver = DriverManager.getDriver(delegateUrl); return driver.connect(delegateUrl, delegateProperties); }
EnvironmentDriver implements Driver { @Override public Connection connect(String url, Properties info) throws SQLException { String name = url.substring("jdbc:environment:".length()); String delegateUrl = null; Properties delegateProperties = new Properties(); for(String key : System.getenv().keySet()) { if (key.startsWith("PIRANHA_ENVIRONMENT." + name + ".URL")) { delegateUrl = System.getenv("PIRANHA_ENVIRONMENT." + name + ".URL"); } } Driver driver = DriverManager.getDriver(delegateUrl); return driver.connect(delegateUrl, delegateProperties); } }
EnvironmentDriver implements Driver { @Override public Connection connect(String url, Properties info) throws SQLException { String name = url.substring("jdbc:environment:".length()); String delegateUrl = null; Properties delegateProperties = new Properties(); for(String key : System.getenv().keySet()) { if (key.startsWith("PIRANHA_ENVIRONMENT." + name + ".URL")) { delegateUrl = System.getenv("PIRANHA_ENVIRONMENT." + name + ".URL"); } } Driver driver = DriverManager.getDriver(delegateUrl); return driver.connect(delegateUrl, delegateProperties); } EnvironmentDriver(); }
EnvironmentDriver implements Driver { @Override public Connection connect(String url, Properties info) throws SQLException { String name = url.substring("jdbc:environment:".length()); String delegateUrl = null; Properties delegateProperties = new Properties(); for(String key : System.getenv().keySet()) { if (key.startsWith("PIRANHA_ENVIRONMENT." + name + ".URL")) { delegateUrl = System.getenv("PIRANHA_ENVIRONMENT." + name + ".URL"); } } Driver driver = DriverManager.getDriver(delegateUrl); return driver.connect(delegateUrl, delegateProperties); } EnvironmentDriver(); @Override Connection connect(String url, Properties info); @Override boolean acceptsURL(String url); @Override DriverPropertyInfo[] getPropertyInfo(String url, Properties info); @Override int getMajorVersion(); @Override int getMinorVersion(); @Override boolean jdbcCompliant(); @Override Logger getParentLogger(); }
EnvironmentDriver implements Driver { @Override public Connection connect(String url, Properties info) throws SQLException { String name = url.substring("jdbc:environment:".length()); String delegateUrl = null; Properties delegateProperties = new Properties(); for(String key : System.getenv().keySet()) { if (key.startsWith("PIRANHA_ENVIRONMENT." + name + ".URL")) { delegateUrl = System.getenv("PIRANHA_ENVIRONMENT." + name + ".URL"); } } Driver driver = DriverManager.getDriver(delegateUrl); return driver.connect(delegateUrl, delegateProperties); } EnvironmentDriver(); @Override Connection connect(String url, Properties info); @Override boolean acceptsURL(String url); @Override DriverPropertyInfo[] getPropertyInfo(String url, Properties info); @Override int getMajorVersion(); @Override int getMinorVersion(); @Override boolean jdbcCompliant(); @Override Logger getParentLogger();  }