private async Task RunAdoJobStoreTest( string dbProvider, string connectionStringId, string serializerType, NameValueCollection extraProperties, bool clustered = true) { var config = SchedulerBuilder.Create("instance_one", "TestScheduler"); config.UseDefaultThreadPool(x => { x.MaxConcurrency = 10; }); config.MisfireThreshold = TimeSpan.FromSeconds(60); config.UsePersistentStore(store => { store.UseProperties = false; if (clustered) { store.UseClustering(c => { c.CheckinInterval = TimeSpan.FromMilliseconds(1000); }); } store.UseGenericDatabase(dbProvider, db => db.ConnectionString = dbConnectionStrings[connectionStringId] ); if (serializerType == "json") { store.UseJsonSerializer(); } else { store.UseBinarySerializer(); } }); if (extraProperties != null) { foreach (string key in extraProperties.Keys) { config.SetProperty(key, extraProperties[key]); } } // Clear any old errors from the log FailFastLoggerFactoryAdapter.Errors.Clear(); // First we must get a reference to a scheduler IScheduler sched = await config.BuildScheduler(); SmokeTestPerformer performer = new SmokeTestPerformer(); await performer.Test(sched, clearJobs, scheduleJobs); Assert.IsEmpty(FailFastLoggerFactoryAdapter.Errors, "Found error from logging output"); }
private async Task RunAdoJobStoreTest( string dbProvider, string connectionStringId, string serializerType, NameValueCollection extraProperties) { NameValueCollection properties = new NameValueCollection(); properties["quartz.scheduler.instanceName"] = "TestScheduler"; properties["quartz.scheduler.instanceId"] = "instance_one"; properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz"; properties["quartz.threadPool.threadCount"] = "10"; properties["quartz.jobStore.misfireThreshold"] = "60000"; properties["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz"; properties["quartz.jobStore.driverDelegateType"] = "Quartz.Impl.AdoJobStore.StdAdoDelegate, Quartz"; properties["quartz.jobStore.useProperties"] = "false"; properties["quartz.jobStore.dataSource"] = "default"; properties["quartz.jobStore.tablePrefix"] = "QRTZ_"; properties["quartz.jobStore.clustered"] = clustered.ToString(); properties["quartz.jobStore.clusterCheckinInterval"] = 1000.ToString(); properties["quartz.serializer.type"] = serializerType; if (extraProperties != null) { foreach (string key in extraProperties.Keys) { properties[key] = extraProperties[key]; } } if (connectionStringId == "SQLite") { // if running SQLite we need this, SQL Server is sniffed automatically properties["quartz.jobStore.lockHandler.type"] = "Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz"; } string connectionString; if (!dbConnectionStrings.TryGetValue(connectionStringId, out connectionString)) { throw new Exception("Unknown connection string id: " + connectionStringId); } properties["quartz.dataSource.default.connectionString"] = connectionString; properties["quartz.dataSource.default.provider"] = dbProvider; // Clear any old errors from the log FailFastLoggerFactoryAdapter.Errors.Clear(); // First we must get a reference to a scheduler ISchedulerFactory sf = new StdSchedulerFactory(properties); IScheduler sched = await sf.GetScheduler(); SmokeTestPerformer performer = new SmokeTestPerformer(); await performer.Test(sched, clearJobs, scheduleJobs); Assert.IsEmpty(FailFastLoggerFactoryAdapter.Errors, "Found error from logging output"); }
private async Task RunAdoJobStoreTest( string dbProvider, string connectionStringId, string serializerType, NameValueCollection extraProperties, bool clustered = true) { var builder = SchedulerBuilder.Create("instance_one", "TestScheduler") .WithDefaultThreadPool(x => x.WithThreadCount(10)) .WithMisfireThreshold(TimeSpan.FromSeconds(60)) .UsePersistentStore(store => { var x = store .UseProperties(false) .Clustered(clustered, options => options.WithCheckinInterval(TimeSpan.FromMilliseconds(1000))) .UseGenericDatabase(dbProvider, db => db.WithConnectionString(dbConnectionStrings[connectionStringId])); x = serializerType == "json" ? x.WithJsonSerializer() : x.WithBinarySerializer(); }); if (extraProperties != null) { foreach (string key in extraProperties.Keys) { builder.SetProperty(key, extraProperties[key]); } } // Clear any old errors from the log FailFastLoggerFactoryAdapter.Errors.Clear(); // First we must get a reference to a scheduler IScheduler sched = await builder.Build(); SmokeTestPerformer performer = new SmokeTestPerformer(); await performer.Test(sched, clearJobs, scheduleJobs); Assert.IsEmpty(FailFastLoggerFactoryAdapter.Errors, "Found error from logging output"); }
private void RunAdoJobStoreTest(string dbProvider, string connectionStringId, NameValueCollection extraProperties) { NameValueCollection properties = new NameValueCollection(); properties["quartz.scheduler.instanceName"] = "TestScheduler"; properties["quartz.scheduler.instanceId"] = "instance_one"; properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz"; properties["quartz.threadPool.threadCount"] = "10"; properties["quartz.threadPool.threadPriority"] = "Normal"; properties["quartz.jobStore.misfireThreshold"] = "60000"; properties["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz"; properties["quartz.jobStore.driverDelegateType"] = "Quartz.Impl.AdoJobStore.StdAdoDelegate, Quartz"; properties["quartz.jobStore.useProperties"] = "false"; properties["quartz.jobStore.dataSource"] = "default"; properties["quartz.jobStore.tablePrefix"] = "QRTZ_"; properties["quartz.jobStore.clustered"] = clustered.ToString(); properties["quartz.jobStore.clusterCheckinInterval"] = 1000.ToString(); if (extraProperties != null) { foreach (string key in extraProperties.Keys) { properties[key] = extraProperties[key]; } } if (connectionStringId == "SQLite") { // if running SQLite we need this, SQL Server is sniffed automatically properties["quartz.jobStore.lockHandler.type"] = "Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz"; } string connectionString; if (!dbConnectionStrings.TryGetValue(connectionStringId, out connectionString)) { throw new Exception("Unknown connection string id: " + connectionStringId); } properties["quartz.dataSource.default.connectionString"] = connectionString; properties["quartz.dataSource.default.provider"] = dbProvider; // First we must get a reference to a scheduler ISchedulerFactory sf = new StdSchedulerFactory(properties); IScheduler sched = sf.GetScheduler(); SmokeTestPerformer performer = new SmokeTestPerformer(); performer.Test(sched, clearJobs, scheduleJobs); }