Initial version of Quartz 2.0 integration

This commit is contained in:
Marko Lahma
2012-02-11 17:55:35 +02:00
parent 387ba32476
commit fa894204d3
78 changed files with 134392 additions and 51635 deletions

20
.gitignore vendored
View File

@@ -43,3 +43,23 @@ buildlog.txt
# XMLmind temporary files
*.xml~
*.dotCover
/src/Spring/Spring.Aop/Spring.Aop.xml
/src/Spring/Spring.Core/Spring.Core.xml
/src/Spring/Spring.Data.NHibernate12/Spring.Data.NHibernate12.xml
/src/Spring/Spring.Data.NHibernate20/Spring.Data.NHibernate20.xml
/src/Spring/Spring.Data.NHibernate21/Spring.Data.NHibernate21.xml
/src/Spring/Spring.Data.NHibernate30/Spring.Data.NHibernate30.xml
/src/Spring/Spring.Data.NHibernate31/Spring.Data.NHibernate31.xml
/src/Spring/Spring.Data.NHibernate32/Spring.Data.NHibernate32.xml
/src/Spring/Spring.Messaging.Nms/Spring.Messaging.Nms.xml
/src/Spring/Spring.Messaging/Spring.Messaging.xml
/src/Spring/Spring.Data/Spring.Data.xml
/src/Spring/Spring.Web/Spring.Web.xml
/src/Spring/Spring.Web.Mvc/Spring.Web.Mvc.xml
/src/Spring/Spring.Web.Mvc3/Spring.Web.Mvc3.xml
/src/Spring/Spring.Testing.NUnit/Spring.Testing.NUnit.xml
/src/Spring/Spring.Services/Spring.Services.xml
/src/Spring/Spring.Web.Extensions/Spring.Web.Extensions.xml
/src/Spring/GenCommonAssemblyInfo.cs

View File

@@ -430,6 +430,8 @@ Commandline Examples:
<property name="nh30.lib.dir" value="${spring.basedir}/lib/NHibernate30/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}"/>
<property name="nh31.lib.dir" value="${spring.basedir}/lib/NHibernate31/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}"/>
<property name="nh32.lib.dir" value="${spring.basedir}/lib/NHibernate32/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}"/>
<property name="quartz.lib.dir" value="${spring.basedir}/lib/Quartz10/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}"/>
<property name="quartz20.lib.dir" value="${spring.basedir}/lib/Quartz20/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}"/>
<call target="copylibtobin"/>
<!-- build assemblies -->
@@ -568,6 +570,8 @@ Commandline Examples:
<property name="nh30.lib.dir" value="${spring.basedir}/lib/NHibernate30/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}"/>
<property name="nh31.lib.dir" value="${spring.basedir}/lib/NHibernate31/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}"/>
<property name="nh32.lib.dir" value="${spring.basedir}/lib/NHibernate32/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}"/>
<property name="quartz.lib.dir" value="${spring.basedir}/lib/Quartz10/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}"/>
<property name="quartz20.lib.dir" value="${spring.basedir}/lib/Quartz20/${framework::get-family(framework::get-target-framework())}/${framework::get-version(framework::get-target-framework())}"/>
<call target="copykeys" if="${project.build.sign}"/>
<call target="copylibs" />
<call target="common.generate-assemblyinfo"/>
@@ -845,6 +849,8 @@ Commandline Examples:
<delete dir="src/Spring/Spring.Messaging/bin" failonerror="false"/>
<delete dir="src/Spring/Spring.Scheduling.Quartz/obj" failonerror="false"/>
<delete dir="src/Spring/Spring.Scheduling.Quartz/bin" failonerror="false"/>
<delete dir="src/Spring/Spring.Scheduling.Quartz20/obj" failonerror="false"/>
<delete dir="src/Spring/Spring.Scheduling.Quartz20/bin" failonerror="false"/>
<delete dir="src/Spring/Spring.Template.Velocity/obj" failonerror="false"/>
<delete dir="src/Spring/Spring.Template.Velocity/bin" failonerror="false"/>
<delete dir="src/Spring/Spring.Testing.NUnit/obj" failonerror="false"/>
@@ -900,6 +906,8 @@ Commandline Examples:
<delete dir="test/Spring/Spring.Messaging.Tests/bin" failonerror="false"/>
<delete dir="test/Spring/Spring.Scheduling.Quartz.Tests/obj" failonerror="false"/>
<delete dir="test/Spring/Spring.Scheduling.Quartz.Tests/bin" failonerror="false"/>
<delete dir="test/Spring/Spring.Scheduling.Quartz20.Tests/obj" failonerror="false"/>
<delete dir="test/Spring/Spring.Scheduling.Quartz20.Tests/bin" failonerror="false"/>
<delete dir="test/Spring/Spring.Template.Velocity.Tests/obj" failonerror="false"/>
<delete dir="test/Spring/Spring.Template.Velocity.Tests/bin" failonerror="false"/>
<delete dir="test/Spring/Spring.Web.Tests/obj" failonerror="false"/>
@@ -1545,9 +1553,14 @@ Commandline Examples:
<include name="*/*/Spring.Messaging.xml"/>
<include name="*/*/Spring.Messaging.pdb"/>
<!--
<include name="*/*/Spring.Scheduling.Quartz.dll"/>
<include name="*/*/Spring.Scheduling.Quartz.xml"/>
<include name="*/*/Spring.Scheduling.Quartz.pdb"/>
-->
<include name="*/*/Spring.Scheduling.Quartz20.dll"/>
<include name="*/*/Spring.Scheduling.Quartz20.xml"/>
<include name="*/*/Spring.Scheduling.Quartz20.pdb"/>
<include name="*/*/Spring.Template.Velocity.dll"/>
<include name="*/*/Spring.Template.Velocity.xml"/>
@@ -1579,9 +1592,14 @@ Commandline Examples:
<include name="*/Spring.Services.xml"/>
<include name="*/Spring.Services.pdb"/>
<include name="*/Spring.Scheduling.Quartz.dll"/>
<include name="*/Spring.Scheduling.Quartz.xml"/>
<include name="*/Spring.Scheduling.Quartz.pdb"/>
<!--
<include name="*/*/Spring.Scheduling.Quartz.dll"/>
<include name="*/*/Spring.Scheduling.Quartz.xml"/>
<include name="*/*/Spring.Scheduling.Quartz.pdb"/>
-->
<include name="*/*/Spring.Scheduling.Quartz20.dll"/>
<include name="*/*/Spring.Scheduling.Quartz20.xml"/>
<include name="*/*/Spring.Scheduling.Quartz20.pdb"/>
<include name="*/Spring.Web.Mvc.dll"/>
<include name="*/Spring.Web.Mvc.xml"/>
@@ -1802,6 +1820,7 @@ Commandline Examples:
<include name="src/Spring/Spring.Messaging.Nms/**"/>
<include name="src/Spring/Spring.Messaging.Ems/**"/>
<include name="src/Spring/Spring.Scheduling.Quartz/**"/>
<include name="src/Spring/Spring.Scheduling.Quartz20/**"/>
<include name="src/Spring/Spring.Template.Velocity/**"/>
<include name="src/Spring/Spring.Testing.NUnit/**"/>
<include name="src/Spring/Spring.Testing.Microsoft/**"/>
@@ -1832,6 +1851,7 @@ Commandline Examples:
<include name="test/Spring/Spring.Messaging.Nms.Integration.Tests/**"/>
<include name="test/Spring/Spring.Messaging.Ems.Tests/**"/>
<include name="test/Spring/Spring.Scheduling.Quartz.Tests/**"/>
<include name="test/Spring/Spring.Scheduling.Quartz20.Tests/**"/>
<include name="test/Spring/Spring.Template.Velocity.Tests/**"/>
<include name="test/Spring/Spring.Testing.NUnit.Tests/**"/>
<include name="test/Spring/Spring.Testing.Microsoft.Tests/**"/>

View File

@@ -23,6 +23,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Scheduling.Quartz.In
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Core.Tests.2008", "..\..\test\Spring\Spring.Core.Tests\Spring.Core.Tests.2008.csproj", "{44B16BAA-6DF8-447C-9D7F-3AD3D854D904}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Scheduling.Quartz20.Integration.Tests.2008", "..\..\test\Spring\Spring.Scheduling.Quartz20.Integration.Tests\Spring.Scheduling.Quartz20.Integration.Tests.2008.csproj", "{8CF0F34A-CC93-4D87-AE14-A2DEEF072F26}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Scheduling.Quartz20.Tests.2008", "..\..\test\Spring\Spring.Scheduling.Quartz20.Tests\Spring.Scheduling.Quartz20.Tests.2008.csproj", "{47E7DF97-2515-4F2F-BBFD-0A4C205800DE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Scheduling.Quartz20.2008", "..\..\src\Spring\Spring.Scheduling.Quartz20\Spring.Scheduling.Quartz20.2008.csproj", "{764C3A6A-8690-49DD-B9AF-99E7C09AE4F0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|.NET = Debug|.NET
@@ -109,6 +115,36 @@ Global
{44B16BAA-6DF8-447C-9D7F-3AD3D854D904}.Release|Any CPU.Build.0 = Release|Any CPU
{44B16BAA-6DF8-447C-9D7F-3AD3D854D904}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{44B16BAA-6DF8-447C-9D7F-3AD3D854D904}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{8CF0F34A-CC93-4D87-AE14-A2DEEF072F26}.Debug|.NET.ActiveCfg = Debug|Any CPU
{8CF0F34A-CC93-4D87-AE14-A2DEEF072F26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8CF0F34A-CC93-4D87-AE14-A2DEEF072F26}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8CF0F34A-CC93-4D87-AE14-A2DEEF072F26}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{8CF0F34A-CC93-4D87-AE14-A2DEEF072F26}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{8CF0F34A-CC93-4D87-AE14-A2DEEF072F26}.Release|.NET.ActiveCfg = Release|Any CPU
{8CF0F34A-CC93-4D87-AE14-A2DEEF072F26}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8CF0F34A-CC93-4D87-AE14-A2DEEF072F26}.Release|Any CPU.Build.0 = Release|Any CPU
{8CF0F34A-CC93-4D87-AE14-A2DEEF072F26}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{8CF0F34A-CC93-4D87-AE14-A2DEEF072F26}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{47E7DF97-2515-4F2F-BBFD-0A4C205800DE}.Debug|.NET.ActiveCfg = Debug|Any CPU
{47E7DF97-2515-4F2F-BBFD-0A4C205800DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{47E7DF97-2515-4F2F-BBFD-0A4C205800DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47E7DF97-2515-4F2F-BBFD-0A4C205800DE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{47E7DF97-2515-4F2F-BBFD-0A4C205800DE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{47E7DF97-2515-4F2F-BBFD-0A4C205800DE}.Release|.NET.ActiveCfg = Release|Any CPU
{47E7DF97-2515-4F2F-BBFD-0A4C205800DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47E7DF97-2515-4F2F-BBFD-0A4C205800DE}.Release|Any CPU.Build.0 = Release|Any CPU
{47E7DF97-2515-4F2F-BBFD-0A4C205800DE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{47E7DF97-2515-4F2F-BBFD-0A4C205800DE}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{764C3A6A-8690-49DD-B9AF-99E7C09AE4F0}.Debug|.NET.ActiveCfg = Debug|Any CPU
{764C3A6A-8690-49DD-B9AF-99E7C09AE4F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{764C3A6A-8690-49DD-B9AF-99E7C09AE4F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{764C3A6A-8690-49DD-B9AF-99E7C09AE4F0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{764C3A6A-8690-49DD-B9AF-99E7C09AE4F0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{764C3A6A-8690-49DD-B9AF-99E7C09AE4F0}.Release|.NET.ActiveCfg = Release|Any CPU
{764C3A6A-8690-49DD-B9AF-99E7C09AE4F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{764C3A6A-8690-49DD-B9AF-99E7C09AE4F0}.Release|Any CPU.Build.0 = Release|Any CPU
{764C3A6A-8690-49DD-B9AF-99E7C09AE4F0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{764C3A6A-8690-49DD-B9AF-99E7C09AE4F0}.Release|Mixed Platforms.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -118,9 +154,12 @@ Global
{3A3A4E65-45A6-4B20-B460-0BEDC302C02C} = {438FE108-6F55-4C8A-8BF4-C85D0906D134}
{AE00E5AB-C39A-436F-86D2-33BFE33E2E40} = {438FE108-6F55-4C8A-8BF4-C85D0906D134}
{E823D54C-CE82-4868-929F-5F95A999F61E} = {438FE108-6F55-4C8A-8BF4-C85D0906D134}
{764C3A6A-8690-49DD-B9AF-99E7C09AE4F0} = {438FE108-6F55-4C8A-8BF4-C85D0906D134}
{9FE720ED-2BD9-4FB9-89C8-FFFA4A491CB5} = {5ECE7B2B-6975-4800-982E-618794909499}
{E4328F68-C3FC-43E2-9D63-30CEC55215B0} = {5ECE7B2B-6975-4800-982E-618794909499}
{44B16BAA-6DF8-447C-9D7F-3AD3D854D904} = {5ECE7B2B-6975-4800-982E-618794909499}
{8CF0F34A-CC93-4D87-AE14-A2DEEF072F26} = {5ECE7B2B-6975-4800-982E-618794909499}
{47E7DF97-2515-4F2F-BBFD-0A4C205800DE} = {5ECE7B2B-6975-4800-982E-618794909499}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
NAntAddinLastFileName = Spring.build

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

BIN
lib/Quartz20/net/3.5/C5.dll Normal file

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

BIN
lib/Quartz20/net/4.0/C5.dll Normal file

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -20,6 +20,12 @@ using Quartz;
using Quartz.Spi;
using Quartz.Util;
#if QUARTZ_2_0
using JobDetail = Quartz.IJobDetail;
#else
using JobDetail = Quartz.JobDetail;
#endif
namespace Spring.Scheduling.Quartz
{
/// <summary>
@@ -32,6 +38,27 @@ namespace Spring.Scheduling.Quartz
/// <seealso cref="AdaptJob(object)" />
public class AdaptableJobFactory : IJobFactory
{
#if QUARTZ_2_0
/// <summary>
/// Called by the scheduler at the time of the trigger firing, in order to
/// produce a <see cref="IJob"/> instance on which to call Execute.
/// </summary>
/// <remarks>
/// It should be extremely rare for this method to throw an exception -
/// basically only the the case where there is no way at all to instantiate
/// and prepare the Job for execution. When the exception is thrown, the
/// Scheduler will move all triggers associated with the Job into the
/// <see cref="TriggerState.Error"/> state, which will require human
/// intervention (e.g. an application restart after fixing whatever
/// configuration problem led to the issue wih instantiating the Job.
/// </remarks>
/// <param name="bundle">The TriggerFiredBundle from which the <see cref="JobDetail"/>
/// and other info relating to the trigger firing can be obtained.</param>
/// <param name="scheduler">The scheduler instance.</param>
/// <returns>the newly instantiated Job</returns>
/// <throws>SchedulerException if there is a problem instantiating the Job.</throws>
public virtual IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
#else
/// <summary>
/// Called by the scheduler at the time of the trigger firing, in order to
/// produce a <see cref="IJob"/> instance on which to call Execute.
@@ -49,7 +76,8 @@ namespace Spring.Scheduling.Quartz
/// and other info relating to the trigger firing can be obtained.</param>
/// <returns>the newly instantiated Job</returns>
/// <throws>SchedulerException if there is a problem instantiating the Job.</throws>
public virtual IJob NewJob(TriggerFiredBundle bundle)
public virtual IJob NewJob(TriggerFiredBundle bundle)
#endif
{
try
{
@@ -75,7 +103,11 @@ namespace Spring.Scheduling.Quartz
/// <returns>The job instance.</returns>
protected virtual object CreateJobInstance(TriggerFiredBundle bundle)
{
#if QUARTZ_2_0
return ObjectUtils.InstantiateType<object>(bundle.JobDetail.JobType);
#else
return ObjectUtils.InstantiateType(bundle.JobDetail.JobType);
#endif
}
/// <summary>
@@ -92,24 +124,21 @@ namespace Spring.Scheduling.Quartz
/// <seealso cref="DelegatingJob" />
protected virtual IJob AdaptJob(object jobObject)
{
if (jobObject is IJob)
{
return (IJob) jobObject;
}
else if (jobObject is ThreadStart)
{
return new DelegatingJob((ThreadStart)jobObject);
}
else if (jobObject is IThreadRunnable)
if (jobObject is IJob)
{
return new DelegatingJob(new ThreadStart(((IThreadRunnable) jobObject).Run));
return (IJob)jobObject;
}
else
{
throw new ArgumentException(
string.Format("Unable to execute job class [{0}]: only [IJob] and [ThreadStart] supported.",
jobObject.GetType().FullName));
}
if (jobObject is ThreadStart)
{
return new DelegatingJob((ThreadStart)jobObject);
}
if (jobObject is IThreadRunnable)
{
return new DelegatingJob(((IThreadRunnable)jobObject).Run);
}
string message = string.Format("Unable to execute job class [{0}]: only [IJob] and [ThreadStart] supported.", jobObject.GetType().FullName);
throw new ArgumentException(message);
}
}
}

View File

@@ -13,13 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Threading;
using Quartz;
using Spring.Util;
#if QUARTZ_2_0
using JobExecutionContext = Quartz.IJobExecutionContext;
#else
using JobExecutionContext = Quartz.JobExecutionContext;
#endif
namespace Spring.Scheduling.Quartz
{
/// <summary>

View File

@@ -13,7 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using Quartz;
#if QUARTZ_2_0
using JobDetail = Quartz.IJobDetail;
#else
using JobDetail = Quartz.JobDetail;
#endif
namespace Spring.Scheduling.Quartz
{
@@ -36,8 +41,6 @@ namespace Spring.Scheduling.Quartz
/// <author>Juergen Hoeller</author>
/// <seealso cref="SchedulerAccessor.Triggers" />
/// <seealso cref="SchedulerAccessor.JobDetails" />
/// <seealso cref="Trigger.JobName" />
/// <seealso cref="Trigger.JobGroup" />
public interface IJobDetailAwareTrigger
{
/// <summary>

View File

@@ -16,21 +16,17 @@
namespace Spring.Scheduling
{
/// <summary>
///
/// </summary>
public interface ISchedulingTaskExecutor : ITaskExecutor
{
/// <summary>
/// Gets a value indicating whether<65>this instance prefers short lived tasks.
/// </summary>
/// <value>
/// <c>true</c> if prefers short lived tasks; otherwise, <c>false</c>.
/// </value>
bool PrefersShortLivedTasks
{
get;
}
}
}
/// <summary>
///
/// </summary>
public interface ISchedulingTaskExecutor : ITaskExecutor
{
/// <summary>
/// Gets a value indicating whether<65>this instance prefers short lived tasks.
/// </summary>
/// <value>
/// <c>true</c> if prefers short lived tasks; otherwise, <c>false</c>.
/// </value>
bool PrefersShortLivedTasks { get; }
}
}

View File

@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System.Threading;
using Common.Logging;
using Quartz;
@@ -32,11 +31,11 @@ namespace Spring.Scheduling.Quartz
/// <summary>
/// Logger available to subclasses.
/// </summary>
protected ILog logger;
private readonly ILog logger;
private ITaskExecutor taskExecutor;
/// <summary>
/// <summary>
/// Initializes a new instance of the <see cref="LocalTaskExecutorThreadPool"/> class.
/// </summary>
public LocalTaskExecutorThreadPool()
@@ -45,6 +44,14 @@ namespace Spring.Scheduling.Quartz
}
/// <summary>
/// Logger instance.
/// </summary>
protected ILog Logger
{
get { return logger; }
}
/// <summary>
/// Gets the size of the pool.
/// </summary>
/// <value>The size of the pool.</value>
@@ -53,7 +60,25 @@ namespace Spring.Scheduling.Quartz
get { return - 1; }
}
/// <summary>
/// <summary>
/// Inform the <see cref="T:Quartz.Spi.IThreadPool"/> of the Scheduler instance's Id,
/// prior to initialize being invoked.
/// </summary>
public string InstanceId
{
set { }
}
/// <summary>
/// Inform the <see cref="T:Quartz.Spi.IThreadPool"/> of the Scheduler instance's name,
/// prior to initialize being invoked.
/// </summary>
public string InstanceName
{
set { }
}
/// <summary>
/// Called by the QuartzScheduler before the <see cref="T:System.Threading.ThreadPool"/> is
/// used, in order to give the it a chance to Initialize.
/// </summary>
@@ -99,7 +124,7 @@ namespace Spring.Scheduling.Quartz
}
try
{
taskExecutor.Execute(new ThreadStart(runnable.Run));
taskExecutor.Execute(runnable.Run);
return true;
}
catch (TaskRejectedException ex)

View File

@@ -23,6 +23,12 @@ using Quartz;
using Spring.Objects.Support;
#if QUARTZ_2_0
using JobExecutionContext = Quartz.IJobExecutionContext;
#else
using JobExecutionContext = Quartz.JobExecutionContext;
#endif
namespace Spring.Scheduling.Quartz
{
/// <summary>

View File

@@ -56,7 +56,7 @@ namespace Spring.Scheduling.Quartz
/// <summary>
/// Logger instance shared by this instance and its sub-class instances.
/// </summary>
protected ILog logger;
private readonly ILog logger;
/// <summary>
/// Initializes a new instance of the <see cref="MethodInvokingRunnable"/> class.
@@ -66,6 +66,13 @@ namespace Spring.Scheduling.Quartz
logger = LogManager.GetLogger(GetType());
}
/// <summary>
/// Logger instance.
/// </summary>
protected ILog Logger
{
get { return logger; }
}
/// <summary>
/// Gets the invocation failure message.

View File

@@ -14,8 +14,15 @@
* limitations under the License.
*/
using Quartz;
using Spring.Objects;
#if QUARTZ_2_0
using JobExecutionContext = Quartz.IJobExecutionContext;
#else
using JobExecutionContext = Quartz.JobExecutionContext;
#endif
namespace Spring.Scheduling.Quartz
{
/// <summary>

View File

@@ -18,6 +18,9 @@ using System;
using System.Collections;
using System.Collections.Specialized;
using System.IO;
#if QUARTZ_2_0
using System.Linq;
#endif
using Quartz;
using Quartz.Impl;
@@ -566,7 +569,11 @@ namespace Spring.Scheduling.Quartz
public virtual void AfterPropertiesSet()
{
// Create SchedulerFactory instance.
#if QUARTZ_2_0
ISchedulerFactory schedulerFactory = ObjectUtils.InstantiateType<ISchedulerFactory>(schedulerFactoryType);
#else
ISchedulerFactory schedulerFactory = (ISchedulerFactory) ObjectUtils.InstantiateType(schedulerFactoryType);
#endif
InitSchedulerFactory(schedulerFactory);
@@ -755,7 +762,12 @@ namespace Spring.Scheduling.Quartz
// Put specified objects into Scheduler context.
if (schedulerContextMap != null)
{
#if QUARTZ_2_0
var dictionary = schedulerContextMap.Cast<DictionaryEntry>().ToDictionary(entry => entry.Key.ToString(), entry => entry.Value);
scheduler.Context.PutAll(dictionary);
#else
scheduler.Context.PutAll(schedulerContextMap);
#endif
}
// Register IApplicationContext in Scheduler context.
@@ -837,9 +849,9 @@ namespace Spring.Scheduling.Quartz
}
}
/// <summary>
/// Handles the application context's refresh event and starts the scheduler.
/// </summary>
/// <summary>
/// Handles the application context's refresh event and starts the scheduler.
/// </summary>
public void HandleApplicationEvent(object sender, ApplicationEventArgs e)
{
// auto-start Scheduler if demanded

View File

@@ -31,13 +31,13 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Common.Logging, Version=1.1.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e">
<Reference Include="Common.Logging, Version=1.2.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\net\2.0\Common.Logging.dll</HintPath>
<HintPath>..\..\..\lib\Net\2.0\Common.Logging.dll</HintPath>
</Reference>
<Reference Include="Quartz, Version=0.6.0.21049, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Quartz, Version=1.0.3.2, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\net\2.0\Quartz.dll</HintPath>
<HintPath>..\..\..\lib\Quartz10\net\2.0\Quartz.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />

View File

@@ -37,12 +37,13 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Common.Logging, Version=1.1.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e">
<Reference Include="Common.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\net\2.0\Common.Logging.dll</HintPath>
<HintPath>..\..\..\lib\Net\2.0\Common.Logging.dll</HintPath>
</Reference>
<Reference Include="Quartz">
<HintPath>..\..\..\lib\Net\3.5\Quartz.dll</HintPath>
<Reference Include="Quartz, Version=1.0.3.3, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\Quartz10\net\3.5\Quartz.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />

View File

@@ -7,6 +7,14 @@
* current.build.defines.csc - framework-specific build defines for C# compiler
-->
<target name="build">
<echo message="${quartz.lib.dir}" />
<copy todir="${current.bin.dir}" overwrite="true">
<fileset basedir="${quartz.lib.dir}">
<include name="**/*.dll" />
</fileset>
</copy>
<csc target="library" define="${current.build.defines.csc}"
warnaserror="true"
optimize="${build.optimize}"

View File

@@ -0,0 +1,235 @@
/*
* Copyright 2002-2010 the original author or authors.
*
* Licensed 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.
*/
using System;
using System.Collections;
using System.Reflection;
using Quartz;
using Quartz.Impl.Triggers;
using Spring.Objects.Factory;
using Spring.Util;
namespace Spring.Scheduling.Quartz
{
/// <summary>
/// Convenience subclass of Quartz's CronTrigger type, making property based
/// usage easier.
/// </summary>
/// <remarks>
/// <p>
/// CronTrigger itself is already property based but lacks sensible defaults.
/// This class uses the Spring object name as job name, the Quartz default group
/// ("DEFAULT") as job group, the current time as start time, and indefinite
/// repetition, if not specified.
/// </p>
/// <p>
/// This class will also register the trigger with the job name and group of
/// a given <see cref="JobDetail" />. This allows <see cref="SchedulerFactoryObject" />
/// to automatically register a trigger for the corresponding JobDetail,
/// instead of registering the JobDetail separately.
/// </p>
/// </remarks>
/// <author>Juergen Hoeller</author>
/// <seealso cref="ITrigger.Key" />
/// <seealso cref="ITrigger.StartTimeUtc" />
/// <seealso cref="ITrigger.JobKey" />
/// <seealso cref="JobDetail" />
/// <seealso cref="SchedulerAccessor.Triggers" />
/// <seealso cref="SchedulerAccessor.JobDetails" />
public class CronTriggerObject : CronTriggerImpl, IJobDetailAwareTrigger, IObjectNameAware, IInitializingObject
{
private readonly Constants constants = new Constants(typeof(MisfireInstruction.CronTrigger), typeof(MisfireInstruction));
private IJobDetail jobDetail;
private string objectName;
private TimeSpan startDelay;
/// <summary>
/// Register objects in the JobDataMap via a given Map.
/// </summary>
/// <remarks>
/// These objects will be available to this Trigger only,
/// in contrast to objects in the JobDetail's data map.
/// </remarks>
/// <seealso cref="JobDetailObject.JobDataAsMap" />
public virtual IDictionary JobDataAsMap
{
set
{
foreach (DictionaryEntry entry in value)
{
JobDataMap.Put((string) entry.Key, entry.Value);
}
}
}
/// <summary>
/// Set the misfire instruction via the name of the corresponding
/// constant in the CronTrigger class.
/// Default is <see cref="MisfireInstruction.SmartPolicy" />.
/// </summary>
/// <seealso cref="MisfireInstruction.CronTrigger.FireOnceNow" />
/// <seealso cref="MisfireInstruction.CronTrigger.DoNothing" />
/// <seealso cref="MisfireInstruction.SmartPolicy" />
public virtual string MisfireInstructionName
{
set { MisfireInstruction = constants.AsNumber(value); }
}
/// <summary>
/// Set the name of the object in the object factory that created this object.
/// </summary>
/// <value>The name of the object in the factory.</value>
/// <remarks>
/// <p>
/// Invoked after population of normal object properties but before an init
/// callback like <see cref="Spring.Objects.Factory.IInitializingObject"/>'s
/// <see cref="Spring.Objects.Factory.IInitializingObject.AfterPropertiesSet"/>
/// method or a custom init-method.
/// </p>
/// </remarks>
public virtual string ObjectName
{
set { objectName = value; }
}
/// <summary>
/// Set the JobDetail that this trigger should be associated with.
/// </summary>
/// <remarks>
/// This is typically used with a object reference if the JobDetail
/// is a Spring-managed object. Alternatively, the trigger can also
/// be associated with a job by name and group.
/// </remarks>
/// <seealso cref="ITrigger.JobKey" />
public virtual IJobDetail JobDetail
{
get { return jobDetail; }
set { jobDetail = value; }
}
/// <summary>
/// Set the start delay as <see cref="TimeSpan" />.
/// </summary>
/// <remarks>
/// <para>
/// The start delay is added to the current system UTC time
/// (when the object starts) to control the <see cref="ITrigger.StartTimeUtc" />
/// of the trigger.
/// </para>
/// <para>
/// If the start delay is non-zero it will <strong>always</strong>
/// take precedence over start time.
/// </para>
/// </remarks>
/// <value>the start delay, as <see cref="TimeSpan" /> object.</value>
public TimeSpan StartDelay
{
set
{
AssertUtils.State(value > TimeSpan.Zero, "Start delay cannot be negative.");
startDelay = value;
}
get { return startDelay; }
}
/// <summary>
/// Invoked by an <see cref="Spring.Objects.Factory.IObjectFactory"/>
/// after it has injected all of an object's dependencies.
/// </summary>
/// <remarks>
/// <p>
/// This method allows the object instance to perform the kind of
/// initialization only possible when all of it's dependencies have
/// been injected (set), and to throw an appropriate exception in the
/// event of misconfiguration.
/// </p>
/// <p>
/// Please do consult the class level documentation for the
/// <see cref="Spring.Objects.Factory.IObjectFactory"/> interface for a
/// description of exactly <i>when</i> this method is invoked. In
/// particular, it is worth noting that the
/// <see cref="Spring.Objects.Factory.IObjectFactoryAware"/>
/// and <see cref="Spring.Context.IApplicationContextAware"/>
/// callbacks will have been invoked <i>prior</i> to this method being
/// called.
/// </p>
/// </remarks>
/// <exception cref="System.Exception">
/// In the event of misconfiguration (such as the failure to set a
/// required property) or if initialization fails.
/// </exception>
public virtual void AfterPropertiesSet()
{
#if QUARTZ_2_0
if (StartTimeUtc == DateTimeOffset.MinValue)
{
StartTimeUtc = DateTimeOffset.UtcNow;
}
#else
if (StartTimeUtc == DateTime.MinValue)
{
StartTimeUtc = DateTime.UtcNow;
}
#endif
if (StartDelay > TimeSpan.Zero)
{
StartTimeUtc = DateTime.UtcNow.Add(startDelay);
}
if (Name == null)
{
Name = objectName;
}
if (Group == null)
{
Group = SchedulerConstants.DefaultGroup;
}
if (jobDetail != null)
{
JobName = jobDetail.Key.Name;
JobGroup = jobDetail.Key.Group;
}
}
}
/// <summary>
/// Helper class to map constant names to their values.
/// </summary>
internal class Constants
{
private readonly Type[] types;
public Constants(params Type[] reflectedTypes)
{
types = reflectedTypes;
}
public int AsNumber(string field)
{
foreach (Type type in types)
{
FieldInfo fi = type.GetField(field);
if (fi != null)
{
return Convert.ToInt32(fi.GetValue(null));
}
}
// not found
throw new Exception(string.Format("Unknown field '{0}'", field));
}
}
}

View File

@@ -0,0 +1,220 @@
/*
* Copyright 2002-2010 the original author or authors.
*
* Licensed 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.
*/
using System;
using System.Collections;
using Quartz;
using Quartz.Impl;
using Spring.Context;
using Spring.Objects.Factory;
namespace Spring.Scheduling.Quartz
{
/// <summary>
/// Convenience subclass of Quartz' JobDetail class that eases properties based
/// usage.
/// </summary>
/// <remarks>
/// <see cref="IJobDetail" /> itself is already a object but lacks
/// sensible defaults. This class uses the Spring object name as job name,
/// and the Quartz default group ("DEFAULT") as job group if not specified.
/// </remarks>
/// <author>Juergen Hoeller</author>
/// <seealso cref="IJobDetail.Key" />
/// <seealso cref="SchedulerConstants.DefaultGroup" />
public class JobDetailObject : JobDetailImpl, IObjectNameAware, IApplicationContextAware, IInitializingObject
{
private Type actualJobType;
private string objectName;
private IApplicationContext applicationContext;
private string applicationContextJobDataKey;
/// <summary>
/// Overridden to support any job class, to allow a custom JobFactory
/// to adapt the given job class to the Quartz Job interface.
/// </summary>
/// <seealso cref="SchedulerFactoryObject.JobFactory" />
public override Type JobType
{
get { return (actualJobType ?? base.JobType); }
set
{
if (value != null && !typeof (IJob).IsAssignableFrom(value))
{
base.JobType = typeof (DelegatingJob);
actualJobType = value;
}
else
{
base.JobType = value;
}
}
}
/// <summary>
/// Register objects in the JobDataMap via a given Map.
/// </summary>
/// <remarks>
/// These objects will be available to this Job only,
/// in contrast to objects in the SchedulerContext.
/// <p>
/// Note: When using persistent Jobs whose JobDetail will be kept in the
/// database, do not put Spring-managed objects or an ApplicationContext
/// reference into the JobDataMap but rather into the SchedulerContext.
/// </p>
/// </remarks>
/// <seealso cref="SchedulerFactoryObject.SchedulerContextAsMap" />
public virtual IDictionary JobDataAsMap
{
set
{
if (value == null)
{
throw new ArgumentException("Value cannot be null", "value");
}
foreach (DictionaryEntry entry in value)
{
JobDataMap.Put((string) entry.Key, entry.Value);
}
}
}
/// <summary>
/// Set the name of the object in the object factory that created this object.
/// </summary>
/// <value>The name of the object in the factory.</value>
/// <remarks>
/// Invoked after population of normal object properties but before an init
/// callback like <see cref="Spring.Objects.Factory.IInitializingObject"/>'s
/// <see cref="Spring.Objects.Factory.IInitializingObject.AfterPropertiesSet"/>
/// method or a custom init-method.
/// </remarks>
public virtual string ObjectName
{
set { objectName = value; }
}
/// <summary>
/// Gets or sets the <see cref="Spring.Context.IApplicationContext"/> that this
/// object runs in.
/// </summary>
/// <value></value>
/// <remarks>
/// <p>
/// Normally this call will be used to initialize the object.
/// </p>
/// <p>
/// Invoked after population of normal object properties but before an
/// init callback such as
/// <see cref="Spring.Objects.Factory.IInitializingObject"/>'s
/// <see cref="Spring.Objects.Factory.IInitializingObject.AfterPropertiesSet"/>
/// or a custom init-method. Invoked after the setting of any
/// <see cref="Spring.Context.IResourceLoaderAware"/>'s
/// <see cref="Spring.Context.IResourceLoaderAware.ResourceLoader"/>
/// property.
/// </p>
/// </remarks>
/// <exception cref="Spring.Context.ApplicationContextException">
/// In the case of application context initialization errors.
/// </exception>
/// <exception cref="Spring.Objects.ObjectsException">
/// If thrown by any application context methods.
/// </exception>
/// <exception cref="Spring.Objects.Factory.ObjectInitializationException"/>
public virtual IApplicationContext ApplicationContext
{
set { applicationContext = value; }
get { return applicationContext; }
}
/// <summary>
/// Set the key of an IApplicationContext reference to expose in the JobDataMap,
/// for example "applicationContext". Default is none.
/// Only applicable when running in a Spring ApplicationContext.
/// </summary>
/// <remarks>
/// <p>
/// In case of a QuartzJobObject, the reference will be applied to the Job
/// instance as object property. An "applicationContext" attribute will correspond
/// to a "setApplicationContext" method in that scenario.
/// </p>
/// <p>
/// Note that ObjectFactory callback interfaces like IApplicationContextAware
/// are not automatically applied to Quartz Job instances, because Quartz
/// itself is responsible for the lifecycle of its Jobs.
/// </p>
/// <p>
/// <b>Note: When using persistent job stores where JobDetail contents will
/// be kept in the database, do not put an IApplicationContext reference into
/// the JobDataMap but rather into the SchedulerContext.</b>
/// </p>
/// </remarks>
/// <seealso cref="SchedulerFactoryObject.ApplicationContextSchedulerContextKey" />
/// <seealso cref="IApplicationContext" />
public virtual string ApplicationContextJobDataKey
{
set { applicationContextJobDataKey = value; }
}
/// <summary>
/// Invoked by an <see cref="Spring.Objects.Factory.IObjectFactory"/>
/// after it has injected all of an object's dependencies.
/// </summary>
/// <remarks>
/// <p>
/// This method allows the object instance to perform the kind of
/// initialization only possible when all of it's dependencies have
/// been injected (set), and to throw an appropriate exception in the
/// event of misconfiguration.
/// </p>
/// <p>
/// Please do consult the class level documentation for the
/// <see cref="Spring.Objects.Factory.IObjectFactory"/> interface for a
/// description of exactly <i>when</i> this method is invoked. In
/// particular, it is worth noting that the
/// <see cref="Spring.Objects.Factory.IObjectFactoryAware"/>
/// and <see cref="Spring.Context.IApplicationContextAware"/>
/// callbacks will have been invoked <i>prior</i> to this method being
/// called.
/// </p>
/// </remarks>
/// <exception cref="System.Exception">
/// In the event of misconfiguration (such as the failure to set a
/// required property) or if initialization fails.
/// </exception>
public virtual void AfterPropertiesSet()
{
if (Name == null)
{
Name = objectName;
}
if (Group == null)
{
Group = SchedulerConstants.DefaultGroup;
}
if (applicationContextJobDataKey != null)
{
if (applicationContext == null)
{
throw new ArgumentException("JobDetailObject needs to be set up in an IApplicationContext " +
"to be able to handle an 'applicationContextJobDataKey'");
}
JobDataMap.Put(applicationContextJobDataKey, applicationContext);
}
}
}
}

View File

@@ -0,0 +1,292 @@
/*
* Copyright 2002-2010 the original author or authors.
*
* Licensed 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.
*/
using System;
using Quartz;
using Quartz.Impl;
using Spring.Objects.Factory;
using Spring.Objects.Factory.Config;
using Spring.Objects.Support;
namespace Spring.Scheduling.Quartz
{
/// <summary>
/// IFactoryObject that exposes a JobDetail object that delegates job execution
/// to a specified (static or non-static) method. Avoids the need to implement
/// a one-line Quartz Job that just invokes an existing service method.
/// </summary>
/// <remarks>
/// <p>
/// Derived from ArgumentConverting MethodInvoker to share common properties and behavior
/// with MethodInvokingFactoryObject.
/// </p>
/// <p>
/// Supports both concurrently running jobs and non-currently running
/// ones through the "concurrent" property. Jobs created by this
/// MethodInvokingJobDetailFactoryObject are by default volatile and durable
/// (according to Quartz terminology).
/// </p>
/// <p><b>NOTE: JobDetails created via this FactoryObject are <i>not</i>
/// serializable and thus not suitable for persistent job stores.</b>
/// You need to implement your own Quartz Job as a thin wrapper for each case
/// where you want a persistent job to delegate to a specific service method.
/// </p>
/// </remarks>
/// <author>Juergen Hoeller</author>
/// <author>Alef Arendsen</author>
/// <seealso cref="Concurrent" />
/// <seealso cref="MethodInvokingFactoryObject" />
public class MethodInvokingJobDetailFactoryObject : ArgumentConvertingMethodInvoker,
IObjectFactoryAware,
IFactoryObject,
IObjectNameAware,
IInitializingObject
{
private string name;
private string group;
private bool concurrent = true;
private string[] jobListenerNames;
private string targetObjectName;
private string objectName;
private JobDetailImpl jobDetail;
private IObjectFactory objectFactory;
/// <summary>
/// Initializes a new instance of the <see cref="MethodInvokingJobDetailFactoryObject"/> class.
/// </summary>
public MethodInvokingJobDetailFactoryObject()
{
group = SchedulerConstants.DefaultGroup;
}
/// <summary>
/// Set the name of the job.
/// Default is the object name of this FactoryObject.
/// </summary>
/// <seealso cref="Name" />
public virtual string Name
{
set { name = value; }
}
/// <summary>
/// Set the group of the job.
/// Default is the default group of the Scheduler.
/// </summary>
/// <seealso cref="Group" />
/// <seealso cref="SchedulerConstants.DefaultGroup" />
public virtual string Group
{
set { group = value; }
}
/// <summary>
/// Specify whether or not multiple jobs should be run in a concurrent
/// fashion. The behavior when one does not want concurrent jobs to be
/// executed is realized through adding the <see cref="DisallowConcurrentExecutionAttribute" /> attribute.
/// More information on stateful versus stateless jobs can be found
/// <a href="http://www.opensymphony.com/quartz/tutorial.html#jobsMore">here</a>.
/// <p>
/// The default setting is to run jobs concurrently.
/// </p>
/// </summary>
public virtual bool Concurrent
{
set { concurrent = value; }
}
/// <summary>
/// Gets the job detail.
/// </summary>
/// <value>The job detail.</value>
protected IJobDetail JobDetail
{
get { return jobDetail; }
}
/// <summary>
/// Set a list of JobListener names for this job, referring to
/// non-global JobListeners registered with the Scheduler.
/// </summary>
/// <remarks>
/// A JobListener name always refers to the name returned
/// by the JobListener implementation.
/// </remarks>
/// <seealso cref="SchedulerAccessor.JobListeners" />
/// <seealso cref="IJobListener.Name" />
public virtual string[] JobListenerNames
{
set { jobListenerNames = value; }
}
/// <summary>
/// Set the name of the object in the object factory that created this object.
/// </summary>
/// <value>The name of the object in the factory.</value>
/// <remarks>
/// Invoked after population of normal object properties but before an init
/// callback like <see cref="Spring.Objects.Factory.IInitializingObject"/>'s
/// <see cref="Spring.Objects.Factory.IInitializingObject.AfterPropertiesSet"/>
/// method or a custom init-method.
/// </remarks>
public virtual string ObjectName
{
set { objectName = value; }
}
/// <summary>
/// Set the name of the target object in the Spring object factory.
/// </summary>
/// <remarks>
/// This is an alternative to specifying TargetObject
/// allowing for non-singleton objects to be invoked. Note that specified
/// "TargetObject" and "TargetType" values will
/// override the corresponding effect of this "TargetObjectName" setting
///(i.e. statically pre-define the object type or even the target object).
/// </remarks>
public string TargetObjectName
{
set { targetObjectName = value; }
}
/// <summary>
/// Sets the object factory.
/// </summary>
/// <value>The object factory.</value>
public IObjectFactory ObjectFactory
{
set { objectFactory = value; }
}
/// <summary>
/// Return an instance (possibly shared or independent) of the object
/// managed by this factory.
/// </summary>
/// <returns>
/// An instance (possibly shared or independent) of the object managed by
/// this factory.
/// </returns>
/// <remarks>
/// <note type="caution">
/// If this method is being called in the context of an enclosing IoC container and
/// returns <see langword="null"/>, the IoC container will consider this factory
/// object as not being fully initialized and throw a corresponding (and most
/// probably fatal) exception.
/// </note>
/// </remarks>
public virtual object GetObject()
{
return jobDetail;
}
/// <summary>
/// Return the <see cref="System.Type"/> of object that this
/// <see cref="Spring.Objects.Factory.IFactoryObject"/> creates, or
/// <see langword="null"/> if not known in advance.
/// </summary>
/// <value></value>
public virtual Type ObjectType
{
get
{
if (targetObjectName != null)
{
if (objectFactory == null)
{
throw new InvalidOperationException("ObjectFactory must be set when using 'TargetObjectName'");
}
return objectFactory.GetType(targetObjectName);
}
return typeof(IJobDetail);
}
}
/// <summary>
/// Is the object managed by this factory a singleton or a prototype?
/// </summary>
/// <value></value>
public virtual bool IsSingleton
{
get { return true; }
}
/// <summary>
/// Invoked by an <see cref="Spring.Objects.Factory.IObjectFactory"/>
/// after it has injected all of an object's dependencies.
/// </summary>
/// <remarks>
/// <p>
/// This method allows the object instance to perform the kind of
/// initialization only possible when all of it's dependencies have
/// been injected (set), and to throw an appropriate exception in the
/// event of misconfiguration.
/// </p>
/// <p>
/// Please do consult the class level documentation for the
/// <see cref="Spring.Objects.Factory.IObjectFactory"/> interface for a
/// description of exactly <i>when</i> this method is invoked. In
/// particular, it is worth noting that the
/// <see cref="Spring.Objects.Factory.IObjectFactoryAware"/>
/// and <see cref="Spring.Context.IApplicationContextAware"/>
/// callbacks will have been invoked <i>prior</i> to this method being
/// called.
/// </p>
/// </remarks>
/// <exception cref="System.Exception">
/// In the event of misconfiguration (such as the failure to set a
/// required property) or if initialization fails.
/// </exception>
public virtual void AfterPropertiesSet()
{
Prepare();
// Use specific name if given, else fall back to object name.
string jobDetailName = name ?? objectName;
// Consider the concurrent flag to choose between stateful and stateless job.
Type jobType = (concurrent ? typeof (MethodInvokingJob) : typeof (StatefulMethodInvokingJob));
// Build JobDetail instance.
jobDetail = new JobDetailImpl(jobDetailName, group, jobType);
jobDetail.JobDataMap.Put("methodInvoker", this);
jobDetail.Durable = true;
// job listeners through configuration are no longer supported
if (jobListenerNames != null && jobListenerNames.Length > 0)
{
throw new InvalidOperationException("Non-global IJobListeners not supported on Quartz 2 - " +
"manually register a Matcher against the Quartz ListenerManager instead");
}
PostProcessJobDetail(jobDetail);
}
/// <summary>
/// Callback for post-processing the JobDetail to be exposed by this FactoryObject.
/// <p>
/// The default implementation is empty. Can be overridden in subclasses.
/// </p>
/// </summary>
/// <param name="detail">the JobDetail prepared by this FactoryObject</param>
protected virtual void PostProcessJobDetail(IJobDetail detail)
{
}
}
}

View File

@@ -0,0 +1,451 @@
/*
* Copyright 2002-2010 the original author or authors.
*
* Licensed 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.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using Common.Logging;
using Quartz;
using Quartz.Simpl;
using Quartz.Xml;
using Spring.Collections;
using Spring.Context;
using Spring.Core.IO;
using Spring.Transaction;
using Spring.Transaction.Support;
namespace Spring.Scheduling.Quartz
{
/// <summary>
/// Common base class for accessing a Quartz Scheduler, i.e. for registering jobs,
/// triggers and listeners on a <see cref="IScheduler" /> instance.
/// </summary>
/// <remarks>
/// For concrete usage, check out the <see cref="SchedulerFactoryObject" /> and
/// <see cref="SchedulerAccessorObject" /> classes.
///</remarks>
/// <author>Juergen Hoeller</author>
/// <author>Marko Lahma (.NET)</author>
public abstract class SchedulerAccessor : IResourceLoaderAware
{
/// <summary>
/// Logger instance.
/// </summary>
protected readonly ILog logger;
private bool overwriteExistingJobs;
private string[] jobSchedulingDataLocations;
private IList jobDetails;
private IDictionary calendars;
private IList triggers;
private ISchedulerListener[] schedulerListeners;
private IJobListener[] globalJobListeners;
private IJobListener[] jobListeners;
private ITriggerListener[] globalTriggerListeners;
private ITriggerListener[] triggerListeners;
private IPlatformTransactionManager transactionManager;
/// <summary>
/// Resource loader instance for sub-classes
/// </summary>
protected IResourceLoader resourceLoader;
/// <summary>
/// Initializes a new instance of the <see cref="SchedulerAccessor"/> class.
/// </summary>
protected SchedulerAccessor()
{
logger = LogManager.GetLogger(GetType());
}
/// <summary>
/// Set whether any jobs defined on this SchedulerFactoryObject should overwrite
/// existing job definitions. Default is "false", to not overwrite already
/// registered jobs that have been read in from a persistent job store.
/// </summary>
public virtual bool OverwriteExistingJobs
{
set { overwriteExistingJobs = value; }
}
/// <summary>
/// Set the locations of Quartz job definition XML files that follow the
/// "job_scheduling_data_1_5" XSD. Can be specified to automatically
/// register jobs that are defined in such files, possibly in addition
/// to jobs defined directly on this SchedulerFactoryObject.
/// </summary>
/// <seealso cref="XMLSchedulingDataProcessor" />
public virtual string[] JobSchedulingDataLocations
{
set { jobSchedulingDataLocations = value; }
}
/// <summary>
/// Set the location of a Quartz job definition XML file that follows the
/// "job_scheduling_data" XSD. Can be specified to automatically
/// register jobs that are defined in such a file, possibly in addition
/// to jobs defined directly on this SchedulerFactoryObject.
/// </summary>
/// <seealso cref="XMLSchedulingDataProcessor" />
public virtual string JobSchedulingDataLocation
{
set { jobSchedulingDataLocations = new string[] {value}; }
}
/// <summary>
/// Register a list of JobDetail objects with the Scheduler that
/// this FactoryObject creates, to be referenced by Triggers.
/// This is not necessary when a Trigger determines the JobDetail
/// itself: In this case, the JobDetail will be implicitly registered
/// in combination with the Trigger.
/// </summary>
/// <seealso cref="Triggers" />
/// <seealso cref="IJobDetail" />
/// <seealso cref="JobDetailObject" />
/// <seealso cref="IJobDetailAwareTrigger" />
/// <seealso cref="ITrigger.JobKey" />
public virtual IJobDetail[] JobDetails
{
set
{
// Use modifiable ArrayList here, to allow for further adding of
// JobDetail objects during autodetection of JobDetailAwareTriggers.
jobDetails = new List<IJobDetail>(value);
}
}
/// <summary>
/// Register a list of Quartz ICalendar objects with the Scheduler
/// that this FactoryObject creates, to be referenced by Triggers.
/// </summary>
/// <value>Map with calendar names as keys as Calendar objects as values</value>
/// <seealso cref="ICalendar" />
/// <seealso cref="ITrigger.CalendarName" />
public virtual IDictionary Calendars
{
set { calendars = value; }
}
/// <summary>
/// Register a list of Trigger objects with the Scheduler that
/// this FactoryObject creates.
/// </summary>
/// <remarks>
/// If the Trigger determines the corresponding JobDetail itself,
/// the job will be automatically registered with the Scheduler.
/// Else, the respective JobDetail needs to be registered via the
/// "jobDetails" property of this FactoryObject.
/// </remarks>
/// <seealso cref="JobDetails" />
/// <seealso cref="IJobDetail" />
/// <seealso cref="IJobDetailAwareTrigger" />
/// <seealso cref="CronTriggerObject" />
/// <seealso cref="SimpleTriggerObject" />
public virtual ITrigger[] Triggers
{
set { triggers = new ArrayList(value); }
}
/// <summary>
/// Specify Quartz SchedulerListeners to be registered with the Scheduler.
/// </summary>
public virtual ISchedulerListener[] SchedulerListeners
{
set { schedulerListeners = value; }
}
/// <summary>
/// Specify global Quartz JobListeners to be registered with the Scheduler.
/// Such JobListeners will apply to all Jobs in the Scheduler.
/// </summary>
public virtual IJobListener[] GlobalJobListeners
{
set { globalJobListeners = value; }
}
/// <summary>
/// Specify named Quartz JobListeners to be registered with the Scheduler.
/// Such JobListeners will only apply to Jobs that explicitly activate
/// them via their name.
/// </summary>
/// <seealso cref="IJobListener.Name" />
public virtual IJobListener[] JobListeners
{
set { jobListeners = value; }
}
/// <summary>
/// Specify global Quartz TriggerListeners to be registered with the Scheduler.
/// Such TriggerListeners will apply to all Triggers in the Scheduler.
/// </summary>
public virtual ITriggerListener[] GlobalTriggerListeners
{
set { globalTriggerListeners = value; }
}
/// <summary>
/// Specify named Quartz TriggerListeners to be registered with the Scheduler.
/// Such TriggerListeners will only apply to Triggers that explicitly activate
/// them via their name.
/// </summary>
/// <seealso cref="ITriggerListener.Name" />
public virtual ITriggerListener[] TriggerListeners
{
set { triggerListeners = value; }
}
/// <summary>
/// Set the transaction manager to be used for registering jobs and triggers
/// that are defined by this SchedulerFactoryObject. Default is none; setting
/// this only makes sense when specifying a DataSource for the Scheduler.
/// </summary>
public virtual IPlatformTransactionManager TransactionManager
{
set { transactionManager = value; }
}
/// <summary>
/// Sets the <see cref="Spring.Core.IO.IResourceLoader"/>
/// that this object runs in.
/// </summary>
/// <value></value>
/// <remarks>
/// Invoked <b>after</b> population of normal objects properties but
/// before an init callback such as
/// <see cref="Spring.Objects.Factory.IInitializingObject"/>'s
/// <see cref="Spring.Objects.Factory.IInitializingObject.AfterPropertiesSet()"/>
/// or a custom init-method. Invoked <b>before</b> setting
/// <see cref="Spring.Context.IApplicationContextAware"/>'s
/// <see cref="Spring.Context.IApplicationContextAware.ApplicationContext"/>
/// property.
/// </remarks>
public virtual IResourceLoader ResourceLoader
{
set { resourceLoader = value; }
}
/// <summary>
/// Register jobs and triggers (within a transaction, if possible).
/// </summary>
protected virtual void RegisterJobsAndTriggers()
{
ITransactionStatus transactionStatus = null;
if (transactionManager != null)
{
transactionStatus = transactionManager.GetTransaction(new DefaultTransactionDefinition());
}
try
{
if (jobSchedulingDataLocations != null)
{
XMLSchedulingDataProcessor dataProcessor = new XMLSchedulingDataProcessor(new SimpleTypeLoadHelper());
dataProcessor.OverWriteExistingData = overwriteExistingJobs;
foreach (string location in jobSchedulingDataLocations)
{
dataProcessor.ProcessFileAndScheduleJobs(location, GetScheduler());
}
}
// Register JobDetails.
if (jobDetails != null)
{
foreach (IJobDetail jobDetail in jobDetails)
{
AddJobToScheduler(jobDetail);
}
}
else
{
// Create empty list for easier checks when registering triggers.
jobDetails = new LinkedList();
}
// Register Calendars.
if (calendars != null)
{
foreach (DictionaryEntry entry in calendars)
{
string calendarName = (string) entry.Key;
ICalendar calendar = (ICalendar) entry.Value;
GetScheduler().AddCalendar(calendarName, calendar, true, true);
}
}
// Register Triggers.
if (triggers != null)
{
foreach (ITrigger trigger in triggers)
{
AddTriggerToScheduler(trigger);
}
}
}
catch (Exception ex)
{
if (transactionStatus != null)
{
try
{
transactionManager.Rollback(transactionStatus);
}
catch (TransactionException)
{
logger.Error("Job registration exception overridden by rollback exception", ex);
throw;
}
}
if (ex is SchedulerException)
{
throw;
}
throw new SchedulerException("Registration of jobs and triggers failed: " + ex.Message);
}
if (transactionStatus != null)
{
transactionManager.Commit(transactionStatus);
}
}
/// <summary>
/// Add the given job to the Scheduler, if it doesn't already exist.
/// Overwrites the job in any case if "overwriteExistingJobs" is set.
/// </summary>
/// <param name="jobDetail">the job to add</param>
/// <returns><code>true</code> if the job was actually added, <code>false</code> if it already existed before</returns>
private bool AddJobToScheduler(IJobDetail jobDetail)
{
if (overwriteExistingJobs || GetScheduler().GetJobDetail(jobDetail.Key) == null)
{
GetScheduler().AddJob(jobDetail, true);
return true;
}
else
{
return false;
}
}
/// <summary>
/// Add the given trigger to the Scheduler, if it doesn't already exist.
/// Overwrites the trigger in any case if "overwriteExistingJobs" is set.
/// </summary>
/// <param name="trigger">the trigger to add</param>
/// <returns><code>true</code> if the trigger was actually added, <code>false</code> if it already existed before</returns>
private bool AddTriggerToScheduler(ITrigger trigger)
{
bool triggerExists = (GetScheduler().GetTrigger(trigger.Key) != null);
if (!triggerExists || this.overwriteExistingJobs)
{
// Check if the Trigger is aware of an associated JobDetail.
if (trigger is IJobDetailAwareTrigger)
{
IJobDetail jobDetail = ((IJobDetailAwareTrigger) trigger).JobDetail;
// Automatically register the JobDetail too.
if (!jobDetails.Contains(jobDetail) && AddJobToScheduler(jobDetail))
{
jobDetails.Add(jobDetail);
}
}
if (!triggerExists)
{
try
{
GetScheduler().ScheduleJob(trigger);
}
catch (ObjectAlreadyExistsException ex)
{
if (logger.IsDebugEnabled)
{
logger.Debug(
"Unexpectedly found existing trigger, assumably due to cluster race condition: " +
ex.Message + " - can safely be ignored");
}
if (overwriteExistingJobs)
{
GetScheduler().RescheduleJob(trigger.Key, trigger);
}
}
}
else
{
GetScheduler().RescheduleJob(trigger.Key, trigger);
}
return true;
}
else
{
return false;
}
}
/// <summary>
/// Register all specified listeners with the Scheduler.
/// </summary>
protected virtual void RegisterListeners()
{
if (schedulerListeners != null)
{
for (int i = 0; i < schedulerListeners.Length; i++)
{
GetScheduler().ListenerManager.AddSchedulerListener(schedulerListeners[i]);
}
}
if (globalJobListeners != null)
{
foreach (IJobListener jobListener in globalJobListeners)
{
GetScheduler().ListenerManager.AddJobListener(jobListener);
}
}
if (jobListeners != null && jobListeners.Length > 0)
{
throw new InvalidOperationException("Non-global JobListeners not supported on Quartz 2 - " +
"manually register a Matcher against the Quartz ListenerManager instead");
}
if (globalTriggerListeners != null)
{
foreach (ITriggerListener triggerListener in globalTriggerListeners)
{
GetScheduler().ListenerManager.AddTriggerListener(triggerListener);
}
}
if (triggerListeners != null && triggerListeners.Length > 0)
{
throw new InvalidOperationException("Non-global TriggerListeners not supported on Quartz 2 - " +
"manually register a Matcher against the Quartz ListenerManager instead");
}
}
/// <summary>
/// Template method that determines the Scheduler to operate on.
/// To be implemented by subclasses.
/// </summary>
/// <returns></returns>
protected abstract IScheduler GetScheduler();
}
}

View File

@@ -0,0 +1,215 @@
/*
* Copyright 2002-2010 the original author or authors.
*
* Licensed 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.
*/
using System;
using System.Collections;
using Quartz;
using Quartz.Impl.Triggers;
using Spring.Objects.Factory;
using Spring.Util;
namespace Spring.Scheduling.Quartz
{
/// <summary>
/// Convenience subclass of Quartz's <see cref="ISimpleTrigger" />
/// class, making properties based usage easier.
/// </summary>
/// <remarks>
/// <p>
/// SimpleTrigger itself is already a PONO but lacks sensible defaults.
/// This class uses the Spring object name as job name, the Quartz default group
/// ("DEFAULT") as job group, the current time as start time, and indefinite
/// repetition, if not specified.
/// </p>
///
/// <p>
/// This class will also register the trigger with the job name and group of
/// a given <see cref="JobDetail" />. This allows <see cref="SchedulerFactoryObject" />
/// to automatically register a trigger for the corresponding JobDetail,
/// instead of registering the JobDetail separately.
/// </p>
/// </remarks>
/// <author>Juergen Hoeller</author>
/// <seealso cref="ITrigger.Key" />
/// <seealso cref="ITrigger.StartTimeUtc" />
/// <seealso cref="ITrigger.JobKey" />
/// <seealso cref="SimpleTriggerObject.JobDetail" />
/// <seealso cref="SchedulerAccessor.Triggers" />
/// <seealso cref="SchedulerAccessor.JobDetails" />
/// <seealso cref="CronTriggerObject" />
public class SimpleTriggerObject : SimpleTriggerImpl, IJobDetailAwareTrigger, IObjectNameAware, IInitializingObject
{
private TimeSpan startDelay = TimeSpan.Zero;
private IJobDetail jobDetail;
private string objectName;
private readonly Constants constants = new Constants(typeof(MisfireInstruction.SimpleTrigger), typeof(MisfireInstruction));
/// <summary>
/// Initializes a new instance of the <see cref="SimpleTriggerObject"/> class.
/// </summary>
public SimpleTriggerObject()
{
RepeatCount = RepeatIndefinitely;
}
/// <summary>
/// Register objects in the JobDataMap via a given Map.
/// <p>
/// These objects will be available to this Trigger only,
/// in contrast to objects in the JobDetail's data map.
/// </p>
/// </summary>
/// <seealso cref="JobDetailObject.JobDataAsMap" />
public virtual IDictionary JobDataAsMap
{
set
{
foreach (DictionaryEntry entry in value)
{
JobDataMap.Put((string) entry.Key, entry.Value);
}
}
}
/// <summary>
/// Set the misfire instruction via the name of the corresponding
/// constant in the SimpleTrigger class.
/// Default is <see cref="MisfireInstruction.SmartPolicy" />.
/// </summary>
/// <seealso cref="MisfireInstruction.SimpleTrigger.FireNow" />
/// <seealso cref="MisfireInstruction.SimpleTrigger.RescheduleNextWithExistingCount" />
/// <seealso cref="MisfireInstruction.SimpleTrigger.RescheduleNextWithRemainingCount" />
/// <seealso cref="MisfireInstruction.SimpleTrigger.RescheduleNowWithExistingRepeatCount" />
/// <seealso cref="MisfireInstruction.SimpleTrigger.RescheduleNowWithRemainingRepeatCount" />
/// <seealso cref="MisfireInstruction.SmartPolicy" />
public virtual string MisfireInstructionName
{
set { MisfireInstruction = constants.AsNumber(value); }
}
/// <summary>
/// Set the delay before starting the job for the first time.
/// The given time span will be added to the current
/// time to calculate the start time. Default is <see cref="TimeSpan.Zero" />.
/// </summary>
/// <remarks>
/// This delay will just be applied if no custom start time was
/// specified. However, in typical usage within a Spring context,
/// the start time will be the container startup time anyway.
/// Specifying a relative delay is appropriate in that case.
/// </remarks>
/// <seealso cref="ITrigger.StartTimeUtc" />
public virtual TimeSpan StartDelay
{
set
{
AssertUtils.State(value > TimeSpan.Zero, "Start delay cannot be negative.");
startDelay = value;
}
get { return startDelay; }
}
/// <summary>
/// Set the name of the object in the object factory that created this object.
/// </summary>
/// <value>The name of the object in the factory.</value>
/// <remarks>
/// <p>
/// Invoked after population of normal object properties but before an init
/// callback like <see cref="Spring.Objects.Factory.IInitializingObject"/>'s
/// <see cref="Spring.Objects.Factory.IInitializingObject.AfterPropertiesSet"/>
/// method or a custom init-method.
/// </p>
/// </remarks>
public virtual string ObjectName
{
set { objectName = value; }
}
/// <summary>
/// Set the JobDetail that this trigger should be associated with.
/// <p>
/// This is typically used with a object reference if the JobDetail
/// is a Spring-managed object. Alternatively, the trigger can also
/// be associated with a job by name and group.
/// </p>
/// </summary>
public virtual IJobDetail JobDetail
{
get { return jobDetail; }
set { jobDetail = value; }
}
/// <summary>
/// Invoked by an <see cref="Spring.Objects.Factory.IObjectFactory"/>
/// after it has injected all of an object's dependencies.
/// </summary>
/// <remarks>
/// <p>
/// This method allows the object instance to perform the kind of
/// initialization only possible when all of it's dependencies have
/// been injected (set), and to throw an appropriate exception in the
/// event of misconfiguration.
/// </p>
/// <p>
/// Please do consult the class level documentation for the
/// <see cref="Spring.Objects.Factory.IObjectFactory"/> interface for a
/// description of exactly <i>when</i> this method is invoked. In
/// particular, it is worth noting that the
/// <see cref="Spring.Objects.Factory.IObjectFactoryAware"/>
/// and <see cref="Spring.Context.IApplicationContextAware"/>
/// callbacks will have been invoked <i>prior</i> to this method being
/// called.
/// </p>
/// </remarks>
/// <exception cref="System.Exception">
/// In the event of misconfiguration (such as the failure to set a
/// required property) or if initialization fails.
/// </exception>
public virtual void AfterPropertiesSet()
{
#if QUARTZ_2_0
if (StartTimeUtc == DateTimeOffset.MinValue)
{
StartTimeUtc = DateTimeOffset.UtcNow;
}
#else
if (StartTimeUtc == DateTime.MinValue)
{
StartTimeUtc = DateTime.UtcNow;
}
#endif
if (StartDelay > TimeSpan.Zero)
{
StartTimeUtc = DateTime.UtcNow.Add(startDelay);
}
if (Name == null)
{
Name = objectName;
}
if (Group == null)
{
Group = SchedulerConstants.DefaultGroup;
}
if (jobDetail != null)
{
JobName = jobDetail.Key.Name;
JobGroup = jobDetail.Key.Group;
}
}
}
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright 2002-2010 the original author or authors.
*
* Licensed 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.
*/
using Quartz;
namespace Spring.Scheduling.Quartz
{
/// <summary>
/// Extension of the MethodInvokingJob, implementing the StatefulJob interface.
/// Quartz checks whether or not jobs are stateful and if so,
/// won't let jobs interfere with each other.
/// </summary>
[DisallowConcurrentExecution]
[PersistJobDataAfterExecution]
public class StatefulMethodInvokingJob : MethodInvokingJob
{
// No implementation, just an addition of the tag interface StatefulJob
// in order to allow stateful method invoking jobs.
}
}

View File

@@ -0,0 +1,136 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{764C3A6A-8690-49DD-B9AF-99E7C09AE4F0}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Spring</RootNamespace>
<AssemblyName>Spring.Scheduling.Quartz20</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\build\VS.NET.2008\Spring.Scheduling.Quartz20\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;NET_2_0,QUARTZ_2_0</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>..\..\..\build\VS.NET.2008\Spring.Scheduling.Quartz\Debug\Spring.Scheduling.Quartz20.XML</DocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\build\VS.NET.2008\Spring.Scheduling.Quartz20\Release\</OutputPath>
<DefineConstants>TRACE;NET_2_0</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="C5, Version=1.1.0.0, Culture=neutral, PublicKeyToken=06a1b38866503b69, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\Quartz20\net\3.5\C5.dll</HintPath>
</Reference>
<Reference Include="Common.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\Net\2.0\Common.Logging.dll</HintPath>
</Reference>
<Reference Include="Quartz, Version=2.0.0.100, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\Quartz20\net\3.5\Quartz.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll</HintPath>
</Reference>
<Reference Include="System.Data" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Spring.Scheduling.Quartz\JobMethodInvocationFailedException.cs">
<Link>JobMethodInvocationFailedException.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\AdaptableJobFactory.cs">
<Link>Scheduling\Quartz\AdaptableJobFactory.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\DelegatingJob.cs">
<Link>Scheduling\Quartz\DelegatingJob.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\IJobDetailAwareTrigger.cs">
<Link>Scheduling\Quartz\IJobDetailAwareTrigger.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\ISchedulerContextAware.cs">
<Link>Scheduling\Quartz\ISchedulerContextAware.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\ISchedulingTaskExecutor.cs">
<Link>Scheduling\Quartz\ISchedulingTaskExecutor.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\ITaskExecutor.cs">
<Link>Scheduling\Quartz\ITaskExecutor.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\LocalDataSourceJobStore.cs">
<Link>Scheduling\Quartz\LocalDataSourceJobStore.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\LocalTaskExecutorThreadPool.cs">
<Link>Scheduling\Quartz\LocalTaskExecutorThreadPool.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\MethodInvokingJob.cs">
<Link>Scheduling\Quartz\MethodInvokingJob.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\MethodInvokingRunnable.cs">
<Link>Scheduling\Quartz\MethodInvokingRunnable.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\QuartzJobObject.cs">
<Link>Scheduling\Quartz\QuartzJobObject.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\SchedulerAccessorObject.cs">
<Link>Scheduling\Quartz\SchedulerAccessorObject.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\SchedulerFactoryObject.cs">
<Link>Scheduling\Quartz\SchedulerFactoryObject.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\SchedulingException.cs">
<Link>Scheduling\Quartz\SchedulingException.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\SimpleThreadPoolTaskExecutor.cs">
<Link>Scheduling\Quartz\SimpleThreadPoolTaskExecutor.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\SpringDbProviderAdapter.cs">
<Link>Scheduling\Quartz\SpringDbProviderAdapter.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\SpringObjectJobFactory.cs">
<Link>Scheduling\Quartz\SpringObjectJobFactory.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\TaskRejectedException.cs">
<Link>Scheduling\Quartz\TaskRejectedException.cs</Link>
</Compile>
<Compile Include="Scheduling\Quartz\CronTriggerObject.cs" />
<Compile Include="Scheduling\Quartz\JobDetailObject.cs" />
<Compile Include="Scheduling\Quartz\MethodInvokingJobDetailFactoryObject.cs" />
<Compile Include="Scheduling\Quartz\SchedulerAccessor.cs" />
<Compile Include="Scheduling\Quartz\SimpleTriggerObject.cs" />
<Compile Include="Scheduling\Quartz\StatefulMethodInvokingJob.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Spring.Core\Spring.Core.2008.csproj">
<Project>{710961A3-0DF4-49E4-A26E-F5B9C044AC84}</Project>
<Name>Spring.Core.2008</Name>
</ProjectReference>
<ProjectReference Include="..\Spring.Data\Spring.Data.2008.csproj">
<Project>{AE00E5AB-C39A-436F-86D2-33BFE33E2E40}</Project>
<Name>Spring.Data.2008</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{E823D54C-CE82-4868-929F-5F95A999F123}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Spring</RootNamespace>
<AssemblyName>Spring.Scheduling.Quartz20</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\build\VS.NET.2010\Spring.Scheduling.Quartz20\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;NET_2_0,QUARTZ_2_0</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>..\..\..\build\VS.NET.2010\Spring.Scheduling.Quartz20\Debug\Spring.Scheduling.Quartz20.XML</DocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\build\VS.NET.2010\Spring.Scheduling.Quartz20\Release\</OutputPath>
<DefineConstants>TRACE;NET_2_0</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="C5">
<HintPath>..\..\..\lib\Quartz20\net\3.5\C5.dll</HintPath>
</Reference>
<Reference Include="Common.Logging, Version=1.1.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\net\2.0\Common.Logging.dll</HintPath>
</Reference>
<Reference Include="Quartz">
<HintPath>..\..\..\lib\Quartz20\net\3.5\Quartz.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\AdaptableJobFactory.cs">
<Link>Scheduling\Quartz\AdaptableJobFactory.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\DelegatingJob.cs">
<Link>Scheduling\Quartz\DelegatingJob.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\IJobDetailAwareTrigger.cs">
<Link>Scheduling\Quartz\IJobDetailAwareTrigger.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\ISchedulerContextAware.cs">
<Link>Scheduling\Quartz\ISchedulerContextAware.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\ISchedulingTaskExecutor.cs">
<Link>Scheduling\Quartz\ISchedulingTaskExecutor.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\ITaskExecutor.cs">
<Link>Scheduling\Quartz\ITaskExecutor.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\LocalDataSourceJobStore.cs">
<Link>Scheduling\Quartz\LocalDataSourceJobStore.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\LocalTaskExecutorThreadPool.cs">
<Link>Scheduling\Quartz\LocalTaskExecutorThreadPool.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\MethodInvokingJob.cs">
<Link>Scheduling\Quartz\MethodInvokingJob.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\MethodInvokingRunnable.cs">
<Link>Scheduling\Quartz\MethodInvokingRunnable.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\QuartzJobObject.cs">
<Link>Scheduling\Quartz\QuartzJobObject.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\SchedulerAccessorObject.cs">
<Link>Scheduling\Quartz\SchedulerAccessorObject.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\SchedulerFactoryObject.cs">
<Link>Scheduling\Quartz\SchedulerFactoryObject.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\SchedulingException.cs">
<Link>Scheduling\Quartz\SchedulingException.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\SimpleThreadPoolTaskExecutor.cs">
<Link>Scheduling\Quartz\SimpleThreadPoolTaskExecutor.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\SpringDbProviderAdapter.cs">
<Link>Scheduling\Quartz\SpringDbProviderAdapter.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\SpringObjectJobFactory.cs">
<Link>Scheduling\Quartz\SpringObjectJobFactory.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz\Scheduling\Quartz\TaskRejectedException.cs">
<Link>Scheduling\Quartz\TaskRejectedException.cs</Link>
</Compile>
<Compile Include="JobMethodInvocationFailedException.cs" />
<Compile Include="Scheduling\Quartz\CronTriggerObject.cs" />
<Compile Include="Scheduling\Quartz\JobDetailObject.cs" />
<Compile Include="Scheduling\Quartz\MethodInvokingJobDetailFactoryObject.cs" />
<Compile Include="Scheduling\Quartz\SchedulerAccessor.cs" />
<Compile Include="Scheduling\Quartz\SimpleTriggerObject.cs" />
<Compile Include="Scheduling\Quartz\StatefulMethodInvokingJob.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Spring.Core\Spring.Core.2010.csproj">
<Project>{710961A3-0DF4-49E4-A26E-F5B9C044AC84}</Project>
<Name>Spring.Core.2010</Name>
</ProjectReference>
<ProjectReference Include="..\Spring.Data\Spring.Data.2010.csproj">
<Project>{AE00E5AB-C39A-436F-86D2-33BFE33E2E40}</Project>
<Name>Spring.Data.2010</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,56 @@
<?xml version="1.0" ?>
<project name="Spring.Scheduling.Quartz20" default="build" xmlns="http://nant.sf.net/schemas/nant.xsd">
<!--
Required properties:
* current.bin.dir - (path) root level to build to
* current.build.debug - (true|false) debug build?
* current.build.defines.csc - framework-specific build defines for C# compiler
-->
<target name="build">
<echo message="${quartz20.lib.dir}" />
<copy todir="${current.bin.dir}" overwrite="true">
<fileset basedir="${quartz20.lib.dir}">
<include name="**/*.dll" />
</fileset>
</copy>
<csc target="library" define="${current.build.defines.csc},QUARTZ_2_0"
warnaserror="true"
optimize="${build.optimize}"
debug="${current.build.debug}"
output="${current.bin.dir}/${project::get-name()}.dll"
doc="${current.bin.dir}/${project::get-name()}.xml"
>
<arg line="${compiler.args}"/>
<nowarn>
<warning number="1591" />
</nowarn>
<sources failonempty="true">
<include name="**/*.cs" />
<include name="../Spring.Scheduling.Quartz/**/*.cs" />
<exclude name="../Spring.Scheduling.Quartz/**/CronTriggerObject.cs" />
<exclude name="../Spring.Scheduling.Quartz/**/JobDetailObject.cs" />
<exclude name="../Spring.Scheduling.Quartz/**/MethodInvokingJobDetailFactoryObject.cs" />
<exclude name="../Spring.Scheduling.Quartz/**/SchedulerAccessor.cs" />
<exclude name="../Spring.Scheduling.Quartz/**/SimpleTriggerObject.cs" />
<exclude name="../Spring.Scheduling.Quartz/**/StatefulMethodInvokingJob.cs" />
<exclude name="../Spring.Scheduling.Quartz/**/JobMethodInvocationFailedException.cs" />
<exclude name="../Spring.Scheduling.Quartz/**/ResourceJobSchedulingDataProcessor.cs" />
<include name="../GenCommonAssemblyInfo.cs" />
</sources>
<references basedir="${current.bin.dir}">
<include name="Spring.Core.dll" />
<include name="Spring.Data.dll" />
<include name="Common.Logging.dll" />
<include name="System.Data.dll" />
<include name="Quartz.dll" />
<include name="C5.dll" />
<exclude name="${project::get-name()}.dll" />
<exclude if="${net-4.0}" name="System.Web.Extensions.dll" />
</references>
</csc>
</target>
</project>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Spring.Scheduling.Quartz20</id>
<projectUrl>http://www.springframework.net/</projectUrl>
<licenseUrl>http://www.springframework.net/license.html</licenseUrl>
<iconUrl>http://springframework.net/images/SpringSource_Leaves32x32.png</iconUrl>
<version>0.0.0</version>
<!-- this value is a placeholder replaced by build script -->
<authors>SpringSource</authors>
<description>Spring.NET Integration with the Quartz Scheduling Library 2.0</description>
<summary>
</summary>
<language>en-US</language>
<dependencies>
<dependency id="Common.Logging" version="2.0" />
<dependency id="Quartz" version="2.0.0" />
<dependency id="Spring.Core" version="1.3.2" />
<dependency id="Spring.Data" version="1.3.2" />
</dependencies>
</metadata>
<files>
<file src="..\..\..\build\net\3.5\release\Spring.Scheduling.Quartz20.dll" target="lib\net35" />
<file src="..\..\..\build\net\3.5\release\Spring.Scheduling.Quartz20.pdb" target="lib\net35" />
<file src="..\..\..\build\net\3.5\release\Spring.Scheduling.Quartz20.xml" target="lib\net35" />
<file src="..\..\..\build\net\4.0\release\Spring.Scheduling.Quartz20.dll" target="lib\net40" />
<file src="..\..\..\build\net\4.0\release\Spring.Scheduling.Quartz20.pdb" target="lib\net40" />
<file src="..\..\..\build\net\4.0\release\Spring.Scheduling.Quartz20.xml" target="lib\net40" />
</files>
</package>

View File

@@ -2,7 +2,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{E4328F68-C3FC-43E2-9D63-30CEC55215B0}</ProjectGuid>
<OutputType>Library</OutputType>
@@ -33,9 +33,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\net\2.0\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="Quartz, Version=0.7.0.15571, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Quartz, Version=1.0.3.2, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\net\2.0\Quartz.dll</HintPath>
<HintPath>..\..\..\lib\Quartz10\net\2.0\Quartz.dll</HintPath>
</Reference>
<Reference Include="Rhino.Mocks, Version=2.9.6.40380, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>

View File

@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{E4328F68-C3FC-43E2-9D63-30CEC55215B0}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Spring</RootNamespace>
<AssemblyName>Spring.Scheduling.Quartz.Integration.Tests</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\build\VS.NET.2008\Spring.Scheduling.Quartz.Integration.Tests\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;NET_2_0;NET_3_5</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\build\VS.NET.2008\Spring.Scheduling.Quartz.Integration.Tests\Release\</OutputPath>
<DefineConstants>TRACE;NET_2_0;NET_3_5</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework, Version=2.2.7.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\net\2.0\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="Quartz, Version=1.0.3.2, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\Quartz10\net\2.0\Quartz.dll</HintPath>
</Reference>
<Reference Include="Rhino.Mocks, Version=2.9.6.40380, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\Net\2.0\Rhino.Mocks.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<None Include="Spring.Scheduling.Quartz.Integration.Tests.dll.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<Compile Include="Scheduling\Quartz\LocalDataSourceJobStoreTest.cs" />
<Compile Include="Scheduling\Quartz\TestJob.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Scheduling\Quartz\LocalDataSourceJobStoreTest.xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\src\Spring\Spring.Core\Spring.Core.2010.csproj">
<Project>{710961A3-0DF4-49E4-A26E-F5B9C044AC84}</Project>
<Name>Spring.Core.2010</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\src\Spring\Spring.Data\Spring.Data.2010.csproj">
<Project>{AE00E5AB-C39A-436F-86D2-33BFE33E2E40}</Project>
<Name>Spring.Data.2010</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\src\Spring\Spring.Scheduling.Quartz\Spring.Scheduling.Quartz.2010.csproj">
<Project>{E823D54C-CE82-4868-929F-5F95A999F61E}</Project>
<Name>Spring.Scheduling.Quartz.2010</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -44,8 +44,8 @@
<assemblyIdentity name="Common.Logging"
publicKeyToken="af08829b84f0328e" />
<!-- Assembly versions can be redirected in application, publisher policy, or machine configuration files. -->
<bindingRedirect oldVersion="1.1.0.0"
newVersion="1.2.0.0"/>
<bindingRedirect oldVersion="1.2.0.0"
newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>

View File

@@ -14,15 +14,11 @@
* limitations under the License.
*/
using System;
using NUnit.Framework;
using Quartz;
using Quartz.Job;
using Quartz.Spi;
using Spring.Scheduling.Quartz;
namespace Spring.Scheduling.Quartz
{
/// <summary>
@@ -52,8 +48,12 @@ namespace Spring.Scheduling.Quartz
try
{
// this actually fails already in Quartz level
TriggerFiredBundle bundle = TestUtil.CreateMinimalFiredBundleWithTypedJobDetail(typeof(object));
TriggerFiredBundle bundle = TestUtil.CreateMinimalFiredBundleWithTypedJobDetail(typeof (object));
#if QUARTZ_2_0
jobFactory.NewJob(bundle, null);
#else
jobFactory.NewJob(bundle);
#endif
Assert.Fail("Created job which was not an IJob");
}
catch (ArgumentException)
@@ -85,14 +85,15 @@ namespace Spring.Scheduling.Quartz
[Test]
public void TestNewJob_NormalIJob()
{
TriggerFiredBundle bundle = TestUtil.CreateMinimalFiredBundleWithTypedJobDetail(typeof(NoOpJob));
TriggerFiredBundle bundle = TestUtil.CreateMinimalFiredBundleWithTypedJobDetail(typeof (NoOpJob));
#if QUARTZ_2_0
IJob job = jobFactory.NewJob(bundle, null);
#else
IJob job = jobFactory.NewJob(bundle);
#endif
Assert.IsNotNull(job, "Returned job was null");
}
}
internal class NoOpThreadStartJob : NoOpJob

View File

@@ -16,12 +16,16 @@
using System;
using System.Collections;
using System.Collections.Generic;
using NUnit.Framework;
using Quartz;
using Quartz.Job;
#if QUARTZ_2_0
using JobDetail = Quartz.Impl.JobDetailImpl;
#endif
namespace Spring.Scheduling.Quartz
{
/// <summary>
@@ -79,7 +83,7 @@ namespace Spring.Scheduling.Quartz
[Test]
public void TestJobDataAsMap()
{
Hashtable data = new Hashtable();
IDictionary data = new Dictionary<string, object>();
data["foo"] = "bar";
data["number"] = 123;
cronTrigger.JobDataAsMap = data;

View File

@@ -18,6 +18,10 @@ using NUnit.Framework;
using Quartz;
#if QUARTZ_2_0
using JobDetail = Quartz.Impl.JobDetailImpl;
#endif
namespace Spring.Scheduling.Quartz
{
/// <summary>
@@ -54,7 +58,9 @@ namespace Spring.Scheduling.Quartz
Assert.AreEqual(FACTORY_NAME, jd.Name, "job name did not default to factory name");
Assert.AreEqual(jd.JobType, typeof(MethodInvokingJob), "factory did not create method invoking job");
Assert.IsTrue(jd.Durable, "job was not durable");
#if !QUARTZ_2_0
Assert.IsTrue(jd.Volatile, "job was not volatile");
#endif
}
/// <summary>
@@ -70,6 +76,7 @@ namespace Spring.Scheduling.Quartz
Assert.AreEqual(jd.JobType, typeof(StatefulMethodInvokingJob), "factory did not create stateful method invoking job");
}
#if !QUARTZ_2_0
/// <summary>
/// Tests JobDetail retrieval and it's set properties.
/// </summary>
@@ -82,6 +89,7 @@ namespace Spring.Scheduling.Quartz
JobDetail jd = (JobDetail)factory.GetObject();
CollectionAssert.AreEquivalent(LISTENER_NAMES, jd.JobListenerNames);
}
#endif
}
}

View File

@@ -27,6 +27,12 @@ using Rhino.Mocks;
using Spring.Objects.Support;
#if QUARTZ_2_0
using JobExecutionContext = Quartz.Impl.JobExecutionContextImpl;
using JobDetail = Quartz.Impl.JobDetailImpl;
using SimpleTrigger = Quartz.Impl.Triggers.SimpleTriggerImpl;
#endif
namespace Spring.Scheduling.Quartz
{
/// <summary>

View File

@@ -30,6 +30,14 @@ using Spring.Context.Support;
using Spring.Objects;
using Spring.Objects.Factory.Support;
#if QUARTZ_2_0
using CronTrigger = Quartz.Impl.Triggers.CronTriggerImpl;
using JobExecutionContext = Quartz.IJobExecutionContext;
using JobDetail = Quartz.Impl.JobDetailImpl;
using SimpleTrigger = Quartz.Impl.Triggers.SimpleTriggerImpl;
using Trigger = Quartz.ITrigger;
#endif
namespace Spring.Scheduling.Quartz
{
/// <summary>
@@ -41,17 +49,6 @@ namespace Spring.Scheduling.Quartz
[TestFixture]
public class QuartzSupportTests
{
private MockRepository mockery;
/// <summary>
/// Test setup.
/// </summary>
[SetUp]
public void SetUp()
{
mockery = new MockRepository();
}
/// <summary>
/// Executes parametrized test.
/// </summary>
@@ -123,28 +120,10 @@ namespace Spring.Scheduling.Quartz
trigger1.RepeatInterval = TimeSpan.FromMilliseconds(20);
trigger1.AfterPropertiesSet();
IScheduler scheduler = (IScheduler) mockery.CreateMock(typeof (IScheduler));
IScheduler scheduler = MockRepository.GenerateMock<IScheduler>();
Expect.Call(scheduler.Context).Return(new SchedulerContext());
Expect.Call(scheduler.GetJobDetail("myJob0", SchedulerConstants.DefaultGroup)).Return(null);
Expect.Call(scheduler.GetJobDetail("myJob1", SchedulerConstants.DefaultGroup)).Return(null);
Expect.Call(scheduler.GetTrigger("myTrigger0", SchedulerConstants.DefaultGroup)).Return(null);
Expect.Call(scheduler.GetTrigger("myTrigger1", SchedulerConstants.DefaultGroup)).Return(null);
scheduler.Stub(x => x.Context).Return(new SchedulerContext());
scheduler.AddJob(jobDetail0, true);
LastCall.IgnoreArguments();
Expect.Call(scheduler.ScheduleJob(trigger0)).Return(DateTime.UtcNow);
scheduler.AddJob(jobDetail1, true);
LastCall.IgnoreArguments();
Expect.Call(scheduler.ScheduleJob(trigger1)).Return(DateTime.UtcNow);
scheduler.Start();
LastCall.IgnoreArguments();
scheduler.Shutdown(false);
LastCall.IgnoreArguments();
mockery.ReplayAll();
SchedulerFactoryObject schedulerFactoryObject = new TestSchedulerFactoryObject(scheduler);
schedulerFactoryObject.JobFactory = (null);
IDictionary schedulerContext = new Hashtable();
@@ -165,7 +144,14 @@ namespace Spring.Scheduling.Quartz
schedulerFactoryObject.Dispose();
}
mockery.VerifyAll();
scheduler.AssertWasCalled(x => x.ScheduleJob(trigger0));
scheduler.AssertWasCalled(x => x.ScheduleJob(trigger1));
scheduler.AssertWasCalled(x => x.AddJob(jobDetail0, true));
scheduler.AssertWasCalled(x => x.AddJob(jobDetail1, true));
scheduler.AssertWasCalled(x => x.Start());
scheduler.AssertWasCalled(x => x.Shutdown(false));
}
/// <summary>
@@ -219,28 +205,21 @@ namespace Spring.Scheduling.Quartz
trigger1.RepeatInterval = TimeSpan.FromMilliseconds(20);
trigger1.AfterPropertiesSet();
IScheduler scheduler = (IScheduler) mockery.CreateMock(typeof (IScheduler));
Expect.Call(scheduler.Context).Return(new SchedulerContext());
Expect.Call(scheduler.GetTrigger("myTrigger0", SchedulerConstants.DefaultGroup)).Return(null);
Expect.Call(scheduler.GetTrigger("myTrigger1", SchedulerConstants.DefaultGroup)).Return(new SimpleTrigger());
IScheduler scheduler = MockRepository.GenerateMock<IScheduler>();
scheduler.Stub(x => x.Context).Return(new SchedulerContext());
#if QUARTZ_2_0
scheduler.Stub(x => x.GetTrigger(new TriggerKey("myTrigger1", SchedulerConstants.DefaultGroup))).Return(new SimpleTrigger());
#else
scheduler.Stub(x => x.GetTrigger("myTrigger1", SchedulerConstants.DefaultGroup)).Return(new SimpleTrigger());
#endif
if (overwrite)
{
scheduler.AddJob(jobDetail1, true);
LastCall.IgnoreArguments();
Expect.Call(scheduler.RescheduleJob("myTrigger1", SchedulerConstants.DefaultGroup, trigger1)).Return(
DateTime.UtcNow);
#if QUARTZ_2_0
scheduler.Stub(x => x.RescheduleJob(new TriggerKey("myTrigger1", SchedulerConstants.DefaultGroup), trigger1)).Return(DateTime.UtcNow);
#else
scheduler.Stub(x => x.RescheduleJob("myTrigger1", SchedulerConstants.DefaultGroup, trigger1)).Return(DateTime.UtcNow);
#endif
}
else
{
Expect.Call(scheduler.GetJobDetail("myJob0", SchedulerConstants.DefaultGroup)).Return(null);
}
scheduler.AddJob(jobDetail0, true);
LastCall.IgnoreArguments();
Expect.Call(scheduler.ScheduleJob(trigger0)).Return(DateTime.UtcNow);
scheduler.Start();
scheduler.Shutdown(false);
mockery.ReplayAll();
SchedulerFactoryObject schedulerFactoryObject = new TestSchedulerFactoryObject(scheduler);
schedulerFactoryObject.JobFactory = (null);
@@ -262,7 +241,10 @@ namespace Spring.Scheduling.Quartz
schedulerFactoryObject.Dispose();
}
mockery.VerifyAll();
scheduler.AssertWasCalled(x => x.AddJob(jobDetail0, true));
scheduler.AssertWasCalled(x => x.ScheduleJob(trigger0));
scheduler.AssertWasCalled(x => x.Start());
scheduler.AssertWasCalled(x => x.Shutdown(false));
}
/// <summary>
@@ -316,37 +298,37 @@ namespace Spring.Scheduling.Quartz
trigger1.RepeatInterval = TimeSpan.FromMilliseconds(20);
trigger1.AfterPropertiesSet();
IScheduler scheduler = (IScheduler) mockery.CreateMock(typeof (IScheduler));
Expect.Call(scheduler.Context).Return(new SchedulerContext());
Expect.Call(scheduler.GetTrigger("myTrigger0", SchedulerConstants.DefaultGroup)).Return(null);
Expect.Call(scheduler.GetTrigger("myTrigger1", SchedulerConstants.DefaultGroup)).Return(new SimpleTrigger());
IScheduler scheduler = MockRepository.GenerateMock<IScheduler>();
scheduler.Stub(x => x.Context).Return(new SchedulerContext());
#if QUARTZ_2_0
scheduler.Stub(x => x.GetTrigger(new TriggerKey("myTrigger1", SchedulerConstants.DefaultGroup))).Return(new SimpleTrigger());
#else
scheduler.Stub(x => x.GetTrigger("myTrigger1", SchedulerConstants.DefaultGroup)).Return(new SimpleTrigger());
#endif
if (overwrite)
{
scheduler.AddJob(jobDetail1, true);
LastCall.IgnoreArguments();
Expect.Call(scheduler.RescheduleJob("myTrigger1", SchedulerConstants.DefaultGroup, trigger1)).Return(
DateTime.UtcNow);
}
else
{
Expect.Call(scheduler.GetJobDetail("myJob0", SchedulerConstants.DefaultGroup)).Return(null);
#if QUARTZ_2_0
scheduler.Stub(x => x.RescheduleJob(new TriggerKey("myTrigger1", SchedulerConstants.DefaultGroup), trigger1)).Return(DateTime.UtcNow);
#else
scheduler.Stub(x => x.RescheduleJob("myTrigger1", SchedulerConstants.DefaultGroup, trigger1)).Return(DateTime.UtcNow);
#endif
}
scheduler.AddJob(jobDetail0, true);
LastCall.IgnoreArguments();
scheduler.Stub(x => x.ScheduleJob(trigger0)).Throw(new ObjectAlreadyExistsException(""));
Expect.Call(scheduler.ScheduleJob(trigger0)).Throw(new ObjectAlreadyExistsException(""));
if (overwrite)
{
Expect.Call(scheduler.RescheduleJob("myTrigger0", SchedulerConstants.DefaultGroup, trigger0)).Return(
DateTime.UtcNow);
#if QUARTZ_2_0
scheduler.Stub(x => x.RescheduleJob(new TriggerKey("myTrigger0", SchedulerConstants.DefaultGroup), trigger0)).Return(DateTime.UtcNow);
#else
scheduler.Stub(x => x.RescheduleJob("myTrigger0", SchedulerConstants.DefaultGroup, trigger0)).Return(DateTime.UtcNow);
#endif
}
scheduler.Start();
scheduler.Shutdown(false);
mockery.ReplayAll();
SchedulerFactoryObject schedulerFactoryObject = new TestSchedulerFactoryObject(scheduler);
schedulerFactoryObject.JobFactory = (null);
@@ -368,9 +350,11 @@ namespace Spring.Scheduling.Quartz
schedulerFactoryObject.Dispose();
}
mockery.VerifyAll();
scheduler.AssertWasCalled(x => x.AddJob(jobDetail0, true));
}
#if !QUARTZ_2_0
/// <summary>
/// </summary>
[Test]
@@ -378,7 +362,7 @@ namespace Spring.Scheduling.Quartz
{
IJobFactory jobFactory = new AdaptableJobFactory();
IScheduler scheduler = (IScheduler) mockery.CreateMock(typeof (IScheduler));
IScheduler scheduler = MockRepository.GenerateMock<IScheduler>();
ISchedulerListener schedulerListener = new TestSchedulerListener();
IJobListener globalJobListener = new TestJobListener();
@@ -395,8 +379,6 @@ namespace Spring.Scheduling.Quartz
scheduler.Start();
scheduler.Shutdown(false);
mockery.ReplayAll();
SchedulerFactoryObject schedulerFactoryObject = new TestSchedulerFactoryObject(scheduler);
schedulerFactoryObject.JobFactory = (jobFactory);
@@ -414,10 +396,9 @@ namespace Spring.Scheduling.Quartz
{
schedulerFactoryObject.Dispose();
}
mockery.VerifyAll();
}
#endif
/*public void TestMethodInvocationWithConcurrency() {
methodInvokingConcurrency(true);
}*/
@@ -549,23 +530,8 @@ namespace Spring.Scheduling.Quartz
trigger1.RepeatCount = (SimpleTrigger.RepeatIndefinitely);
trigger1.RepeatInterval = TimeSpan.FromMilliseconds(20);
IScheduler scheduler = (IScheduler) mockery.CreateMock(typeof (IScheduler));
Expect.Call(scheduler.JobFactory = (jobFactory));
Expect.Call(scheduler.GetJobDetail("myJob0", SchedulerConstants.DefaultGroup)).Return(null);
Expect.Call(scheduler.GetJobDetail("myJob1", SchedulerConstants.DefaultGroup)).Return(null);
Expect.Call(scheduler.GetTrigger("myTrigger0", SchedulerConstants.DefaultGroup)).Return(null);
Expect.Call(scheduler.GetTrigger("myTrigger1", SchedulerConstants.DefaultGroup)).Return(null);
scheduler.AddJob(jobDetail0, true);
LastCall.IgnoreArguments();
scheduler.AddJob(jobDetail1, true);
LastCall.IgnoreArguments();
Expect.Call(scheduler.ScheduleJob(trigger0)).Return(DateTime.UtcNow);
Expect.Call(scheduler.ScheduleJob(trigger1)).Return(DateTime.UtcNow);
scheduler.Start();
scheduler.Shutdown(false);
mockery.ReplayAll();
IScheduler scheduler = MockRepository.GenerateMock<IScheduler>();
SchedulerFactoryObject schedulerFactoryObject = new TestSchedulerFactoryObject(scheduler);
schedulerFactoryObject.JobFactory = (jobFactory);
@@ -581,7 +547,20 @@ namespace Spring.Scheduling.Quartz
schedulerFactoryObject.Dispose();
}
mockery.VerifyAll();
scheduler.AssertWasCalled(x => x.JobFactory = jobFactory);
scheduler.AssertWasCalled(x => x.AddJob(jobDetail0, true));
scheduler.AssertWasCalled(x => x.AddJob(jobDetail1, true));
#if QUARTZ_2_0
scheduler.AssertWasCalled(x => x.GetJobDetail(new JobKey("myJob0", SchedulerConstants.DefaultGroup)));
scheduler.AssertWasCalled(x => x.GetJobDetail(new JobKey("myJob1", SchedulerConstants.DefaultGroup)));
scheduler.AssertWasCalled(x => x.GetTrigger(new TriggerKey("myTrigger0", SchedulerConstants.DefaultGroup)));
scheduler.AssertWasCalled(x => x.GetTrigger(new TriggerKey("myTrigger1", SchedulerConstants.DefaultGroup)));
#else
scheduler.AssertWasCalled(x => x.GetJobDetail("myJob0", SchedulerConstants.DefaultGroup));
scheduler.AssertWasCalled(x => x.GetJobDetail("myJob1", SchedulerConstants.DefaultGroup));
scheduler.AssertWasCalled(x => x.GetTrigger("myTrigger0", SchedulerConstants.DefaultGroup));
scheduler.AssertWasCalled(x => x.GetTrigger("myTrigger1", SchedulerConstants.DefaultGroup));
#endif
}
/// <summary>
@@ -592,13 +571,9 @@ namespace Spring.Scheduling.Quartz
TestObject tb = new TestObject("tb", 99);
StaticApplicationContext ac = new StaticApplicationContext();
IScheduler scheduler = (IScheduler) mockery.CreateMock(typeof (IScheduler));
IScheduler scheduler = MockRepository.GenerateMock<IScheduler>();
SchedulerContext schedulerContext = new SchedulerContext();
Expect.Call(scheduler.Context).Return(schedulerContext).Repeat.Times(4);
scheduler.Start();
scheduler.Shutdown(false);
mockery.ReplayAll();
scheduler.Stub(x => x.Context).Return(schedulerContext).Repeat.Times(4);
SchedulerFactoryObject schedulerFactoryObject = new TestSchedulerFactoryObject(scheduler);
schedulerFactoryObject.JobFactory = (null);
@@ -619,8 +594,6 @@ namespace Spring.Scheduling.Quartz
{
schedulerFactoryObject.Dispose();
}
mockery.VerifyAll();
}
/// <summary>
@@ -645,6 +618,7 @@ namespace Spring.Scheduling.Quartz
Assert.AreEqual(ac, jobDetail.JobDataMap.Get("appCtx"));
}
#if !QUARTZ_2_0
/// <summary>
/// </summary>
[Test]
@@ -699,7 +673,7 @@ namespace Spring.Scheduling.Quartz
ArrayList result = new ArrayList(trigger.TriggerListenerNames);
Assert.AreEqual(names, result);
}
#endif
/// <summary>
/// </summary>
[Test]
@@ -744,23 +718,23 @@ namespace Spring.Scheduling.Quartz
JobDetail jobDetail = new JobDetailObject();
jobDetail.JobType = typeof (DummyRunnable);
jobDetail.Name = ("myJob");
jobDetail.Name = "myJob";
SimpleTriggerObject trigger = new SimpleTriggerObject();
trigger.Name = ("myTrigger");
trigger.JobDetail = (jobDetail);
trigger.Name = "myTrigger";
trigger.JobDetail = jobDetail;
trigger.StartDelay = TimeSpan.FromMilliseconds(1);
trigger.RepeatInterval = TimeSpan.FromMilliseconds(500);
trigger.RepeatCount = (1);
trigger.RepeatCount = 1;
trigger.AfterPropertiesSet();
SchedulerFactoryObject factoryObject = new SchedulerFactoryObject();
factoryObject.Triggers = (new Trigger[] {trigger});
factoryObject.JobDetails = (new JobDetail[] {jobDetail});
factoryObject.Triggers = new Trigger[] {trigger};
factoryObject.JobDetails = new JobDetail[] {jobDetail};
factoryObject.AfterPropertiesSet();
factoryObject.Start();
Thread.Sleep(500);
DummyRunnable.runEvent.WaitOne(500);
Assert.IsTrue(DummyRunnable.count > 0);
factoryObject.Dispose();
@@ -901,7 +875,7 @@ namespace Spring.Scheduling.Quartz
factoryObject.AfterPropertiesSet();
factoryObject.Start();
Thread.Sleep(500);
DummyRunnable.runEvent.WaitOne(500);
Assert.AreEqual(10, DummyRunnable.param);
Assert.IsTrue(DummyRunnable.count > 0);
@@ -953,8 +927,8 @@ namespace Spring.Scheduling.Quartz
DummyJob.count = 0;
SchedulerFactoryObject factoryObject = new SchedulerFactoryObject();
factoryObject.JobFactory = (new SpringObjectJobFactory());
factoryObject.JobSchedulingDataLocation = ("job-scheduling-data.xml");
factoryObject.JobFactory = new SpringObjectJobFactory();
factoryObject.JobSchedulingDataLocation = "job-scheduling-data.xml";
// TODO bean.ResourceLoader = (new FileSystemResourceLoader());
factoryObject.AfterPropertiesSet();
factoryObject.Start();
@@ -1091,6 +1065,87 @@ namespace Spring.Scheduling.Quartz
}
#if QUARTZ_2_0
private class TestSchedulerListener : ISchedulerListener
{
public void JobScheduled(ITrigger trigger)
{
}
public void JobUnscheduled(TriggerKey triggerKey)
{
}
public void TriggerFinalized(ITrigger trigger)
{
}
public void TriggerPaused(TriggerKey triggerKey)
{
}
public void TriggersPaused(string triggerGroup)
{
}
public void TriggerResumed(TriggerKey triggerKey)
{
}
public void TriggersResumed(string triggerGroup)
{
}
public void JobAdded(IJobDetail jobDetail)
{
}
public void JobDeleted(JobKey jobKey)
{
}
public void JobPaused(JobKey jobKey)
{
}
public void JobsPaused(string jobGroup)
{
}
public void JobResumed(JobKey jobKey)
{
}
public void JobsResumed(string jobGroup)
{
}
public void SchedulerError(string msg, SchedulerException cause)
{
}
public void SchedulerInStandbyMode()
{
}
public void SchedulerStarted()
{
}
public void SchedulerShutdown()
{
}
public void SchedulerShuttingdown()
{
}
public void SchedulingDataCleared()
{
}
}
#else
private class TestSchedulerListener : ISchedulerListener
{
public void JobScheduled(Trigger trigger)
@@ -1129,7 +1184,7 @@ namespace Spring.Scheduling.Quartz
{
}
}
#endif
private class TestJobListener : IJobListener
{
@@ -1236,19 +1291,7 @@ namespace Spring.Scheduling.Quartz
{
internal static int param;
internal static int count;
/// <summary>
/// Sets param value.
/// </summary>
/// <param name="value"></param>
public void SetParam(int value)
{
if (param > 0)
{
throw new NotSupportedException("Param already set");
}
param = value;
}
internal static readonly ManualResetEvent runEvent = new ManualResetEvent(false);
/// <summary>
/// Runs thread runnable.
@@ -1256,6 +1299,7 @@ namespace Spring.Scheduling.Quartz
public void Run()
{
count++;
runEvent.Set();
}
}
}

View File

@@ -16,21 +16,27 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Reflection;
using System.Text;
using System.Threading;
using NUnit.Framework;
using Quartz;
using Quartz.Impl;
using Quartz.Spi;
using Rhino.Mocks;
using Spring.Core.IO;
#if QUARTZ_2_0
using Trigger = Quartz.ITrigger;
using JobExecutionContext = Quartz.IJobExecutionContext;
using JobDetail = Quartz.IJobDetail;
using SimpleTrigger = Quartz.Impl.Triggers.SimpleTriggerImpl;
#endif
namespace Spring.Scheduling.Quartz
{
/// <summary>
@@ -42,7 +48,6 @@ namespace Spring.Scheduling.Quartz
{
private static readonly MethodInfo m_InitSchedulerFactory = typeof(SchedulerFactoryObject).GetMethod("InitSchedulerFactory",
BindingFlags.Instance | BindingFlags.NonPublic);
private MockRepository mockery;
private SchedulerFactoryObject factory;
/// <summary>
@@ -52,12 +57,9 @@ namespace Spring.Scheduling.Quartz
public void SetUp()
{
factory = new SchedulerFactoryObject();
TestSchedulerFactory.Mockery.BackToRecordAll();
Expect
.Call(TestSchedulerFactory.MockScheduler.SchedulerName)
.Return("scheduler")
.Repeat.Any();
TestSchedulerFactory.Initialize();
TestSchedulerFactory.MockScheduler.Stub(x => x.SchedulerName).Return("scheduler").Repeat.Any();
}
/// <summary>
@@ -67,7 +69,6 @@ namespace Spring.Scheduling.Quartz
public void TestAfterPropertiesSet_Defaults()
{
factory.AfterPropertiesSet();
TestSchedulerFactory.Mockery.ReplayAll();
}
/// <summary>
@@ -78,7 +79,6 @@ namespace Spring.Scheduling.Quartz
{
factory.JobFactory = null;
factory.AfterPropertiesSet();
TestSchedulerFactory.Mockery.ReplayAll();
}
/// <summary>
@@ -89,67 +89,63 @@ namespace Spring.Scheduling.Quartz
{
// set expectations
TestSchedulerFactory.MockScheduler.JobFactory = null;
LastCall.IgnoreArguments();
TestSchedulerFactory.Mockery.ReplayAll();
factory.SchedulerFactoryType = typeof(TestSchedulerFactory);
factory.AutoStartup = false;
factory.AfterPropertiesSet();
TestSchedulerFactory.MockScheduler.AssertWasCalled(x => x.JobFactory = null);
}
#if !QUARTZ_2_0
/// <summary>
/// Tests AfterPropertiesSet behavior.
/// </summary>
[Test]
public void TestAfterPropertiesSet_AddListeners()
{
mockery = new MockRepository();
InitForAfterPropertiesSetTest();
factory.SchedulerListeners = new ISchedulerListener[] { (ISchedulerListener)mockery.CreateMock(typeof(ISchedulerListener)) };
factory.SchedulerListeners = new ISchedulerListener[] { MockRepository.GenerateMock<ISchedulerListener>() };
TestSchedulerFactory.MockScheduler.AddSchedulerListener(null);
LastCall.IgnoreArguments();
factory.GlobalJobListeners = new IJobListener[] { (IJobListener)mockery.CreateMock(typeof(IJobListener)) };
factory.GlobalJobListeners = new IJobListener[] { MockRepository.GenerateMock<IJobListener>() };
TestSchedulerFactory.MockScheduler.AddGlobalJobListener(null);
LastCall.IgnoreArguments();
factory.JobListeners = new IJobListener[] { (IJobListener)mockery.CreateMock(typeof(IJobListener)) };
factory.JobListeners = new IJobListener[] { MockRepository.GenerateMock<IJobListener>() };
TestSchedulerFactory.MockScheduler.AddJobListener(null);
LastCall.IgnoreArguments();
factory.GlobalTriggerListeners = new ITriggerListener[] { (ITriggerListener)mockery.CreateMock(typeof(ITriggerListener)) };
factory.GlobalTriggerListeners = new ITriggerListener[] { MockRepository.GenerateMock<ITriggerListener>() };
TestSchedulerFactory.MockScheduler.AddGlobalTriggerListener(null);
LastCall.IgnoreArguments();
factory.TriggerListeners = new ITriggerListener[] { (ITriggerListener)mockery.CreateMock(typeof(ITriggerListener)) };
factory.TriggerListeners = new ITriggerListener[] { MockRepository.GenerateMock<ITriggerListener>() };
TestSchedulerFactory.MockScheduler.AddTriggerListener(null);
LastCall.IgnoreArguments();
TestSchedulerFactory.Mockery.ReplayAll();
mockery.ReplayAll();
factory.AfterPropertiesSet();
}
#endif
/// <summary>
/// Tests AfterPropertiesSet behavior.
/// </summary>
[Test]
public void TestAfterPropertiesSet_Calendars()
{
mockery = new MockRepository();
InitForAfterPropertiesSetTest();
const string calendarName = "calendar";
ICalendar cal = (ICalendar) mockery.CreateMock(typeof (ICalendar));
ICalendar cal = MockRepository.GenerateMock<ICalendar>();
Hashtable calTable = new Hashtable();
calTable[calendarName] = cal;
factory.Calendars = calTable;
TestSchedulerFactory.MockScheduler.AddCalendar(calendarName, cal, true, true);
TestSchedulerFactory.Mockery.ReplayAll();
mockery.ReplayAll();
factory.AfterPropertiesSet();
TestSchedulerFactory.MockScheduler.AssertWasCalled(x => x.AddCalendar(calendarName, cal, true, true));
}
/// <summary>
@@ -158,7 +154,6 @@ namespace Spring.Scheduling.Quartz
[Test]
public void TestAfterPropertiesSet_Trigger_TriggerExists()
{
mockery = new MockRepository();
InitForAfterPropertiesSetTest();
const string TRIGGER_NAME = "trigName";
@@ -166,10 +161,12 @@ namespace Spring.Scheduling.Quartz
SimpleTrigger trigger = new SimpleTrigger(TRIGGER_NAME, TRIGGER_GROUP);
factory.Triggers = new Trigger[] { trigger };
Expect.Call(TestSchedulerFactory.MockScheduler.GetTrigger(TRIGGER_NAME, TRIGGER_GROUP)).Return(trigger);
#if QUARTZ_2_0
TestSchedulerFactory.MockScheduler.Stub(x => x.GetTrigger(new TriggerKey(TRIGGER_NAME, TRIGGER_GROUP))).Return(trigger);
#else
TestSchedulerFactory.MockScheduler.Stub(x => x.GetTrigger(TRIGGER_NAME, TRIGGER_GROUP)).Return(trigger);
#endif
TestSchedulerFactory.Mockery.ReplayAll();
mockery.ReplayAll();
factory.AfterPropertiesSet();
}
@@ -179,7 +176,6 @@ namespace Spring.Scheduling.Quartz
[Test]
public void TestAfterPropertiesSet_Trigger_TriggerDoesntExist()
{
mockery = new MockRepository();
InitForAfterPropertiesSetTest();
const string TRIGGER_NAME = "trigName";
@@ -187,15 +183,9 @@ namespace Spring.Scheduling.Quartz
SimpleTrigger trigger = new SimpleTrigger(TRIGGER_NAME, TRIGGER_GROUP);
factory.Triggers = new Trigger[] { trigger };
Expect.Call(TestSchedulerFactory.MockScheduler.GetTrigger(TRIGGER_NAME, TRIGGER_GROUP)).Return(null);
TestSchedulerFactory.MockScheduler.ScheduleJob(trigger);
LastCall.IgnoreArguments().Return(DateTime.UtcNow);
TestSchedulerFactory.Mockery.ReplayAll();
mockery.ReplayAll();
factory.AfterPropertiesSet();
TestSchedulerFactory.MockScheduler.AssertWasCalled(x => x.ScheduleJob(trigger));
}
@@ -205,7 +195,6 @@ namespace Spring.Scheduling.Quartz
// set expectations
factory.SchedulerFactoryType = typeof(TestSchedulerFactory);
TestSchedulerFactory.MockScheduler.JobFactory = null;
LastCall.IgnoreArguments();
}
/// <summary>
@@ -214,16 +203,13 @@ namespace Spring.Scheduling.Quartz
[Test]
public void TestStart()
{
// set expectations
TestSchedulerFactory.MockScheduler.JobFactory = null;
LastCall.IgnoreArguments();
TestSchedulerFactory.MockScheduler.Start();
TestSchedulerFactory.Mockery.ReplayAll();
factory.SchedulerFactoryType = typeof(TestSchedulerFactory);
factory.AutoStartup = false;
factory.AfterPropertiesSet();
factory.Start();
TestSchedulerFactory.MockScheduler.AssertWasCalled(x => x.JobFactory = Arg<IJobFactory>.Is.NotNull);
TestSchedulerFactory.MockScheduler.AssertWasCalled(x => x.Start());
}
/// <summary>
@@ -232,16 +218,13 @@ namespace Spring.Scheduling.Quartz
[Test]
public void TestStop()
{
// set expectations
TestSchedulerFactory.MockScheduler.JobFactory = null;
LastCall.IgnoreArguments();
TestSchedulerFactory.MockScheduler.Standby();
TestSchedulerFactory.Mockery.ReplayAll();
factory.SchedulerFactoryType = typeof(TestSchedulerFactory);
factory.AutoStartup = false;
factory.AfterPropertiesSet();
factory.Stop();
TestSchedulerFactory.MockScheduler.AssertWasCalled(x => x.JobFactory = Arg<IJobFactory>.Is.NotNull);
TestSchedulerFactory.MockScheduler.AssertWasCalled(x => x.Standby());
}
/// <summary>
@@ -251,7 +234,6 @@ namespace Spring.Scheduling.Quartz
public void TestGetObject()
{
factory.AfterPropertiesSet();
TestSchedulerFactory.Mockery.ReplayAll();
IScheduler sched = (IScheduler)factory.GetObject();
Assert.IsNotNull(sched, "scheduler was null");
}
@@ -263,7 +245,6 @@ namespace Spring.Scheduling.Quartz
[ExpectedException(typeof(ArgumentException))]
public void TestSchedulerFactoryType_InvalidType()
{
TestSchedulerFactory.Mockery.ReplayAll();
factory.SchedulerFactoryType = typeof(SchedulerFactoryObjectTest);
}
@@ -273,7 +254,6 @@ namespace Spring.Scheduling.Quartz
[Test]
public void TestSchedulerFactoryType_ValidType()
{
TestSchedulerFactory.Mockery.ReplayAll();
factory.SchedulerFactoryType = typeof(StdSchedulerFactory);
}
@@ -283,8 +263,6 @@ namespace Spring.Scheduling.Quartz
[Test]
public void TestInitSchedulerFactory_MinimalDefaults()
{
TestSchedulerFactory.Mockery.ReplayAll();
factory.SchedulerName = "testFactoryObject";
StdSchedulerFactory factoryToPass = new StdSchedulerFactory();
m_InitSchedulerFactory.Invoke(factory, new object[] { factoryToPass });
@@ -315,8 +293,6 @@ ConnectionStringKey+ " = " + ConnectionStringValue + Environment.NewLine +
// intercept call
InterceptingStdSChedulerFactory factoryToPass = new InterceptingStdSChedulerFactory();
TestSchedulerFactory.Mockery.ReplayAll();
factory.ConfigLocation = new TestConfigLocation(ms, "description");
m_InitSchedulerFactory.Invoke(factory, new object[] { factoryToPass });
@@ -324,21 +300,6 @@ ConnectionStringKey+ " = " + ConnectionStringValue + Environment.NewLine +
Assert.AreEqual(ConnectionStringValue, factoryToPass.Properties[ConnectionStringKey]);
}
/// <summary>
/// Cleans this test instance.
/// </summary>
[TearDown]
public void TearDown()
{
TestSchedulerFactory.Mockery.VerifyAll();
if (mockery != null)
{
mockery.VerifyAll();
}
}
}
internal class TestConfigLocation : InputStreamResource
@@ -353,21 +314,7 @@ ConnectionStringKey+ " = " + ConnectionStringValue + Environment.NewLine +
/// </summary>
public class TestSchedulerFactory : ISchedulerFactory
{
private static readonly MockRepository mockery = new MockRepository();
private static readonly IScheduler mockScheduler;
static TestSchedulerFactory()
{
mockScheduler = (IScheduler) mockery.CreateMock(typeof (IScheduler));
}
/// <summary>
/// MockRepository intance.
/// </summary>
public static MockRepository Mockery
{
get { return mockery; }
}
private static IScheduler mockScheduler;
/// <summary>
/// The mocked scheduler.
@@ -394,12 +341,26 @@ ConnectionStringKey+ " = " + ConnectionStringValue + Environment.NewLine +
return mockScheduler;
}
#if QUARTZ_2_0
///<summary>
///</summary>
public ICollection<IScheduler> AllSchedulers
{
get { return new List<IScheduler>(); }
}
#else
///<summary>
///</summary>
public ICollection AllSchedulers
{
get { return new ArrayList(); }
}
#endif
public static void Initialize()
{
mockScheduler = MockRepository.GenerateMock<IScheduler>();
}
}
///<summary>

View File

@@ -16,12 +16,17 @@
using System;
using System.Collections;
using System.Collections.Generic;
using NUnit.Framework;
using Quartz;
using Quartz.Job;
#if QUARTZ_2_0
using JobDetail = Quartz.Impl.JobDetailImpl;
#endif
namespace Spring.Scheduling.Quartz
{
/// <summary>
@@ -113,7 +118,7 @@ namespace Spring.Scheduling.Quartz
[Test]
public void TestJobDataAsMap()
{
Hashtable data = new Hashtable();
IDictionary data = new Dictionary<string, object>();
data["foo"] = "bar";
data["number"] = 123;
simpleTrigger.JobDataAsMap = data;

View File

@@ -15,13 +15,20 @@
*/
using System.Collections;
using System.Collections.Generic;
using NUnit.Framework;
using Quartz;
using Quartz.Job;
using Quartz.Spi;
#if QUARTZ_2_0
using Trigger = Quartz.Spi.IOperableTrigger;
using JobExecutionContext = Quartz.IJobExecutionContext;
using JobDetail = Quartz.IJobDetail;
using SimpleTrigger = Quartz.Impl.Triggers.SimpleTriggerImpl;
#endif
namespace Spring.Scheduling.Quartz
{
/// <summary>
@@ -51,7 +58,11 @@ namespace Spring.Scheduling.Quartz
Trigger trigger = new SimpleTrigger();
TriggerFiredBundle bundle = TestUtil.CreateMinimalFiredBundleWithTypedJobDetail(typeof (NoOpJob), trigger);
#if QUARTZ_2_0
IJob job = factory.NewJob(bundle, null);
#else
IJob job = factory.NewJob(bundle);
#endif
Assert.IsNotNull(job, "Created job was null");
}
@@ -61,14 +72,23 @@ namespace Spring.Scheduling.Quartz
[Test]
public void TestCreateJobInstance_SchedulerContextGiven()
{
Trigger trigger = new SimpleTrigger();
TriggerFiredBundle bundle = TestUtil.CreateMinimalFiredBundleWithTypedJobDetail(typeof(InjectableJob), trigger);
#if QUARTZ_2_0
IDictionary<string, object> items = new Dictionary<string, object>();
items["foo"] = "bar";
items["number"] = 123;
factory.SchedulerContext = new SchedulerContext(items);
InjectableJob job = (InjectableJob)factory.NewJob(bundle, null);
#else
IDictionary items = new Hashtable();
items["foo"] = "bar";
items["number"] = 123;
factory.SchedulerContext = new SchedulerContext(items);
Trigger trigger = new SimpleTrigger();
TriggerFiredBundle bundle = TestUtil.CreateMinimalFiredBundleWithTypedJobDetail(typeof(InjectableJob), trigger);
InjectableJob job = (InjectableJob) factory.NewJob(bundle);
#endif
Assert.IsNotNull(job, "Created job was null");
Assert.AreEqual("bar", job.Foo, "string injection failed");
Assert.AreEqual(123, job.Number, "integer injection failed");
@@ -86,7 +106,11 @@ namespace Spring.Scheduling.Quartz
trigger.JobDataMap["number"] = 123;
TriggerFiredBundle bundle = TestUtil.CreateMinimalFiredBundleWithTypedJobDetail(typeof(InjectableJob), trigger);
#if QUARTZ_2_0
InjectableJob job = (InjectableJob)factory.NewJob(bundle, null);
#else
InjectableJob job = (InjectableJob)factory.NewJob(bundle);
#endif
Assert.IsNotNull(job, "Created job was null");
Assert.AreEqual(123, job.Number, "integer injection failed");
Assert.IsNull(job.Foo, "foo was injected when it was not supposed to ");

View File

@@ -19,6 +19,11 @@ using System;
using Quartz;
using Quartz.Spi;
#if QUARTZ_2_0
using JobDetail = Quartz.Impl.JobDetailImpl;
using Trigger = Quartz.Spi.IOperableTrigger;
#endif
namespace Spring.Scheduling.Quartz
{
/// <summary>

View File

@@ -22,6 +22,10 @@ using Quartz;
using Spring.Objects.Factory;
#if QUARTZ_2_0
using Trigger = Quartz.Spi.IOperableTrigger;
#endif
namespace Spring.Scheduling.Quartz
{
/// <summary>
@@ -31,6 +35,7 @@ namespace Spring.Scheduling.Quartz
public abstract class TriggerObjectTest
{
private Trigger trigger;
/// <summary>
/// Constant name for tested triggers.
/// </summary>
@@ -52,11 +57,17 @@ namespace Spring.Scheduling.Quartz
{
((IInitializingObject) trigger).AfterPropertiesSet();
#if QUARTZ_2_0
Assert.AreEqual(TRIGGER_NAME, trigger.Key.Name, "trigger name mismatch");
Assert.AreEqual(SchedulerConstants.DefaultGroup, trigger.Key.Group, "trigger group name mismatch");
Assert.IsNull(trigger.JobKey, "trigger job name not null");
#else
Assert.AreEqual(TRIGGER_NAME, trigger.Name, "trigger name mismatch");
Assert.AreEqual(SchedulerConstants.DefaultGroup, trigger.Group, "trigger group name mismatch");
AssertDateTimesEqualityWithAllowedDelta(DateTime.UtcNow, trigger.StartTimeUtc, 1000);
Assert.IsNull(trigger.JobName, "trigger job name not null");
Assert.AreEqual(SchedulerConstants.DefaultGroup, trigger.JobGroup, "trigger job group was not default");
#endif
AssertDateTimesEqualityWithAllowedDelta(DateTime.UtcNow, trigger.StartTimeUtc, 1000);
}
/// <summary>
@@ -69,12 +80,18 @@ namespace Spring.Scheduling.Quartz
const string NAME = "newName";
const string GROUP = "newGroup";
DateTime START_TIME = new DateTime(10000000);
DateTime START_TIME = new DateTime(1982, 6, 28, 13, 10, 0);
trigger.StartTimeUtc = START_TIME;
#if QUARTZ_2_0
trigger.Key = new TriggerKey(NAME, GROUP);
Assert.AreEqual(NAME, trigger.Key.Name, "trigger name mismatch");
Assert.AreEqual(GROUP, trigger.Key.Group, "trigger group name mismatch");
#else
trigger.Name = NAME;
trigger.Group = GROUP;
trigger.StartTimeUtc = START_TIME;
Assert.AreEqual(NAME, trigger.Name, "trigger name mismatch");
Assert.AreEqual(GROUP, trigger.Group, "trigger group name mismatch");
#endif
AssertDateTimesEqualityWithAllowedDelta(START_TIME, trigger.StartTimeUtc, 1000);
}
@@ -88,10 +105,42 @@ namespace Spring.Scheduling.Quartz
const string jobName = "jobName";
const string jobGroup = "jobGroup";
#if QUARTZ_2_0
Assert.AreEqual(jobName, trigger.JobKey.Name, "trigger job name was not from job detail");
Assert.AreEqual(jobGroup, trigger.JobKey.Group, "trigger job group was not from job detail");
#else
Assert.AreEqual(jobName, trigger.JobName, "trigger job name was not from job detail");
Assert.AreEqual(jobGroup, trigger.JobGroup, "trigger job group was not from job detail");
#endif
}
#if QUARTZ_2_0
/// <summary>
/// Tests whether two datetimes are close enough.
/// </summary>
/// <param name="d1"></param>
/// <param name="d2"></param>
/// <param name="allowedDeltaInMilliseconds"></param>
protected static void AssertDateTimesEqualityWithAllowedDelta(DateTimeOffset d1, DateTimeOffset d2, int allowedDeltaInMilliseconds)
{
int diffInMillis = (int) Math.Abs((d1 - d2).TotalMilliseconds);
Assert.LessOrEqual(diffInMillis, allowedDeltaInMilliseconds, "too much difference in times");
}
#else
/// <summary>
/// Tests whether two datetimes are close enough.
/// </summary>
/// <param name="d1"></param>
/// <param name="d2"></param>
/// <param name="allowedDeltaInMilliseconds"></param>
protected static void AssertDateTimesEqualityWithAllowedDelta(DateTime d1, DateTime d2, int allowedDeltaInMilliseconds)
{
int diffInMillis = (int)Math.Abs((d1 - d2).TotalMilliseconds);
Assert.LessOrEqual(diffInMillis, allowedDeltaInMilliseconds, "too much difference in times");
}
/// <summary>
/// Tests that TriggerObject defaults values as expected in AfterPropertiesSet.
/// </summary>
@@ -104,18 +153,7 @@ namespace Spring.Scheduling.Quartz
trigger.TriggerListenerNames = LISTENER_NAMES;
CollectionAssert.AreEqual(LISTENER_NAMES, trigger.TriggerListenerNames, "Trigger listeners were not equal");
}
/// <summary>
/// Tests whether two datetimes are close enough.
/// </summary>
/// <param name="d1"></param>
/// <param name="d2"></param>
/// <param name="allowedDeltaInMilliseconds"></param>
protected static void AssertDateTimesEqualityWithAllowedDelta(DateTime d1, DateTime d2, int allowedDeltaInMilliseconds)
{
int diffInMillis = (int) Math.Abs((d1 - d2).TotalMilliseconds);
Assert.LessOrEqual(diffInMillis, allowedDeltaInMilliseconds, "too much difference in times");
}
#endif
}
}

View File

@@ -36,15 +36,19 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\net\2.0\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="Quartz, Version=0.7.0.15571, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Quartz, Version=1.0.3.2, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\net\2.0\Quartz.dll</HintPath>
<HintPath>..\..\..\lib\Quartz10\net\2.0\Quartz.dll</HintPath>
</Reference>
<Reference Include="Rhino.Mocks, Version=2.9.6.40380, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\Net\2.0\Rhino.Mocks.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll</HintPath>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>

View File

@@ -42,8 +42,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\net\2.0\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="Quartz">
<HintPath>..\..\..\lib\Net\3.5\Quartz.dll</HintPath>
<Reference Include="Quartz, Version=1.0.3.3, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\Quartz10\net\3.5\Quartz.dll</HintPath>
</Reference>
<Reference Include="Rhino.Mocks, Version=2.9.6.40380, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>

View File

@@ -0,0 +1,51 @@
#region License
/*
* Copyright <20> 2002-2007 the original author or authors.
*
* Licensed 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.
*/
#endregion
#region Imports
using System.Threading;
using NUnit.Framework;
using Spring.Context;
using Spring.Context.Support;
#endregion
namespace Spring.Scheduling.Quartz.Integration.Tests
{
[TestFixture]
public class LocalDataSourceJobStoreTest
{
private IApplicationContext ctx;
[SetUp]
public void SetUp()
{
ctx = new XmlApplicationContext("assembly://Spring.Scheduling.Quartz20.Integration.Tests/Spring.Scheduling.Quartz/LocalDataSourceJobStoreTest.xml");
}
[Test]
public void TestLocalDataSourceJobStore()
{
// sleep 20 seconds
Thread.Sleep(20000);
}
}
}

View File

@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net"
xmlns:aop="http://www.springframework.net/aop"
xmlns:db="http://www.springframework.net/database"
xmlns:tx="http://www.springframework.net/tx">
<!-- Property placeholder configurer for database settings -->
<object type="Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer, Spring.Core">
<property name="ConfigSections" value="appSettings"/>
</object>
<!-- DB -->
<db:provider id="dbProvider" provider="SqlServer-2.0" connectionString="${ConnectionString}"/>
<object id="transactionManager" type="Spring.Data.Core.TxScopeTransactionManager, Spring.Data">
</object>
<!-- And actual Quartz -->
<object id="quartzSchedulerFactory" type="Spring.Scheduling.Quartz.SchedulerFactoryObject, Spring.Scheduling.Quartz20">
<property name="AutoStartup" value="true" />
<property name="StartupDelay" value="5s" />
<property name="QuartzProperties">
<dictionary>
<entry key="quartz.threadPool.threadCount" value="10"/>
<entry key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz"/>
<entry key="quartz.threadPool.threadPriority" value="Normal"/>
<entry key="quartz.jobStore.misfireThreshold" value="60000"/>
<entry key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.StdAdoDelegate, Quartz"/>
<entry key="quartz.jobStore.useProperties" value="false"/>
<entry key="quartz.jobStore.tablePrefix" value="QRTZ_"/>
<entry key="quartz.jobStore.lockHandler.type" value="Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz"/>
</dictionary>
</property>
<property name="triggers">
<list>
<ref object="simpleTrigger" />
</list>
</property>
<property name="DbProvider" ref="dbProvider" />
<property name="TransactionManager" ref="transactionManager" />
</object>
<object id="testJob" type="Spring.Scheduling.Quartz.JobDetailObject, Spring.Scheduling.Quartz20">
<property name="JobType" value="Spring.Scheduling.Quartz.Integration.Tests.TestJob, Spring.Scheduling.Quartz20.Integration.Tests" />
</object>
<object id="simpleTrigger" type="Spring.Scheduling.Quartz.SimpleTriggerObject, Spring.Scheduling.Quartz20">
<!-- see the example of method invoking job above -->
<property name="jobDetail" ref="testJob" />
<!-- 2 seconds -->
<property name="startDelay" value="2s" />
<!-- repeat every 3 seconds -->
<property name="repeatInterval" value="3s" />
</object>
</objects>

View File

@@ -0,0 +1,20 @@
using System;
using Quartz;
namespace Spring.Scheduling.Quartz.Integration.Tests
{
public class TestJob : IJob
{
public void Execute(IJobExecutionContext context)
{
Console.WriteLine("Executing Execute!");
}
public void DoIt()
{
Console.WriteLine("Executing DoIt!");
}
}
}

View File

@@ -0,0 +1,81 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{8CF0F34A-CC93-4D87-AE14-A2DEEF072F26}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Spring</RootNamespace>
<AssemblyName>Spring.Scheduling.Quartz20.Integration.Tests</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\build\VS.NET.2008\Spring.Scheduling.Quartz20.Integration.Tests\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;NET_2_0;NET_3_5</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\build\VS.NET.2008\Spring.Scheduling.Quartz20.Integration.Tests\Release\</OutputPath>
<DefineConstants>TRACE;NET_2_0;NET_3_5</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="C5, Version=1.1.0.0, Culture=neutral, PublicKeyToken=06a1b38866503b69, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\Quartz20\net\3.5\C5.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=2.2.7.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\net\2.0\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="Quartz, Version=2.0.0.100, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\Quartz20\net\3.5\Quartz.dll</HintPath>
</Reference>
<Reference Include="Rhino.Mocks, Version=2.9.6.40380, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\Net\2.0\Rhino.Mocks.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<None Include="Spring.Scheduling.Quartz20.Integration.Tests.dll.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Compile Include="Scheduling\Quartz\LocalDataSourceJobStoreTest.cs" />
<Compile Include="Scheduling\Quartz\TestJob.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Scheduling\Quartz\LocalDataSourceJobStoreTest.xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\src\Spring\Spring.Core\Spring.Core.2008.csproj">
<Project>{710961A3-0DF4-49E4-A26E-F5B9C044AC84}</Project>
<Name>Spring.Core.2008</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,127 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{8CF0F34A-CC93-4D87-AE14-A2DEEF072F26}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Spring</RootNamespace>
<AssemblyName>Spring.Scheduling.Quartz20.Integration.Tests</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\build\VS.NET.2008\Spring.Scheduling.Quartz20.Integration.Tests\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;NET_2_0;NET_3_5,QUARTZ_2_0</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\build\VS.NET.2008\Spring.Scheduling.Quartz20.Integration.Tests\Release\</OutputPath>
<DefineConstants>TRACE;NET_2_0;NET_3_5</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="C5, Version=1.1.0.0, Culture=neutral, PublicKeyToken=06a1b38866503b69, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\Quartz20\net\3.5\C5.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=2.2.7.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\net\2.0\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="Quartz, Version=2.0.0.100, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\Quartz20\net\3.5\Quartz.dll</HintPath>
</Reference>
<Reference Include="Rhino.Mocks, Version=2.9.6.40380, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\Net\2.0\Rhino.Mocks.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<None Include="Spring.Scheduling.Quartz20.Integration.Tests.dll.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Compile Include="Scheduling\Quartz\LocalDataSourceJobStoreTest.cs" />
<Compile Include="Scheduling\Quartz\TestJob.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Scheduling\Quartz\LocalDataSourceJobStoreTest.xml" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\src\Spring\Spring.Core\Spring.Core.2010.csproj">
<Project>{710961A3-0DF4-49E4-A26E-F5B9C044AC84}</Project>
<Name>Spring.Core.2010</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\src\Spring\Spring.Data\Spring.Data.2010.csproj">
<Project>{AE00E5AB-C39A-436F-86D2-33BFE33E2E40}</Project>
<Name>Spring.Data.2010</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\src\Spring\Spring.Scheduling.Quartz20\Spring.Scheduling.Quartz20.2010.csproj">
<Project>{E823D54C-CE82-4868-929F-5F95A999F123}</Project>
<Name>Spring.Scheduling.Quartz20.2010</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,73 @@
<?xml version="1.0" ?>
<project name="Spring.Scheduling.Quartz20.Integration.Tests" default="build" xmlns="http://nant.sf.net/schemas/nant.xsd">
<include buildfile="${spring.basedir}/common-project.include" />
<!--
Required properties:
* current.bin.dir - (path) root level to build to
* build.debug - (true|false) debug build?
* current.build.defines.csc - framework-specific build defines
-->
<target name="build">
<csc target="library" define="${current.build.defines.csc}"
warnaserror="true"
optimize="${build.optimize}"
debug="${current.build.debug}"
output="${current.bin.dir}/${project::get-name()}.dll"
doc="${current.bin.dir}/${project::get-name()}.xml">
<nowarn>
<warning number="${nowarn.numbers.test}" />
</nowarn>
<sources failonempty="true">
<include name="**/*.cs" />
<include name="../CommonAssemblyInfo.cs" />
</sources>
<references basedir="${current.bin.dir}">
<include name="*.dll" />
<exclude name="${project::get-name()}.dll" />
</references>
</csc>
<copy todir="${current.bin.dir}">
<fileset basedir="${project::get-name()}/Data">
<include name="**/*.xml" />
<include name="**/*.test" />
</fileset>
</copy>
<copy todir="${current.bin.dir}">
<fileset basedir="${project::get-name()}">
<include name="**/*.config" />
</fileset>
</copy>
</target>
<target name="test" depends="build">
<!-- property name="test.assemblyname" value="${project::get-name()}" / -->
<call target="common.run-tests" />
</target>
<!--
<target name="test" depends="build">
<nunit2>
<formatter type="Plain" />
<formatter type="Xml" usefile="true" extension=".xml"
outputdir="${current.bin.dir}/results" />
<test assemblyname="${current.bin.dir}/${project::get-name()}.dll"
appconfig="${current.bin.dir}/${project::get-name()}.dll.config" />
</nunit2>
</target>
-->
<!--
<target name="test-mono-1.0" >
<nunit2>
<formatter type="Plain" />
<formatter type="Xml" usefile="true" extension=".xml"
outputdir="${current.bin.dir}/results" />
<test assemblyname="${bin.dir}/net/1.1/${current.build.config}/${project::get-name()}.dll"
appconfig="${bin.dir}/net/1.1/${current.build.config}/${project::get-name()}.dll.config" />
</nunit2>
</target>
-->
</project>

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
</sectionGroup>
<sectionGroup name="spring">
<section name="typeAliases" type="Spring.Context.Support.TypeAliasesSectionHandler, Spring.Core"/>
<section name="parsers" type="Spring.Context.Support.NamespaceParsersSectionHandler, Spring.Core"/>
<section name="context" type="Spring.Context.Support.WebContextHandler, Spring.Web"/>
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core"/>
</sectionGroup>
</configSections>
<common>
<logging>
<factoryAdapter type="Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter, Common.Logging">
<arg key="level" value="DEBUG" />
</factoryAdapter>
</logging>
</common>
<spring>
<parsers>
<parser type="Spring.Data.Config.DatabaseNamespaceParser, Spring.Data"/>
<parser type="Spring.Transaction.Config.TxNamespaceParser, Spring.Data"/>
<parser type="Spring.Aop.Config.AopNamespaceParser, Spring.Aop"/>
</parsers>
</spring>
<appSettings>
<add key="ConnectionString" value="Server=(local);initial catalog=quartz;Integrated Security=true"/>
</appSettings>
</configuration>

View File

@@ -0,0 +1,142 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{47E7DF97-2515-4F2F-BBFD-0A4C205800DE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Spring</RootNamespace>
<AssemblyName>Spring.Scheduling.Quartz20.Tests</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\build\VS.NET.2008\Spring.Scheduling.Quartz20.Tests\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;NET_2_0</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>
</DocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\build\VS.NET.2008\Spring.Scheduling.Quartz20.Tests\Release\</OutputPath>
<DefineConstants>TRACE;NET_2_0</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="C5, Version=1.1.0.0, Culture=neutral, PublicKeyToken=06a1b38866503b69, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\Quartz20\net\3.5\C5.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=2.2.7.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\net\2.0\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="Quartz, Version=2.0.0.100, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\Quartz20\net\3.5\Quartz.dll</HintPath>
</Reference>
<Reference Include="Rhino.Mocks, Version=2.9.6.40380, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\Net\2.0\Rhino.Mocks.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\QuartzCompilerOptionsTests.cs">
<Link>QuartzCompilerOptionsTests.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\AdaptableJobFactoryTest.cs">
<Link>Scheduling\Quartz\AdaptableJobFactoryTest.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\CronTriggerObjectTest.cs">
<Link>Scheduling\Quartz\CronTriggerObjectTest.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\JobDetailObjectTest.cs">
<Link>Scheduling\Quartz\JobDetailObjectTest.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\MethodInvokingJobDetailFactoryObjectTest.cs">
<Link>Scheduling\Quartz\MethodInvokingJobDetailFactoryObjectTest.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\MethodInvokingJobTest.cs">
<Link>Scheduling\Quartz\MethodInvokingJobTest.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\QuartzSupportTests.cs">
<Link>Scheduling\Quartz\QuartzSupportTests.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\QuartzTestObject.cs">
<Link>Scheduling\Quartz\QuartzTestObject.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\SchedulerFactoryObjectTest.cs">
<Link>Scheduling\Quartz\SchedulerFactoryObjectTest.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\SimpleTriggerObjectTest.cs">
<Link>Scheduling\Quartz\SimpleTriggerObjectTest.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\SpringObjectJobFactoryTest.cs">
<Link>Scheduling\Quartz\SpringObjectJobFactoryTest.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\TestMethodInvokingTask.cs">
<Link>Scheduling\Quartz\TestMethodInvokingTask.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\TestUtil.cs">
<Link>Scheduling\Quartz\TestUtil.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\TriggerObjectTest.cs">
<Link>Scheduling\Quartz\TriggerObjectTest.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="job-scheduling-data.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="multipleAnonymousMethodInvokingJobDetailFB.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="multipleSchedulers.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="schedulerAccessorObject.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="schedulerRepositoryExposure.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\src\Spring\Spring.Core\Spring.Core.2008.csproj">
<Project>{710961A3-0DF4-49E4-A26E-F5B9C044AC84}</Project>
<Name>Spring.Core.2008</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\src\Spring\Spring.Scheduling.Quartz20\Spring.Scheduling.Quartz20.2008.csproj">
<Project>{E823D54C-CE82-4868-929F-5F95A999F61E}</Project>
<Name>Spring.Scheduling.Quartz20.2008</Name>
</ProjectReference>
<ProjectReference Include="..\Spring.Core.Tests\Spring.Core.Tests.2008.csproj">
<Project>{44B16BAA-6DF8-447C-9D7F-3AD3D854D904}</Project>
<Name>Spring.Core.Tests.2008</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Spring.Scheduling.Quartz20.Tests.build" />
<None Include="Spring.Scheduling.Quartz20.Tests.dll.config" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,148 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{247787CF-ECE1-4675-8B42-7DF4329A4891}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Spring</RootNamespace>
<AssemblyName>Spring.Scheduling.Quartz20.Tests</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\build\VS.NET.2010\Spring.Scheduling.Quartz20.Tests\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;NET_2_0,QUARTZ_2_0</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>
</DocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\build\VS.NET.2010\Spring.Scheduling.Quartz20.Tests\Release\</OutputPath>
<DefineConstants>TRACE;NET_2_0</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="C5, Version=1.1.0.0, Culture=neutral, PublicKeyToken=06a1b38866503b69, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\Quartz20\net\3.5\C5.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=2.2.7.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\net\2.0\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="Quartz">
<HintPath>..\..\..\lib\Quartz20\net\3.5\Quartz.dll</HintPath>
</Reference>
<Reference Include="Rhino.Mocks, Version=2.9.6.40380, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\Net\2.0\Rhino.Mocks.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\src\Spring\Spring.Core\Spring.Core.2010.csproj">
<Project>{710961A3-0DF4-49E4-A26E-F5B9C044AC84}</Project>
<Name>Spring.Core.2010</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\src\Spring\Spring.Scheduling.Quartz20\Spring.Scheduling.Quartz20.2010.csproj">
<Project>{E823D54C-CE82-4868-929F-5F95A999F123}</Project>
<Name>Spring.Scheduling.Quartz20.2010</Name>
</ProjectReference>
<ProjectReference Include="..\Spring.Core.Tests\Spring.Core.Tests.2010.csproj">
<Project>{44B16BAA-6DF8-447C-9D7F-3AD3D854D904}</Project>
<Name>Spring.Core.Tests.2010</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\QuartzCompilerOptionsTests.cs">
<Link>QuartzCompilerOptionsTests.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\AdaptableJobFactoryTest.cs">
<Link>Scheduling\Quartz\AdaptableJobFactoryTest.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\CronTriggerObjectTest.cs">
<Link>Scheduling\Quartz\CronTriggerObjectTest.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\JobDetailObjectTest.cs">
<Link>Scheduling\Quartz\JobDetailObjectTest.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\MethodInvokingJobDetailFactoryObjectTest.cs">
<Link>Scheduling\Quartz\MethodInvokingJobDetailFactoryObjectTest.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\MethodInvokingJobTest.cs">
<Link>Scheduling\Quartz\MethodInvokingJobTest.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\QuartzSupportTests.cs">
<Link>Scheduling\Quartz\QuartzSupportTests.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\QuartzTestObject.cs">
<Link>Scheduling\Quartz\QuartzTestObject.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\SchedulerFactoryObjectTest.cs">
<Link>Scheduling\Quartz\SchedulerFactoryObjectTest.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\SimpleTriggerObjectTest.cs">
<Link>Scheduling\Quartz\SimpleTriggerObjectTest.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\SpringObjectJobFactoryTest.cs">
<Link>Scheduling\Quartz\SpringObjectJobFactoryTest.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\TestMethodInvokingTask.cs">
<Link>Scheduling\Quartz\TestMethodInvokingTask.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\TestUtil.cs">
<Link>Scheduling\Quartz\TestUtil.cs</Link>
</Compile>
<Compile Include="..\Spring.Scheduling.Quartz.Tests\Scheduling\Quartz\TriggerObjectTest.cs">
<Link>Scheduling\Quartz\TriggerObjectTest.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="job-scheduling-data.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="multipleAnonymousMethodInvokingJobDetailFB.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="multipleSchedulers.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="schedulerAccessorObject.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="schedulerRepositoryExposure.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="Spring.Scheduling.Quartz20.Tests.dll.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,79 @@
<?xml version="1.0" ?>
<project name="Spring.Scheduling.Quartz.Tests" default="build" xmlns="http://nant.sf.net/schemas/nant.xsd">
<include buildfile="${spring.basedir}/common-project.include" />
<!--
Required properties:
* current.bin.dir - (path) root level to build to
* build.debug - (true|false) debug build?
* current.build.defines.csc - framework-specific build defines
-->
<target name="build">
<echo message="${quartz20.lib.dir}" />
<copy todir="${current.bin.dir}" overwrite="true">
<fileset basedir="${quartz20.lib.dir}">
<include name="**/*.dll" />
</fileset>
</copy>
<csc target="library" define="${current.build.defines.csc}"
warnaserror="true"
optimize="${build.optimize}"
debug="${current.build.debug}"
output="${current.bin.dir}/${project::get-name()}.dll"
doc="${current.bin.dir}/${project::get-name()}.xml">
<nowarn>
<warning number="${nowarn.numbers.test}" />
</nowarn>
<sources failonempty="true">
<include name="**/*.cs" />
<include name="../CommonAssemblyInfo.cs" />
</sources>
<references basedir="${current.bin.dir}">
<include name="*.dll" />
<exclude name="${project::get-name()}.dll" />
</references>
</csc>
<copy todir="${current.bin.dir}">
<fileset basedir="${project::get-name()}/Data">
<include name="**/*.xml" />
<include name="**/*.test" />
</fileset>
</copy>
<copy todir="${current.bin.dir}">
<fileset basedir="${project::get-name()}">
<include name="**/*.config" />
</fileset>
</copy>
</target>
<target name="test" depends="build">
<!-- property name="test.assemblyname" value="${project::get-name()}" / -->
<call target="common.run-tests" />
</target>
<!--
<target name="test" depends="build">
<nunit2>
<formatter type="Plain" />
<formatter type="Xml" usefile="true" extension=".xml"
outputdir="${current.bin.dir}/results" />
<test assemblyname="${current.bin.dir}/${project::get-name()}.dll"
appconfig="${current.bin.dir}/${project::get-name()}.dll.config" />
</nunit2>
</target>
-->
<!--
<target name="test-mono-1.0" >
<nunit2>
<formatter type="Plain" />
<formatter type="Xml" usefile="true" extension=".xml"
outputdir="${current.bin.dir}/results" />
<test assemblyname="${bin.dir}/net/1.1/${current.build.config}/${project::get-name()}.dll"
appconfig="${bin.dir}/net/1.1/${current.build.config}/${project::get-name()}.dll.config" />
</nunit2>
</target>
-->
</project>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
</configuration>

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<job-scheduling-data xmlns="http://quartznet.sourceforge.net/JobSchedulingData"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.0">
<processing-directives>
<overwrite-existing-data>true</overwrite-existing-data>
</processing-directives>
<schedule>
<job>
<name>myJob</name>
<group>myGroup</group>
<job-type>Spring.Scheduling.Quartz.DummyJob, Spring.Scheduling.Quartz20.Tests</job-type>
<durable>true</durable>
<recover>false</recover>
<job-data-map>
<entry>
<key>param</key>
<value>10</value>
</entry>
</job-data-map>
</job>
<trigger>
<simple>
<name>myTrigger</name>
<group>myGroup</group>
<job-name>myJob</job-name>
<job-group>myGroup</job-group>
<repeat-count>1</repeat-count>
<repeat-interval>500</repeat-interval>
</simple>
</trigger>
</schedule>
</job-scheduling-data>

View File

@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<objects xmlns="http://www.springframework.net"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd">
<object id="scheduler" type="Spring.Scheduling.Quartz.SchedulerFactoryObject, Spring.Scheduling.Quartz20">
<property name="Triggers">
<list>
<ref local="exportTrigger"/>
<ref local="importTrigger"/>
</list>
</property>
</object>
<object id="exportTrigger" type="Spring.Scheduling.Quartz.SimpleTriggerObject, Spring.Scheduling.Quartz20">
<property name="JobDetail">
<object type="Spring.Scheduling.Quartz.MethodInvokingJobDetailFactoryObject, Spring.Scheduling.Quartz20">
<property name="TargetObject" ref="exportService"/>
<property name="TargetMethod" value="DoExport"/>
</object>
</property>
<property name="RepeatInterval" value="1s"/>
<property name="RepeatCount" value="1"/>
</object>
<object id="importTrigger" type="Spring.Scheduling.Quartz.SimpleTriggerObject, Spring.Scheduling.Quartz20">
<property name="JobDetail">
<object type="Spring.Scheduling.Quartz.MethodInvokingJobDetailFactoryObject, Spring.Scheduling.Quartz20">
<property name="TargetObject" ref="importService"/>
<property name="TargetMethod" value="DoImport"/>
</object>
</property>
<property name="RepeatInterval" value="1s"/>
<property name="RepeatCount" value="1"/>
</object>
<object id="exportService" type="Spring.Scheduling.Quartz.QuartzTestObject, Spring.Scheduling.Quartz20.Tests"/>
<object id="importService" type="Spring.Scheduling.Quartz.QuartzTestObject, Spring.Scheduling.Quartz20.Tests"/>
</objects>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<objects xmlns="http://www.springframework.net"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd">
<object id="scheduler1" type="Spring.Scheduling.Quartz.SchedulerFactoryObject, Spring.Scheduling.Quartz20">
<property name="SchedulerName" value="quartz1"/>
</object>
<object id="scheduler2" type="Spring.Scheduling.Quartz.SchedulerFactoryObject, Spring.Scheduling.Quartz20">
<property name="SchedulerName" value="quartz2"/>
</object>
</objects>

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<objects xmlns="http://www.springframework.net"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd">
<object id="scheduler" type="Spring.Scheduling.Quartz.SchedulerFactoryObject, Spring.Scheduling.Quartz20"/>
<object type="Spring.Scheduling.Quartz.SchedulerAccessorObject, Spring.Scheduling.Quartz20">
<property name="Scheduler" ref="scheduler"/>
<property name="Triggers">
<list>
<ref local="exportTrigger"/>
<ref local="importTrigger"/>
</list>
</property>
</object>
<object id="exportTrigger" type="Spring.Scheduling.Quartz.SimpleTriggerObject, Spring.Scheduling.Quartz20">
<property name="JobDetail">
<object type="Spring.Scheduling.Quartz.MethodInvokingJobDetailFactoryObject, Spring.Scheduling.Quartz20">
<property name="TargetObject" ref="exportService"/>
<property name="TargetMethod" value="DoExport"/>
</object>
</property>
<property name="RepeatInterval" value="1s"/>
<property name="RepeatCount" value="1"/>
</object>
<object id="importTrigger" type="Spring.Scheduling.Quartz.SimpleTriggerObject, Spring.Scheduling.Quartz20">
<property name="jobDetail">
<object type="Spring.Scheduling.Quartz.MethodInvokingJobDetailFactoryObject, Spring.Scheduling.Quartz20">
<property name="TargetObject" ref="importService"/>
<property name="TargetMethod" value="DoImport"/>
</object>
</property>
<property name="RepeatInterval" value="1s"/>
<property name="RepeatCount" value="1"/>
</object>
<object id="exportService" type="Spring.Scheduling.Quartz.QuartzTestObject, Spring.Scheduling.Quartz20.Tests"/>
<object id="importService" type="Spring.Scheduling.Quartz.QuartzTestObject, Spring.Scheduling.Quartz20.Tests"/>
</objects>

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<objects xmlns="http://www.springframework.net"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd">
<object id="scheduler" type="Spring.Scheduling.Quartz.SchedulerFactoryObject, Spring.Scheduling.Quartz20">
<property name="schedulerName" value="myScheduler"/>
<property name="exposeSchedulerInRepository" value="true"/>
</object>
<object type="Spring.Scheduling.Quartz.SchedulerAccessorObject, Spring.Scheduling.Quartz20">
<property name="schedulerName" value="myScheduler"/>
<property name="triggers">
<list>
<ref local="exportTrigger"/>
<ref local="importTrigger"/>
</list>
</property>
</object>
<object id="exportTrigger" type="Spring.Scheduling.Quartz.SimpleTriggerObject, Spring.Scheduling.Quartz20">
<property name="JobDetail">
<object type="Spring.Scheduling.Quartz.MethodInvokingJobDetailFactoryObject, Spring.Scheduling.Quartz20">
<property name="TargetObject" ref="exportService"/>
<property name="TargetMethod" value="DoExport"/>
</object>
</property>
<property name="RepeatInterval" value="1s"/>
<property name="RepeatCount" value="1"/>
</object>
<object id="importTrigger" type="Spring.Scheduling.Quartz.SimpleTriggerObject, Spring.Scheduling.Quartz20">
<property name="jobDetail">
<object type="Spring.Scheduling.Quartz.MethodInvokingJobDetailFactoryObject, Spring.Scheduling.Quartz20">
<property name="TargetObject" ref="importService"/>
<property name="TargetMethod" value="DoImport"/>
</object>
</property>
<property name="RepeatInterval" value="1s"/>
<property name="RepeatCount" value="1"/>
</object>
<object id="exportService" type="Spring.Scheduling.Quartz.QuartzTestObject, Spring.Scheduling.Quartz20.Tests"/>
<object id="importService" type="Spring.Scheduling.Quartz.QuartzTestObject, Spring.Scheduling.Quartz20.Tests"/>
</objects>