Author: painter
Date: Tue Dec 11 17:06:14 2018
New Revision: 1848699

URL: http://svn.apache.org/viewvc?rev=1848699&view=rev
Log:
Figured out testing error was due to missing quartz.xml - adding to test source 
and errors went away

Added:
    turbine/fulcrum/trunk/quartz/src/test/quartz.xml
Modified:
    turbine/fulcrum/trunk/quartz/src/resources/test/quartz.xml
    
turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/DefaultQuartzSchedulerImplTest.java

Modified: turbine/fulcrum/trunk/quartz/src/resources/test/quartz.xml
URL: 
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/quartz/src/resources/test/quartz.xml?rev=1848699&r1=1848698&r2=1848699&view=diff
==============================================================================
--- turbine/fulcrum/trunk/quartz/src/resources/test/quartz.xml (original)
+++ turbine/fulcrum/trunk/quartz/src/resources/test/quartz.xml Tue Dec 11 
17:06:14 2018
@@ -15,23 +15,26 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 -->
-<job-scheduling-data 
xmlns="http://www.quartz-scheduler.org/xml/JobSchedulingData";
-                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-                     
xsi:schemaLocation="http://www.quartz-scheduler.org/xml/JobSchedulingData 
http://www.quartz-scheduler.org/xml/job_scheduling_data_2_0.xsd";
-                     version="2.0">
-    <pre-processing-commands>
-        <delete-jobs-in-group>*</delete-jobs-in-group>
-        <!-- clear all jobs in scheduler -->
-        <delete-triggers-in-group>*</delete-triggers-in-group>
-        <!-- clear all triggers in scheduler -->
-    </pre-processing-commands>
-    <processing-directives>
-        <!-- if there are any jobs/trigger in scheduler of same name (as in 
this file), overwrite them -->
-        <overwrite-existing-data>true</overwrite-existing-data>
-        <!-- if there are any jobs/trigger in scheduler of same name (as in 
this file), and over-write is false, ignore them rather then generating an 
error -->
-        <ignore-duplicates>false</ignore-duplicates>
-    </processing-directives>
-    <schedule>
+<job-scheduling-data
+       xmlns="http://www.quartz-scheduler.org/xml/JobSchedulingData";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       
xsi:schemaLocation="http://www.quartz-scheduler.org/xml/JobSchedulingData 
http://www.quartz-scheduler.org/xml/job_scheduling_data_2_0.xsd";
+       version="2.0">
+       <pre-processing-commands>
+               <delete-jobs-in-group>*</delete-jobs-in-group>
+               <!-- clear all jobs in scheduler -->
+               <delete-triggers-in-group>*</delete-triggers-in-group>
+               <!-- clear all triggers in scheduler -->
+       </pre-processing-commands>
+       <processing-directives>
+               <!-- if there are any jobs/trigger in scheduler of same name 
(as in this 
+                       file), overwrite them -->
+               <overwrite-existing-data>true</overwrite-existing-data>
+               <!-- if there are any jobs/trigger in scheduler of same name 
(as in this 
+                       file), and over-write is false, ignore them rather then 
generating an error -->
+               <ignore-duplicates>false</ignore-duplicates>
+       </processing-directives>
+<schedule>
         <job>
             <name>simpleJob</name>
             <group>TURBINE</group>

Modified: 
turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/DefaultQuartzSchedulerImplTest.java
URL: 
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/DefaultQuartzSchedulerImplTest.java?rev=1848699&r1=1848698&r2=1848699&view=diff
==============================================================================
--- 
turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/DefaultQuartzSchedulerImplTest.java
 (original)
+++ 
turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/DefaultQuartzSchedulerImplTest.java
 Tue Dec 11 17:06:14 2018
@@ -19,6 +19,9 @@
 
 package org.apache.fulcrum.quartz;
 
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
 import java.util.Date;
 import java.util.List;
 import java.util.Set;
@@ -28,7 +31,6 @@ import org.apache.fulcrum.quartz.test.Si
 import org.junit.Assert;
 import org.junit.jupiter.api.Test;
 import org.quartz.DateBuilder;
-import org.quartz.JobBuilder;
 import org.quartz.JobDetail;
 import org.quartz.JobKey;
 import org.quartz.Scheduler;
@@ -39,125 +41,111 @@ import org.quartz.TriggerKey;
 import org.quartz.impl.matchers.GroupMatcher;
 
 /**
- * @author <a href="mailto:lean...@ibnetwork.com.br";>Leandro Rodrigo Saad 
Cruz</a>
+ * @author <a href="mailto:lean...@ibnetwork.com.br";>Leandro Rodrigo Saad
+ *         Cruz</a>
  * @author <a href="mailto:epughnos...@opensourceconnections.com";>Eric Pugh 
</a>
  */
-public class DefaultQuartzSchedulerImplTest extends BaseQuartzTestCase
-{
+public class DefaultQuartzSchedulerImplTest extends BaseQuartzTestCase {
+
+       /**
+        * Make sure that the Quartz scheduler is up and running
+        * 
+        * @throws Exception generic exception
+        */
+       @Test
+       public void testService() throws Exception {
+               Scheduler scheduler = quartz.getScheduler();
+               Assert.assertNotNull(scheduler);
+               Assert.assertNotNull(scheduler.getContext());
+       }
+
+       /**
+        * The following test has been updated for Quartz 2.3.0 Adding/removing 
a
+        * scheduled job
+        * 
+        * @throws Exception generic exception
+        */
+       @Test
+       public void testAddRemoveTrigger() throws Exception {
+
+               Scheduler scheduler = quartz.getScheduler();
+               TriggerKey triggerKey = TriggerKey.triggerKey("someTrigger", 
"TURBINE");
+
+               Date date = DateBuilder.dateOf(0, 0, 0, 1, 1, 2099);
+
+               Trigger someDay = 
TriggerBuilder.newTrigger().withIdentity(triggerKey).forJob("simpleJob", 
"TURBINE")
+                               
.withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInHours(1).repeatForever())
+                               .startAt(date).build();
+
+               scheduler.scheduleJob(someDay);
 
-    /**
-     * Make sure that the Quartz scheduler is up and running
-     * 
-     * @throws Exception generic exception
-     */
-       @Test
-    public void testService() throws Exception
-    {
-        Scheduler scheduler = quartz.getScheduler();
-        Assert.assertNotNull(scheduler);
-        Assert.assertNotNull(scheduler.getContext());
-    }
-       
-
-    /**
-     * The following test has been updated for Quartz 2.3.0
-     * Adding/removing a scheduled job
-     * @throws Exception generic exception
-     */
-    @Test
-    public void testAddRemoveTrigger() throws Exception
-    {
-        Scheduler scheduler = quartz.getScheduler();
-        Assert.assertNotNull(scheduler);
-        Assert.assertNotNull(scheduler.getContext());
-        
-       // Define job instance
-       JobDetail job1 = JobBuilder.newJob(SimpleJob.class)
-           .withIdentity("simpleJob", "TURBINE")
-           .build();
-
-       // Define a Trigger that will fire "now", and not repeat
-       Trigger trigger = TriggerBuilder.newTrigger()
-           .withIdentity("someTrigger", "TURBINE")
-           .startNow()
-           .build();
-
-       // Schedule the job with the trigger
-       scheduler.scheduleJob(job1, trigger);
-
-       TriggerKey triggerKey = new TriggerKey("someTrigger", "TURBINE");
-        Trigger t1 = scheduler.getTrigger(triggerKey);
-        
-        // System.out.println(" >> KEY: " + t1.getJobKey().toString());
-        
-        Assert.assertNotNull(t1);
-        scheduler.unscheduleJob(triggerKey);
-        trigger = scheduler.getTrigger(triggerKey);
-        Assert.assertNull(trigger);
-    }
-       
-       
-//
-//    /**
-//     * Get all scheduled jobs for "TURBINE" to make sure that
-//     * the registration worked.
-//     * @throws Exception generic exception 
-//     */
-//    @Test
-//    public void testGetJobs() throws Exception
-//    {
-//        Scheduler scheduler = quartz.getScheduler();
-//        Assert.assertNotNull(scheduler);
-//        Set<JobKey> jobNames = 
scheduler.getJobKeys(GroupMatcher.jobGroupEquals("TURBINE"));
-//        Assert.assertEquals("Expected two registered jobs", 2, 
jobNames.size());
-//    }
-//    
-//
-//    /**
-//     * Get the job details and job data map of an existing job to
-//     * make sure that the XStream configuration works.
-//     * @throws Exception generic exception
-//     */
-//    @Test
-//    public void testJobDetailMap() throws Exception
-//    {
-//     
-//        JobDetail jobDetail = 
quartz.getScheduler().getJobDetail(JobKey.jobKey("simpleJob", "TURBINE"));
-//        Assert.assertNotNull(jobDetail);
-//        Assert.assertEquals("simpleJob", jobDetail.getKey().getName());
-//        Assert.assertNotNull(jobDetail.getJobDataMap());
-//        Assert.assertEquals(2, jobDetail.getJobDataMap().size());
-//    }
-//
-//    /**
-//     * Make sure the "notSoSimpleJob" is triggered by the CronTrigger.
-//     * @throws Exception generic exception
-//     */
-//    @Test
-//    public void testGetTriggersOfJob() throws Exception
-//    {
-//        List<? extends Trigger> triggers = 
quartz.getScheduler().getTriggersOfJob(JobKey.jobKey("notSoSimpleJob", 
"TURBINE"));
-//        Assert.assertEquals(1, triggers.size());
-//        Assert.assertEquals("cronTrigger", 
((Trigger)triggers.get(0)).getKey().getName());
-//    }
-//
-//    /**
-//     * Make sure that our two registered jobs are executed after
-//     * one second.
-//     * @throws Exception generic exception
-//     */
-//    @Test
-//    public void testJobExecution() throws Exception
-//    {
-//        Thread.sleep(2000);
-//        Assert.assertTrue("SimpleJob was not executed", 
SimpleJob.wasExecuted);
-//        Assert.assertTrue("NotSoSimpleJob was not executed", 
NotSoSimpleJob.wasExecuted);
-//        Assert.assertTrue("NotSoSimpleJob was not serviced", 
NotSoSimpleJob.wasServiced);
-//        SimpleJob.reset();
-//        NotSoSimpleJob.reset();
-//        Thread.sleep(2000);
-//        Assert.assertTrue("SimpleJob was not executed", 
SimpleJob.wasExecuted);
-//        Assert.assertTrue("NotSoSimpleJob was not executed", 
NotSoSimpleJob.wasExecuted);
-//        Assert.assertTrue("NotSoSimpleJob was not serviced", 
NotSoSimpleJob.wasServiced);
-//    }
+               Trigger trigger = scheduler.getTrigger(triggerKey);
+               assertNotNull(trigger);
+               scheduler.unscheduleJob(triggerKey);
+               trigger = scheduler.getTrigger(triggerKey);
+               assertNull(trigger);
+
+       }
+
+       /**
+        * Get all scheduled jobs for "TURBINE" to make sure that the 
registration
+        * worked.
+        * 
+        * @throws Exception generic exception
+        */
+       @Test
+       public void testGetJobs() throws Exception {
+               Scheduler scheduler = quartz.getScheduler();
+               Assert.assertNotNull(scheduler);
+               Set<JobKey> jobNames = 
scheduler.getJobKeys(GroupMatcher.jobGroupEquals("TURBINE"));
+               Assert.assertEquals("Expected two registered jobs", 2, 
jobNames.size());
+       }
+
+       /**
+        * Get the job details and job data map of an existing job to make sure 
that the
+        * XStream configuration works.
+        * 
+        * @throws Exception generic exception
+        */
+       @Test
+       public void testJobDetailMap() throws Exception {
+
+               JobDetail jobDetail = 
quartz.getScheduler().getJobDetail(JobKey.jobKey("simpleJob", "TURBINE"));
+               Assert.assertNotNull(jobDetail);
+               Assert.assertEquals("simpleJob", jobDetail.getKey().getName());
+               Assert.assertNotNull(jobDetail.getJobDataMap());
+               Assert.assertEquals(2, jobDetail.getJobDataMap().size());
+       }
+
+       /**
+        * Make sure the "notSoSimpleJob" is triggered by the CronTrigger.
+        * 
+        * @throws Exception generic exception
+        */
+       @Test
+       public void testGetTriggersOfJob() throws Exception {
+               List<? extends Trigger> triggers = quartz.getScheduler()
+                               
.getTriggersOfJob(JobKey.jobKey("notSoSimpleJob", "TURBINE"));
+               Assert.assertEquals(1, triggers.size());
+               Assert.assertEquals("cronTrigger", ((Trigger) 
triggers.get(0)).getKey().getName());
+       }
+
+       /**
+        * Make sure that our two registered jobs are executed after one second.
+        * 
+        * @throws Exception generic exception
+        */
+       @Test
+       public void testJobExecution() throws Exception {
+               Thread.sleep(2000);
+               Assert.assertTrue("SimpleJob was not executed", 
SimpleJob.wasExecuted);
+               Assert.assertTrue("NotSoSimpleJob was not executed", 
NotSoSimpleJob.wasExecuted);
+               Assert.assertTrue("NotSoSimpleJob was not serviced", 
NotSoSimpleJob.wasServiced);
+               SimpleJob.reset();
+               NotSoSimpleJob.reset();
+               Thread.sleep(2000);
+               Assert.assertTrue("SimpleJob was not executed", 
SimpleJob.wasExecuted);
+               Assert.assertTrue("NotSoSimpleJob was not executed", 
NotSoSimpleJob.wasExecuted);
+               Assert.assertTrue("NotSoSimpleJob was not serviced", 
NotSoSimpleJob.wasServiced);
+       }
 }

Added: turbine/fulcrum/trunk/quartz/src/test/quartz.xml
URL: 
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/quartz/src/test/quartz.xml?rev=1848699&view=auto
==============================================================================
--- turbine/fulcrum/trunk/quartz/src/test/quartz.xml (added)
+++ turbine/fulcrum/trunk/quartz/src/test/quartz.xml Tue Dec 11 17:06:14 2018
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<job-scheduling-data
+       xmlns="http://www.quartz-scheduler.org/xml/JobSchedulingData";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       
xsi:schemaLocation="http://www.quartz-scheduler.org/xml/JobSchedulingData 
http://www.quartz-scheduler.org/xml/job_scheduling_data_2_0.xsd";
+       version="2.0">
+       <pre-processing-commands>
+               <delete-jobs-in-group>*</delete-jobs-in-group>
+               <!-- clear all jobs in scheduler -->
+               <delete-triggers-in-group>*</delete-triggers-in-group>
+               <!-- clear all triggers in scheduler -->
+       </pre-processing-commands>
+       <processing-directives>
+               <!-- if there are any jobs/trigger in scheduler of same name 
(as in this 
+                       file), overwrite them -->
+               <overwrite-existing-data>true</overwrite-existing-data>
+               <!-- if there are any jobs/trigger in scheduler of same name 
(as in this 
+                       file), and over-write is false, ignore them rather then 
generating an error -->
+               <ignore-duplicates>false</ignore-duplicates>
+       </processing-directives>
+<schedule>
+        <job>
+            <name>simpleJob</name>
+            <group>TURBINE</group>
+            <description>A simple job</description>
+            <job-class>org.apache.fulcrum.quartz.test.SimpleJob</job-class>
+            <job-data-map>
+                <entry>
+                    <key>dressing-list</key>
+                    <value>ketchup,mayo</value>
+                </entry>
+                <entry>
+                    <key>burger-type</key>
+                    <value>hotdog</value>
+                </entry>
+            </job-data-map>
+        </job>
+        <job>
+            <name>notSoSimpleJob</name>
+            <group>TURBINE</group>
+            <description>A not so simple job using a service 
manager</description>
+            
<job-class>org.apache.fulcrum.quartz.test.NotSoSimpleJob</job-class>
+        </job>
+        <trigger>
+            <cron>
+                <!-- define a Cron trigger firing every second from now on -->
+                <name>cronTrigger</name>
+                <group>TURBINE</group>
+                <job-name>notSoSimpleJob</job-name>
+                <job-group>TURBINE</job-group>
+                <cron-expression>* * * * * ?</cron-expression>
+            </cron>
+        </trigger>
+        <trigger>
+            <simple>
+                <!-- define a simple trigger firing every second -->
+                <name>simpleTrigger</name>
+                <group>TURBINE</group>
+                <job-name>simpleJob</job-name>
+                <job-group>TURBINE</job-group>
+                <start-time>2010-08-01T00:00:00</start-time>
+                
<misfire-instruction>MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT</misfire-instruction>
+                <repeat-count>-1</repeat-count>
+                <repeat-interval>1000</repeat-interval>
+            </simple>
+        </trigger>
+    </schedule>
+</job-scheduling-data>


Reply via email to