From c3c369d13dd1b15a147bde86c89ec63a9b0c7818 Mon Sep 17 00:00:00 2001 From: shacharPash Date: Wed, 27 Sep 2023 11:27:24 +0300 Subject: [PATCH] clean almost all warnings --- src/NRedisStack/Graph/ResultSet.cs | 8 ++++++++ src/NRedisStack/Search/Group.cs | 2 +- tests/NRedisStack.Tests/Person.cs | 2 +- .../TimeSeries/TestAPI/TestAddAsync.cs | 8 +++++++- .../TimeSeries/TestAPI/TestAlterAsync.cs | 3 +++ .../TimeSeries/TestAPI/TestCreateAsync.cs | 3 +++ .../TimeSeries/TestAPI/TestDecrByAsync.cs | 4 ++-- .../TimeSeries/TestAPI/TestIncrByAsync.cs | 12 +++++++----- .../TestTimeSeriesInformation.cs | 2 ++ tests/NRedisStack.Tests/TransactionsTests.cs | 19 ++++++++++--------- 10 files changed, 44 insertions(+), 19 deletions(-) diff --git a/src/NRedisStack/Graph/ResultSet.cs b/src/NRedisStack/Graph/ResultSet.cs index 45291286..9ef95af8 100644 --- a/src/NRedisStack/Graph/ResultSet.cs +++ b/src/NRedisStack/Graph/ResultSet.cs @@ -32,6 +32,7 @@ internal enum ResultSetScalarType public Header? Header { get; } public int Count { get; } + [Obsolete] internal ResultSet(RedisResult result, GraphCache graphCache) { if (result.Type == ResultType.MultiBulk) @@ -125,6 +126,7 @@ private IEnumerable RecordIterator() } } + [Obsolete] private Node DeserializeNode(RedisResult[] rawNodeData) { var node = new Node(); @@ -145,6 +147,7 @@ private Node DeserializeNode(RedisResult[] rawNodeData) return node; } + [Obsolete] private Edge DeserializeEdge(RedisResult[] rawEdgeData) { var edge = new Edge(); @@ -160,6 +163,7 @@ private Edge DeserializeEdge(RedisResult[] rawEdgeData) return edge; } + [Obsolete] private object? DeserializeScalar(RedisResult[] rawScalarData) { var type = GetValueTypeFromObject(rawScalarData[0]); @@ -197,6 +201,7 @@ private Edge DeserializeEdge(RedisResult[] rawEdgeData) private static void DeserializeGraphEntityId(GraphEntity graphEntity, RedisResult rawEntityId) => graphEntity.Id = (int)rawEntityId; + [Obsolete] private void DeserializeGraphEntityProperties(GraphEntity graphEntity, RedisResult[] rawProperties) { foreach (RedisResult[]? rawProperty in rawProperties) @@ -209,6 +214,7 @@ private void DeserializeGraphEntityProperties(GraphEntity graphEntity, RedisResu } } + [Obsolete] private object[] DeserializeArray(RedisResult[] serializedArray) { var result = new object[serializedArray.Length]; @@ -221,6 +227,7 @@ private object[] DeserializeArray(RedisResult[] serializedArray) return result; } + [Obsolete] private DataTypes.Path DeserializePath(RedisResult[] rawPath) { var deserializedNodes = (object[])DeserializeScalar((RedisResult[])rawPath[0]!)!; @@ -248,6 +255,7 @@ private DataTypes.Path DeserializePath(RedisResult[] rawPath) } // @SuppressWarnings("unchecked") + [Obsolete] private Dictionary DeserializeDictionary(RedisResult rawPath) { RedisResult[] keyTypeValueEntries = (RedisResult[])rawPath!; diff --git a/src/NRedisStack/Search/Group.cs b/src/NRedisStack/Search/Group.cs index 04ffb321..a45e065f 100644 --- a/src/NRedisStack/Search/Group.cs +++ b/src/NRedisStack/Search/Group.cs @@ -36,7 +36,7 @@ internal void SerializeRedisArgs(List args) if (!string.IsNullOrEmpty(alias)) { args.Add("AS"); - args.Add(alias); + args.Add(alias!); } } _limit.SerializeRedisArgs(args); diff --git a/tests/NRedisStack.Tests/Person.cs b/tests/NRedisStack.Tests/Person.cs index 6859401b..fc217a05 100644 --- a/tests/NRedisStack.Tests/Person.cs +++ b/tests/NRedisStack.Tests/Person.cs @@ -2,7 +2,7 @@ namespace NRedisStack.Tests { public class Person { - public string Name { get; set; } + public string? Name { get; set; } public int Age { get; set; } } } \ No newline at end of file diff --git a/tests/NRedisStack.Tests/TimeSeries/TestAPI/TestAddAsync.cs b/tests/NRedisStack.Tests/TimeSeries/TestAPI/TestAddAsync.cs index d0a77c4b..7e641ab3 100644 --- a/tests/NRedisStack.Tests/TimeSeries/TestAPI/TestAddAsync.cs +++ b/tests/NRedisStack.Tests/TimeSeries/TestAPI/TestAddAsync.cs @@ -11,6 +11,7 @@ public class TestAddAsync : AbstractNRedisStackTest public TestAddAsync(RedisFixture redisFixture) : base(redisFixture) { } [Fact] + [Obsolete] public async Task TestAddNotExistingTimeSeries() { var key = CreateKeyName(); @@ -26,6 +27,7 @@ public async Task TestAddNotExistingTimeSeries() } [Fact] + [Obsolete] public async Task TestAddExistingTimeSeries() { var key = CreateKeyName(); @@ -42,6 +44,7 @@ public async Task TestAddExistingTimeSeries() } [Fact] + [Obsolete] public async Task TestAddStar() { var key = CreateKeyName(); @@ -50,11 +53,12 @@ public async Task TestAddStar() var ts = db.TS(); await ts.AddAsync(key, "*", 1.1); var info = await ts.InfoAsync(key); - Assert.True(info.FirstTimeStamp > 0); + Assert.True(info.FirstTimeStamp! > 0); Assert.Equal(info.FirstTimeStamp, info.LastTimeStamp); } [Fact] + [Obsolete] public async Task TestAddWithRetentionTime() { var key = CreateKeyName(); @@ -72,6 +76,7 @@ public async Task TestAddWithRetentionTime() } [Fact] + [Obsolete] public async Task TestAddWithLabels() { var key = CreateKeyName(); @@ -106,6 +111,7 @@ public async Task TestAddWithChunkSize() } [Fact] + [Obsolete] public async Task TestAddWithUncompressed() { var key = CreateKeyName(); diff --git a/tests/NRedisStack.Tests/TimeSeries/TestAPI/TestAlterAsync.cs b/tests/NRedisStack.Tests/TimeSeries/TestAPI/TestAlterAsync.cs index 05a992ce..ff5df550 100644 --- a/tests/NRedisStack.Tests/TimeSeries/TestAPI/TestAlterAsync.cs +++ b/tests/NRedisStack.Tests/TimeSeries/TestAPI/TestAlterAsync.cs @@ -10,6 +10,7 @@ public class TestAlterAsync : AbstractNRedisStackTest public TestAlterAsync(RedisFixture redisFixture) : base(redisFixture) { } [Fact] + [Obsolete] public async Task TestAlterRetentionTime() { var key = CreateKeyName(); @@ -25,6 +26,7 @@ public async Task TestAlterRetentionTime() } [Fact] + [Obsolete] public async Task TestAlterLabels() { var key = CreateKeyName(); @@ -47,6 +49,7 @@ public async Task TestAlterLabels() } [Fact] + [Obsolete] public async Task TestAlterPolicyAndChunkAsync() { var key = CreateKeyName(); diff --git a/tests/NRedisStack.Tests/TimeSeries/TestAPI/TestCreateAsync.cs b/tests/NRedisStack.Tests/TimeSeries/TestAPI/TestCreateAsync.cs index 39b1951f..36993d4b 100644 --- a/tests/NRedisStack.Tests/TimeSeries/TestAPI/TestCreateAsync.cs +++ b/tests/NRedisStack.Tests/TimeSeries/TestAPI/TestCreateAsync.cs @@ -20,6 +20,7 @@ public async Task TestCreateOK() } [Fact] + [Obsolete] public async Task TestCreateRetentionTime() { var key = CreateKeyName(); @@ -34,6 +35,7 @@ public async Task TestCreateRetentionTime() } [Fact] + [Obsolete] public async Task TestCreateLabels() { var key = CreateKeyName(); @@ -49,6 +51,7 @@ public async Task TestCreateLabels() } [Fact] + [Obsolete] public async Task TestCreateEmptyLabels() { var key = CreateKeyName(); diff --git a/tests/NRedisStack.Tests/TimeSeries/TestAPI/TestDecrByAsync.cs b/tests/NRedisStack.Tests/TimeSeries/TestAPI/TestDecrByAsync.cs index 463f69d6..219ebe64 100644 --- a/tests/NRedisStack.Tests/TimeSeries/TestAPI/TestDecrByAsync.cs +++ b/tests/NRedisStack.Tests/TimeSeries/TestAPI/TestDecrByAsync.cs @@ -20,7 +20,7 @@ public async Task TestDefaultDecrBy() Assert.True(await ts.DecrByAsync(key, -value) > 0); var result = await ts.GetAsync(key); - Assert.Equal(value, result.Val); + Assert.Equal(value, result!.Val); } [Fact] @@ -34,7 +34,7 @@ public async Task TestStarDecrBy() Assert.True(await ts.DecrByAsync(key, -value, timestamp: "*") > 0); var result = await ts.GetAsync(key); - Assert.Equal(value, result.Val); + Assert.Equal(value, result!.Val); } [Fact] diff --git a/tests/NRedisStack.Tests/TimeSeries/TestAPI/TestIncrByAsync.cs b/tests/NRedisStack.Tests/TimeSeries/TestAPI/TestIncrByAsync.cs index 2ca85069..1c02440e 100644 --- a/tests/NRedisStack.Tests/TimeSeries/TestAPI/TestIncrByAsync.cs +++ b/tests/NRedisStack.Tests/TimeSeries/TestAPI/TestIncrByAsync.cs @@ -20,7 +20,7 @@ public async Task TestDefaultIncrBy() Assert.True(await ts.IncrByAsync(key, value) > 0); var result = await ts.GetAsync(key); - Assert.Equal(value, result.Val); + Assert.Equal(value, result!.Val); } [Fact] @@ -34,7 +34,7 @@ public async Task TestStarIncrBy() Assert.True(await ts.IncrByAsync(key, value, timestamp: "*") > 0); var result = await ts.GetAsync(key); - Assert.Equal(value, result.Val); + Assert.Equal(value, result!.Val); } [Fact] @@ -51,6 +51,7 @@ public async Task TestIncrByTimeStamp() } [Fact] + [Obsolete] public async Task TestDefaultIncrByWithRetentionTime() { var key = CreateKeyName(); @@ -62,13 +63,14 @@ public async Task TestDefaultIncrByWithRetentionTime() Assert.True(await ts.IncrByAsync(key, value, retentionTime: retentionTime) > 0); var result = await ts.GetAsync(key); - Assert.Equal(value, result.Val); + Assert.Equal(value, result!.Val); var info = await ts.InfoAsync(key); Assert.Equal(retentionTime, info.RetentionTime); } [Fact] + [Obsolete] public async Task TestDefaultIncrByWithLabels() { var key = CreateKeyName(); @@ -81,7 +83,7 @@ public async Task TestDefaultIncrByWithLabels() Assert.True(await ts.IncrByAsync(key, value, labels: labels) > 0); var result = await ts.GetAsync(key); - Assert.Equal(value, result.Val); + Assert.Equal(value, result!.Val); var info = await ts.InfoAsync(key); Assert.Equal(labels, info.Labels); @@ -98,7 +100,7 @@ public async Task TestDefaultIncrByWithUncompressed() Assert.True(await ts.IncrByAsync(key, value, uncompressed: true) > 0); var result = await ts.GetAsync(key); - Assert.Equal(value, result.Val); + Assert.Equal(value, result!.Val); } [Fact] diff --git a/tests/NRedisStack.Tests/TimeSeries/TestDataTypes/TestTimeSeriesInformation.cs b/tests/NRedisStack.Tests/TimeSeries/TestDataTypes/TestTimeSeriesInformation.cs index 9318fd07..e3e43daa 100644 --- a/tests/NRedisStack.Tests/TimeSeries/TestDataTypes/TestTimeSeriesInformation.cs +++ b/tests/NRedisStack.Tests/TimeSeries/TestDataTypes/TestTimeSeriesInformation.cs @@ -13,6 +13,7 @@ public class TestInformation : AbstractNRedisStackTest public TestInformation(NRedisStack.Tests.RedisFixture redisFixture) : base(redisFixture) { } [Fact] + [Obsolete] public void TestInformationSync() { string key = CreateKeyName(); @@ -41,6 +42,7 @@ public void TestInformationSync() } [Fact] + [Obsolete] public async Task TestInformationAsync() { string key = CreateKeyName(); diff --git a/tests/NRedisStack.Tests/TransactionsTests.cs b/tests/NRedisStack.Tests/TransactionsTests.cs index 1f7b9603..0422dca4 100644 --- a/tests/NRedisStack.Tests/TransactionsTests.cs +++ b/tests/NRedisStack.Tests/TransactionsTests.cs @@ -81,21 +81,22 @@ public async Task TestModulsTransaction() } [SkipIfRedis(Is.OSSCluster)] + [Obsolete] public async Task TestModulsTransactionWithoutGraph() { IDatabase db = redisFixture.Redis.GetDatabase(); db.Execute("FLUSHALL"); var tran = new Transaction(db); - tran.Bf.ReserveAsync("bf-key", 0.001, 100); - tran.Bf.AddAsync("bf-key", "1"); - tran.Cms.InitByDimAsync("cms-key", 100, 5); - tran.Cf.ReserveAsync("cf-key", 100); - tran.Json.SetAsync("json-key", "$", "{}"); - tran.Ft.CreateAsync("ft-key", new FTCreateParams(), new Schema().AddTextField("txt")); - tran.Tdigest.CreateAsync("tdigest-key", 100); - tran.Ts.CreateAsync("ts-key", 100); - tran.TopK.ReserveAsync("topk-key", 100, 100, 100); + await tran.Bf.ReserveAsync("bf-key", 0.001, 100); + await tran.Bf.AddAsync("bf-key", "1"); + await tran.Cms.InitByDimAsync("cms-key", 100, 5); + await tran.Cf.ReserveAsync("cf-key", 100); + await tran.Json.SetAsync("json-key", "$", "{}"); + await tran.Ft.CreateAsync("ft-key", new FTCreateParams(), new Schema().AddTextField("txt")); + await tran.Tdigest.CreateAsync("tdigest-key", 100); + await tran.Ts.CreateAsync("ts-key", 100); + await tran.TopK.ReserveAsync("topk-key", 100, 100, 100); Assert.False(db.KeyExists("bf-key")); Assert.False(db.KeyExists("cms-key"));