### Question:
JDBCCore { public void executePublish(ExtensionServiceMessage message) { Map<String, ?> request = (Map<String, ?>) message.getObject(); JDBC localJDBC = null; synchronized (SYNCH_LOCK) { localJDBC = jdbc; } if (localJDBC == null) { log.error("JDBC connection closed before operation could complete"); } try { if (request.get("query") instanceof String) { String queryString = (String) request.get("query"); int data = localJDBC.processPublish(queryString); log.trace("The returned integer value from Publish Query is the following: ", data); } else if (request.get("query") instanceof List) { List queryArray = (List) request.get("query"); int[] data = localJDBC.processBatchPublish(queryArray); log.trace("The returned integer array from Publish Query is the following: ", data); } else { log.error("Query could not be executed because query was not a String or a List"); } } catch (VantiqSQLException e) { log.error("Could not execute requested query.", e); log.error("Request was: {}", request); } catch (ClassCastException e) { log.error("Could not execute requested query. This is most likely because the query list did not contain Strings.", e); log.error("Request was: {}", request); } catch (Exception e) { log.error("An unexpected error occurred when executing the requested query.", e); log.error("Request was: {}", request); } } JDBCCore(String sourceName, String authToken, String targetVantiqServer); String getSourceName(); boolean start(int timeout); void executeQuery(ExtensionServiceMessage message); void executePublish(ExtensionServiceMessage message); void executePolling(String pollQuery); void sendDataFromQuery(HashMap[] queryArray, ExtensionServiceMessage message); void close(); void stop(); boolean exitIfConnectionFails(ExtensionWebSocketClient client, int timeout); public HashMap[] lastRowBundle; final Handler<ExtensionServiceMessage> reconnectHandler; final Handler<ExtensionWebSocketClient> closeHandler; }### Answer:
@Test public void testPublishQuery() throws VantiqSQLException { assumeTrue(testDBUsername != null && testDBPassword != null && testDBURL != null && jdbcDriverLoc != null); jdbc.setupJDBC(testDBURL, testDBUsername, testDBPassword, false, 0); Map<String, Object> request; ExtensionServiceMessage msg = new ExtensionServiceMessage(""); Map<String, String> header = new LinkedHashMap<>(); header.put(ExtensionServiceMessage.ORIGIN_ADDRESS_HEADER, "queryAddress"); msg.messageHeaders = header; request = new LinkedHashMap<>(); msg.object = request; core.executePublish(msg); assertFalse("Core should not be closed", core.isClosed()); request = new LinkedHashMap<>(); request.put("query", "jibberish"); msg.object = request; core.executePublish(msg); assertFalse("Core should not be closed", core.isClosed()); }