mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Merge branch 'dev' into use-nuget-instead-of-lib-folder
Conflicts: lib/aspnetmvc/System.Web.Helpers.xml lib/aspnetmvc/System.Web.Mvc.xml lib/aspnetmvc/System.Web.Razor.xml lib/aspnetmvc/System.Web.WebPages.Deployment.xml lib/aspnetmvc/System.Web.WebPages.Razor.xml lib/aspnetmvc/System.Web.WebPages.xml lib/aspnetwebapi/System.Net.Http.Formatting.xml lib/aspnetwebapi/System.Web.Http.WebHost.xml lib/aspnetwebapi/System.Web.Http.xml lib/autofac/Autofac.Configuration.xml lib/autofac/Autofac.XML lib/autofac/License.txt lib/dlr/LICENSE.APACHE.html lib/dlr/LICENSE.CPL.txt lib/dlr/LICENSE.Ruby.txt lib/dlr/README.txt lib/dotnetzip/Ionic.Zip.xml lib/dotnetzip/License.txt lib/htmlagilitypack/HtmlAgilityPack.XML lib/imageresizer/license.txt lib/log4net/log4net.xml lib/lucene.net/Lucene.Net.xml lib/moq/Moq.xml lib/newtonsoft.json/Newtonsoft.Json.xml lib/newtonsoft.json/license.txt lib/nhibernate/Iesi.Collections.xml lib/nunit/NUnitFitTests.html lib/nunit/NUnitTests.config lib/nunit/NUnitTests.nunit lib/nunit/agent.conf lib/nunit/agent.log.conf lib/nunit/clr.bat lib/nunit/launcher.log.conf lib/nunit/license.txt lib/nunit/nunit-agent.exe.config lib/nunit/nunit-console-x86.exe.config lib/nunit/nunit-console.exe.config lib/nunit/nunit-x86.exe.config lib/nunit/nunit.exe.config lib/nunit/pnunit-agent.exe.config lib/nunit/pnunit-launcher.exe.config lib/nunit/runFile.exe.config lib/nunit/runpnunit.bat lib/nunit/test.conf lib/specflow/LICENSE.txt lib/specflow/TechTalk.SpecFlow.targets lib/specflow/TechTalk.SpecFlow.tasks lib/specflow/changelog.txt lib/windowsazure/Microsoft.ApplicationServer.Caching.AzureCommon.xml lib/windowsazure/Microsoft.ApplicationServer.Caching.Client.xml lib/windowsazure/Microsoft.ApplicationServer.Caching.Core.xml src/Orchard.Core.Tests/Orchard.Core.Tests.csproj src/Orchard.Profile/Orchard.Profile.csproj src/Orchard.Specs/App.Config src/Orchard.Specs/Orchard.Specs.csproj src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj src/Orchard.Tests/Orchard.Framework.Tests.csproj src/Orchard.Web.Tests/Orchard.Web.Tests.csproj src/Orchard.Web/Core/Orchard.Core.csproj src/Orchard.Web/Modules/Lucene/Lucene.csproj src/Orchard.Web/Modules/Markdown/Markdown.csproj src/Orchard.Web/Modules/Orchard.Alias/Orchard.Alias.csproj src/Orchard.Web/Modules/Orchard.AntiSpam/Orchard.AntiSpam.csproj src/Orchard.Web/Modules/Orchard.ArchiveLater/Orchard.ArchiveLater.csproj src/Orchard.Web/Modules/Orchard.Autoroute/Orchard.Autoroute.csproj src/Orchard.Web/Modules/Orchard.Azure/Orchard.Azure.csproj src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj src/Orchard.Web/Modules/Orchard.CodeGeneration/Orchard.CodeGeneration.csproj src/Orchard.Web/Modules/Orchard.Comments/Orchard.Comments.csproj src/Orchard.Web/Modules/Orchard.ContentPermissions/Orchard.ContentPermissions.csproj src/Orchard.Web/Modules/Orchard.ContentPicker/Orchard.ContentPicker.csproj src/Orchard.Web/Modules/Orchard.ContentTypes/Orchard.ContentTypes.csproj src/Orchard.Web/Modules/Orchard.CustomForms/Orchard.CustomForms.csproj src/Orchard.Web/Modules/Orchard.DesignerTools/Orchard.DesignerTools.csproj src/Orchard.Web/Modules/Orchard.Email/Orchard.Email.csproj src/Orchard.Web/Modules/Orchard.Fields/Orchard.Fields.csproj src/Orchard.Web/Modules/Orchard.Forms/Orchard.Forms.csproj src/Orchard.Web/Modules/Orchard.ImageEditor/Orchard.ImageEditor.csproj src/Orchard.Web/Modules/Orchard.ImportExport/Orchard.ImportExport.csproj src/Orchard.Web/Modules/Orchard.Indexing/Orchard.Indexing.csproj src/Orchard.Web/Modules/Orchard.Layouts/Orchard.Layouts.csproj src/Orchard.Web/Modules/Orchard.Lists/Orchard.Lists.csproj src/Orchard.Web/Modules/Orchard.Localization/Orchard.Localization.csproj src/Orchard.Web/Modules/Orchard.Media/Orchard.Media.csproj src/Orchard.Web/Modules/Orchard.MediaPicker/Orchard.MediaPicker.csproj src/Orchard.Web/Modules/Orchard.MediaProcessing/Orchard.MediaProcessing.csproj src/Orchard.Web/Modules/Orchard.Migrations/Orchard.Migrations.csproj src/Orchard.Web/Modules/Orchard.Modules/Orchard.Modules.csproj src/Orchard.Web/Modules/Orchard.MultiTenancy/Orchard.MultiTenancy.csproj src/Orchard.Web/Modules/Orchard.OutputCache/Orchard.OutputCache.csproj src/Orchard.Web/Modules/Orchard.Packaging/Orchard.Packaging.csproj src/Orchard.Web/Modules/Orchard.Projections/Orchard.Projections.csproj src/Orchard.Web/Modules/Orchard.Projections/Tests/Orchard.Projections.Tests.csproj src/Orchard.Web/Modules/Orchard.Recipes/Orchard.Recipes.csproj src/Orchard.Web/Modules/Orchard.Roles/Orchard.Roles.csproj src/Orchard.Web/Modules/Orchard.Rules/Orchard.Rules.csproj src/Orchard.Web/Modules/Orchard.Scripting.CSharp/Orchard.Scripting.CSharp.csproj src/Orchard.Web/Modules/Orchard.Scripting.Dlr/Orchard.Scripting.Dlr.csproj src/Orchard.Web/Modules/Orchard.Search/Orchard.Search.csproj src/Orchard.Web/Modules/Orchard.Setup/Orchard.Setup.csproj src/Orchard.Web/Modules/Orchard.Tags/Orchard.Tags.csproj src/Orchard.Web/Modules/Orchard.TaskLease/Orchard.TaskLease.csproj src/Orchard.Web/Modules/Orchard.Themes/Orchard.Themes.csproj src/Orchard.Web/Modules/Orchard.Tokens/Orchard.Tokens.csproj src/Orchard.Web/Modules/Orchard.Tokens/Tests/Orchard.Tokens.Tests.csproj src/Orchard.Web/Modules/Orchard.Users/Orchard.Users.csproj src/Orchard.Web/Modules/Orchard.Warmup/Orchard.Warmup.csproj src/Orchard.Web/Modules/Orchard.Widgets/Orchard.Widgets.csproj src/Orchard.Web/Modules/Orchard.jQuery/Orchard.jQuery.csproj src/Orchard.Web/Modules/SysCache/SysCache.csproj src/Orchard.Web/Modules/Upgrade/Upgrade.csproj src/Orchard.Web/Orchard.Web.csproj src/Orchard.sln src/Tools/Orchard.Tests/Orchard.Tests.csproj
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
using System;
|
||||
using Orchard.Data.Migration;
|
||||
|
||||
namespace Orchard.TaskLease {
|
||||
public class TaskLeaseMigrations : DataMigrationImpl {
|
||||
|
||||
public int Create() {
|
||||
SchemaBuilder.CreateTable("TaskLeaseRecord",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<string>("TaskName")
|
||||
.Column<string>("MachineName")
|
||||
.Column<DateTime>("UpdatedUtc")
|
||||
.Column<DateTime>("ExpiredUtc")
|
||||
.Column<string>("State", c => c.Unlimited())
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using Orchard.Data.Migration;
|
||||
|
||||
namespace Orchard.TaskLease {
|
||||
public class TaskLeaseMigrations : DataMigrationImpl {
|
||||
|
||||
public int Create() {
|
||||
SchemaBuilder.CreateTable("TaskLeaseRecord",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<string>("TaskName")
|
||||
.Column<string>("MachineName")
|
||||
.Column<DateTime>("UpdatedUtc")
|
||||
.Column<DateTime>("ExpiredUtc")
|
||||
.Column<string>("State", c => c.Unlimited())
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,17 +1,17 @@
|
||||
using System;
|
||||
using Orchard.Data.Conventions;
|
||||
|
||||
namespace Orchard.TaskLease.Models
|
||||
{
|
||||
public class TaskLeaseRecord
|
||||
{
|
||||
public virtual int Id { get; set; }
|
||||
public virtual string TaskName { get; set; }
|
||||
public virtual string MachineName { get; set; }
|
||||
public virtual DateTime UpdatedUtc { get; set; }
|
||||
public virtual DateTime ExpiredUtc { get; set; }
|
||||
|
||||
[StringLengthMax]
|
||||
public virtual string State { get; set; }
|
||||
}
|
||||
using System;
|
||||
using Orchard.Data.Conventions;
|
||||
|
||||
namespace Orchard.TaskLease.Models
|
||||
{
|
||||
public class TaskLeaseRecord
|
||||
{
|
||||
public virtual int Id { get; set; }
|
||||
public virtual string TaskName { get; set; }
|
||||
public virtual string MachineName { get; set; }
|
||||
public virtual DateTime UpdatedUtc { get; set; }
|
||||
public virtual DateTime ExpiredUtc { get; set; }
|
||||
|
||||
[StringLengthMax]
|
||||
public virtual string State { get; set; }
|
||||
}
|
||||
}
|
@@ -1,9 +1,9 @@
|
||||
Name: Task Lease
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardtasklease.codeplex.com
|
||||
Version: 1.9.2
|
||||
OrchardVersion: 1.9
|
||||
LifecycleStatus: Deprecated
|
||||
Description: Provides services to synchronize tasks in a farm environment.
|
||||
Name: Task Lease
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardtasklease.codeplex.com
|
||||
Version: 1.9.2
|
||||
OrchardVersion: 1.9
|
||||
LifecycleStatus: Deprecated
|
||||
Description: Provides services to synchronize tasks in a farm environment.
|
||||
Category: Hosting
|
@@ -1,36 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
|
||||
// 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("Orchard.TaskLease")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyProduct("Orchard")]
|
||||
[assembly: AssemblyCopyright("Copyright <20> .NET Foundation")]
|
||||
[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("3320c438-e92b-4753-bfe5-944f29d13ded")]
|
||||
|
||||
// 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 Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.9.2")]
|
||||
[assembly: AssemblyFileVersion("1.9.2")]
|
||||
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
|
||||
// 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("Orchard.TaskLease")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyProduct("Orchard")]
|
||||
[assembly: AssemblyCopyright("Copyright <20> .NET Foundation")]
|
||||
[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("3320c438-e92b-4753-bfe5-944f29d13ded")]
|
||||
|
||||
// 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 Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.9.2")]
|
||||
[assembly: AssemblyFileVersion("1.9.2")]
|
||||
|
||||
|
@@ -1,28 +1,28 @@
|
||||
using System;
|
||||
|
||||
namespace Orchard.TaskLease.Services {
|
||||
|
||||
/// <summary>
|
||||
/// Describes a service to save and acquire task leases. A task lease can't be acquired by two different machines,
|
||||
/// for a specific amount of time. Optionnally a State can be saved along with the lease.
|
||||
/// </summary>
|
||||
[Obsolete("Use Orchard.Tasks.Locking.IDistributedLockService instead.")]
|
||||
public interface ITaskLeaseService : IDependency {
|
||||
|
||||
/// <summary>
|
||||
/// Acquires a lease for the specified task name, and amount of time.
|
||||
/// </summary>
|
||||
/// <returns>The state of the lease if it was acquired, otherwise <c>null</c>.</returns>
|
||||
string Acquire(string taskName, DateTime expiredUtc);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a lease for the current machine if it exists
|
||||
/// </summary>
|
||||
void Update(string taskName, string state);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a lease for the current machine if it exists
|
||||
/// </summary>
|
||||
void Update(string taskName, string state, DateTime expiredUtc);
|
||||
}
|
||||
using System;
|
||||
|
||||
namespace Orchard.TaskLease.Services {
|
||||
|
||||
/// <summary>
|
||||
/// Describes a service to save and acquire task leases. A task lease can't be acquired by two different machines,
|
||||
/// for a specific amount of time. Optionnally a State can be saved along with the lease.
|
||||
/// </summary>
|
||||
[Obsolete("Use Orchard.Tasks.Locking.IDistributedLockService instead.")]
|
||||
public interface ITaskLeaseService : IDependency {
|
||||
|
||||
/// <summary>
|
||||
/// Acquires a lease for the specified task name, and amount of time.
|
||||
/// </summary>
|
||||
/// <returns>The state of the lease if it was acquired, otherwise <c>null</c>.</returns>
|
||||
string Acquire(string taskName, DateTime expiredUtc);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a lease for the current machine if it exists
|
||||
/// </summary>
|
||||
void Update(string taskName, string state);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a lease for the current machine if it exists
|
||||
/// </summary>
|
||||
void Update(string taskName, string state, DateTime expiredUtc);
|
||||
}
|
||||
}
|
@@ -1,96 +1,96 @@
|
||||
using System;
|
||||
using Orchard.Data;
|
||||
using Orchard.Environment;
|
||||
using Orchard.Services;
|
||||
using Orchard.TaskLease.Models;
|
||||
|
||||
namespace Orchard.TaskLease.Services {
|
||||
|
||||
/// <summary>
|
||||
/// Provides a database driven implementation of <see cref="ITaskLeaseService" />
|
||||
/// </summary>
|
||||
[Obsolete("Use Orchard.Tasks.Locking.DistributedLockService instead.")]
|
||||
public class TaskLeaseService : ITaskLeaseService {
|
||||
|
||||
private readonly IRepository<TaskLeaseRecord> _repository;
|
||||
private readonly IClock _clock;
|
||||
private readonly IApplicationEnvironment _applicationEnvironment;
|
||||
|
||||
public TaskLeaseService(
|
||||
IRepository<TaskLeaseRecord> repository,
|
||||
IClock clock,
|
||||
IApplicationEnvironment applicationEnvironment) {
|
||||
|
||||
_repository = repository;
|
||||
_clock = clock;
|
||||
_applicationEnvironment = applicationEnvironment;
|
||||
}
|
||||
|
||||
public string Acquire(string taskName, DateTime expiredUtc) {
|
||||
var environmentIdentifier = _applicationEnvironment.GetEnvironmentIdentifier();
|
||||
|
||||
// retrieve current lease for the specified task
|
||||
var taskLease = _repository.Get(x => x.TaskName == taskName);
|
||||
|
||||
// create a new lease if there is no current lease for this task
|
||||
if (taskLease == null) {
|
||||
taskLease = new TaskLeaseRecord {
|
||||
TaskName = taskName,
|
||||
MachineName = environmentIdentifier,
|
||||
State = String.Empty,
|
||||
UpdatedUtc = _clock.UtcNow,
|
||||
ExpiredUtc = expiredUtc
|
||||
};
|
||||
|
||||
_repository.Create(taskLease);
|
||||
_repository.Flush();
|
||||
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
// lease can't be aquired only if for a different machine and it has not expired
|
||||
if (taskLease.MachineName != environmentIdentifier && taskLease.ExpiredUtc >= _clock.UtcNow) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// otherwise update information
|
||||
taskLease.MachineName = environmentIdentifier;
|
||||
taskLease.UpdatedUtc = _clock.UtcNow;
|
||||
taskLease.ExpiredUtc = expiredUtc;
|
||||
|
||||
_repository.Flush();
|
||||
|
||||
return taskLease.State;
|
||||
}
|
||||
|
||||
public void Update(string taskName, string state) {
|
||||
var environmentIdentifier = _applicationEnvironment.GetEnvironmentIdentifier();
|
||||
|
||||
// retrieve current lease for the specified task
|
||||
var taskLease = _repository.Get(x => x.TaskName == taskName && x.MachineName == environmentIdentifier);
|
||||
|
||||
if (taskLease == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
taskLease.State = state;
|
||||
_repository.Flush();
|
||||
}
|
||||
|
||||
public void Update(string taskName, string state, DateTime expiredUtc) {
|
||||
var environmentIdentifier = _applicationEnvironment.GetEnvironmentIdentifier();
|
||||
|
||||
// retrieve current lease for the specified task
|
||||
var taskLease = _repository.Get(x => x.TaskName == taskName && x.MachineName == environmentIdentifier);
|
||||
|
||||
if (taskLease == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
taskLease.ExpiredUtc = expiredUtc;
|
||||
taskLease.State = state;
|
||||
|
||||
_repository.Flush();
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using Orchard.Data;
|
||||
using Orchard.Environment;
|
||||
using Orchard.Services;
|
||||
using Orchard.TaskLease.Models;
|
||||
|
||||
namespace Orchard.TaskLease.Services {
|
||||
|
||||
/// <summary>
|
||||
/// Provides a database driven implementation of <see cref="ITaskLeaseService" />
|
||||
/// </summary>
|
||||
[Obsolete("Use Orchard.Tasks.Locking.DistributedLockService instead.")]
|
||||
public class TaskLeaseService : ITaskLeaseService {
|
||||
|
||||
private readonly IRepository<TaskLeaseRecord> _repository;
|
||||
private readonly IClock _clock;
|
||||
private readonly IApplicationEnvironment _applicationEnvironment;
|
||||
|
||||
public TaskLeaseService(
|
||||
IRepository<TaskLeaseRecord> repository,
|
||||
IClock clock,
|
||||
IApplicationEnvironment applicationEnvironment) {
|
||||
|
||||
_repository = repository;
|
||||
_clock = clock;
|
||||
_applicationEnvironment = applicationEnvironment;
|
||||
}
|
||||
|
||||
public string Acquire(string taskName, DateTime expiredUtc) {
|
||||
var environmentIdentifier = _applicationEnvironment.GetEnvironmentIdentifier();
|
||||
|
||||
// retrieve current lease for the specified task
|
||||
var taskLease = _repository.Get(x => x.TaskName == taskName);
|
||||
|
||||
// create a new lease if there is no current lease for this task
|
||||
if (taskLease == null) {
|
||||
taskLease = new TaskLeaseRecord {
|
||||
TaskName = taskName,
|
||||
MachineName = environmentIdentifier,
|
||||
State = String.Empty,
|
||||
UpdatedUtc = _clock.UtcNow,
|
||||
ExpiredUtc = expiredUtc
|
||||
};
|
||||
|
||||
_repository.Create(taskLease);
|
||||
_repository.Flush();
|
||||
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
// lease can't be aquired only if for a different machine and it has not expired
|
||||
if (taskLease.MachineName != environmentIdentifier && taskLease.ExpiredUtc >= _clock.UtcNow) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// otherwise update information
|
||||
taskLease.MachineName = environmentIdentifier;
|
||||
taskLease.UpdatedUtc = _clock.UtcNow;
|
||||
taskLease.ExpiredUtc = expiredUtc;
|
||||
|
||||
_repository.Flush();
|
||||
|
||||
return taskLease.State;
|
||||
}
|
||||
|
||||
public void Update(string taskName, string state) {
|
||||
var environmentIdentifier = _applicationEnvironment.GetEnvironmentIdentifier();
|
||||
|
||||
// retrieve current lease for the specified task
|
||||
var taskLease = _repository.Get(x => x.TaskName == taskName && x.MachineName == environmentIdentifier);
|
||||
|
||||
if (taskLease == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
taskLease.State = state;
|
||||
_repository.Flush();
|
||||
}
|
||||
|
||||
public void Update(string taskName, string state, DateTime expiredUtc) {
|
||||
var environmentIdentifier = _applicationEnvironment.GetEnvironmentIdentifier();
|
||||
|
||||
// retrieve current lease for the specified task
|
||||
var taskLease = _repository.Get(x => x.TaskName == taskName && x.MachineName == environmentIdentifier);
|
||||
|
||||
if (taskLease == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
taskLease.ExpiredUtc = expiredUtc;
|
||||
taskLease.State = state;
|
||||
|
||||
_repository.Flush();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,110 +1,110 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{3FD9FA96-F7C9-4E98-BF17-DC75D07B7307}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Orchard.TaskLease.Tests</RootNamespace>
|
||||
<AssemblyName>Orchard.TaskLease.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=2.2.4.900, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL" />
|
||||
<Reference Include="Moq, Version=4.0.812.4, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL" />
|
||||
<Reference Include="NHibernate.ByteCode.Castle">
|
||||
<HintPath>..\..\..\..\..\..\lib\fluentnhibernate\NHibernate.ByteCode.Castle.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\..\..\Contrib.RewriteRules\bin\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\lib\sqlce\System.Data.SqlServerCe.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\TaskLeaseServiceTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\..\Orchard.Tests.Modules\Orchard.Tests.Modules.csproj">
|
||||
<Project>{6CB3EB30-F725-45C0-9742-42599BA8E8D2}</Project>
|
||||
<Name>Orchard.Tests.Modules</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\..\Orchard.Tests\Orchard.Framework.Tests.csproj">
|
||||
<Project>{ABC826D4-2FA1-4F2F-87DE-E6095F653810}</Project>
|
||||
<Name>Orchard.Framework.Tests</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\..\Orchard\Orchard.Framework.csproj">
|
||||
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
|
||||
<Name>Orchard.Framework</Name>
|
||||
<Private>false</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Core\Orchard.Core.csproj">
|
||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||
<Name>Orchard.Core</Name>
|
||||
<Private>false</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Orchard.TaskLease.csproj">
|
||||
<Project>{3F72A4E9-7B72-4260-B010-C16EC54F9BAF}</Project>
|
||||
<Name>Orchard.TaskLease</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<Target Name="CopySqlCeBinaries">
|
||||
<ItemGroup>
|
||||
<SqlCeBinariesx86 Include="$(ProjectDir)..\..\lib\sqlce\x86\**\*" />
|
||||
<SqlCeBinariesx64 Include="$(ProjectDir)..\..\lib\sqlce\amd64\**\*" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(SqlCeBinariesx86)" DestinationFolder="$(OutputPath)\x86\%(RecursiveDir)" SkipUnchangedFiles="true" />
|
||||
<Copy SourceFiles="@(SqlCeBinariesx64)" DestinationFolder="$(OutputPath)\amd64\%(RecursiveDir)" SkipUnchangedFiles="true" />
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
<CallTarget Targets="CopySqlCeBinaries" />
|
||||
</Target>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{3FD9FA96-F7C9-4E98-BF17-DC75D07B7307}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Orchard.TaskLease.Tests</RootNamespace>
|
||||
<AssemblyName>Orchard.TaskLease.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=2.2.4.900, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL" />
|
||||
<Reference Include="Moq, Version=4.0.812.4, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL" />
|
||||
<Reference Include="NHibernate.ByteCode.Castle">
|
||||
<HintPath>..\..\..\..\..\..\lib\fluentnhibernate\NHibernate.ByteCode.Castle.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\..\..\Contrib.RewriteRules\bin\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\lib\sqlce\System.Data.SqlServerCe.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\TaskLeaseServiceTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\..\Orchard.Tests.Modules\Orchard.Tests.Modules.csproj">
|
||||
<Project>{6CB3EB30-F725-45C0-9742-42599BA8E8D2}</Project>
|
||||
<Name>Orchard.Tests.Modules</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\..\Orchard.Tests\Orchard.Framework.Tests.csproj">
|
||||
<Project>{ABC826D4-2FA1-4F2F-87DE-E6095F653810}</Project>
|
||||
<Name>Orchard.Framework.Tests</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\..\Orchard\Orchard.Framework.csproj">
|
||||
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
|
||||
<Name>Orchard.Framework</Name>
|
||||
<Private>false</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Core\Orchard.Core.csproj">
|
||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||
<Name>Orchard.Core</Name>
|
||||
<Private>false</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Orchard.TaskLease.csproj">
|
||||
<Project>{3F72A4E9-7B72-4260-B010-C16EC54F9BAF}</Project>
|
||||
<Name>Orchard.TaskLease</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<Target Name="CopySqlCeBinaries">
|
||||
<ItemGroup>
|
||||
<SqlCeBinariesx86 Include="$(ProjectDir)..\..\lib\sqlce\x86\**\*" />
|
||||
<SqlCeBinariesx64 Include="$(ProjectDir)..\..\lib\sqlce\amd64\**\*" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(SqlCeBinariesx86)" DestinationFolder="$(OutputPath)\x86\%(RecursiveDir)" SkipUnchangedFiles="true" />
|
||||
<Copy SourceFiles="@(SqlCeBinariesx64)" DestinationFolder="$(OutputPath)\amd64\%(RecursiveDir)" SkipUnchangedFiles="true" />
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
<CallTarget Targets="CopySqlCeBinaries" />
|
||||
</Target>
|
||||
</Project>
|
@@ -1,36 +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("Orchard.TaskLease.Tests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("Orchard.TaskLease.Tests")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
|
||||
[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("0435ceba-eada-4dc4-aa03-74a68ccca515")]
|
||||
|
||||
// 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("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.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: AssemblyTitle("Orchard.TaskLease.Tests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("Orchard.TaskLease.Tests")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
|
||||
[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("0435ceba-eada-4dc4-aa03-74a68ccca515")]
|
||||
|
||||
// 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("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
@@ -1,97 +1,97 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Autofac;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Orchard.TaskLease.Models;
|
||||
using Orchard.TaskLease.Services;
|
||||
using Orchard.Tests.Modules;
|
||||
|
||||
namespace Orchard.TaskLease.Tests.Services
|
||||
{
|
||||
[TestFixture]
|
||||
public class TaskLeaseServiceTests : DatabaseEnabledTestsBase
|
||||
{
|
||||
private ITaskLeaseService _service;
|
||||
private Mock<IMachineNameProvider> _machineNameProvider;
|
||||
|
||||
protected override IEnumerable<Type> DatabaseTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
return new[] {
|
||||
typeof (TaskLeaseRecord)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterType<TaskLeaseService>().As<ITaskLeaseService>();
|
||||
builder.RegisterInstance((_machineNameProvider = new Mock<IMachineNameProvider>()).Object);
|
||||
|
||||
_machineNameProvider.Setup(x => x.GetMachineName()).Returns("SkyNet");
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
_service = _container.Resolve<ITaskLeaseService>();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AcquireShouldSucceedIfNoTask()
|
||||
{
|
||||
var state = _service.Acquire("Foo", _clock.UtcNow.AddDays(1));
|
||||
Assert.That(state, Is.EqualTo(String.Empty));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AcquireShouldSucceedIfTaskBySameMachine()
|
||||
{
|
||||
var state = _service.Acquire("Foo", _clock.UtcNow.AddDays(1));
|
||||
Assert.That(state, Is.EqualTo(String.Empty));
|
||||
|
||||
state = _service.Acquire("Foo", _clock.UtcNow.AddDays(1));
|
||||
Assert.That(state, Is.EqualTo(String.Empty));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AcquireShouldNotSucceedIfTaskByOtherMachine()
|
||||
{
|
||||
var state = _service.Acquire("Foo", _clock.UtcNow.AddDays(1));
|
||||
Assert.That(state, Is.EqualTo(String.Empty));
|
||||
|
||||
_machineNameProvider.Setup(x => x.GetMachineName()).Returns("TheMatrix");
|
||||
|
||||
state = _service.Acquire("Foo", _clock.UtcNow.AddDays(1));
|
||||
Assert.That(state, Is.EqualTo(null));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ShouldUpdateTask()
|
||||
{
|
||||
var state = _service.Acquire("Foo", _clock.UtcNow.AddDays(1));
|
||||
Assert.That(state, Is.EqualTo(String.Empty));
|
||||
|
||||
_service.Update("Foo", "Other");
|
||||
state = _service.Acquire("Foo", _clock.UtcNow.AddDays(1));
|
||||
|
||||
Assert.That(state, Is.EqualTo("Other"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AcquireShouldSucceedIfTaskByOtherMachineAndExpired()
|
||||
{
|
||||
var state = _service.Acquire("Foo", _clock.UtcNow.AddDays(1));
|
||||
Assert.That(state, Is.EqualTo(String.Empty));
|
||||
|
||||
_machineNameProvider.Setup(x => x.GetMachineName()).Returns("TheMatrix");
|
||||
_clock.Advance(new TimeSpan(2,0,0,0));
|
||||
|
||||
state = _service.Acquire("Foo", _clock.UtcNow.AddDays(1));
|
||||
Assert.That(state, Is.EqualTo(String.Empty));
|
||||
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Autofac;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Orchard.TaskLease.Models;
|
||||
using Orchard.TaskLease.Services;
|
||||
using Orchard.Tests.Modules;
|
||||
|
||||
namespace Orchard.TaskLease.Tests.Services
|
||||
{
|
||||
[TestFixture]
|
||||
public class TaskLeaseServiceTests : DatabaseEnabledTestsBase
|
||||
{
|
||||
private ITaskLeaseService _service;
|
||||
private Mock<IMachineNameProvider> _machineNameProvider;
|
||||
|
||||
protected override IEnumerable<Type> DatabaseTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
return new[] {
|
||||
typeof (TaskLeaseRecord)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterType<TaskLeaseService>().As<ITaskLeaseService>();
|
||||
builder.RegisterInstance((_machineNameProvider = new Mock<IMachineNameProvider>()).Object);
|
||||
|
||||
_machineNameProvider.Setup(x => x.GetMachineName()).Returns("SkyNet");
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
_service = _container.Resolve<ITaskLeaseService>();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AcquireShouldSucceedIfNoTask()
|
||||
{
|
||||
var state = _service.Acquire("Foo", _clock.UtcNow.AddDays(1));
|
||||
Assert.That(state, Is.EqualTo(String.Empty));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AcquireShouldSucceedIfTaskBySameMachine()
|
||||
{
|
||||
var state = _service.Acquire("Foo", _clock.UtcNow.AddDays(1));
|
||||
Assert.That(state, Is.EqualTo(String.Empty));
|
||||
|
||||
state = _service.Acquire("Foo", _clock.UtcNow.AddDays(1));
|
||||
Assert.That(state, Is.EqualTo(String.Empty));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AcquireShouldNotSucceedIfTaskByOtherMachine()
|
||||
{
|
||||
var state = _service.Acquire("Foo", _clock.UtcNow.AddDays(1));
|
||||
Assert.That(state, Is.EqualTo(String.Empty));
|
||||
|
||||
_machineNameProvider.Setup(x => x.GetMachineName()).Returns("TheMatrix");
|
||||
|
||||
state = _service.Acquire("Foo", _clock.UtcNow.AddDays(1));
|
||||
Assert.That(state, Is.EqualTo(null));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ShouldUpdateTask()
|
||||
{
|
||||
var state = _service.Acquire("Foo", _clock.UtcNow.AddDays(1));
|
||||
Assert.That(state, Is.EqualTo(String.Empty));
|
||||
|
||||
_service.Update("Foo", "Other");
|
||||
state = _service.Acquire("Foo", _clock.UtcNow.AddDays(1));
|
||||
|
||||
Assert.That(state, Is.EqualTo("Other"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AcquireShouldSucceedIfTaskByOtherMachineAndExpired()
|
||||
{
|
||||
var state = _service.Acquire("Foo", _clock.UtcNow.AddDays(1));
|
||||
Assert.That(state, Is.EqualTo(String.Empty));
|
||||
|
||||
_machineNameProvider.Setup(x => x.GetMachineName()).Returns("TheMatrix");
|
||||
_clock.Advance(new TimeSpan(2,0,0,0));
|
||||
|
||||
state = _service.Acquire("Foo", _clock.UtcNow.AddDays(1));
|
||||
Assert.That(state, Is.EqualTo(String.Empty));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,56 +1,56 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false"/>
|
||||
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false"/>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<system.web.webPages.razor>
|
||||
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<pages pageBaseType="Orchard.Mvc.ViewEngines.Razor.WebViewPage">
|
||||
<namespaces>
|
||||
<add namespace="System.Web.Mvc"/>
|
||||
<add namespace="System.Web.Mvc.Ajax"/>
|
||||
<add namespace="System.Web.Mvc.Html"/>
|
||||
<add namespace="System.Web.Routing"/>
|
||||
<add namespace="System.Web.WebPages"/>
|
||||
<add namespace="System.Linq"/>
|
||||
<add namespace="System.Collections.Generic"/>
|
||||
<add namespace="Orchard.Mvc.Html"/>
|
||||
</namespaces>
|
||||
</pages>
|
||||
</system.web.webPages.razor>
|
||||
<system.web>
|
||||
<compilation targetFramework="4.5.1">
|
||||
<assemblies>
|
||||
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||
<add assembly="System.Web.Mvc, Version=5.2.3, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<add assembly="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
</assemblies>
|
||||
</compilation>
|
||||
</system.web>
|
||||
<runtime>
|
||||
<!-- NOTE: These binding redirects have no runtime effect; they are only here to avoid build warnings. -->
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30AD4FE6B2A6AEED" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="AA95F207798DFDB4" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.4000" newVersion="4.0.0.4000"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="AA95F207798DFDB4" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Autofac" publicKeyToken="17863AF14B0044DA" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false"/>
|
||||
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false"/>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<system.web.webPages.razor>
|
||||
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<pages pageBaseType="Orchard.Mvc.ViewEngines.Razor.WebViewPage">
|
||||
<namespaces>
|
||||
<add namespace="System.Web.Mvc"/>
|
||||
<add namespace="System.Web.Mvc.Ajax"/>
|
||||
<add namespace="System.Web.Mvc.Html"/>
|
||||
<add namespace="System.Web.Routing"/>
|
||||
<add namespace="System.Web.WebPages"/>
|
||||
<add namespace="System.Linq"/>
|
||||
<add namespace="System.Collections.Generic"/>
|
||||
<add namespace="Orchard.Mvc.Html"/>
|
||||
</namespaces>
|
||||
</pages>
|
||||
</system.web.webPages.razor>
|
||||
<system.web>
|
||||
<compilation targetFramework="4.5.1">
|
||||
<assemblies>
|
||||
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||
<add assembly="System.Web.Mvc, Version=5.2.3, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<add assembly="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
</assemblies>
|
||||
</compilation>
|
||||
</system.web>
|
||||
<runtime>
|
||||
<!-- NOTE: These binding redirects have no runtime effect; they are only here to avoid build warnings. -->
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30AD4FE6B2A6AEED" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="AA95F207798DFDB4" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.4000" newVersion="4.0.0.4000"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="AA95F207798DFDB4" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Autofac" publicKeyToken="17863AF14B0044DA" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
|
Reference in New Issue
Block a user