Modified: jakarta/turbine/stratum/trunk/src/test/org/apache/stratum/scheduler/TestScheduler.java URL: http://svn.apache.org/viewcvs/jakarta/turbine/stratum/trunk/src/test/org/apache/stratum/scheduler/TestScheduler.java?rev=264191&r1=264190&r2=264191&view=diff ============================================================================== --- jakarta/turbine/stratum/trunk/src/test/org/apache/stratum/scheduler/TestScheduler.java (original) +++ jakarta/turbine/stratum/trunk/src/test/org/apache/stratum/scheduler/TestScheduler.java Mon Aug 29 11:07:52 2005 @@ -31,32 +31,58 @@ import org.apache.commons.betwixt.strategy.DefaultPluralStemmer; import org.apache.commons.configuration.PropertiesConfiguration; - /** - * Test harness for the Scheduler - * - * @author <a href="mailto:[EMAIL PROTECTED]">John Thorhauer</a> - * @version $Id$ - */ -public class TestScheduler extends TestCase { - - private static final String XML = "src/test-conf/Scheduler.xml"; - private static final String PROPERTIES = - "src/test-conf/Scheduler.properties"; + * Test harness for the Scheduler + * + * @author <a href="mailto:[EMAIL PROTECTED]">John Thorhauer</a> + * @version $Id$ + */ +public class TestScheduler + extends TestCase +{ + /** TODO: DOCUMENT ME! */ + private static final String XML = "src/test-conf/Scheduler.xml"; + + /** TODO: DOCUMENT ME! */ + private static final String PROPERTIES = "src/test-conf/Scheduler.properties"; - public static void main( String[] args ) { - TestRunner.run( suite() ); + /** + * TODO: DOCUMENT ME! + * + * @param args TODO: DOCUMENT ME! + */ + public static void main(String [] args) + { + TestRunner.run(suite()); } - public static Test suite() { + /** + * TODO: DOCUMENT ME! + * + * @return TODO: DOCUMENT ME! + */ + public static Test suite() + { return new TestSuite(TestScheduler.class); } - public TestScheduler(String testName) { + /** + * Creates a new TestScheduler object. + * + * @param testName TODO: DOCUMENT ME! + */ + public TestScheduler(String testName) + { super(testName); } - public void testLoadXmlConfig() throws Exception + /** + * TODO: DOCUMENT ME! + * + * @throws Exception TODO: DOCUMENT ME! + */ + public void testLoadXmlConfig() + throws Exception { SchedulerConfig schedConf = new SchedulerConfig(); FileInputStream in = new FileInputStream(new File(XML)); @@ -67,21 +93,20 @@ SchedulerConfig schedConf2 = (SchedulerConfig) reader.parse(in); assertNotNull("scheduler should not be null.", schedConf2); - assertEquals("there should be 2 job configurations", - 2, - schedConf2.getJobConfigs().size()); - assertEquals("there should be 2 triggers", - 2, - schedConf2.getTriggerConfigs().size()); - assertTrue("scheduler name should be scheduler1", - schedConf2.getInstanceName().equals("scheduler1")); - - assertTrue("job name should be job1", - ((JobConfig)(schedConf2.getJobConfigs().get(0))).getName().equals("job1")); + assertEquals("there should be 2 job configurations", 2, schedConf2.getJobConfigs().size()); + assertEquals("there should be 2 triggers", 2, schedConf2.getTriggerConfigs().size()); + assertTrue("scheduler name should be scheduler1", schedConf2.getInstanceName().equals("scheduler1")); + assertTrue("job name should be job1", ((JobConfig) (schedConf2.getJobConfigs().get(0))).getName().equals("job1")); } - public void testRunScheduler() throws Exception + /** + * TODO: DOCUMENT ME! + * + * @throws Exception TODO: DOCUMENT ME! + */ + public void testRunScheduler() + throws Exception { Scheduler sched = new Scheduler(); PropertiesConfiguration conf = new PropertiesConfiguration(PROPERTIES); @@ -89,34 +114,36 @@ try { - sched.start(); - Thread.currentThread().sleep(5000); - sched.stop(); + sched.start(); + Thread.currentThread().sleep(5000); + sched.stop(); } catch (InterruptedException e) { - e.printStackTrace(); + e.printStackTrace(); } - - } // Implementation methods //------------------------------------------------------------------------- - - protected BeanReader createBeanReader() throws Exception { + protected BeanReader createBeanReader() + throws Exception + { BeanReader reader = new BeanReader(); - reader.setXMLIntrospector( createXMLIntrospector() ); - reader.registerBeanClass( SchedulerConfig.class ); + reader.setXMLIntrospector(createXMLIntrospector()); + reader.registerBeanClass(SchedulerConfig.class); + return reader; } /** - * ### it would be really nice to move this somewhere shareable across - * Maven / Turbine projects. Maybe a static helper method - question is - * what to call it??? + * ### it would be really nice to move this somewhere shareable across Maven / Turbine projects. Maybe a static helper method - + * question is what to call it??? + * + * @return TODO: DOCUMENT ME! */ - protected XMLIntrospector createXMLIntrospector() { + protected XMLIntrospector createXMLIntrospector() + { XMLIntrospector introspector = new XMLIntrospector(); // set elements for attributes to true @@ -124,14 +151,11 @@ // wrap collections in an XML element //introspector.setWrapCollectionsInElement(true); - // turn bean elements first letter into lower case - introspector.setNameMapper( new DecapitalizeNameMapper() ); + introspector.setNameMapper(new DecapitalizeNameMapper()); - introspector.setPluralStemmer( new DefaultPluralStemmer() ); + introspector.setPluralStemmer(new DefaultPluralStemmer()); return introspector; } - } -
Modified: jakarta/turbine/stratum/trunk/src/test/org/apache/stratum/scheduler/examplejobs/JobOne.java URL: http://svn.apache.org/viewcvs/jakarta/turbine/stratum/trunk/src/test/org/apache/stratum/scheduler/examplejobs/JobOne.java?rev=264191&r1=264190&r2=264191&view=diff ============================================================================== --- jakarta/turbine/stratum/trunk/src/test/org/apache/stratum/scheduler/examplejobs/JobOne.java (original) +++ jakarta/turbine/stratum/trunk/src/test/org/apache/stratum/scheduler/examplejobs/JobOne.java Mon Aug 29 11:07:52 2005 @@ -23,44 +23,45 @@ import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; - /** - * <p>A dumb implementation of Job, for unittesting purposes.</p> + * <p> + * A dumb implementation of Job, for unittesting purposes. + * </p> * * @author James House */ -public class JobOne implements Job { - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * - * Constructors. - * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - public JobOne() - { - } - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * - * Interface. - * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /** - * <p>Called by the <code>[EMAIL PROTECTED] org.quartz.Scheduler}</code> when a - * <code>[EMAIL PROTECTED] org.quartz.Trigger}</code> fires that is associated with the - * <code>Job</code>.</p> - * - * @throws JobExecutionException if there is an exception while executing - * the job. - */ - public void execute(JobExecutionContext context) - throws JobExecutionException - { - System.out.println(" --- Testing Scheduler Component\n --- " - + context.getJobDetail().getFullName() + " executed.[" + new Date() + "]"); - } - +public class JobOne + implements Job +{ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Constructors. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + public JobOne() + { + } + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Interface. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + /** + * <p> + * Called by the <code>[EMAIL PROTECTED] org.quartz.Scheduler}</code> when a <code>[EMAIL PROTECTED] org.quartz.Trigger}</code> fires that is + * associated with the <code>Job</code>. + * </p> + * + * @param context TODO: DOCUMENT ME! + * + * @throws JobExecutionException if there is an exception while executing the job. + */ + public void execute(JobExecutionContext context) + throws JobExecutionException + { + System.out.println(" --- Testing Scheduler Component\n --- " + context.getJobDetail().getFullName() + " executed.[" + + new Date() + "]"); + } } Modified: jakarta/turbine/stratum/trunk/src/test/org/apache/stratum/scheduler/examplejobs/JobTwo.java URL: http://svn.apache.org/viewcvs/jakarta/turbine/stratum/trunk/src/test/org/apache/stratum/scheduler/examplejobs/JobTwo.java?rev=264191&r1=264190&r2=264191&view=diff ============================================================================== --- jakarta/turbine/stratum/trunk/src/test/org/apache/stratum/scheduler/examplejobs/JobTwo.java (original) +++ jakarta/turbine/stratum/trunk/src/test/org/apache/stratum/scheduler/examplejobs/JobTwo.java Mon Aug 29 11:07:52 2005 @@ -23,43 +23,45 @@ import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; - /** - * <p>A dumb implementation of Job, for unittesting purposes.</p> + * <p> + * A dumb implementation of Job, for unittesting purposes. + * </p> * * @author James House */ -public class JobTwo implements Job { - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * - * Constructors. - * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - public JobTwo() - { - } - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * - * Interface. - * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /** - * <p>Called by the <code>[EMAIL PROTECTED] org.quartz.Scheduler}</code> when a - * <code>[EMAIL PROTECTED] org.quartz.Trigger}</code> fires that is associated with the - * <code>Job</code>.</p> - * - * @throws JobExecutionException if there is an exception while executing - * the job. - */ - public void execute(JobExecutionContext context) - throws JobExecutionException - { - System.err.println(" --- Testing Scheduler Component\n --- " - + context.getJobDetail().getFullName() + " executed.[" + new Date() + "]"); - } - +public class JobTwo + implements Job +{ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Constructors. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + public JobTwo() + { + } + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Interface. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + /** + * <p> + * Called by the <code>[EMAIL PROTECTED] org.quartz.Scheduler}</code> when a <code>[EMAIL PROTECTED] org.quartz.Trigger}</code> fires that is + * associated with the <code>Job</code>. + * </p> + * + * @param context TODO: DOCUMENT ME! + * + * @throws JobExecutionException if there is an exception while executing the job. + */ + public void execute(JobExecutionContext context) + throws JobExecutionException + { + System.err.println(" --- Testing Scheduler Component\n --- " + context.getJobDetail().getFullName() + " executed.[" + + new Date() + "]"); + } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]