diff --git a/LICENSE b/LICENSE index c210cf0..da90b3b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,9 @@ MIT License -Copyright (c) 2018 Jan Lucansky +Copyright (c) 2018-2019 Jan Lucansky +Copyright (c) 2019 mukmyash +Copyright (c) 2019-2020 Yanhong Ma + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Quartzmin.sln b/Quartzmin.sln index 404c00f..58f28e6 100644 --- a/Quartzmin.sln +++ b/Quartzmin.sln @@ -11,6 +11,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Quartz.Plugins.RecentHistor EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNetCore31", "sample\AspNetCore31\AspNetCore31.csproj", "{98365304-B53D-4A09-91BB-A709BC330511}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F77F2A7C-C844-4DEE-B797-67AB09655FC1}" + ProjectSection(SolutionItems) = preProject + .dockerignore = .dockerignore + .gitattributes = .gitattributes + .gitignore = .gitignore + .travis.yml = .travis.yml + LICENSE = LICENSE + README.md = README.md + EndProjectSection +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SilkierQuartz.Test", "test\QuartzHostedService.Test\SilkierQuartz.Test.csproj", "{185EF4D4-EE0C-4365-B465-0D3021949592}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -29,6 +41,10 @@ Global {98365304-B53D-4A09-91BB-A709BC330511}.Debug|Any CPU.Build.0 = Debug|Any CPU {98365304-B53D-4A09-91BB-A709BC330511}.Release|Any CPU.ActiveCfg = Release|Any CPU {98365304-B53D-4A09-91BB-A709BC330511}.Release|Any CPU.Build.0 = Release|Any CPU + {185EF4D4-EE0C-4365-B465-0D3021949592}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {185EF4D4-EE0C-4365-B465-0D3021949592}.Debug|Any CPU.Build.0 = Debug|Any CPU + {185EF4D4-EE0C-4365-B465-0D3021949592}.Release|Any CPU.ActiveCfg = Release|Any CPU + {185EF4D4-EE0C-4365-B465-0D3021949592}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/README.md b/README.md index c84d93c..59f7e24 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,23 @@ -

- -

---- -[![NuGet](https://img.shields.io/nuget/v/QuartzminFork.svg)](https://www.nuget.org/packages/QuartzminFork) +[![NuGet](https://img.shields.io/nuget/v/SilkierQuartz.svg)](https://www.nuget.org/packages/SilkierQuartz) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE) -QuartzminFork is fork from Quartzmin! - - -Quartzmin is powerful, easy to use web management tool for Quartz.NET - -Quartzmin can be used within your existing application with minimum effort as a Quartz.NET plugin when it automatically creates embedded web server. Or it can be plugged into your existing OWIN-based web application as a middleware. +SilkierQuartz is a new after merging [Quartzmin](https://github.com/jlucansky/Quartzmin) and [QuartzHostedService](https://github.com/mukmyash/QuartzHostedService)! > [Quartz.NET](https://www.quartz-scheduler.net) is a full-featured, open source job scheduling system that can be used from smallest apps to large scale enterprise systems. + +> [Quartzmin](https://github.com/jlucansky/Quartzmin) Quartzmin is powerful, easy to use web management tool for Quartz.NET + +> [QuartzHostedService](https://github.com/mukmyash/QuartzHostedService) QuartzHostedService is easy to host Quartz as service in .Net Core ! + + +So + +SilkierQuartz can be used within your existing application with minimum effort as a Quartz.NET plugin when it automatically creates embedded web server. Or it can be plugged into your existing OWIN-based web application as a middleware. + + ![Demo](https://raw.githubusercontent.com/jlucansky/public-assets/master/Quartzmin/demo.gif) The goal of this project is to provide convenient tool to utilize most of the functionality that Quartz.NET enables. The biggest challenge was to create a simple yet effective editor of job data map which is heart of Quartz.NET. Every job data map item is strongly typed and Quartzmin can be easily extended with a custom editor for your specific type beside standard supported types such as String, Integer, DateTime and so on. @@ -39,51 +41,23 @@ Quartzmin was created with **Semantic UI** and **Handlebars.Net** as the templat - See recent job history, state and error messages ## Install -Quartzmin is available on [nuget.org](https://www.nuget.org/packages/QuartzminFork) +SilkierQuartz is available on [nuget.org](https://www.nuget.org/packages/SilkierQuartz) -To install QuartzminFork, run the following command in the Package Manager Console +To install SilkierQuartz, run the following command in the Package Manager Console ```powershell -PM> Install-Package QuartzminFork +PM> Install-Package SilkierQuartz ``` ## Minimum requirements -- .NET Framework 4.5.2 -- .NET Standard 2.0 - -## Usage -### Embedded web server -Everything you should do is just install [Quartzmin.SelfHost](https://www.nuget.org/packages/Quartzmin.SelfHost) package and configure `QuartzminPlugin` and `ExecutionHistoryPlugin` to support histograms and statistics. - -Run the following command in the Package Manager Console: -```powershell -PM> Install-Package Quartzmin.SelfHost -``` -Add to your `App.config` file: -```xml - - -
- - - - - - - - - - -``` -Start Quartz.NET scheduler somewhere: -```csharp -StdSchedulerFactory.GetDefaultScheduler().Result.Start(); -``` + +- .NET Core 3.1 + ### OWIN middleware Add to your `Startup.cs` file: ```csharp public void Configuration(IAppBuilder app) { - app.UseQuartzmin(new QuartzminOptions() + app.UseSilkierQuartz(new SilkierQuartzOptions() { Scheduler = StdSchedulerFactory.GetDefaultScheduler().Result }); @@ -95,12 +69,12 @@ Add to your `Startup.cs` file: ```csharp public void ConfigureServices(IServiceCollection services) { - services.AddQuartzmin(); + services.AddSilkierQuartz(); } public void Configure(IApplicationBuilder app) { - app.UseQuartzmin(new QuartzminOptions() + app.UseSilkierQuartz(new QuartzminOptions() { Scheduler = StdSchedulerFactory.GetDefaultScheduler().Result }); @@ -108,7 +82,7 @@ public void Configure(IApplicationBuilder app) ``` ## Notes -In clustered environment, it make more sense to host Quarzmin on single dedicated Quartz.NET node in standby mode and implement own `IExecutionHistoryStore` depending on database or ORM framework you typically incorporate. Every clustered Quarz.NET node should be configured with `ExecutionHistoryPlugin` and only dedicated node for management may have `QuartzminPlugin`. +In clustered environment, it make more sense to host SilkierQuartz on single dedicated Quartz.NET node in standby mode and implement own `IExecutionHistoryStore` depending on database or ORM framework you typically incorporate. Every clustered Quarz.NET node should be configured with `ExecutionHistoryPlugin` and only dedicated node for management may have `SilkierQuartzPlugin`. ## License diff --git a/src/Quartzmin/HostedService/IJobRegistrator.cs b/src/Quartzmin/HostedService/IJobRegistrator.cs index cf02fa8..ed1023f 100644 --- a/src/Quartzmin/HostedService/IJobRegistrator.cs +++ b/src/Quartzmin/HostedService/IJobRegistrator.cs @@ -1,6 +1,6 @@ using Microsoft.Extensions.DependencyInjection; -namespace Quartzmin +namespace Quartzmin.HostedService { public interface IJobRegistrator { diff --git a/src/Quartzmin/HostedService/IJobRegistratorExtensions.cs b/src/Quartzmin/HostedService/IJobRegistratorExtensions.cs index f682f00..8d96dd8 100644 --- a/src/Quartzmin/HostedService/IJobRegistratorExtensions.cs +++ b/src/Quartzmin/HostedService/IJobRegistratorExtensions.cs @@ -9,7 +9,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -namespace Quartzmin +namespace Quartzmin.HostedService { public static class IJobRegistratorExtensions { diff --git a/src/Quartzmin/HostedService/IScheduleJob.cs b/src/Quartzmin/HostedService/IScheduleJob.cs index 7ed0e05..6e725b7 100644 --- a/src/Quartzmin/HostedService/IScheduleJob.cs +++ b/src/Quartzmin/HostedService/IScheduleJob.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using Quartz; -namespace Quartzmin +namespace Quartzmin.HostedService { internal interface IScheduleJob { diff --git a/src/Quartzmin/HostedService/IServiceCollectionExtensions.cs b/src/Quartzmin/HostedService/IServiceCollectionExtensions.cs index ad8a96a..dc6aab8 100644 --- a/src/Quartzmin/HostedService/IServiceCollectionExtensions.cs +++ b/src/Quartzmin/HostedService/IServiceCollectionExtensions.cs @@ -9,7 +9,7 @@ using System.Collections.Generic; using System.Collections.Specialized; using System.Text; -namespace Quartzmin +namespace Quartzmin.HostedService { public static class IServiceCollectionExtensions { diff --git a/src/Quartzmin/HostedService/JobOptions.cs b/src/Quartzmin/HostedService/JobOptions.cs index 5c5546a..b40db9f 100644 --- a/src/Quartzmin/HostedService/JobOptions.cs +++ b/src/Quartzmin/HostedService/JobOptions.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; -namespace Quartzmin +namespace Quartzmin.HostedService { public class JobOptions { diff --git a/src/Quartzmin/HostedService/JobRegistrator.cs b/src/Quartzmin/HostedService/JobRegistrator.cs index 32a02a1..9681dc1 100644 --- a/src/Quartzmin/HostedService/JobRegistrator.cs +++ b/src/Quartzmin/HostedService/JobRegistrator.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; using System.Text; -namespace Quartzmin +namespace Quartzmin.HostedService { internal class JobRegistrator : IJobRegistrator { diff --git a/src/Quartzmin/HostedService/QuartzHostedService.cs b/src/Quartzmin/HostedService/QuartzHostedService.cs index 63a9d0b..77bc939 100644 --- a/src/Quartzmin/HostedService/QuartzHostedService.cs +++ b/src/Quartzmin/HostedService/QuartzHostedService.cs @@ -10,7 +10,7 @@ using Quartz; using Quartz.Spi; using System.Linq; -namespace Quartzmin +namespace Quartzmin.HostedService { internal class QuartzHostedService : IHostedService { diff --git a/src/Quartzmin/HostedService/ScheduleJob.cs b/src/Quartzmin/HostedService/ScheduleJob.cs index 00eedc3..30d0bc3 100644 --- a/src/Quartzmin/HostedService/ScheduleJob.cs +++ b/src/Quartzmin/HostedService/ScheduleJob.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; -namespace Quartzmin +namespace Quartzmin.HostedService { internal class ScheduleJob : IScheduleJob { diff --git a/src/Quartzmin/HostedService/ServiceCollectionJobFactory.cs b/src/Quartzmin/HostedService/ServiceCollectionJobFactory.cs index e4536b9..aa7134c 100644 --- a/src/Quartzmin/HostedService/ServiceCollectionJobFactory.cs +++ b/src/Quartzmin/HostedService/ServiceCollectionJobFactory.cs @@ -6,7 +6,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Text; -namespace Quartzmin +namespace Quartzmin.HostedService { public class ServiceCollectionJobFactory : IJobFactory { diff --git a/src/Quartzmin/HostedService/TriggerOptions.cs b/src/Quartzmin/HostedService/TriggerOptions.cs index 1664b09..9cb3201 100644 --- a/src/Quartzmin/HostedService/TriggerOptions.cs +++ b/src/Quartzmin/HostedService/TriggerOptions.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; using System.Text; -namespace Quartzmin +namespace Quartzmin.HostedService { public class TriggerOptions { diff --git a/src/Quartzmin/Properties/AssemblyInfo.cs b/src/Quartzmin/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..beb04de --- /dev/null +++ b/src/Quartzmin/Properties/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("SilkierQuartz.Test")] \ No newline at end of file diff --git a/test/QuartzHostedService.Test/IServiceCollectionExtensionsUnitTest.cs b/test/QuartzHostedService.Test/IServiceCollectionExtensionsUnitTest.cs index edd8e15..b0ab906 100644 --- a/test/QuartzHostedService.Test/IServiceCollectionExtensionsUnitTest.cs +++ b/test/QuartzHostedService.Test/IServiceCollectionExtensionsUnitTest.cs @@ -1,17 +1,19 @@ -using FluentAssertions; +using FluentAssertions; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Quartz; using Quartz.Impl; using Quartz.Spi; +using Quartzmin; +using Quartzmin.HostedService; using System; using Xunit; -namespace QuartzHostedService.Test +namespace SilkierQuartz.Test { public class IServiceCollectionExtensionsUnitTest { - [Fact(DisplayName = " HostedService")] + [Fact(DisplayName = "«арегистрировали HostedService")] public void IServiceCollectionExtensions_Register_HostedService() { IServiceCollection serviceCollection = new ServiceCollection(); @@ -20,10 +22,10 @@ namespace QuartzHostedService.Test var testClass = serviceCollection.BuildServiceProvider().GetRequiredService(); testClass.Should() .NotBeNull() - .And.BeOfType(); + .And.BeOfType(); } - [Fact(DisplayName = " IJobFactory ( DI Job')")] + [Fact(DisplayName = "«арегистрировали IJobFactory (дл¤ DI в Job'ах)")] public void IServiceCollectionExtensions_Register_IJobFactory() { IServiceCollection serviceCollection = new ServiceCollection(); @@ -35,7 +37,7 @@ namespace QuartzHostedService.Test .And.BeOfType(); } - [Fact(DisplayName = " ISchedulerFactory ( )")] + [Fact(DisplayName = "«арегистрировали ISchedulerFactory (не передали параметры дл¤ инициализации)")] public void IServiceCollectionExtensions_Register_ISchedulerFactory() { IServiceCollection serviceCollection = new ServiceCollection(); @@ -47,20 +49,20 @@ namespace QuartzHostedService.Test .And.BeOfType(); } - [Fact(DisplayName = " ISchedulerFactory ( )")] + [Fact(DisplayName = "«арегистрировали ISchedulerFactory (передали параметры дл¤ инициализации)")] public void IServiceCollectionExtensions_Register_ISchedulerFactory_WithParams() { IServiceCollection serviceCollection = new ServiceCollection(); IServiceCollectionExtensions.UseQuartzHostedService(serviceCollection, options => { options.Add("quartz.threadPool.threadCount", "1"); }); - // TODO: + // TODO: ѕроверить что параметры передались в конструктор var testClass = serviceCollection.BuildServiceProvider().GetRequiredService(); testClass.Should() .NotBeNull() .And.BeOfType(); } - [Fact(DisplayName = " IJobRegistrator")] + [Fact(DisplayName = "ѕосле регистрации зависимосте возвращаетс¤ IJobRegistrator")] public void IServiceCollectionExtensions_Return_IJobRegistrator() { IServiceCollection serviceCollection = new ServiceCollection(); diff --git a/test/QuartzHostedService.Test/QuartzHostedServiceUnitTest.cs b/test/QuartzHostedService.Test/QuartzHostedServiceUnitTest.cs index e36c008..cd7c9de 100644 --- a/test/QuartzHostedService.Test/QuartzHostedServiceUnitTest.cs +++ b/test/QuartzHostedService.Test/QuartzHostedServiceUnitTest.cs @@ -1,4 +1,4 @@ -using FakeItEasy; +using FakeItEasy; using Quartz; using Quartz.Spi; using System; @@ -7,8 +7,8 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using Xunit; - -namespace QuartzHostedService.Test +using Quartzmin.HostedService; +namespace SilkierQuartz.Test { public class QuartzHostedServiceUnitTest { diff --git a/test/QuartzHostedService.Test/QuartzHostedService.Test.csproj b/test/QuartzHostedService.Test/SilkierQuartz.Test.csproj similarity index 77% rename from test/QuartzHostedService.Test/QuartzHostedService.Test.csproj rename to test/QuartzHostedService.Test/SilkierQuartz.Test.csproj index 79ed54c..a4588c9 100644 --- a/test/QuartzHostedService.Test/QuartzHostedService.Test.csproj +++ b/test/QuartzHostedService.Test/SilkierQuartz.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp3.0 + netcoreapp3.1 false @@ -20,7 +20,8 @@ - + +