Search in sources :

Example 1 with ScenarioWithIndex

use of org.drools.scenariosimulation.api.model.ScenarioWithIndex in project drools by kiegroup.

the class ScenarioResultMetadataTest method setup.

@Before
public void setup() {
    scenarioMock = mock(Scenario.class);
    scenarioWithIndex = new ScenarioWithIndex(SCENARIO_INDEX, scenarioMock);
    scenarioResultMetadata = new ScenarioResultMetadata(scenarioWithIndex);
}
Also used : ScenarioWithIndex(org.drools.scenariosimulation.api.model.ScenarioWithIndex) Scenario(org.drools.scenariosimulation.api.model.Scenario) Before(org.junit.Before)

Example 2 with ScenarioWithIndex

use of org.drools.scenariosimulation.api.model.ScenarioWithIndex in project drools by kiegroup.

the class AbstractScenarioRunner method run.

@Override
public void run(RunNotifier notifier) {
    simulationRunMetadataBuilder = SimulationRunMetadataBuilder.create();
    notifier.fireTestStarted(getDescription());
    for (ScenarioWithIndex scenarioWithIndex : scenarioRunnerDTO.getScenarioWithIndices()) {
        singleRunScenario(scenarioWithIndex, notifier, scenarioRunnerDTO.getSettings(), scenarioRunnerDTO.getBackground()).ifPresent(simulationRunMetadataBuilder::addScenarioResultMetadata);
    }
    notifier.fireTestStarted(getDescription());
}
Also used : ScenarioWithIndex(org.drools.scenariosimulation.api.model.ScenarioWithIndex)

Example 3 with ScenarioWithIndex

use of org.drools.scenariosimulation.api.model.ScenarioWithIndex 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 4 with ScenarioWithIndex

use of org.drools.scenariosimulation.api.model.ScenarioWithIndex in project drools-wb by kiegroup.

the class CoverageReportPresenterTest method setup.

@Before
public void setup() {
    presenterSpy = spy(presenter);
    presenterSpy.downloadReportCommand = downloadReportCommandMock;
    when(coverageReportViewMock.getDonutChart()).thenReturn(donutChartMock);
    when(coverageReportViewMock.getList()).thenReturn(list);
    when(coverageReportViewMock.getScenarioList()).thenReturn(scenarioList);
    when(coverageReportViewMock.getDownloadReportButton()).thenReturn(downloadReportButtonMock);
    availableLocal = 10;
    executedLocal = 6;
    coverageLocal = (double) executedLocal / availableLocal * 100;
    outputCounterLocal = new HashMap<>();
    outputCounterLocal.put("d1", 1);
    outputCounterLocal.put("d2", 2);
    scenarioCounterLocal = new HashMap<>();
    Map<String, Integer> scenario1Data = new HashMap<>();
    scenario1Data.put("d1", 1);
    scenario1Data.put("d2", 1);
    Map<String, Integer> scenario2Data = new HashMap<>();
    scenario2Data.put("d2", 1);
    scenarioCounterLocal.put(new ScenarioWithIndex(1, new Scenario()), scenario1Data);
    scenarioCounterLocal.put(new ScenarioWithIndex(2, new Scenario()), scenario2Data);
    simulationRunMetadataLocal = new SimulationRunMetadata(availableLocal, executedLocal, outputCounterLocal, scenarioCounterLocal, auditLog);
}
Also used : HashMap(java.util.HashMap) SimulationRunMetadata(org.drools.scenariosimulation.api.model.SimulationRunMetadata) Matchers.anyString(org.mockito.Matchers.anyString) ScenarioWithIndex(org.drools.scenariosimulation.api.model.ScenarioWithIndex) Scenario(org.drools.scenariosimulation.api.model.Scenario) Before(org.junit.Before)

Example 5 with ScenarioWithIndex

use of org.drools.scenariosimulation.api.model.ScenarioWithIndex in project drools-wb by kiegroup.

the class CoverageReportPresenter method populateScenarioList.

protected void populateScenarioList(Map<ScenarioWithIndex, Map<String, Integer>> scenarioCounter, Type type) {
    coverageScenarioListPresenter.clear();
    List<ScenarioWithIndex> scenarioIndexes = new ArrayList<>(scenarioCounter.keySet());
    scenarioIndexes.sort(Comparator.comparingInt(ScenarioWithIndex::getIndex));
    for (ScenarioWithIndex scenarioWithIndex : scenarioIndexes) {
        coverageScenarioListPresenter.addScesimDataGroup(scenarioWithIndex, scenarioCounter.get(scenarioWithIndex), type);
    }
}
Also used : ArrayList(java.util.ArrayList) ScenarioWithIndex(org.drools.scenariosimulation.api.model.ScenarioWithIndex)

Aggregations

ScenarioWithIndex (org.drools.scenariosimulation.api.model.ScenarioWithIndex)20 Scenario (org.drools.scenariosimulation.api.model.Scenario)10 ArrayList (java.util.ArrayList)9 Test (org.junit.Test)9 ScesimModelDescriptor (org.drools.scenariosimulation.api.model.ScesimModelDescriptor)7 Path (org.uberfire.backend.vfs.Path)7 List (java.util.List)6 SimulationRunResult (org.drools.workbench.screens.scenariosimulation.model.SimulationRunResult)6 Simulation (org.drools.scenariosimulation.api.model.Simulation)5 FactMapping (org.drools.scenariosimulation.api.model.FactMapping)4 ScenarioSimulationModel (org.drools.scenariosimulation.api.model.ScenarioSimulationModel)4 SimulationRunMetadata (org.drools.scenariosimulation.api.model.SimulationRunMetadata)4 ScenarioResultMetadata (org.drools.scenariosimulation.backend.runner.model.ScenarioResultMetadata)4 HashMap (java.util.HashMap)3 Map (java.util.Map)3 Inject (javax.inject.Inject)3 AuditLogLine (org.drools.scenariosimulation.api.model.AuditLogLine)3 Background (org.drools.scenariosimulation.api.model.Background)3 BackgroundData (org.drools.scenariosimulation.api.model.BackgroundData)3 BackgroundDataWithIndex (org.drools.scenariosimulation.api.model.BackgroundDataWithIndex)3