This is an automated email from the ASF dual-hosted git repository. gk pushed a commit to tag FULCRUM_QUARTZ_1_1_0 in repository https://gitbox.apache.org/repos/asf/turbine-fulcrum-quartz.git
commit bb9827c433cc37698a1eec1c9f4f008560867c44 Author: Thomas Vandahl <[email protected]> AuthorDate: Wed Sep 14 17:55:47 2011 +0000 [maven-release-plugin] copy for tag FULCRUM_QUARTZ_1_1_0 git-svn-id: https://svn.apache.org/repos/asf/turbine/fulcrum/tags/FULCRUM_QUARTZ_1_1_0@1170742 13f79535-47bb-0310-9956-ffa450edef68 --- NOTICE.txt | 2 +- pom.xml | 263 +++++++++++---------- project.properties | 35 --- project.xml | 69 ------ src/{site/xdoc => changes}/changes.xml | 5 +- .../fulcrum/quartz/impl/QuartzSchedulerImpl.java | 49 ++-- src/site/xdoc/index.xml | 10 +- src/site/xdoc/navigation.xml | 39 --- .../quartz/DefaultQuartzSchedulerImplTest.java | 50 ++-- src/test/quartz.xml | 5 +- 10 files changed, 211 insertions(+), 316 deletions(-) diff --git a/NOTICE.txt b/NOTICE.txt index f55d686..1a28567 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1,5 +1,5 @@ Turbine Fulcrum Quartz -Copyright 2004-2008 The Apache Software Foundation. +Copyright 2004-2011 The Apache Software Foundation. This product includes software developed at The Apache Software Foundation (http://www.apache.org/). diff --git a/pom.xml b/pom.xml index b5eeafe..87ce23f 100644 --- a/pom.xml +++ b/pom.xml @@ -1,126 +1,137 @@ -<?xml version="1.0"?> -<!-- - 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. ---> -<project - xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <parent> - <groupId>org.apache.fulcrum</groupId> - <artifactId>fulcrum-parent</artifactId> - <version>1</version> - </parent> - - <modelVersion>4.0.0</modelVersion> - <artifactId>fulcrum-quartz</artifactId> - <version>1.1.0-SNAPSHOT</version> - <name>Fulcrum Quartz</name> - <inceptionYear>2004</inceptionYear> - <description>A wrapper around the Quartz Scheduler.</description> - <url>http://turbine.apache.org/fulcrum/fulcrum-quartz/</url> - - <scm> - <connection>scm:svn:http://svn.apache.org/repos/asf/turbine/fulcrum/trunk/quartz/</connection> - <developerConnection>scm:svn:https://svn.apache.org/repos/asf/turbine/fulcrum/trunk/quartz/</developerConnection> - <url>http://svn.apache.org/viewcvs/turbine/fulcrum/trunk/quartz/</url> - </scm> - - <distributionManagement> - <site> - <id>apache.website</id> - <name>Fulcrum Website</name> - <url>${fulcrum.deployment.protocol}://people.apache.org/www/turbine.apache.org/fulcrum/fulcrum-quartz/</url> - </site> - </distributionManagement> - - <developers> - <developer> - <name>Scott Eade</name> - <id>seade</id> - <email>[email protected]</email> - <organization>Backstage Technologies Pty. Ltd.</organization> - <roles> - <role>Java Developer</role> - </roles> - </developer> - <developer> - <name>Siegfried Goeschl</name> - <id>sgoeschl</id> - <roles> - <role>Java Developer</role> - </roles> - </developer> - </developers> - - <dependencies> - <!-- Test Dependencies --> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.fulcrum</groupId> - <artifactId>fulcrum-testcontainer</artifactId> - <version>1.0.6</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.fulcrum</groupId> - <artifactId>fulcrum-yaafi</artifactId> - <version>1.0.6</version> - <scope>test</scope> - </dependency> - <!-- Service Dependencies --> - <dependency> - <groupId>org.quartz-scheduler</groupId> - <artifactId>quartz</artifactId> - <version>1.8.3</version> - </dependency> - <dependency> - <groupId>org.apache.avalon.framework</groupId> - <artifactId>avalon-framework-api</artifactId> - <version>4.3.1</version> - </dependency> - </dependencies> - - <build> - <sourceDirectory>${basedir}/src/java</sourceDirectory> - <testSourceDirectory>${basedir}/src/test</testSourceDirectory> - </build> - - <properties> - <!-- This bits are used for the staging directory --> - <fulcrum.release.version>1.1.0</fulcrum.release.version> - <fulcrum.rc.version>RC1</fulcrum.rc.version> - </properties> - - <profiles> - <profile> - <id>rc</id> - <distributionManagement> - <!-- Cannot define in parent ATM, see COMMONSSITE-26 --> - <site> - <id>apache.website</id> - <name>Apache Fulcrum Release Candidate Staging Site</name> - <url>${fulcrum.deployment.protocol}://people.apache.org/www/turbine.apache.org/builds/fulcrum/${fulcrum.componentid}/${fulcrum.release.version}/${fulcrum.rc.version}/site</url> - </site> - </distributionManagement> - </profile> - </profiles> -</project> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>org.apache.fulcrum</groupId> + <artifactId>fulcrum-parent</artifactId> + <version>1</version> + </parent> + + <modelVersion>4.0.0</modelVersion> + <artifactId>fulcrum-quartz</artifactId> + <version>1.1.0</version> + <name>Fulcrum Quartz</name> + <inceptionYear>2004</inceptionYear> + <description>A wrapper around the Quartz Scheduler.</description> + <url>http://turbine.apache.org/fulcrum/fulcrum-quartz/</url> + + <scm> + <connection>scm:svn:http://svn.apache.org/repos/asf/turbine/fulcrum/tags/FULCRUM_QUARTZ_1_1_0</connection> + <developerConnection>scm:svn:https://svn.apache.org/repos/asf/turbine/fulcrum/tags/FULCRUM_QUARTZ_1_1_0</developerConnection> + <url>http://svn.apache.org/viewcvs/turbine/fulcrum/tags/FULCRUM_QUARTZ_1_1_0</url> + </scm> + + <distributionManagement> + <site> + <id>apache.website</id> + <name>Fulcrum Website</name> + <url>${fulcrum.deployment.protocol}://people.apache.org/www/turbine.apache.org/fulcrum/fulcrum-quartz/</url> + </site> + </distributionManagement> + + <developers> + <developer> + <name>Scott Eade</name> + <id>seade</id> + <email>[email protected]</email> + <organization>Backstage Technologies Pty. Ltd.</organization> + <roles> + <role>Java Developer</role> + </roles> + </developer> + <developer> + <name>Siegfried Goeschl</name> + <id>sgoeschl</id> + <roles> + <role>Java Developer</role> + </roles> + </developer> + <developer> + <name>Thomas Vandahl</name> + <id>tv</id> + <email>[email protected]</email> + <organization /> + <roles> + <role>Java Developer</role> + </roles> + </developer> + </developers> + + <dependencies> + <!-- Test Dependencies --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.fulcrum</groupId> + <artifactId>fulcrum-testcontainer</artifactId> + <version>1.0.6</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.fulcrum</groupId> + <artifactId>fulcrum-yaafi</artifactId> + <version>1.0.6</version> + <scope>test</scope> + </dependency> + <!-- Service Dependencies --> + <dependency> + <groupId>org.quartz-scheduler</groupId> + <artifactId>quartz</artifactId> + <version>2.0.0</version> + </dependency> + <dependency> + <groupId>org.apache.avalon.framework</groupId> + <artifactId>avalon-framework-api</artifactId> + <version>4.3.1</version> + </dependency> + </dependencies> + + <build> + <sourceDirectory>${basedir}/src/java</sourceDirectory> + <testSourceDirectory>${basedir}/src/test</testSourceDirectory> + </build> + + <reporting> + <plugins> + <plugin> + <!-- generate the changes report from changes.xml --> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-changes-plugin</artifactId> + <version>2.0-beta-3</version> + <configuration> + <xmlPath>${basedir}/src/changes/changes.xml</xmlPath> + </configuration> + <reportSets> + <reportSet> + <reports> + <report>changes-report</report> + </reports> + </reportSet> + </reportSets> + </plugin> + </plugins> + </reporting> + + <properties> + <!-- This bits are used for the staging directory --> + <fulcrum.release.version>1.1.0</fulcrum.release.version> + <fulcrum.rc.version>RC1</fulcrum.rc.version> + <fulcrum.deployment.protocol>scpexe</fulcrum.deployment.protocol> + </properties> + + <profiles> + <profile> + <id>rc</id> + <distributionManagement> + <!-- Cannot define in parent ATM, see COMMONSSITE-26 --> + <site> + <id>apache.website</id> + <name>Apache Fulcrum Release Candidate Staging Site</name> + <url>${fulcrum.deployment.protocol}://people.apache.org/www/turbine.apache.org/builds/fulcrum/${fulcrum.componentid}/${fulcrum.release.version}/${fulcrum.rc.version}/site</url> + </site> + </distributionManagement> + </profile> + </profiles> +</project> \ No newline at end of file diff --git a/project.properties b/project.properties deleted file mode 100644 index 8f6e797..0000000 --- a/project.properties +++ /dev/null @@ -1,35 +0,0 @@ -# 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. -# ------------------------------------------------------------------- -# P R O J E C T P R O P E R T I E S -# ------------------------------------------------------------------- - -# #################################################################### -# Site Plugin -# #################################################################### - -maven.xdoc.date=left -maven.xdoc.distributionUrl=http://www.apache.org/dyn/closer.cgi/turbine/fulcrum/fulcrum-quartz/binaries -maven.xdoc.distributionType=zip - -# -# Compilation options -maven.compile.source = 1.4 -maven.compile.target = 1.4 -maven.compile.debug = on -maven.compile.optimize = off -maven.compile.deprecation = off diff --git a/project.xml b/project.xml deleted file mode 100644 index 81fb661..0000000 --- a/project.xml +++ /dev/null @@ -1,69 +0,0 @@ -<?xml version="1.0"?> -<!-- - 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. ---> -<project> - <extend>${basedir}/../project.xml</extend> - <id>fulcrum-quartz</id> - <name>Fulcrum Quartz Component</name> - <currentVersion>1.1-dev</currentVersion> - <versions> - <version> - <id>1.0</id> - <name>1.0</name> - <tag>FULCRUM_QUARTZ_1_0</tag> - </version> - </versions> - <dependencies> - <!-- Service --> - <dependency> - <groupId>xstream</groupId> - <artifactId>xstream</artifactId> - <version>1.1.3</version> - <url>http://xstream.codehaus.org/</url> - </dependency> - <!-- QUARTZ --> - <dependency> - <groupId>commons-collections</groupId> - <artifactId>commons-collections</artifactId> - <version>3.2</version> - </dependency> - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - <version>1.1.1</version> - </dependency> - <dependency> - <groupId>quartz</groupId> - <artifactId>quartz</artifactId> - <version>1.5.2</version> - </dependency> - <!-- Needed only for testing --> - <dependency> - <groupId>fulcrum</groupId> - <artifactId>fulcrum-testcontainer</artifactId> - <version>1.0.5</version> - </dependency> - <dependency> - <groupId>fulcrum</groupId> - <artifactId>fulcrum-yaafi</artifactId> - <version>1.0.5</version> - </dependency> - </dependencies> -</project> - diff --git a/src/site/xdoc/changes.xml b/src/changes/changes.xml similarity index 94% rename from src/site/xdoc/changes.xml rename to src/changes/changes.xml index cd1d6b5..5f54b7b 100644 --- a/src/site/xdoc/changes.xml +++ b/src/changes/changes.xml @@ -24,7 +24,10 @@ </properties> <body> - <release version="1.1.0-SNAPSHOT" date="in svn"> + <release version="1.1.0" date="in svn"> + <action dev="tv" type="update" date="2011-09-12"> + Update dependency to quartz-2.0.0 + </action> <action dev="sgoeschl" type="update" date="2010-08-09"> Injecting Avalon logger into a job instance if "LogEnabled" is implemented by this job instance. diff --git a/src/java/org/apache/fulcrum/quartz/impl/QuartzSchedulerImpl.java b/src/java/org/apache/fulcrum/quartz/impl/QuartzSchedulerImpl.java index 0cfabe0..e40ce30 100644 --- a/src/java/org/apache/fulcrum/quartz/impl/QuartzSchedulerImpl.java +++ b/src/java/org/apache/fulcrum/quartz/impl/QuartzSchedulerImpl.java @@ -19,6 +19,12 @@ package org.apache.fulcrum.quartz.impl; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Properties; +import java.util.Set; + import org.apache.avalon.framework.activity.Disposable; import org.apache.avalon.framework.activity.Initializable; import org.apache.avalon.framework.activity.Startable; @@ -37,13 +43,13 @@ import org.quartz.Job; import org.quartz.JobDetail; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; +import org.quartz.JobKey; import org.quartz.JobListener; import org.quartz.Scheduler; import org.quartz.SchedulerException; import org.quartz.Trigger; import org.quartz.impl.StdSchedulerFactory; - -import java.util.Properties; +import org.quartz.impl.matchers.GroupMatcher; /** * Avalon service wrapping the QuartzScheduler. @@ -118,14 +124,14 @@ public class QuartzSchedulerImpl } else { - getLogger().info("Using Quartz default configuration since no user-supplied configuration was found"); + getLogger().info("Using Quartz default configuration since no user-supplied configuration was found"); schedulerFactory.initialize(); } - + this.scheduler = schedulerFactory.getScheduler(); // add this service instance as JobListener to allow basic monitoring - getScheduler().addGlobalJobListener(this); + getScheduler().getListenerManager().addJobListener(this, new ArrayList()); } public void start() throws Exception @@ -220,14 +226,14 @@ public class QuartzSchedulerImpl { if (ex != null) { - String msg = "Executing the job '" + context.getJobDetail().getFullName() + "' failed"; + String msg = "Executing the job '" + context.getJobDetail().getKey() + "' failed"; getLogger().error(msg, ex.getCause()); } else { if (getLogger().isDebugEnabled()) { - getLogger().debug("Executing the job '" + context.getJobDetail().getFullName() + "' took " + context.getJobRunTime() + " ms"); + getLogger().debug("Executing the job '" + context.getJobDetail().getKey() + "' took " + context.getJobRunTime() + " ms"); } } } @@ -244,25 +250,26 @@ public class QuartzSchedulerImpl private void logSchedulerConfiguration() throws SchedulerException { - String[] jobGroups = getScheduler().getJobGroupNames(); - for (int i = 0; i < jobGroups.length; i++) + List jobGroups = getScheduler().getJobGroupNames(); + for (Iterator i = jobGroups.iterator(); i.hasNext();) { - String jobGroup = jobGroups[i]; - String[] jobsInGroup = getScheduler().getJobNames(jobGroup); - getLogger().info("Job Group: " + jobGroup + " contains the following number of jobs : " + jobsInGroup.length); - for (int j = 0; j < jobsInGroup.length; j++) + String jobGroup = (String)i.next(); + Set jobsInGroup = getScheduler().getJobKeys(GroupMatcher.groupEquals(jobGroup)); + getLogger().info("Job Group: " + jobGroup + " contains the following number of jobs : " + jobsInGroup.size()); + for (Iterator j = jobsInGroup.iterator(); j.hasNext();) { StringBuffer buffer = new StringBuffer(); - String jobName = jobsInGroup[j]; - JobDetail jobDetail = getScheduler().getJobDetail(jobName, jobGroup); - Trigger[] jobTriggers = getScheduler().getTriggersOfJob(jobName, jobGroup); - buffer.append(jobDetail.getFullName()); + JobKey jobKey = (JobKey)j.next(); + JobDetail jobDetail = getScheduler().getJobDetail(jobKey); + List jobTriggers = getScheduler().getTriggersOfJob(jobKey); + buffer.append(jobDetail.getKey()); buffer.append(" => "); - if(jobTriggers != null && jobTriggers.length > 0) + if(jobTriggers != null && !jobTriggers.isEmpty()) { - buffer.append(jobTriggers[0].getFullName()); + Trigger jt = (Trigger)jobTriggers.get(0); + buffer.append(jt.getKey()); buffer.append(" ("); - buffer.append(jobTriggers[0].getNextFireTime()); + buffer.append(jt.getNextFireTime()); buffer.append(")"); } else @@ -272,6 +279,6 @@ public class QuartzSchedulerImpl getLogger().info(buffer.toString()); } - } + } } } diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml index b379f0c..359d2b8 100644 --- a/src/site/xdoc/index.xml +++ b/src/site/xdoc/index.xml @@ -42,9 +42,9 @@ Scheduled jobs can be either created programmatically (using the Quartz API) or by using an XML configuration based on the 'XMLSchedulingDataProcessorPlugin'. A scheduled job consists of a class implementing the interface - <a href="http://www.quartz-scheduler.org/docs/api/1.8.1/org/quartz/Job.html">org.quartz.Job</a> + <a href="http://www.quartz-scheduler.org/api/2.0.0/org/quartz/Job.html">org.quartz.Job</a> This requires just that one method be defined, execute(), whose - <a href="http://www.opensymphony.com/quartz/api/org/quartz/JobExecutionContext.html"> + <a href="http://www.quartz-scheduler.org/api/2.0.0/org/quartz/JobExecutionContext.html"> org.quartz.JobExecutionContext</a> argument provides you with details of the execution context when the task is triggered. </p> @@ -76,7 +76,7 @@ public class SimpleJob implements Job In order to invoke the SimpleJob we have to tell Quartz when to invoke the 'execute' method. In this case we create a CRON trigger firing every second to invoke SimpleJob#execute() on a newly created instance. Please - note that we definea set of parameters using the <job-data-map> + note that we define a set of parameters using the <job-data-map> which are available using 'JobExecutionContext'. </p> @@ -116,7 +116,7 @@ public class SimpleJob implements Job <section name="Implementation Details"> <p> - The implemtation registers a JobListener which intercepts the execution of + The implementation registers a JobListener which intercepts the execution of the job to set some Avalon infrastructure such 'Logger' and 'ServiceManager'. This allows an simple invocation of an Avalon service within the job execution. </p> @@ -127,7 +127,7 @@ public class SimpleJob implements Job </p> <p> The service can be started without quartz configuration (relying on default - settings) and preconfigered triggers. + settings) and preconfigured triggers. </p> </section> </body> diff --git a/src/site/xdoc/navigation.xml b/src/site/xdoc/navigation.xml deleted file mode 100644 index ac984f4..0000000 --- a/src/site/xdoc/navigation.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- - 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. ---> - -<!DOCTYPE project [ -<!ENTITY site-nav SYSTEM "../../incl_site_nav.xml"> -]> - -<project - name="Fulcrum Quartz" - href="http://turbine.apache.org/fulcrum/fulcrum-quartz/"> - - <body> - -&site-nav; - - <menu name="Overview"> - <item name="Main" href="/index.html"/> - <item name="Quartz" href="http://www.opensymphony.com/quartz/"/> - <item name="XStream" href="http://xstream.codehaus.org/"/> - </menu> - </body> -</project> diff --git a/src/test/org/apache/fulcrum/quartz/DefaultQuartzSchedulerImplTest.java b/src/test/org/apache/fulcrum/quartz/DefaultQuartzSchedulerImplTest.java index c7f7fcb..759b82b 100644 --- a/src/test/org/apache/fulcrum/quartz/DefaultQuartzSchedulerImplTest.java +++ b/src/test/org/apache/fulcrum/quartz/DefaultQuartzSchedulerImplTest.java @@ -19,15 +19,21 @@ package org.apache.fulcrum.quartz; +import java.util.Date; +import java.util.List; +import java.util.Set; + import org.apache.fulcrum.quartz.test.NotSoSimpleJob; import org.apache.fulcrum.quartz.test.SimpleJob; +import org.quartz.DateBuilder; import org.quartz.JobDetail; +import org.quartz.JobKey; import org.quartz.Scheduler; -import org.quartz.SimpleTrigger; +import org.quartz.SimpleScheduleBuilder; import org.quartz.Trigger; -import org.quartz.TriggerUtils; - -import java.util.Date; +import org.quartz.TriggerBuilder; +import org.quartz.TriggerKey; +import org.quartz.impl.matchers.GroupMatcher; /** * @author <a href="mailto:[email protected]">Leandro Rodrigo Saad Cruz</a> @@ -54,8 +60,8 @@ public class DefaultQuartzSchedulerImplTest extends BaseQuartzTestCase { Scheduler scheduler = quartz.getScheduler(); assertNotNull(scheduler); - String[] jobNames = scheduler.getJobNames("TURBINE"); - assertEquals("Expected two registered jobs", 2, jobNames.length); + Set jobNames = scheduler.getJobKeys(GroupMatcher.groupEquals("TURBINE")); + assertEquals("Expected two registered jobs", 2, jobNames.size()); } /** @@ -64,9 +70,9 @@ public class DefaultQuartzSchedulerImplTest extends BaseQuartzTestCase */ public void testJobDetailMap() throws Exception { - JobDetail jobDetail = quartz.getScheduler().getJobDetail("simpleJob", "TURBINE"); + JobDetail jobDetail = quartz.getScheduler().getJobDetail(JobKey.jobKey("simpleJob", "TURBINE")); assertNotNull(jobDetail); - assertEquals("simpleJob", jobDetail.getName()); + assertEquals("simpleJob", jobDetail.getKey().getName()); assertNotNull(jobDetail.getJobDataMap()); assertEquals(2, jobDetail.getJobDataMap().size()); } @@ -76,9 +82,9 @@ public class DefaultQuartzSchedulerImplTest extends BaseQuartzTestCase */ public void testGetTriggersOfJob() throws Exception { - Trigger triggers[] = quartz.getScheduler().getTriggersOfJob("notSoSimpleJob", "TURBINE"); - assertEquals(1, triggers.length); - assertEquals("cronTrigger", triggers[0].getName()); + List triggers = quartz.getScheduler().getTriggersOfJob(JobKey.jobKey("notSoSimpleJob", "TURBINE")); + assertEquals(1, triggers.size()); + assertEquals("cronTrigger", ((Trigger)triggers.get(0)).getKey().getName()); } /** @@ -88,13 +94,25 @@ public class DefaultQuartzSchedulerImplTest extends BaseQuartzTestCase public void testAddRemoveTrigger() throws Exception { Scheduler scheduler = quartz.getScheduler(); - Date date = TriggerUtils.getDateOf(0, 0, 0, 1, 1, 2099); - Trigger someDay = new SimpleTrigger("someTrigger", "TURBINE", "simpleJob", "TURBINE", date, null, 0, 0L); + 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); - Trigger trigger = scheduler.getTrigger("someTrigger", "TURBINE"); + + Trigger trigger = scheduler.getTrigger(triggerKey); assertNotNull(trigger); - scheduler.unscheduleJob("someTrigger", "TURBINE"); - trigger = scheduler.getTrigger("someTrigger", "TURBINE"); + scheduler.unscheduleJob(triggerKey); + trigger = scheduler.getTrigger(triggerKey); assertNull(trigger); } diff --git a/src/test/quartz.xml b/src/test/quartz.xml index 31b2123..6a17c0b 100644 --- a/src/test/quartz.xml +++ b/src/test/quartz.xml @@ -17,8 +17,8 @@ --> <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_1_8.xsd" - version="1.8"> + 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 --> @@ -71,7 +71,6 @@ <group>TURBINE</group> <job-name>simpleJob</job-name> <job-group>TURBINE</job-group> - <volatility>true</volatility> <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>
