private Connection createConnection() throws SQLException { String url = format("jdbc:presto://%s", server.getAddress()); return DriverManager.getConnection(url, "test", null); } }
private Connection createConnection() throws SQLException { String url = format("jdbc:presto://%s", server.getAddress()); return DriverManager.getConnection(url, "test", null); }
private Connection createConnection(String catalog) throws SQLException { String url = format("jdbc:presto://%s/%s", server.getAddress(), catalog); return DriverManager.getConnection(url, "test", null); }
private Connection createConnection(String catalog, String schema) throws SQLException { String url = format("jdbc:presto://%s/%s/%s", server.getAddress(), catalog, schema); return DriverManager.getConnection(url, "test", null); }
private Connection createConnection() throws SQLException { String url = format("jdbc:presto://%s", server.getAddress(), "blackhole", "blackhole"); return DriverManager.getConnection(url, "test", null); }
private Connection createConnection() throws SQLException { String url = format("jdbc:presto://%s", server.getAddress()); return DriverManager.getConnection(url, "test", null); }
private Connection createConnection(String extra) throws SQLException { String url = format("jdbc:presto://%s/hive/default?%s", server.getAddress(), extra); return DriverManager.getConnection(url, "test", null); }
private Connection createConnection(String catalog, String schema) throws SQLException { String url = format("jdbc:presto://%s/%s/%s", server.getAddress(), catalog, schema); return DriverManager.getConnection(url, "test", null); } }
private Connection createConnection() throws SQLException { String url = format("jdbc:presto://%s", server.getAddress()); return DriverManager.getConnection(url, "test", null); }
@Test(expectedExceptions = SQLException.class, expectedExceptionsMessageRegExp = "Connection property 'user' is required") public void testUserIsRequired() throws Exception { try (Connection ignored = DriverManager.getConnection(format("jdbc:presto://%s", server.getAddress()))) { fail("expected exception"); } }
public void run() throws Exception { try (TestingPrestoServer server = new TestingPrestoServer()) { for (String pluginClass : options.getPluginClassNames()) { Plugin plugin = (Plugin) Class.forName(pluginClass).getConstructor().newInstance(); server.installPlugin(plugin); } for (Catalog catalog : options.getCatalogs()) { server.createCatalog(catalog.getCatalogName(), catalog.getConnectorName()); } System.out.println(server.getAddress()); waitForInterruption(); } }
@Test public void testConnectionStringWithCatalogAndSchema() throws Exception { String prefix = format("jdbc:presto://%s", server.getAddress()); Connection connection; connection = DriverManager.getConnection(prefix + "/a/b/", "test", null); assertEquals(connection.getCatalog(), "a"); assertEquals(connection.getSchema(), "b"); connection = DriverManager.getConnection(prefix + "/a/b", "test", null); assertEquals(connection.getCatalog(), "a"); assertEquals(connection.getSchema(), "b"); connection = DriverManager.getConnection(prefix + "/a/", "test", null); assertEquals(connection.getCatalog(), "a"); assertNull(connection.getSchema()); connection = DriverManager.getConnection(prefix + "/a", "test", null); assertEquals(connection.getCatalog(), "a"); assertNull(connection.getSchema()); connection = DriverManager.getConnection(prefix + "/", "test", null); assertNull(connection.getCatalog()); assertNull(connection.getSchema()); connection = DriverManager.getConnection(prefix, "test", null); assertNull(connection.getCatalog()); assertNull(connection.getSchema()); }
.put("metadata.db.filename", metadataDatabase).build()); String prestoUrl = "http://" + testingPrestoServer.getAddress().toString(); prestoConfig = new PrestoConfig() .setAddress(URI.create(prestoUrl))
private Connection createConnection(String catalog, String schema) throws SQLException { String url = format("jdbc:presto://%s/%s/%s", server.getAddress(), catalog, schema); return DriverManager.getConnection(url, "test", null); } }
private Connection createConnection(String catalog) throws SQLException { String url = format("jdbc:presto://%s/%s", server.getAddress(), catalog); return DriverManager.getConnection(url, "test", null); }
private Connection createConnection(String extra) throws SQLException { String url = format("jdbc:presto://%s/hive/default?%s", server.getAddress(), extra); return DriverManager.getConnection(url, "test", null); }
private Connection createConnection(String catalog, String schema) throws SQLException { String url = format("jdbc:presto://%s/%s/%s", server.getAddress(), catalog, schema); return DriverManager.getConnection(url, "test", null); }
private Connection createConnection() throws SQLException { String url = format("jdbc:presto://%s", server.getAddress()); return DriverManager.getConnection(url, "test", null); }
private Connection createConnection() throws SQLException { String url = format("jdbc:presto://%s", server.getAddress()); return DriverManager.getConnection(url, "test", null); }
@Test(expectedExceptions = SQLException.class, expectedExceptionsMessageRegExp = "Connection property 'user' is required") public void testUserIsRequired() throws Exception { try (Connection ignored = DriverManager.getConnection(format("jdbc:presto://%s", server.getAddress()))) { fail("expected exception"); } }