Search in sources :

Example 6 with ConcordObjectMapper

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);
    }
}
Also used : ConcordObjectMapper(com.walmartlabs.concord.server.ConcordObjectMapper) Test(org.junit.jupiter.api.Test) AbstractDaoTest(com.walmartlabs.concord.server.AbstractDaoTest)

Aggregations

ConcordObjectMapper (com.walmartlabs.concord.server.ConcordObjectMapper)6 AbstractDaoTest (com.walmartlabs.concord.server.AbstractDaoTest)5 Test (org.junit.jupiter.api.Test)5 ProcessKey (com.walmartlabs.concord.server.sdk.ProcessKey)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 ProcessConfiguration (com.walmartlabs.concord.server.cfg.ProcessConfiguration)2 SecretStoreConfiguration (com.walmartlabs.concord.server.cfg.SecretStoreConfiguration)2 ProjectDao (com.walmartlabs.concord.server.org.project.ProjectDao)2 RepositoryDao (com.walmartlabs.concord.server.org.project.RepositoryDao)2 PolicyManager (com.walmartlabs.concord.server.policy.PolicyManager)2 ProcessLogManager (com.walmartlabs.concord.server.process.logs.ProcessLogManager)2 ProcessKeyCache (com.walmartlabs.concord.server.process.queue.ProcessKeyCache)2 ProcessQueueDao (com.walmartlabs.concord.server.process.queue.ProcessQueueDao)2 Path (java.nio.file.Path)2 RepositoryEntry (com.walmartlabs.concord.server.org.project.RepositoryEntry)1 SecretDao (com.walmartlabs.concord.server.org.secret.SecretDao)1 OutputStream (java.io.OutputStream)1 UUID (java.util.UUID)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1