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));
}
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));
}
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));
}
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));
}
}
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());
}
Aggregations