RestSqlAdapter implements IDatabaseAdapter { @Override public List<IKVStore> getResultsOfQuery(final String query, final List<String> values) throws SQLException { if (values.isEmpty()) { return this.select(query); } else { throw new UnsupportedOperationException("Cannot cope with prepared statements and values to set."); } } RestSqlAdapter(final IRestDatabaseConfig config); List<IKVStore> select(final String query); @Override int[] insert(final String table, final Map<String, ? extends Object> values); @Override int[] insertMultiple(final String tablename, final List<String> keys, final List<List<?>> values); int[] insert(final String query); @Override int update(final String query); @Override List<IKVStore> query(final String query); JsonNode executeRESTCall(final String URL, final String query); @Override int update(final String tablename, final Map<String, ? extends Object> valuesToWrite, final Map<String, ? extends Object> where); static String whereClauseElement(final String key, final String value); @Override String getLoggerName(); @Override void setLoggerName(final String name); @Override void checkConnection(); @Override void createTable(final String tablename, final String nameOfPrimaryField, final Collection<String> fieldnames, final Map<String, String> types, final Collection<String> keys); @Override List<IKVStore> getRowsOfTable(final String table, final Map<String, String> conditions); @Override List<IKVStore> getResultsOfQuery(final String query, final List<String> values); @Override int[] insert(final String sql, final List<? extends Object> values); @Override int[] insertMultiple(final String table, final List<String> keys, final List<List<? extends Object>> datarows, final int chunkSize); @Override int update(final String sql, final List<? extends Object> values); @Override void executeQueriesAtomically(final List<PreparedStatement> queries); @Override void close();  }
@Test @Ignore public void testSelectQuery() throws SQLException { List<IKVStore> res = adapter.getResultsOfQuery("SELECT * FROM " + SELECT_TABLE); if (res.isEmpty() || res.size() > 1) { fail("No result or too many results returned for select query."); } IKVStore store = res.get(0); assertEquals("ID not as expected.", "1", store.getAsString("id")); assertEquals("Column 'a' not as expected.", "1", store.getAsString("a")); assertEquals("Column 'b' not as expected.", "y", store.getAsString("b")); assertEquals("Column 'c' not as expected.", "3", store.getAsString("c")); }