fixes #155 replace Quartz 2 integration with Quartz 3 integration
This commit is contained in:
@@ -63,7 +63,7 @@ namespace Spring.Data.Core
|
||||
|
||||
TransactionOptions txOptions = new TransactionOptions();
|
||||
txOptions.IsolationLevel = IsolationLevel.ReadCommitted;
|
||||
txAdapter.CreateTransactionScope(TransactionScopeOption.Required, txOptions, EnterpriseServicesInteropOption.None);
|
||||
txAdapter.CreateTransactionScope(TransactionScopeOption.Required, txOptions, TransactionScopeAsyncFlowOption.Enabled);
|
||||
txAdapter.Complete();
|
||||
txAdapter.Dispose();
|
||||
}
|
||||
@@ -103,7 +103,7 @@ namespace Spring.Data.Core
|
||||
}
|
||||
|
||||
Assert.IsTrue(!TransactionSynchronizationManager.SynchronizationActive, "Synchronizations not active");
|
||||
A.CallTo(() => txAdapter.CreateTransactionScope(TransactionScopeOption.Required, txOptions, EnterpriseServicesInteropOption.None)).MustHaveHappenedOnceExactly();
|
||||
A.CallTo(() => txAdapter.CreateTransactionScope(TransactionScopeOption.Required, txOptions, TransactionScopeAsyncFlowOption.Enabled)).MustHaveHappenedOnceExactly();
|
||||
A.CallTo(() => txAdapter.Dispose()).MustHaveHappenedOnceExactly();
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace Spring.Data.Core
|
||||
return null;
|
||||
});
|
||||
|
||||
A.CallTo(() => txAdapter.CreateTransactionScope(TransactionScopeOption.RequiresNew, txOptions, EnterpriseServicesInteropOption.None)).MustHaveHappenedTwiceExactly();
|
||||
A.CallTo(() => txAdapter.CreateTransactionScope(TransactionScopeOption.RequiresNew, txOptions, TransactionScopeAsyncFlowOption.Enabled)).MustHaveHappenedTwiceExactly();
|
||||
A.CallTo(() => txAdapter.Dispose()).MustHaveHappenedTwiceExactly();
|
||||
A.CallTo(() => txAdapter.Complete()).MustHaveHappenedOnceExactly();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright <20> 2002-2011 the original author or authors.
|
||||
*
|
||||
@@ -16,47 +14,31 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Transactions;
|
||||
using Common.Logging;
|
||||
using Spring.Objects;
|
||||
using Spring.Transaction;
|
||||
using Spring.Transaction.Interceptor;
|
||||
using Spring.Transaction.Support;
|
||||
using IsolationLevel=System.Data.IsolationLevel;
|
||||
|
||||
#endregion
|
||||
using IsolationLevel = System.Data.IsolationLevel;
|
||||
|
||||
namespace Spring.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Group together multiple ITestObjectDao operations.
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack (.NET)</author>
|
||||
public class TestObjectMgr : ITestObjectMgr
|
||||
{
|
||||
#region Fields
|
||||
|
||||
/// <summary>
|
||||
/// Group together multiple ITestObjectDao operations.
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack (.NET)</author>
|
||||
public class TestObjectMgr : ITestObjectMgr
|
||||
{
|
||||
private static readonly ILog LOG = LogManager.GetLogger(typeof(TestObjectMgr));
|
||||
#endregion
|
||||
|
||||
#region Constructor (s)
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TestObjectMgr"/> class.
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TestObjectMgr"/> class.
|
||||
/// </summary>
|
||||
public TestObjectMgr()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region Methods
|
||||
public TestObjectMgr()
|
||||
{
|
||||
}
|
||||
|
||||
[Transaction()]
|
||||
public void SaveTwoTestObjects(TestObject to1, TestObject to2)
|
||||
@@ -65,14 +47,12 @@ namespace Spring.Data
|
||||
}
|
||||
|
||||
[Transaction(TransactionPropagation.Required, IsolationLevel.Unspecified, Timeout = 50,
|
||||
RollbackFor = new Type[]{typeof(ArgumentNullException)},
|
||||
ReadOnly = false,
|
||||
EnterpriseServicesInteropOption = System.Transactions.EnterpriseServicesInteropOption.Automatic,
|
||||
NoRollbackFor = new Type[] { typeof(ArithmeticException), typeof(NotSupportedException) })]
|
||||
public void DeleteTwoTestObjects(string name1, string name2)
|
||||
RollbackFor = new Type[] {typeof(ArgumentNullException)},
|
||||
ReadOnly = false,
|
||||
AsyncFlowOption = TransactionScopeAsyncFlowOption.Enabled,
|
||||
NoRollbackFor = new Type[] {typeof(ArithmeticException), typeof(NotSupportedException)})]
|
||||
public void DeleteTwoTestObjects(string name1, string name2)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,49 +5,17 @@ namespace Spring.Transaction
|
||||
{
|
||||
public class MockTxnDefinition : ITransactionDefinition
|
||||
{
|
||||
private int _transactionTimeout = DefaultTransactionDefinition.TIMEOUT_DEFAULT;
|
||||
private TransactionPropagation _transactionPropagation = TransactionPropagation.NotSupported;
|
||||
private bool _readOnly = false;
|
||||
private string _name = null;
|
||||
private System.Transactions.EnterpriseServicesInteropOption _esInteropOption;
|
||||
public bool ReadOnly { get; set; }
|
||||
|
||||
#region ITransactionDefinition Members
|
||||
public int TransactionTimeout { get; set; } = DefaultTransactionDefinition.TIMEOUT_DEFAULT;
|
||||
|
||||
public bool ReadOnly
|
||||
{
|
||||
get { return _readOnly; }
|
||||
set { _readOnly = value; }
|
||||
}
|
||||
public IsolationLevel TransactionIsolationLevel => IsolationLevel.Unspecified;
|
||||
|
||||
public int TransactionTimeout
|
||||
{
|
||||
get { return _transactionTimeout; }
|
||||
set { _transactionTimeout = value; }
|
||||
}
|
||||
public TransactionPropagation PropagationBehavior { get; set; } = TransactionPropagation.NotSupported;
|
||||
|
||||
public IsolationLevel TransactionIsolationLevel
|
||||
{
|
||||
get { return IsolationLevel.Unspecified; }
|
||||
}
|
||||
public string Name { get; } = null;
|
||||
|
||||
public TransactionPropagation PropagationBehavior
|
||||
{
|
||||
get { return _transactionPropagation; }
|
||||
set { _transactionPropagation = value; }
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
}
|
||||
|
||||
public System.Transactions.EnterpriseServicesInteropOption EnterpriseServicesInteropOption
|
||||
{
|
||||
get { return _esInteropOption; }
|
||||
set { _esInteropOption = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
public System.Transactions.TransactionScopeAsyncFlowOption AsyncFlowOption { get; set; }
|
||||
}
|
||||
|
||||
public class MockTxnPlatformMgrAbstract : AbstractPlatformTransactionManager
|
||||
@@ -68,32 +36,18 @@ namespace Spring.Transaction
|
||||
_isExistingTransaction = true;
|
||||
}
|
||||
|
||||
public object Transaction
|
||||
{
|
||||
get { return _transaction; }
|
||||
}
|
||||
public object Transaction => _transaction;
|
||||
|
||||
public bool Savepoints
|
||||
{
|
||||
set { _useSavepointForNestedTransaction = value; }
|
||||
set => _useSavepointForNestedTransaction = value;
|
||||
}
|
||||
|
||||
public int DoBeginCallCount
|
||||
{
|
||||
get { return _doBeginCalls; }
|
||||
}
|
||||
public int DoBeginCallCount => _doBeginCalls;
|
||||
|
||||
public int DoGetTransactionCallCount
|
||||
{
|
||||
get { return _doGetTxnCalls; }
|
||||
}
|
||||
public int DoGetTransactionCallCount => _doGetTxnCalls;
|
||||
|
||||
public int IsExistingTransactionCallCount
|
||||
{
|
||||
get { return _isExistingTxnCalls; }
|
||||
}
|
||||
|
||||
#region AbstractPlatformTransactionManager Impls
|
||||
public int IsExistingTransactionCallCount => _isExistingTxnCalls;
|
||||
|
||||
protected override void DoResume(object transaction, object suspendedResources)
|
||||
{
|
||||
@@ -144,7 +98,5 @@ namespace Spring.Transaction
|
||||
{
|
||||
return _useSavepointForNestedTransaction;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
<?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.Quartz2">
|
||||
<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.Quartz2">
|
||||
<property name="JobType" value="Spring.Scheduling.Quartz.Integration.Tests.TestJob, Spring.Scheduling.Quartz2.Integration.Tests" />
|
||||
</object>
|
||||
|
||||
<object id="simpleTrigger" type="Spring.Scheduling.Quartz.SimpleTriggerObject, Spring.Scheduling.Quartz2">
|
||||
<!-- 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>
|
||||
@@ -1,7 +1,7 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2007 the original author or authors.
|
||||
* Copyright <EFBFBD> 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.
|
||||
@@ -21,32 +21,32 @@
|
||||
#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
|
||||
public class LocalDataSourceJobStoreTest
|
||||
{
|
||||
private IApplicationContext ctx;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
ctx = new XmlApplicationContext("assembly://Spring.Scheduling.Quartz2.Integration.Tests/Spring.Scheduling.Quartz/LocalDataSourceJobStoreTest.xml");
|
||||
ctx = new XmlApplicationContext(
|
||||
"assembly://Spring.Scheduling.Quartz3.Integration.Tests/Spring.Scheduling.Quartz/LocalDataSourceJobStoreTest.xml");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Appveyor problems")]
|
||||
[Explicit("Appveyor problems")]
|
||||
public void TestLocalDataSourceJobStore()
|
||||
{
|
||||
// sleep 20 seconds
|
||||
Thread.Sleep(20000);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?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.Quartz3">
|
||||
<property name="AutoStartup" value="true" />
|
||||
<property name="StartupDelay" value="5s" />
|
||||
<property name="QuartzProperties">
|
||||
<dictionary>
|
||||
<entry key="quartz.serializer.type" value="binary" />
|
||||
<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.Quartz3">
|
||||
<property name="JobType"
|
||||
value="Spring.Scheduling.Quartz.Integration.Tests.TestJob, Spring.Scheduling.Quartz3.Integration.Tests" />
|
||||
</object>
|
||||
|
||||
<object id="simpleTrigger" type="Spring.Scheduling.Quartz.SimpleTriggerObject, Spring.Scheduling.Quartz3">
|
||||
<!-- 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>
|
||||
@@ -1,14 +1,15 @@
|
||||
using System;
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using Quartz;
|
||||
|
||||
namespace Spring.Scheduling.Quartz.Integration.Tests
|
||||
{
|
||||
public class TestJob : IJob
|
||||
{
|
||||
public void Execute(IJobExecutionContext context)
|
||||
public Task Execute(IJobExecutionContext context)
|
||||
{
|
||||
Console.WriteLine("Executing Execute!");
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
public void DoIt()
|
||||
@@ -1,11 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net452</TargetFramework>
|
||||
<TargetFrameworks>netcoreapp2.1;$(TargetFullFrameworkVersion)</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Core\Spring.Core.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Data\Spring.Data.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Scheduling.Quartz2\Spring.Scheduling.Quartz2.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Scheduling.Quartz3\Spring.Scheduling.Quartz3.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FakeItEasy" Version="$(FakeItEasyVersion)" />
|
||||
@@ -19,7 +19,6 @@ using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
using Quartz;
|
||||
using Quartz.Job;
|
||||
using Quartz.Spi;
|
||||
|
||||
namespace Spring.Scheduling.Quartz
|
||||
@@ -22,8 +22,6 @@ using NUnit.Framework;
|
||||
|
||||
using Quartz;
|
||||
using Quartz.Impl;
|
||||
using Quartz.Job;
|
||||
|
||||
|
||||
namespace Spring.Scheduling.Quartz
|
||||
{
|
||||
@@ -20,7 +20,6 @@ using System.Collections;
|
||||
using NUnit.Framework;
|
||||
|
||||
using Quartz;
|
||||
using Quartz.Job;
|
||||
|
||||
using Spring.Context.Support;
|
||||
|
||||
@@ -24,7 +24,6 @@ using NUnit.Framework;
|
||||
using Quartz;
|
||||
using Quartz.Impl;
|
||||
using Quartz.Impl.Triggers;
|
||||
using Quartz.Job;
|
||||
using Quartz.Spi;
|
||||
|
||||
using Spring.Objects.Support;
|
||||
@@ -151,7 +150,15 @@ namespace Spring.Scheduling.Quartz
|
||||
{
|
||||
IJobDetail jd = new JobDetailImpl("jobName", "jobGroup", typeof(NoOpJob));
|
||||
IOperableTrigger trigger = new SimpleTriggerImpl("triggerName", "triggerGroup");
|
||||
TriggerFiredBundle retValue = new TriggerFiredBundle(jd, trigger, null, false, null, null, null, null);
|
||||
TriggerFiredBundle retValue = new TriggerFiredBundle(
|
||||
jd,
|
||||
trigger,
|
||||
null,
|
||||
false,
|
||||
DateTimeOffset.UtcNow,
|
||||
null,
|
||||
null,
|
||||
null);
|
||||
|
||||
return retValue;
|
||||
}
|
||||
@@ -17,7 +17,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Threading;
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using FakeItEasy;
|
||||
|
||||
using NUnit.Framework;
|
||||
@@ -46,18 +46,18 @@ namespace Spring.Scheduling.Quartz
|
||||
/// Executes parametrized test.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestSchedulerFactoryObject()
|
||||
public async Task TestSchedulerFactoryObject()
|
||||
{
|
||||
DoTestSchedulerFactoryObject(false, false);
|
||||
await DoTestSchedulerFactoryObject(false, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes parametrized test.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestSchedulerFactoryObjectWithExplicitJobDetail()
|
||||
public async Task TestSchedulerFactoryObjectWithExplicitJobDetail()
|
||||
{
|
||||
DoTestSchedulerFactoryObject(true, false);
|
||||
await DoTestSchedulerFactoryObject(true, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -65,12 +65,12 @@ namespace Spring.Scheduling.Quartz
|
||||
/// </summary>
|
||||
[Test]
|
||||
[Ignore("Requires change to MethodInvoker for overriding target object and type")]
|
||||
public void TestSchedulerFactoryObjectWithPrototypeJob()
|
||||
public async Task TestSchedulerFactoryObjectWithPrototypeJob()
|
||||
{
|
||||
DoTestSchedulerFactoryObject(false, true);
|
||||
await DoTestSchedulerFactoryObject(false, true);
|
||||
}
|
||||
|
||||
private void DoTestSchedulerFactoryObject(bool explicitJobDetail, bool prototypeJob)
|
||||
private async Task DoTestSchedulerFactoryObject(bool explicitJobDetail, bool prototypeJob)
|
||||
{
|
||||
TestObject tb = new TestObject("tb", 99);
|
||||
JobDetailObject jobDetail0 = new JobDetailObject();
|
||||
@@ -116,8 +116,8 @@ namespace Spring.Scheduling.Quartz
|
||||
IScheduler scheduler = A.Fake<IScheduler>();
|
||||
|
||||
A.CallTo(() => scheduler.Context).Returns(new SchedulerContext());
|
||||
A.CallTo(() => scheduler.GetTrigger(A<TriggerKey>._)).Returns(null);
|
||||
A.CallTo(() => scheduler.GetJobDetail(A<JobKey>._)).Returns(null);
|
||||
A.CallTo(() => scheduler.GetTrigger(A<TriggerKey>._, A<CancellationToken>._)).Returns(Task.FromResult<ITrigger>(null));
|
||||
A.CallTo(() => scheduler.GetJobDetail(A<JobKey>._, A<CancellationToken>._)).Returns(Task.FromResult<IJobDetail>(null));
|
||||
|
||||
SchedulerFactoryObject schedulerFactoryObject = new TestSchedulerFactoryObject(scheduler);
|
||||
schedulerFactoryObject.JobFactory = null;
|
||||
@@ -132,42 +132,42 @@ namespace Spring.Scheduling.Quartz
|
||||
try
|
||||
{
|
||||
schedulerFactoryObject.AfterPropertiesSet();
|
||||
schedulerFactoryObject.Start();
|
||||
await schedulerFactoryObject.Start();
|
||||
}
|
||||
finally
|
||||
{
|
||||
schedulerFactoryObject.Dispose();
|
||||
}
|
||||
|
||||
A.CallTo(() => scheduler.ScheduleJob(trigger0)).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.ScheduleJob(trigger1)).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.ScheduleJob(trigger0, A<CancellationToken>._)).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.ScheduleJob(trigger1, A<CancellationToken>._)).MustHaveHappened();
|
||||
|
||||
A.CallTo(() => scheduler.AddJob(jobDetail0, true, true)).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.AddJob(jobDetail0, true, true)).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.AddJob(jobDetail0, true, true, A<CancellationToken>._)).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.AddJob(jobDetail0, true, true, A<CancellationToken>._)).MustHaveHappened();
|
||||
|
||||
A.CallTo(() => scheduler.Start()).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.Shutdown(false)).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.Start(A<CancellationToken>._)).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.Shutdown(false, A<CancellationToken>._)).MustHaveHappened();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes parametrized test.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestSchedulerFactoryObjectWithExistingJobs()
|
||||
public async Task TestSchedulerFactoryObjectWithExistingJobs()
|
||||
{
|
||||
DoTestSchedulerFactoryObjectWithExistingJobs(false);
|
||||
await DoTestSchedulerFactoryObjectWithExistingJobs(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes parametrized test.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestSchedulerFactoryObjectWithOverwriteExistingJobs()
|
||||
public async Task TestSchedulerFactoryObjectWithOverwriteExistingJobs()
|
||||
{
|
||||
DoTestSchedulerFactoryObjectWithExistingJobs(true);
|
||||
await DoTestSchedulerFactoryObjectWithExistingJobs(true);
|
||||
}
|
||||
|
||||
private void DoTestSchedulerFactoryObjectWithExistingJobs(bool overwrite)
|
||||
private async Task DoTestSchedulerFactoryObjectWithExistingJobs(bool overwrite)
|
||||
{
|
||||
TestObject tb = new TestObject("tb", 99);
|
||||
JobDetailObject jobDetail0 = new JobDetailObject();
|
||||
@@ -202,13 +202,13 @@ namespace Spring.Scheduling.Quartz
|
||||
|
||||
IScheduler scheduler = A.Fake<IScheduler>();
|
||||
A.CallTo(() => scheduler.Context).Returns(new SchedulerContext());
|
||||
A.CallTo(() => scheduler.GetJobDetail(A<JobKey>._)).Returns(null);
|
||||
A.CallTo(() => scheduler.GetTrigger(new TriggerKey("myTrigger0", SchedulerConstants.DefaultGroup))).Returns(null);
|
||||
A.CallTo(() => scheduler.GetTrigger(new TriggerKey("myTrigger1", SchedulerConstants.DefaultGroup))).Returns(new SimpleTriggerImpl());
|
||||
A.CallTo(() => scheduler.GetJobDetail(A<JobKey>._, A<CancellationToken>._)).Returns(Task.FromResult<IJobDetail>(null));
|
||||
A.CallTo(() => scheduler.GetTrigger(new TriggerKey("myTrigger0", SchedulerConstants.DefaultGroup), A<CancellationToken>._)).Returns(Task.FromResult<ITrigger>(null));
|
||||
A.CallTo(() => scheduler.GetTrigger(new TriggerKey("myTrigger1", SchedulerConstants.DefaultGroup), A<CancellationToken>._)).Returns(Task.FromResult<ITrigger>(new SimpleTriggerImpl()));
|
||||
|
||||
if (overwrite)
|
||||
{
|
||||
A.CallTo(() => scheduler.RescheduleJob(new TriggerKey("myTrigger1", SchedulerConstants.DefaultGroup), trigger1)).Returns(DateTime.UtcNow);
|
||||
A.CallTo(() => scheduler.RescheduleJob(new TriggerKey("myTrigger1", SchedulerConstants.DefaultGroup), trigger1, A<CancellationToken>._)).Returns(DateTime.UtcNow);
|
||||
}
|
||||
|
||||
SchedulerFactoryObject schedulerFactoryObject = new TestSchedulerFactoryObject(scheduler);
|
||||
@@ -224,38 +224,38 @@ namespace Spring.Scheduling.Quartz
|
||||
try
|
||||
{
|
||||
schedulerFactoryObject.AfterPropertiesSet();
|
||||
schedulerFactoryObject.Start();
|
||||
await schedulerFactoryObject.Start();
|
||||
}
|
||||
finally
|
||||
{
|
||||
schedulerFactoryObject.Dispose();
|
||||
}
|
||||
|
||||
A.CallTo(() => scheduler.AddJob(jobDetail0, true, true)).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.ScheduleJob(trigger0)).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.Start()).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.Shutdown(false)).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.AddJob(jobDetail0, true, true, A<CancellationToken>._)).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.ScheduleJob(trigger0, A<CancellationToken>._)).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.Start(A<CancellationToken>._)).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.Shutdown(false, A<CancellationToken>._)).MustHaveHappened();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes parametrized test.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestSchedulerFactoryObjectWithExistingJobsAndRaceCondition()
|
||||
public async Task TestSchedulerFactoryObjectWithExistingJobsAndRaceCondition()
|
||||
{
|
||||
DoTestSchedulerFactoryObjectWithExistingJobsAndRaceCondition(false);
|
||||
await DoTestSchedulerFactoryObjectWithExistingJobsAndRaceCondition(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes parametrized test.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestSchedulerFactoryObjectWithOverwriteExistingJobsAndRaceCondition()
|
||||
public async Task TestSchedulerFactoryObjectWithOverwriteExistingJobsAndRaceCondition()
|
||||
{
|
||||
DoTestSchedulerFactoryObjectWithExistingJobsAndRaceCondition(true);
|
||||
await DoTestSchedulerFactoryObjectWithExistingJobsAndRaceCondition(true);
|
||||
}
|
||||
|
||||
private void DoTestSchedulerFactoryObjectWithExistingJobsAndRaceCondition(bool overwrite)
|
||||
private async Task DoTestSchedulerFactoryObjectWithExistingJobsAndRaceCondition(bool overwrite)
|
||||
{
|
||||
TestObject tb = new TestObject("tb", 99);
|
||||
JobDetailObject jobDetail0 = new JobDetailObject();
|
||||
@@ -290,24 +290,24 @@ namespace Spring.Scheduling.Quartz
|
||||
|
||||
IScheduler scheduler = A.Fake<IScheduler>();
|
||||
A.CallTo(() => scheduler.Context).Returns(new SchedulerContext());
|
||||
A.CallTo(() => scheduler.GetJobDetail(A<JobKey>._)).Returns(null);
|
||||
A.CallTo(() => scheduler.GetTrigger(new TriggerKey("myTrigger0", SchedulerConstants.DefaultGroup))).Returns(null);
|
||||
A.CallTo(() => scheduler.GetTrigger(new TriggerKey("myTrigger1", SchedulerConstants.DefaultGroup))).Returns(new SimpleTriggerImpl());
|
||||
A.CallTo(() => scheduler.GetJobDetail(A<JobKey>._, A<CancellationToken>._)).Returns(Task.FromResult<IJobDetail>(null));
|
||||
A.CallTo(() => scheduler.GetTrigger(new TriggerKey("myTrigger0", SchedulerConstants.DefaultGroup), A<CancellationToken>._)).Returns(Task.FromResult<ITrigger>(null));
|
||||
A.CallTo(() => scheduler.GetTrigger(new TriggerKey("myTrigger1", SchedulerConstants.DefaultGroup), A<CancellationToken>._)).Returns(Task.FromResult<ITrigger>(new SimpleTriggerImpl()));
|
||||
if (overwrite)
|
||||
{
|
||||
scheduler.AddJob(jobDetail1, true);
|
||||
A.CallTo(() => scheduler.RescheduleJob(new TriggerKey("myTrigger1", SchedulerConstants.DefaultGroup), trigger1)).Returns(DateTime.UtcNow);
|
||||
await scheduler.AddJob(jobDetail1, true);
|
||||
A.CallTo(() => scheduler.RescheduleJob(new TriggerKey("myTrigger1", SchedulerConstants.DefaultGroup), trigger1, A<CancellationToken>._)).Returns(DateTime.UtcNow);
|
||||
}
|
||||
|
||||
A.CallTo(() => scheduler.ScheduleJob(trigger0)).Throws(new ObjectAlreadyExistsException(""));
|
||||
A.CallTo(() => scheduler.ScheduleJob(trigger0, A<CancellationToken>._)).Throws(new ObjectAlreadyExistsException(""));
|
||||
|
||||
if (overwrite)
|
||||
{
|
||||
A.CallTo(() => scheduler.RescheduleJob(new TriggerKey("myTrigger0", SchedulerConstants.DefaultGroup), trigger0)).Returns(DateTime.UtcNow);
|
||||
A.CallTo(() => scheduler.RescheduleJob(new TriggerKey("myTrigger0", SchedulerConstants.DefaultGroup), trigger0, A<CancellationToken>._)).Returns(DateTime.UtcNow);
|
||||
}
|
||||
|
||||
scheduler.Start();
|
||||
scheduler.Shutdown(false);
|
||||
await scheduler.Start();
|
||||
await scheduler.Shutdown(false);
|
||||
|
||||
SchedulerFactoryObject schedulerFactoryObject = new TestSchedulerFactoryObject(scheduler);
|
||||
|
||||
@@ -323,14 +323,14 @@ namespace Spring.Scheduling.Quartz
|
||||
try
|
||||
{
|
||||
schedulerFactoryObject.AfterPropertiesSet();
|
||||
schedulerFactoryObject.Start();
|
||||
await schedulerFactoryObject.Start();
|
||||
}
|
||||
finally
|
||||
{
|
||||
schedulerFactoryObject.Dispose();
|
||||
}
|
||||
|
||||
A.CallTo(() => scheduler.AddJob(jobDetail0, true, true)).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.AddJob(jobDetail0, true, true, A<CancellationToken>._)).MustHaveHappened();
|
||||
|
||||
}
|
||||
|
||||
@@ -417,7 +417,7 @@ namespace Spring.Scheduling.Quartz
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestSchedulerFactoryObjectWithPlainQuartzObjects()
|
||||
public async Task TestSchedulerFactoryObjectWithPlainQuartzObjects()
|
||||
{
|
||||
IJobFactory jobFactory = new AdaptableJobFactory();
|
||||
|
||||
@@ -456,8 +456,8 @@ namespace Spring.Scheduling.Quartz
|
||||
trigger1.RepeatInterval = TimeSpan.FromMilliseconds(20);
|
||||
|
||||
IScheduler scheduler = A.Fake<IScheduler>();
|
||||
A.CallTo(() => scheduler.GetTrigger(A<TriggerKey>._)).Returns(null);
|
||||
A.CallTo(() => scheduler.GetJobDetail(A<JobKey>._)).Returns(null);
|
||||
A.CallTo(() => scheduler.GetTrigger(A<TriggerKey>._, A<CancellationToken>._)).Returns(Task.FromResult<ITrigger>(null));
|
||||
A.CallTo(() => scheduler.GetJobDetail(A<JobKey>._, A<CancellationToken>._)).Returns(Task.FromResult<IJobDetail>(null));
|
||||
|
||||
SchedulerFactoryObject schedulerFactoryObject = new TestSchedulerFactoryObject(scheduler);
|
||||
|
||||
@@ -467,7 +467,7 @@ namespace Spring.Scheduling.Quartz
|
||||
try
|
||||
{
|
||||
schedulerFactoryObject.AfterPropertiesSet();
|
||||
schedulerFactoryObject.Start();
|
||||
await schedulerFactoryObject.Start();
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -479,18 +479,18 @@ namespace Spring.Scheduling.Quartz
|
||||
.WhenArgumentsMatch(x => x.Get<IJobFactory>(0) == jobFactory)
|
||||
.MustHaveHappened();
|
||||
|
||||
A.CallTo(() => scheduler.AddJob(jobDetail0, true, true)).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.AddJob(jobDetail1, true, true)).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.GetJobDetail(new JobKey("myJob0", SchedulerConstants.DefaultGroup))).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.GetJobDetail(new JobKey("myJob1", SchedulerConstants.DefaultGroup))).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.GetTrigger(new TriggerKey("myTrigger0", SchedulerConstants.DefaultGroup))).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.GetTrigger(new TriggerKey("myTrigger1", SchedulerConstants.DefaultGroup))).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.AddJob(jobDetail0, true, true, A<CancellationToken>._)).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.AddJob(jobDetail1, true, true, A<CancellationToken>._)).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.GetJobDetail(new JobKey("myJob0", SchedulerConstants.DefaultGroup), A<CancellationToken>._)).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.GetJobDetail(new JobKey("myJob1", SchedulerConstants.DefaultGroup), A<CancellationToken>._)).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.GetTrigger(new TriggerKey("myTrigger0", SchedulerConstants.DefaultGroup), A<CancellationToken>._)).MustHaveHappened();
|
||||
A.CallTo(() => scheduler.GetTrigger(new TriggerKey("myTrigger1", SchedulerConstants.DefaultGroup), A<CancellationToken>._)).MustHaveHappened();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestSchedulerFactoryObjectWithApplicationContext()
|
||||
public async Task TestSchedulerFactoryObjectWithApplicationContext()
|
||||
{
|
||||
TestObject tb = new TestObject("tb", 99);
|
||||
StaticApplicationContext ac = new StaticApplicationContext();
|
||||
@@ -509,7 +509,7 @@ namespace Spring.Scheduling.Quartz
|
||||
try
|
||||
{
|
||||
schedulerFactoryObject.AfterPropertiesSet();
|
||||
schedulerFactoryObject.Start();
|
||||
await schedulerFactoryObject.Start();
|
||||
IScheduler returnedScheduler = (IScheduler) schedulerFactoryObject.GetObject();
|
||||
Assert.AreEqual(tb, returnedScheduler.Context["testObject"]);
|
||||
Assert.AreEqual(ac, returnedScheduler.Context["appCtx"]);
|
||||
@@ -545,7 +545,7 @@ namespace Spring.Scheduling.Quartz
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestSchedulerWithTaskExecutor()
|
||||
public async Task TestSchedulerWithTaskExecutor()
|
||||
{
|
||||
CountingTaskExecutor taskExecutor = new CountingTaskExecutor();
|
||||
DummyJob.count = 0;
|
||||
@@ -567,7 +567,7 @@ namespace Spring.Scheduling.Quartz
|
||||
factoryObject.Triggers = new ITrigger[] {trigger};
|
||||
factoryObject.JobDetails = new IJobDetail[] {jobDetail};
|
||||
factoryObject.AfterPropertiesSet();
|
||||
factoryObject.Start();
|
||||
await factoryObject.Start();
|
||||
|
||||
Thread.Sleep(500);
|
||||
Assert.IsTrue(DummyJob.count > 0);
|
||||
@@ -579,7 +579,7 @@ namespace Spring.Scheduling.Quartz
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestSchedulerWithRunnable()
|
||||
public async Task TestSchedulerWithRunnable()
|
||||
{
|
||||
DummyRunnable.count = 0;
|
||||
|
||||
@@ -599,7 +599,7 @@ namespace Spring.Scheduling.Quartz
|
||||
factoryObject.Triggers = new ITrigger[] {trigger};
|
||||
factoryObject.JobDetails = new IJobDetail[] {jobDetail};
|
||||
factoryObject.AfterPropertiesSet();
|
||||
factoryObject.Start();
|
||||
await factoryObject.Start();
|
||||
|
||||
DummyRunnable.runEvent.WaitOne(500);
|
||||
Assert.IsTrue(DummyRunnable.count > 0);
|
||||
@@ -610,7 +610,7 @@ namespace Spring.Scheduling.Quartz
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestSchedulerWithQuartzJobObject()
|
||||
public async Task TestSchedulerWithQuartzJobObject()
|
||||
{
|
||||
DummyJob.param = 0;
|
||||
DummyJob.count = 0;
|
||||
@@ -632,7 +632,7 @@ namespace Spring.Scheduling.Quartz
|
||||
factoryObject.Triggers = new ITrigger[] {trigger};
|
||||
factoryObject.JobDetails = new IJobDetail[] {jobDetail};
|
||||
factoryObject.AfterPropertiesSet();
|
||||
factoryObject.Start();
|
||||
await factoryObject.Start();
|
||||
|
||||
Thread.Sleep(500);
|
||||
Assert.AreEqual(10, DummyJobObject.param);
|
||||
@@ -644,7 +644,7 @@ namespace Spring.Scheduling.Quartz
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestSchedulerWithSpringObjectJobFactory()
|
||||
public async Task TestSchedulerWithSpringObjectJobFactory()
|
||||
{
|
||||
DummyJob.param = 0;
|
||||
DummyJob.count = 0;
|
||||
@@ -668,7 +668,7 @@ namespace Spring.Scheduling.Quartz
|
||||
factoryObject.Triggers = new ITrigger[] {trigger};
|
||||
factoryObject.JobDetails = new IJobDetail[] {jobDetail};
|
||||
factoryObject.AfterPropertiesSet();
|
||||
factoryObject.Start();
|
||||
await factoryObject.Start();
|
||||
|
||||
Thread.Sleep(500);
|
||||
Assert.AreEqual(10, DummyJob.param);
|
||||
@@ -717,7 +717,7 @@ namespace Spring.Scheduling.Quartz
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestSchedulerWithSpringObjectJobFactoryAndRunnable()
|
||||
public async Task TestSchedulerWithSpringObjectJobFactoryAndRunnable()
|
||||
{
|
||||
DummyRunnable.param = 0;
|
||||
DummyRunnable.count = 0;
|
||||
@@ -740,7 +740,7 @@ namespace Spring.Scheduling.Quartz
|
||||
factoryObject.Triggers = new ITrigger[] {trigger};
|
||||
factoryObject.JobDetails = new IJobDetail[] {jobDetail};
|
||||
factoryObject.AfterPropertiesSet();
|
||||
factoryObject.Start();
|
||||
await factoryObject.Start();
|
||||
|
||||
Thread.Sleep(500);
|
||||
Assert.AreEqual(10, DummyRunnable.param);
|
||||
@@ -752,7 +752,7 @@ namespace Spring.Scheduling.Quartz
|
||||
///<summary>
|
||||
///</summary>
|
||||
[Test]
|
||||
public void TestSchedulerWithSpringObjectJobFactoryAndQuartzJobObject()
|
||||
public async Task TestSchedulerWithSpringObjectJobFactoryAndQuartzJobObject()
|
||||
{
|
||||
DummyJobObject.param = 0;
|
||||
DummyJobObject.count = 0;
|
||||
@@ -775,7 +775,7 @@ namespace Spring.Scheduling.Quartz
|
||||
factoryObject.Triggers = new ITrigger[] {trigger};
|
||||
factoryObject.JobDetails = new IJobDetail[] {jobDetail};
|
||||
factoryObject.AfterPropertiesSet();
|
||||
factoryObject.Start();
|
||||
await factoryObject.Start();
|
||||
|
||||
Thread.Sleep(500);
|
||||
Assert.AreEqual(10, DummyJobObject.param);
|
||||
@@ -788,7 +788,7 @@ namespace Spring.Scheduling.Quartz
|
||||
///
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestSchedulerWithSpringObjectJobFactoryAndJobSchedulingData()
|
||||
public async Task TestSchedulerWithSpringObjectJobFactoryAndJobSchedulingData()
|
||||
{
|
||||
DummyJob.param = 0;
|
||||
DummyJob.count = 0;
|
||||
@@ -798,7 +798,7 @@ namespace Spring.Scheduling.Quartz
|
||||
factoryObject.JobSchedulingDataLocation = "job-scheduling-data.xml";
|
||||
// TODO bean.ResourceLoader = (new FileSystemResourceLoader());
|
||||
factoryObject.AfterPropertiesSet();
|
||||
factoryObject.Start();
|
||||
await factoryObject.Start();
|
||||
|
||||
Thread.Sleep(500);
|
||||
Assert.AreEqual(10, DummyJob.param);
|
||||
@@ -924,145 +924,14 @@ namespace Spring.Scheduling.Quartz
|
||||
/// Tests how scheduler is exposed to application context.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestSchedulerRepositoryExposure()
|
||||
public async Task TestSchedulerRepositoryExposure()
|
||||
{
|
||||
XmlApplicationContext ctx = new XmlApplicationContext("schedulerRepositoryExposure.xml");
|
||||
Assert.AreSame(SchedulerRepository.Instance.Lookup("myScheduler"), ctx.GetObject("scheduler"));
|
||||
var expected = await SchedulerRepository.Instance.Lookup("myScheduler");
|
||||
Assert.AreSame(expected, ctx.GetObject("scheduler"));
|
||||
ctx.Dispose();
|
||||
}
|
||||
|
||||
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 SchedulerStarting()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SchedulerShutdown()
|
||||
{
|
||||
}
|
||||
|
||||
public void SchedulerShuttingdown()
|
||||
{
|
||||
}
|
||||
|
||||
public void SchedulingDataCleared()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private class TestJobListener : IJobListener
|
||||
{
|
||||
public string Name
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public void JobToBeExecuted(IJobExecutionContext context)
|
||||
{
|
||||
}
|
||||
|
||||
public void JobExecutionVetoed(IJobExecutionContext context)
|
||||
{
|
||||
}
|
||||
|
||||
public void JobWasExecuted(IJobExecutionContext context, JobExecutionException jobException)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class TestTriggerListener : ITriggerListener
|
||||
{
|
||||
public string Name
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public void TriggerFired(ITrigger trigger, IJobExecutionContext context)
|
||||
{
|
||||
}
|
||||
|
||||
public bool VetoJobExecution(ITrigger trigger, IJobExecutionContext context)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void TriggerMisfired(ITrigger trigger)
|
||||
{
|
||||
}
|
||||
|
||||
public void TriggerComplete(ITrigger trigger, IJobExecutionContext context,
|
||||
SchedulerInstruction triggerInstructionCode)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Simple task executor that tracks invocation count.
|
||||
/// </summary>
|
||||
@@ -1107,9 +976,10 @@ namespace Spring.Scheduling.Quartz
|
||||
/// applied as object property values by execute. The contract is
|
||||
/// exactly the same as for the standard Quartz execute method.
|
||||
/// </summary>
|
||||
protected override void ExecuteInternal(IJobExecutionContext jobExecutionContext)
|
||||
protected override Task ExecuteInternal(IJobExecutionContext jobExecutionContext)
|
||||
{
|
||||
count++;
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1125,10 +995,11 @@ namespace Spring.Scheduling.Quartz
|
||||
/// <summary>
|
||||
/// Runs thread runnable.
|
||||
/// </summary>
|
||||
public void Run()
|
||||
public Task Run()
|
||||
{
|
||||
count++;
|
||||
runEvent.Set();
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1158,9 +1029,10 @@ namespace Spring.Scheduling.Quartz
|
||||
/// Executes this job instance.
|
||||
///</summary>
|
||||
///<param name="jobExecutionContext"></param>
|
||||
public void Execute(IJobExecutionContext jobExecutionContext)
|
||||
public Task Execute(IJobExecutionContext jobExecutionContext)
|
||||
{
|
||||
count++;
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,8 @@ using System.Collections.Specialized;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using FakeItEasy;
|
||||
|
||||
using NUnit.Framework;
|
||||
@@ -87,7 +88,7 @@ namespace Spring.Scheduling.Quartz
|
||||
factory.AutoStartup = false;
|
||||
factory.AfterPropertiesSet();
|
||||
|
||||
A.CallTo(() => TestSchedulerFactory.MockScheduler.Start()).MustNotHaveHappened();
|
||||
A.CallTo(() => TestSchedulerFactory.MockScheduler.Start(A<CancellationToken>._)).MustNotHaveHappened();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -106,7 +107,7 @@ namespace Spring.Scheduling.Quartz
|
||||
|
||||
factory.AfterPropertiesSet();
|
||||
|
||||
A.CallTo(() => TestSchedulerFactory.MockScheduler.AddCalendar(calendarName, cal, true, true)).MustHaveHappened();
|
||||
A.CallTo(() => TestSchedulerFactory.MockScheduler.AddCalendar(calendarName, cal, true, true, A<CancellationToken>._)).MustHaveHappened();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -122,7 +123,7 @@ namespace Spring.Scheduling.Quartz
|
||||
SimpleTriggerImpl trigger = new SimpleTriggerImpl(TRIGGER_NAME, TRIGGER_GROUP);
|
||||
factory.Triggers = new ITrigger[] { trigger };
|
||||
|
||||
A.CallTo(() => TestSchedulerFactory.MockScheduler.GetTrigger(new TriggerKey(TRIGGER_NAME, TRIGGER_GROUP))).Returns(trigger);
|
||||
A.CallTo(() => TestSchedulerFactory.MockScheduler.GetTrigger(new TriggerKey(TRIGGER_NAME, TRIGGER_GROUP), A<CancellationToken>._)).Returns(trigger);
|
||||
|
||||
factory.AfterPropertiesSet();
|
||||
}
|
||||
@@ -134,7 +135,7 @@ namespace Spring.Scheduling.Quartz
|
||||
public void TestAfterPropertiesSet_Trigger_TriggerDoesntExist()
|
||||
{
|
||||
InitForAfterPropertiesSetTest();
|
||||
A.CallTo(() => TestSchedulerFactory.MockScheduler.GetTrigger(A<TriggerKey>._)).Returns(null);
|
||||
A.CallTo(() => TestSchedulerFactory.MockScheduler.GetTrigger(A<TriggerKey>._, A<CancellationToken>._)).Returns(Task.FromResult<ITrigger>(null));
|
||||
|
||||
const string TRIGGER_NAME = "trigName";
|
||||
const string TRIGGER_GROUP = "trigGroup";
|
||||
@@ -143,7 +144,7 @@ namespace Spring.Scheduling.Quartz
|
||||
|
||||
factory.AfterPropertiesSet();
|
||||
|
||||
A.CallTo(() => TestSchedulerFactory.MockScheduler.ScheduleJob(trigger)).MustHaveHappened();
|
||||
A.CallTo(() => TestSchedulerFactory.MockScheduler.ScheduleJob(trigger, A<CancellationToken>._)).MustHaveHappened();
|
||||
}
|
||||
|
||||
|
||||
@@ -159,38 +160,38 @@ namespace Spring.Scheduling.Quartz
|
||||
/// Tests AfterPropertiesSet behavior.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestStart()
|
||||
public async Task TestStart()
|
||||
{
|
||||
factory.SchedulerFactoryType = typeof(TestSchedulerFactory);
|
||||
factory.AutoStartup = false;
|
||||
factory.AfterPropertiesSet();
|
||||
factory.Start();
|
||||
await factory.Start();
|
||||
|
||||
A.CallTo(TestSchedulerFactory.MockScheduler)
|
||||
.Where(x => x.Method.Name.Equals("set_JobFactory"))
|
||||
.WhenArgumentsMatch(x => x.Get<IJobFactory>(0) != null)
|
||||
.MustHaveHappened();
|
||||
|
||||
A.CallTo(() => TestSchedulerFactory.MockScheduler.Start()).MustHaveHappened();
|
||||
A.CallTo(() => TestSchedulerFactory.MockScheduler.Start(A<CancellationToken>._)).MustHaveHappened();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests AfterPropertiesSet behavior.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestStop()
|
||||
public async Task TestStop()
|
||||
{
|
||||
factory.SchedulerFactoryType = typeof(TestSchedulerFactory);
|
||||
factory.AutoStartup = false;
|
||||
factory.AfterPropertiesSet();
|
||||
factory.Stop();
|
||||
await factory.Stop();
|
||||
|
||||
A.CallTo(TestSchedulerFactory.MockScheduler)
|
||||
.Where(x => x.Method.Name.Equals("set_JobFactory"))
|
||||
.WhenArgumentsMatch(x => x.Get<IJobFactory>(0) != null)
|
||||
.MustHaveHappened();
|
||||
|
||||
A.CallTo(() => TestSchedulerFactory.MockScheduler.Standby()).MustHaveHappened();
|
||||
A.CallTo(() => TestSchedulerFactory.MockScheduler.Standby(A<CancellationToken>._)).MustHaveHappened();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -284,34 +285,23 @@ ConnectionStringKey+ " = " + ConnectionStringValue + Environment.NewLine +
|
||||
/// <summary>
|
||||
/// The mocked scheduler.
|
||||
/// </summary>
|
||||
public static IScheduler MockScheduler
|
||||
public static IScheduler MockScheduler => mockScheduler;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<IScheduler> GetScheduler(CancellationToken _)
|
||||
{
|
||||
get { return mockScheduler; }
|
||||
return Task.FromResult(mockScheduler);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///</summary>
|
||||
///<returns></returns>
|
||||
public IScheduler GetScheduler()
|
||||
/// <inheritdoc />
|
||||
public Task<IScheduler> GetScheduler(string schedName, CancellationToken _)
|
||||
{
|
||||
return mockScheduler;
|
||||
return Task.FromResult(mockScheduler);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///</summary>
|
||||
///<param name="schedName"></param>
|
||||
///<returns></returns>
|
||||
public IScheduler GetScheduler(string schedName)
|
||||
{
|
||||
return mockScheduler;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///</summary>
|
||||
public ICollection<IScheduler> AllSchedulers
|
||||
{
|
||||
get { return new List<IScheduler>(); }
|
||||
}
|
||||
/// <inheritdoc />
|
||||
public Task<IReadOnlyList<IScheduler>> GetAllSchedulers(CancellationToken _)
|
||||
=> Task.FromResult<IReadOnlyList<IScheduler>>(new List<IScheduler>());
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
@@ -326,21 +316,15 @@ ConnectionStringKey+ " = " + ConnectionStringValue + Environment.NewLine +
|
||||
{
|
||||
private NameValueCollection properties;
|
||||
|
||||
///<summary>
|
||||
/// Initializes the factory.
|
||||
///</summary>
|
||||
///<param name="props"></param>
|
||||
/// <inheritdoc />
|
||||
public override void Initialize(NameValueCollection props)
|
||||
{
|
||||
this.properties = props;
|
||||
properties = props;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return propeties given to this factory at initialization time.
|
||||
/// </summary>
|
||||
public NameValueCollection Properties
|
||||
{
|
||||
get { return properties; }
|
||||
}
|
||||
public NameValueCollection Properties => properties;
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,6 @@ using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
|
||||
using Quartz.Impl;
|
||||
using Quartz.Job;
|
||||
|
||||
namespace Spring.Scheduling.Quartz
|
||||
{
|
||||
@@ -15,12 +15,11 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
using Quartz;
|
||||
using Quartz.Impl.Triggers;
|
||||
using Quartz.Job;
|
||||
using Quartz.Spi;
|
||||
|
||||
namespace Spring.Scheduling.Quartz
|
||||
@@ -95,31 +94,28 @@ namespace Spring.Scheduling.Quartz
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class NoOpJob : IJob
|
||||
{
|
||||
public Task Execute(IJobExecutionContext context)
|
||||
{
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test job object that has injectable properties
|
||||
/// </summary>
|
||||
public class InjectableJob : NoOpJob
|
||||
{
|
||||
private int number;
|
||||
private string foo;
|
||||
|
||||
/// <summary>
|
||||
/// Simple int property.
|
||||
/// </summary>
|
||||
public int Number
|
||||
{
|
||||
get { return number; }
|
||||
set { number = value; }
|
||||
}
|
||||
public int Number { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Simple string property.
|
||||
/// </summary>
|
||||
public string Foo
|
||||
{
|
||||
get { return foo; }
|
||||
set { foo = value; }
|
||||
}
|
||||
public string Foo { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,7 @@ namespace Spring.Scheduling.Quartz
|
||||
public static TriggerFiredBundle CreateMinimalFiredBundleWithTypedJobDetail(Type jobType, IOperableTrigger trigger)
|
||||
{
|
||||
IJobDetail jd = new JobDetailImpl("jobName", "jobGroup", jobType);
|
||||
TriggerFiredBundle bundle = new TriggerFiredBundle(jd, trigger, null, false, null, null, null, null);
|
||||
TriggerFiredBundle bundle = new TriggerFiredBundle(jd, trigger, null, false, DateTimeOffset.UtcNow, null, null, null);
|
||||
return bundle;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net452</TargetFramework>
|
||||
<TargetFrameworks>netcoreapp2.1;$(TargetFullFrameworkVersion)</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Core\Spring.Core.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Scheduling.Quartz2\Spring.Scheduling.Quartz2.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Scheduling.Quartz3\Spring.Scheduling.Quartz3.csproj" />
|
||||
<ProjectReference Include="..\Spring.Core.Tests\Spring.Core.Tests.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -13,7 +13,7 @@
|
||||
<job>
|
||||
<name>myJob</name>
|
||||
<group>myGroup</group>
|
||||
<job-type>Spring.Scheduling.Quartz.DummyJob, Spring.Scheduling.Quartz2.Tests</job-type>
|
||||
<job-type>Spring.Scheduling.Quartz.DummyJob, Spring.Scheduling.Quartz3.Tests</job-type>
|
||||
<durable>true</durable>
|
||||
<recover>false</recover>
|
||||
<job-data-map>
|
||||
@@ -4,7 +4,7 @@
|
||||
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.Quartz2">
|
||||
<object id="scheduler" type="Spring.Scheduling.Quartz.SchedulerFactoryObject, Spring.Scheduling.Quartz3">
|
||||
<property name="Triggers">
|
||||
<list>
|
||||
<ref local="exportTrigger"/>
|
||||
@@ -14,9 +14,9 @@
|
||||
</property>
|
||||
</object>
|
||||
|
||||
<object id="exportTrigger" type="Spring.Scheduling.Quartz.SimpleTriggerObject, Spring.Scheduling.Quartz2">
|
||||
<object id="exportTrigger" type="Spring.Scheduling.Quartz.SimpleTriggerObject, Spring.Scheduling.Quartz3">
|
||||
<property name="JobDetail">
|
||||
<object type="Spring.Scheduling.Quartz.MethodInvokingJobDetailFactoryObject, Spring.Scheduling.Quartz2">
|
||||
<object type="Spring.Scheduling.Quartz.MethodInvokingJobDetailFactoryObject, Spring.Scheduling.Quartz3">
|
||||
<property name="TargetObject" ref="exportService"/>
|
||||
<property name="TargetMethod" value="DoExport"/>
|
||||
</object>
|
||||
@@ -26,9 +26,9 @@
|
||||
<property name="RepeatCount" value="1"/>
|
||||
</object>
|
||||
|
||||
<object id="importTrigger" type="Spring.Scheduling.Quartz.SimpleTriggerObject, Spring.Scheduling.Quartz2">
|
||||
<object id="importTrigger" type="Spring.Scheduling.Quartz.SimpleTriggerObject, Spring.Scheduling.Quartz3">
|
||||
<property name="JobDetail">
|
||||
<object type="Spring.Scheduling.Quartz.MethodInvokingJobDetailFactoryObject, Spring.Scheduling.Quartz2">
|
||||
<object type="Spring.Scheduling.Quartz.MethodInvokingJobDetailFactoryObject, Spring.Scheduling.Quartz3">
|
||||
<property name="TargetObject" ref="importService"/>
|
||||
|
||||
<property name="TargetMethod" value="DoImport"/>
|
||||
@@ -38,8 +38,8 @@
|
||||
<property name="RepeatCount" value="1"/>
|
||||
</object>
|
||||
|
||||
<object id="exportService" type="Spring.Scheduling.Quartz.QuartzTestObject, Spring.Scheduling.Quartz2.Tests"/>
|
||||
<object id="exportService" type="Spring.Scheduling.Quartz.QuartzTestObject, Spring.Scheduling.Quartz3.Tests"/>
|
||||
|
||||
<object id="importService" type="Spring.Scheduling.Quartz.QuartzTestObject, Spring.Scheduling.Quartz2.Tests"/>
|
||||
<object id="importService" type="Spring.Scheduling.Quartz.QuartzTestObject, Spring.Scheduling.Quartz3.Tests"/>
|
||||
|
||||
</objects>
|
||||
@@ -5,11 +5,11 @@
|
||||
xsi:schemaLocation="http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd">
|
||||
|
||||
|
||||
<object id="scheduler1" type="Spring.Scheduling.Quartz.SchedulerFactoryObject, Spring.Scheduling.Quartz2">
|
||||
<object id="scheduler1" type="Spring.Scheduling.Quartz.SchedulerFactoryObject, Spring.Scheduling.Quartz3">
|
||||
<property name="SchedulerName" value="quartz1"/>
|
||||
</object>
|
||||
|
||||
<object id="scheduler2" type="Spring.Scheduling.Quartz.SchedulerFactoryObject, Spring.Scheduling.Quartz2">
|
||||
<object id="scheduler2" type="Spring.Scheduling.Quartz.SchedulerFactoryObject, Spring.Scheduling.Quartz3">
|
||||
<property name="SchedulerName" value="quartz2"/>
|
||||
</object>
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
xsi:schemaLocation="http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd">
|
||||
|
||||
|
||||
<object id="scheduler" type="Spring.Scheduling.Quartz.SchedulerFactoryObject, Spring.Scheduling.Quartz2"/>
|
||||
<object id="scheduler" type="Spring.Scheduling.Quartz.SchedulerFactoryObject, Spring.Scheduling.Quartz3"/>
|
||||
|
||||
<object type="Spring.Scheduling.Quartz.SchedulerAccessorObject, Spring.Scheduling.Quartz2">
|
||||
<object type="Spring.Scheduling.Quartz.SchedulerAccessorObject, Spring.Scheduling.Quartz3">
|
||||
<property name="Scheduler" ref="scheduler"/>
|
||||
<property name="Triggers">
|
||||
<list>
|
||||
@@ -18,9 +18,9 @@
|
||||
</property>
|
||||
</object>
|
||||
|
||||
<object id="exportTrigger" type="Spring.Scheduling.Quartz.SimpleTriggerObject, Spring.Scheduling.Quartz2">
|
||||
<object id="exportTrigger" type="Spring.Scheduling.Quartz.SimpleTriggerObject, Spring.Scheduling.Quartz3">
|
||||
<property name="JobDetail">
|
||||
<object type="Spring.Scheduling.Quartz.MethodInvokingJobDetailFactoryObject, Spring.Scheduling.Quartz2">
|
||||
<object type="Spring.Scheduling.Quartz.MethodInvokingJobDetailFactoryObject, Spring.Scheduling.Quartz3">
|
||||
<property name="TargetObject" ref="exportService"/>
|
||||
<property name="TargetMethod" value="DoExport"/>
|
||||
</object>
|
||||
@@ -29,10 +29,10 @@
|
||||
<property name="RepeatCount" value="1"/>
|
||||
</object>
|
||||
|
||||
<object id="importTrigger" type="Spring.Scheduling.Quartz.SimpleTriggerObject, Spring.Scheduling.Quartz2">
|
||||
<object id="importTrigger" type="Spring.Scheduling.Quartz.SimpleTriggerObject, Spring.Scheduling.Quartz3">
|
||||
<property name="jobDetail">
|
||||
|
||||
<object type="Spring.Scheduling.Quartz.MethodInvokingJobDetailFactoryObject, Spring.Scheduling.Quartz2">
|
||||
<object type="Spring.Scheduling.Quartz.MethodInvokingJobDetailFactoryObject, Spring.Scheduling.Quartz3">
|
||||
<property name="TargetObject" ref="importService"/>
|
||||
<property name="TargetMethod" value="DoImport"/>
|
||||
</object>
|
||||
@@ -41,8 +41,8 @@
|
||||
<property name="RepeatCount" value="1"/>
|
||||
</object>
|
||||
|
||||
<object id="exportService" type="Spring.Scheduling.Quartz.QuartzTestObject, Spring.Scheduling.Quartz2.Tests"/>
|
||||
<object id="exportService" type="Spring.Scheduling.Quartz.QuartzTestObject, Spring.Scheduling.Quartz3.Tests"/>
|
||||
|
||||
<object id="importService" type="Spring.Scheduling.Quartz.QuartzTestObject, Spring.Scheduling.Quartz2.Tests"/>
|
||||
<object id="importService" type="Spring.Scheduling.Quartz.QuartzTestObject, Spring.Scheduling.Quartz3.Tests"/>
|
||||
|
||||
</objects>
|
||||
@@ -5,12 +5,12 @@
|
||||
xsi:schemaLocation="http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd">
|
||||
|
||||
|
||||
<object id="scheduler" type="Spring.Scheduling.Quartz.SchedulerFactoryObject, Spring.Scheduling.Quartz2">
|
||||
<object id="scheduler" type="Spring.Scheduling.Quartz.SchedulerFactoryObject, Spring.Scheduling.Quartz3">
|
||||
<property name="schedulerName" value="myScheduler"/>
|
||||
<property name="exposeSchedulerInRepository" value="true"/>
|
||||
</object>
|
||||
|
||||
<object type="Spring.Scheduling.Quartz.SchedulerAccessorObject, Spring.Scheduling.Quartz2">
|
||||
<object type="Spring.Scheduling.Quartz.SchedulerAccessorObject, Spring.Scheduling.Quartz3">
|
||||
<property name="schedulerName" value="myScheduler"/>
|
||||
|
||||
<property name="triggers">
|
||||
@@ -21,10 +21,10 @@
|
||||
</property>
|
||||
</object>
|
||||
|
||||
<object id="exportTrigger" type="Spring.Scheduling.Quartz.SimpleTriggerObject, Spring.Scheduling.Quartz2">
|
||||
<object id="exportTrigger" type="Spring.Scheduling.Quartz.SimpleTriggerObject, Spring.Scheduling.Quartz3">
|
||||
|
||||
<property name="JobDetail">
|
||||
<object type="Spring.Scheduling.Quartz.MethodInvokingJobDetailFactoryObject, Spring.Scheduling.Quartz2">
|
||||
<object type="Spring.Scheduling.Quartz.MethodInvokingJobDetailFactoryObject, Spring.Scheduling.Quartz3">
|
||||
<property name="TargetObject" ref="exportService"/>
|
||||
<property name="TargetMethod" value="DoExport"/>
|
||||
</object>
|
||||
@@ -33,9 +33,9 @@
|
||||
<property name="RepeatCount" value="1"/>
|
||||
</object>
|
||||
|
||||
<object id="importTrigger" type="Spring.Scheduling.Quartz.SimpleTriggerObject, Spring.Scheduling.Quartz2">
|
||||
<object id="importTrigger" type="Spring.Scheduling.Quartz.SimpleTriggerObject, Spring.Scheduling.Quartz3">
|
||||
<property name="jobDetail">
|
||||
<object type="Spring.Scheduling.Quartz.MethodInvokingJobDetailFactoryObject, Spring.Scheduling.Quartz2">
|
||||
<object type="Spring.Scheduling.Quartz.MethodInvokingJobDetailFactoryObject, Spring.Scheduling.Quartz3">
|
||||
<property name="TargetObject" ref="importService"/>
|
||||
<property name="TargetMethod" value="DoImport"/>
|
||||
</object>
|
||||
@@ -45,8 +45,8 @@
|
||||
<property name="RepeatCount" value="1"/>
|
||||
</object>
|
||||
|
||||
<object id="exportService" type="Spring.Scheduling.Quartz.QuartzTestObject, Spring.Scheduling.Quartz2.Tests"/>
|
||||
<object id="exportService" type="Spring.Scheduling.Quartz.QuartzTestObject, Spring.Scheduling.Quartz3.Tests"/>
|
||||
|
||||
<object id="importService" type="Spring.Scheduling.Quartz.QuartzTestObject, Spring.Scheduling.Quartz2.Tests"/>
|
||||
<object id="importService" type="Spring.Scheduling.Quartz.QuartzTestObject, Spring.Scheduling.Quartz3.Tests"/>
|
||||
|
||||
</objects>
|
||||
Reference in New Issue
Block a user