DataSetDefsBootstrap extends AbstractDataSetDefsBootstrap { public void registerDataSetDefinitions(@Observes QueryDefinitionLoaded event) { if (event.getDefinition().getName().equals(HUMAN_TASKS_DATASET)) { registerDataSetDefinition(event.getDefinition(), builder -> addBuilderCommonColumns(builder) ); } else if (event.getDefinition().getName().equals(HUMAN_TASKS_WITH_USER_DATASET)) { registerDataSetDefinition(event.getDefinition(), builder -> addBuilderCommonColumns(builder) .label(COLUMN_ORGANIZATIONAL_ENTITY) .label(COLUMN_EXCLUDED_OWNER) ); } else if (event.getDefinition().getName().equals(HUMAN_TASKS_WITH_ADMIN_DATASET)) { registerDataSetDefinition(event.getDefinition(), builder -> addBuilderCommonColumns(builder) .label(COLUMN_ORGANIZATIONAL_ENTITY) .number(COLUMN_ERROR_COUNT) ); } else if (event.getDefinition().getName().equals(HUMAN_TASKS_WITH_VARIABLES_DATASET)) { registerDataSetDefinition(event.getDefinition(), builder -> builder.number(COLUMN_TASK_VARIABLE_TASK_ID) .label(COLUMN_TASK_VARIABLE_NAME) .label(COLUMN_TASK_VARIABLE_VALUE) ); } }  void registerDataSetDefinitions(@Observes QueryDefinitionLoaded event);  }
@Test public void testHumanTasksDataSet() { QueryDefinition qd = QueryDefinition.builder().name(HUMAN_TASKS_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(HUMAN_TASKS_DATASET, dataSetDef.getUUID()); assertEquals("target-" + HUMAN_TASKS_DATASET, dataSetDef.getName()); assertEquals(KieServerDataSetProvider.TYPE, dataSetDef.getProvider()); assertEquals("SELECT *", dataSetDef.getDbSQL()); assertEquals(21, dataSetDef.getColumns().size()); }
@Test public void testHumanTasksWithUserDataSet() { QueryDefinition qd = QueryDefinition.builder().name(HUMAN_TASKS_WITH_USER_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(HUMAN_TASKS_WITH_USER_DATASET, dataSetDef.getUUID()); assertEquals("target-" + HUMAN_TASKS_WITH_USER_DATASET, dataSetDef.getName()); assertEquals(KieServerDataSetProvider.TYPE, dataSetDef.getProvider()); assertEquals("SELECT *", dataSetDef.getDbSQL()); assertEquals(23, dataSetDef.getColumns().size()); }
@Test public void testHumanTasksWithAdminDataSet() { QueryDefinition qd = QueryDefinition.builder().name(HUMAN_TASKS_WITH_ADMIN_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(HUMAN_TASKS_WITH_ADMIN_DATASET, dataSetDef.getUUID()); assertEquals("target-" + HUMAN_TASKS_WITH_ADMIN_DATASET, dataSetDef.getName()); assertEquals(KieServerDataSetProvider.TYPE, dataSetDef.getProvider()); assertEquals("SELECT *", dataSetDef.getDbSQL()); assertEquals(23, dataSetDef.getColumns().size()); }
@Test public void testHumanTasksWithVariablesDataSet() { QueryDefinition qd = QueryDefinition.builder().name(HUMAN_TASKS_WITH_VARIABLES_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(HUMAN_TASKS_WITH_VARIABLES_DATASET, dataSetDef.getUUID()); assertEquals("target-" + HUMAN_TASKS_WITH_VARIABLES_DATASET, dataSetDef.getName()); assertEquals(KieServerDataSetProvider.TYPE, dataSetDef.getProvider()); assertEquals("SELECT *", dataSetDef.getDbSQL()); assertEquals(3, dataSetDef.getColumns().size()); }