use of org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.activitycalendar.DayProfileAction in project open-smart-grid-platform by OSGP.
the class BundledSetActivityCalendarSteps method theActivityCalendarContainsADayProfile.
@Given("^the activity calendar contains a day profile$")
public void theActivityCalendarContainsADayProfile(final Map<String, String> parameters) throws Throwable {
final ActivityCalendar activityCalendar = (ActivityCalendar) ScenarioContext.current().get(PlatformSmartmeteringKeys.ACTIVITY_CALENDAR);
final int dayId = Integer.parseInt(parameters.get(PlatformSmartmeteringKeys.DAY_PROFILE_DAY_ID));
final int actionCount = Integer.parseInt(parameters.get(PlatformSmartmeteringKeys.DAY_PROFILE_ACTION_COUNT));
final DayProfile profile = new DayProfile(dayId);
for (int i = 1; i <= actionCount; i++) {
final String start = SettingsHelper.getStringValue(parameters, PlatformSmartmeteringKeys.DAY_PROFILE_START_TIME, i);
final int selector = SettingsHelper.getIntegerValue(parameters, PlatformSmartmeteringKeys.DAY_PROFILE_SCRIPT_SELECTOR, i);
profile.getDayProfileActions().add(new DayProfileAction(start, selector));
}
activityCalendar.getDayProfiles().put(dayId, profile);
ScenarioContext.current().put(PlatformSmartmeteringKeys.ACTIVITY_CALENDAR, activityCalendar);
}
Aggregations