From 2a5a374f5143ebcec63accfae207491cec1eaedc Mon Sep 17 00:00:00 2001 From: Dylan Brasseur Date: Fri, 6 Oct 2023 15:08:56 +0200 Subject: [PATCH 1/3] feat: added duration filter --- Base/src/ArmoniK.Core.Base.csproj | 2 +- Common/src/ArmoniK.Core.Common.csproj | 2 +- Common/src/gRPC/FilterRangeExt.cs | 37 +++++++++++++++++++ Common/src/gRPC/ListSessionsRequestExt.cs | 4 ++ Common/src/gRPC/ListTasksRequestExt.cs | 4 ++ .../ToSessionDataFilterTest.cs | 29 ++++++++++++++- .../ListTasksRequestExt/ListTasksHelper.cs | 20 ++++++++++ .../ToTaskDataFilterTest.cs | 14 +++++++ .../src/ArmoniK.Samples.Bench.Server.csproj | 2 +- .../ArmoniK.Core.Common.Tests.Client.csproj | 2 +- .../src/ArmoniK.Samples.HtcMock.Server.csproj | 2 +- ...s.Common.StreamWrapper.Tests.Client.csproj | 2 +- ...s.Common.StreamWrapper.Tests.Server.csproj | 2 +- 13 files changed, 114 insertions(+), 8 deletions(-) diff --git a/Base/src/ArmoniK.Core.Base.csproj b/Base/src/ArmoniK.Core.Base.csproj index 442df76e4..86ad63e68 100644 --- a/Base/src/ArmoniK.Core.Base.csproj +++ b/Base/src/ArmoniK.Core.Base.csproj @@ -26,7 +26,7 @@ - + diff --git a/Common/src/ArmoniK.Core.Common.csproj b/Common/src/ArmoniK.Core.Common.csproj index a6f26a6c8..4f4dfc49b 100644 --- a/Common/src/ArmoniK.Core.Common.csproj +++ b/Common/src/ArmoniK.Core.Common.csproj @@ -26,7 +26,7 @@ - + diff --git a/Common/src/gRPC/FilterRangeExt.cs b/Common/src/gRPC/FilterRangeExt.cs index a538a9ffd..1e4056891 100644 --- a/Common/src/gRPC/FilterRangeExt.cs +++ b/Common/src/gRPC/FilterRangeExt.cs @@ -212,4 +212,41 @@ public static Expression> ToFilter(this FilterBooleanOperator ExpressionType.Equal), _ => throw new ArgumentOutOfRangeException(nameof(filterOperator)), }; + + /// + /// Generate a filter for operations on durations + /// + /// Type of the value and field on which the operation is applied + /// The gRPC enum that selects the operation + /// The to select the field on which to apply the operation + /// Value for the operation + /// + /// The that represents the operation on the field with the given value + /// + public static Expression> ToFilter(this FilterDurationOperator filterOperator, + Expression> field, + TimeSpan? value) + + => filterOperator switch + { + FilterDurationOperator.LessThan => ExpressionBuilders.MakeBinary(field, + value, + ExpressionType.LessThan), + FilterDurationOperator.LessThanOrEqual => ExpressionBuilders.MakeBinary(field, + value, + ExpressionType.LessThanOrEqual), + FilterDurationOperator.Equal => ExpressionBuilders.MakeBinary(field, + value, + ExpressionType.Equal), + FilterDurationOperator.NotEqual => ExpressionBuilders.MakeBinary(field, + value, + ExpressionType.NotEqual), + FilterDurationOperator.GreaterThanOrEqual => ExpressionBuilders.MakeBinary(field, + value, + ExpressionType.GreaterThanOrEqual), + FilterDurationOperator.GreaterThan => ExpressionBuilders.MakeBinary(field, + value, + ExpressionType.GreaterThan), + _ => throw new ArgumentOutOfRangeException(nameof(filterOperator)), + }; } diff --git a/Common/src/gRPC/ListSessionsRequestExt.cs b/Common/src/gRPC/ListSessionsRequestExt.cs index 96e9b9db5..5231e155e 100644 --- a/Common/src/gRPC/ListSessionsRequestExt.cs +++ b/Common/src/gRPC/ListSessionsRequestExt.cs @@ -105,6 +105,10 @@ public static Expression> ToSessionDataFilter(this Filte exprAnd = exprAnd.ExpressionAnd(filterField.FilterArray.Operator.ToFilter(filterField.Field.ToField(), filterField.FilterArray.Value)); break; + case FilterField.ValueConditionOneofCase.FilterDuration: + exprAnd = exprAnd.ExpressionAnd(filterField.FilterDuration.Operator.ToFilter(filterField.Field.ToField(), + filterField.FilterDuration.Value?.ToTimeSpan())); + break; case FilterField.ValueConditionOneofCase.None: default: throw new ArgumentOutOfRangeException(nameof(filters)); diff --git a/Common/src/gRPC/ListTasksRequestExt.cs b/Common/src/gRPC/ListTasksRequestExt.cs index 5b460bd5a..be046e41e 100644 --- a/Common/src/gRPC/ListTasksRequestExt.cs +++ b/Common/src/gRPC/ListTasksRequestExt.cs @@ -102,6 +102,10 @@ public static Expression> ToTaskDataFilter(this Filters fil exprAnd = exprAnd.ExpressionAnd(filterField.FilterArray.Operator.ToFilter(filterField.Field.ToField(), filterField.FilterArray.Value)); break; + case FilterField.ValueConditionOneofCase.FilterDuration: + exprAnd = exprAnd.ExpressionAnd(filterField.FilterDuration.Operator.ToFilter(filterField.Field.ToField(), + filterField.FilterDuration.Value?.ToTimeSpan())); + break; case FilterField.ValueConditionOneofCase.None: default: throw new ArgumentOutOfRangeException(nameof(filters)); diff --git a/Common/tests/ListSessionsRequestExt/ToSessionDataFilterTest.cs b/Common/tests/ListSessionsRequestExt/ToSessionDataFilterTest.cs index 453ab053a..63f03cb72 100644 --- a/Common/tests/ListSessionsRequestExt/ToSessionDataFilterTest.cs +++ b/Common/tests/ListSessionsRequestExt/ToSessionDataFilterTest.cs @@ -24,6 +24,8 @@ using ArmoniK.Core.Common.gRPC; using ArmoniK.Core.Common.Storage; +using Google.Protobuf.WellKnownTypes; + using NUnit.Framework; using static Google.Protobuf.WellKnownTypes.Timestamp; @@ -37,7 +39,7 @@ namespace ArmoniK.Core.Common.Tests.ListSessionsRequestExt; public class ToSessionDataFilterTest { private static readonly TaskOptions Options = new(new Dictionary(), - TimeSpan.MaxValue, + TimeSpan.FromMinutes(5), 5, 1, "part1", @@ -210,6 +212,25 @@ public static FilterField CreateListSessionsFilterDate(SessionRawEnumField field }, }; + public static FilterField CreateListSessionsFilterDuration(TaskOptionEnumField field, + FilterDurationOperator op, + TimeSpan value) + => new() + { + Field = new SessionField + { + TaskOptionField = new TaskOptionField + { + Field = field, + }, + }, + FilterDuration = new FilterDuration() + { + Operator = op, + Value = Duration.FromTimeSpan(value), + }, + }; + [Test] [TestCaseSource(nameof(TestCasesFilter))] public void Filter(IEnumerable filterFields, @@ -279,5 +300,11 @@ TestCaseData CaseFalse(FilterField filterField) yield return CaseFalse(CreateListSessionsFilterDate(SessionRawEnumField.CancelledAt, FilterDateOperator.Before, DateTime.UtcNow)); + yield return CaseTrue(CreateListSessionsFilterDuration(TaskOptionEnumField.MaxDuration, + FilterDurationOperator.LessThanOrEqual, + TimeSpan.FromMinutes(5))); + yield return CaseFalse(CreateListSessionsFilterDuration(TaskOptionEnumField.MaxDuration, + FilterDurationOperator.NotEqual, + TimeSpan.FromMinutes(5))); } } diff --git a/Common/tests/ListTasksRequestExt/ListTasksHelper.cs b/Common/tests/ListTasksRequestExt/ListTasksHelper.cs index c07eb687d..6cafab0cc 100644 --- a/Common/tests/ListTasksRequestExt/ListTasksHelper.cs +++ b/Common/tests/ListTasksRequestExt/ListTasksHelper.cs @@ -21,6 +21,7 @@ using ArmoniK.Api.gRPC.V1; using ArmoniK.Api.gRPC.V1.Tasks; +using static Google.Protobuf.WellKnownTypes.Duration; using static Google.Protobuf.WellKnownTypes.Timestamp; namespace ArmoniK.Core.Common.Tests.ListTasksRequestExt; @@ -159,4 +160,23 @@ public static FilterField CreateListTasksFilterDate(TaskSummaryEnumField field, : FromDateTime(value.Value), }, }; + + public static FilterField CreateListTasksFilterDuration(TaskSummaryEnumField field, FilterDurationOperator op, TimeSpan? value) + => new() + { + Field = new TaskField + { + TaskSummaryField = new TaskSummaryField + { + Field = field, + }, + }, + FilterDuration = new FilterDuration + { + Operator = op, + Value = value is null + ? null + : FromTimeSpan(value.Value), + }, + }; } diff --git a/Common/tests/ListTasksRequestExt/ToTaskDataFilterTest.cs b/Common/tests/ListTasksRequestExt/ToTaskDataFilterTest.cs index b709acc59..552339541 100644 --- a/Common/tests/ListTasksRequestExt/ToTaskDataFilterTest.cs +++ b/Common/tests/ListTasksRequestExt/ToTaskDataFilterTest.cs @@ -88,6 +88,8 @@ public class ToTaskDataFilterTest 3, 15).ToUniversalTime(); + private static readonly TimeSpan TimeSpanToCompare = TimeSpan.FromDays(1.5); + private static readonly ListTasksRequest.Types.Sort Sort = new() { Direction = SortDirection.Asc, @@ -222,5 +224,17 @@ TestCaseData CaseFalse(FilterField filterField) yield return CaseTrue(ListTasksHelper.CreateListTasksFilterString("key1", FilterStringOperator.EndsWith, "val1")); + yield return CaseTrue(ListTasksHelper.CreateListTasksFilterDuration(TaskSummaryEnumField.ProcessingToEndDuration, + FilterDurationOperator.LessThanOrEqual, + TimeSpanToCompare)); + yield return CaseFalse(ListTasksHelper.CreateListTasksFilterDuration(TaskSummaryEnumField.CreationToEndDuration, + FilterDurationOperator.LessThanOrEqual, + TimeSpanToCompare)); + yield return CaseFalse(ListTasksHelper.CreateListTasksFilterDuration(TaskSummaryEnumField.ProcessingToEndDuration, + FilterDurationOperator.GreaterThan, + TimeSpanToCompare)); + yield return CaseTrue(ListTasksHelper.CreateListTasksFilterDuration(TaskSummaryEnumField.CreationToEndDuration, + FilterDurationOperator.GreaterThan, + TimeSpanToCompare)); } } diff --git a/Tests/Bench/Server/src/ArmoniK.Samples.Bench.Server.csproj b/Tests/Bench/Server/src/ArmoniK.Samples.Bench.Server.csproj index 650e57262..72d81d14b 100644 --- a/Tests/Bench/Server/src/ArmoniK.Samples.Bench.Server.csproj +++ b/Tests/Bench/Server/src/ArmoniK.Samples.Bench.Server.csproj @@ -25,7 +25,7 @@ - + diff --git a/Tests/Common/Client/src/ArmoniK.Core.Common.Tests.Client.csproj b/Tests/Common/Client/src/ArmoniK.Core.Common.Tests.Client.csproj index bee25c2b5..2dda3aa0b 100644 --- a/Tests/Common/Client/src/ArmoniK.Core.Common.Tests.Client.csproj +++ b/Tests/Common/Client/src/ArmoniK.Core.Common.Tests.Client.csproj @@ -25,7 +25,7 @@ - + diff --git a/Tests/HtcMock/Server/src/ArmoniK.Samples.HtcMock.Server.csproj b/Tests/HtcMock/Server/src/ArmoniK.Samples.HtcMock.Server.csproj index 200f4a146..429974cdb 100644 --- a/Tests/HtcMock/Server/src/ArmoniK.Samples.HtcMock.Server.csproj +++ b/Tests/HtcMock/Server/src/ArmoniK.Samples.HtcMock.Server.csproj @@ -25,7 +25,7 @@ - + diff --git a/Tests/Stream/Client/ArmoniK.Extensions.Common.StreamWrapper.Tests.Client.csproj b/Tests/Stream/Client/ArmoniK.Extensions.Common.StreamWrapper.Tests.Client.csproj index 33b1d3847..a9d1aa73a 100644 --- a/Tests/Stream/Client/ArmoniK.Extensions.Common.StreamWrapper.Tests.Client.csproj +++ b/Tests/Stream/Client/ArmoniK.Extensions.Common.StreamWrapper.Tests.Client.csproj @@ -25,7 +25,7 @@ - + diff --git a/Tests/Stream/Server/ArmoniK.Extensions.Common.StreamWrapper.Tests.Server.csproj b/Tests/Stream/Server/ArmoniK.Extensions.Common.StreamWrapper.Tests.Server.csproj index 8f460f751..079cdb38c 100644 --- a/Tests/Stream/Server/ArmoniK.Extensions.Common.StreamWrapper.Tests.Server.csproj +++ b/Tests/Stream/Server/ArmoniK.Extensions.Common.StreamWrapper.Tests.Server.csproj @@ -24,7 +24,7 @@ - + From b797c2861d2152f26b43a9ca8eb48bdbdc70e3cb Mon Sep 17 00:00:00 2001 From: Dylan Brasseur Date: Fri, 6 Oct 2023 15:27:57 +0200 Subject: [PATCH 2/3] Formatting --- Common/src/gRPC/FilterRangeExt.cs | 41 +++++++++---------- Common/src/gRPC/ListSessionsRequestExt.cs | 2 +- .../ToSessionDataFilterTest.cs | 16 ++++---- .../ListTasksRequestExt/ListTasksHelper.cs | 34 +++++++-------- .../ToTaskDataFilterTest.cs | 10 ++--- 5 files changed, 52 insertions(+), 51 deletions(-) diff --git a/Common/src/gRPC/FilterRangeExt.cs b/Common/src/gRPC/FilterRangeExt.cs index 1e4056891..a7a94df10 100644 --- a/Common/src/gRPC/FilterRangeExt.cs +++ b/Common/src/gRPC/FilterRangeExt.cs @@ -225,28 +225,27 @@ public static Expression> ToFilter(this FilterBooleanOperator /// public static Expression> ToFilter(this FilterDurationOperator filterOperator, Expression> field, - TimeSpan? value) - + TimeSpan? value) => filterOperator switch - { - FilterDurationOperator.LessThan => ExpressionBuilders.MakeBinary(field, - value, - ExpressionType.LessThan), - FilterDurationOperator.LessThanOrEqual => ExpressionBuilders.MakeBinary(field, - value, - ExpressionType.LessThanOrEqual), - FilterDurationOperator.Equal => ExpressionBuilders.MakeBinary(field, - value, - ExpressionType.Equal), - FilterDurationOperator.NotEqual => ExpressionBuilders.MakeBinary(field, - value, - ExpressionType.NotEqual), - FilterDurationOperator.GreaterThanOrEqual => ExpressionBuilders.MakeBinary(field, + { + FilterDurationOperator.LessThan => ExpressionBuilders.MakeBinary(field, + value, + ExpressionType.LessThan), + FilterDurationOperator.LessThanOrEqual => ExpressionBuilders.MakeBinary(field, value, - ExpressionType.GreaterThanOrEqual), - FilterDurationOperator.GreaterThan => ExpressionBuilders.MakeBinary(field, + ExpressionType.LessThanOrEqual), + FilterDurationOperator.Equal => ExpressionBuilders.MakeBinary(field, + value, + ExpressionType.Equal), + FilterDurationOperator.NotEqual => ExpressionBuilders.MakeBinary(field, value, - ExpressionType.GreaterThan), - _ => throw new ArgumentOutOfRangeException(nameof(filterOperator)), - }; + ExpressionType.NotEqual), + FilterDurationOperator.GreaterThanOrEqual => ExpressionBuilders.MakeBinary(field, + value, + ExpressionType.GreaterThanOrEqual), + FilterDurationOperator.GreaterThan => ExpressionBuilders.MakeBinary(field, + value, + ExpressionType.GreaterThan), + _ => throw new ArgumentOutOfRangeException(nameof(filterOperator)), + }; } diff --git a/Common/src/gRPC/ListSessionsRequestExt.cs b/Common/src/gRPC/ListSessionsRequestExt.cs index 5231e155e..61316f06d 100644 --- a/Common/src/gRPC/ListSessionsRequestExt.cs +++ b/Common/src/gRPC/ListSessionsRequestExt.cs @@ -107,7 +107,7 @@ public static Expression> ToSessionDataFilter(this Filte break; case FilterField.ValueConditionOneofCase.FilterDuration: exprAnd = exprAnd.ExpressionAnd(filterField.FilterDuration.Operator.ToFilter(filterField.Field.ToField(), - filterField.FilterDuration.Value?.ToTimeSpan())); + filterField.FilterDuration.Value?.ToTimeSpan())); break; case FilterField.ValueConditionOneofCase.None: default: diff --git a/Common/tests/ListSessionsRequestExt/ToSessionDataFilterTest.cs b/Common/tests/ListSessionsRequestExt/ToSessionDataFilterTest.cs index 63f03cb72..391106710 100644 --- a/Common/tests/ListSessionsRequestExt/ToSessionDataFilterTest.cs +++ b/Common/tests/ListSessionsRequestExt/ToSessionDataFilterTest.cs @@ -220,15 +220,15 @@ public static FilterField CreateListSessionsFilterDuration(TaskOptionEnumField Field = new SessionField { TaskOptionField = new TaskOptionField - { + { Field = field, }, }, - FilterDuration = new FilterDuration() - { - Operator = op, - Value = Duration.FromTimeSpan(value), - }, + FilterDuration = new FilterDuration + { + Operator = op, + Value = Duration.FromTimeSpan(value), + }, }; [Test] @@ -301,8 +301,8 @@ TestCaseData CaseFalse(FilterField filterField) FilterDateOperator.Before, DateTime.UtcNow)); yield return CaseTrue(CreateListSessionsFilterDuration(TaskOptionEnumField.MaxDuration, - FilterDurationOperator.LessThanOrEqual, - TimeSpan.FromMinutes(5))); + FilterDurationOperator.LessThanOrEqual, + TimeSpan.FromMinutes(5))); yield return CaseFalse(CreateListSessionsFilterDuration(TaskOptionEnumField.MaxDuration, FilterDurationOperator.NotEqual, TimeSpan.FromMinutes(5))); diff --git a/Common/tests/ListTasksRequestExt/ListTasksHelper.cs b/Common/tests/ListTasksRequestExt/ListTasksHelper.cs index 6cafab0cc..297a44661 100644 --- a/Common/tests/ListTasksRequestExt/ListTasksHelper.cs +++ b/Common/tests/ListTasksRequestExt/ListTasksHelper.cs @@ -161,22 +161,24 @@ public static FilterField CreateListTasksFilterDate(TaskSummaryEnumField field, }, }; - public static FilterField CreateListTasksFilterDuration(TaskSummaryEnumField field, FilterDurationOperator op, TimeSpan? value) - => new() - { - Field = new TaskField - { - TaskSummaryField = new TaskSummaryField - { - Field = field, - }, - }, - FilterDuration = new FilterDuration + public static FilterField CreateListTasksFilterDuration(TaskSummaryEnumField field, + FilterDurationOperator op, + TimeSpan? value) + => new() + { + Field = new TaskField { - Operator = op, - Value = value is null - ? null - : FromTimeSpan(value.Value), + TaskSummaryField = new TaskSummaryField + { + Field = field, + }, }, - }; + FilterDuration = new FilterDuration + { + Operator = op, + Value = value is null + ? null + : FromTimeSpan(value.Value), + }, + }; } diff --git a/Common/tests/ListTasksRequestExt/ToTaskDataFilterTest.cs b/Common/tests/ListTasksRequestExt/ToTaskDataFilterTest.cs index 552339541..6edb46375 100644 --- a/Common/tests/ListTasksRequestExt/ToTaskDataFilterTest.cs +++ b/Common/tests/ListTasksRequestExt/ToTaskDataFilterTest.cs @@ -228,13 +228,13 @@ TestCaseData CaseFalse(FilterField filterField) FilterDurationOperator.LessThanOrEqual, TimeSpanToCompare)); yield return CaseFalse(ListTasksHelper.CreateListTasksFilterDuration(TaskSummaryEnumField.CreationToEndDuration, - FilterDurationOperator.LessThanOrEqual, - TimeSpanToCompare)); + FilterDurationOperator.LessThanOrEqual, + TimeSpanToCompare)); yield return CaseFalse(ListTasksHelper.CreateListTasksFilterDuration(TaskSummaryEnumField.ProcessingToEndDuration, - FilterDurationOperator.GreaterThan, - TimeSpanToCompare)); - yield return CaseTrue(ListTasksHelper.CreateListTasksFilterDuration(TaskSummaryEnumField.CreationToEndDuration, FilterDurationOperator.GreaterThan, TimeSpanToCompare)); + yield return CaseTrue(ListTasksHelper.CreateListTasksFilterDuration(TaskSummaryEnumField.CreationToEndDuration, + FilterDurationOperator.GreaterThan, + TimeSpanToCompare)); } } From 364f5cec291ca1d2e839debdcbf49e9e5f5bd99f Mon Sep 17 00:00:00 2001 From: Dylan Brasseur Date: Mon, 9 Oct 2023 12:17:26 +0200 Subject: [PATCH 3/3] Changed Api operator --- Base/src/ArmoniK.Core.Base.csproj | 2 +- Common/src/ArmoniK.Core.Common.csproj | 2 +- Common/src/gRPC/FilterRangeExt.cs | 24 +++++++++---------- .../ToSessionDataFilterTest.cs | 2 +- .../ToTaskDataFilterTest.cs | 8 +++---- .../src/ArmoniK.Samples.Bench.Server.csproj | 2 +- .../ArmoniK.Core.Common.Tests.Client.csproj | 2 +- .../src/ArmoniK.Samples.HtcMock.Server.csproj | 2 +- ...s.Common.StreamWrapper.Tests.Client.csproj | 2 +- ...s.Common.StreamWrapper.Tests.Server.csproj | 2 +- 10 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Base/src/ArmoniK.Core.Base.csproj b/Base/src/ArmoniK.Core.Base.csproj index 86ad63e68..742c076b8 100644 --- a/Base/src/ArmoniK.Core.Base.csproj +++ b/Base/src/ArmoniK.Core.Base.csproj @@ -26,7 +26,7 @@ - + diff --git a/Common/src/ArmoniK.Core.Common.csproj b/Common/src/ArmoniK.Core.Common.csproj index 4f4dfc49b..ff03ca19c 100644 --- a/Common/src/ArmoniK.Core.Common.csproj +++ b/Common/src/ArmoniK.Core.Common.csproj @@ -26,7 +26,7 @@ - + diff --git a/Common/src/gRPC/FilterRangeExt.cs b/Common/src/gRPC/FilterRangeExt.cs index a7a94df10..11890e2fe 100644 --- a/Common/src/gRPC/FilterRangeExt.cs +++ b/Common/src/gRPC/FilterRangeExt.cs @@ -228,24 +228,24 @@ public static Expression> ToFilter(this FilterDurationOperator TimeSpan? value) => filterOperator switch { - FilterDurationOperator.LessThan => ExpressionBuilders.MakeBinary(field, - value, - ExpressionType.LessThan), - FilterDurationOperator.LessThanOrEqual => ExpressionBuilders.MakeBinary(field, - value, - ExpressionType.LessThanOrEqual), + FilterDurationOperator.ShorterThan => ExpressionBuilders.MakeBinary(field, + value, + ExpressionType.LessThan), + FilterDurationOperator.ShorterThanOrEqual => ExpressionBuilders.MakeBinary(field, + value, + ExpressionType.LessThanOrEqual), FilterDurationOperator.Equal => ExpressionBuilders.MakeBinary(field, value, ExpressionType.Equal), FilterDurationOperator.NotEqual => ExpressionBuilders.MakeBinary(field, value, ExpressionType.NotEqual), - FilterDurationOperator.GreaterThanOrEqual => ExpressionBuilders.MakeBinary(field, - value, - ExpressionType.GreaterThanOrEqual), - FilterDurationOperator.GreaterThan => ExpressionBuilders.MakeBinary(field, - value, - ExpressionType.GreaterThan), + FilterDurationOperator.LongerThanOrEqual => ExpressionBuilders.MakeBinary(field, + value, + ExpressionType.GreaterThanOrEqual), + FilterDurationOperator.LongerThan => ExpressionBuilders.MakeBinary(field, + value, + ExpressionType.GreaterThan), _ => throw new ArgumentOutOfRangeException(nameof(filterOperator)), }; } diff --git a/Common/tests/ListSessionsRequestExt/ToSessionDataFilterTest.cs b/Common/tests/ListSessionsRequestExt/ToSessionDataFilterTest.cs index 391106710..d39fe11d9 100644 --- a/Common/tests/ListSessionsRequestExt/ToSessionDataFilterTest.cs +++ b/Common/tests/ListSessionsRequestExt/ToSessionDataFilterTest.cs @@ -301,7 +301,7 @@ TestCaseData CaseFalse(FilterField filterField) FilterDateOperator.Before, DateTime.UtcNow)); yield return CaseTrue(CreateListSessionsFilterDuration(TaskOptionEnumField.MaxDuration, - FilterDurationOperator.LessThanOrEqual, + FilterDurationOperator.ShorterThanOrEqual, TimeSpan.FromMinutes(5))); yield return CaseFalse(CreateListSessionsFilterDuration(TaskOptionEnumField.MaxDuration, FilterDurationOperator.NotEqual, diff --git a/Common/tests/ListTasksRequestExt/ToTaskDataFilterTest.cs b/Common/tests/ListTasksRequestExt/ToTaskDataFilterTest.cs index 6edb46375..9a3392a88 100644 --- a/Common/tests/ListTasksRequestExt/ToTaskDataFilterTest.cs +++ b/Common/tests/ListTasksRequestExt/ToTaskDataFilterTest.cs @@ -225,16 +225,16 @@ TestCaseData CaseFalse(FilterField filterField) FilterStringOperator.EndsWith, "val1")); yield return CaseTrue(ListTasksHelper.CreateListTasksFilterDuration(TaskSummaryEnumField.ProcessingToEndDuration, - FilterDurationOperator.LessThanOrEqual, + FilterDurationOperator.ShorterThanOrEqual, TimeSpanToCompare)); yield return CaseFalse(ListTasksHelper.CreateListTasksFilterDuration(TaskSummaryEnumField.CreationToEndDuration, - FilterDurationOperator.LessThanOrEqual, + FilterDurationOperator.ShorterThanOrEqual, TimeSpanToCompare)); yield return CaseFalse(ListTasksHelper.CreateListTasksFilterDuration(TaskSummaryEnumField.ProcessingToEndDuration, - FilterDurationOperator.GreaterThan, + FilterDurationOperator.LongerThan, TimeSpanToCompare)); yield return CaseTrue(ListTasksHelper.CreateListTasksFilterDuration(TaskSummaryEnumField.CreationToEndDuration, - FilterDurationOperator.GreaterThan, + FilterDurationOperator.LongerThan, TimeSpanToCompare)); } } diff --git a/Tests/Bench/Server/src/ArmoniK.Samples.Bench.Server.csproj b/Tests/Bench/Server/src/ArmoniK.Samples.Bench.Server.csproj index 72d81d14b..289f90548 100644 --- a/Tests/Bench/Server/src/ArmoniK.Samples.Bench.Server.csproj +++ b/Tests/Bench/Server/src/ArmoniK.Samples.Bench.Server.csproj @@ -25,7 +25,7 @@ - + diff --git a/Tests/Common/Client/src/ArmoniK.Core.Common.Tests.Client.csproj b/Tests/Common/Client/src/ArmoniK.Core.Common.Tests.Client.csproj index 2dda3aa0b..17f8f5a4c 100644 --- a/Tests/Common/Client/src/ArmoniK.Core.Common.Tests.Client.csproj +++ b/Tests/Common/Client/src/ArmoniK.Core.Common.Tests.Client.csproj @@ -25,7 +25,7 @@ - + diff --git a/Tests/HtcMock/Server/src/ArmoniK.Samples.HtcMock.Server.csproj b/Tests/HtcMock/Server/src/ArmoniK.Samples.HtcMock.Server.csproj index 429974cdb..2ec4213ac 100644 --- a/Tests/HtcMock/Server/src/ArmoniK.Samples.HtcMock.Server.csproj +++ b/Tests/HtcMock/Server/src/ArmoniK.Samples.HtcMock.Server.csproj @@ -25,7 +25,7 @@ - + diff --git a/Tests/Stream/Client/ArmoniK.Extensions.Common.StreamWrapper.Tests.Client.csproj b/Tests/Stream/Client/ArmoniK.Extensions.Common.StreamWrapper.Tests.Client.csproj index a9d1aa73a..d89fb771f 100644 --- a/Tests/Stream/Client/ArmoniK.Extensions.Common.StreamWrapper.Tests.Client.csproj +++ b/Tests/Stream/Client/ArmoniK.Extensions.Common.StreamWrapper.Tests.Client.csproj @@ -25,7 +25,7 @@ - + diff --git a/Tests/Stream/Server/ArmoniK.Extensions.Common.StreamWrapper.Tests.Server.csproj b/Tests/Stream/Server/ArmoniK.Extensions.Common.StreamWrapper.Tests.Server.csproj index 079cdb38c..996ac69d9 100644 --- a/Tests/Stream/Server/ArmoniK.Extensions.Common.StreamWrapper.Tests.Server.csproj +++ b/Tests/Stream/Server/ArmoniK.Extensions.Common.StreamWrapper.Tests.Server.csproj @@ -24,7 +24,7 @@ - +