Skip to content

Commit

Permalink
Make SessionToken on QueryRequestOptions public (#979)
Browse files Browse the repository at this point in the history
* Make SessionToken on QueryRequestOptions public

* Fix mocking for FeedIterator and Response classes (#978)

* Fix feed iterator for mocking

* Updated changelog

* Added method back

* Fixed type casting

* Removed additional internal abstract types. Added UT

* Removed unused variable

* Updated changelog

* Fixed tests

* Updating package (#975)

* Update azure-pipelines-official.yml (#970)

* Update changelog with 979

* Move line in changelog to correct location

* Remove added in change log to correct location
  • Loading branch information
dpgregory authored and Jake Willey committed Nov 22, 2019
1 parent d42970b commit 789ca8e
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public ConsistencyLevel? ConsistencyLevel
///
/// </para>
/// </remarks>
internal string SessionToken { get; set; }
public string SessionToken { get; set; }

internal CosmosSerializationFormatOptions CosmosSerializationFormatOptions { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3954,6 +3954,18 @@
"Attributes": [],
"MethodInfo": null
},
"System.String get_SessionToken()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
"Type": "Method",
"Attributes": [
"CompilerGeneratedAttribute"
],
"MethodInfo": "System.String get_SessionToken()"
},
"System.String SessionToken": {
"Type": "Property",
"Attributes": [],
"MethodInfo": null
},
"Void .ctor()": {
"Type": "Constructor",
"Attributes": [],
Expand Down Expand Up @@ -4012,6 +4024,13 @@
"CompilerGeneratedAttribute"
],
"MethodInfo": "Void set_ResponseContinuationTokenLimitInKb(System.Nullable`1[System.Int32])"
},
"Void set_SessionToken(System.String)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
"Type": "Method",
"Attributes": [
"CompilerGeneratedAttribute"
],
"MethodInfo": "Void set_SessionToken(System.String)"
}
},
"NestedTypes": {}
Expand Down Expand Up @@ -4648,6 +4667,18 @@
"Attributes": [],
"MethodInfo": null
},
"System.String get_SessionToken()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
"Type": "Method",
"Attributes": [
"CompilerGeneratedAttribute"
],
"MethodInfo": "System.String get_SessionToken()"
},
"System.String SessionToken": {
"Type": "Property",
"Attributes": [],
"MethodInfo": null
},
"Void .ctor()": {
"Type": "Constructor",
"Attributes": [],
Expand Down Expand Up @@ -4706,6 +4737,13 @@
"CompilerGeneratedAttribute"
],
"MethodInfo": "Void set_ResponseContinuationTokenLimitInKb(System.Nullable`1[System.Int32])"
},
"Void set_SessionToken(System.String)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
"Type": "Method",
"Attributes": [
"CompilerGeneratedAttribute"
],
"MethodInfo": "Void set_SessionToken(System.String)"
}
},
"NestedTypes": {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,34 @@ public async Task RequestOptionsConsistencyLevel()
await invoker.SendAsync(requestMessage, new CancellationToken());
}
}
}
}

[TestMethod]
public async Task QueryRequestOptionsSessionToken()
{
const string SessionToken = "SessionToken";
ItemRequestOptions options = new ItemRequestOptions
{
SessionToken = SessionToken
};

TestHandler testHandler = new TestHandler((request, cancellationToken) =>
{
Assert.AreEqual(SessionToken, request.Headers.GetValues(HttpConstants.HttpHeaders.SessionToken).First());
return TestHandler.ReturnSuccess();
});

CosmosClient client = MockCosmosUtil.CreateMockCosmosClient();

RequestInvokerHandler invoker = new RequestInvokerHandler(client);
invoker.InnerHandler = testHandler;
RequestMessage requestMessage = new RequestMessage(HttpMethod.Get, new System.Uri("https://dummy.documents.azure.com:443/dbs"));
requestMessage.Headers.Add(HttpConstants.HttpHeaders.PartitionKey, "[]");
requestMessage.ResourceType = ResourceType.Document;
requestMessage.OperationType = OperationType.Read;
requestMessage.RequestOptions = options;
await invoker.SendAsync(requestMessage, new CancellationToken());
}

[TestMethod]
public async Task ConsistencyLevelClient()
Expand Down
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- [#979](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/979) Make SessionToken on QueryRequestOptions public.
- [#995](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/995) Included session token in diagnostics.
- [#1000](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/1000) Add PortReuseMode to CosmosClientOptions.
- [#1017](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/1017) Adding ClientSideRequestStatistics to gateway calls and making endtime nullable
Expand Down

0 comments on commit 789ca8e

Please sign in to comment.