001: /*
002: * ChainBuilder ESB
003: * Visual Enterprise Integration
004: *
005: * Copyright (C) 2007 Bostech Corporation
006: *
007: * This program is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU General Public License as published by the
009: * Free Software Foundation; either version 2 of the License, or (at your option)
010: * any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
014: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
015: * for more details.
016: *
017: * You should have received a copy of the GNU General Public License along with
018: * this program; if not, write to the Free Software Foundation, Inc.,
019: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: *
021: *
022: * $Id: ComponentScheduleTest.java 6898 2007-04-18 15:35:56Z mpreston $
023: */
024: package com.bostechcorp.cbesb.runtime.scheduler;
025:
026: import java.io.File;
027: import javax.xml.namespace.QName;
028:
029: import junit.framework.TestCase;
030:
031: public class ComponentScheduleTest extends TestCase {
032:
033: /**
034: * @param name
035: */
036: public ComponentScheduleTest(String name) {
037: super (name);
038: }
039:
040: /* (non-Javadoc)
041: * @see junit.framework.TestCase#setUp()
042: */
043: protected void setUp() throws Exception {
044: super .setUp();
045: }
046:
047: /* (non-Javadoc)
048: * @see junit.framework.TestCase#tearDown()
049: */
050: protected void tearDown() throws Exception {
051: super .tearDown();
052: }
053:
054: public void testIO() {
055: try {
056: File compSchedFile1 = new File(
057: "target/test-data/compSched1.xml");
058: File compSchedFile2 = new File(
059: "target/test-data/compSched2.xml");
060:
061: ComponentSchedule compSched1 = new ComponentSchedule();
062: //Create a new standard schedule and add it
063: //to the component schedule
064: StandardSchedule standSched = new StandardSchedule();
065: standSched.setSeconds("0");
066: standSched.setMinutes("0,15,30,45");
067: standSched.setHours("9-17");
068: standSched.setDayOfMonth("?");
069: standSched.setMonth("*");
070: standSched.setDayOfWeek("MON-FRI");
071: compSched1.addSchedule(standSched);
072: //Create a new auto-retry schedule
073: AutoRetrySchedule autoSched = new AutoRetrySchedule();
074: autoSched.setStartTime("16:00:00");
075: autoSched.setEndTime("18:00:00");
076: autoSched.setRetryInterval(60);
077: autoSched.setDayOfMonth("1,15");
078: autoSched.setMonth("*");
079: autoSched.setDayOfWeek("?");
080: autoSched.setHolidaySchedule("MyHolidays.hol");
081: autoSched.setSuccessNotificationService(new QName(
082: "http://bostechcorp.com/SU/SA1_Email",
083: "SA1_Email_Service"));
084: autoSched.setSuccessNotificationEndpoint("SA1_Email");
085: autoSched.setFailureNotificationService(new QName(
086: "http://bostechcorp.com/SU/SA1_Email",
087: "SA1_Email_Service"));
088: autoSched.setFailureNotificationEndpoint("SA1_Email");
089: compSched1.addSchedule(autoSched);
090:
091: compSched1.save(compSchedFile1);
092:
093: ComponentSchedule compSched2 = new ComponentSchedule();
094: compSched2.load(compSchedFile1);
095: compSched2.save(compSchedFile2);
096:
097: } catch (Exception e) {
098: e.printStackTrace();
099: fail();
100: }
101: }
102: }
|