use of org.drools.scenariosimulation.api.model.ScenarioSimulationModel in project drools-wb by kiegroup.
the class ScenarioRunnerServiceImpl method runAllTests.
@Override
public List<TestResultMessage> runAllTests(final String identifier, final Path path) {
final List<TestResultMessage> testResultMessages = new ArrayList<>();
for (Map.Entry<Path, ScenarioSimulationModel> entry : scenarioLoader.loadScenarios(path).entrySet()) {
final Simulation simulation = entry.getValue().getSimulation();
final Settings settings = entry.getValue().getSettings();
if (!settings.isSkipFromBuild()) {
testResultMessages.add(runTest(identifier, entry.getKey(), simulation.getScesimModelDescriptor(), simulation.getScenarioWithIndex(), settings, entry.getValue().getBackground()).getTestResultMessage());
}
}
return testResultMessages;
}
use of org.drools.scenariosimulation.api.model.ScenarioSimulationModel in project drools-wb by kiegroup.
the class AbstractScenarioSimulationEditorTest method setup.
public void setup() {
super.setup();
// Mock FileMenuBuilder usage since we cannot use FileMenuBuilderImpl either
when(fileMenuBuilderMock.addSave(any(MenuItem.class))).thenReturn(fileMenuBuilderMock);
when(fileMenuBuilderMock.addCopy(any(ObservablePath.class), any(DefaultFileNameValidator.class))).thenReturn(fileMenuBuilderMock);
when(fileMenuBuilderMock.addRename(any(Command.class))).thenReturn(fileMenuBuilderMock);
when(fileMenuBuilderMock.addDelete(any(ObservablePath.class))).thenReturn(fileMenuBuilderMock);
when(fileMenuBuilderMock.addValidate(any(Command.class))).thenReturn(fileMenuBuilderMock);
when(fileMenuBuilderMock.addNewTopLevelMenu(any(MenuItem.class))).thenReturn(fileMenuBuilderMock);
when(versionRecordManagerMock.getCurrentPath()).thenReturn(observablePathMock);
when(versionRecordManagerMock.getPathToLatest()).thenReturn(observablePathMock);
when(workbenchContextMock.getActiveWorkspaceProject()).thenReturn(Optional.empty());
when(gridContextMenuMock.getView()).thenReturn(gridContextMenuViewMock);
when(headerGivenContextMenuMock.getView()).thenReturn(headerContextMenuViewMock);
this.modelLocal = new ScenarioSimulationModel();
modelLocal.setSimulation(getSimulation());
modelLocal.setSettings(settingsLocal);
settingsLocal.setType(ScenarioSimulationModel.Type.RULE);
settingsLocal.setDmoSession(null);
modelLocal.setBackground(backgroundLocal);
this.content = new ScenarioSimulationModelContent(modelLocal, overviewMock, packageDataModelOracleBaselinePayload);
when(packageDataModelOracleBaselinePayload.getPackageName()).thenReturn(TestProperties.FACT_PACKAGE);
when(scenarioSimulationServiceMock.loadContent(observablePathMock)).thenReturn(content);
}
use of org.drools.scenariosimulation.api.model.ScenarioSimulationModel 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.ScenarioSimulationModel in project drools by kiegroup.
the class ScenarioJunitActivator method parseFile.
protected ScenarioRunnerDTO parseFile(String path) {
try (final Scanner scanner = new Scanner(new File(path))) {
String rawFile = scanner.useDelimiter("\\Z").next();
ScenarioSimulationModel scenarioSimulationModel = getXmlReader().unmarshal(rawFile);
return new ScenarioRunnerDTO(scenarioSimulationModel, path);
} catch (FileNotFoundException e) {
throw new ScenarioException("File not found, this should not happen: " + path, e);
} catch (Exception e) {
throw new ScenarioException("Issue on parsing file: " + path, e);
}
}
use of org.drools.scenariosimulation.api.model.ScenarioSimulationModel in project drools by kiegroup.
the class ScenarioSimulationXMLPersistenceTest method noFQCNUsed.
@Test
public void noFQCNUsed() {
final ScenarioSimulationModel simulationModel = new ScenarioSimulationModel();
simulationModel.getImports().addImport(new Import("org.test.Test"));
final String xml = instance.marshal(simulationModel);
assertFalse(xml.contains("org.drools.scenariosimulation.api.model"));
assertFalse(xml.contains("org.kie.soup.project.datamodel.imports"));
}
Aggregations