Search in sources :

Example 1 with ActivityCalendar

use of org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.activitycalendar.ActivityCalendar in project open-smart-grid-platform by OSGP.

the class BundledSetActivityCalendarSteps method theActivityCalendarContainsASeasonProfile.

@Given("^the activity calendar contains a season profile$")
public void theActivityCalendarContainsASeasonProfile(final Map<String, String> parameters) throws Throwable {
    final ActivityCalendar activityCalendar = (ActivityCalendar) ScenarioContext.current().get(PlatformSmartmeteringKeys.ACTIVITY_CALENDAR);
    final String name = parameters.get(PlatformSmartmeteringKeys.SEASON_PROFILE_NAME);
    final String start = parameters.get(PlatformSmartmeteringKeys.SEASON_PROFILE_START);
    final String weekName = parameters.get(PlatformSmartmeteringKeys.SEASON_PROFILE_WEEK_NAME);
    final SeasonProfile profile = new SeasonProfile(name, start, weekName);
    activityCalendar.getSeasonProfiles().put(name, profile);
    ScenarioContext.current().put(PlatformSmartmeteringKeys.ACTIVITY_CALENDAR, activityCalendar);
}
Also used : ActivityCalendar(org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.activitycalendar.ActivityCalendar) SeasonProfile(org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.activitycalendar.SeasonProfile) Given(io.cucumber.java.en.Given)

Example 2 with ActivityCalendar

use of org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.activitycalendar.ActivityCalendar in project open-smart-grid-platform by OSGP.

the class BundledSetActivityCalendarSteps method theBundleRequestContainsASetActivityCalendarAction.

@Given("^the bundle request contains a set activity calendar action$")
public void theBundleRequestContainsASetActivityCalendarAction() throws Throwable {
    SetActivityCalendarRequest action;
    if (ScenarioContext.current().get(PlatformSmartmeteringKeys.ACTIVITY_CALENDAR) == null) {
        action = new SetActivityCalendarRequestBuilder().withDefaults().build();
    } else {
        final ActivityCalendar activityCalendar = (ActivityCalendar) ScenarioContext.current().get(PlatformSmartmeteringKeys.ACTIVITY_CALENDAR);
        action = new SetActivityCalendarRequestBuilder().withActivityCalendar(activityCalendar).build();
    }
    this.addActionToBundleRequest(action);
}
Also used : ActivityCalendar(org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.activitycalendar.ActivityCalendar) SetActivityCalendarRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.SetActivityCalendarRequest) SetActivityCalendarRequestBuilder(org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.SetActivityCalendarRequestBuilder) Given(io.cucumber.java.en.Given)

Example 3 with ActivityCalendar

use of org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.activitycalendar.ActivityCalendar in project open-smart-grid-platform by OSGP.

the class BundledSetActivityCalendarSteps method anActivityCalendar.

@Given("^an activity calendar$")
public void anActivityCalendar(final Map<String, String> parameters) throws Throwable {
    final String name = parameters.get(PlatformSmartmeteringKeys.ACTIVITY_CALENDAR_NAME);
    final String activatePassiveCalendarTime = parameters.get(PlatformSmartmeteringKeys.ACTIVITY_CALENDAR_ACTIVATE_PASSIVE_CALENDAR_TIME);
    final ActivityCalendar activityCalendar = new ActivityCalendar(name, activatePassiveCalendarTime);
    ScenarioContext.current().put(PlatformSmartmeteringKeys.ACTIVITY_CALENDAR, activityCalendar);
}
Also used : ActivityCalendar(org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.activitycalendar.ActivityCalendar) Given(io.cucumber.java.en.Given)

Example 4 with ActivityCalendar

use of org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.activitycalendar.ActivityCalendar in project open-smart-grid-platform by OSGP.

the class BundledSetActivityCalendarSteps method theActivityCalendarContainsAWeekProfile.

@Given("^the activity calendar contains a week profile$")
public void theActivityCalendarContainsAWeekProfile(final Map<String, String> parameters) throws Throwable {
    final ActivityCalendar activityCalendar = (ActivityCalendar) ScenarioContext.current().get(PlatformSmartmeteringKeys.ACTIVITY_CALENDAR);
    final String name = parameters.get(PlatformSmartmeteringKeys.WEEK_PROFILE_NAME);
    final int monday = Integer.parseInt(parameters.get(PlatformSmartmeteringKeys.WEEK_PROFILE_MONDAY_DAY_ID));
    final int tuesday = Integer.parseInt(parameters.get(PlatformSmartmeteringKeys.WEEK_PROFILE_TUESDAY_DAY_ID));
    final int wednesday = Integer.parseInt(parameters.get(PlatformSmartmeteringKeys.WEEK_PROFILE_WEDNESDAY_DAY_ID));
    final int thursday = Integer.parseInt(parameters.get(PlatformSmartmeteringKeys.WEEK_PROFILE_THURSDAY_DAY_ID));
    final int friday = Integer.parseInt(parameters.get(PlatformSmartmeteringKeys.WEEK_PROFILE_FRIDAY_DAY_ID));
    final int saturday = Integer.parseInt(parameters.get(PlatformSmartmeteringKeys.WEEK_PROFILE_SATURDAY_DAY_ID));
    final int sunday = Integer.parseInt(parameters.get(PlatformSmartmeteringKeys.WEEK_PROFILE_SUNDAY_DAY_ID));
    final WeekProfile profile = new WeekProfile(name, monday, tuesday, wednesday, thursday, friday, saturday, sunday);
    activityCalendar.getWeekProfiles().put(name, profile);
    ScenarioContext.current().put(PlatformSmartmeteringKeys.ACTIVITY_CALENDAR, activityCalendar);
}
Also used : WeekProfile(org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.activitycalendar.WeekProfile) ActivityCalendar(org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.activitycalendar.ActivityCalendar) Given(io.cucumber.java.en.Given)

Example 5 with ActivityCalendar

use of org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.activitycalendar.ActivityCalendar 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);
}
Also used : ActivityCalendar(org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.activitycalendar.ActivityCalendar) DayProfile(org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.activitycalendar.DayProfile) DayProfileAction(org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.activitycalendar.DayProfileAction) Given(io.cucumber.java.en.Given)

Aggregations

Given (io.cucumber.java.en.Given)5 ActivityCalendar (org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.activitycalendar.ActivityCalendar)5 SetActivityCalendarRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.SetActivityCalendarRequest)1 SetActivityCalendarRequestBuilder (org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.SetActivityCalendarRequestBuilder)1 DayProfile (org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.activitycalendar.DayProfile)1 DayProfileAction (org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.activitycalendar.DayProfileAction)1 SeasonProfile (org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.activitycalendar.SeasonProfile)1 WeekProfile (org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.activitycalendar.WeekProfile)1