Skip to content

Commit

Permalink
updated cm-jobstorage & cm-management to v1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
olibanjoli committed Sep 26, 2018
1 parent cda19c4 commit 81a397f
Show file tree
Hide file tree
Showing 12 changed files with 87 additions and 16 deletions.
6 changes: 3 additions & 3 deletions source/Jobbr.Server.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>Jobbr is a non-invasive .NET JobServer</description>
<iconUrl>https://raw.githubusercontent.com/jobbrIO/artwork/master/build/icons/icon_detailed_256_dark.png</iconUrl>
<copyright>Copyright 2017</copyright>
<copyright>Copyright 2018</copyright>
<dependencies>
<dependency id="Jobbr.ComponentModel.ArtefactStorage" version="[1,1.1)" />
<dependency id="Jobbr.ComponentModel.Execution" version="[1,1.1)" />
<dependency id="Jobbr.ComponentModel.JobStorage" version="[1.1,1.2)" />
<dependency id="Jobbr.ComponentModel.Management" version="[1.1,1.2)" />
<dependency id="Jobbr.ComponentModel.JobStorage" version="[1.2,1.3)" />
<dependency id="Jobbr.ComponentModel.Management" version="[1.2,1.3)" />
<dependency id="Jobbr.ComponentModel.Registration" version="[1,1.1)" />
</dependencies>
</metadata>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using AutoMapper;
using Jobbr.ComponentModel.Management;
using Jobbr.ComponentModel.Management.Model;
Expand Down Expand Up @@ -163,6 +164,21 @@ public PagedResult<JobRun> GetJobRunsByState(JobRunStates state, int page = 1, i
};
}

public PagedResult<JobRun> GetJobRunsByStates(JobRunStates[] states, int page = 1, int pageSize = 50, string jobTypeFilter = null, string jobUniqueNameFilter = null, string query = null, params string[] sort)
{
var statesCasted = states.Cast<ComponentModel.JobStorage.Model.JobRunStates>().ToArray();

var jobruns = this.repository.GetJobRunsByStates(statesCasted, page, pageSize, jobTypeFilter, jobUniqueNameFilter, query, sort);

return new PagedResult<JobRun>
{
Items = this.mapper.Map<List<JobRun>>(jobruns.Items),
TotalItems = jobruns.TotalItems,
Page = page,
PageSize = pageSize
};
}

public JobRun GetLastJobRunByTriggerId(long jobId, long triggerId, DateTime utcNow)
{
var jobrun = this.repository.GetLastJobRunByTriggerId(jobId, triggerId, utcNow);
Expand Down
12 changes: 7 additions & 5 deletions source/Jobbr.Server/Jobbr.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@
<Reference Include="Jobbr.ComponentModel.Execution, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Jobbr.ComponentModel.Execution.1.0.1\lib\net462\Jobbr.ComponentModel.Execution.dll</HintPath>
</Reference>
<Reference Include="Jobbr.ComponentModel.JobStorage, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Jobbr.ComponentModel.JobStorage.1.1.0\lib\net462\Jobbr.ComponentModel.JobStorage.dll</HintPath>
<Reference Include="Jobbr.ComponentModel.JobStorage, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Jobbr.ComponentModel.JobStorage.1.2.0\lib\net462\Jobbr.ComponentModel.JobStorage.dll</HintPath>
</Reference>
<Reference Include="Jobbr.ComponentModel.Management, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Jobbr.ComponentModel.Management.1.1.0\lib\net462\Jobbr.ComponentModel.Management.dll</HintPath>
<Reference Include="Jobbr.ComponentModel.Management, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Jobbr.ComponentModel.Management.1.2.0\lib\net462\Jobbr.ComponentModel.Management.dll</HintPath>
</Reference>
<Reference Include="Jobbr.ComponentModel.Registration, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Jobbr.ComponentModel.Registration.1.0.1\lib\net462\Jobbr.ComponentModel.Registration.dll</HintPath>
Expand Down Expand Up @@ -134,7 +134,9 @@
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Desktop.Analyzers.1.1.0\analyzers\dotnet\cs\Desktop.Analyzers.dll" />
Expand Down
2 changes: 2 additions & 0 deletions source/Jobbr.Server/Storage/IJobbrRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public interface IJobbrRepository

PagedResult<JobRun> GetJobRunsByState(JobRunStates state, int page = 1, int pageSize = 50, string jobTypeFilter = null, string jobUniqueNameFilter = null, string query = null, params string[] sort);

PagedResult<JobRun> GetJobRunsByStates(JobRunStates[] states, int page = 1, int pageSize = 50, string jobTypeFilter = null, string jobUniqueNameFilter = null, string query = null, params string[] sort);

JobRun GetLastJobRunByTriggerId(long jobId, long triggerId, DateTime utcNow);

JobRun GetNextJobRunByTriggerId(long jobId, long triggerId, DateTime utcNow);
Expand Down
24 changes: 24 additions & 0 deletions source/Jobbr.Server/Storage/InMemoryJobStorageProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,30 @@ public PagedResult<JobRun> GetJobRunsByState(JobRunStates state, int page = 1, i
};
}

public PagedResult<JobRun> GetJobRunsByStates(JobRunStates[] states, int page = 1, int pageSize = 50, string jobTypeFilter = null, string jobUniqueNameFilter = null, string query = null, params string[] sort)
{
int totalItems;

var enumerable = this.ApplyFiltersAndPaging(page, pageSize, jobTypeFilter, jobUniqueNameFilter, query, this.localJobRuns.Where(p => states.Contains(p.State)), out totalItems);

if (sort == null || sort.Length == 0)
{
enumerable = enumerable.OrderByDescending(o => o.PlannedStartDateTimeUtc);
}
else
{
enumerable = ApplySorting(sort, enumerable, this.JobRunOrderByMapping);
}

return new PagedResult<JobRun>
{
Page = page,
PageSize = pageSize,
Items = enumerable.ToList(),
TotalItems = totalItems,
};
}

public PagedResult<JobRun> GetJobRunsByUserId(string userId, int page = 1, int pageSize = 50, string jobTypeFilter = null, string jobUniqueNameFilter = null, params string[] sort)
{
int totalItems;
Expand Down
5 changes: 5 additions & 0 deletions source/Jobbr.Server/Storage/JobbrRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ public void SaveAddTrigger(long jobId, InstantTrigger trigger)
this.storageProvider.AddTrigger(jobId, trigger);
}

public PagedResult<JobRun> GetJobRunsByStates(JobRunStates[] states, int page = 1, int pageSize = 50, string jobTypeFilter = null, string jobUniqueNameFilter = null, string query = null, params string[] sort)
{
return this.storageProvider.GetJobRunsByStates(states, page, pageSize, jobTypeFilter, jobUniqueNameFilter, query, sort);
}

public JobRun GetLastJobRunByTriggerId(long jobId, long triggerId, DateTime utcNow)
{
return this.storageProvider.GetLastJobRunByTriggerId(jobId, triggerId, utcNow);
Expand Down
4 changes: 2 additions & 2 deletions source/Jobbr.Server/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<package id="Desktop.Analyzers" version="1.1.0" targetFramework="net462" />
<package id="Jobbr.ComponentModel.ArtefactStorage" version="1.0.1" targetFramework="net462" />
<package id="Jobbr.ComponentModel.Execution" version="1.0.1" targetFramework="net462" />
<package id="Jobbr.ComponentModel.JobStorage" version="1.1.0" targetFramework="net462" />
<package id="Jobbr.ComponentModel.Management" version="1.1.0" targetFramework="net462" />
<package id="Jobbr.ComponentModel.JobStorage" version="1.2.0" targetFramework="net462" />
<package id="Jobbr.ComponentModel.Management" version="1.2.0" targetFramework="net462" />
<package id="Jobbr.ComponentModel.Registration" version="1.0.1" targetFramework="net462" />
<package id="LibLog" version="3.1.0" targetFramework="net462" developmentDependency="true" />
<package id="Microsoft.AnalyzerPowerPack" version="1.1.0" targetFramework="net462" />
Expand Down
6 changes: 6 additions & 0 deletions source/Jobbr.Tests/Infrastructure/FaultyJobStorageProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ public PagedResult<JobRun> GetJobRunsByState(JobRunStates state, int page = 1, i
return this.inMemoryVersion.GetJobRunsByState(state, page, pageSize, jobTypeFilter, jobUniqueNameFilter, query, sort);
}

public PagedResult<JobRun> GetJobRunsByStates(JobRunStates[] states, int page = 1, int pageSize = 50, string jobTypeFilter = null, string jobUniqueNameFilter = null, string query = null, params string[] sort)
{
this.CheckFailAll();
return this.inMemoryVersion.GetJobRunsByStates(states, page, pageSize, jobTypeFilter, jobUniqueNameFilter, query, sort);
}

public PagedResult<JobRun> GetJobRunsByJobId(int jobId, int page = 1, int pageSize = 50, params string[] sort)
{
this.CheckFailAll();
Expand Down
11 changes: 11 additions & 0 deletions source/Jobbr.Tests/Infrastructure/PseudoJobStorageProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,17 @@ public PagedResult<JobRun> GetJobRunsByState(JobRunStates state, int page = 1, i
};
}

public PagedResult<JobRun> GetJobRunsByStates(JobRunStates[] states, int page = 1, int pageSize = 50, string jobTypeFilter = null, string jobUniqueNameFilter = null, string query = null, params string[] sort)
{
return new PagedResult<JobRun>
{
Items = new List<JobRun>(),
TotalItems = 0,
Page = page,
PageSize = pageSize
};
}

public PagedResult<JobRun> GetJobRunsByJobId(int jobId, int page = 1, int pageSize = 50, params string[] sort)
{
return new PagedResult<JobRun>
Expand Down
8 changes: 4 additions & 4 deletions source/Jobbr.Tests/Jobbr.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
<Reference Include="Jobbr.ComponentModel.Execution, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Jobbr.ComponentModel.Execution.1.0.1\lib\net462\Jobbr.ComponentModel.Execution.dll</HintPath>
</Reference>
<Reference Include="Jobbr.ComponentModel.JobStorage, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Jobbr.ComponentModel.JobStorage.1.1.0\lib\net462\Jobbr.ComponentModel.JobStorage.dll</HintPath>
<Reference Include="Jobbr.ComponentModel.JobStorage, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Jobbr.ComponentModel.JobStorage.1.2.0\lib\net462\Jobbr.ComponentModel.JobStorage.dll</HintPath>
</Reference>
<Reference Include="Jobbr.ComponentModel.Management, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Jobbr.ComponentModel.Management.1.1.0\lib\net462\Jobbr.ComponentModel.Management.dll</HintPath>
<Reference Include="Jobbr.ComponentModel.Management, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Jobbr.ComponentModel.Management.1.2.0\lib\net462\Jobbr.ComponentModel.Management.dll</HintPath>
</Reference>
<Reference Include="Jobbr.ComponentModel.Registration, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Jobbr.ComponentModel.Registration.1.0.1\lib\net462\Jobbr.ComponentModel.Registration.dll</HintPath>
Expand Down
5 changes: 5 additions & 0 deletions source/Jobbr.Tests/Registration/BuilderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ public PagedResult<JobRun> GetJobRunsByState(JobRunStates state, int page = 0, i
throw new NotImplementedException();
}

public PagedResult<JobRun> GetJobRunsByStates(JobRunStates[] states, int page = 1, int pageSize = 50, string jobTypeFilter = null, string jobUniqueNameFilter = null, string query = null, params string[] sort)
{
throw new NotImplementedException();
}

public PagedResult<JobRun> GetJobRunsByUserId(string userId, int page = 0, int pageSize = 50, string jobTypeFilter = null, string jobUniqueNameFilter = null, params string[] sort)
{
throw new NotImplementedException();
Expand Down
4 changes: 2 additions & 2 deletions source/Jobbr.Tests/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<package id="Castle.Core" version="4.1.1" targetFramework="net462" />
<package id="Jobbr.ComponentModel.ArtefactStorage" version="1.0.1" targetFramework="net462" />
<package id="Jobbr.ComponentModel.Execution" version="1.0.1" targetFramework="net462" />
<package id="Jobbr.ComponentModel.JobStorage" version="1.1.0" targetFramework="net462" />
<package id="Jobbr.ComponentModel.Management" version="1.1.0" targetFramework="net462" />
<package id="Jobbr.ComponentModel.JobStorage" version="1.2.0" targetFramework="net462" />
<package id="Jobbr.ComponentModel.Management" version="1.2.0" targetFramework="net462" />
<package id="Jobbr.ComponentModel.Registration" version="1.0.1" targetFramework="net462" />
<package id="Moq" version="4.7.99" targetFramework="net462" />
</packages>

0 comments on commit 81a397f

Please sign in to comment.