@Override public ScenarioInstance run(ScenarioDefinition scenarioDefinition) { List<String> experimentSeriesNames = new ArrayList<String>(); for (MeasurementSpecification ms : scenarioDefinition.getMeasurementSpecifications()) { for (ExperimentSeriesDefinition esd : ms.getExperimentSeriesDefinitions()) { experimentSeriesNames.add(ms.getName() + "." + esd.getName()); } } return run(scenarioDefinition, experimentSeriesNames); }
@Override public ScenarioInstance run( ScenarioDefinition scenarioDefinition, Collection<String> experimentSeriesNames) { if (experimentSeriesNames == null || experimentSeriesNames.isEmpty()) { throw new RuntimeException("List of experiment series names is empty or null!"); } ScenarioInstance scenarioInstance = retrieveScenarioInstance(scenarioDefinition); scenarioInstance.getScenarioDefinition().getAllExperimentSeriesDefinitions(); Map<MeasurementSpecification, List<ExperimentSeriesDefinition>> experimentSeries = new HashMap<MeasurementSpecification, List<ExperimentSeriesDefinition>>(); for (MeasurementSpecification ms : scenarioDefinition.getMeasurementSpecifications()) { List<ExperimentSeriesDefinition> currentExpSeriesList = new ArrayList<ExperimentSeriesDefinition>(); for (ExperimentSeriesDefinition esd : ms.getExperimentSeriesDefinitions()) { for (String expSeriesName : experimentSeriesNames) { if ((ms.getName() + "." + esd.getName()).equals(expSeriesName)) { currentExpSeriesList.add(esd); } } } if (!currentExpSeriesList.isEmpty()) { experimentSeries.put(ms, currentExpSeriesList); } } runExperimentSeries(scenarioInstance, experimentSeries); try { ScenarioInstance loadedScenario = persistenceProvider.loadScenarioInstance(scenarioInstance.getPrimaryKey()); return loadedScenario; } catch (DataNotFoundException e) { LOGGER.error( "Cannot load the scenario from the persistnce provider. Something is seriously gone wrong."); throw new RuntimeException("Something went wrong"); } }