use of org.drools.scenariosimulation.api.model.Scenario in project drools by kiegroup.
the class RuleScenarioRunnerHelperTest method groupByFactIdentifierAndFilterTest.
@Test
public void groupByFactIdentifierAndFilterTest() {
Map<FactIdentifier, List<FactMappingValue>> scenario1Given = runnerHelper.groupByFactIdentifierAndFilter(scenario1.getUnmodifiableFactMappingValues(), FactMappingType.GIVEN);
Map<FactIdentifier, List<FactMappingValue>> scenario1Expected = runnerHelper.groupByFactIdentifierAndFilter(scenario1.getUnmodifiableFactMappingValues(), FactMappingType.EXPECT);
Map<FactIdentifier, List<FactMappingValue>> scenario2Given = runnerHelper.groupByFactIdentifierAndFilter(scenario2.getUnmodifiableFactMappingValues(), FactMappingType.GIVEN);
Map<FactIdentifier, List<FactMappingValue>> scenario2Expected = runnerHelper.groupByFactIdentifierAndFilter(scenario2.getUnmodifiableFactMappingValues(), FactMappingType.EXPECT);
assertEquals(1, scenario1Given.keySet().size());
assertEquals(1, scenario1Expected.keySet().size());
assertEquals(2, scenario2Given.keySet().size());
assertEquals(2, scenario2Expected.keySet().size());
assertEquals(1, scenario1Given.get(personFactIdentifier).size());
assertEquals(1, scenario1Expected.get(personFactIdentifier).size());
assertEquals(1, scenario2Given.get(disputeFactIdentifier).size());
assertEquals(1, scenario2Expected.get(disputeFactIdentifier).size());
Scenario scenario = new Scenario();
scenario.addMappingValue(FactIdentifier.EMPTY, ExpressionIdentifier.DESCRIPTION, null);
assertEquals(0, runnerHelper.groupByFactIdentifierAndFilter(scenario.getUnmodifiableFactMappingValues(), FactMappingType.GIVEN).size());
}
use of org.drools.scenariosimulation.api.model.Scenario in project drools by kiegroup.
the class AbstractScenarioRunnerTest method getDescriptionForScenario.
@Test
public void getDescriptionForScenario() {
final Scenario scenario = scenarioRunnerDTOLocal.getScenarioWithIndices().get(2).getScesimData();
Description retrieved = AbstractScenarioRunner.getDescriptionForScenario(Optional.empty(), 1, scenario.getDescription());
commonVerifyDescriptionForScenario(retrieved, 1, scenario.getDescription(), AbstractScenarioRunner.class.getSimpleName());
retrieved = AbstractScenarioRunner.getDescriptionForScenario(Optional.of("src/test/Test.scesim"), 1, scenario.getDescription());
commonVerifyDescriptionForScenario(retrieved, 1, scenario.getDescription(), "Test");
}
use of org.drools.scenariosimulation.api.model.Scenario in project drools by kiegroup.
the class AbstractScenarioRunnerTest method getScenarioRunnerDTO.
private ScenarioRunnerDTO getScenarioRunnerDTO() {
Simulation simulation = new Simulation();
IntStream.range(0, SCENARIO_DATA).forEach(index -> {
Scenario scenario = simulation.addData();
scenario.setDescription("INDEX-" + index);
});
ScenarioSimulationModel model = new ScenarioSimulationModel();
model.setSimulation(simulation);
return new ScenarioRunnerDTO(model, "test.scesim");
}
use of org.drools.scenariosimulation.api.model.Scenario 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.scenariosimulation.api.model.Scenario 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);
}
Aggregations