JDBC { public void setupJDBC(String dbURL, String username, String password, boolean asyncProcessing, int maxPoolSize) throws VantiqSQLException { try { if (asyncProcessing) { HikariConfig connectionPoolConfig = new HikariConfig(); connectionPoolConfig.setJdbcUrl(dbURL); if (username != null) { connectionPoolConfig.setUsername(username); } if (password != null) { connectionPoolConfig.setPassword(password); } ds = new HikariDataSource(connectionPoolConfig); ds.setConnectionTimeout(CONNECTION_POOL_TIMEOUT); ds.setMaximumPoolSize(maxPoolSize); } else { conn = DriverManager.getConnection(dbURL,username,password); } this.dbURL = dbURL; this.username = username; this.password = password; this.isAsync = asyncProcessing; } catch (SQLException e) { reportSQLError(e); } }  void setupJDBC(String dbURL, String username, String password, boolean asyncProcessing, int maxPoolSize); HashMap[] processQuery(String sqlQuery); int processPublish(String sqlQuery); int[] processBatchPublish(List queryList); void diagnoseConnection(); void reportSQLError(SQLException e); void close();  }
@Test public void testVantiqDateFormatting() throws VantiqSQLException { assumeTrue(testAuthToken != null && testVantiqServer != null); assumeTrue(testDBUsername != null && testDBPassword != null && testDBURL != null && jdbcDriverLoc != null); assumeFalse(checkSourceExists()); assumeFalse(checkTypeExists()); jdbc.setupJDBC(testDBURL, testDBUsername, testDBPassword, false, 0); setupSource(createSourceDef(false, false)); Map<String,Object> create_params = new LinkedHashMap<String,Object>(); create_params.put("query", CREATE_TABLE_DATETIME); vantiq.publish("sources", testSourceName, create_params); Map<String,Object> insert_params = new LinkedHashMap<String,Object>(); insert_params.put("query", INSERT_VALUE_DATETIME); vantiq.publish("sources", testSourceName, insert_params); Map<String,Object> params = new LinkedHashMap<String,Object>(); params.put("query", QUERY_TABLE_DATETIME); VantiqResponse response = vantiq.query(testSourceName, params); JsonArray responseBody = (JsonArray) response.getBody(); JsonObject responseMap = (JsonObject) responseBody.get(0); String timestamp = (String) responseMap.get("ts").getAsString(); assertTrue("Expected " + FORMATTED_TIMESTAMP + ", but got " + timestamp, timestamp.equals(FORMATTED_TIMESTAMP)); setupType(); Map<String,String> insertObj = new LinkedHashMap<String,String>(); insertObj.put("timestamp", timestamp); vantiq.insert(testTypeName, insertObj); response = vantiq.select(testTypeName, null, null, null); ArrayList typeResponseBody = (ArrayList) response.getBody(); responseMap = (JsonObject) typeResponseBody.get(0); String vantiqTimestamp = (String) responseMap.get("timestamp").getAsString(); assert vantiqTimestamp.equals(VANTIQ_FORMATTED_TIMESTAMP); deleteType(); deleteSource(); }