DataSetDefsBootstrap extends AbstractDataSetDefsBootstrap { public void registerDataSetDefinitions(@Observes QueryDefinitionLoaded event) { if (event.getDefinition().getName().equals(PROCESS_INSTANCE_DATASET)) { registerDataSetDefinition(event.getDefinition(), builder -> builder.number(COLUMN_PROCESS_INSTANCE_ID) .label(COLUMN_PROCESS_ID) .date(COLUMN_START) .date(COLUMN_END) .number(COLUMN_STATUS) .number(COLUMN_PARENT_PROCESS_INSTANCE_ID) .label(COLUMN_OUTCOME) .number(COLUMN_DURATION) .label(COLUMN_IDENTITY) .label(COLUMN_PROCESS_VERSION) .label(COLUMN_PROCESS_NAME) .label(COLUMN_CORRELATION_KEY) .label(COLUMN_EXTERNAL_ID) .label(COLUMN_PROCESS_INSTANCE_DESCRIPTION) .date(COLUMN_SLA_DUE_DATE) .number(COLUMN_SLA_COMPLIANCE) .date(COLUMN_LAST_MODIFICATION_DATE) .number(COLUMN_ERROR_COUNT) ); } else if (event.getDefinition().getName().equals(PROCESS_INSTANCE_WITH_VARIABLES_DATASET)) { registerDataSetDefinition(event.getDefinition(), builder -> builder.number(PROCESS_INSTANCE_ID) .label(PROCESS_NAME) .number(VARIABLE_ID) .label(VARIABLE_NAME) .label(VARIABLE_VALUE) ); } else if (event.getDefinition().getName().equals(PROCESS_INSTANCE_LOGS_DATASET)) { registerDataSetDefinition(event.getDefinition(), builder -> builder.number(COLUMN_LOG_ID) .label(COLUMN_LOG_NODE_ID) .label(COLUMN_LOG_NODE_NAME) .label(COLUMN_LOG_NODE_TYPE) .label(COLUMN_LOG_DEPLOYMENT_ID) .number(COLUMN_LOG_PROCESS_INSTANCE_ID) .date(COLUMN_LOG_DATE) .label(COLUMN_LOG_CONNECTION) .number(COLUMN_LOG_TYPE) .number(COLUMN_LOG_WORK_ITEM_ID) .number(COLUMN_LOG_REFERENCE_ID) .label(COLUMN_LOG_NODE_CONTAINER_ID) .date(COLUMN_LOG_SLA_DUE_DATE) .number(COLUMN_LOG_SLA_COMPLIANCE) ); } }  void registerDataSetDefinitions(@Observes QueryDefinitionLoaded event);  }
@Test public void testProcessInstanceDataSet() { QueryDefinition qd = QueryDefinition.builder().name(PROCESS_INSTANCE_DATASET).expression("SELECT *").source("source").target("target").build(); dataSetsBootstrap.registerDataSetDefinitions(new QueryDefinitionLoaded(qd)); ArgumentCaptor<SQLDataSetDef> argument = ArgumentCaptor.forClass(SQLDataSetDef.class); verify(dataSetRegistry).registerDataSetDef(argument.capture()); SQLDataSetDef dataSetDef = argument.getValue(); assertEquals(PROCESS_INSTANCE_DATASET, dataSetDef.getUUID()); assertEquals("target-" + PROCESS_INSTANCE_DATASET, dataSetDef.getName()); assertEquals(KieServerDataSetProvider.TYPE, dataSetDef.getProvider()); assertEquals("SELECT *", dataSetDef.getDbSQL()); assertEquals(18, dataSetDef.getColumns().size()); }
@Test public void testProcessInstanceWithVariablesDataSet() { QueryDefinition qd = QueryDefinition.builder().name(PROCESS_INSTANCE_WITH_VARIABLES_DATASET).expression("SELECT *").source("source").target("target").build(); dataSetsBootstrap.registerDataSetDefinitions(new QueryDefinitionLoaded(qd)); ArgumentCaptor<SQLDataSetDef> argument = ArgumentCaptor.forClass(SQLDataSetDef.class); verify(dataSetRegistry).registerDataSetDef(argument.capture()); SQLDataSetDef dataSetDef = argument.getValue(); assertEquals(PROCESS_INSTANCE_WITH_VARIABLES_DATASET, dataSetDef.getUUID()); assertEquals("target-" + PROCESS_INSTANCE_WITH_VARIABLES_DATASET, dataSetDef.getName()); assertEquals(KieServerDataSetProvider.TYPE, dataSetDef.getProvider()); assertEquals("SELECT *", dataSetDef.getDbSQL()); assertEquals(5, dataSetDef.getColumns().size()); }
@Test public void testProcessInstanceLogsDataSet() { QueryDefinition qd = QueryDefinition.builder().name(PROCESS_INSTANCE_LOGS_DATASET).expression("SELECT *").source("source").target("target").build(); dataSetsBootstrap.registerDataSetDefinitions(new QueryDefinitionLoaded(qd)); ArgumentCaptor<SQLDataSetDef> argument = ArgumentCaptor.forClass(SQLDataSetDef.class); verify(dataSetRegistry).registerDataSetDef(argument.capture()); SQLDataSetDef dataSetDef = argument.getValue(); assertEquals(PROCESS_INSTANCE_LOGS_DATASET, dataSetDef.getUUID()); assertEquals("target-" + PROCESS_INSTANCE_LOGS_DATASET, dataSetDef.getName()); assertEquals(KieServerDataSetProvider.TYPE, dataSetDef.getProvider()); assertEquals("SELECT *", dataSetDef.getDbSQL()); assertEquals(14, dataSetDef.getColumns().size()); }