2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle * The contents of this file are subject to the terms of the Common Development and
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle * Distribution License (the License). You may not use this file except in compliance with the
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle * specific language governing permission and limitations under the License.
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle * When distributing Covered Software, include this CDDL Header Notice in each file and include
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle * Header, with the fields enclosed by brackets [] replaced by your own identifying
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle * information: "Portions copyright [year] [name of copyright owner]".
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle * Portions copyright 2011-2015 ForgeRock AS.
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienleimport org.forgerock.json.resource.ResourceException;
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle * Basic unit tests for schedule configurations
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle public void configParsingTest() throws ResourceException {
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle // Check valid configuration succeeds
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle Map<String, Object> config = new HashMap<String, Object>();
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle config.put(SchedulerService.SCHEDULE_TYPE, SchedulerService.SCHEDULE_TYPE_CRON);
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle config.put(SchedulerService.SCHEDULE_START_TIME, "2011-05-03T10:00:00");
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle config.put(SchedulerService.SCHEDULE_END_TIME, "2011-05-03T15:59:59");
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle config.put(SchedulerService.SCHEDULE_CRON_SCHEDULE, "0 30 10-13 ? * WED,FRI");
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle config.put(SchedulerService.SCHEDULE_TIME_ZONE, "America/Los_Angeles");
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle config.put(SchedulerService.SCHEDULE_INVOKE_SERVICE, "active-sync");
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle config.put(SchedulerService.SCHEDULE_INVOKE_CONTEXT, "system-x");
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle ScheduleConfig scheduleConfig = new ScheduleConfig(new JsonValue(config));
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle // Basic sanity check on one property
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle @Test(enabled = false, expectedExceptions = ResourceException.class)
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle public void invalidConfigParsingTest() throws ResourceException {
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle // Check invalid configuration fails
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle Map<String, Object> config = new HashMap<String, Object>();
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle config.put(SchedulerService.SCHEDULE_TYPE, SchedulerService.SCHEDULE_TYPE_CRON);
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle config.put(SchedulerService.SCHEDULE_START_TIME, "2011-05-03T10:00:00");
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle config.put(SchedulerService.SCHEDULE_END_TIME, "2011-05-03T15:59:59");
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle config.put(SchedulerService.SCHEDULE_CRON_SCHEDULE, "0 30 10-13 ? * WED,FRI");
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle config.put(SchedulerService.SCHEDULE_TIME_ZONE, "America/Los_Angeles");
2f3539b525a7789b56723ef2553f73d39cf2507echad.kienle // test missing config.put(SchedulerService.SCHEDULE_INVOKE_SERVICE, "active-sync");