From 2aee0871e0cf0005eb5502d6b1c2d19e37b9f7fc Mon Sep 17 00:00:00 2001 From: tjoubert Date: Mon, 25 Jul 2022 10:00:36 +0400 Subject: [PATCH 1/6] Deprecated methods --- .../CollectionApi/CollectionApiClientTest.cs | 2 +- .../CollectionApi/Models/GetCollectionFiguresResponse.cs | 4 ++++ .../Models/GetCollectionPropertiesResponse.cs | 3 +++ .../CollectionApi/Models/GetCollectionRevisionResponse.cs | 4 ++++ .../CollectionApi/Models/PostCollectionBody.cs | 5 +++++ .../CollectionApi/Models/PostCollectionResponse.cs | 8 ++++++++ .../CollectionApi/Models/PutCollectionPropertyBody.cs | 1 + .../CollectionApi/Models/PutCollectionPropertyResponse.cs | 4 ++++ arangodb-net-standard/CursorApi/CursorApiClient.cs | 4 +++- 9 files changed, 33 insertions(+), 2 deletions(-) diff --git a/arangodb-net-standard.Test/CollectionApi/CollectionApiClientTest.cs b/arangodb-net-standard.Test/CollectionApi/CollectionApiClientTest.cs index 576eb039..5ff5cc05 100644 --- a/arangodb-net-standard.Test/CollectionApi/CollectionApiClientTest.cs +++ b/arangodb-net-standard.Test/CollectionApi/CollectionApiClientTest.cs @@ -440,7 +440,7 @@ public async Task PutCollectionPropertyAsync_ShouldThrow_WhenCollectionDoesNotEx { var body = new PutCollectionPropertyBody { - JournalSize = 313136, + //JournalSize = 313136, WaitForSync = false }; var exception = await Assert.ThrowsAsync(async () => diff --git a/arangodb-net-standard/CollectionApi/Models/GetCollectionFiguresResponse.cs b/arangodb-net-standard/CollectionApi/Models/GetCollectionFiguresResponse.cs index 49bd7fe9..b467bb71 100644 --- a/arangodb-net-standard/CollectionApi/Models/GetCollectionFiguresResponse.cs +++ b/arangodb-net-standard/CollectionApi/Models/GetCollectionFiguresResponse.cs @@ -14,6 +14,7 @@ public class GetCollectionFiguresResponse public string Id { get; set; } + [System.Obsolete()] public int IndexBuckets { get; set; } public string Error { get; set; } @@ -24,12 +25,15 @@ public class GetCollectionFiguresResponse public int Status { get; set; } + [System.Obsolete()] public int JournalSize { get; set; } + [System.Obsolete()] public bool IsVolatile { get; set; } public string Name { get; set; } + [System.Obsolete()] public bool DoCompact { get; set; } public bool IsSystem { get; set; } diff --git a/arangodb-net-standard/CollectionApi/Models/GetCollectionPropertiesResponse.cs b/arangodb-net-standard/CollectionApi/Models/GetCollectionPropertiesResponse.cs index a91b8602..2898d0fc 100644 --- a/arangodb-net-standard/CollectionApi/Models/GetCollectionPropertiesResponse.cs +++ b/arangodb-net-standard/CollectionApi/Models/GetCollectionPropertiesResponse.cs @@ -17,12 +17,14 @@ public class GetCollectionPropertiesResponse /// Whether or not the collection is compacted. /// This option is meaningful for the MMFiles storage engine only. /// + [System.Obsolete()] public bool DoCompact { get; set; } /// /// The maximal size of a journal or datafile in bytes. /// This option is meaningful for the MMFiles storage engine only. /// + [System.Obsolete()] public int JournalSize { get; set; } /// @@ -35,6 +37,7 @@ public class GetCollectionPropertiesResponse /// If true then the collection data is kept in-memory only and not made persistent. /// This option is meaningful for the MMFiles storage engine only. /// + [System.Obsolete()] public bool IsVolatile { get; set; } /// diff --git a/arangodb-net-standard/CollectionApi/Models/GetCollectionRevisionResponse.cs b/arangodb-net-standard/CollectionApi/Models/GetCollectionRevisionResponse.cs index 171d1311..6d4294c8 100644 --- a/arangodb-net-standard/CollectionApi/Models/GetCollectionRevisionResponse.cs +++ b/arangodb-net-standard/CollectionApi/Models/GetCollectionRevisionResponse.cs @@ -10,12 +10,15 @@ public class GetCollectionRevisionResponse public bool WaitForSync { get; set; } + [System.Obsolete()] public int JournalSize { get; set; } + [System.Obsolete()] public bool IsVolatile { get; set; } public bool IsSystem { get; set; } + [System.Obsolete()] public int IndexBuckets { get; set; } public CollectionKeyOptions KeyOptions { get; set; } @@ -34,6 +37,7 @@ public class GetCollectionRevisionResponse public string Name { get; set; } + [System.Obsolete()] public bool DoCompact { get; set; } } } diff --git a/arangodb-net-standard/CollectionApi/Models/PostCollectionBody.cs b/arangodb-net-standard/CollectionApi/Models/PostCollectionBody.cs index daf20d93..28b46382 100644 --- a/arangodb-net-standard/CollectionApi/Models/PostCollectionBody.cs +++ b/arangodb-net-standard/CollectionApi/Models/PostCollectionBody.cs @@ -19,6 +19,7 @@ public class PostCollectionBody /// Whether or not the collection will be compacted (default is true). /// This option is meaningful for the MMFiles storage engine only. /// + [System.Obsolete()] public bool? DoCompact { get; set; } /// @@ -32,6 +33,8 @@ public class PostCollectionBody /// For example, 64 might be a sensible value for a collection with 100 000 000 documents. /// This option is meaningful for the MMFiles storage engine only. /// + /// + [System.Obsolete()] public int? IndexBuckets { get; set; } /// @@ -53,6 +56,7 @@ public class PostCollectionBody /// and not for data that cannot be re-created otherwise. (The default is false) /// This option is meaningful for the MMFiles storage engine only. /// + [System.Obsolete()] public bool? IsVolatile { get; set; } /// @@ -62,6 +66,7 @@ public class PostCollectionBody /// (The default is a configuration parameter) /// This option is meaningful for the MMFiles storage engine only. /// + [System.Obsolete()] public long? JournalSize { get; set; } /// diff --git a/arangodb-net-standard/CollectionApi/Models/PostCollectionResponse.cs b/arangodb-net-standard/CollectionApi/Models/PostCollectionResponse.cs index a28c951c..0f727259 100644 --- a/arangodb-net-standard/CollectionApi/Models/PostCollectionResponse.cs +++ b/arangodb-net-standard/CollectionApi/Models/PostCollectionResponse.cs @@ -33,6 +33,8 @@ public class PostCollectionResponse /// The maximal size of a journal or datafile in bytes. /// This option is meaningful for the MMFiles storage engine only. /// + /// + [System.Obsolete()] public long JournalSize { get; set; } public PostCollectionResponseCollectionKeyOptions KeyOptions { get; set; } @@ -53,6 +55,8 @@ public class PostCollectionResponse /// Whether or not the collection is compacted. /// This option is meaningful for the MMFiles storage engine only. /// + /// + [System.Obsolete()] public bool DoCompact { get; set; } /// @@ -65,6 +69,8 @@ public class PostCollectionResponse /// The number of buckets into which indexes using a hash table are split. /// This option is meaningful for the MMFiles storage engine only. /// + /// + [System.Obsolete()] public int IndexBuckets { get; set; } /// @@ -72,6 +78,8 @@ public class PostCollectionResponse /// If true then the collection data is kept in-memory only and not made persistent. /// This option is meaningful for the MMFiles storage engine only. /// + /// + [System.Obsolete()] public bool IsVolatile { get; set; } /// diff --git a/arangodb-net-standard/CollectionApi/Models/PutCollectionPropertyBody.cs b/arangodb-net-standard/CollectionApi/Models/PutCollectionPropertyBody.cs index b48b0e44..dd6141f0 100644 --- a/arangodb-net-standard/CollectionApi/Models/PutCollectionPropertyBody.cs +++ b/arangodb-net-standard/CollectionApi/Models/PutCollectionPropertyBody.cs @@ -4,6 +4,7 @@ public class PutCollectionPropertyBody { public bool? WaitForSync { get; set; } + [System.Obsolete()] public long? JournalSize { get; set; } } } diff --git a/arangodb-net-standard/CollectionApi/Models/PutCollectionPropertyResponse.cs b/arangodb-net-standard/CollectionApi/Models/PutCollectionPropertyResponse.cs index 5a898043..ae913c45 100644 --- a/arangodb-net-standard/CollectionApi/Models/PutCollectionPropertyResponse.cs +++ b/arangodb-net-standard/CollectionApi/Models/PutCollectionPropertyResponse.cs @@ -10,6 +10,7 @@ public class PutCollectionPropertyResponse public bool WaitForSync { get; set; } + [System.Obsolete()] public long JournalSize { get; set; } public int Status { get; set; } @@ -18,8 +19,10 @@ public class PutCollectionPropertyResponse public bool IsSystem { get; set; } + [System.Obsolete()] public bool IsVolatile { get; set; } + [System.Obsolete()] public bool DoCompact { get; set; } public CollectionKeyOptions KeyOptions { get; set; } @@ -32,6 +35,7 @@ public class PutCollectionPropertyResponse public string StatusString { get; set; } + [System.Obsolete()] public int IndexBuckets { get; set; } } } diff --git a/arangodb-net-standard/CursorApi/CursorApiClient.cs b/arangodb-net-standard/CursorApi/CursorApiClient.cs index 7ca10530..bb0b33c4 100644 --- a/arangodb-net-standard/CursorApi/CursorApiClient.cs +++ b/arangodb-net-standard/CursorApi/CursorApiClient.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Net; using System.Threading.Tasks; using ArangoDBNetStandard.CursorApi.Models; @@ -158,6 +159,7 @@ public virtual async Task DeleteCursorAsync(string cursorI /// Result type to deserialize to /// ID of the existing query cursor. /// + [Obsolete("Use PostCursorAsync")] public virtual async Task> PutCursorAsync(string cursorId) { string uri = _cursorApiPath + "/" + WebUtility.UrlEncode(cursorId); From 711955ef6131bd713149f19493f0512b11a300d0 Mon Sep 17 00:00:00 2001 From: tjoubert Date: Sun, 28 Aug 2022 15:53:37 +0400 Subject: [PATCH 2/6] Updated obsolete message for PutCursorAsync() and overloaded PostCursorAsync() --- .../CursorApi/CursorApiClient.cs | 31 ++++++++++++++++--- .../CursorApi/ICursorApiClient.cs | 11 +++++++ 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/arangodb-net-standard/CursorApi/CursorApiClient.cs b/arangodb-net-standard/CursorApi/CursorApiClient.cs index b0f3bd4b..49504061 100644 --- a/arangodb-net-standard/CursorApi/CursorApiClient.cs +++ b/arangodb-net-standard/CursorApi/CursorApiClient.cs @@ -128,8 +128,8 @@ public virtual async Task> PostCursorAsync( { var content = GetContent(postCursorBody, new ApiClientSerializationOptions(true, true)); var headerCollection = GetHeaderCollection(headerProperties); - using (var response = await _client.PostAsync(_cursorApiPath, - content, + using (var response = await _client.PostAsync(_cursorApiPath, + content, headerCollection, token).ConfigureAwait(false)) { @@ -175,12 +175,12 @@ public virtual async Task DeleteCursorAsync(string cursorI /// ID of the existing query cursor. /// A CancellationToken to observe while waiting for the task to complete or to cancel the task. /// - [Obsolete("Use PostCursorAsync")] + [Obsolete("Use PostCursorAsync and specify the cursorIdentifier parameter.")] public virtual async Task> PutCursorAsync(string cursorId, CancellationToken token = default) { string uri = _cursorApiPath + "/" + WebUtility.UrlEncode(cursorId); - using (var response = await _client.PutAsync(uri, new byte[0],null,token).ConfigureAwait(false)) + using (var response = await _client.PutAsync(uri, new byte[0], null, token).ConfigureAwait(false)) { if (response.IsSuccessStatusCode) { @@ -191,5 +191,28 @@ public virtual async Task> PutCursorAsync(string cursorI throw await GetApiErrorException(response).ConfigureAwait(false); } } + + /// + /// Advances an existing query cursor and gets the next set of results. + /// Replaces + /// + /// The name / identifier of the existing cursor. + /// A CancellationToken to observe while waiting for the task to complete or to cancel the task. + /// + public virtual async Task> PostCursorAsync(string cursorIdentifier, CancellationToken token = default) + { + using (var response = await _client.PostAsync( + requestUri: _cursorApiPath + $"/{WebUtility.UrlEncode(cursorIdentifier)}", + content: new byte[] { }, + token: token).ConfigureAwait(false)) + { + if (response.IsSuccessStatusCode) + { + var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + return DeserializeJsonFromStream>(stream); + } + throw await GetApiErrorException(response).ConfigureAwait(false); + } + } } } \ No newline at end of file diff --git a/arangodb-net-standard/CursorApi/ICursorApiClient.cs b/arangodb-net-standard/CursorApi/ICursorApiClient.cs index b5463daf..ee553193 100644 --- a/arangodb-net-standard/CursorApi/ICursorApiClient.cs +++ b/arangodb-net-standard/CursorApi/ICursorApiClient.cs @@ -49,6 +49,17 @@ Task> PostCursorAsync( CursorHeaderProperties headerProperties = null, CancellationToken token = default); + /// + /// Advances an existing query cursor and gets the next set of results. + /// Replaces + /// + /// The name / identifier of the existing cursor. + /// A CancellationToken to observe while waiting for the task to complete or to cancel the task. + /// + Task> PostCursorAsync( + string cursorIdentifier, + CancellationToken token = default); + /// /// Deletes an existing cursor and frees the resources associated with it. /// DELETE /_api/cursor/{cursor-identifier} From 243fd62d7f224815a5591d73086fc92694d98e8d Mon Sep 17 00:00:00 2001 From: tjoubert Date: Sun, 28 Aug 2022 15:57:09 +0400 Subject: [PATCH 3/6] Fixed tests --- .../CursorApi/CursorApiClientTest.cs | 18 +++++++++--------- arangodb-net-standard.Test/Docs/UsageTest.cs | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/arangodb-net-standard.Test/CursorApi/CursorApiClientTest.cs b/arangodb-net-standard.Test/CursorApi/CursorApiClientTest.cs index f6a68ed6..eadca475 100644 --- a/arangodb-net-standard.Test/CursorApi/CursorApiClientTest.cs +++ b/arangodb-net-standard.Test/CursorApi/CursorApiClientTest.cs @@ -44,7 +44,7 @@ public async Task PostCursorAsync_ShouldSucceed() [Fact] public async Task PostCursorAsync_ShouldSucceed_WhenQueryResultsInWarnings() { - var response = await _cursorApi.PostCursorAsync("RETURN 1 / 0"); + var response = await _cursorApi.PostCursorAsync("RETURN 1 / 0",null); Assert.Single(response.Result); Assert.Null(response.Result.First()); @@ -158,7 +158,7 @@ public async Task PostCursorAsync_ShouldThrow_WhenAqlIsNotValid() { var ex = await Assert.ThrowsAsync(async () => { - await _cursorApi.PostCursorAsync("RETURN blah"); + await _cursorApi.PostCursorAsync("RETURN blah", null); }); Assert.NotNull(ex.ApiError.ErrorMessage); @@ -197,7 +197,7 @@ public async Task PostCursorAsync_ShouldThrow_WhenErrorDeserializationFailed() var ex = await Assert.ThrowsAsync(async () => { - await cursorApi.PostCursorAsync("RETURN true"); + await cursorApi.PostCursorAsync("RETURN true", null); }); Assert.NotNull(ex.Message); @@ -210,7 +210,7 @@ public async Task PostCursorAsync_ShouldThrowException_WhenResponseDeserializati { var ex = await Assert.ThrowsAsync(async () => { - await _cursorApi.PostCursorAsync("RETURN null"); + await _cursorApi.PostCursorAsync("RETURN null", null); }); Assert.NotNull(ex.Message); @@ -274,7 +274,7 @@ await apiClient.PostCursorAsync( public async Task PostCursorAsync_ShouldReturnResponseModelWithInterface() { ICursorResponse response = - await _cursorApi.PostCursorAsync("RETURN {}"); + await _cursorApi.PostCursorAsync("RETURN {}", null); Assert.NotNull(response); } @@ -282,7 +282,7 @@ public async Task PostCursorAsync_ShouldReturnResponseModelWithInterface() [Fact] public async Task PutCursorAsync_ShouldSucceed() { - var response = await _cursorApi.PostCursorAsync("FOR i IN 0..1000 RETURN i"); + var response = await _cursorApi.PostCursorAsync("FOR i IN 0..1000 RETURN i", null); Assert.True(response.HasMore); var nextResponse = await _cursorApi.PutCursorAsync(response.Id); @@ -295,7 +295,7 @@ public async Task PutCursorAsync_ShouldSucceed() [Fact] public async Task PutCursorAsync_ShouldThrow_WhenCursorIsExhausted() { - var response = await _cursorApi.PostCursorAsync("FOR i IN 0..1000 RETURN i"); + var response = await _cursorApi.PostCursorAsync("FOR i IN 0..1000 RETURN i", null); Assert.True(response.HasMore); var nextResponse = await _cursorApi.PutCursorAsync(response.Id); @@ -320,7 +320,7 @@ public async Task PutCursorAsync_ShouldThrow_WhenCursorDoesNotExist() public async Task PutCursorAsync_ShouldReturnResponseModelWithInterface() { PostCursorResponse postResponse = - await _cursorApi.PostCursorAsync("FOR i IN 0..1500 RETURN i"); + await _cursorApi.PostCursorAsync("FOR i IN 0..1500 RETURN i", null); ICursorResponse putResult = await _cursorApi.PutCursorAsync(postResponse.Id); @@ -342,7 +342,7 @@ public async Task DeleteCursorAsync_ShouldThrow_WhenCursorDoesNotExist() [Fact] public async Task DeleteCursorAsync_ShouldSucceed() { - var response = await _cursorApi.PostCursorAsync("FOR i IN 0..1000 RETURN i"); + var response = await _cursorApi.PostCursorAsync("FOR i IN 0..1000 RETURN i", null); Assert.True(response.HasMore); var deleteResponse = await _cursorApi.DeleteCursorAsync(response.Id); diff --git a/arangodb-net-standard.Test/Docs/UsageTest.cs b/arangodb-net-standard.Test/Docs/UsageTest.cs index 0a5acc9b..cf9218ef 100644 --- a/arangodb-net-standard.Test/Docs/UsageTest.cs +++ b/arangodb-net-standard.Test/Docs/UsageTest.cs @@ -106,7 +106,7 @@ await adb.Document.PostDocumentAsync( var response = await adb.Cursor.PostCursorAsync( @"FOR doc IN MyCollection FILTER doc.ItemNumber == 123456 - RETURN doc"); + RETURN doc", null); MyClassDocument item = response.Result.First(); From 6e8ca86db901f89ceabc7d01dbb88b0b29c4bf17 Mon Sep 17 00:00:00 2001 From: tjoubert Date: Mon, 29 Aug 2022 14:12:53 +0400 Subject: [PATCH 4/6] Renamed replacement method for PutCursorAsync to PostAdvanceCursorAsync and amended test project. --- .../CursorApi/CursorApiClientTest.cs | 18 +++++++++--------- .../CursorApi/CursorApiClient.cs | 4 ++-- .../CursorApi/ICursorApiClient.cs | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/arangodb-net-standard.Test/CursorApi/CursorApiClientTest.cs b/arangodb-net-standard.Test/CursorApi/CursorApiClientTest.cs index eadca475..483c945f 100644 --- a/arangodb-net-standard.Test/CursorApi/CursorApiClientTest.cs +++ b/arangodb-net-standard.Test/CursorApi/CursorApiClientTest.cs @@ -280,12 +280,12 @@ public async Task PostCursorAsync_ShouldReturnResponseModelWithInterface() } [Fact] - public async Task PutCursorAsync_ShouldSucceed() + public async Task PostAdvanceCursorAsync_ShouldSucceed() { var response = await _cursorApi.PostCursorAsync("FOR i IN 0..1000 RETURN i", null); Assert.True(response.HasMore); - var nextResponse = await _cursorApi.PutCursorAsync(response.Id); + var nextResponse = await _cursorApi.PostAdvanceCursorAsync(response.Id); Assert.False(nextResponse.HasMore); Assert.Single(nextResponse.Result); Assert.Equal(1000, nextResponse.Result.First()); @@ -293,23 +293,23 @@ public async Task PutCursorAsync_ShouldSucceed() } [Fact] - public async Task PutCursorAsync_ShouldThrow_WhenCursorIsExhausted() + public async Task PostAdvanceCursorAsync_ShouldThrow_WhenCursorIsExhausted() { var response = await _cursorApi.PostCursorAsync("FOR i IN 0..1000 RETURN i", null); Assert.True(response.HasMore); - var nextResponse = await _cursorApi.PutCursorAsync(response.Id); + var nextResponse = await _cursorApi.PostAdvanceCursorAsync(response.Id); Assert.False(nextResponse.HasMore); await Assert.ThrowsAsync(async () => - await _cursorApi.PutCursorAsync(response.Id)); + await _cursorApi.PostAdvanceCursorAsync(response.Id)); } [Fact] - public async Task PutCursorAsync_ShouldThrow_WhenCursorDoesNotExist() + public async Task PostAdvanceCursorAsync_ShouldThrow_WhenCursorDoesNotExist() { var ex = await Assert.ThrowsAsync(async () => - await _cursorApi.PutCursorAsync("nada")); + await _cursorApi.PostAdvanceCursorAsync("nada")); Assert.NotNull(ex.ApiError.ErrorMessage); Assert.Equal(1600, ex.ApiError.ErrorNum); @@ -317,13 +317,13 @@ public async Task PutCursorAsync_ShouldThrow_WhenCursorDoesNotExist() } [Fact] - public async Task PutCursorAsync_ShouldReturnResponseModelWithInterface() + public async Task PostAdvanceCursorAsync_ShouldReturnResponseModelWithInterface() { PostCursorResponse postResponse = await _cursorApi.PostCursorAsync("FOR i IN 0..1500 RETURN i", null); ICursorResponse putResult = - await _cursorApi.PutCursorAsync(postResponse.Id); + await _cursorApi.PostAdvanceCursorAsync(postResponse.Id); Assert.NotNull(putResult); } diff --git a/arangodb-net-standard/CursorApi/CursorApiClient.cs b/arangodb-net-standard/CursorApi/CursorApiClient.cs index 49504061..98395c4a 100644 --- a/arangodb-net-standard/CursorApi/CursorApiClient.cs +++ b/arangodb-net-standard/CursorApi/CursorApiClient.cs @@ -175,7 +175,7 @@ public virtual async Task DeleteCursorAsync(string cursorI /// ID of the existing query cursor. /// A CancellationToken to observe while waiting for the task to complete or to cancel the task. /// - [Obsolete("Use PostCursorAsync and specify the cursorIdentifier parameter.")] + [Obsolete("Use PostAdvanceCursorAsync.")] public virtual async Task> PutCursorAsync(string cursorId, CancellationToken token = default) { @@ -199,7 +199,7 @@ public virtual async Task> PutCursorAsync(string cursorI /// The name / identifier of the existing cursor. /// A CancellationToken to observe while waiting for the task to complete or to cancel the task. /// - public virtual async Task> PostCursorAsync(string cursorIdentifier, CancellationToken token = default) + public virtual async Task> PostAdvanceCursorAsync(string cursorIdentifier, CancellationToken token = default) { using (var response = await _client.PostAsync( requestUri: _cursorApiPath + $"/{WebUtility.UrlEncode(cursorIdentifier)}", diff --git a/arangodb-net-standard/CursorApi/ICursorApiClient.cs b/arangodb-net-standard/CursorApi/ICursorApiClient.cs index ee553193..608c060b 100644 --- a/arangodb-net-standard/CursorApi/ICursorApiClient.cs +++ b/arangodb-net-standard/CursorApi/ICursorApiClient.cs @@ -56,7 +56,7 @@ Task> PostCursorAsync( /// The name / identifier of the existing cursor. /// A CancellationToken to observe while waiting for the task to complete or to cancel the task. /// - Task> PostCursorAsync( + Task> PostAdvanceCursorAsync( string cursorIdentifier, CancellationToken token = default); From 19658fb4182d2f758339d00c3909faec2c2bfda3 Mon Sep 17 00:00:00 2001 From: tjoubert Date: Mon, 29 Aug 2022 14:18:22 +0400 Subject: [PATCH 5/6] Added `[Trait("ServerVersion", "3_8_PLUS")]` to `PostAdvanceCursorAsync` tests --- arangodb-net-standard.Test/CursorApi/CursorApiClientTest.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arangodb-net-standard.Test/CursorApi/CursorApiClientTest.cs b/arangodb-net-standard.Test/CursorApi/CursorApiClientTest.cs index 483c945f..7eafe153 100644 --- a/arangodb-net-standard.Test/CursorApi/CursorApiClientTest.cs +++ b/arangodb-net-standard.Test/CursorApi/CursorApiClientTest.cs @@ -280,6 +280,7 @@ public async Task PostCursorAsync_ShouldReturnResponseModelWithInterface() } [Fact] + [Trait("ServerVersion", "3_8_PLUS")] public async Task PostAdvanceCursorAsync_ShouldSucceed() { var response = await _cursorApi.PostCursorAsync("FOR i IN 0..1000 RETURN i", null); @@ -293,6 +294,7 @@ public async Task PostAdvanceCursorAsync_ShouldSucceed() } [Fact] + [Trait("ServerVersion", "3_8_PLUS")] public async Task PostAdvanceCursorAsync_ShouldThrow_WhenCursorIsExhausted() { var response = await _cursorApi.PostCursorAsync("FOR i IN 0..1000 RETURN i", null); @@ -306,6 +308,7 @@ await Assert.ThrowsAsync(async () => } [Fact] + [Trait("ServerVersion", "3_8_PLUS")] public async Task PostAdvanceCursorAsync_ShouldThrow_WhenCursorDoesNotExist() { var ex = await Assert.ThrowsAsync(async () => @@ -317,6 +320,7 @@ public async Task PostAdvanceCursorAsync_ShouldThrow_WhenCursorDoesNotExist() } [Fact] + [Trait("ServerVersion", "3_8_PLUS")] public async Task PostAdvanceCursorAsync_ShouldReturnResponseModelWithInterface() { PostCursorResponse postResponse = From ad8c44fe208c9e2f77673f722a1bcbd46ab8f9a9 Mon Sep 17 00:00:00 2001 From: tjoubert Date: Mon, 29 Aug 2022 14:31:41 +0400 Subject: [PATCH 6/6] Cleaned PostCursorAsync tests --- .../CursorApi/CursorApiClientTest.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/arangodb-net-standard.Test/CursorApi/CursorApiClientTest.cs b/arangodb-net-standard.Test/CursorApi/CursorApiClientTest.cs index 7eafe153..ce20b9aa 100644 --- a/arangodb-net-standard.Test/CursorApi/CursorApiClientTest.cs +++ b/arangodb-net-standard.Test/CursorApi/CursorApiClientTest.cs @@ -44,7 +44,7 @@ public async Task PostCursorAsync_ShouldSucceed() [Fact] public async Task PostCursorAsync_ShouldSucceed_WhenQueryResultsInWarnings() { - var response = await _cursorApi.PostCursorAsync("RETURN 1 / 0",null); + var response = await _cursorApi.PostCursorAsync("RETURN 1 / 0"); Assert.Single(response.Result); Assert.Null(response.Result.First()); @@ -158,7 +158,7 @@ public async Task PostCursorAsync_ShouldThrow_WhenAqlIsNotValid() { var ex = await Assert.ThrowsAsync(async () => { - await _cursorApi.PostCursorAsync("RETURN blah", null); + await _cursorApi.PostCursorAsync("RETURN blah"); }); Assert.NotNull(ex.ApiError.ErrorMessage); @@ -197,7 +197,7 @@ public async Task PostCursorAsync_ShouldThrow_WhenErrorDeserializationFailed() var ex = await Assert.ThrowsAsync(async () => { - await cursorApi.PostCursorAsync("RETURN true", null); + await cursorApi.PostCursorAsync("RETURN true"); }); Assert.NotNull(ex.Message); @@ -210,7 +210,7 @@ public async Task PostCursorAsync_ShouldThrowException_WhenResponseDeserializati { var ex = await Assert.ThrowsAsync(async () => { - await _cursorApi.PostCursorAsync("RETURN null", null); + await _cursorApi.PostCursorAsync("RETURN null"); }); Assert.NotNull(ex.Message); @@ -274,7 +274,7 @@ await apiClient.PostCursorAsync( public async Task PostCursorAsync_ShouldReturnResponseModelWithInterface() { ICursorResponse response = - await _cursorApi.PostCursorAsync("RETURN {}", null); + await _cursorApi.PostCursorAsync("RETURN {}"); Assert.NotNull(response); } @@ -283,7 +283,7 @@ public async Task PostCursorAsync_ShouldReturnResponseModelWithInterface() [Trait("ServerVersion", "3_8_PLUS")] public async Task PostAdvanceCursorAsync_ShouldSucceed() { - var response = await _cursorApi.PostCursorAsync("FOR i IN 0..1000 RETURN i", null); + var response = await _cursorApi.PostCursorAsync("FOR i IN 0..1000 RETURN i"); Assert.True(response.HasMore); var nextResponse = await _cursorApi.PostAdvanceCursorAsync(response.Id); @@ -297,7 +297,7 @@ public async Task PostAdvanceCursorAsync_ShouldSucceed() [Trait("ServerVersion", "3_8_PLUS")] public async Task PostAdvanceCursorAsync_ShouldThrow_WhenCursorIsExhausted() { - var response = await _cursorApi.PostCursorAsync("FOR i IN 0..1000 RETURN i", null); + var response = await _cursorApi.PostCursorAsync("FOR i IN 0..1000 RETURN i"); Assert.True(response.HasMore); var nextResponse = await _cursorApi.PostAdvanceCursorAsync(response.Id); @@ -324,7 +324,7 @@ public async Task PostAdvanceCursorAsync_ShouldThrow_WhenCursorDoesNotExist() public async Task PostAdvanceCursorAsync_ShouldReturnResponseModelWithInterface() { PostCursorResponse postResponse = - await _cursorApi.PostCursorAsync("FOR i IN 0..1500 RETURN i", null); + await _cursorApi.PostCursorAsync("FOR i IN 0..1500 RETURN i"); ICursorResponse putResult = await _cursorApi.PostAdvanceCursorAsync(postResponse.Id); @@ -346,7 +346,7 @@ public async Task DeleteCursorAsync_ShouldThrow_WhenCursorDoesNotExist() [Fact] public async Task DeleteCursorAsync_ShouldSucceed() { - var response = await _cursorApi.PostCursorAsync("FOR i IN 0..1000 RETURN i", null); + var response = await _cursorApi.PostCursorAsync("FOR i IN 0..1000 RETURN i"); Assert.True(response.HasMore); var deleteResponse = await _cursorApi.DeleteCursorAsync(response.Id);