Updated test server with new paging test fix. Regenerated.

This commit is contained in:
Michael Yanni 2020-04-29 11:04:35 -07:00
Родитель 273870fa14
Коммит 544ec4681b
5 изменённых файлов: 10 добавлений и 118 удалений

6
package-lock.json сгенерированный
Просмотреть файл

@ -9,9 +9,9 @@
"dev": true
},
"@microsoft.azure/autorest.testserver": {
"version": "2.10.31",
"resolved": "https://registry.npmjs.org/@microsoft.azure/autorest.testserver/-/autorest.testserver-2.10.31.tgz",
"integrity": "sha512-PCkvkLvx3AzPKtvvjyaxZiILTE6Xqk2bkL1YjoVCjfT6nbzbX5K4/6EhqicIdKTNssHg6NZSsjPgdo+sM/jO7w==",
"version": "2.10.32",
"resolved": "https://registry.npmjs.org/@microsoft.azure/autorest.testserver/-/autorest.testserver-2.10.32.tgz",
"integrity": "sha512-a3aq39CqGv8DXU7Cqjd8snKisyeV60qQLLJoPpb++yu9xCsBHlWkgeEV66kZEaO9N+Ys5OX9RbrgXB1ll2YUtg==",
"dev": true,
"requires": {
"azure-storage": "^2.4.0",

Просмотреть файл

@ -4,7 +4,7 @@
"description": "package.json intended for in-repo use only, package.json used for publishing is located in src/AutoRest.CSharp.V3/package.json",
"devDependencies": {
"@autorest/autorest": "https://github.com/Azure/autorest/releases/download/autorest-3.0.6222/autorest-autorest-3.0.6222.tgz",
"@microsoft.azure/autorest.testserver": "^2.10.31"
"@microsoft.azure/autorest.testserver": "^2.10.32"
},
"dependencies": {}
}

4
test/TestServerProjects/paging/CodeModel.yaml сгенерированный
Просмотреть файл

@ -1151,14 +1151,14 @@ operationGroups:
extensions:
x-ms-pageable:
itemName: values
nextLinkName: nextLink
nextLinkName: null
language: !<!Languages>
default:
name: NextOperationWithQueryParams
description: Next operation for getWithQueryParams. Pass in next=True to pass test. Returns a ProductResult
paging:
itemName: values
nextLinkName: nextLink
nextLinkName: null
protocol: !<!Protocols> {}
protocol: !<!Protocols> {}
- *ref_35

Просмотреть файл

@ -207,14 +207,9 @@ namespace paging
async Task<Page<Product>> FirstPageFunc(int? pageSizeHint)
{
var response = await RestClient.NextOperationWithQueryParamsAsync(cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Values, response.Value.NextLink, response.GetRawResponse());
return Page.FromValues(response.Value.Values, null, response.GetRawResponse());
}
async Task<Page<Product>> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = await RestClient.NextOperationWithQueryParamsNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Values, response.Value.NextLink, response.GetRawResponse());
}
return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
}
/// <summary> Next operation for getWithQueryParams. Pass in next=True to pass test. Returns a ProductResult. </summary>
@ -224,14 +219,9 @@ namespace paging
Page<Product> FirstPageFunc(int? pageSizeHint)
{
var response = RestClient.NextOperationWithQueryParams(cancellationToken);
return Page.FromValues(response.Value.Values, response.Value.NextLink, response.GetRawResponse());
return Page.FromValues(response.Value.Values, null, response.GetRawResponse());
}
Page<Product> NextPageFunc(string nextLink, int? pageSizeHint)
{
var response = RestClient.NextOperationWithQueryParamsNextPage(nextLink, cancellationToken);
return Page.FromValues(response.Value.Values, response.Value.NextLink, response.GetRawResponse());
}
return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
}
/// <summary> A paging operation that includes a nextLink in odata format that has 10 pages. </summary>

Просмотреть файл

@ -2049,104 +2049,6 @@ namespace paging
}
}
internal HttpMessage CreateNextOperationWithQueryParamsNextPageRequest(string nextLink)
{
var message = _pipeline.CreateMessage();
var request = message.Request;
request.Method = RequestMethod.Get;
var uri = new RawRequestUriBuilder();
uri.AppendRaw(host, false);
uri.AppendRawNextLink(nextLink, false);
request.Uri = uri;
return message;
}
/// <summary> Next operation for getWithQueryParams. Pass in next=True to pass test. Returns a ProductResult. </summary>
/// <param name="nextLink"> The URL to the next page of results. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public async ValueTask<Response<ProductResult>> NextOperationWithQueryParamsNextPageAsync(string nextLink, CancellationToken cancellationToken = default)
{
if (nextLink == null)
{
throw new ArgumentNullException(nameof(nextLink));
}
using var scope = _clientDiagnostics.CreateScope("PagingClient.NextOperationWithQueryParams");
scope.Start();
try
{
using var message = CreateNextOperationWithQueryParamsNextPageRequest(nextLink);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
{
ProductResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = ProductResult.DeserializeProductResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Next operation for getWithQueryParams. Pass in next=True to pass test. Returns a ProductResult. </summary>
/// <param name="nextLink"> The URL to the next page of results. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public Response<ProductResult> NextOperationWithQueryParamsNextPage(string nextLink, CancellationToken cancellationToken = default)
{
if (nextLink == null)
{
throw new ArgumentNullException(nameof(nextLink));
}
using var scope = _clientDiagnostics.CreateScope("PagingClient.NextOperationWithQueryParams");
scope.Start();
try
{
using var message = CreateNextOperationWithQueryParamsNextPageRequest(nextLink);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
{
ProductResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
if (document.RootElement.ValueKind == JsonValueKind.Null)
{
value = null;
}
else
{
value = ProductResult.DeserializeProductResult(document.RootElement);
}
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
internal HttpMessage CreateGetOdataMultiplePagesNextPageRequest(string nextLink, string clientRequestId, PagingGetOdataMultiplePagesOptions pagingGetOdataMultiplePagesOptions)
{
var message = _pipeline.CreateMessage();