use of org.drools.scenariosimulation.api.model.ScenarioSimulationModel in project drools by kiegroup.
the class ScenarioSimulationXMLPersistenceTest method unmarshalRULE.
@Test
public void unmarshalRULE() throws Exception {
String toUnmarshal = getFileContent("scesim-rule.scesim");
final ScenarioSimulationModel retrieved = ScenarioSimulationXMLPersistence.getInstance().unmarshal(toUnmarshal);
assertEquals(ScenarioSimulationModel.Type.RULE, retrieved.getSettings().getType());
commonCheckSimulation(retrieved);
}
use of org.drools.scenariosimulation.api.model.ScenarioSimulationModel in project drools-wb by kiegroup.
the class ScenarioRunnerServiceImplTest method makeScenarioSimulationModel.
private ScenarioSimulationModel makeScenarioSimulationModel(boolean toSkip) {
Simulation simulation = new Simulation();
Settings settings = new Settings();
settings.setType(Type.RULE);
settings.setSkipFromBuild(toSkip);
ScenarioSimulationModel scenarioSimulationModel = new ScenarioSimulationModel();
scenarioSimulationModel.setSimulation(simulation);
scenarioSimulationModel.setSettings(settings);
scenarioSimulationModel.setBackground(new Background());
return scenarioSimulationModel;
}
use of org.drools.scenariosimulation.api.model.ScenarioSimulationModel in project drools-wb by kiegroup.
the class ScenarioSimulationServiceImplTest method createRULEScenario.
@Test
public void createRULEScenario() {
doReturn(false).when(ioServiceMock).exists(any());
ScenarioSimulationModel model = new ScenarioSimulationModel();
assertNull(model.getSimulation());
assertNull(model.getBackground());
assertNull(model.getSettings());
final Path returnPath = service.create(this.path, "test.scesim", model, "Commit comment", Type.RULE, null);
assertNotNull(returnPath);
assertNotNull(model.getSimulation());
assertNotNull(model.getBackground());
assertNotNull(model.getSettings());
verify(ioServiceMock, times(2)).write(any(org.uberfire.java.nio.file.Path.class), anyString(), any());
}
use of org.drools.scenariosimulation.api.model.ScenarioSimulationModel in project drools-wb by kiegroup.
the class ScenarioSimulationServiceImpl method load.
@Override
public ScenarioSimulationModel load(final Path path) {
try {
final String content = ioService.readAllString(Paths.convert(path));
final ScenarioSimulationModel scenarioSimulationModel = unmarshalInternal(content);
final Settings settings = scenarioSimulationModel.getSettings();
if (settings != null && DMN.equals(settings.getType())) {
try {
dmnTypeService.initializeNameAndNamespace(settings, path, settings.getDmnFilePath());
} catch (ImpossibleToFindDMNException e) {
// this error is not thrown so user can fix the file path manually
logger.error(e.getMessage(), e);
}
}
return scenarioSimulationModel;
} catch (Exception e) {
throw ExceptionUtilities.handleException(e);
}
}
use of org.drools.scenariosimulation.api.model.ScenarioSimulationModel in project drools-wb by kiegroup.
the class ScenarioSimulationServiceImplTest method createFileExists.
@Test(expected = FileAlreadyExistsException.class)
public void createFileExists() throws Exception {
doReturn(true).when(ioServiceMock).exists(any());
ScenarioSimulationModel model = new ScenarioSimulationModel();
service.create(this.path, "test.scesim", model, "Commit comment");
}
Aggregations