Update of /cvsroot/springnet/Spring.Net.Integration/projects/Spring.Scheduling.Quartz/test/Spring/Spring.Scheduling.Quartz.Tests/Scheduling/Quartz
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv32712
Added Files:
AdaptableJobFactoryTest.cs
Log Message:
Added missing files, joys of CVS
--- NEW FILE: AdaptableJobFactoryTest.cs ---
/*
* Copyright 2002-2005 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 NUnit.Framework;
using Quartz;
using Quartz.Job;
using Quartz.Spi;
using Spring.Scheduling.Quartz;
namespace Spring
{
/// <summary>
/// Tests for <see cref="AdaptableJobFactory" />.
/// </summary>
[TestFixture]
public class AdaptableJobFactoryTest
{
private AdaptableJobFactory jobFactory;
[SetUp]
public void SetUp()
{
jobFactory = new AdaptableJobFactory();
}
[Test]
public void TestNewJob_IncompatibleJob()
{
try
{
// this actually fails already in Quartz level
TriggerFiredBundle bundle = CreateMinimalFiredBundleWithTypedJobDetail(typeof(object));
jobFactory.NewJob(bundle);
Assert.Fail("Created job which was not an IJob");
}
catch (ArgumentException)
{
// ok
}
catch (SchedulerException)
{
// ok
}
catch (Exception)
{
Assert.Fail("Got exception that was not instance of SchedulerException or ArgumentException");
}
}
[Test]
public void TestNewJob_ThreadStartJob()
{
// TODO ThreadStart is not the way to go
}
[Test]
public void TestNewJob_NormalIJob()
{
TriggerFiredBundle bundle = CreateMinimalFiredBundleWithTypedJobDetail(typeof(NoOpJob));
IJob job = jobFactory.NewJob(bundle);
Assert.IsNotNull(job, "Returned job was null");
}
/// <summary>
/// Creates the minimal fired bundle with job detail that has
/// given job type.
/// </summary>
/// <param name="jobType">Type of the job.</param>
/// <returns>Minimal TriggerFiredBundle</returns>
private static TriggerFiredBundle CreateMinimalFiredBundleWithTypedJobDetail(Type jobType)
{
JobDetail jd = new JobDetail("jobName", "jobGroup", jobType);
TriggerFiredBundle bundle = new TriggerFiredBundle(jd, null, null, false, null, null, null, null);
return bundle;
}
}
internal class NoOpThreadStartJob : NoOpJob
{
public void Execute()
{
Execute(null);
}
}
}
|