use of com.walmartlabs.concord.server.ConcordObjectMapper in project concord by walmartlabs.
the class JsonStorageQueryExecDaoTest method execQueryTest.
@Test
public void execQueryTest() throws Exception {
List<String> queries = parseQueries("queries.txt");
JsonStoreQueryDao qd = mock(JsonStoreQueryDao.class);
JsonStoreQueryExecDao dao = new JsonStoreQueryExecDao(getConfiguration(), new ConcordObjectMapper(TestObjectMapper.INSTANCE), qd);
UUID storageId = UUID.randomUUID();
for (String sql : queries) {
String queryName = "test";
UUID queryId = UUID.randomUUID();
Map<String, Object> params = null;
if (sql.contains("?::jsonb")) {
params = new HashMap<>();
params.put("k", "v");
}
when(qd.get(eq(storageId), eq(queryName))).thenReturn(JsonStoreQueryEntry.builder().id(queryId).storeId(storageId).name(queryName).text(sql).build());
List<Object> result = dao.exec(storageId, queryName, params);
assertNotNull(result);
}
}
Aggregations