24 Commits

Author SHA1 Message Date
Austin Winstanley 930a7bbe9a aaaaaand now that travis ci is working, a fix for appveyor 2017-10-19 17:19:13 -05:00
Austin Winstanley 7ea68134ad another attempted fix for Travis CI build 2017-10-19 17:14:33 -05:00
Austin Winstanley 3fa56388a6 attempting fix for Travis CI build 2017-10-19 17:05:25 -05:00
Austin Winstanley 242ce14ef4 added support for DotNet 4.5, 4.6, NetStandard1.3, 1.4, 1.5,1.6 and added new sample console project for DotNet4.6 2017-10-19 16:38:05 -05:00
Austin Winstanley f19f1c17b3 upgraded to netstandard2.0 2017-09-27 16:21:55 -05:00
Austin Winstanley d9cd7a63f7 fix for CI 2017-09-12 22:34:33 -05:00
Austin Winstanley 8e54a30a70 updated to .Net Standard / Core 2.0.0 2017-09-12 22:30:11 -05:00
Austin Winstanley 690e97e0e5 Fixed Appveyor CI badge 2017-07-18 03:17:51 -05:00
Austin Winstanley 59e2bcf293 Fixed AppVeyor build badge 2017-07-18 03:05:15 -05:00
Austin Winstanley 15bfa38032 fixed Travis CI link 2 2017-07-18 02:57:56 -05:00
Austin Winstanley 62ec953b07 Fixed TravisCI build link 2017-07-18 02:56:58 -05:00
Austin Winstanley c8cad4c8b2 Merge pull request #23 from Fewzion/master
Fix bug with getting a stale JobQueues query result that resulted in the
2017-07-18 02:18:31 -05:00
Joerg Kiegeland 64f4927e1b Fix bug with getting a stale JobQueues query result that resulted in the
same job being executed multiple times by different worker threads (e.g.
consider a Hangfire job then sending out the same email multiple times).
2017-07-08 22:29:45 +10:00
Austin Winstanley b0c3b5e2ed added AppVeyor CI for Windows builds 2017-04-28 17:48:50 -05:00
Austin Winstanley cf83a35520 added travis ci status to README 2017-04-28 00:23:13 -05:00
Austin Winstanley f4f672e323 upgraded to NetStandard 1.3 and new project format for DotNetCore. Also added Travis CI integration 2017-04-28 00:20:06 -05:00
Austin Winstanley 7706a2e799 upgraded to Visual Studio 2017 and pushed version 2.2.0 to Nuget 2017-03-17 01:47:44 -05:00
Austin Winstanley 1f58085aa6 Merge pull request #21 from mjohnson0580/master
Updated to latest stable versions of Hangfire (1.6.9) and RavenDB (3.5.3)
2017-03-15 19:57:40 -05:00
Michael Johnson e284ad7cf4 Updated to latest stable versions of Hangfire (1.6.9) and RavenDB (3.5.3) 2017-03-11 16:57:26 +11:00
Austin Winstanley ad39bb3f49 Merge pull request #19 from mjohnson0580/master
Added Hangfire.Raven.Tests project. Nice work @mjohnson0580  and @xinix00
2017-03-07 15:19:12 -06:00
Michael Johnson 1002c28ddd Added Hangfire.Raven.Tests project
- Refactored Repository and RavenStorage to allow injection of a TestRepository (using an in-memory database for unit tests)
- Made several fixes to comply with unit tests (notably RavenDistributedLock and RavenJobQueue)
- Merged fixes from xinix00 pull request #11 (https://github.com/RefreshingIO/hangfire-ravendb/pull/11)
2017-03-07 18:38:18 +11:00
Austin Winstanley 4107954dec merge to fix #14 2016-12-08 21:16:09 -06:00
Austin Winstanley 382e502c6b Merge pull request #16 from mjohnson0580/master
Revert back to using InvocationData
2016-12-08 20:59:39 -06:00
Michael Johnson 7aa06fe914 Revert back to using InvocationData, as the following functionality has been lost, but is already handled by Hangfire
- Overloaded method calls e.g. Console.WriteLine(String) vs Console.WriteLine(Int32) Console.WriteLine(Boolean)
- Generic method calls
- Nullable parameters in method calls
- Special handling of CancellationToken arguments during serialization/deserialization
2016-12-09 12:52:17 +11:00
129 changed files with 6169 additions and 22897 deletions
+13
View File
@@ -0,0 +1,13 @@
language: csharp
solution: Hangfire.Raven.sln
mono: none
dotnet: 2.0.0
dist: trusty
sudo: required
script:
- dotnet restore
- dotnet build -f netstandard1.3 ./src/Hangfire.Raven/Hangfire.Raven.csproj
- dotnet build -f netstandard1.4 ./src/Hangfire.Raven/Hangfire.Raven.csproj
- dotnet build -f netstandard1.5 ./src/Hangfire.Raven/Hangfire.Raven.csproj
- dotnet build -f netstandard1.6 ./src/Hangfire.Raven/Hangfire.Raven.csproj
- dotnet build -f netstandard2.0 ./src/Hangfire.Raven/Hangfire.Raven.csproj
+56 -50
View File
@@ -1,50 +1,56 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_", "_", "{8CF2D2F6-BEFE-47FE-B141-0017FC6F97D8}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
global.json = global.json
README.md = README.md
EndProjectSection
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Hangfire.Raven", "src\Hangfire.Raven\Hangfire.Raven.xproj", "{BA18F6BF-5613-4B9D-A57A-C05C51148EC5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{EF9BFE2C-0386-4EC4-83EC-D7E315F56735}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{54466714-23AC-4D87-90EB-EAD235F84F71}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Hangfire.Raven.Examples.Console", "examples\Hangfire.Raven.Examples.Console\Hangfire.Raven.Examples.Console.xproj", "{3955F2F1-99AF-4CC0-88F5-C9B69757A1B2}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Hangfire.Raven.Examples.AspNetCore", "examples\Hangfire.Raven.Examples.AspNetCore\Hangfire.Raven.Examples.AspNetCore.xproj", "{82A516D0-287C-4DD8-A153-2B3AFFB88241}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BA18F6BF-5613-4B9D-A57A-C05C51148EC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BA18F6BF-5613-4B9D-A57A-C05C51148EC5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BA18F6BF-5613-4B9D-A57A-C05C51148EC5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BA18F6BF-5613-4B9D-A57A-C05C51148EC5}.Release|Any CPU.Build.0 = Release|Any CPU
{3955F2F1-99AF-4CC0-88F5-C9B69757A1B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3955F2F1-99AF-4CC0-88F5-C9B69757A1B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3955F2F1-99AF-4CC0-88F5-C9B69757A1B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3955F2F1-99AF-4CC0-88F5-C9B69757A1B2}.Release|Any CPU.Build.0 = Release|Any CPU
{82A516D0-287C-4DD8-A153-2B3AFFB88241}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{82A516D0-287C-4DD8-A153-2B3AFFB88241}.Debug|Any CPU.Build.0 = Debug|Any CPU
{82A516D0-287C-4DD8-A153-2B3AFFB88241}.Release|Any CPU.ActiveCfg = Release|Any CPU
{82A516D0-287C-4DD8-A153-2B3AFFB88241}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{BA18F6BF-5613-4B9D-A57A-C05C51148EC5} = {EF9BFE2C-0386-4EC4-83EC-D7E315F56735}
{3955F2F1-99AF-4CC0-88F5-C9B69757A1B2} = {54466714-23AC-4D87-90EB-EAD235F84F71}
{82A516D0-287C-4DD8-A153-2B3AFFB88241} = {54466714-23AC-4D87-90EB-EAD235F84F71}
EndGlobalSection
EndGlobal
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27004.2005
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_", "_", "{8CF2D2F6-BEFE-47FE-B141-0017FC6F97D8}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitattributes = .gitattributes
.gitignore = .gitignore
.travis.yml = .travis.yml
appveyor.yml = appveyor.yml
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{EF9BFE2C-0386-4EC4-83EC-D7E315F56735}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hangfire.Raven", "src\Hangfire.Raven\Hangfire.Raven.csproj", "{BA18F6BF-5613-4B9D-A57A-C05C51148EC5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{F42EDD6E-883B-4067-94AD-72EC7A095BF2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hangfire.Raven.Samples.AspNetCore", "samples\Hangfire.Raven.Samples.AspNetCore\Hangfire.Raven.Samples.AspNetCore.csproj", "{34B7ED1A-796C-40B8-A8B9-D12D88C8A880}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hangfire.Raven.Samples.Console", "samples\Hangfire.Raven.Samples.Console\Hangfire.Raven.Samples.Console.csproj", "{A7691484-4466-4F8C-9B57-C77EA0FF4670}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BA18F6BF-5613-4B9D-A57A-C05C51148EC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BA18F6BF-5613-4B9D-A57A-C05C51148EC5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BA18F6BF-5613-4B9D-A57A-C05C51148EC5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BA18F6BF-5613-4B9D-A57A-C05C51148EC5}.Release|Any CPU.Build.0 = Release|Any CPU
{34B7ED1A-796C-40B8-A8B9-D12D88C8A880}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{34B7ED1A-796C-40B8-A8B9-D12D88C8A880}.Debug|Any CPU.Build.0 = Debug|Any CPU
{34B7ED1A-796C-40B8-A8B9-D12D88C8A880}.Release|Any CPU.ActiveCfg = Release|Any CPU
{34B7ED1A-796C-40B8-A8B9-D12D88C8A880}.Release|Any CPU.Build.0 = Release|Any CPU
{A7691484-4466-4F8C-9B57-C77EA0FF4670}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A7691484-4466-4F8C-9B57-C77EA0FF4670}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A7691484-4466-4F8C-9B57-C77EA0FF4670}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A7691484-4466-4F8C-9B57-C77EA0FF4670}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{BA18F6BF-5613-4B9D-A57A-C05C51148EC5} = {EF9BFE2C-0386-4EC4-83EC-D7E315F56735}
{34B7ED1A-796C-40B8-A8B9-D12D88C8A880} = {F42EDD6E-883B-4067-94AD-72EC7A095BF2}
{A7691484-4466-4F8C-9B57-C77EA0FF4670} = {F42EDD6E-883B-4067-94AD-72EC7A095BF2}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1E710484-845C-4FAB-9F3F-2E3384385445}
EndGlobalSection
EndGlobal
-6
View File
@@ -1,6 +0,0 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/CodeAnnotations/NamespacesWithAnnotations/=Hangfire_002EAnnotations/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/CodeAnnotations/NamespacesWithAnnotations/=Hangfire_002ERedis_002EAnnotations/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/CodeAnnotations/NamespacesWithAnnotations/=Hangfire_002ESqlServer_002EAnnotations/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/FilterSettingsManager/CoverageFilterXml/@EntryValue">&lt;data&gt;&lt;IncludeFilters /&gt;&lt;ExcludeFilters&gt;&lt;Filter ModuleMask="Hangfire.Core.Tests" ModuleVersionMask="*" ClassMask="*" FunctionMask="*" IsEnabled="True" /&gt;&lt;Filter ModuleMask="Hangfire.SqlServer.Tests" ModuleVersionMask="*" ClassMask="*" FunctionMask="*" IsEnabled="True" /&gt;&lt;/ExcludeFilters&gt;&lt;/data&gt;</s:String>
<s:String x:Key="/Default/FilterSettingsManager/AttributeFilterXml/@EntryValue">&lt;data /&gt;</s:String></wpf:ResourceDictionary>
+20 -5
View File
@@ -1,5 +1,17 @@
Usage
--------
# Hangfire RavenDB
## Build Status
`Platform` | `Master`
--- | ---
**Windows** | [![Build status](https://ci.appveyor.com/api/projects/status/hcmu0b0p62mbuwen?svg=true)](https://ci.appveyor.com/project/CadyIO/hangfire-ravendb)
**Linux / OS X** | [![Travis CI Build Status](https://travis-ci.org/CadyIO/hangfire-ravendb.svg?branch=master)](https://travis-ci.org/CadyIO/hangfire-ravendb)
## Overview
RavenDB job storage for Hangfire
## Usage
This is how you connect to a ravendb server (local or remote)
```csharp
@@ -34,7 +46,7 @@ Recurring jobs were never been simpler, just call the following method to perfor
RecurringJob.AddOrUpdate(() => Console.WriteLine("Transparent!"), Cron.Daily);
```
**Continuations**
## Continuations
Continuations allow you to define complex workflows by chaining multiple background jobs together.
@@ -43,8 +55,7 @@ var id = BackgroundJob.Enqueue(() => Console.WriteLine("Hello, "));
BackgroundJob.ContinueWith(id, () => Console.WriteLine("world!"));
```
License
--------
## License
Copyright © 2013-2014 Sergey Odinokov.
@@ -60,3 +71,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see [http://www.gnu.org/licenses/](http://www.gnu.org/licenses).
## Known Bugs
Hangfire.Tests requires RavenDB.Client which requires .Net 4.5. Until RavenDB 4.0 is released, Hangfire.Tests cannot be included and run.
+33
View File
@@ -0,0 +1,33 @@
version: 3.2.0.{build}
# branches to build
branches:
# whitelist
only:
- master
- production
# blacklist
except:
- gh-pages
# build configuration
configuration:
- Debug
- Release
# build platform
platform: Any CPU
# environment variables
environment:
# Don't report back to the mothership
DOTNET_CLI_TELEMETRY_OPTOUT: 1
# scripts to run before build
before_build:
- cmd: appveyor-retry dotnet restore -v Minimal
# run dotnet cli instead of msbuild
build_script:
- dotnet build
@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>82a516d0-287c-4dd8-a153-2b3affb88241</ProjectGuid>
<RootNamespace>Hangfire.Raven.Examples.AspNetCore</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<ItemGroup>
<DnxInvisibleContent Include="bower.json" />
<DnxInvisibleContent Include=".bowerrc" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DotNet.Web\Microsoft.DotNet.Web.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
@@ -1,187 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Welcome to ASP.NET Core</title>
<style>
html {
background: #f1f1f1;
height: 100%;
}
body {
background: #fff;
color: #505050;
font: 14px 'Segoe UI', tahoma, arial, helvetica, sans-serif;
margin: 1%;
min-height: 95.5%;
border: 1px solid silver;
position: relative;
}
#header {
padding: 0;
}
#header h1 {
font-size: 44px;
font-weight: normal;
margin: 0;
padding: 10px 30px 10px 30px;
}
#header span {
margin: 0;
padding: 0 30px;
display: block;
}
#header p {
font-size: 20px;
color: #fff;
background: #007acc;
padding: 0 30px;
line-height: 50px;
margin-top: 25px;
}
#header p a {
color: #fff;
text-decoration: underline;
font-weight: bold;
padding-right: 35px;
background: no-repeat right bottom url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAWCAMAAAAcqPc3AAAANlBMVEUAAAAAeswfitI9mthXp91us+KCvuaTx+mjz+2x1u+83PLH4vTR5/ba7Pjj8Pns9fv1+v3////wy3dWAAAAAXRSTlMAQObYZgAAAHxJREFUeNp9kVcSwCAIRMHUYoH7XzaxOxJ9P8oyQ1uIqNPwh3s2aLmIM2YtqrLcQIeQEylhuCeUOlhgve5yoBCfWmlnlgkN4H8ykbpaE7gR03AbUHiwoOxUH9Xp+ubd41p1HF3mBPrfC87BHeTdaB3ceeKL9HGpcvX9zu6+DdMWT9KQPvYAAAAASUVORK5CYII=);
}
#main {
padding: 5px 30px;
clear: both;
}
.section {
width: 21.7%;
float: left;
margin: 0 0 0 4%;
}
.section h2 {
font-size: 13px;
text-transform: uppercase;
margin: 0;
border-bottom: 1px solid silver;
padding-bottom: 12px;
margin-bottom: 8px;
}
.section.first {
margin-left: 0;
}
.section.first h2 {
font-size: 24px;
text-transform: none;
margin-bottom: 25px;
border: none;
}
.section.first li {
border-top: 1px solid silver;
padding: 8px 0;
}
.section.last {
margin-right: 0;
}
ul {
list-style: none;
padding: 0;
margin: 0;
line-height: 20px;
}
li {
padding: 4px 0;
}
a {
color: #267cb2;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
#footer {
clear: both;
padding-top: 50px;
}
#footer p {
position: absolute;
bottom: 10px;
}
</style>
</head>
<body>
<div id="header">
<h1>Welcome to ASP.NET Core</h1>
<span>
We've made some big updates in this release, so its <b>important</b> that you spend
a few minutes to learn whats new.
</span>
<p>You've created a new ASP.NET Core project. <a href="http://go.microsoft.com/fwlink/?LinkId=518016">Learn what's new</a></p>
</div>
<div id="main">
<div class="section first">
<h2>This application consists of:</h2>
<ul>
<li>Sample pages using ASP.NET Core MVC</li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518004">Bower</a> for managing client-side libraries</li>
<li>Theming using <a href="http://go.microsoft.com/fwlink/?LinkID=398939">Bootstrap</a></li>
</ul>
</div>
<div class="section">
<h2>How to</h2>
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398600">Add a Controller and View</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699562">Add an appsetting in config and access it in app.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699315">Manage User Secrets using Secret Manager.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699316">Use logging to log a message.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699317">Add packages using NuGet.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699318">Add client packages using Bower.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699319">Target development, staging or production environment.</a></li>
</ul>
</div>
<div class="section">
<h2>Overview</h2>
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518008">Conceptual overview of what is ASP.NET Core</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699320">Fundamentals of ASP.NET Core such as Startup and middleware.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=398602">Working with Data</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=398603">Security</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699321">Client side development</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699322">Develop on different platforms</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699323">Read more on the documentation site</a></li>
</ul>
</div>
<div class="section last">
<h2>Run & Deploy</h2>
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517851">Run your app</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517853">Run tools such as EF migrations and more</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure Web Apps</a></li>
</ul>
</div>
<div id="footer">
<p>We would love to hear your <a href="http://go.microsoft.com/fwlink/?LinkId=518015">feedback</a></p>
</div>
</div>
</body>
</html>
@@ -1,105 +0,0 @@
{
"title": "Hangfire.Raven.Examples.AspNetCore",
"version": "2.1.0",
"description": "RavenDB job storage for Hangfire - AspNetCore Example",
"copyright": "Copyright @ 2016 Cady, LLC",
"authors": [
"Cady <contact@cady.io>"
],
"buildOptions": {
"allowUnsafe": true,
"debugType": "portable",
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"packOptions": {
"tags": [
"Hangfire",
"AspNet",
"MVC",
"OWIN",
"RavenDB",
"Long-Running",
"Background",
"Fire-And-Forget",
"Delayed",
"Recurring",
"Tasks",
"Jobs",
"Scheduler",
"Threading",
"Queues"
],
"iconUrl": "https://avatars2.githubusercontent.com/u/7880472?v=3&s=200",
"projectUrl": "https://github.com/cady-io/hangfire-ravendb",
"licenseUrl": "http://www.gnu.org/licenses/lgpl-3.0.html",
"owners": [
"Cady <contact@cady.io>"
],
"repository": {
"type": "git",
"url": "https://github.com/cady-io/hangfire-ravendb"
},
"summary": "RavenDB job storage for Hangfire - AspNetCore Example"
},
"dependencies": {
"Hangfire.AspNetCore": "1.6.7",
"Hangfire.Raven": "2.1.0",
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Routing": "1.0.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0"
},
"tools": {
"BundlerMinifier.Core": "2.0.238",
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
File diff suppressed because it is too large Load Diff
@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
-->
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>
@@ -1,6 +0,0 @@
/// <autosync enabled="true" />
/// <reference path="js/site.js" />
/// <reference path="lib/bootstrap/dist/js/bootstrap.js" />
/// <reference path="lib/jquery/dist/jquery.js" />
/// <reference path="lib/jquery-validation/dist/jquery.validate.js" />
/// <reference path="lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js" />
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>3955f2f1-99af-4cc0-88f5-c9b69757a1b2</ProjectGuid>
<RootNamespace>Hangfire.Raven.Examples.Console</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
@@ -1,19 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Hangfire.Raven.Examples.Console")]
[assembly: AssemblyTrademark("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3955f2f1-99af-4cc0-88f5-c9b69757a1b2")]
@@ -1,58 +0,0 @@
{
"title": "Hangfire.Raven.Examples.Console",
"version": "2.1.0",
"description": "RavenDB job storage for Hangfire - Console Example",
"copyright": "Copyright @ 2016 Cady, LLC",
"authors": [
"Cady <contact@cady.io>"
],
"buildOptions": {
"allowUnsafe": true,
"debugType": "portable",
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"packOptions": {
"tags": [
"Hangfire",
"AspNet",
"MVC",
"OWIN",
"RavenDB",
"Long-Running",
"Background",
"Fire-And-Forget",
"Delayed",
"Recurring",
"Tasks",
"Jobs",
"Scheduler",
"Threading",
"Queues"
],
"include": [
"app.config"
],
"iconUrl": "https://avatars2.githubusercontent.com/u/7880472?v=3&s=200",
"projectUrl": "https://github.com/cady-io/hangfire-ravendb",
"licenseUrl": "http://www.gnu.org/licenses/lgpl-3.0.html",
"owners": [
"Cady <contact@cady.io>"
],
"repository": {
"type": "git",
"url": "https://github.com/cady-io/hangfire-ravendb"
},
"summary": "RavenDB job storage for Hangfire - Console Example"
},
"runtimes": {
"win10-x64": {}
},
"frameworks": {
"net452": { }
},
"dependencies": {
"Hangfire.Raven": "2.1.0",
"System.ComponentModel.Primitives": "4.3.0"
}
}
@@ -1,286 +0,0 @@
{
"locked": false,
"version": 2,
"targets": {
".NETFramework,Version=v4.5.2": {
"Hangfire.Core/1.6.4": {
"type": "package",
"dependencies": {
"Newtonsoft.Json": "5.0.0",
"Owin": "1.0.0"
},
"compile": {
"lib/net45/Hangfire.Core.dll": {}
},
"runtime": {
"lib/net45/Hangfire.Core.dll": {}
}
},
"Newtonsoft.Json/9.0.1": {
"type": "package",
"compile": {
"lib/net45/Newtonsoft.Json.dll": {}
},
"runtime": {
"lib/net45/Newtonsoft.Json.dll": {}
}
},
"Owin/1.0.0": {
"type": "package",
"compile": {
"lib/net40/Owin.dll": {}
},
"runtime": {
"lib/net40/Owin.dll": {}
}
},
"RavenDB.Client/3.5.0-rc-35169": {
"type": "package",
"frameworkAssemblies": [
"System.ComponentModel.Composition"
],
"compile": {
"lib/net45/Raven.Abstractions.dll": {},
"lib/net45/Raven.Client.Lightweight.dll": {}
},
"runtime": {
"lib/net45/Raven.Abstractions.dll": {},
"lib/net45/Raven.Client.Lightweight.dll": {}
}
},
"System.ComponentModel.Primitives/4.3.0": {
"type": "package",
"frameworkAssemblies": [
"System",
"mscorlib"
],
"compile": {
"ref/net45/System.ComponentModel.Primitives.dll": {}
},
"runtime": {
"lib/net45/System.ComponentModel.Primitives.dll": {}
}
},
"Hangfire.Raven/2.1.0": {
"type": "project",
"framework": ".NETFramework,Version=v4.5",
"dependencies": {
"Hangfire.Core": "1.6.4",
"Newtonsoft.Json": "9.0.1",
"RavenDB.Client": "3.5.0-rc-35169"
},
"frameworkAssemblies": [
"System.Data",
"System.Reflection"
],
"compile": {
"net45/Hangfire.Raven.dll": {}
},
"runtime": {
"net45/Hangfire.Raven.dll": {}
}
}
},
".NETFramework,Version=v4.5.2/win10-x64": {
"Hangfire.Core/1.6.4": {
"type": "package",
"dependencies": {
"Newtonsoft.Json": "5.0.0",
"Owin": "1.0.0"
},
"compile": {
"lib/net45/Hangfire.Core.dll": {}
},
"runtime": {
"lib/net45/Hangfire.Core.dll": {}
}
},
"Newtonsoft.Json/9.0.1": {
"type": "package",
"compile": {
"lib/net45/Newtonsoft.Json.dll": {}
},
"runtime": {
"lib/net45/Newtonsoft.Json.dll": {}
}
},
"Owin/1.0.0": {
"type": "package",
"compile": {
"lib/net40/Owin.dll": {}
},
"runtime": {
"lib/net40/Owin.dll": {}
}
},
"RavenDB.Client/3.5.0-rc-35169": {
"type": "package",
"frameworkAssemblies": [
"System.ComponentModel.Composition"
],
"compile": {
"lib/net45/Raven.Abstractions.dll": {},
"lib/net45/Raven.Client.Lightweight.dll": {}
},
"runtime": {
"lib/net45/Raven.Abstractions.dll": {},
"lib/net45/Raven.Client.Lightweight.dll": {}
}
},
"System.ComponentModel.Primitives/4.3.0": {
"type": "package",
"frameworkAssemblies": [
"System",
"mscorlib"
],
"compile": {
"ref/net45/System.ComponentModel.Primitives.dll": {}
},
"runtime": {
"lib/net45/System.ComponentModel.Primitives.dll": {}
}
},
"Hangfire.Raven/2.1.0": {
"type": "project",
"framework": ".NETFramework,Version=v4.5",
"dependencies": {
"Hangfire.Core": "1.6.4",
"Newtonsoft.Json": "9.0.1",
"RavenDB.Client": "3.5.0-rc-35169"
},
"frameworkAssemblies": [
"System.Data",
"System.Reflection"
],
"compile": {
"net45/Hangfire.Raven.dll": {}
},
"runtime": {
"net45/Hangfire.Raven.dll": {}
}
}
}
},
"libraries": {
"Hangfire.Core/1.6.4": {
"sha512": "QM+WNZ/B7t3BzOBumLb2NU9aoh76hb/Jdt9pV95+HSHZbPsvms7Jk9kUC9PLopdh9gpUL7L6dmnhEnpQJBBs+Q==",
"type": "package",
"path": "Hangfire.Core/1.6.4",
"files": [
"Hangfire.Core.1.6.4.nupkg.sha512",
"Hangfire.Core.nuspec",
"lib/net45/Hangfire.Core.dll",
"lib/net45/Hangfire.Core.xml",
"lib/netstandard1.3/Hangfire.Core.dll",
"lib/netstandard1.3/Hangfire.Core.xml"
]
},
"Newtonsoft.Json/9.0.1": {
"sha512": "U82mHQSKaIk+lpSVCbWYKNavmNH1i5xrExDEquU1i6I5pV6UMOqRnJRSlKO3cMPfcpp0RgDY+8jUXHdQ4IfXvw==",
"type": "package",
"path": "Newtonsoft.Json/9.0.1",
"files": [
"Newtonsoft.Json.9.0.1.nupkg.sha512",
"Newtonsoft.Json.nuspec",
"lib/net20/Newtonsoft.Json.dll",
"lib/net20/Newtonsoft.Json.xml",
"lib/net35/Newtonsoft.Json.dll",
"lib/net35/Newtonsoft.Json.xml",
"lib/net40/Newtonsoft.Json.dll",
"lib/net40/Newtonsoft.Json.xml",
"lib/net45/Newtonsoft.Json.dll",
"lib/net45/Newtonsoft.Json.xml",
"lib/netstandard1.0/Newtonsoft.Json.dll",
"lib/netstandard1.0/Newtonsoft.Json.xml",
"lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.dll",
"lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.xml",
"lib/portable-net45+wp80+win8+wpa81/Newtonsoft.Json.dll",
"lib/portable-net45+wp80+win8+wpa81/Newtonsoft.Json.xml",
"tools/install.ps1"
]
},
"Owin/1.0.0": {
"sha512": "OseTFniKmyp76mEzOBwIKGBRS5eMoYNkMKaMXOpxx9jv88+b6mh1rSaw43vjBOItNhaLFG3d0a20PfHyibH5sw==",
"type": "package",
"path": "Owin/1.0.0",
"files": [
"Owin.1.0.0.nupkg.sha512",
"Owin.nuspec",
"lib/net40/Owin.dll"
]
},
"RavenDB.Client/3.5.0-rc-35169": {
"sha512": "xP23wh0U4h8/MmuiFEYhCB+y9AA87DvsJOifmfynPrYYV9jOjFLLWa55iOmy/RNWakDso7td0m3AcfGygULXQw==",
"type": "package",
"path": "RavenDB.Client/3.5.0-rc-35169",
"files": [
"RavenDB.Client.3.5.0-rc-35169.nupkg.sha512",
"RavenDB.Client.nuspec",
"lib/net45/Raven.Abstractions.dll",
"lib/net45/Raven.Abstractions.pdb",
"lib/net45/Raven.Abstractions.xml",
"lib/net45/Raven.Client.Lightweight.XML",
"lib/net45/Raven.Client.Lightweight.dll",
"lib/net45/Raven.Client.Lightweight.pdb",
"lib/netstandard1.6/Raven.Abstractions.dll",
"lib/netstandard1.6/Raven.Abstractions.pdb",
"lib/netstandard1.6/Raven.Client.Lightweight.deps.json",
"lib/netstandard1.6/Raven.Client.Lightweight.dll",
"lib/netstandard1.6/Raven.Client.Lightweight.pdb",
"lib/netstandard1.6/Sparrow.dll",
"lib/netstandard1.6/Sparrow.pdb"
]
},
"System.ComponentModel.Primitives/4.3.0": {
"sha512": "j8GUkCpM8V4d4vhLIIoBLGey2Z5bCkMVNjEZseyAlm4n5arcsJOeI3zkUP+zvZgzsbLTYh4lYeP/ZD/gdIAPrw==",
"type": "package",
"path": "System.ComponentModel.Primitives/4.3.0",
"files": [
"System.ComponentModel.Primitives.4.3.0.nupkg.sha512",
"System.ComponentModel.Primitives.nuspec",
"ThirdPartyNotices.txt",
"dotnet_library_license.txt",
"lib/MonoAndroid10/_._",
"lib/MonoTouch10/_._",
"lib/net45/System.ComponentModel.Primitives.dll",
"lib/netstandard1.0/System.ComponentModel.Primitives.dll",
"lib/xamarinios10/_._",
"lib/xamarinmac20/_._",
"lib/xamarintvos10/_._",
"lib/xamarinwatchos10/_._",
"ref/MonoAndroid10/_._",
"ref/MonoTouch10/_._",
"ref/net45/System.ComponentModel.Primitives.dll",
"ref/netstandard1.0/System.ComponentModel.Primitives.dll",
"ref/netstandard1.0/System.ComponentModel.Primitives.xml",
"ref/netstandard1.0/de/System.ComponentModel.Primitives.xml",
"ref/netstandard1.0/es/System.ComponentModel.Primitives.xml",
"ref/netstandard1.0/fr/System.ComponentModel.Primitives.xml",
"ref/netstandard1.0/it/System.ComponentModel.Primitives.xml",
"ref/netstandard1.0/ja/System.ComponentModel.Primitives.xml",
"ref/netstandard1.0/ko/System.ComponentModel.Primitives.xml",
"ref/netstandard1.0/ru/System.ComponentModel.Primitives.xml",
"ref/netstandard1.0/zh-hans/System.ComponentModel.Primitives.xml",
"ref/netstandard1.0/zh-hant/System.ComponentModel.Primitives.xml",
"ref/xamarinios10/_._",
"ref/xamarinmac20/_._",
"ref/xamarintvos10/_._",
"ref/xamarinwatchos10/_._"
]
},
"Hangfire.Raven/2.1.0": {
"type": "project",
"path": "../../src/Hangfire.Raven/project.json",
"msbuildProject": "../../src/Hangfire.Raven/Hangfire.Raven.xproj"
}
},
"projectFileDependencyGroups": {
"": [
"Hangfire.Raven >= 2.1.0",
"System.ComponentModel.Primitives >= 4.3.0"
],
".NETFramework,Version=v4.5.2": []
},
"tools": {},
"projectFileToolGroups": {}
}
-3
View File
@@ -1,3 +0,0 @@
{
"projects": [ "examples", "src" ]
}
@@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc;
namespace Hangfire.Raven.Examples.AspNetCore.Controllers
namespace Hangfire.Raven.Samples.AspNetCore.Controllers
{
public class HomeController : Controller
{
@@ -0,0 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<Version>3.2.0</Version>
<AssemblyVersion>3.2.0.0</AssemblyVersion>
<FileVersion>3.2.0.0</FileVersion>
<Description>RavenDB job storage for Hangfire - AspNetCore Example</Description>
<Authors>CadyIO &lt;contact@cady.io&gt;</Authors>
<Company>Cady IO</Company>
<Copyright>Copyright @ Cady LLC</Copyright>
<PackageLicenseUrl>http://www.gnu.org/licenses/lgpl-3.0.html</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/CadyIO/hangfire-ravendb</PackageProjectUrl>
<PackageIconUrl>https://avatars2.githubusercontent.com/u/7880472?v=3&amp;s=200</PackageIconUrl>
<PackageId>Hangfire.Raven.Samples.AspNetCore</PackageId>
<PackageTags>Hangfire;AspNet;MVC;OWIN;RavenDB;Long-Running;Background;Fire-And-Forget;Delayed;Recurring;Tasks;Jobs;Scheduler;Threading;Queues</PackageTags>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/CadyIO/hangfire-ravendb</RepositoryUrl>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Hangfire.AspNetCore" Version="1.6.17" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Hangfire.Raven\Hangfire.Raven.csproj" />
</ItemGroup>
</Project>
@@ -1,11 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.IO;
using Microsoft.AspNetCore.Hosting;
namespace Hangfire.Raven.Examples.AspNetCore
namespace Hangfire.Raven.Samples.AspNetCore
{
public class Program
{
@@ -1,9 +1,9 @@
{
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:63791/",
"applicationUrl": "http://localhost:44510/",
"sslPort": 0
}
},
@@ -15,13 +15,13 @@
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Hangfire.Raven.Examples.AspNetCore": {
"Hangfire.Raven.Samples.AspNetCore": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"applicationUrl": "http://localhost:44511"
}
}
}
}
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using System.Diagnostics;
using Hangfire.Raven.Storage;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
@@ -10,7 +6,7 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Hangfire.Raven.Examples.AspNetCore
namespace Hangfire.Raven.Samples.AspNetCore
{
public class Startup
{
@@ -18,7 +14,7 @@ namespace Hangfire.Raven.Examples.AspNetCore
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
@@ -62,8 +58,7 @@ namespace Hangfire.Raven.Examples.AspNetCore
app.UseHangfireDashboard();
// Run once
// BUG: https://github.com/cady-io/hangfire-ravendb/issues/14
//BackgroundJob.Enqueue(() => System.Console.WriteLine("Background Job: Hello, world!"));
BackgroundJob.Enqueue(() => System.Console.WriteLine("Background Job: Hello, world!"));
BackgroundJob.Enqueue(() => Test());
@@ -15,7 +15,7 @@
<div class="carousel-caption" role="option">
<p>
Learn how to build ASP.NET apps that can run anywhere.
<a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkID=525028&clcid=0x409">
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525028&clcid=0x409">
Learn More
</a>
</p>
@@ -26,7 +26,7 @@
<div class="carousel-caption" role="option">
<p>
There are powerful new features in Visual Studio for building modern web apps.
<a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkID=525030&clcid=0x409">
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525030&clcid=0x409">
Learn More
</a>
</p>
@@ -37,7 +37,7 @@
<div class="carousel-caption" role="option">
<p>
Bring in libraries from NuGet, Bower, and npm, and automate tasks using Grunt or Gulp.
<a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkID=525029&clcid=0x409">
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525029&clcid=0x409">
Learn More
</a>
</p>
@@ -48,7 +48,7 @@
<div class="carousel-caption" role="option">
<p>
Learn how Microsoft's Azure cloud platform allows you to build, deploy, and scale web apps.
<a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkID=525027&clcid=0x409">
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525027&clcid=0x409">
Learn More
</a>
</p>
@@ -70,40 +70,39 @@
<h2>Application uses</h2>
<ul>
<li>Sample pages using ASP.NET Core MVC</li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518004">Bower</a> for managing client-side libraries</li>
<li>Theming using <a href="http://go.microsoft.com/fwlink/?LinkID=398939">Bootstrap</a></li>
<li><a href="https://go.microsoft.com/fwlink/?LinkId=518004">Bower</a> for managing client-side libraries</li>
<li>Theming using <a href="https://go.microsoft.com/fwlink/?LinkID=398939">Bootstrap</a></li>
</ul>
</div>
<div class="col-md-3">
<h2>How to</h2>
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398600">Add a Controller and View</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699562">Add an appsetting in config and access it in app.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699315">Manage User Secrets using Secret Manager.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699316">Use logging to log a message.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699317">Add packages using NuGet.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699318">Add client packages using Bower.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699319">Target development, staging or production environment.</a></li>
<li><a href="https://go.microsoft.com/fwlink/?LinkID=398600">Add a Controller and View</a></li>
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699315">Manage User Secrets using Secret Manager.</a></li>
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699316">Use logging to log a message.</a></li>
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699317">Add packages using NuGet.</a></li>
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699318">Add client packages using Bower.</a></li>
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699319">Target development, staging or production environment.</a></li>
</ul>
</div>
<div class="col-md-3">
<h2>Overview</h2>
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518008">Conceptual overview of what is ASP.NET Core</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699320">Fundamentals of ASP.NET Core such as Startup and middleware.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=398602">Working with Data</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=398603">Security</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699321">Client side development</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699322">Develop on different platforms</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699323">Read more on the documentation site</a></li>
<li><a href="https://go.microsoft.com/fwlink/?LinkId=518008">Conceptual overview of what is ASP.NET Core</a></li>
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699320">Fundamentals of ASP.NET Core such as Startup and middleware.</a></li>
<li><a href="https://go.microsoft.com/fwlink/?LinkId=398602">Working with Data</a></li>
<li><a href="https://go.microsoft.com/fwlink/?LinkId=398603">Security</a></li>
<li><a href="https://go.microsoft.com/fwlink/?LinkID=699321">Client side development</a></li>
<li><a href="https://go.microsoft.com/fwlink/?LinkID=699322">Develop on different platforms</a></li>
<li><a href="https://go.microsoft.com/fwlink/?LinkID=699323">Read more on the documentation site</a></li>
</ul>
</div>
<div class="col-md-3">
<h2>Run & Deploy</h2>
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517851">Run your app</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517853">Run tools such as EF migrations and more</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure Web Apps</a></li>
<li><a href="https://go.microsoft.com/fwlink/?LinkID=517851">Run your app</a></li>
<li><a href="https://go.microsoft.com/fwlink/?LinkID=517853">Run tools such as EF migrations and more</a></li>
<li><a href="https://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure Web Apps</a></li>
</ul>
</div>
</div>
@@ -1,23 +1,25 @@
<!DOCTYPE html>
@inject Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet JavaScriptSnippet
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - Hangfire.Raven.Examples.AspNetCore</title>
<title>@ViewData["Title"] - Hangfire.Raven.Samples.AspNetCore</title>
<environment names="Development">
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="~/css/site.css" />
</environment>
<environment names="Staging,Production">
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.6/css/bootstrap.min.css"
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css"
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
<link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
</environment>
@Html.Raw(JavaScriptSnippet.FullScript)
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
@@ -26,7 +28,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a asp-area="" asp-controller="Home" asp-action="Index" class="navbar-brand">Hangfire.Raven.Examples.AspNetCore</a>
<a asp-area="" asp-controller="Home" asp-action="Index" class="navbar-brand">Hangfire.Raven.Samples.AspNetCore</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
@@ -36,12 +38,12 @@
</ul>
</div>
</div>
</div>
</nav>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>&copy; 2016 - Hangfire.Raven.Examples.AspNetCore</p>
<p>&copy; 2017 - Hangfire.Raven.Samples.AspNetCore</p>
</footer>
</div>
@@ -53,15 +55,19 @@
<environment names="Staging,Production">
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.2.0.min.js"
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
asp-fallback-test="window.jQuery">
asp-fallback-test="window.jQuery"
crossorigin="anonymous"
integrity="sha384-K+ctZQ+LL8q6tP7I94W+qzQsfRV2a+AfHIi9k8z8l9ggpc8X+Ytst4yBo/hH+8Fk">
</script>
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.6/bootstrap.min.js"
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/bootstrap.min.js"
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal">
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
crossorigin="anonymous"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa">
</script>
<script src="~/js/site.min.js" asp-append-version="true"></script>
</environment>
@RenderSection("scripts", required: false)
@RenderSection("Scripts", required: false)
</body>
</html>
@@ -0,0 +1,18 @@
<environment names="Development">
<script src="~/lib/jquery-validation/dist/jquery.validate.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>
</environment>
<environment names="Staging,Production">
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js"
asp-fallback-src="~/lib/jquery-validation/dist/jquery.validate.min.js"
asp-fallback-test="window.jQuery && window.jQuery.validator"
crossorigin="anonymous"
integrity="sha384-Fnqn3nxp3506LP/7Y3j/25BlWeA3PXTyT1l78LjECcPaKCV12TsZP7yyMxOe/G/k">
</script>
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validation.unobtrusive/3.2.6/jquery.validate.unobtrusive.min.js"
asp-fallback-src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
asp-fallback-test="window.jQuery && window.jQuery.validator && window.jQuery.validator.unobtrusive"
crossorigin="anonymous"
integrity="sha384-JrXK+k53HACyavUKOsL+NkmSesD2P+73eDMrbTtTk0h4RmOF8hF8apPlkp26JlyH">
</script>
</environment>
@@ -1,2 +1,2 @@
@using Hangfire.Raven.Examples.AspNetCore
@using Hangfire.Raven.Samples.AspNetCore
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@@ -0,0 +1,8 @@
{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Warning"
}
}
}
@@ -2,7 +2,7 @@
"name": "asp.net",
"private": true,
"dependencies": {
"bootstrap": "3.3.6",
"bootstrap": "3.3.7",
"jquery": "2.2.0",
"jquery-validation": "1.14.0",
"jquery-validation-unobtrusive": "3.2.6"
@@ -18,7 +18,7 @@
"enabled": true,
"renameLocals": true
},
// Optinally generate .map file
// Optionally generate .map file
"sourceMap": false
}
]
@@ -24,15 +24,14 @@ textarea {
}
/* Make .svg files in the carousel display properly in older browsers */
.carousel-inner .item img[src$=".svg"]
{
.carousel-inner .item img[src$=".svg"] {
width: 100%;
}
/* Hide/rearrange for smaller screens */
@media screen and (max-width: 767px) {
/* Hide captions */
.carousel-caption {
display: none
}
/* Hide captions */
.carousel-caption {
display: none;
}
}

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

@@ -29,16 +29,17 @@
"test-infra"
],
"dependencies": {
"jquery": "1.9.1 - 2"
"jquery": "1.9.1 - 3"
},
"version": "3.3.6",
"_release": "3.3.6",
"version": "3.3.7",
"_release": "3.3.7",
"_resolution": {
"type": "version",
"tag": "v3.3.6",
"commit": "81df608a40bf0629a1dc08e584849bb1e43e0b7a"
"tag": "v3.3.7",
"commit": "0b9c4a4007c44201dce9a6cc1a38407005c26c86"
},
"_source": "git://github.com/twbs/bootstrap.git",
"_target": "3.3.6",
"_originalSource": "bootstrap"
"_source": "https://github.com/twbs/bootstrap.git",
"_target": "v3.3.7",
"_originalSource": "bootstrap",
"_direct": true
}
@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2011-2015 Twitter, Inc
Copyright (c) 2011-2016 Twitter, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/*!
* Bootstrap v3.3.6 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Bootstrap v3.3.7 (http://getbootstrap.com)
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
.btn-default,
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
/*!
* Bootstrap v3.3.6 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Bootstrap v3.3.7 (http://getbootstrap.com)
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */
@@ -1106,7 +1106,6 @@ a:focus {
text-decoration: underline;
}
a:focus {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
@@ -2537,7 +2536,6 @@ select[size] {
input[type="file"]:focus,
input[type="radio"]:focus,
input[type="checkbox"]:focus {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
@@ -3029,7 +3027,6 @@ select[multiple].input-lg {
.btn.focus,
.btn:active.focus,
.btn.active.focus {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
/*!
* Bootstrap v3.3.6 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Bootstrap v3.3.7 (http://getbootstrap.com)
* Copyright 2011-2016 Twitter, Inc.
* Licensed under the MIT license
*/
@@ -11,16 +11,16 @@ if (typeof jQuery === 'undefined') {
+function ($) {
'use strict';
var version = $.fn.jquery.split(' ')[0].split('.')
if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 2)) {
throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3')
if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 3)) {
throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4')
}
}(jQuery);
/* ========================================================================
* Bootstrap: transition.js v3.3.6
* Bootstrap: transition.js v3.3.7
* http://getbootstrap.com/javascript/#transitions
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -77,10 +77,10 @@ if (typeof jQuery === 'undefined') {
}(jQuery);
/* ========================================================================
* Bootstrap: alert.js v3.3.6
* Bootstrap: alert.js v3.3.7
* http://getbootstrap.com/javascript/#alerts
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -96,7 +96,7 @@ if (typeof jQuery === 'undefined') {
$(el).on('click', dismiss, this.close)
}
Alert.VERSION = '3.3.6'
Alert.VERSION = '3.3.7'
Alert.TRANSITION_DURATION = 150
@@ -109,7 +109,7 @@ if (typeof jQuery === 'undefined') {
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}
var $parent = $(selector)
var $parent = $(selector === '#' ? [] : selector)
if (e) e.preventDefault()
@@ -172,10 +172,10 @@ if (typeof jQuery === 'undefined') {
}(jQuery);
/* ========================================================================
* Bootstrap: button.js v3.3.6
* Bootstrap: button.js v3.3.7
* http://getbootstrap.com/javascript/#buttons
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -192,7 +192,7 @@ if (typeof jQuery === 'undefined') {
this.isLoading = false
}
Button.VERSION = '3.3.6'
Button.VERSION = '3.3.7'
Button.DEFAULTS = {
loadingText: 'loading...'
@@ -214,10 +214,10 @@ if (typeof jQuery === 'undefined') {
if (state == 'loadingText') {
this.isLoading = true
$el.addClass(d).attr(d, d)
$el.addClass(d).attr(d, d).prop(d, true)
} else if (this.isLoading) {
this.isLoading = false
$el.removeClass(d).removeAttr(d)
$el.removeClass(d).removeAttr(d).prop(d, false)
}
}, this), 0)
}
@@ -281,10 +281,15 @@ if (typeof jQuery === 'undefined') {
$(document)
.on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
var $btn = $(e.target)
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
var $btn = $(e.target).closest('.btn')
Plugin.call($btn, 'toggle')
if (!($(e.target).is('input[type="radio"]') || $(e.target).is('input[type="checkbox"]'))) e.preventDefault()
if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) {
// Prevent double click on radios, and the double selections (so cancellation) on checkboxes
e.preventDefault()
// The target component still receive the focus
if ($btn.is('input,button')) $btn.trigger('focus')
else $btn.find('input:visible,button:visible').first().trigger('focus')
}
})
.on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
$(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
@@ -293,10 +298,10 @@ if (typeof jQuery === 'undefined') {
}(jQuery);
/* ========================================================================
* Bootstrap: carousel.js v3.3.6
* Bootstrap: carousel.js v3.3.7
* http://getbootstrap.com/javascript/#carousel
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -324,7 +329,7 @@ if (typeof jQuery === 'undefined') {
.on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
}
Carousel.VERSION = '3.3.6'
Carousel.VERSION = '3.3.7'
Carousel.TRANSITION_DURATION = 600
@@ -531,13 +536,14 @@ if (typeof jQuery === 'undefined') {
}(jQuery);
/* ========================================================================
* Bootstrap: collapse.js v3.3.6
* Bootstrap: collapse.js v3.3.7
* http://getbootstrap.com/javascript/#collapse
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
/* jshint latedef: false */
+function ($) {
'use strict';
@@ -561,7 +567,7 @@ if (typeof jQuery === 'undefined') {
if (this.options.toggle) this.toggle()
}
Collapse.VERSION = '3.3.6'
Collapse.VERSION = '3.3.7'
Collapse.TRANSITION_DURATION = 350
@@ -743,10 +749,10 @@ if (typeof jQuery === 'undefined') {
}(jQuery);
/* ========================================================================
* Bootstrap: dropdown.js v3.3.6
* Bootstrap: dropdown.js v3.3.7
* http://getbootstrap.com/javascript/#dropdowns
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -763,7 +769,7 @@ if (typeof jQuery === 'undefined') {
$(element).on('click.bs.dropdown', this.toggle)
}
Dropdown.VERSION = '3.3.6'
Dropdown.VERSION = '3.3.7'
function getParent($this) {
var selector = $this.attr('data-target')
@@ -909,10 +915,10 @@ if (typeof jQuery === 'undefined') {
}(jQuery);
/* ========================================================================
* Bootstrap: modal.js v3.3.6
* Bootstrap: modal.js v3.3.7
* http://getbootstrap.com/javascript/#modals
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -943,7 +949,7 @@ if (typeof jQuery === 'undefined') {
}
}
Modal.VERSION = '3.3.6'
Modal.VERSION = '3.3.7'
Modal.TRANSITION_DURATION = 300
Modal.BACKDROP_TRANSITION_DURATION = 150
@@ -1050,7 +1056,9 @@ if (typeof jQuery === 'undefined') {
$(document)
.off('focusin.bs.modal') // guard against infinite focus loop
.on('focusin.bs.modal', $.proxy(function (e) {
if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
if (document !== e.target &&
this.$element[0] !== e.target &&
!this.$element.has(e.target).length) {
this.$element.trigger('focus')
}
}, this))
@@ -1247,11 +1255,11 @@ if (typeof jQuery === 'undefined') {
}(jQuery);
/* ========================================================================
* Bootstrap: tooltip.js v3.3.6
* Bootstrap: tooltip.js v3.3.7
* http://getbootstrap.com/javascript/#tooltip
* Inspired by the original jQuery.tipsy by Jason Frame
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -1274,7 +1282,7 @@ if (typeof jQuery === 'undefined') {
this.init('tooltip', element, options)
}
Tooltip.VERSION = '3.3.6'
Tooltip.VERSION = '3.3.7'
Tooltip.TRANSITION_DURATION = 150
@@ -1565,9 +1573,11 @@ if (typeof jQuery === 'undefined') {
function complete() {
if (that.hoverState != 'in') $tip.detach()
that.$element
.removeAttr('aria-describedby')
.trigger('hidden.bs.' + that.type)
if (that.$element) { // TODO: Check whether guarding this code with this `if` is really necessary.
that.$element
.removeAttr('aria-describedby')
.trigger('hidden.bs.' + that.type)
}
callback && callback()
}
@@ -1610,7 +1620,10 @@ if (typeof jQuery === 'undefined') {
// width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
}
var elOffset = isBody ? { top: 0, left: 0 } : $element.offset()
var isSvg = window.SVGElement && el instanceof window.SVGElement
// Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3.
// See https://github.com/twbs/bootstrap/issues/20280
var elOffset = isBody ? { top: 0, left: 0 } : (isSvg ? null : $element.offset())
var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
@@ -1726,6 +1739,7 @@ if (typeof jQuery === 'undefined') {
that.$tip = null
that.$arrow = null
that.$viewport = null
that.$element = null
})
}
@@ -1762,10 +1776,10 @@ if (typeof jQuery === 'undefined') {
}(jQuery);
/* ========================================================================
* Bootstrap: popover.js v3.3.6
* Bootstrap: popover.js v3.3.7
* http://getbootstrap.com/javascript/#popovers
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -1782,7 +1796,7 @@ if (typeof jQuery === 'undefined') {
if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
Popover.VERSION = '3.3.6'
Popover.VERSION = '3.3.7'
Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
placement: 'right',
@@ -1871,10 +1885,10 @@ if (typeof jQuery === 'undefined') {
}(jQuery);
/* ========================================================================
* Bootstrap: scrollspy.js v3.3.6
* Bootstrap: scrollspy.js v3.3.7
* http://getbootstrap.com/javascript/#scrollspy
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -1900,7 +1914,7 @@ if (typeof jQuery === 'undefined') {
this.process()
}
ScrollSpy.VERSION = '3.3.6'
ScrollSpy.VERSION = '3.3.7'
ScrollSpy.DEFAULTS = {
offset: 10
@@ -2044,10 +2058,10 @@ if (typeof jQuery === 'undefined') {
}(jQuery);
/* ========================================================================
* Bootstrap: tab.js v3.3.6
* Bootstrap: tab.js v3.3.7
* http://getbootstrap.com/javascript/#tabs
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -2064,7 +2078,7 @@ if (typeof jQuery === 'undefined') {
// jscs:enable requireDollarBeforejQueryAssignment
}
Tab.VERSION = '3.3.6'
Tab.VERSION = '3.3.7'
Tab.TRANSITION_DURATION = 150
@@ -2200,10 +2214,10 @@ if (typeof jQuery === 'undefined') {
}(jQuery);
/* ========================================================================
* Bootstrap: affix.js v3.3.6
* Bootstrap: affix.js v3.3.7
* http://getbootstrap.com/javascript/#affix
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -2229,7 +2243,7 @@ if (typeof jQuery === 'undefined') {
this.checkPosition()
}
Affix.VERSION = '3.3.6'
Affix.VERSION = '3.3.7'
Affix.RESET = 'affix affix-top affix-bottom'
File diff suppressed because one or more lines are too long
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
@@ -1,6 +1,4 @@
using System;
namespace Hangfire.Raven.Examples.Console
namespace Hangfire.Raven.Samples.Console.DotNet46
{
public class GenericServices<TType>
{
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{547D4C07-FC38-4920-9891-D04A5027C0A4}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Hangfire.Raven.Samples.Console.DotNet46</RootNamespace>
<AssemblyName>Hangfire.Raven.Samples.Console.DotNet46</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Hangfire.Core, Version=1.6.17.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Hangfire.Core.1.6.17\lib\net45\Hangfire.Core.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
<HintPath>..\..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="Raven.Abstractions, Version=3.5.4.0, Culture=neutral, PublicKeyToken=37f41c7f99471593, processorArchitecture=MSIL">
<HintPath>..\..\packages\RavenDB.Client.3.5.4\lib\net45\Raven.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Raven.Client.Lightweight, Version=3.5.4.0, Culture=neutral, PublicKeyToken=37f41c7f99471593, processorArchitecture=MSIL">
<HintPath>..\..\packages\RavenDB.Client.3.5.4\lib\net45\Raven.Client.Lightweight.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="GenericServices.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Hangfire.Raven\Hangfire.Raven.csproj">
<Project>{ba18f6bf-5613-4b9d-a57a-c05c51148ec5}</Project>
<Name>Hangfire.Raven</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
@@ -0,0 +1,56 @@
using System;
using Hangfire.Raven.Storage;
namespace Hangfire.Raven.Samples.Console.DotNet46
{
class Program
{
public static int x = 0;
public static void Main()
{
try
{
// you can use Raven Storage and specify the connection string name
GlobalConfiguration.Configuration
.UseColouredConsoleLogProvider()
.UseRavenStorage("RavenDebug");
// you can use Raven Storage and specify the connection string and database name
//GlobalConfiguration.Configuration
// .UseColouredConsoleLogProvider()
// .UseRavenStorage("http://localhost:9090", "HangfireConsole");
// you can use Raven Embedded Storage which runs in memory!
//GlobalConfiguration.Configuration
// .UseColouredConsoleLogProvider()
// .UseEmbeddedRavenStorage();
//you have to create an instance of background job server at least once for background jobs to run
var client = new BackgroundJobServer();
// Run once
BackgroundJob.Enqueue(() => System.Console.WriteLine("Background Job: Hello, world!"));
BackgroundJob.Enqueue(() => Test());
// Run every minute
RecurringJob.AddOrUpdate(() => Test(), Cron.Minutely);
System.Console.WriteLine("Press Enter to exit...");
System.Console.ReadLine();
}
catch (Exception ex)
{
throw ex;
}
}
[AutomaticRetry(Attempts = 2, LogEvents = true, OnAttemptsExceeded = AttemptsExceededAction.Delete)]
public static void Test()
{
System.Console.WriteLine($"{x++} Cron Job: Hello, world!");
//throw new ArgumentException("fail");
}
}
}
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Hangfire.Raven.Samples.Console.DotNet46")]
[assembly: AssemblyDescription("RavenDB job storage for Hangfire - .Net 46 Console Example")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Cady IO")]
[assembly: AssemblyProduct("Hangfire.Raven.Samples.Console.DotNet46")]
[assembly: AssemblyCopyright("Copyright © Cady LLC")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("547d4c07-fc38-4920-9891-d04a5027c0a4")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.2.0.0")]
[assembly: AssemblyFileVersion("3.2.0.0")]
@@ -1,10 +1,9 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Threading;
namespace Hangfire.Raven.Examples.Console
namespace Hangfire.Raven.Samples.Console.DotNet46
{
public class Services
{
@@ -62,8 +61,7 @@ namespace Hangfire.Raven.Examples.Console
throw;
}
}
[DisplayName("Name: {0}")]
public void Args(string name, int authorId, DateTime createdAt)
{
System.Console.WriteLine("{0}, {1}, {2}", name, authorId, createdAt);
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Hangfire.Core" version="1.6.17" targetFramework="net46" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net46" />
<package id="Owin" version="1.0" targetFramework="net46" />
<package id="RavenDB.Client" version="3.5.4" targetFramework="net46" />
</packages>
@@ -0,0 +1,10 @@
namespace Hangfire.Raven.Samples.Console
{
public class GenericServices<TType>
{
public void Method<TMethod>(TType arg1, TMethod arg2)
{
System.Console.WriteLine("Arg1: {0}, Arg2: {1}", arg1, arg2);
}
}
}
@@ -0,0 +1,46 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputType>exe</OutputType>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<Version>3.2.0</Version>
<AssemblyVersion>3.2.0.0</AssemblyVersion>
<FileVersion>3.2.0.0</FileVersion>
<Description>RavenDB job storage for Hangfire - Console Example</Description>
<Authors>CadyIO &lt;contact@cady.io&gt;</Authors>
<Company>Cady IO</Company>
<Copyright>Copyright @ Cady LLC</Copyright>
<PackageLicenseUrl>http://www.gnu.org/licenses/lgpl-3.0.html</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/CadyIO/hangfire-ravendb</PackageProjectUrl>
<PackageIconUrl>https://avatars2.githubusercontent.com/u/7880472?v=3&amp;s=200</PackageIconUrl>
<PackageId>Hangfire.Raven.Samples.Console</PackageId>
<PackageTags>Hangfire;AspNet;MVC;OWIN;RavenDB;Long-Running;Background;Fire-And-Forget;Delayed;Recurring;Tasks;Jobs;Scheduler;Threading;Queues</PackageTags>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/CadyIO/hangfire-ravendb</RepositoryUrl>
<ApplicationIcon />
<OutputTypeEx>exe</OutputTypeEx>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<None Remove="app.config" />
</ItemGroup>
<ItemGroup>
<Content Include="app.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Hangfire.Raven\Hangfire.Raven.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Hangfire.Core" Version="1.6.17" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="RavenDB.Client" Version="3.5.4" />
</ItemGroup>
</Project>
@@ -1,7 +1,7 @@
using System;
using Hangfire.Raven.Storage;
namespace Hangfire.Raven.Examples.Console
namespace Hangfire.Raven.Samples.Console
{
public static class Program
{
@@ -29,9 +29,7 @@ namespace Hangfire.Raven.Examples.Console
var client = new BackgroundJobServer();
// Run once
// BUG: https://github.com/cady-io/hangfire-ravendb/issues/14
//BackgroundJob.Enqueue(() => System.Console.WriteLine("Background Job: Hello, world!"));
BackgroundJob.Enqueue(() => System.Console.WriteLine("Background Job: Hello, world!"));
BackgroundJob.Enqueue(() => Test());
@@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
namespace Hangfire.Raven.Samples.Console
{
public class Services
{
private static readonly Random _random = new Random();
public void EmptyDefault()
{
}
[Queue("critical")]
public void EmptyCritical()
{
}
[AutomaticRetry(Attempts = 0)]
public void Error()
{
System.Console.WriteLine("Beginning error task...");
throw new InvalidOperationException(null, new FileLoadException());
}
[Queue("critical")]
public void Random(int number)
{
int time;
lock (_random)
{
time = _random.Next(10);
}
if (time < 5)
{
throw new Exception();
}
Thread.Sleep(TimeSpan.FromSeconds(5 + time));
System.Console.WriteLine("Finished task: " + number);
}
public void Cancelable(int iterationCount, IJobCancellationToken token)
{
try
{
for (var i = 1; i <= iterationCount; i++)
{
Thread.Sleep(1000);
System.Console.WriteLine("Performing step {0} of {1}...", i, iterationCount);
token.ThrowIfCancellationRequested();
}
}
catch (OperationCanceledException)
{
System.Console.WriteLine("Cancellation requested, exiting...");
throw;
}
}
public void Args(string name, int authorId, DateTime createdAt)
{
System.Console.WriteLine("{0}, {1}, {2}", name, authorId, createdAt);
}
public void Custom(int id, string[] values, CustomObject objects, DayOfWeek dayOfWeek)
{
}
public void FullArgs(
bool b,
int i,
char c,
DayOfWeek e,
string s,
TimeSpan t,
DateTime d,
CustomObject o,
string[] sa,
int[] ia,
long[] ea,
object[] na,
List<string> sl)
{
}
public class CustomObject
{
public int Id { get; set; }
public CustomObject[] Children { get; set; }
}
public void Write(char character)
{
System.Console.Write(character);
}
public void WriteBlankLine()
{
System.Console.WriteLine();
}
}
}
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<connectionStrings>
<add name="RavenDebug" connectionString="URL=http://localhost:9090;Database=HangfireConsole" />
</connectionStrings>
@@ -0,0 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>3.1.1</Version>
<AssemblyVersion>3.1.1.0</AssemblyVersion>
<FileVersion>3.1.1.0</FileVersion>
<Description>Tests for RavenDB job storage for Hangfire</Description>
<Description>A collection of .Net utilities for JSON</Description>
<Authors>Refreshing Collective &lt;contact@refreshing.io&gt;</Authors>
<Company>Refreshing Collective LLC</Company>
<Copyright>Copyright @ Refreshing Collective LLC</Copyright>
<PackageLicenseUrl>http://www.gnu.org/licenses/lgpl-3.0.html</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/RefreshingIO/hangfire-ravendb</PackageProjectUrl>
<PackageIconUrl>https://avatars2.githubusercontent.com/u/7880472?v=3&amp;s=200</PackageIconUrl>
<PackageId>Hangfire.Raven.Tests</PackageId>
<PackageTags>Hangfire;AspNet;MVC;OWIN;RavenDB;Long-Running;Background;Fire-And-Forget;Delayed;Recurring;Tasks;Jobs;Scheduler;Threading;Queues</PackageTags>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/RefreshingIO/hangfire-ravendb</RepositoryUrl>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Hangfire.Raven\Hangfire.Raven.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170106-08" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-beta5-build1225" />
<PackageReference Include="Moq" Version="4.7.1" />
<PackageReference Include="xunit" Version="2.2.0-beta5-build3474" />
<PackageReference Include="RavenDB.Database" Version="3.5.3" />
</ItemGroup>
</Project>
@@ -0,0 +1,99 @@
using System;
using System.Linq;
using Moq;
using Xunit;
using Hangfire.Raven.JobQueues;
namespace Hangfire.Raven.Tests
{
public class PersistentJobQueueProviderCollectionFacts
{
private static readonly string[] Queues = { "default", "critical" };
private readonly Mock<IPersistentJobQueueProvider> _defaultProvider;
private readonly Mock<IPersistentJobQueueProvider> _provider;
public PersistentJobQueueProviderCollectionFacts()
{
_defaultProvider = new Mock<IPersistentJobQueueProvider>();
_provider = new Mock<IPersistentJobQueueProvider>();
}
[Fact]
public void Ctor_ThrowsAnException_WhenDefaultProviderIsNull()
{
Assert.Throws<ArgumentNullException>(
() => new PersistentJobQueueProviderCollection(null));
}
[Fact]
public void Enumeration_IncludesTheDefaultProvider()
{
var collection = CreateCollection();
var result = collection.ToArray();
Assert.Equal(1, result.Length);
Assert.Same(_defaultProvider.Object, result[0]);
}
[Fact]
public void GetProvider_ReturnsTheDefaultProvider_WhenProviderCanNotBeResolvedByQueue()
{
var collection = CreateCollection();
var provider = collection.GetProvider("queue");
Assert.Same(_defaultProvider.Object, provider);
}
[Fact]
public void Add_ThrowsAnException_WhenProviderIsNull()
{
var collection = CreateCollection();
var exception = Assert.Throws<ArgumentNullException>(
() => collection.Add(null, Queues));
Assert.Equal("provider", exception.ParamName);
}
[Fact]
public void Add_ThrowsAnException_WhenQueuesCollectionIsNull()
{
var collection = CreateCollection();
var exception = Assert.Throws<ArgumentNullException>(
() => collection.Add(_provider.Object, null));
Assert.Equal("queues", exception.ParamName);
}
[Fact]
public void Enumeration_ContainsAddedProvider()
{
var collection = CreateCollection();
collection.Add(_provider.Object, Queues);
Assert.Contains(_provider.Object, collection);
}
[Fact]
public void GetProvider_CanBeResolved_ByAnyQueue()
{
var collection = CreateCollection();
collection.Add(_provider.Object, Queues);
var provider1 = collection.GetProvider("default");
var provider2 = collection.GetProvider("critical");
Assert.NotSame(_defaultProvider.Object, provider1);
Assert.Same(provider1, provider2);
}
private PersistentJobQueueProviderCollection CreateCollection()
{
return new PersistentJobQueueProviderCollection(_defaultProvider.Object);
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,179 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Hangfire.Storage;
using Xunit;
using Hangfire.Raven.DistributedLocks;
using Hangfire.Raven.Storage;
using Hangfire.Raven.Entities;
using Raven.Client.Linq;
using System.Linq;
namespace Hangfire.Raven.Tests
{
public class RavenDistributedLockFacts
{
[Fact]
public void Ctor_ThrowsAnException_WhenResourceIsNull()
{
UseStorage(storage =>
{
var exception = Assert.Throws<ArgumentNullException>(
() => new RavenDistributedLock(storage, null, TimeSpan.Zero, new RavenStorageOptions()));
Assert.Equal("resource", exception.ParamName);
});
}
[Fact]
public void Ctor_ThrowsAnException_WhenStorageIsNull()
{
var exception = Assert.Throws<ArgumentNullException>(
() => new RavenDistributedLock(null, "resource1", TimeSpan.Zero, new RavenStorageOptions()));
Assert.Equal("storage", exception.ParamName);
}
[Fact]
public void Ctor_SetLock_WhenResourceIsNotLocked()
{
UseStorage(storage =>
{
using (new RavenDistributedLock(storage, "resource1", TimeSpan.Zero, new RavenStorageOptions()))
using (var session = storage.Repository.OpenSession())
{
var locksCount = session.Query<DistributedLock>().Where(_ => _.Resource == "resource1").Count();
Assert.Equal(1, locksCount);
}
});
}
[Fact]
public void Ctor_SetReleaseLock_WhenResourceIsNotLocked()
{
UseStorage(storage =>
{
using (new RavenDistributedLock(storage, "resource1", TimeSpan.Zero, new RavenStorageOptions()))
using (var session = storage.Repository.OpenSession())
{
var locksCount = session.Query<DistributedLock>().Where(_ => _.Resource == "resource1").Count();
Assert.Equal(1, locksCount);
}
using (var session = storage.Repository.OpenSession())
{
var locksCountAfter = session.Query<DistributedLock>().Where(_ => _.Resource == "resource1").Count();
Assert.Equal(0, locksCountAfter);
}
});
}
[Fact]
public void Ctor_AcquireLockWithinSameThread_WhenResourceIsLocked()
{
UseStorage(storage =>
{
using (new RavenDistributedLock(storage, "resource1", TimeSpan.Zero, new RavenStorageOptions()))
{
int locksCount;
using (var session = storage.Repository.OpenSession())
{
locksCount = session.Query<DistributedLock>().Where(_ => _.Resource == "resource1").Count();
Assert.Equal(1, locksCount);
}
using (new RavenDistributedLock(storage, "resource1", TimeSpan.Zero, new RavenStorageOptions()))
using (var session = storage.Repository.OpenSession())
{
locksCount = session.Query<DistributedLock>().Where(_ => _.Resource == "resource1").Count();
Assert.Equal(1, locksCount);
}
}
});
}
[Fact]
public void Ctor_ThrowsAnException_WhenResourceIsLocked()
{
UseStorage(storage =>
{
using (new RavenDistributedLock(storage, "resource1", TimeSpan.Zero, new RavenStorageOptions()))
using (var session = storage.Repository.OpenSession())
{
var locksCount = session.Query<DistributedLock>().Where(_ => _.Resource == "resource1").Count();
Assert.Equal(1, locksCount);
Task.Run(() =>
{
Assert.Throws<DistributedLockTimeoutException>(() =>
new RavenDistributedLock(storage, "resource1", TimeSpan.Zero, new RavenStorageOptions()));
}).Wait();
}
});
}
[Fact]
public void Ctor_WaitForLock_SignaledAtLockRelease()
{
UseStorage(storage =>
{
Task.Run(() =>
{
using (new RavenDistributedLock(storage, "resource1", TimeSpan.Zero, new RavenStorageOptions()))
{
Thread.Sleep(TimeSpan.FromSeconds(5));
}
});
// Wait just a bit to make sure the above lock is acuired
Thread.Sleep(TimeSpan.FromSeconds(1));
// Record when we try to aquire the lock
var startTime = DateTime.Now;
using (new RavenDistributedLock(storage, "resource1", TimeSpan.FromSeconds(30), new RavenStorageOptions()))
{
Assert.InRange(DateTime.Now - startTime, TimeSpan.Zero, TimeSpan.FromSeconds(5));
}
});
}
[Fact]
public void Ctor_ThrowsAnException_WhenOptionsIsNull()
{
UseStorage(storage =>
{
var exception = Assert.Throws<ArgumentNullException>(() =>
new RavenDistributedLock(storage, "resource1", TimeSpan.Zero, null));
Assert.Equal("options", exception.ParamName);
});
}
[Fact]
public void Ctor_SetLockExpireAtWorks_WhenResourceIsNotLocked()
{
UseStorage(storage =>
{
using (new RavenDistributedLock(storage, "resource1", TimeSpan.Zero, new RavenStorageOptions { DistributedLockLifetime = TimeSpan.FromSeconds(3) }))
using (var session = storage.Repository.OpenSession())
{
DateTime initialExpireAt = DateTime.UtcNow;
Thread.Sleep(TimeSpan.FromSeconds(5));
DistributedLock lockEntry = session.Query<DistributedLock>().Where(_ => _.Resource == "resource1").FirstOrDefault();
Assert.NotNull(lockEntry);
var expireAt = session.Advanced.GetExpire(lockEntry);
Assert.True(expireAt > initialExpireAt);
}
});
}
private static void UseStorage(Action<RavenStorage> action)
{
using (var repository = new TestRepository())
{
var storage = new RavenStorage(repository);
action(storage);
}
}
}
}
@@ -0,0 +1,166 @@
using Hangfire.Raven.Entities;
using Hangfire.Raven.Storage;
using System;
using System.Linq;
using Xunit;
namespace Hangfire.Raven.Tests
{
public class RavenFetchedJobFacts
{
private const string JobId = "id";
private const string Queue = "queue";
[Fact]
public void Ctor_ThrowsAnException_WhenStorageIsNull()
{
UseStorage(storage =>
{
var exception = Assert.Throws<ArgumentNullException>(
() => new RavenFetchedJob(null, new JobQueue()));
Assert.Equal("storage", exception.ParamName);
});
}
[Fact]
public void Ctor_ThrowsAnException_WhenJobQueueIsNull()
{
UseStorage(storage =>
{
var exception = Assert.Throws<ArgumentNullException>(() => new RavenFetchedJob(storage, null));
Assert.Equal("jobQueue", exception.ParamName);
});
}
[Fact]
public void Ctor_CorrectlySets_AllInstanceProperties()
{
UseStorage(storage =>
{
var fetchedJob = new RavenFetchedJob(storage, new JobQueue { Id = "1", JobId = JobId, Queue = Queue });
Assert.Equal("1", fetchedJob.Id);
Assert.Equal(JobId, fetchedJob.JobId);
Assert.Equal(Queue, fetchedJob.Queue);
});
}
[Fact]
public void RemoveFromQueue_ReallyDeletesTheJobFromTheQueue()
{
UseStorage(storage =>
{
// Arrange
var id = CreateJobQueueRecord(storage, "1", "default");
var processingJob = new RavenFetchedJob(storage, new JobQueue { Id = id, JobId = "1", Queue = "default" });
// Act
processingJob.RemoveFromQueue();
// Assert
using (var session = storage.Repository.OpenSession())
{
var count = session.Query<JobQueue>().Count();
Assert.Equal(0, count);
}
});
}
[Fact]
public void RemoveFromQueue_DoesNotDelete_UnrelatedJobs()
{
UseStorage(storage =>
{
// Arrange
CreateJobQueueRecord(storage, "1", "default");
CreateJobQueueRecord(storage, "1", "critical");
CreateJobQueueRecord(storage, "2", "default");
var fetchedJob = new RavenFetchedJob(storage, new JobQueue { Id = "999", JobId = "1", Queue = "default" });
// Act
fetchedJob.RemoveFromQueue();
// Assert
using (var session = storage.Repository.OpenSession())
{
var count = session.Query<JobQueue>().Count();
Assert.Equal(3, count);
}
});
}
[Fact]
public void Requeue_SetsFetchedAtValueToNull()
{
UseStorage(storage =>
{
// Arrange
var id = CreateJobQueueRecord(storage, "1", "default");
var processingJob = new RavenFetchedJob(storage, new JobQueue { Id = id, JobId = "1", Queue = "default" });
// Act
processingJob.Requeue();
// Assert
using (var session = storage.Repository.OpenSession())
{
var record = session.Query<JobQueue>().Single();
Assert.Null(record.FetchedAt);
}
});
}
[Fact]
public void Dispose_SetsFetchedAtValueToNull_IfThereWereNoCallsToComplete()
{
UseStorage(storage =>
{
// Arrange
var id = CreateJobQueueRecord(storage, "1", "default");
var processingJob = new RavenFetchedJob(storage, new JobQueue { Id = id, JobId = "1", Queue = "default" });
// Act
processingJob.Dispose();
// Assert
using (var session = storage.Repository.OpenSession())
{
var record = session.Query<JobQueue>().Single();
Assert.Null(record.FetchedAt);
}
});
}
private static string CreateJobQueueRecord(RavenStorage storage, string jobId, string queue)
{
var jobQueue = new JobQueue
{
Id = storage.Repository.GetId(typeof(JobQueue), queue, jobId),
JobId = jobId,
Queue = queue,
FetchedAt = DateTime.UtcNow
};
using (var session = storage.Repository.OpenSession())
{
session.Store(jobQueue);
session.SaveChanges();
}
return jobQueue.Id;
}
private static void UseStorage(Action<RavenStorage> action)
{
using (var repository = new TestRepository())
{
var storage = new RavenStorage(repository);
action(storage);
}
}
}
}
@@ -0,0 +1,394 @@
using Hangfire.Raven.Entities;
using Hangfire.Raven.JobQueues;
using Hangfire.Raven.Storage;
using System;
using System.Linq;
using System.Threading;
using Xunit;
namespace Hangfire.Raven.Tests
{
public class RavenJobQueueFacts
{
private static readonly string[] DefaultQueues = { "default" };
[Fact]
public void Ctor_ThrowsAnException_WhenStorageIsNull()
{
var exception = Assert.Throws<ArgumentNullException>(
() => new RavenJobQueue(null, new RavenStorageOptions()));
Assert.Equal("storage", exception.ParamName);
}
[Fact]
public void Ctor_ThrowsAnException_WhenOptionsValueIsNull()
{
UseStorage(storage =>
{
var exception = Assert.Throws<ArgumentNullException>(
() => new RavenJobQueue(storage, null));
Assert.Equal("options", exception.ParamName);
});
}
[Fact]
public void Dequeue_ShouldThrowAnException_WhenQueuesCollectionIsNull()
{
UseStorage(storage =>
{
var queue = CreateJobQueue(storage);
var exception = Assert.Throws<ArgumentNullException>(
() => queue.Dequeue(null, CreateTimingOutCancellationToken()));
Assert.Equal("queues", exception.ParamName);
});
}
[Fact]
public void Dequeue_ShouldThrowAnException_WhenQueuesCollectionIsEmpty()
{
UseStorage(storage =>
{
var queue = CreateJobQueue(storage);
var exception = Assert.Throws<ArgumentException>(
() => queue.Dequeue(new string[0], CreateTimingOutCancellationToken()));
Assert.Equal("queues", exception.ParamName);
});
}
[Fact]
public void Dequeue_ThrowsOperationCanceled_WhenCancellationTokenIsSetAtTheBeginning()
{
UseStorage(storage =>
{
var cts = new CancellationTokenSource();
cts.Cancel();
var queue = CreateJobQueue(storage);
Assert.Throws<OperationCanceledException>(() => queue.Dequeue(DefaultQueues, cts.Token));
});
}
[Fact]
public void Dequeue_ShouldWaitIndefinitely_WhenThereAreNoJobs()
{
UseStorage(storage =>
{
var cts = new CancellationTokenSource(200);
var queue = CreateJobQueue(storage);
Assert.Throws<OperationCanceledException>(() => queue.Dequeue(DefaultQueues, cts.Token));
});
}
[Fact]
public void Dequeue_ShouldFetchAJob_FromTheSpecifiedQueue()
{
// Arrange
UseStorage(storage =>
{
var queue = CreateJobQueue(storage);
var jobQueue = new JobQueue
{
Id = storage.Repository.GetId(typeof(JobQueue), "default", "1"),
JobId = "1",
Queue = "default"
};
using (var session = storage.Repository.OpenSession())
{
session.Store(jobQueue);
session.SaveChanges();
}
// Act
RavenFetchedJob payload = (RavenFetchedJob)queue.Dequeue(DefaultQueues, CreateTimingOutCancellationToken());
// Assert
var id = jobQueue.Id;
Assert.Equal(id, payload.Id);
Assert.Equal("1", payload.JobId);
Assert.Equal("default", payload.Queue);
});
}
[Fact]
public void Dequeue_ShouldLeaveJobInTheQueue_ButSetItsFetchedAtValue()
{
// Arrange
UseStorage(storage =>
{
var queue = CreateJobQueue(storage);
var jobId = Guid.NewGuid().ToString();
var job = new RavenJob
{
Id = storage.Repository.GetId(typeof(RavenJob), jobId),
InvocationData = null,
CreatedAt = DateTime.UtcNow
};
var jobQueue = new JobQueue
{
Id = storage.Repository.GetId(typeof(JobQueue), "default", jobId),
JobId = jobId,
Queue = "default"
};
using (var session = storage.Repository.OpenSession())
{
session.Store(job);
session.Store(jobQueue);
session.SaveChanges();
}
// Act
var payload = queue.Dequeue(DefaultQueues, CreateTimingOutCancellationToken());
// Assert
Assert.NotNull(payload);
using (var session = storage.Repository.OpenSession())
{
var fetchedAt = session.Query<JobQueue>().Where(_ => _.JobId == payload.JobId).FirstOrDefault().FetchedAt;
Assert.NotNull(fetchedAt);
Assert.True(fetchedAt > DateTime.UtcNow.AddMinutes(-1));
}
});
}
[Fact]
public void Dequeue_ShouldFetchATimedOutJobs_FromTheSpecifiedQueue()
{
// Arrange
UseStorage(storage =>
{
var queue = CreateJobQueue(storage);
var jobId = Guid.NewGuid().ToString();
var job = new RavenJob
{
Id = storage.Repository.GetId(typeof(RavenJob), jobId),
InvocationData = null,
CreatedAt = DateTime.UtcNow
};
var jobQueue = new JobQueue
{
Id = storage.Repository.GetId(typeof(JobQueue), "default", jobId),
JobId = jobId,
Queue = "default",
FetchedAt = DateTime.UtcNow.AddDays(-1)
};
using (var session = storage.Repository.OpenSession())
{
session.Store(job);
session.Store(jobQueue);
session.SaveChanges();
}
// Act
var payload = queue.Dequeue(DefaultQueues, CreateTimingOutCancellationToken());
// Assert
Assert.NotEmpty(payload.JobId);
});
}
[Fact]
public void Dequeue_ShouldSetFetchedAt_OnlyForTheFetchedJob()
{
UseStorage(storage =>
{
// Arrange
var queue = CreateJobQueue(storage);
using (var session = storage.Repository.OpenSession())
{
var job1Id = Guid.NewGuid().ToString();
var job1 = new RavenJob
{
Id = storage.Repository.GetId(typeof(RavenJob), job1Id),
InvocationData = null,
CreatedAt = DateTime.UtcNow
};
session.Store(job1);
var job2Id = Guid.NewGuid().ToString();
var job2 = new RavenJob
{
Id = storage.Repository.GetId(typeof(RavenJob), job2Id),
InvocationData = null,
CreatedAt = DateTime.UtcNow
};
session.Store(job2);
session.Store(new JobQueue
{
Id = storage.Repository.GetId(typeof(JobQueue), "default", job1Id),
JobId = job1Id,
Queue = "default"
});
session.Store(new JobQueue
{
Id = storage.Repository.GetId(typeof(JobQueue), "default", job2Id),
JobId = job2Id,
Queue = "default"
});
session.SaveChanges();
}
// Act
var payload = queue.Dequeue(DefaultQueues, CreateTimingOutCancellationToken());
// Assert
using (var session = storage.Repository.OpenSession())
{
var otherJobFetchedAt = session.Query<JobQueue>().Where(_ => _.JobId != payload.JobId).FirstOrDefault().FetchedAt;
Assert.Null(otherJobFetchedAt);
}
});
}
[Fact]
public void Dequeue_ShouldFetchJobs_OnlyFromSpecifiedQueues()
{
UseStorage(storage =>
{
var queue = CreateJobQueue(storage);
using (var session = storage.Repository.OpenSession())
{
var job1Id = Guid.NewGuid().ToString();
var job1 = new RavenJob
{
Id = storage.Repository.GetId(typeof(RavenJob), job1Id),
InvocationData = null,
CreatedAt = DateTime.UtcNow
};
session.Store(job1);
session.Store(new JobQueue
{
Id = storage.Repository.GetId(typeof(JobQueue), "critical", job1Id),
JobId = job1Id,
Queue = "critical"
});
session.SaveChanges();
}
Assert.Throws<OperationCanceledException>(() => queue.Dequeue(DefaultQueues, CreateTimingOutCancellationToken()));
});
}
[Fact]
public void Dequeue_ShouldFetchJobs_FromMultipleQueuesBasedOnQueuePriority()
{
UseStorage(storage =>
{
var queue = CreateJobQueue(storage);
using (var session = storage.Repository.OpenSession())
{
var criticalJobId = Guid.NewGuid().ToString();
var criticalJob = new RavenJob
{
Id = storage.Repository.GetId(typeof(RavenJob), criticalJobId),
InvocationData = null,
CreatedAt = DateTime.UtcNow
};
session.Store(criticalJob);
var defaultJobId = Guid.NewGuid().ToString();
var defaultJob = new RavenJob
{
Id = storage.Repository.GetId(typeof(RavenJob), defaultJobId),
InvocationData = null,
CreatedAt = DateTime.UtcNow
};
session.Store(defaultJob);
session.Store(new JobQueue
{
Id = storage.Repository.GetId(typeof(JobQueue), "default", defaultJobId),
JobId = defaultJobId,
Queue = "default"
});
session.Store(new JobQueue
{
Id = storage.Repository.GetId(typeof(JobQueue), "critical", criticalJobId),
JobId = criticalJobId,
Queue = "critical"
});
session.SaveChanges();
}
var critical = (RavenFetchedJob)queue.Dequeue(
new[] { "critical", "default" },
CreateTimingOutCancellationToken());
Assert.NotNull(critical.JobId);
Assert.Equal("critical", critical.Queue);
var @default = (RavenFetchedJob)queue.Dequeue(
new[] { "critical", "default" },
CreateTimingOutCancellationToken());
Assert.NotNull(@default.JobId);
Assert.Equal("default", @default.Queue);
});
}
[Fact]
public void Enqueue_AddsAJobToTheQueue()
{
UseStorage(storage =>
{
var queue = CreateJobQueue(storage);
queue.Enqueue("default", "1");
using (var session = storage.Repository.OpenSession())
{
var record = session.Query<JobQueue>().Single();
Assert.Equal("1", record.JobId.ToString());
Assert.Equal("default", record.Queue);
Assert.Null(record.FetchedAt);
}
});
}
private static CancellationToken CreateTimingOutCancellationToken()
{
var source = new CancellationTokenSource(TimeSpan.FromSeconds(10));
return source.Token;
}
private static RavenJobQueue CreateJobQueue(RavenStorage storage)
{
return new RavenJobQueue(storage, new RavenStorageOptions());
}
private static void UseStorage(Action<RavenStorage> action)
{
using (var repository = new TestRepository())
{
var storage = new RavenStorage(repository);
action(storage);
}
}
}
}
@@ -0,0 +1,323 @@
using Hangfire.Raven.Entities;
using Hangfire.Raven.JobQueues;
using Hangfire.Raven.Storage;
using Hangfire.Storage;
using System;
using System.Linq;
using Xunit;
namespace Hangfire.Raven.Tests
{
public class RavenJobQueueMonitoringApiFacts
{
private const string QueueName1 = "queueName1";
private const string QueueName2 = "queueName2";
[Fact]
public void Ctor_ThrowsAnException_WhenStorageIsNull()
{
var exception = Assert.Throws<ArgumentNullException>(() => new RavenJobQueueMonitoringApi(null));
Assert.Equal("storage", exception.ParamName);
}
[Fact]
public void GetQueues_ShouldReturnEmpty_WhenNoQueuesExist()
{
UseStorage(storage =>
{
var ravenJobQueueMonitoringApi = CreateRavenJobQueueMonitoringApi(storage);
var queues = ravenJobQueueMonitoringApi.GetQueues();
Assert.Empty(queues);
});
}
[Fact]
public void GetQueues_ShouldReturnOneQueue_WhenOneQueueExists()
{
UseStorage(storage =>
{
var ravenJobQueueMonitoringApi = CreateRavenJobQueueMonitoringApi(storage);
CreateJobQueue(storage, QueueName1, false);
var queues = ravenJobQueueMonitoringApi.GetQueues().ToList();
Assert.Equal(1, queues.Count);
Assert.Equal(QueueName1, queues.First());
});
}
[Fact]
public void GetQueues_ShouldReturnTwoUniqueQueues_WhenThreeNonUniqueQueuesExist()
{
UseStorage(storage =>
{
var ravenJobQueueMonitoringApi = CreateRavenJobQueueMonitoringApi(storage);
CreateJobQueue(storage, QueueName1, false);
CreateJobQueue(storage, QueueName1, false);
CreateJobQueue(storage, QueueName2, false);
var queues = ravenJobQueueMonitoringApi.GetQueues().ToList();
Assert.Equal(2, queues.Count);
Assert.True(queues.Contains(QueueName1));
Assert.True(queues.Contains(QueueName2));
});
}
[Fact]
public void GetEnqueuedJobIds_ShouldReturnEmpty_WheNoQueuesExist()
{
UseStorage(storage =>
{
var mongoJobQueueMonitoringApi = CreateRavenJobQueueMonitoringApi(storage);
var enqueuedJobIds = mongoJobQueueMonitoringApi.GetEnqueuedJobIds(QueueName1, 0, 10);
Assert.Empty(enqueuedJobIds);
});
}
[Fact]
public void GetEnqueuedJobIds_ShouldReturnEmpty_WhenOneJobWithAFetchedStateExists()
{
UseStorage(storage =>
{
var ravenJobQueueMonitoringApi = CreateRavenJobQueueMonitoringApi(storage);
CreateJobQueue(storage, QueueName1, true);
var enqueuedJobIds = ravenJobQueueMonitoringApi.GetEnqueuedJobIds(QueueName1, 0, 10).ToList();
Assert.Empty(enqueuedJobIds);
});
}
[Fact]
public void GetEnqueuedJobIds_ShouldReturnOneJobId_WhenOneJobExists()
{
UseStorage(storage =>
{
var ravenJobQueueMonitoringApi = CreateRavenJobQueueMonitoringApi(storage);
var jobQueue = CreateJobQueue(storage, QueueName1, false);
var enqueuedJobIds = ravenJobQueueMonitoringApi.GetEnqueuedJobIds(QueueName1, 0, 10).ToList();
Assert.Equal(1, enqueuedJobIds.Count);
Assert.Equal(jobQueue.JobId, enqueuedJobIds.First());
});
}
[Fact]
public void GetEnqueuedJobIds_ShouldReturnThreeJobIds_WhenThreeJobsExists()
{
UseStorage(storage =>
{
var ravenJobQueueMonitoringApi = CreateRavenJobQueueMonitoringApi(storage);
var jobQueue = CreateJobQueue(storage, QueueName1, false);
var jobQueue2 = CreateJobQueue(storage, QueueName1, false);
var jobQueue3 = CreateJobQueue(storage, QueueName1, false);
var enqueuedJobIds = ravenJobQueueMonitoringApi.GetEnqueuedJobIds(QueueName1, 0, 10).ToList();
Assert.Equal(3, enqueuedJobIds.Count);
Assert.True(enqueuedJobIds.Contains(jobQueue.JobId));
Assert.True(enqueuedJobIds.Contains(jobQueue2.JobId));
Assert.True(enqueuedJobIds.Contains(jobQueue3.JobId));
});
}
[Fact]
public void GetEnqueuedJobIds_ShouldReturnTwoJobIds_WhenThreeJobsExistsButOnlyTwoInRequestedQueue()
{
UseStorage(storage =>
{
var ravenJobQueueMonitoringApi = CreateRavenJobQueueMonitoringApi(storage);
var jobQueue = CreateJobQueue(storage, QueueName1, false);
var jobQueue2 = CreateJobQueue(storage, QueueName1, false);
CreateJobQueue(storage, QueueName2, false);
var enqueuedJobIds = ravenJobQueueMonitoringApi.GetEnqueuedJobIds(QueueName1, 0, 10).ToList();
Assert.Equal(2, enqueuedJobIds.Count);
Assert.True(enqueuedJobIds.Contains(jobQueue.JobId));
Assert.True(enqueuedJobIds.Contains(jobQueue2.JobId));
});
}
[Fact]
public void GetEnqueuedJobIds_ShouldReturnTwoJobIds_WhenThreeJobsExistsButLimitIsSet()
{
UseStorage(storage =>
{
var ravenJobQueueMonitoringApi = CreateRavenJobQueueMonitoringApi(storage);
var jobQueue = CreateJobQueue(storage, QueueName1, false);
var jobQueue2 = CreateJobQueue(storage, QueueName1, false);
CreateJobQueue(storage, QueueName1, false);
var enqueuedJobIds = ravenJobQueueMonitoringApi.GetEnqueuedJobIds(QueueName1, 0, 2).ToList();
Assert.Equal(2, enqueuedJobIds.Count);
Assert.True(enqueuedJobIds.Contains(jobQueue.JobId));
Assert.True(enqueuedJobIds.Contains(jobQueue2.JobId));
});
}
[Fact]
public void GetFetchedJobIds_ShouldReturnEmpty_WheNoQueuesExist()
{
UseStorage(storage =>
{
var ravenJobQueueMonitoringApi = CreateRavenJobQueueMonitoringApi(storage);
var enqueuedJobIds = ravenJobQueueMonitoringApi.GetFetchedJobIds(QueueName1, 0, 10);
Assert.Empty(enqueuedJobIds);
});
}
[Fact]
public void GetFetchedJobIds_ShouldReturnEmpty_WhenOneJobWithNonFetchedStateExists()
{
UseStorage(storage =>
{
var ravenJobQueueMonitoringApi = CreateRavenJobQueueMonitoringApi(storage);
CreateJobQueue(storage, QueueName1, false);
var enqueuedJobIds = ravenJobQueueMonitoringApi.GetFetchedJobIds(QueueName1, 0, 10).ToList();
Assert.Empty(enqueuedJobIds);
});
}
[Fact]
public void GetFetchedJobIds_ShouldReturnOneJobId_WhenOneJobExists()
{
UseStorage(storage =>
{
var ravenJobQueueMonitoringApi = CreateRavenJobQueueMonitoringApi(storage);
var jobQueue = CreateJobQueue(storage, QueueName1, true);
var enqueuedJobIds = ravenJobQueueMonitoringApi.GetFetchedJobIds(QueueName1, 0, 10).ToList();
Assert.Equal(1, enqueuedJobIds.Count);
Assert.Equal(jobQueue.JobId, enqueuedJobIds.First());
});
}
[Fact]
public void GetFetchedJobIds_ShouldReturnThreeJobIds_WhenThreeJobsExists()
{
UseStorage(storage =>
{
var ravenJobQueueMonitoringApi = CreateRavenJobQueueMonitoringApi(storage);
var jobQueue = CreateJobQueue(storage, QueueName1, true);
var jobQueue2 = CreateJobQueue(storage, QueueName1, true);
var jobQueue3 = CreateJobQueue(storage, QueueName1, true);
var enqueuedJobIds = ravenJobQueueMonitoringApi.GetFetchedJobIds(QueueName1, 0, 10).ToList();
Assert.Equal(3, enqueuedJobIds.Count);
Assert.True(enqueuedJobIds.Contains(jobQueue.JobId));
Assert.True(enqueuedJobIds.Contains(jobQueue2.JobId));
Assert.True(enqueuedJobIds.Contains(jobQueue3.JobId));
});
}
[Fact]
public void GetFetchedJobIds_ShouldReturnTwoJobIds_WhenThreeJobsExistsButOnlyTwoInRequestedQueue()
{
UseStorage(storage =>
{
var ravenJobQueueMonitoringApi = CreateRavenJobQueueMonitoringApi(storage);
var jobQueue = CreateJobQueue(storage, QueueName1, true);
var jobQueue2 = CreateJobQueue(storage, QueueName1, true);
CreateJobQueue(storage, QueueName2, true);
var enqueuedJobIds = ravenJobQueueMonitoringApi.GetFetchedJobIds(QueueName1, 0, 10).ToList();
Assert.Equal(2, enqueuedJobIds.Count);
Assert.True(enqueuedJobIds.Contains(jobQueue.JobId));
Assert.True(enqueuedJobIds.Contains(jobQueue2.JobId));
});
}
[Fact]
public void GetFetchedJobIds_ShouldReturnTwoJobIds_WhenThreeJobsExistsButLimitIsSet()
{
UseStorage(storage =>
{
var ravenJobQueueMonitoringApi = CreateRavenJobQueueMonitoringApi(storage);
var jobQueue = CreateJobQueue(storage, QueueName1, true);
var jobQueue2 = CreateJobQueue(storage, QueueName1, true);
CreateJobQueue(storage, QueueName1, true);
var enqueuedJobIds = ravenJobQueueMonitoringApi.GetFetchedJobIds(QueueName1, 0, 2).ToList();
Assert.Equal(2, enqueuedJobIds.Count);
Assert.True(enqueuedJobIds.Contains(jobQueue.JobId));
Assert.True(enqueuedJobIds.Contains(jobQueue2.JobId));
});
}
private static JobQueue CreateJobQueue(RavenStorage storage, string queue, bool isFetched)
{
var jobId = Guid.NewGuid().ToString();
var job = new RavenJob
{
Id = storage.Repository.GetId(typeof(RavenJob), jobId),
CreatedAt = DateTime.UtcNow,
StateData = new StateData()
};
var jobQueue = new JobQueue
{
Id = storage.Repository.GetId(typeof(JobQueue), queue, jobId),
Queue = queue,
JobId = jobId
};
if (isFetched)
{
jobQueue.FetchedAt = DateTime.UtcNow.AddDays(-1);
}
using (var session = storage.Repository.OpenSession())
{
session.Store(job);
session.Store(jobQueue);
session.SaveChanges();
}
return jobQueue;
}
private static RavenJobQueueMonitoringApi CreateRavenJobQueueMonitoringApi(RavenStorage storage)
{
return new RavenJobQueueMonitoringApi(storage);
}
private static void UseStorage(Action<RavenStorage> action)
{
using (var repository = new TestRepository())
{
var storage = new RavenStorage(repository);
action(storage);
}
}
}
}
@@ -0,0 +1,304 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Hangfire.Common;
using Hangfire.States;
using Hangfire.Storage;
using Moq;
using Xunit;
using Hangfire.Raven.JobQueues;
using Hangfire.Raven.Storage;
using Hangfire.Raven.Entities;
using System.Linq;
namespace Hangfire.Raven.Tests
{
public class RavenMonitoringApiFacts
{
private const string DefaultQueue = "default";
private const string FetchedStateName = "Fetched";
private const int From = 0;
private const int PerPage = 5;
private readonly Mock<IPersistentJobQueue> _queue;
private readonly Mock<IPersistentJobQueueProvider> _provider;
private readonly Mock<IPersistentJobQueueMonitoringApi> _persistentJobQueueMonitoringApi;
private readonly PersistentJobQueueProviderCollection _providers;
public RavenMonitoringApiFacts()
{
_queue = new Mock<IPersistentJobQueue>();
_persistentJobQueueMonitoringApi = new Mock<IPersistentJobQueueMonitoringApi>();
_provider = new Mock<IPersistentJobQueueProvider>();
_provider.Setup(x => x.GetJobQueue()).Returns(_queue.Object);
_provider.Setup(x => x.GetJobQueueMonitoringApi())
.Returns(_persistentJobQueueMonitoringApi.Object);
_providers = new PersistentJobQueueProviderCollection(_provider.Object);
}
[Fact]
public void GetStatistics_ReturnsZero_WhenNoJobsExist()
{
UseMonitoringApi((repository, monitoringApi) =>
{
var result = monitoringApi.GetStatistics();
Assert.Equal(0, result.Enqueued);
Assert.Equal(0, result.Failed);
Assert.Equal(0, result.Processing);
Assert.Equal(0, result.Scheduled);
});
}
[Fact]
public void GetStatistics_ReturnsExpectedCounts_WhenJobsExist()
{
UseMonitoringApi((repository, monitoringApi) =>
{
CreateJobInState(repository, "1", EnqueuedState.StateName);
CreateJobInState(repository, "2", EnqueuedState.StateName);
CreateJobInState(repository, "4", FailedState.StateName);
CreateJobInState(repository, "5", ProcessingState.StateName);
CreateJobInState(repository, "6", ScheduledState.StateName);
CreateJobInState(repository, "7", ScheduledState.StateName);
var result = monitoringApi.GetStatistics();
Assert.Equal(2, result.Enqueued);
Assert.Equal(1, result.Failed);
Assert.Equal(1, result.Processing);
Assert.Equal(2, result.Scheduled);
});
}
[Fact]
public void JobDetails_ReturnsNull_WhenThereIsNoSuchJob()
{
UseMonitoringApi((repository, monitoringApi) =>
{
var result = monitoringApi.JobDetails("547527");
Assert.Null(result);
});
}
[Fact]
public void JobDetails_ReturnsResult_WhenJobExists()
{
UseMonitoringApi((repository, monitoringApi) =>
{
var job1 = CreateJobInState(repository, "1", EnqueuedState.StateName);
var result = monitoringApi.JobDetails(job1.Id.Split(new[] { '/' }, 2)[1]);
Assert.NotNull(result);
Assert.NotNull(result.Job);
Assert.Equal("Arguments", result.Job.Args[0]);
Assert.True(DateTime.UtcNow.AddMinutes(-1) < result.CreatedAt);
Assert.True(result.CreatedAt < DateTime.UtcNow.AddMinutes(1));
});
}
[Fact]
public void EnqueuedJobs_ReturnsEmpty_WhenThereIsNoJobs()
{
UseMonitoringApi((repository, monitoringApi) =>
{
var jobIds = new List<string>();
_persistentJobQueueMonitoringApi.Setup(x => x
.GetEnqueuedJobIds(DefaultQueue, From, PerPage))
.Returns(jobIds);
var resultList = monitoringApi.EnqueuedJobs(DefaultQueue, From, PerPage);
Assert.Empty(resultList);
});
}
[Fact]
public void EnqueuedJobs_ReturnsSingleJob_WhenOneJobExistsThatIsNotFetched()
{
UseMonitoringApi((repository, monitoringApi) =>
{
var unfetchedJob = CreateJobInState(repository, "1", EnqueuedState.StateName);
var jobIds = new List<string> { unfetchedJob.Id };
_persistentJobQueueMonitoringApi.Setup(x => x
.GetEnqueuedJobIds(DefaultQueue, From, PerPage))
.Returns(jobIds.Select(x => x.Split(new[] { '/' }, 2)[1]));
var resultList = monitoringApi.EnqueuedJobs(DefaultQueue, From, PerPage);
Assert.Equal(1, resultList.Count);
});
}
[Fact]
public void EnqueuedJobs_ReturnsEmpty_WhenOneJobExistsThatIsFetched()
{
UseMonitoringApi((repository, monitoringApi) =>
{
var fetchedJob = CreateJobInState(repository, "1", FetchedStateName);
var jobIds = new List<string> { fetchedJob.Id };
_persistentJobQueueMonitoringApi.Setup(x => x
.GetEnqueuedJobIds(DefaultQueue, From, PerPage))
.Returns(jobIds.Select(x => x.Split(new[] { '/' }, 2)[1]));
var resultList = monitoringApi.EnqueuedJobs(DefaultQueue, From, PerPage);
Assert.Empty(resultList);
});
}
[Fact]
public void EnqueuedJobs_ReturnsUnfetchedJobsOnly_WhenMultipleJobsExistsInFetchedAndUnfetchedStates()
{
UseMonitoringApi((repository, monitoringApi) =>
{
var unfetchedJob = CreateJobInState(repository, "1", EnqueuedState.StateName);
var unfetchedJob2 = CreateJobInState(repository, "2", EnqueuedState.StateName);
var fetchedJob = CreateJobInState(repository, "3", FetchedStateName);
var jobIds = new List<string> { unfetchedJob.Id, unfetchedJob2.Id, fetchedJob.Id };
_persistentJobQueueMonitoringApi.Setup(x => x
.GetEnqueuedJobIds(DefaultQueue, From, PerPage))
.Returns(jobIds.Select(x => x.Split(new[] { '/' }, 2)[1]));
var resultList = monitoringApi.EnqueuedJobs(DefaultQueue, From, PerPage);
Assert.Equal(2, resultList.Count);
});
}
[Fact]
public void FetchedJobs_ReturnsEmpty_WhenThereIsNoJobs()
{
UseMonitoringApi((repository, monitoringApi) =>
{
var jobIds = new List<string>();
_persistentJobQueueMonitoringApi.Setup(x => x
.GetFetchedJobIds(DefaultQueue, From, PerPage))
.Returns(jobIds);
var resultList = monitoringApi.FetchedJobs(DefaultQueue, From, PerPage);
Assert.Empty(resultList);
});
}
[Fact]
public void FetchedJobs_ReturnsSingleJob_WhenOneJobExistsThatIsFetched()
{
UseMonitoringApi((repository, monitoringApi) =>
{
var fetchedJob = CreateJobInState(repository, "1", FetchedStateName);
var jobIds = new List<string> { fetchedJob.Id };
_persistentJobQueueMonitoringApi.Setup(x => x
.GetFetchedJobIds(DefaultQueue, From, PerPage))
.Returns(jobIds.Select(x => x.Split(new[] { '/' }, 2)[1]));
var resultList = monitoringApi.FetchedJobs(DefaultQueue, From, PerPage);
Assert.Equal(1, resultList.Count);
});
}
[Fact]
public void FetchedJobs_ReturnsEmpty_WhenOneJobExistsThatIsNotFetched()
{
UseMonitoringApi((repository, monitoringApi) =>
{
var unfetchedJob = CreateJobInState(repository, "1", EnqueuedState.StateName);
var jobIds = new List<string> { unfetchedJob.Id };
_persistentJobQueueMonitoringApi.Setup(x => x
.GetFetchedJobIds(DefaultQueue, From, PerPage))
.Returns(jobIds.Select(x => x.Split(new[] { '/' }, 2)[1]));
var resultList = monitoringApi.FetchedJobs(DefaultQueue, From, PerPage);
Assert.Empty(resultList);
});
}
[Fact]
public void FetchedJobs_ReturnsFetchedJobsOnly_WhenMultipleJobsExistsInFetchedAndUnfetchedStates()
{
UseMonitoringApi((repository, monitoringApi) =>
{
var fetchedJob = CreateJobInState(repository, "1", FetchedStateName);
var fetchedJob2 = CreateJobInState(repository, "2", FetchedStateName);
var unfetchedJob = CreateJobInState(repository, "3", EnqueuedState.StateName);
var jobIds = new List<string> { fetchedJob.Id, fetchedJob2.Id, unfetchedJob.Id };
_persistentJobQueueMonitoringApi.Setup(x => x
.GetFetchedJobIds(DefaultQueue, From, PerPage))
.Returns(jobIds.Select(x => x.Split(new[] { '/' }, 2)[1]));
var resultList = monitoringApi.FetchedJobs(DefaultQueue, From, PerPage);
Assert.Equal(2, resultList.Count);
});
}
public static void SampleMethod(string arg)
{
Debug.WriteLine(arg);
}
private void UseMonitoringApi(Action<IRepository, RavenStorageMonitoringApi> action)
{
using (var repository = new TestRepository())
{
var storage = new Mock<RavenStorage>(repository);
storage.Setup(x => x.QueueProviders).Returns(_providers);
action(repository, new RavenStorageMonitoringApi(storage.Object));
}
}
private RavenJob CreateJobInState(IRepository repository, string jobId, string stateName)
{
var job = Job.FromExpression(() => SampleMethod("Arguments"));
var ravenJob = new RavenJob
{
Id = repository.GetId(typeof(RavenJob), jobId),
InvocationData = InvocationData.Serialize(job),
CreatedAt = DateTime.UtcNow,
StateData = new StateData
{
Name = stateName,
Data =
stateName == EnqueuedState.StateName
? new Dictionary<string, string> { ["EnqueuedAt"] = $"{DateTime.UtcNow:o}" }
: new Dictionary<string, string>(),
}
};
var jobQueue = new JobQueue
{
FetchedAt = null,
Id = repository.GetId(typeof(JobQueue), DefaultQueue, jobId),
JobId = jobId,
Queue = DefaultQueue
};
if (stateName == FetchedStateName)
{
jobQueue.FetchedAt = DateTime.UtcNow;
}
using (var session = repository.OpenSession())
{
session.Store(ravenJob);
session.Store(jobQueue);
session.SaveChanges();
}
return ravenJob;
}
}
}

Some files were not shown because too many files have changed in this diff Show More