RemoteDataSetDefAttributesEditor implements IsWidget, org.jbpm.dashboard.dataset.editor.RemoteDataSetDefAttributesEditor { @PostConstruct public void init() { view.init(this); view.initWidgets(queryTarget.view, serverTemplateId.view, dataSource.view, dbSQL.view); queryTarget.setSelectHint(DashboardConstants.INSTANCE.remote_query_target_hint()); List<DropDownEditor.Entry> entries = Stream.of("CUSTOM", "PROCESS", "TASK", "BA_TASK", "PO_TASK", "JOBS", "FILTERED_PROCESS", "FILTERED_BA_TASK", "FILTERED_PO_TASK") .map(s -> queryTarget.newEntry(s, s)).collect(Collectors.toList()); queryTarget.setEntries(entries); queryTarget.addHelpContent(DashboardConstants.INSTANCE.query_target(), DashboardConstants.INSTANCE.query_target_description(), Placement.RIGHT); serverTemplateId.setSelectHint(DashboardConstants.INSTANCE.remote_server_template_hint()); specManagementService.call((ServerTemplateList serverTemplates) -> { onServerTemplateLoad(serverTemplates); }).listServerTemplates(); serverTemplateId.addHelpContent(DashboardConstants.INSTANCE.server_template(), DashboardConstants.INSTANCE.server_template_description(), Placement.RIGHT); dataSource.addHelpContent(DashboardConstants.INSTANCE.sql_datasource(), DashboardConstants.INSTANCE.sql_datasource_description(), Placement.BOTTOM); dbSQL.addHelpContent(DashboardConstants.INSTANCE.sql_source(), DashboardConstants.INSTANCE.sql_source_description(), Placement.BOTTOM); } @Inject  RemoteDataSetDefAttributesEditor(final DropDownEditor queryTarget,
                                            final DropDownEditor serverTemplateId,
                                         final ValueBoxEditor<String> dataSource,
                                         final ValueBoxEditor<String> dbSQL,
                                         final View view,
                                         final Caller<SpecManagementService> specManagementService); @PostConstruct void init(); @Override Widget asWidget(); @Override DropDownEditor queryTarget(); @Override DropDownEditor serverTemplateId(); @Override ValueBoxEditor<String> dataSource(); @Override ValueBoxEditor<String> dbSQL(); @Override void flush(); @Override void onPropertyChange(final String... paths); @Override void setDelegate(final EditorDelegate<RemoteDataSetDef> delegate); @Override void setValue(RemoteDataSetDef value); public View view; }
@Test public void testInit() { presenter.init(); verify(view, times(1)).init(presenter); verify(view, times(1)).initWidgets(any(DropDownEditor.View.class), any(DropDownEditor.View.class), any(ValueBoxEditor.View.class), any(ValueBoxEditor.View.class)); verify(dataSource, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class)); verify(queryTarget, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class)); verify(serverTemplates, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class)); verify(dbSQL, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class)); verify(specManagementService).listServerTemplates(); verify(queryTarget).setEntries(any()); verify(serverTemplates).setSelectHint(anyString()); }