use of org.drools.scenariosimulation.api.model.Settings in project drools-wb by kiegroup.
the class ScenarioSimulationServiceImplTest method setup.
@Before
public void setup() {
Set<Package> testPackages = new HashSet<>();
Package testPackage = new Package(path, path, path, path, path, "Test", "", "");
testPackages.add(testPackage);
when(kieModuleServiceMock.resolveModule(any())).thenReturn(kieModuleMock);
when(kieModuleServiceMock.resolvePackages(Mockito.<KieModule>any())).thenReturn(testPackages);
when(kieModuleServiceMock.newPackage(any(), any())).thenReturn(testPackage);
when(kieModuleServiceMock.resolveDefaultPackage(any())).thenReturn(testPackage);
when(kieModuleServiceMock.resolveModule(any())).thenReturn(kieModuleMock);
when(kieModuleMock.getPom()).thenReturn(projectPomMock);
when(projectPomMock.getGav()).thenReturn(gavMock);
when(gavMock.getGroupId()).thenReturn("Test");
when(projectPomMock.getDependencies()).thenReturn(dependenciesMock);
when(dependenciesMock.iterator()).thenReturn(new Dependencies().iterator());
when(ioServiceMock.exists(any())).thenReturn(false);
when(packageMock.getPackageTestSrcPath()).thenReturn(path);
when(scenarioSimulationBuilderMock.createSimulation(any(), any(), any())).thenReturn(new Simulation());
when(scenarioSimulationBuilderMock.createBackground(any(), any(), any())).thenReturn(new Background());
when(scenarioSimulationBuilderMock.createSettings(any(), any(), any())).thenReturn(new Settings());
service.scenarioSimulationBuilder = scenarioSimulationBuilderMock;
}
use of org.drools.scenariosimulation.api.model.Settings 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.Settings in project drools-wb by kiegroup.
the class UpdateSettingsDataCommand method setCurrentContext.
protected CommandResult<ScenarioSimulationViolation> setCurrentContext(ScenarioSimulationContext context) {
try {
if (restorableStatus == null) {
throw new IllegalStateException("restorableStatus is null");
}
final Settings originalSettings = context.getScenarioSimulationModel().getSettings().cloneSettings();
context.getScenarioSimulationEditorPresenter().getModel().setSettings(restorableStatus);
restorableStatus = originalSettings;
if (dmnPathChanged) {
context.getScenarioSimulationEditorPresenter().getPopulateTestToolsCommand().execute();
context.getScenarioSimulationEditorPresenter().validateSimulation();
}
context.getScenarioSimulationEditorPresenter().reloadSettingsDock();
return commonExecution(context);
} catch (Exception e) {
return new CommandResultImpl<>(CommandResult.Type.ERROR, Collections.singleton(new ScenarioSimulationViolation(e.getMessage())));
}
}
use of org.drools.scenariosimulation.api.model.Settings in project drools by kiegroup.
the class AbstractScenarioRunnerTest method setup.
@Before
public void setup() {
settingsLocal = new Settings();
scenarioRunnerDTOLocal = getScenarioRunnerDTO();
abstractScenarioRunnerLocal = spy(new AbstractScenarioRunner(kieContainerMock, scenarioRunnerDTOLocal, ExpressionEvaluatorFactory.create(this.getClass().getClassLoader(), ScenarioSimulationModel.Type.RULE)) {
@Override
protected AbstractRunnerHelper newRunnerHelper() {
return null;
}
});
}
use of org.drools.scenariosimulation.api.model.Settings in project drools by kiegroup.
the class ScenarioJunitActivatorTest method setup.
@Before
public void setup() throws Exception {
simulationLocal = new Simulation();
settingsLocal = new Settings();
settingsLocal.setSkipFromBuild(true);
when(xmlReaderMock.unmarshal(any())).thenReturn(scenarioSimulationModelMock);
when(scenarioSimulationModelMock.getSimulation()).thenReturn(simulationLocal);
when(scenarioSimulationModelMock.getSettings()).thenReturn(settingsLocal);
}
Aggregations