@Test public void testConnProperties() throws Exception { Map<String, String> connProperties = new HashMap<>(); connProperties.put("user", "postgres"); connProperties.put("password", ""); String uri = PgSQLTestServer.getInstance().getJdbcUrl().split("\\?")[0]; Tablespace space = new PgSQLTablespace("t1", URI.create(uri), getJsonTablespace(connProperties)); try { space.init(new TajoConf()); } finally { space.close(); } }
@Test public void testConnPropertiesNegative() throws Exception { Map<String, String> connProperties = new HashMap<>(); connProperties.put("user", "postgresX"); connProperties.put("password", ""); String uri = PgSQLTestServer.getInstance().getJdbcUrl().split("\\?")[0]; Tablespace space = new PgSQLTablespace("t1", URI.create(uri), getJsonTablespace(connProperties)); try { space.init(new TajoConf()); fail("Must be failed"); } catch (IOException ioe) { assertTrue(ioe.getCause() instanceof PSQLException); } finally { space.close(); } }