Delegate connection handling to Spring, still problems..

This commit is contained in:
lahma
2008-07-31 20:37:10 +00:00
parent 0c1ab68f93
commit 9fc7a53f03
13 changed files with 782 additions and 79 deletions

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.Quartz.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.Quartz">
<property name="AutoStartup" value="true" />
<property name="StartupDelay" value="5" />
<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.Quartz">
<property name="JobType" value="Spring.Scheduling.Quartz.Integration.Tests.TestJob, Spring.Scheduling.Quartz.Integration.Tests" />
</object>
<object id="simpleTrigger" type="Spring.Scheduling.Quartz.SimpleTriggerObject, Spring.Scheduling.Quartz">
<!-- see the example of method invoking job above -->
<property name="jobDetail" ref="testJob" />
<!-- 2 seconds -->
<property name="startDelay" value="2" />
<!-- repeat every 3 seconds -->
<property name="repeatInterval" value="3000" />
</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(JobExecutionContext context)
{
Console.WriteLine("Executing Execute!");
}
public void DoIt()
{
Console.WriteLine("Executing DoIt!");
}
}
}

View File

@@ -0,0 +1,170 @@
<VisualStudioProject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.10.6030"
SchemaVersion = "2.0"
ProjectGuid = "{ED644EA8-B6AE-457C-BF32-516DAE541FAC}"
>
<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyContainerName = ""
AssemblyName = "Spring.Scheduling.Quartz.Integration.Tests"
AssemblyOriginatorKeyFile = ""
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "Library"
PreBuildEvent = ""
PostBuildEvent = ""
RootNamespace = "Spring"
RunPostBuildEvent = "OnBuildSuccess"
StartupObject = ""
>
<Config
Name = "Debug"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "DEBUG;TRACE"
DocumentationFile = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuild = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "false"
OutputPath = "..\..\..\build\VS.NET.2003\Spring.Scheduling.Quartz.Integration.Tests\Debug\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "TRACE"
DocumentationFile = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuild = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "true"
OutputPath = "..\..\..\build\VS.NET.2003\Spring.Scheduling.Quartz.Integration.Tests\Release\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
/>
<Reference
Name = "System.Data"
AssemblyName = "System.Data"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
/>
<Reference
Name = "System.XML"
AssemblyName = "System.Xml"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
/>
<Reference
Name = "Spring.Scheduling.Quartz.2003"
Project = "{0C0D8C65-90DE-4914-9940-4C684C54971B}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
<Reference
Name = "Spring.Core"
AssemblyName = "Spring.Core"
HintPath = "..\..\..\lib\net\1.1\Spring.Core.dll"
/>
<Reference
Name = "nunit.framework"
AssemblyName = "nunit.framework"
HintPath = "..\..\..\lib\net\1.1\nunit.framework.dll"
/>
<Reference
Name = "Quartz"
AssemblyName = "Quartz"
HintPath = "..\..\..\lib\net\1.1\Quartz.dll"
/>
<Reference
Name = "Nullables"
AssemblyName = "Nullables"
HintPath = "..\..\..\lib\net\1.1\Nullables.dll"
/>
<Reference
Name = "Rhino.Mocks"
AssemblyName = "Rhino.Mocks"
HintPath = "..\..\..\lib\net\1.1\Rhino.Mocks.dll"
/>
</References>
</Build>
<Files>
<Include>
<File
RelPath = "Scheduling\Quartz\AdaptableJobFactoryTest.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "Scheduling\Quartz\CronTriggerObjectTest.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "Scheduling\Quartz\JobDetailObjectTest.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "Scheduling\Quartz\MethodInvokingJobDetailFactoryObjectTest.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "Scheduling\Quartz\MethodInvokingJobTest.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "Scheduling\Quartz\SchedulerFactoryObjectTest.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "Scheduling\Quartz\SimpleTriggerObjectTest.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "Scheduling\Quartz\SpringObjectJobFactoryTest.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "Scheduling\Quartz\TestUtil.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "Scheduling\Quartz\TriggerObjectTest.cs"
SubType = "Code"
BuildAction = "Compile"
/>
</Include>
</Files>
</CSHARP>
</VisualStudioProject>

View File

@@ -0,0 +1,82 @@
<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>8.0.50727</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>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\build\VS.NET.2005\Spring.Scheduling.Quartz.Integration.Tests\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;NET_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.2005\Spring.Scheduling.Quartz.Integration.Tests\Release\</OutputPath>
<DefineConstants>TRACE;NET_2_0</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=0.7.0.15571, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\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.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\src\Spring\Spring.Core\Spring.Core.2005.csproj">
<Project>{710961A3-0DF4-49E4-A26E-F5B9C044AC84}</Project>
<Name>Spring.Core.2005</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\src\Spring\Spring.Scheduling.Quartz\Spring.Scheduling.Quartz.2005.csproj">
<Project>{E823D54C-CE82-4868-929F-5F95A999F61E}</Project>
<Name>Spring.Scheduling.Quartz.2005</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Spring.Scheduling.Quartz.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>
<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,60 @@
<?xml version="1.0" ?>
<project name="Spring.Scheduling.Quartz.Integration.Tests" default="build" xmlns="http://nant.sf.net/schemas/nant.xsd">
<!--
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"
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">
<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,52 @@
<?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>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<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"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>