diff --git a/tests/Agent/IntegrationTests/UnboundedApplications/BasicMvcCoreApplication/BasicMvcCoreApplication.csproj b/tests/Agent/IntegrationTests/UnboundedApplications/BasicMvcCoreApplication/BasicMvcCoreApplication.csproj deleted file mode 100644 index 649c68f701..0000000000 --- a/tests/Agent/IntegrationTests/UnboundedApplications/BasicMvcCoreApplication/BasicMvcCoreApplication.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - net7.0 - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - diff --git a/tests/Agent/IntegrationTests/UnboundedApplications/BasicMvcCoreApplication/Controllers/MicrosoftDataSqlClientController.cs b/tests/Agent/IntegrationTests/UnboundedApplications/BasicMvcCoreApplication/Controllers/MicrosoftDataSqlClientController.cs deleted file mode 100644 index 6accd6a5d1..0000000000 --- a/tests/Agent/IntegrationTests/UnboundedApplications/BasicMvcCoreApplication/Controllers/MicrosoftDataSqlClientController.cs +++ /dev/null @@ -1,236 +0,0 @@ -// Copyright 2020 New Relic, Inc. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 - - -using NewRelic.Agent.IntegrationTests.Shared; -using System.Collections.Generic; -using System.Data; -using Microsoft.Data.SqlClient; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; - -namespace BasicMvcApplication.Controllers -{ - public class MicrosoftDataSqlClientController : Controller - { - private const string InsertPersonMsSql = "INSERT INTO {0} (FirstName, LastName, Email) VALUES('Testy', 'McTesterson', 'testy@mctesterson.com')"; - private const string DeletePersonMsSql = "DELETE FROM {0} WHERE Email = 'testy@mctesterson.com'"; - private const string CountPersonMsSql = "SELECT COUNT(*) FROM {0} WITH(nolock)"; - - [HttpGet] - [Route("MicrosoftDataSqlClient/MsSql")] - public string MsSql(string tableName) - { - var teamMembers = new List(); - - using (var connection = new SqlConnection(MsSqlConfiguration.MsSqlConnectionString)) - { - connection.Open(); - - using (var command = new SqlCommand("SELECT * FROM NewRelic.dbo.TeamMembers WHERE FirstName = 'John'", connection)) - { - - using (var reader = command.ExecuteReader()) - { - while (reader.Read()) - { - teamMembers.Add(reader.GetString(reader.GetOrdinal("FirstName"))); - if (reader.NextResult()) - { - teamMembers.Add(reader.GetString(reader.GetOrdinal("FirstName"))); - } - } - } - } - - var insertSql = string.Format(InsertPersonMsSql, tableName); - var countSql = string.Format(CountPersonMsSql, tableName); - var deleteSql = string.Format(DeletePersonMsSql, tableName); - - using (var command = new SqlCommand(insertSql, connection)) - { - var insertCount = command.ExecuteNonQuery(); - } - - using (var command = new SqlCommand(countSql, connection)) - { - var teamMemberCount = command.ExecuteScalar(); - } - - using (var command = new SqlCommand(deleteSql, connection)) - { - var deleteCount = command.ExecuteNonQuery(); - } - } - - return string.Join(",", teamMembers); - } - - [HttpGet] - [Route("MicrosoftDataSqlClient/MsSqlAsync")] - public async Task MsSqlAsync(string tableName) - { - var teamMembers = new List(); - - using (var connection = new SqlConnection(MsSqlConfiguration.MsSqlConnectionString)) - { - await connection.OpenAsync(); - - using (var command = new SqlCommand("SELECT * FROM NewRelic.dbo.TeamMembers WHERE FirstName = 'John'", connection)) - { - using (var reader = await command.ExecuteReaderAsync()) - { - while (await reader.ReadAsync()) - { - teamMembers.Add(reader.GetString(reader.GetOrdinal("FirstName"))); - if (await reader.NextResultAsync()) - { - teamMembers.Add(reader.GetString(reader.GetOrdinal("FirstName"))); - } - } - } - } - - var insertSql = string.Format(InsertPersonMsSql, tableName); - var countSql = string.Format(CountPersonMsSql, tableName); - var deleteSql = string.Format(DeletePersonMsSql, tableName); - - using (var command = new SqlCommand(insertSql, connection)) - { - var insertCount = await command.ExecuteNonQueryAsync(); - } - - using (var command = new SqlCommand(countSql, connection)) - { - var teamMemberCount = await command.ExecuteScalarAsync(); - } - - using (var command = new SqlCommand(deleteSql, connection)) - { - var deleteCount = await command.ExecuteNonQueryAsync(); - } - } - - return string.Join(",", teamMembers); - } - - [HttpGet] - [Route("MicrosoftDataSqlClient/MsSqlWithParameterizedQuery")] - public string MsSqlWithParameterizedQuery(string tableName, bool paramsWithAtSign) - { - var teamMembers = new List(); - - using (var connection = new SqlConnection(MsSqlConfiguration.MsSqlConnectionString)) - { - connection.Open(); - - using (var command = new SqlCommand("SELECT * FROM NewRelic.dbo.TeamMembers WHERE FirstName = @FN", connection)) - { - command.Parameters.Add(new SqlParameter(paramsWithAtSign ? "@FN" : "FN", "O'Keefe")); - using (var reader = command.ExecuteReader()) - { - while (reader.Read()) - { - teamMembers.Add(reader.GetString(reader.GetOrdinal("FirstName"))); - if (reader.NextResult()) - { - teamMembers.Add(reader.GetString(reader.GetOrdinal("FirstName"))); - } - } - } - } - } - - return string.Join(",", teamMembers); - } - - [HttpGet] - [Route("MicrosoftDataSqlClient/MsSqlAsync_WithParameterizedQuery")] - public async Task MsSqlAsync_WithParameterizedQuery(string tableName, bool paramsWithAtSign) - { - var teamMembers = new List(); - - using (var connection = new SqlConnection(MsSqlConfiguration.MsSqlConnectionString)) - { - await connection.OpenAsync(); - - using (var command = new SqlCommand("SELECT * FROM NewRelic.dbo.TeamMembers WHERE FirstName = @FN", connection)) - { - command.Parameters.Add(new SqlParameter(paramsWithAtSign ? "@FN" : "FN", "O'Keefe")); - using (var reader = await command.ExecuteReaderAsync()) - { - while (await reader.ReadAsync()) - { - teamMembers.Add(reader.GetString(reader.GetOrdinal("FirstName"))); - if (await reader.NextResultAsync()) - { - teamMembers.Add(reader.GetString(reader.GetOrdinal("FirstName"))); - } - } - } - } - - var insertSql = string.Format(InsertPersonMsSql, tableName); - var countSql = string.Format(CountPersonMsSql, tableName); - var deleteSql = string.Format(DeletePersonMsSql, tableName); - - using (var command = new SqlCommand(insertSql, connection)) - { - var insertCount = await command.ExecuteNonQueryAsync(); - } - - using (var command = new SqlCommand(countSql, connection)) - { - var teamMemberCount = await command.ExecuteScalarAsync(); - } - - using (var command = new SqlCommand(deleteSql, connection)) - { - var deleteCount = await command.ExecuteNonQueryAsync(); - } - } - - return string.Join(",", teamMembers); - } - - [HttpGet] - [Route("MicrosoftDataSqlClient/MsSqlParameterizedStoredProcedure")] - public int MsSqlParameterizedStoredProcedure(string procedureName, bool paramsWithAtSign) - { - EnsureProcedure(procedureName, DbParameterData.MsSqlParameters); - - using (var connection = new SqlConnection(MsSqlConfiguration.MsSqlConnectionString)) - using (var command = new SqlCommand(procedureName, connection)) - { - connection.Open(); - command.CommandType = CommandType.StoredProcedure; - foreach (var parameter in DbParameterData.MsSqlParameters) - { - var paramName = paramsWithAtSign - ? parameter.ParameterName - : parameter.ParameterName.TrimStart('@'); - - command.Parameters.Add(new SqlParameter(paramName, parameter.Value)); - } - - return command.ExecuteNonQuery(); - } - } - - private static readonly string CreateProcedureStatement = @"CREATE OR ALTER PROCEDURE [dbo].[{0}] {1} AS RETURN 0"; - - private void EnsureProcedure(string procedureName, DbParameter[] dbParameters) - { - var parameters = string.Join(", ", dbParameters.Select(x => $"{x.ParameterName} {x.DbTypeName}")); - var statement = string.Format(CreateProcedureStatement, procedureName, parameters); - using (var connection = new SqlConnection(MsSqlConfiguration.MsSqlConnectionString)) - using (var command = new SqlCommand(statement, connection)) - { - connection.Open(); - command.ExecuteNonQuery(); - } - } - - } -} diff --git a/tests/Agent/IntegrationTests/UnboundedApplications/BasicMvcCoreApplication/Models/ErrorViewModel.cs b/tests/Agent/IntegrationTests/UnboundedApplications/BasicMvcCoreApplication/Models/ErrorViewModel.cs deleted file mode 100644 index 5deeea54f6..0000000000 --- a/tests/Agent/IntegrationTests/UnboundedApplications/BasicMvcCoreApplication/Models/ErrorViewModel.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2020 New Relic, Inc. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 - - -using System; - -namespace BasicMvcCoreApplication.Models -{ - public class ErrorViewModel - { - public string RequestId { get; set; } - - public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); - } -} diff --git a/tests/Agent/IntegrationTests/UnboundedApplications/BasicMvcCoreApplication/Program.cs b/tests/Agent/IntegrationTests/UnboundedApplications/BasicMvcCoreApplication/Program.cs deleted file mode 100644 index 8410078f2d..0000000000 --- a/tests/Agent/IntegrationTests/UnboundedApplications/BasicMvcCoreApplication/Program.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2020 New Relic, Inc. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 - - -using System; -using System.IO; -using System.Linq; -using System.Diagnostics; -using System.Reflection; -using System.Threading; -using Microsoft.AspNetCore; -using Microsoft.AspNetCore.Hosting; -using Microsoft.CodeAnalysis; - - -namespace BasicMvcCoreApplication -{ - public class Program - { - private const string DefaultPort = "5001"; - - private static string _port; - - private static string _applicationName; - - public static void Main(string[] args) - { - var commandLine = string.Join(" ", args); - - _applicationName = Path.GetFileNameWithoutExtension(new Uri(Assembly.GetExecutingAssembly().Location).LocalPath) + ".exe"; - - Console.WriteLine($"[{_applicationName}] Joined args: {commandLine}"); - - var result = CommandLineParser.SplitCommandLineIntoArguments(commandLine, true); - - var argPort = result.FirstOrDefault()?.Split('=')[1]; - _port = argPort ?? DefaultPort; - - Console.WriteLine($"[{_applicationName}] Received port: {argPort} | Using port: {_port}"); - - var ct = new CancellationTokenSource(); - var task = BuildWebHost(args).RunAsync(ct.Token); - - using (var eventWaitHandle = new EventWaitHandle(false, EventResetMode.AutoReset, - "app_server_wait_for_all_request_done_" + _port)) - { - CreatePidFile(); - eventWaitHandle.WaitOne(TimeSpan.FromMinutes(5)); - } - - ct.Cancel(); - - task.GetAwaiter().GetResult(); - } - - public static IWebHost BuildWebHost(string[] args) => - WebHost.CreateDefaultBuilder(args) - .UseStartup() - .UseUrls($@"http://localhost:{_port}/") - .Build(); - - private static void CreatePidFile() - { - var pid = Process.GetCurrentProcess().Id; - var applicationDirectory = - Path.Combine(Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().Location).LocalPath), - _applicationName); - var pidFilePath = applicationDirectory + ".pid"; - - using (var file = File.CreateText(pidFilePath)) - { - file.WriteLine(pid); - } - } - } -} diff --git a/tests/Agent/IntegrationTests/UnboundedApplications/BasicMvcCoreApplication/Properties/launchSettings.json b/tests/Agent/IntegrationTests/UnboundedApplications/BasicMvcCoreApplication/Properties/launchSettings.json deleted file mode 100644 index a08c687261..0000000000 --- a/tests/Agent/IntegrationTests/UnboundedApplications/BasicMvcCoreApplication/Properties/launchSettings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:60383", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "BasicMvcCoreApplication": { - "commandName": "Project", - "launchBrowser": true, - "applicationUrl": "http://localhost:5000", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} \ No newline at end of file diff --git a/tests/Agent/IntegrationTests/UnboundedApplications/BasicMvcCoreApplication/Startup.cs b/tests/Agent/IntegrationTests/UnboundedApplications/BasicMvcCoreApplication/Startup.cs deleted file mode 100644 index b2989ffd95..0000000000 --- a/tests/Agent/IntegrationTests/UnboundedApplications/BasicMvcCoreApplication/Startup.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2020 New Relic, Inc. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 - - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; - -namespace BasicMvcCoreApplication -{ - public class Startup - { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - - // This method gets called by the runtime. Use this method to add services to the container. - public void ConfigureServices(IServiceCollection services) - { - services.AddMvc(options => - { - options.SuppressAsyncSuffixInActionNames = false; - }); - } - - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) - { - app.UseStaticFiles(); - app.UseRouting(); - - app.UseEndpoints(endpoints => - { - endpoints.MapControllers(); - }); - } - } -} diff --git a/tests/Agent/IntegrationTests/UnboundedApplications/BasicMvcCoreApplication/appsettings.Development.json b/tests/Agent/IntegrationTests/UnboundedApplications/BasicMvcCoreApplication/appsettings.Development.json deleted file mode 100644 index e203e9407e..0000000000 --- a/tests/Agent/IntegrationTests/UnboundedApplications/BasicMvcCoreApplication/appsettings.Development.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Debug", - "System": "Information", - "Microsoft": "Information" - } - } -} diff --git a/tests/Agent/IntegrationTests/UnboundedApplications/BasicMvcCoreApplication/appsettings.json b/tests/Agent/IntegrationTests/UnboundedApplications/BasicMvcCoreApplication/appsettings.json deleted file mode 100644 index def9159a7d..0000000000 --- a/tests/Agent/IntegrationTests/UnboundedApplications/BasicMvcCoreApplication/appsettings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Warning" - } - }, - "AllowedHosts": "*" -} diff --git a/tests/Agent/IntegrationTests/UnboundedIntegrationTests.sln b/tests/Agent/IntegrationTests/UnboundedIntegrationTests.sln index 56769744a5..04d81af6f1 100644 --- a/tests/Agent/IntegrationTests/UnboundedIntegrationTests.sln +++ b/tests/Agent/IntegrationTests/UnboundedIntegrationTests.sln @@ -23,8 +23,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MongoDBApplication", "Unbou EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NewRelic.Testing.Assertions", "..\NewRelic.Testing.Assertions\NewRelic.Testing.Assertions.csproj", "{2A932B62-8787-4963-8D53-F83BF6ACBB5C}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BasicMvcCoreApplication", "UnboundedApplications\BasicMvcCoreApplication\BasicMvcCoreApplication.csproj", "{26AEFF66-DFF2-4C85-AB0C-0B2672E8A434}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SharedApplications", "SharedApplications", "{859E490D-4C1A-4D9D-8271-5FE2E0726ADE}" ProjectSection(SolutionItems) = preProject SharedApplications\WcfAppIisHosted\WcfAppIisHosted.csproj = SharedApplications\WcfAppIisHosted\WcfAppIisHosted.csproj @@ -80,10 +78,6 @@ Global {2A932B62-8787-4963-8D53-F83BF6ACBB5C}.Debug|Any CPU.Build.0 = Debug|Any CPU {2A932B62-8787-4963-8D53-F83BF6ACBB5C}.Release|Any CPU.ActiveCfg = Release|Any CPU {2A932B62-8787-4963-8D53-F83BF6ACBB5C}.Release|Any CPU.Build.0 = Release|Any CPU - {26AEFF66-DFF2-4C85-AB0C-0B2672E8A434}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {26AEFF66-DFF2-4C85-AB0C-0B2672E8A434}.Debug|Any CPU.Build.0 = Debug|Any CPU - {26AEFF66-DFF2-4C85-AB0C-0B2672E8A434}.Release|Any CPU.ActiveCfg = Release|Any CPU - {26AEFF66-DFF2-4C85-AB0C-0B2672E8A434}.Release|Any CPU.Build.0 = Release|Any CPU {8D07A4F7-70FD-40D4-AA95-BA9A98F14CD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8D07A4F7-70FD-40D4-AA95-BA9A98F14CD0}.Debug|Any CPU.Build.0 = Debug|Any CPU {8D07A4F7-70FD-40D4-AA95-BA9A98F14CD0}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -119,7 +113,6 @@ Global GlobalSection(NestedProjects) = preSolution {EA98CDD2-655D-4239-9B9F-44EB806DEE53} = {03BAC949-FAD7-4EE6-A2BD-45E3DE2407F9} {A8308E64-6659-4EFB-A9C4-0C48D4C99A61} = {03BAC949-FAD7-4EE6-A2BD-45E3DE2407F9} - {26AEFF66-DFF2-4C85-AB0C-0B2672E8A434} = {03BAC949-FAD7-4EE6-A2BD-45E3DE2407F9} {8D07A4F7-70FD-40D4-AA95-BA9A98F14CD0} = {859E490D-4C1A-4D9D-8271-5FE2E0726ADE} {5350D3F3-CE09-4992-9756-ACCC92A9129C} = {859E490D-4C1A-4D9D-8271-5FE2E0726ADE} {129FF113-1F3A-4DAA-8D6F-287DF67A68FA} = {859E490D-4C1A-4D9D-8271-5FE2E0726ADE} @@ -128,7 +121,7 @@ Global {F35861EC-9861-4776-AF51-9C2B7F1DBA5C} = {129FF113-1F3A-4DAA-8D6F-287DF67A68FA} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - EnterpriseLibraryConfigurationToolBinariesPathV6 = packages\EnterpriseLibrary.Common.6.0.1304.0\lib\NET45;packages\EnterpriseLibrary.Data.6.0.1304.0\lib\NET45 SolutionGuid = {656848E2-BFD2-4092-9328-C6CDF39B1274} + EnterpriseLibraryConfigurationToolBinariesPathV6 = packages\EnterpriseLibrary.Common.6.0.1304.0\lib\NET45;packages\EnterpriseLibrary.Data.6.0.1304.0\lib\NET45 EndGlobalSection EndGlobal