JDBC { public HashMap[] processQuery(String sqlQuery) throws VantiqSQLException { HashMap[] rsArray = null; if (isAsync) { try (Connection conn = ds.getConnection(); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(sqlQuery)) { rsArray = createMapFromResults(rs); } catch (SQLException e) { reportSQLError(e); } } else { diagnoseConnection(); try (Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(sqlQuery)) { rsArray = createMapFromResults(rs); } catch (SQLException e) { reportSQLError(e); } } return rsArray; }  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 testProcessQuery() throws VantiqSQLException { assumeTrue(testDBUsername != null && testDBPassword != null && testDBURL != null && jdbcDriverLoc != null); jdbc.setupJDBC(testDBURL, testDBUsername, testDBPassword, false, 0); HashMap[] queryResult; int deleteResult; try { queryResult = jdbc.processQuery("jibberish"); fail("Should have thrown exception."); } catch (VantiqSQLException e) { } try { queryResult = jdbc.processQuery(SELECT_QUERY); assert (Integer) queryResult[0].get("id") == 1; assert (Integer) queryResult[0].get("age") == 25; assert queryResult[0].get("first").equals("Santa"); assert queryResult[0].get("last").equals("Claus"); } catch (VantiqSQLException e) { fail("Should not throw an exception: " + e.getMessage()); } try { deleteResult = jdbc.processPublish(DELETE_ROW); assert deleteResult > 0; } catch (VantiqSQLException e) { fail("Should not throw an exception: " + e.getMessage()); } try { queryResult = jdbc.processQuery(SELECT_QUERY); assert queryResult.length == 0; } catch (VantiqSQLException e) { fail("Should not throw an exception: " + e.getMessage()); } jdbc.close(); }