Search in sources :

Example 1 with UpdateSettingsDataEvent

use of org.drools.workbench.screens.scenariosimulation.client.events.UpdateSettingsDataEvent in project drools-wb by kiegroup.

the class ScenarioSimulationEventHandlerTest method onUpdateSettingDataEventChangedValue.

@Test
public void onUpdateSettingDataEventChangedValue() {
    Predicate<Settings> predicateMock = mock(Predicate.class);
    when(predicateMock.test(eq(settingsLocal))).thenReturn(true);
    Consumer<Settings> consumerMock = mock(Consumer.class);
    UpdateSettingsDataEvent event = new UpdateSettingsDataEvent(consumerMock, predicateMock);
    scenarioSimulationEventHandler.onEvent(event);
    verify(predicateMock, times(1)).test(eq(settingsLocal));
    verify(scenarioSimulationEventHandler, times(1)).commonExecution(isA(UpdateSettingsDataCommand.class), eq(false));
    verify(scenarioSimulationEditorPresenterMock, times(1)).unpublishTestResultsAlerts();
}
Also used : UpdateSettingsDataCommand(org.drools.workbench.screens.scenariosimulation.client.commands.actualcommands.UpdateSettingsDataCommand) UpdateSettingsDataEvent(org.drools.workbench.screens.scenariosimulation.client.events.UpdateSettingsDataEvent) Settings(org.drools.scenariosimulation.api.model.Settings) Test(org.junit.Test) AbstractScenarioSimulationTest(org.drools.workbench.screens.scenariosimulation.client.AbstractScenarioSimulationTest)

Example 2 with UpdateSettingsDataEvent

use of org.drools.workbench.screens.scenariosimulation.client.events.UpdateSettingsDataEvent in project drools-wb by kiegroup.

the class ScenarioSimulationEventHandlerTest method onUpdateSettingDataEventNoChangedValueTest.

@Test
public void onUpdateSettingDataEventNoChangedValueTest() {
    Consumer<Settings> consumerMock = mock(Consumer.class);
    UpdateSettingsDataEvent event = new UpdateSettingsDataEvent(consumerMock);
    scenarioSimulationEventHandler.onEvent(event);
    verify(scenarioSimulationEventHandler, times(1)).commonExecution(isA(UpdateSettingsDataCommand.class), eq(false));
    verify(scenarioSimulationEditorPresenterMock, times(1)).unpublishTestResultsAlerts();
}
Also used : UpdateSettingsDataCommand(org.drools.workbench.screens.scenariosimulation.client.commands.actualcommands.UpdateSettingsDataCommand) UpdateSettingsDataEvent(org.drools.workbench.screens.scenariosimulation.client.events.UpdateSettingsDataEvent) Settings(org.drools.scenariosimulation.api.model.Settings) Test(org.junit.Test) AbstractScenarioSimulationTest(org.drools.workbench.screens.scenariosimulation.client.AbstractScenarioSimulationTest)

Example 3 with UpdateSettingsDataEvent

use of org.drools.workbench.screens.scenariosimulation.client.events.UpdateSettingsDataEvent in project drools-wb by kiegroup.

the class SettingsPresenter method syncDmnFilePath.

@Override
public void syncDmnFilePath() {
    String dmnFilePath = getCleanValue(() -> settingsScenarioSimulationDropdown.getValue().map(KieAssetsDropdownItem::getValue).orElse(""));
    eventBus.fireEvent(new UpdateSettingsDataEvent(settingsToUpdate -> settingsToUpdate.setDmnFilePath(dmnFilePath), settingsToCheck -> !Objects.equals(settingsToCheck.getDmnFilePath(), dmnFilePath), true));
}
Also used : UpdateSettingsDataEvent(org.drools.workbench.screens.scenariosimulation.client.events.UpdateSettingsDataEvent) RULE(org.drools.scenariosimulation.api.model.ScenarioSimulationModel.Type.RULE) EventBus(com.google.gwt.event.shared.EventBus) ValidateSimulationEvent(org.drools.workbench.screens.scenariosimulation.client.events.ValidateSimulationEvent) ScenarioSimulationModel(org.drools.scenariosimulation.api.model.ScenarioSimulationModel) Settings(org.drools.scenariosimulation.api.model.Settings) DMN(org.drools.scenariosimulation.api.model.ScenarioSimulationModel.Type.DMN) DEFAULT_PREFERRED_WIDHT(org.drools.workbench.screens.scenariosimulation.client.rightpanel.SettingsPresenter.DEFAULT_PREFERRED_WIDHT) Supplier(java.util.function.Supplier) KieAssetsDropdownItem(org.kie.workbench.common.widgets.client.assets.dropdown.KieAssetsDropdownItem) Objects(java.util.Objects) Inject(javax.inject.Inject) Style(com.google.gwt.dom.client.Style) SettingsScenarioSimulationDropdown(org.drools.workbench.screens.scenariosimulation.client.dropdown.SettingsScenarioSimulationDropdown) IDENTIFIER(org.drools.workbench.screens.scenariosimulation.client.rightpanel.SettingsPresenter.IDENTIFIER) PostConstruct(javax.annotation.PostConstruct) Optional(java.util.Optional) ScenarioSimulationEditorConstants(org.drools.workbench.screens.scenariosimulation.client.resources.i18n.ScenarioSimulationEditorConstants) ApplicationScoped(javax.enterprise.context.ApplicationScoped) Named(javax.inject.Named) WorkbenchScreen(org.uberfire.client.annotations.WorkbenchScreen) Command(org.uberfire.mvp.Command) UpdateSettingsDataEvent(org.drools.workbench.screens.scenariosimulation.client.events.UpdateSettingsDataEvent) KieAssetsDropdownItem(org.kie.workbench.common.widgets.client.assets.dropdown.KieAssetsDropdownItem)

Example 4 with UpdateSettingsDataEvent

use of org.drools.workbench.screens.scenariosimulation.client.events.UpdateSettingsDataEvent in project drools-wb by kiegroup.

the class SettingsPresenter method syncStateless.

@Override
public void syncStateless() {
    boolean isStateless = view.getStateless().isChecked();
    eventBus.fireEvent(new UpdateSettingsDataEvent(settingsToUpdate -> settingsToUpdate.setStateless(isStateless)));
}
Also used : UpdateSettingsDataEvent(org.drools.workbench.screens.scenariosimulation.client.events.UpdateSettingsDataEvent) RULE(org.drools.scenariosimulation.api.model.ScenarioSimulationModel.Type.RULE) EventBus(com.google.gwt.event.shared.EventBus) ValidateSimulationEvent(org.drools.workbench.screens.scenariosimulation.client.events.ValidateSimulationEvent) ScenarioSimulationModel(org.drools.scenariosimulation.api.model.ScenarioSimulationModel) Settings(org.drools.scenariosimulation.api.model.Settings) DMN(org.drools.scenariosimulation.api.model.ScenarioSimulationModel.Type.DMN) DEFAULT_PREFERRED_WIDHT(org.drools.workbench.screens.scenariosimulation.client.rightpanel.SettingsPresenter.DEFAULT_PREFERRED_WIDHT) Supplier(java.util.function.Supplier) KieAssetsDropdownItem(org.kie.workbench.common.widgets.client.assets.dropdown.KieAssetsDropdownItem) Objects(java.util.Objects) Inject(javax.inject.Inject) Style(com.google.gwt.dom.client.Style) SettingsScenarioSimulationDropdown(org.drools.workbench.screens.scenariosimulation.client.dropdown.SettingsScenarioSimulationDropdown) IDENTIFIER(org.drools.workbench.screens.scenariosimulation.client.rightpanel.SettingsPresenter.IDENTIFIER) PostConstruct(javax.annotation.PostConstruct) Optional(java.util.Optional) ScenarioSimulationEditorConstants(org.drools.workbench.screens.scenariosimulation.client.resources.i18n.ScenarioSimulationEditorConstants) ApplicationScoped(javax.enterprise.context.ApplicationScoped) Named(javax.inject.Named) WorkbenchScreen(org.uberfire.client.annotations.WorkbenchScreen) Command(org.uberfire.mvp.Command) UpdateSettingsDataEvent(org.drools.workbench.screens.scenariosimulation.client.events.UpdateSettingsDataEvent)

Example 5 with UpdateSettingsDataEvent

use of org.drools.workbench.screens.scenariosimulation.client.events.UpdateSettingsDataEvent in project drools-wb by kiegroup.

the class SettingsPresenter method syncSkipFromBuild.

@Override
public void syncSkipFromBuild() {
    boolean isSkipFromBuild = view.getSkipFromBuild().isChecked();
    eventBus.fireEvent(new UpdateSettingsDataEvent(settingsToUpdate -> settingsToUpdate.setSkipFromBuild(isSkipFromBuild)));
}
Also used : UpdateSettingsDataEvent(org.drools.workbench.screens.scenariosimulation.client.events.UpdateSettingsDataEvent) RULE(org.drools.scenariosimulation.api.model.ScenarioSimulationModel.Type.RULE) EventBus(com.google.gwt.event.shared.EventBus) ValidateSimulationEvent(org.drools.workbench.screens.scenariosimulation.client.events.ValidateSimulationEvent) ScenarioSimulationModel(org.drools.scenariosimulation.api.model.ScenarioSimulationModel) Settings(org.drools.scenariosimulation.api.model.Settings) DMN(org.drools.scenariosimulation.api.model.ScenarioSimulationModel.Type.DMN) DEFAULT_PREFERRED_WIDHT(org.drools.workbench.screens.scenariosimulation.client.rightpanel.SettingsPresenter.DEFAULT_PREFERRED_WIDHT) Supplier(java.util.function.Supplier) KieAssetsDropdownItem(org.kie.workbench.common.widgets.client.assets.dropdown.KieAssetsDropdownItem) Objects(java.util.Objects) Inject(javax.inject.Inject) Style(com.google.gwt.dom.client.Style) SettingsScenarioSimulationDropdown(org.drools.workbench.screens.scenariosimulation.client.dropdown.SettingsScenarioSimulationDropdown) IDENTIFIER(org.drools.workbench.screens.scenariosimulation.client.rightpanel.SettingsPresenter.IDENTIFIER) PostConstruct(javax.annotation.PostConstruct) Optional(java.util.Optional) ScenarioSimulationEditorConstants(org.drools.workbench.screens.scenariosimulation.client.resources.i18n.ScenarioSimulationEditorConstants) ApplicationScoped(javax.enterprise.context.ApplicationScoped) Named(javax.inject.Named) WorkbenchScreen(org.uberfire.client.annotations.WorkbenchScreen) Command(org.uberfire.mvp.Command) UpdateSettingsDataEvent(org.drools.workbench.screens.scenariosimulation.client.events.UpdateSettingsDataEvent)

Aggregations

Settings (org.drools.scenariosimulation.api.model.Settings)8 UpdateSettingsDataEvent (org.drools.workbench.screens.scenariosimulation.client.events.UpdateSettingsDataEvent)8 Style (com.google.gwt.dom.client.Style)5 EventBus (com.google.gwt.event.shared.EventBus)5 Objects (java.util.Objects)5 Optional (java.util.Optional)5 Supplier (java.util.function.Supplier)5 PostConstruct (javax.annotation.PostConstruct)5 ApplicationScoped (javax.enterprise.context.ApplicationScoped)5 Inject (javax.inject.Inject)5 Named (javax.inject.Named)5 ScenarioSimulationModel (org.drools.scenariosimulation.api.model.ScenarioSimulationModel)5 DMN (org.drools.scenariosimulation.api.model.ScenarioSimulationModel.Type.DMN)5 RULE (org.drools.scenariosimulation.api.model.ScenarioSimulationModel.Type.RULE)5 SettingsScenarioSimulationDropdown (org.drools.workbench.screens.scenariosimulation.client.dropdown.SettingsScenarioSimulationDropdown)5 ValidateSimulationEvent (org.drools.workbench.screens.scenariosimulation.client.events.ValidateSimulationEvent)5 ScenarioSimulationEditorConstants (org.drools.workbench.screens.scenariosimulation.client.resources.i18n.ScenarioSimulationEditorConstants)5 DEFAULT_PREFERRED_WIDHT (org.drools.workbench.screens.scenariosimulation.client.rightpanel.SettingsPresenter.DEFAULT_PREFERRED_WIDHT)5 IDENTIFIER (org.drools.workbench.screens.scenariosimulation.client.rightpanel.SettingsPresenter.IDENTIFIER)5 KieAssetsDropdownItem (org.kie.workbench.common.widgets.client.assets.dropdown.KieAssetsDropdownItem)5