Skip to content

Commit

Permalink
clean almost all warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
shacharPash committed Sep 27, 2023
1 parent 2c5dab6 commit c3c369d
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 19 deletions.
8 changes: 8 additions & 0 deletions src/NRedisStack/Graph/ResultSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -125,6 +126,7 @@ private IEnumerable<Record> RecordIterator()
}
}

[Obsolete]
private Node DeserializeNode(RedisResult[] rawNodeData)
{
var node = new Node();
Expand All @@ -145,6 +147,7 @@ private Node DeserializeNode(RedisResult[] rawNodeData)
return node;
}

[Obsolete]
private Edge DeserializeEdge(RedisResult[] rawEdgeData)
{
var edge = new Edge();
Expand All @@ -160,6 +163,7 @@ private Edge DeserializeEdge(RedisResult[] rawEdgeData)
return edge;
}

[Obsolete]
private object? DeserializeScalar(RedisResult[] rawScalarData)
{
var type = GetValueTypeFromObject(rawScalarData[0]);
Expand Down Expand Up @@ -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)
Expand All @@ -209,6 +214,7 @@ private void DeserializeGraphEntityProperties(GraphEntity graphEntity, RedisResu
}
}

[Obsolete]
private object[] DeserializeArray(RedisResult[] serializedArray)
{
var result = new object[serializedArray.Length];
Expand All @@ -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]!)!;
Expand Down Expand Up @@ -248,6 +255,7 @@ private DataTypes.Path DeserializePath(RedisResult[] rawPath)
}

// @SuppressWarnings("unchecked")
[Obsolete]
private Dictionary<string, object> DeserializeDictionary(RedisResult rawPath)
{
RedisResult[] keyTypeValueEntries = (RedisResult[])rawPath!;
Expand Down
2 changes: 1 addition & 1 deletion src/NRedisStack/Search/Group.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ internal void SerializeRedisArgs(List<object> args)
if (!string.IsNullOrEmpty(alias))
{
args.Add("AS");
args.Add(alias);
args.Add(alias!);
}
}
_limit.SerializeRedisArgs(args);
Expand Down
2 changes: 1 addition & 1 deletion tests/NRedisStack.Tests/Person.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
}
}
8 changes: 7 additions & 1 deletion tests/NRedisStack.Tests/TimeSeries/TestAPI/TestAddAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class TestAddAsync : AbstractNRedisStackTest
public TestAddAsync(RedisFixture redisFixture) : base(redisFixture) { }

[Fact]
[Obsolete]
public async Task TestAddNotExistingTimeSeries()
{
var key = CreateKeyName();
Expand All @@ -26,6 +27,7 @@ public async Task TestAddNotExistingTimeSeries()
}

[Fact]
[Obsolete]
public async Task TestAddExistingTimeSeries()
{
var key = CreateKeyName();
Expand All @@ -42,6 +44,7 @@ public async Task TestAddExistingTimeSeries()
}

[Fact]
[Obsolete]
public async Task TestAddStar()
{
var key = CreateKeyName();
Expand All @@ -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();
Expand All @@ -72,6 +76,7 @@ public async Task TestAddWithRetentionTime()
}

[Fact]
[Obsolete]
public async Task TestAddWithLabels()
{
var key = CreateKeyName();
Expand Down Expand Up @@ -106,6 +111,7 @@ public async Task TestAddWithChunkSize()
}

[Fact]
[Obsolete]
public async Task TestAddWithUncompressed()
{
var key = CreateKeyName();
Expand Down
3 changes: 3 additions & 0 deletions tests/NRedisStack.Tests/TimeSeries/TestAPI/TestAlterAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class TestAlterAsync : AbstractNRedisStackTest
public TestAlterAsync(RedisFixture redisFixture) : base(redisFixture) { }

[Fact]
[Obsolete]
public async Task TestAlterRetentionTime()
{
var key = CreateKeyName();
Expand All @@ -25,6 +26,7 @@ public async Task TestAlterRetentionTime()
}

[Fact]
[Obsolete]
public async Task TestAlterLabels()
{
var key = CreateKeyName();
Expand All @@ -47,6 +49,7 @@ public async Task TestAlterLabels()
}

[Fact]
[Obsolete]
public async Task TestAlterPolicyAndChunkAsync()
{
var key = CreateKeyName();
Expand Down
3 changes: 3 additions & 0 deletions tests/NRedisStack.Tests/TimeSeries/TestAPI/TestCreateAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public async Task TestCreateOK()
}

[Fact]
[Obsolete]
public async Task TestCreateRetentionTime()
{
var key = CreateKeyName();
Expand All @@ -34,6 +35,7 @@ public async Task TestCreateRetentionTime()
}

[Fact]
[Obsolete]
public async Task TestCreateLabels()
{
var key = CreateKeyName();
Expand All @@ -49,6 +51,7 @@ public async Task TestCreateLabels()
}

[Fact]
[Obsolete]
public async Task TestCreateEmptyLabels()
{
var key = CreateKeyName();
Expand Down
4 changes: 2 additions & 2 deletions tests/NRedisStack.Tests/TimeSeries/TestAPI/TestDecrByAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand Down
12 changes: 7 additions & 5 deletions tests/NRedisStack.Tests/TimeSeries/TestAPI/TestIncrByAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand All @@ -51,6 +51,7 @@ public async Task TestIncrByTimeStamp()
}

[Fact]
[Obsolete]
public async Task TestDefaultIncrByWithRetentionTime()
{
var key = CreateKeyName();
Expand All @@ -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();
Expand All @@ -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);
Expand All @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class TestInformation : AbstractNRedisStackTest
public TestInformation(NRedisStack.Tests.RedisFixture redisFixture) : base(redisFixture) { }

[Fact]
[Obsolete]
public void TestInformationSync()
{
string key = CreateKeyName();
Expand Down Expand Up @@ -41,6 +42,7 @@ public void TestInformationSync()
}

[Fact]
[Obsolete]
public async Task TestInformationAsync()
{
string key = CreateKeyName();
Expand Down
19 changes: 10 additions & 9 deletions tests/NRedisStack.Tests/TransactionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down

0 comments on commit c3c369d

Please sign in to comment.