@Test public void validateDmnPath_Invalid() { KieAssetsDropdownItem item = new KieAssetsDropdownItem("DMNFile", "", "", null); when(settingsScenarioSimulationDropdownMock.getValue()).thenReturn(Optional.of(item)); settingsPresenterSpy.validateSimulation(); verify(settingsScenarioSimulationDropdownMock, times(1)).getValue(); verify(dmnFilePathErrorLabelStyleMock, times(1)).setDisplay(eq(Style.Display.INLINE)); verify(dmnFilePathErrorLabelMock, times(1)).setInnerText(eq(ScenarioSimulationEditorConstants.INSTANCE.chooseValidDMNAsset())); verify(settingsSpy, never()).setDmnFilePath(anyString()); verify(eventBusMock, never()).fireEvent(isA(ValidateSimulationEvent.class)); }
protected void validateSimulation() { final Optional<KieAssetsDropdownItem> value = settingsScenarioSimulationDropdown.getValue(); String selectedPath = value.map(KieAssetsDropdownItem::getValue).orElse(null); boolean isValid = selectedPath != null && !selectedPath.isEmpty(); if (!isValid) { view.getDmnFilePathErrorLabel().getStyle().setDisplay(Style.Display.INLINE); view.getDmnFilePathErrorLabel().setInnerText(ScenarioSimulationEditorConstants.INSTANCE.chooseValidDMNAsset()); } else { this.syncDmnFilePath(); view.getDmnFilePathErrorLabel().getStyle().setDisplay(Style.Display.NONE); view.getDmnFilePathErrorLabel().setInnerText(""); eventBus.fireEvent(new ValidateSimulationEvent()); } }
SettingsPresenter extends AbstractSubDockPresenter<SettingsView> implements SettingsView.Presenter { protected void validateSimulation() { final Optional<KieAssetsDropdownItem> value = settingsScenarioSimulationDropdown.getValue(); String selectedPath = value.map(KieAssetsDropdownItem::getValue).orElse(null); boolean isValid = selectedPath != null && !selectedPath.isEmpty(); if (!isValid) { view.getDmnFilePathErrorLabel().getStyle().setDisplay(Style.Display.INLINE); view.getDmnFilePathErrorLabel().setInnerText(ScenarioSimulationEditorConstants.INSTANCE.chooseValidDMNAsset()); } else { this.syncDmnFilePath(); view.getDmnFilePathErrorLabel().getStyle().setDisplay(Style.Display.NONE); view.getDmnFilePathErrorLabel().setInnerText(""); eventBus.fireEvent(new ValidateSimulationEvent()); } } }
SettingsPresenter extends AbstractSubDockPresenter<SettingsView> implements SettingsView.Presenter { protected void validateSimulation() { final Optional<KieAssetsDropdownItem> value = settingsScenarioSimulationDropdown.getValue(); String selectedPath = value.map(KieAssetsDropdownItem::getValue).orElse(null); boolean isValid = selectedPath != null && !selectedPath.isEmpty(); if (!isValid) { view.getDmnFilePathErrorLabel().getStyle().setDisplay(Style.Display.INLINE); view.getDmnFilePathErrorLabel().setInnerText(ScenarioSimulationEditorConstants.INSTANCE.chooseValidDMNAsset()); } else { this.syncDmnFilePath(); view.getDmnFilePathErrorLabel().getStyle().setDisplay(Style.Display.NONE); view.getDmnFilePathErrorLabel().setInnerText(""); eventBus.fireEvent(new ValidateSimulationEvent()); } } SettingsPresenter(); @Inject  SettingsPresenter(@Named(SettingsScenarioSimulationDropdown.BEAN_NAME) SettingsScenarioSimulationDropdown settingsScenarioSimulationDropdown,
                             SettingsView view); }
SettingsPresenter extends AbstractSubDockPresenter<SettingsView> implements SettingsView.Presenter { protected void validateSimulation() { final Optional<KieAssetsDropdownItem> value = settingsScenarioSimulationDropdown.getValue(); String selectedPath = value.map(KieAssetsDropdownItem::getValue).orElse(null); boolean isValid = selectedPath != null && !selectedPath.isEmpty(); if (!isValid) { view.getDmnFilePathErrorLabel().getStyle().setDisplay(Style.Display.INLINE); view.getDmnFilePathErrorLabel().setInnerText(ScenarioSimulationEditorConstants.INSTANCE.chooseValidDMNAsset()); } else { this.syncDmnFilePath(); view.getDmnFilePathErrorLabel().getStyle().setDisplay(Style.Display.NONE); view.getDmnFilePathErrorLabel().setInnerText(""); eventBus.fireEvent(new ValidateSimulationEvent()); } } SettingsPresenter(); @Inject  SettingsPresenter(@Named(SettingsScenarioSimulationDropdown.BEAN_NAME) SettingsScenarioSimulationDropdown settingsScenarioSimulationDropdown,
                             SettingsView view); @PostConstruct void init(); @Override void setScenarioType(ScenarioSimulationModel.Type scenarioType, Settings settings, String fileName); @Override void reset(); @Override void setEventBus(EventBus eventBus); SettingsView getView(); @Override void syncDmoSession(); @Override void syncRuleFlowGroup(); @Override void syncStateless(); @Override void syncDmnFilePath(); @Override void syncSkipFromBuild(); }
SettingsPresenter extends AbstractSubDockPresenter<SettingsView> implements SettingsView.Presenter { protected void validateSimulation() { final Optional<KieAssetsDropdownItem> value = settingsScenarioSimulationDropdown.getValue(); String selectedPath = value.map(KieAssetsDropdownItem::getValue).orElse(null); boolean isValid = selectedPath != null && !selectedPath.isEmpty(); if (!isValid) { view.getDmnFilePathErrorLabel().getStyle().setDisplay(Style.Display.INLINE); view.getDmnFilePathErrorLabel().setInnerText(ScenarioSimulationEditorConstants.INSTANCE.chooseValidDMNAsset()); } else { this.syncDmnFilePath(); view.getDmnFilePathErrorLabel().getStyle().setDisplay(Style.Display.NONE); view.getDmnFilePathErrorLabel().setInnerText(""); eventBus.fireEvent(new ValidateSimulationEvent()); } } SettingsPresenter(); @Inject  SettingsPresenter(@Named(SettingsScenarioSimulationDropdown.BEAN_NAME) SettingsScenarioSimulationDropdown settingsScenarioSimulationDropdown,
                             SettingsView view); @PostConstruct void init(); @Override void setScenarioType(ScenarioSimulationModel.Type scenarioType, Settings settings, String fileName); @Override void reset(); @Override void setEventBus(EventBus eventBus); SettingsView getView(); @Override void syncDmoSession(); @Override void syncRuleFlowGroup(); @Override void syncStateless(); @Override void syncDmnFilePath(); @Override void syncSkipFromBuild(); static final int DEFAULT_PREFERRED_WIDHT; static final String IDENTIFIER; }