diff --git a/documentation/schema.json b/documentation/schema.json index d1e52ab36bb..4ebe00bac0a 100644 --- a/documentation/schema.json +++ b/documentation/schema.json @@ -850,7 +850,6 @@ } }, "JsonConsoleFormatterOptions": { - "title": "JsonConsoleFormatterOptions", "type": "object", "additionalProperties": false, "properties": { @@ -858,7 +857,7 @@ "description": "Gets or sets JsonWriterOptions.", "oneOf": [ { - "$ref": "#/definitions/JsonConsoleFormatterOptions/definitions/JsonWriterOptions" + "$ref": "#/definitions/JsonWriterOptions" } ] }, @@ -878,51 +877,48 @@ "description": "Gets or sets whether or not UTC timezone should be used for timestamps in logging messages. Defaults to false.", "default": false } - }, - "definitions": { - "JsonWriterOptions": { - "type": "object", - "additionalProperties": false, - "properties": { - "Encoder": { - "oneOf": [ - { - "type": "null" - }, - { - "$ref": "#/definitions/JsonConsoleFormatterOptions/definitions/JavaScriptEncoder" - } - ] - }, - "Indented": { - "type": "boolean" - }, - "SkipValidation": { - "type": "boolean" - } - } - }, - "JavaScriptEncoder": { - "allOf": [ + } + }, + "JsonWriterOptions": { + "type": "object", + "additionalProperties": false, + "properties": { + "Encoder": { + "oneOf": [ { - "$ref": "#/definitions/JsonConsoleFormatterOptions/definitions/TextEncoder" + "type": "null" }, { - "type": "object", - "x-abstract": true, - "additionalProperties": false + "$ref": "#/definitions/JavaScriptEncoder" } ] }, - "TextEncoder": { + "Indented": { + "type": "boolean" + }, + "SkipValidation": { + "type": "boolean" + } + } + }, + "JavaScriptEncoder": { + "allOf": [ + { + "$ref": "#/definitions/TextEncoder" + }, + { "type": "object", "x-abstract": true, "additionalProperties": false } - } + ] + }, + "TextEncoder": { + "type": "object", + "x-abstract": true, + "additionalProperties": false }, "SimpleConsoleFormatterOptions": { - "title": "SimpleConsoleFormatterOptions", "type": "object", "additionalProperties": false, "properties": { @@ -930,7 +926,7 @@ "description": "Determines when to use color when logging messages.", "oneOf": [ { - "$ref": "#/definitions/SimpleConsoleFormatterOptions/definitions/LoggerColorBehavior" + "$ref": "#/definitions/LoggerColorBehavior" } ] }, @@ -954,26 +950,23 @@ "description": "Gets or sets whether or not UTC timezone should be used for timestamps in logging messages. Defaults to false.", "default": false } - }, - "definitions": { - "LoggerColorBehavior": { - "type": "string", - "description": "", - "x-enumNames": [ - "Default", - "Enabled", - "Disabled" - ], - "enum": [ - "Default", - "Enabled", - "Disabled" - ] - } } }, + "LoggerColorBehavior": { + "type": "string", + "description": "", + "x-enumNames": [ + "Default", + "Enabled", + "Disabled" + ], + "enum": [ + "Default", + "Enabled", + "Disabled" + ] + }, "ConsoleFormatterOptions": { - "title": "ConsoleFormatterOptions", "type": "object", "additionalProperties": false, "properties": { diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 32c7a8a9ece..96eadc3ccac 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -4,13 +4,13 @@ https://github.com/dotnet/command-line-api 166610c56ff732093f0145a2911d4f6c40b786da - + https://github.com/dotnet/diagnostics - 3f15cc67105068c47743e8719c0e131dac9abb83 + 7cb03dbd4b93564f1d45c9f04ac8bf8961e01cc7 - + https://github.com/dotnet/diagnostics - 3f15cc67105068c47743e8719c0e131dac9abb83 + 7cb03dbd4b93564f1d45c9f04ac8bf8961e01cc7 @@ -22,13 +22,13 @@ https://github.com/dotnet/arcade 382667fff0b58c362855a42c3529ba294fd0514c - + https://github.com/dotnet/symstore - a2ecfd399a548818cd6e596fa401aae42d01c77e + d8e2990b89c53632653d7d67f3481cc72773f25c - + https://github.com/dotnet/aspnetcore - 9b6afb49f6981de4e242e4781a88caf3804e83e9 + 3535cfb61dd955a7fa6c31bdf72a3eba5353f1ce https://github.com/dotnet/runtime diff --git a/eng/Versions.props b/eng/Versions.props index 09941950fb0..0d2add582e2 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -29,14 +29,14 @@ 6.0.0-beta.21406.6 - 6.0.0-rc.1.21408.1 + 6.0.0-rc.1.21410.1 - 5.0.0-preview.21406.1 - 5.0.0-preview.21406.1 + 5.0.0-preview.21409.1 + 5.0.0-preview.21409.1 6.0.0-rc.1.21406.5 - 1.0.240201 + 1.0.240901 3.1.15 diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/DotnetMonitorInfo.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/DotnetMonitorInfo.cs index cb881a252cb..7b3f929fa49 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/DotnetMonitorInfo.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/DotnetMonitorInfo.cs @@ -4,13 +4,7 @@ using System.Text.Json.Serialization; -#if UNITTEST -using Microsoft.Diagnostics.Monitoring.WebApi; - -namespace Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.Models -#else namespace Microsoft.Diagnostics.Monitoring.WebApi.Models -#endif { public class DotnetMonitorInfo { diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/DumpType.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/DumpType.cs index a920aebb556..cccaa97b93b 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/DumpType.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/DumpType.cs @@ -2,11 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#if UNITTEST -namespace Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.Models -#else namespace Microsoft.Diagnostics.Monitoring.WebApi.Models -#endif { public enum DumpType { diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/EgressOperationStatus.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/EgressOperationStatus.cs index 2707346b0a3..3962d2838a7 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/EgressOperationStatus.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/EgressOperationStatus.cs @@ -3,16 +3,9 @@ // See the LICENSE file in the project root for more information. using System; -using System.Collections.Generic; -using System.Linq; using System.Text.Json.Serialization; -using System.Threading.Tasks; -#if UNITTEST -namespace Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.Models -#else namespace Microsoft.Diagnostics.Monitoring.WebApi.Models -#endif { /// /// Represents a partial model when enumerating all operations. diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/LogsConfiguration.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/LogsConfiguration.cs index 2e8809ef817..0641f70d85f 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/LogsConfiguration.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/LogsConfiguration.cs @@ -7,11 +7,7 @@ using System.ComponentModel.DataAnnotations; using System.Text.Json.Serialization; -#if UNITTEST -namespace Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.Models -#else namespace Microsoft.Diagnostics.Monitoring.WebApi.Models -#endif { public class LogsConfiguration { diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/ProcessIdentifier.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/ProcessIdentifier.cs index 83b8fa271cf..df3c9efa320 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/ProcessIdentifier.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/ProcessIdentifier.cs @@ -5,11 +5,7 @@ using System; using System.Text.Json.Serialization; -#if UNITTEST -namespace Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.Models -#else namespace Microsoft.Diagnostics.Monitoring.WebApi.Models -#endif { public class ProcessIdentifier { diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/ProcessInfo.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/ProcessInfo.cs index a1b12189dfa..0524f7f5730 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/ProcessInfo.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/ProcessInfo.cs @@ -5,11 +5,7 @@ using System; using System.Text.Json.Serialization; -#if UNITTEST -namespace Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.Models -#else namespace Microsoft.Diagnostics.Monitoring.WebApi.Models -#endif { public class ProcessInfo { diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/SchemaGenerator.cs b/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/SchemaGenerator.cs index 387654a6e15..b6a3416e7fa 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/SchemaGenerator.cs +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/SchemaGenerator.cs @@ -17,27 +17,18 @@ internal sealed class SchemaGenerator { public string GenerateSchema() { - var settings = new JsonSchemaGeneratorSettings(); + var schema = new JsonSchema(); + var context = new GenerationContext(schema); + context.SetRoot(); - settings.SerializerSettings = new JsonSerializerSettings(); - settings.SerializerSettings.Converters.Add(new StringEnumConverter()); - - JsonSchema schema = JsonSchema.FromType(settings); schema.Id = @"https://www.github.com/dotnet/dotnet-monitor"; schema.Title = "DotnetMonitorConfiguration"; - JsonSchema jsonConsoleFormatterOptions = JsonSchema.FromType(); - schema.Definitions.Add(nameof(JsonConsoleFormatterOptions), jsonConsoleFormatterOptions); - - JsonSchema simpleConsoleFormatterOptions = JsonSchema.FromType(); - schema.Definitions.Add(nameof(SimpleConsoleFormatterOptions), simpleConsoleFormatterOptions); - - JsonSchema systemdConsoleFormatterOptions = JsonSchema.FromType(); - schema.Definitions.Add(nameof(ConsoleFormatterOptions), systemdConsoleFormatterOptions); - //Allow other properties in the schema. schema.AdditionalPropertiesSchema = JsonSchema.CreateAnySchema(); + AddConsoleLoggerFormatterSubSchemas(context); + //TODO Figure out a better way to add object defaults schema.Definitions[nameof(EgressOptions)].Properties[nameof(EgressOptions.AzureBlobStorage)].Default = JsonSchema.CreateAnySchema(); schema.Definitions[nameof(EgressOptions)].Properties[nameof(EgressOptions.FileSystem)].Default = JsonSchema.CreateAnySchema(); @@ -57,16 +48,6 @@ public string GenerateSchema() kvp.Value.Default = JsonSchema.CreateAnySchema(); } - JsonSchema jsonConsoleLoggerOptionsSchema = GenerateConsoleLoggerOptionsSchema(jsonConsoleFormatterOptions, ConsoleLoggerFormat.Json); - JsonSchema simpleConsoleLoggerOptionsSchema = GenerateConsoleLoggerOptionsSchema(simpleConsoleFormatterOptions, ConsoleLoggerFormat.Simple); - JsonSchema systemdConsoleLoggerOptionsSchema = GenerateConsoleLoggerOptionsSchema(systemdConsoleFormatterOptions, ConsoleLoggerFormat.Systemd); - JsonSchema defaultConsoleLoggerOptionsSchema = GenerateDefaultConsoleLoggerOptionsSchema(simpleConsoleFormatterOptions); - - schema.Definitions[nameof(ConsoleLoggerOptions)].OneOf.Add(jsonConsoleLoggerOptionsSchema); - schema.Definitions[nameof(ConsoleLoggerOptions)].OneOf.Add(simpleConsoleLoggerOptionsSchema); - schema.Definitions[nameof(ConsoleLoggerOptions)].OneOf.Add(systemdConsoleLoggerOptionsSchema); - schema.Definitions[nameof(ConsoleLoggerOptions)].OneOf.Add(defaultConsoleLoggerOptionsSchema); - string schemaPayload = schema.ToJson(); //Normalize newlines embedded into json @@ -74,39 +55,37 @@ public string GenerateSchema() return schemaPayload; } - public static JsonSchema GenerateConsoleLoggerOptionsSchema(JsonSchema consoleFormatterOptions, ConsoleLoggerFormat consoleLoggerFormat) + private static void AddConsoleLoggerFormatterSubSchemas(GenerationContext context) { - JsonSchema consoleLoggerOptionsSchema = new JsonSchema(); - - JsonSchemaProperty formatterNameProperty = new JsonSchemaProperty(); - JsonSchemaProperty formatterOptionsProperty = new JsonSchemaProperty(); - - JsonSchema formatterOptionsSchema = new JsonSchema(); - formatterOptionsSchema.Reference = consoleFormatterOptions; - - formatterOptionsProperty.Reference = formatterOptionsSchema; - - formatterNameProperty.ExtensionData = new Dictionary(); - formatterNameProperty.ExtensionData.Add("const", consoleLoggerFormat.ToString()); + AddConsoleLoggerOptionsSubSchema(context, ConsoleLoggerFormat.Json); + AddConsoleLoggerOptionsSubSchema(context, ConsoleLoggerFormat.Simple); + AddConsoleLoggerOptionsSubSchema(context, ConsoleLoggerFormat.Systemd); + AddDefaultConsoleLoggerOptionsSubSchema(context); + } - consoleLoggerOptionsSchema.Properties.Add(nameof(ConsoleLoggerOptions.FormatterName), formatterNameProperty); - consoleLoggerOptionsSchema.Properties.Add(nameof(ConsoleLoggerOptions.FormatterOptions), formatterOptionsProperty); + private static void AddConsoleLoggerOptionsSubSchema(GenerationContext context, ConsoleLoggerFormat consoleLoggerFormat) + { + JsonSchema consoleLoggerOptionsSchema = new JsonSchema(); consoleLoggerOptionsSchema.RequiredProperties.Add(nameof(ConsoleLoggerOptions.FormatterName)); - return consoleLoggerOptionsSchema; + JsonSchemaProperty formatterOptionsProperty = AddDiscriminatedSubSchema( + context.Schema.Definitions[nameof(ConsoleLoggerOptions)], + nameof(ConsoleLoggerOptions.FormatterName), + consoleLoggerFormat.ToString(), + nameof(ConsoleLoggerOptions.FormatterOptions), + consoleLoggerOptionsSchema); + + formatterOptionsProperty.Reference = context.AddTypeIfNotExist(); } - public static JsonSchema GenerateDefaultConsoleLoggerOptionsSchema(JsonSchema consoleFormatterOptions) + private static void AddDefaultConsoleLoggerOptionsSubSchema(GenerationContext context) { JsonSchema consoleLoggerOptionsSchema = new JsonSchema(); JsonSchemaProperty formatterNameProperty = new JsonSchemaProperty(); JsonSchemaProperty formatterOptionsProperty = new JsonSchemaProperty(); - - JsonSchema formatterOptionsSchema = new JsonSchema(); - formatterOptionsSchema.Reference = consoleFormatterOptions; - formatterOptionsProperty.Reference = formatterOptionsSchema; + formatterOptionsProperty.Reference = context.AddTypeIfNotExist(); formatterNameProperty.Type = JsonObjectType.Null; formatterNameProperty.Default = "Simple"; @@ -114,7 +93,66 @@ public static JsonSchema GenerateDefaultConsoleLoggerOptionsSchema(JsonSchema co consoleLoggerOptionsSchema.Properties.Add(nameof(ConsoleLoggerOptions.FormatterName), formatterNameProperty); consoleLoggerOptionsSchema.Properties.Add(nameof(ConsoleLoggerOptions.FormatterOptions), formatterOptionsProperty); - return consoleLoggerOptionsSchema; + context.Schema.Definitions[nameof(ConsoleLoggerOptions)].OneOf.Add(consoleLoggerOptionsSchema); + } + + private static JsonSchemaProperty AddDiscriminatedSubSchema( + JsonSchema parentSchema, + string discriminatingPropertyName, + string discriminatingPropertyValue, + string discriminatedPropertyName, + JsonSchema subSchema = null) + { + if (null == subSchema) + { + subSchema = new JsonSchema(); + } + + JsonSchemaProperty discriminatingProperty = new JsonSchemaProperty(); + discriminatingProperty.ExtensionData = new Dictionary(); + discriminatingProperty.ExtensionData.Add("const", discriminatingPropertyValue); + + subSchema.Properties.Add(discriminatingPropertyName, discriminatingProperty); + + JsonSchemaProperty discriminatedProperty = new JsonSchemaProperty(); + + subSchema.Properties.Add(discriminatedPropertyName, discriminatedProperty); + + parentSchema.OneOf.Add(subSchema); + + return discriminatedProperty; + } + + private class GenerationContext + { + private readonly JsonSchemaGenerator _generator; + private readonly JsonSchemaResolver _resolver; + private readonly JsonSchemaGeneratorSettings _settings; + + public GenerationContext(JsonSchema rootSchema) + { + Schema = rootSchema; + + _settings = new JsonSchemaGeneratorSettings(); + _settings.SerializerSettings = new JsonSerializerSettings(); + _settings.SerializerSettings.Converters.Add(new StringEnumConverter()); + + _resolver = new JsonSchemaResolver(rootSchema, _settings); + + _generator = new JsonSchemaGenerator(_settings); + } + + public JsonSchema AddTypeIfNotExist() + { + return _generator.Generate(typeof(T), _resolver); + } + + public void SetRoot() + { + _generator.Generate(Schema, typeof(T), _resolver); + } + + public JsonSchema Schema { get; } } } } \ No newline at end of file diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/DumpTests.cs b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/DumpTests.cs index f8c8d1c504d..cfad516dd64 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/DumpTests.cs +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/DumpTests.cs @@ -2,13 +2,13 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using Microsoft.Diagnostics.Monitoring.TestCommon; +using Microsoft.Diagnostics.Monitoring.TestCommon.Runners; using Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.Fixtures; using Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.HttpApi; -using Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.Models; using Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.Runners; -using Microsoft.Diagnostics.Monitoring.TestCommon; -using Microsoft.Diagnostics.Monitoring.TestCommon.Options; -using Microsoft.Diagnostics.Monitoring.TestCommon.Runners; +using Microsoft.Diagnostics.Monitoring.WebApi; +using Microsoft.Diagnostics.Monitoring.WebApi.Models; using Microsoft.Extensions.DependencyInjection; using Microsoft.FileFormats; using Microsoft.FileFormats.ELF; @@ -16,13 +16,11 @@ using System; using System.IO; using System.Net.Http; -using System.Reflection; using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; using Xunit; using Xunit.Abstractions; -using Microsoft.Diagnostics.Monitoring.WebApi; namespace Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests { diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/EgressTests.cs b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/EgressTests.cs index ad12a137b57..c7baf9b40c7 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/EgressTests.cs +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/EgressTests.cs @@ -8,9 +8,9 @@ using Microsoft.Diagnostics.Monitoring.TestCommon.Runners; using Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.Fixtures; using Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.HttpApi; -using Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.Models; using Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.Runners; using Microsoft.Diagnostics.Monitoring.WebApi; +using Microsoft.Diagnostics.Monitoring.WebApi.Models; using Microsoft.Diagnostics.Tools.Monitor; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClient.cs b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClient.cs index b25674845f0..f401f492407 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClient.cs +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClient.cs @@ -3,8 +3,8 @@ // See the LICENSE file in the project root for more information. using Microsoft.AspNetCore.Mvc; -using Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.Models; using Microsoft.Diagnostics.Monitoring.WebApi; +using Microsoft.Diagnostics.Monitoring.WebApi.Models; using Microsoft.Extensions.Logging; using Microsoft.Net.Http.Headers; using System; @@ -43,7 +43,7 @@ public ApiClient(ITestOutputHelper outputHelper, HttpClient httpClient) /// /// GET /processes /// - public async Task> GetProcessesAsync(CancellationToken token) + public async Task> GetProcessesAsync(CancellationToken token) { using HttpRequestMessage request = new(HttpMethod.Get, "/processes"); request.Headers.Add(HeaderNames.Accept, ContentTypes.ApplicationJson); @@ -57,7 +57,7 @@ public ApiClient(ITestOutputHelper outputHelper, HttpClient httpClient) { case HttpStatusCode.OK: ValidateContentType(response, ContentTypes.ApplicationJson); - return await ReadContentEnumerableAsync(response).ConfigureAwait(false); + return await ReadContentEnumerableAsync(response).ConfigureAwait(false); case HttpStatusCode.BadRequest: ValidateContentType(response, ContentTypes.ApplicationProblemJson); throw await CreateValidationProblemDetailsExceptionAsync(response).ConfigureAwait(false); @@ -74,12 +74,12 @@ public ApiClient(ITestOutputHelper outputHelper, HttpClient httpClient) /// Capable of getting every combination of process query: PID, UID, and/or Name /// Get /process?pid={pid}&uid={uid}&name={name} /// - public Task GetProcessAsync(int? pid, Guid? uid, string name, CancellationToken token) + public Task GetProcessAsync(int? pid, Guid? uid, string name, CancellationToken token) { return GetProcessAsync(GetProcessQuery(pid: pid, uid: uid, name: name), token); } - private async Task GetProcessAsync(string processQuery, CancellationToken token) + private async Task GetProcessAsync(string processQuery, CancellationToken token) { using HttpRequestMessage request = new(HttpMethod.Get, $"/process?" + processQuery); request.Headers.Add(HeaderNames.Accept, ContentTypes.ApplicationJson); @@ -93,7 +93,7 @@ public ApiClient(ITestOutputHelper outputHelper, HttpClient httpClient) { case HttpStatusCode.OK: ValidateContentType(response, ContentTypes.ApplicationJson); - return await ReadContentAsync(response).ConfigureAwait(false); + return await ReadContentAsync(response).ConfigureAwait(false); case HttpStatusCode.BadRequest: ValidateContentType(response, ContentTypes.ApplicationProblemJson); throw await CreateValidationProblemDetailsExceptionAsync(response).ConfigureAwait(false); @@ -363,7 +363,7 @@ public async Task EgressTraceAsync(int processId, int duratio throw await CreateUnexpectedStatusCodeExceptionAsync(response).ConfigureAwait(false); } - public async Task> GetOperations(CancellationToken token) + public async Task> GetOperations(CancellationToken token) { using HttpRequestMessage request = new(HttpMethod.Get, "/operations"); using HttpResponseMessage response = await SendAndLogAsync(request, HttpCompletionOption.ResponseContentRead, token).ConfigureAwait(false); @@ -372,7 +372,7 @@ public async Task EgressTraceAsync(int processId, int duratio { case HttpStatusCode.OK: ValidateContentType(response, ContentTypes.ApplicationJson); - return await ReadContentEnumerableAsync(response).ConfigureAwait(false); + return await ReadContentEnumerableAsync(response).ConfigureAwait(false); case HttpStatusCode.BadRequest: ValidateContentType(response, ContentTypes.ApplicationProblemJson); throw await CreateValidationProblemDetailsExceptionAsync(response).ConfigureAwait(false); diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClientExtensions.cs b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClientExtensions.cs index e64d9e70514..7774f5b086d 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClientExtensions.cs +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClientExtensions.cs @@ -2,8 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.Models; using Microsoft.Diagnostics.Monitoring.WebApi; +using Microsoft.Diagnostics.Monitoring.WebApi.Models; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; @@ -121,7 +121,7 @@ public static async Task GetProcessAsync(this ApiClient client, Gui /// Capable of getting every combination of process query: PID, UID, and/or Name /// Get /process?pid={pid}&uid={uid}&name={name} /// - public static async Task GetProcessAsync(this ApiClient client, int? pid, Guid? uid, string name, TimeSpan timeout) + public static async Task GetProcessAsync(this ApiClient client, int? pid, Guid? uid, string name, TimeSpan timeout) { using CancellationTokenSource timeoutSource = new(timeout); return await client.GetProcessAsync(pid: pid, uid: uid, name: name, token: timeoutSource.Token).ConfigureAwait(false); @@ -315,7 +315,7 @@ public static async Task GetOperationStatus(this ApiCli return await client.GetOperationStatus(operation, timeoutSource.Token).ConfigureAwait(false); } - public static async Task> GetOperations(this ApiClient client) + public static async Task> GetOperations(this ApiClient client) { using CancellationTokenSource timeoutSource = new(TestTimeouts.HttpApi); return await client.GetOperations(timeoutSource.Token).ConfigureAwait(false); diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/OperationStatusResponse.cs b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/OperationStatusResponse.cs index 7c042249786..213a21fd3c2 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/OperationStatusResponse.cs +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/OperationStatusResponse.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.Models; +using Microsoft.Diagnostics.Monitoring.WebApi.Models; using System.Net; namespace Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.HttpApi diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/InfoTests.cs b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/InfoTests.cs index b0bf10348fa..ecc2249d4d7 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/InfoTests.cs +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/InfoTests.cs @@ -2,20 +2,19 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using Microsoft.Diagnostics.Monitoring.TestCommon; +using Microsoft.Diagnostics.Monitoring.TestCommon.Runners; using Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.Fixtures; using Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.HttpApi; -using Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.Models; using Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.Runners; -using Microsoft.Diagnostics.Monitoring.TestCommon; -using Microsoft.Diagnostics.Monitoring.TestCommon.Options; -using Microsoft.Diagnostics.Monitoring.TestCommon.Runners; +using Microsoft.Diagnostics.Monitoring.WebApi; +using Microsoft.Diagnostics.Monitoring.WebApi.Models; using Microsoft.Extensions.DependencyInjection; using System; using System.Net.Http; using System.Threading.Tasks; using Xunit; using Xunit.Abstractions; -using Microsoft.Diagnostics.Monitoring.WebApi; namespace Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests { diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/LogsTests.cs b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/LogsTests.cs index 4e4f3cece47..0ca4f409782 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/LogsTests.cs +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/LogsTests.cs @@ -3,13 +3,14 @@ // See the LICENSE file in the project root for more information. using Microsoft.AspNetCore.Http; +using Microsoft.Diagnostics.Monitoring.TestCommon; +using Microsoft.Diagnostics.Monitoring.TestCommon.Runners; using Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.Fixtures; using Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.HttpApi; using Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.Models; using Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.Runners; -using Microsoft.Diagnostics.Monitoring.TestCommon; -using Microsoft.Diagnostics.Monitoring.TestCommon.Runners; using Microsoft.Diagnostics.Monitoring.WebApi; +using Microsoft.Diagnostics.Monitoring.WebApi.Models; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using System; diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.csproj b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.csproj index c3bd3b84d77..3e51d912806 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.csproj +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.csproj @@ -10,12 +10,6 @@ - - - - - - diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/Models/LogEntry.cs b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/Models/LogEntry.cs index 8a71cefab68..b766fefff1f 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/Models/LogEntry.cs +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/Models/LogEntry.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using Microsoft.Extensions.Logging; -using System; using System.Collections.Generic; using System.Text.Json; diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/ProcessTests.cs b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/ProcessTests.cs index c3bf93a7e4b..a8112d72982 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/ProcessTests.cs +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/ProcessTests.cs @@ -3,13 +3,13 @@ // See the LICENSE file in the project root for more information. using Microsoft.AspNetCore.Http; +using Microsoft.Diagnostics.Monitoring.TestCommon; +using Microsoft.Diagnostics.Monitoring.TestCommon.Runners; using Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.Fixtures; using Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.HttpApi; -using Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.Models; using Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.Runners; -using Microsoft.Diagnostics.Monitoring.TestCommon; -using Microsoft.Diagnostics.Monitoring.TestCommon.Options; -using Microsoft.Diagnostics.Monitoring.TestCommon.Runners; +using Microsoft.Diagnostics.Monitoring.WebApi; +using Microsoft.Diagnostics.Monitoring.WebApi.Models; using Microsoft.Extensions.DependencyInjection; using System; using System.Collections.Generic; @@ -20,7 +20,6 @@ using System.Threading.Tasks; using Xunit; using Xunit.Abstractions; -using Microsoft.Diagnostics.Monitoring.WebApi; namespace Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests {