Search in sources :

Example 1 with ScenarioSimulationHasBusyIndicatorDefaultErrorCallback

use of org.drools.workbench.screens.scenariosimulation.client.handlers.ScenarioSimulationHasBusyIndicatorDefaultErrorCallback in project drools-wb by kiegroup.

the class ScenarioSimulationEditorBusinessCentralWrapperTest method onRunScenario.

@Test
public void onRunScenario() {
    scenarioWithIndexLocal.add(new ScenarioWithIndex(1, new Scenario()));
    scenarioWithIndexLocal.add(new ScenarioWithIndex(2, new Scenario()));
    scenarioWithIndexLocal.add(new ScenarioWithIndex(3, new Scenario()));
    RemoteCallback<SimulationRunResult> remoteCallback = mock(RemoteCallback.class);
    ScenarioSimulationHasBusyIndicatorDefaultErrorCallback errorCallback = mock(ScenarioSimulationHasBusyIndicatorDefaultErrorCallback.class);
    scenarioSimulationEditorBusinessClientWrapper.onRunScenario(remoteCallback, errorCallback, simulationDescriptorMock, settingsLocal, scenarioWithIndexLocal, backgroundLocal);
    verify(scenarioSimulationEditorBusinessClientWrapper, times(1)).unpublishTestResultsAlerts();
    verify(scenarioSimulationCaller, times(1)).call(eq(remoteCallback), eq(errorCallback));
    verify(scenarioSimulationServiceMock, times(1)).runScenario(eq(observablePathMock), eq(simulationDescriptorMock), eq(scenarioWithIndexLocal), eq(settingsLocal), eq(backgroundLocal));
}
Also used : SimulationRunResult(org.drools.workbench.screens.scenariosimulation.model.SimulationRunResult) ScenarioSimulationHasBusyIndicatorDefaultErrorCallback(org.drools.workbench.screens.scenariosimulation.client.handlers.ScenarioSimulationHasBusyIndicatorDefaultErrorCallback) ScenarioWithIndex(org.drools.scenariosimulation.api.model.ScenarioWithIndex) Scenario(org.drools.scenariosimulation.api.model.Scenario) Test(org.junit.Test) AbstractScenarioSimulationEditorTest(org.drools.workbench.screens.scenariosimulation.client.editor.AbstractScenarioSimulationEditorTest)

Example 2 with ScenarioSimulationHasBusyIndicatorDefaultErrorCallback

use of org.drools.workbench.screens.scenariosimulation.client.handlers.ScenarioSimulationHasBusyIndicatorDefaultErrorCallback in project drools-wb by kiegroup.

the class ScenarioSimulationEditorBusinessCentralWrapperTest method onDownloadReportToCSV.

@Test
public void onDownloadReportToCSV() {
    RemoteCallback<String> remoteCallback = mock(RemoteCallback.class);
    ScenarioSimulationHasBusyIndicatorDefaultErrorCallback errorCallback = mock(ScenarioSimulationHasBusyIndicatorDefaultErrorCallback.class);
    scenarioSimulationEditorBusinessClientWrapper.onDownloadReportToCsv(remoteCallback, errorCallback, simulationRunMetadataMock, RULE);
    verify(runnerReportServiceCaller, times(1)).call(eq(remoteCallback), eq(errorCallback));
    verify(runnerReportServiceMock, times(1)).getReport(eq(simulationRunMetadataMock), eq(RULE));
}
Also used : ScenarioSimulationHasBusyIndicatorDefaultErrorCallback(org.drools.workbench.screens.scenariosimulation.client.handlers.ScenarioSimulationHasBusyIndicatorDefaultErrorCallback) Test(org.junit.Test) AbstractScenarioSimulationEditorTest(org.drools.workbench.screens.scenariosimulation.client.editor.AbstractScenarioSimulationEditorTest)

Example 3 with ScenarioSimulationHasBusyIndicatorDefaultErrorCallback

use of org.drools.workbench.screens.scenariosimulation.client.handlers.ScenarioSimulationHasBusyIndicatorDefaultErrorCallback in project drools-wb by kiegroup.

the class ScenarioSimulationEditorBusinessCentralWrapperTest method onExportToCSV.

@Test
public void onExportToCSV() {
    RemoteCallback<String> remoteCallback = mock(RemoteCallback.class);
    ScenarioSimulationHasBusyIndicatorDefaultErrorCallback errorCallback = mock(ScenarioSimulationHasBusyIndicatorDefaultErrorCallback.class);
    scenarioSimulationEditorBusinessClientWrapper.onExportToCsv(remoteCallback, errorCallback, simulationMock);
    verify(importExportCaller, times(1)).call(eq(remoteCallback), eq(errorCallback));
    verify(importExportServiceMock, times(1)).exportScesimModel(eq(ImportExportType.CSV), eq(simulationMock));
}
Also used : ScenarioSimulationHasBusyIndicatorDefaultErrorCallback(org.drools.workbench.screens.scenariosimulation.client.handlers.ScenarioSimulationHasBusyIndicatorDefaultErrorCallback) Test(org.junit.Test) AbstractScenarioSimulationEditorTest(org.drools.workbench.screens.scenariosimulation.client.editor.AbstractScenarioSimulationEditorTest)

Example 4 with ScenarioSimulationHasBusyIndicatorDefaultErrorCallback

use of org.drools.workbench.screens.scenariosimulation.client.handlers.ScenarioSimulationHasBusyIndicatorDefaultErrorCallback in project drools-wb by kiegroup.

the class ScenarioSimulationEditorBusinessCentralWrapper method setCoverageReport.

protected void setCoverageReport(CoverageReportView.Presenter presenter) {
    ScenarioSimulationModel.Type modelType = scenarioSimulationEditorPresenter.getDataManagementStrategy() instanceof AbstractDMODataManagementStrategy ? ScenarioSimulationModel.Type.RULE : ScenarioSimulationModel.Type.DMN;
    SimulationRunMetadata simulationRunMetadata = lastRunResult != null ? lastRunResult.getSimulationRunMetadata() : null;
    presenter.populateCoverageReport(modelType, simulationRunMetadata);
    if (simulationRunMetadata != null && simulationRunMetadata.getAuditLog() != null) {
        presenter.setDownloadReportCommand(() -> onDownloadReportToCsv(scenarioSimulationEditorPresenter.getExportCallBack(), new ScenarioSimulationHasBusyIndicatorDefaultErrorCallback(scenarioSimulationEditorPresenter.getView()), simulationRunMetadata, modelType));
    }
}
Also used : SimulationRunMetadata(org.drools.scenariosimulation.api.model.SimulationRunMetadata) ScenarioSimulationHasBusyIndicatorDefaultErrorCallback(org.drools.workbench.screens.scenariosimulation.client.handlers.ScenarioSimulationHasBusyIndicatorDefaultErrorCallback) AbstractDMODataManagementStrategy(org.drools.workbench.screens.scenariosimulation.client.editor.strategies.AbstractDMODataManagementStrategy) ScenarioSimulationModel(org.drools.scenariosimulation.api.model.ScenarioSimulationModel)

Example 5 with ScenarioSimulationHasBusyIndicatorDefaultErrorCallback

use of org.drools.workbench.screens.scenariosimulation.client.handlers.ScenarioSimulationHasBusyIndicatorDefaultErrorCallback in project drools-wb by kiegroup.

the class ScenarioSimulationEditorPresenter method onRunScenario.

public void onRunScenario(List<Integer> indexOfScenarioToRun) {
    scenarioMainGridWidget.resetErrors();
    scenarioBackgroundGridWidget.resetErrors();
    model.setSimulation(scenarioMainGridWidget.getScenarioSimulationContext().getStatus().getSimulation());
    model.setBackground(scenarioMainGridWidget.getScenarioSimulationContext().getStatus().getBackground());
    Simulation simulation = model.getSimulation();
    List<ScenarioWithIndex> toRun = simulation.getScenarioWithIndex().stream().filter(elem -> indexOfScenarioToRun.contains(elem.getIndex() - 1)).collect(Collectors.toList());
    view.showBusyIndicator(ScenarioSimulationEditorConstants.INSTANCE.running());
    scenarioSimulationEditorWrapper.onRunScenario(getRefreshModelCallback(), new ScenarioSimulationHasBusyIndicatorDefaultErrorCallback(view), simulation.getScesimModelDescriptor(), model.getSettings(), toRun, model.getBackground());
}
Also used : AbstractScenarioSimulationDocksHandler(org.drools.workbench.screens.scenariosimulation.client.handlers.AbstractScenarioSimulationDocksHandler) ScenarioNotificationEvent(org.drools.workbench.screens.scenariosimulation.client.events.ScenarioNotificationEvent) TestToolsPresenter(org.drools.workbench.screens.scenariosimulation.client.rightpanel.TestToolsPresenter) ScenarioSimulationModel(org.drools.scenariosimulation.api.model.ScenarioSimulationModel) GridWidget(org.drools.workbench.screens.scenariosimulation.client.enums.GridWidget) AbstractDMODataManagementStrategy(org.drools.workbench.screens.scenariosimulation.client.editor.strategies.AbstractDMODataManagementStrategy) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest) CustomBusyPopup(org.drools.workbench.screens.scenariosimulation.client.popup.CustomBusyPopup) FactMappingValidationError(org.drools.workbench.screens.scenariosimulation.model.FactMappingValidationError) Observes(javax.enterprise.event.Observes) BackgroundDataWithIndex(org.drools.scenariosimulation.api.model.BackgroundDataWithIndex) ScesimModelDescriptor(org.drools.scenariosimulation.api.model.ScesimModelDescriptor) SettingsView(org.drools.workbench.screens.scenariosimulation.client.rightpanel.SettingsView) AbstractScenarioSimulationProducer(org.drools.workbench.screens.scenariosimulation.client.producers.AbstractScenarioSimulationProducer) EventBus(com.google.gwt.event.shared.EventBus) TextFileExport(org.uberfire.ext.editor.commons.client.file.exports.TextFileExport) SettingsPresenter(org.drools.workbench.screens.scenariosimulation.client.rightpanel.SettingsPresenter) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback) UberfireDocksInteractionEvent(org.uberfire.client.workbench.docks.UberfireDocksInteractionEvent) Collectors(java.util.stream.Collectors) CheatSheetView(org.drools.workbench.screens.scenariosimulation.client.rightpanel.CheatSheetView) List(java.util.List) FactMapping(org.drools.scenariosimulation.api.model.FactMapping) ObservablePath(org.uberfire.backend.vfs.ObservablePath) ScenarioSimulationHasBusyIndicatorDefaultErrorCallback(org.drools.workbench.screens.scenariosimulation.client.handlers.ScenarioSimulationHasBusyIndicatorDefaultErrorCallback) Simulation(org.drools.scenariosimulation.api.model.Simulation) ScenarioMenuItemFactory(org.drools.workbench.screens.scenariosimulation.client.factories.ScenarioMenuItemFactory) ScenarioSimulationEditorConstants(org.drools.workbench.screens.scenariosimulation.client.resources.i18n.ScenarioSimulationEditorConstants) SimulationRunResult(org.drools.workbench.screens.scenariosimulation.model.SimulationRunResult) IntStream(java.util.stream.IntStream) RedoEvent(org.drools.workbench.screens.scenariosimulation.client.events.RedoEvent) PlaceStatus(org.uberfire.client.mvp.PlaceStatus) FactMappingValueStatus(org.drools.scenariosimulation.api.model.FactMappingValueStatus) ErrorCallback(org.jboss.errai.common.client.api.ErrorCallback) PlaceManager(org.uberfire.client.mvp.PlaceManager) GWT(com.google.gwt.core.client.GWT) Supplier(java.util.function.Supplier) ScenarioSimulationEditorI18nServerManager(org.drools.workbench.screens.scenariosimulation.client.resources.i18n.ScenarioSimulationEditorI18nServerManager) ImportEvent(org.drools.workbench.screens.scenariosimulation.client.events.ImportEvent) Inject(javax.inject.Inject) CSV(org.drools.workbench.screens.scenariosimulation.service.ImportExportType.CSV) ScenarioSimulationContext(org.drools.workbench.screens.scenariosimulation.client.commands.ScenarioSimulationContext) ConfirmPopupPresenter(org.drools.workbench.screens.scenariosimulation.client.popup.ConfirmPopupPresenter) AbstractScesimModel(org.drools.scenariosimulation.api.model.AbstractScesimModel) MenuItem(org.uberfire.workbench.model.menu.MenuItem) CommonConstants(org.kie.workbench.common.widgets.client.resources.i18n.CommonConstants) SCESIMEDITOR_ID(org.drools.workbench.screens.scenariosimulation.client.handlers.AbstractScenarioSimulationDocksHandler.SCESIMEDITOR_ID) ScenarioSimulationResourceType(org.drools.workbench.screens.scenariosimulation.client.type.ScenarioSimulationResourceType) DataManagementStrategy(org.drools.workbench.screens.scenariosimulation.client.editor.strategies.DataManagementStrategy) Path(org.uberfire.backend.vfs.Path) Command(org.uberfire.mvp.Command) ScenarioWithIndex(org.drools.scenariosimulation.api.model.ScenarioWithIndex) TextContent(org.uberfire.ext.editor.commons.client.file.exports.TextContent) UndoEvent(org.drools.workbench.screens.scenariosimulation.client.events.UndoEvent) BackgroundData(org.drools.scenariosimulation.api.model.BackgroundData) Background(org.drools.scenariosimulation.api.model.Background) DomGlobal(elemental2.dom.DomGlobal) FactMappingType(org.drools.scenariosimulation.api.model.FactMappingType) TestToolsView(org.drools.workbench.screens.scenariosimulation.client.rightpanel.TestToolsView) Type(org.drools.scenariosimulation.api.model.ScenarioSimulationModel.Type) AtomicLong(java.util.concurrent.atomic.AtomicLong) MarshallingWrapper(org.jboss.errai.enterprise.client.jaxrs.MarshallingWrapper) Dependent(javax.enterprise.context.Dependent) FileMenuBuilder(org.kie.workbench.common.widgets.client.menu.FileMenuBuilder) ScenarioGridWidget(org.drools.workbench.screens.scenariosimulation.client.widgets.ScenarioGridWidget) AbstractScesimData(org.drools.scenariosimulation.api.model.AbstractScesimData) BusyPopup(org.uberfire.ext.widgets.common.client.common.BusyPopup) Simulation(org.drools.scenariosimulation.api.model.Simulation) ScenarioSimulationHasBusyIndicatorDefaultErrorCallback(org.drools.workbench.screens.scenariosimulation.client.handlers.ScenarioSimulationHasBusyIndicatorDefaultErrorCallback) ScenarioWithIndex(org.drools.scenariosimulation.api.model.ScenarioWithIndex)

Aggregations

ScenarioSimulationHasBusyIndicatorDefaultErrorCallback (org.drools.workbench.screens.scenariosimulation.client.handlers.ScenarioSimulationHasBusyIndicatorDefaultErrorCallback)5 AbstractScenarioSimulationEditorTest (org.drools.workbench.screens.scenariosimulation.client.editor.AbstractScenarioSimulationEditorTest)3 Test (org.junit.Test)3 ScenarioSimulationModel (org.drools.scenariosimulation.api.model.ScenarioSimulationModel)2 ScenarioWithIndex (org.drools.scenariosimulation.api.model.ScenarioWithIndex)2 AbstractDMODataManagementStrategy (org.drools.workbench.screens.scenariosimulation.client.editor.strategies.AbstractDMODataManagementStrategy)2 SimulationRunResult (org.drools.workbench.screens.scenariosimulation.model.SimulationRunResult)2 GWT (com.google.gwt.core.client.GWT)1 EventBus (com.google.gwt.event.shared.EventBus)1 DomGlobal (elemental2.dom.DomGlobal)1 List (java.util.List)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 Supplier (java.util.function.Supplier)1 Collectors (java.util.stream.Collectors)1 IntStream (java.util.stream.IntStream)1 Dependent (javax.enterprise.context.Dependent)1 Observes (javax.enterprise.event.Observes)1 Inject (javax.inject.Inject)1 AbstractScesimData (org.drools.scenariosimulation.api.model.AbstractScesimData)1 AbstractScesimModel (org.drools.scenariosimulation.api.model.AbstractScesimModel)1