DataSetDefsBootstrap extends AbstractDataSetDefsBootstrap { public void registerDataSetDefinitions(@Observes QueryDefinitionLoaded event) { if (event.getDefinition().getName().equals(REQUEST_LIST_DATASET)) { registerDataSetDefinition(event.getDefinition(), builder -> builder.number(COLUMN_ID) .date(COLUMN_TIMESTAMP) .label(COLUMN_STATUS) .label(COLUMN_COMMANDNAME) .label(COLUMN_MESSAGE) .label(COLUMN_BUSINESSKEY) .number(COLUMN_RETRIES) .number(COLUMN_EXECUTIONS) .label(COLUMN_PROCESS_NAME) .number(COLUMN_PROCESS_INSTANCE_ID) .label(COLUMN_PROCESS_INSTANCE_DESCRIPTION) .label(COLUMN_JOB_DEPLOYMENT_ID) ); } else if (event.getDefinition().getName().equals(EXECUTION_ERROR_LIST_DATASET)) { registerDataSetDefinition(event.getDefinition(), builder -> builder.number(COLUMN_ERROR_ACK) .text(COLUMN_ERROR_ACK_BY) .date(COLUMN_ERROR_ACK_AT) .number(COLUMN_ACTIVITY_ID) .label(COLUMN_ACTIVITY_NAME) .label(COLUMN_DEPLOYMENT_ID) .date(COLUMN_ERROR_DATE) .label(COLUMN_ERROR_ID) .label(COLUMN_ERROR_MSG) .number(COLUMN_JOB_ID) .label(COLUMN_PROCESS_ID) .number(COLUMN_PROCESS_INST_ID) .label(COLUMN_ERROR_TYPE)); } }  void registerDataSetDefinitions(@Observes QueryDefinitionLoaded event);  }
@Test public void testRequestListDataSet() { QueryDefinition qd = QueryDefinition.builder().name(REQUEST_LIST_DATASET).expression("SELECT *").source("source").target("target").build(); dataSetsBootstrap.registerDataSetDefinitions(new QueryDefinitionLoaded(qd)); ArgumentCaptor<SQLDataSetDef> argument = ArgumentCaptor.forClass(SQLDataSetDef.class); verify(dataSetDefRegistry).registerDataSetDef(argument.capture()); SQLDataSetDef dataSetDef = argument.getValue(); assertEquals(REQUEST_LIST_DATASET, dataSetDef.getUUID()); assertEquals("target-" + REQUEST_LIST_DATASET, dataSetDef.getName()); assertEquals(KieServerDataSetProvider.TYPE, dataSetDef.getProvider()); assertEquals("SELECT *", dataSetDef.getDbSQL()); assertEquals(12, dataSetDef.getColumns().size()); }
@Test public void testErrorListDataSet() { QueryDefinition qd = QueryDefinition.builder().name(EXECUTION_ERROR_LIST_DATASET).expression("SELECT *").source("source").target("target").build(); dataSetsBootstrap.registerDataSetDefinitions(new QueryDefinitionLoaded(qd)); ArgumentCaptor<SQLDataSetDef> argument = ArgumentCaptor.forClass(SQLDataSetDef.class); verify(dataSetDefRegistry).registerDataSetDef(argument.capture()); SQLDataSetDef dataSetDef = argument.getValue(); assertEquals(EXECUTION_ERROR_LIST_DATASET, dataSetDef.getUUID()); assertEquals("target-" + EXECUTION_ERROR_LIST_DATASET, dataSetDef.getName()); assertEquals(KieServerDataSetProvider.TYPE, dataSetDef.getProvider()); assertEquals("SELECT *", dataSetDef.getDbSQL()); assertEquals(13, dataSetDef.getColumns().size()); }