diff --git a/.editorconfig b/.editorconfig index 353bf8bba12..c9e795adf89 100644 --- a/.editorconfig +++ b/.editorconfig @@ -16,7 +16,7 @@ indent_size = 4 indent_style = space indent_size = 4 -[*.{md,markdown,json,js,csproj,fsproj,targets}] +[*.{md,markdown,json,js,csproj,fsproj,targets,targets,props}] indent_style = space indent_size = 2 diff --git a/build/scripts/scripts.fsproj b/build/scripts/scripts.fsproj index b79233a506e..2cce53e05df 100644 --- a/build/scripts/scripts.fsproj +++ b/build/scripts/scripts.fsproj @@ -61,6 +61,12 @@ + + paket.bat + paket.bat + paket.bat + paket.bat + 11 diff --git a/src/Artifacts.build.props b/src/Artifacts.build.props new file mode 100644 index 00000000000..3c08b9e302e --- /dev/null +++ b/src/Artifacts.build.props @@ -0,0 +1,11 @@ + + + + + + $(OutputPathBaseDir)\$(MSBuildProjectName)\ + + \ No newline at end of file diff --git a/src/CodeGeneration/ApiGenerator/ApiGenerator.csproj b/src/CodeGeneration/ApiGenerator/ApiGenerator.csproj index e8cf307dd64..5d6c76330dc 100644 --- a/src/CodeGeneration/ApiGenerator/ApiGenerator.csproj +++ b/src/CodeGeneration/ApiGenerator/ApiGenerator.csproj @@ -1,5 +1,6 @@  + Exe netcoreapp2.1 @@ -17,5 +18,4 @@ - \ No newline at end of file diff --git a/src/CodeGeneration/DocGenerator/Buildalyzer/ProjectAnalyzer.cs b/src/CodeGeneration/DocGenerator/Buildalyzer/ProjectAnalyzer.cs index 29e93a73776..2cdba3b3de4 100644 --- a/src/CodeGeneration/DocGenerator/Buildalyzer/ProjectAnalyzer.cs +++ b/src/CodeGeneration/DocGenerator/Buildalyzer/ProjectAnalyzer.cs @@ -119,6 +119,8 @@ public Project Load() } } + + // Tweaks the project file a bit to ensure a succesfull build private static XDocument TweakProjectDocument(XDocument projectDocument, string projectFolder) { @@ -128,10 +130,12 @@ private static XDocument TweakProjectDocument(XDocument projectDocument, string if (att == null) continue; var project = att.Value; - if (project.EndsWith("Clients.Common.targets")) - att.Value = Path.GetFullPath(Path.Combine(projectFolder, att.Value)); - else if (project.EndsWith("outputpath.props")) - att.Value = Path.GetFullPath(Path.Combine(projectFolder, att.Value)); + + if (!ResolveKnownPropsPath(projectFolder, project, att, "PublishArtifacts.build.props")) + { + ResolveKnownPropsPath(projectFolder, project, att, "Artifacts.build.props"); + } + ResolveKnownPropsPath(projectFolder, project, att, "Library.build.props"); } // Add SkipGetTargetFrameworkProperties to every ProjectReference foreach (XElement projectReference in projectDocument.GetDescendants("ProjectReference").ToArray()) @@ -149,6 +153,17 @@ private static XDocument TweakProjectDocument(XDocument projectDocument, string return projectDocument; } + private static bool ResolveKnownPropsPath(string projectFolder, string project, XAttribute att, string buildPropFile) + { + if (!project.Contains(buildPropFile)) return false; + var dir = new DirectoryInfo(projectFolder).Parent; + while (dir != null && dir.Name != "src") + dir = dir.Parent; + if (dir == null) return true; + att.Value = Path.GetFullPath(Path.Combine(dir.FullName, buildPropFile)); + return false; + } + private ProjectCollection CreateProjectCollection() { ProjectCollection projectCollection = new ProjectCollection(_globalProperties); diff --git a/src/CodeGeneration/DocGenerator/DocGenerator.csproj b/src/CodeGeneration/DocGenerator/DocGenerator.csproj index 4a554826b3b..a59b91f8dd8 100644 --- a/src/CodeGeneration/DocGenerator/DocGenerator.csproj +++ b/src/CodeGeneration/DocGenerator/DocGenerator.csproj @@ -1,5 +1,6 @@  + Exe netcoreapp2.1 @@ -17,5 +18,4 @@ - diff --git a/src/Directory.build.props b/src/Directory.build.props index d6f4976f0b4..bfabaf7cf7a 100644 --- a/src/Directory.build.props +++ b/src/Directory.build.props @@ -1,27 +1,5 @@ - - 6.0.0 - 6.0.0 - 6.0.0 - - $(CurrentVersion) - $(CurrentVersion) - - $(CurrentAssemblyVersion) - - $(CurrentAssemblyFileVersion) - - $(DefineConstants);DOTNETCORE - $(DefineConstants);DOTNETCORE - $(DefineConstants);DOTNETCORE - - https://raw.githubusercontent.com/elastic/elasticsearch-net - Elasticsearch BV - Elasticsearch BV - https://github.com/elastic/elasticsearch-net - https://github.com/elastic/elasticsearch-net/blob/master/license.txt - See https://github.com/elastic/elasticsearch-net/releases - https://raw.githubusercontent.com/elastic/elasticsearch-net/master/build/nuget-icon.png + Latest \ No newline at end of file diff --git a/src/Elasticsearch.Net/Connection/CertificateValidations.cs b/src/Elasticsearch.Net/Connection/CertificateValidations.cs index 0fc199dc196..0a6038dcbd3 100644 --- a/src/Elasticsearch.Net/Connection/CertificateValidations.cs +++ b/src/Elasticsearch.Net/Connection/CertificateValidations.cs @@ -57,7 +57,7 @@ public static Func Au private static X509Certificate2 to2(X509Certificate certificate) { - #if !FEATURE_HTTPWEBREQUEST + #if DOTNETCORE return new X509Certificate2(certificate.Export(X509ContentType.Cert)); #else return new X509Certificate2(certificate); diff --git a/src/Elasticsearch.Net/Connection/ClientCertificate.cs b/src/Elasticsearch.Net/Connection/ClientCertificate.cs index 7aa47ba490c..8ab6541d8a4 100644 --- a/src/Elasticsearch.Net/Connection/ClientCertificate.cs +++ b/src/Elasticsearch.Net/Connection/ClientCertificate.cs @@ -36,8 +36,8 @@ THE SOFTWARE. namespace Elasticsearch.Net { -//.NET removed the setter for PrivateKey for X509Certificate, you'll have to manually convert to pfx/p12 or add the key to the machine store -#if FEATURE_HTTPWEBREQUEST +//.NET core removed the setter for PrivateKey for X509Certificate, you'll have to manually convert to pfx/p12 or add the key to the machine store +#if !DOTNETCORE public class ClientCertificate { diff --git a/src/Elasticsearch.Net/Connection/HttpConnection-CoreFx.cs b/src/Elasticsearch.Net/Connection/HttpConnection-CoreFx.cs index d0b736ef4e4..3d0b53f110d 100644 --- a/src/Elasticsearch.Net/Connection/HttpConnection-CoreFx.cs +++ b/src/Elasticsearch.Net/Connection/HttpConnection-CoreFx.cs @@ -1,4 +1,4 @@ -#if !FEATURE_HTTPWEBREQUEST +#if DOTNETCORE using System; using System.Collections.Concurrent; using System.Collections.Generic; @@ -29,6 +29,8 @@ internal class WebProxy : IWebProxy public bool IsBypassed(Uri host) => host.IsLoopback; } + + /// The default IConnection implementation. Uses . public class HttpConnection : IConnection { private readonly object _lock = new object(); diff --git a/src/Elasticsearch.Net/Connection/HttpConnection.cs b/src/Elasticsearch.Net/Connection/HttpConnection.cs index cdd87ea0919..f951ca13592 100644 --- a/src/Elasticsearch.Net/Connection/HttpConnection.cs +++ b/src/Elasticsearch.Net/Connection/HttpConnection.cs @@ -1,19 +1,9 @@ -#if FEATURE_HTTPWEBREQUEST -using System; -using System.Collections.Generic; -using System.IO; -using System.IO.Compression; -using System.Linq; +#if !DOTNETCORE using System.Net; -using System.Net.Security; -using System.Text; -using System.Threading; -using System.Threading.Tasks; namespace Elasticsearch.Net { - public class HttpConnection : HttpWebRequestConnection - { - } + /// The default IConnection implementation. Uses on the current .NET desktop framework. + public class HttpConnection : HttpWebRequestConnection { } } #endif diff --git a/src/Elasticsearch.Net/Connection/HttpWebRequestConnection.cs b/src/Elasticsearch.Net/Connection/HttpWebRequestConnection.cs index 6461d173b77..61b53c7bf86 100644 --- a/src/Elasticsearch.Net/Connection/HttpWebRequestConnection.cs +++ b/src/Elasticsearch.Net/Connection/HttpWebRequestConnection.cs @@ -11,6 +11,9 @@ namespace Elasticsearch.Net { +#if DOTNETCORE + [Obsolete("CoreFX HttpWebRequest uses HttpClient under the covers but does not reuse HttpClient instances, we'll therefor stop shipping with this class in the next major version")] +#endif public class HttpWebRequestConnection : IConnection { internal static bool IsMono { get; } = Type.GetType("Mono.Runtime") != null; @@ -57,7 +60,7 @@ protected virtual HttpWebRequest CreateWebRequest(RequestData requestData) request.Accept = requestData.Accept; request.ContentType = requestData.RequestMimeType; -#if FEATURE_HTTPWEBREQUEST +#if !DOTNETCORE // on netstandard/netcoreapp2.0 this throws argument exception request.MaximumResponseHeadersLength = -1; #endif diff --git a/src/Elasticsearch.Net/Elasticsearch.Net.csproj b/src/Elasticsearch.Net/Elasticsearch.Net.csproj index a321308aa2c..d6a7e587f56 100644 --- a/src/Elasticsearch.Net/Elasticsearch.Net.csproj +++ b/src/Elasticsearch.Net/Elasticsearch.Net.csproj @@ -1,6 +1,6 @@  - + netstandard2.0;net461 netstandard2.0 @@ -8,5 +8,4 @@ - \ No newline at end of file diff --git a/src/Elasticsearch.Net/Transport/Transport.cs b/src/Elasticsearch.Net/Transport/Transport.cs index 90e64644b89..425ae3ffb42 100644 --- a/src/Elasticsearch.Net/Transport/Transport.cs +++ b/src/Elasticsearch.Net/Transport/Transport.cs @@ -3,7 +3,7 @@ using System.Threading; using System; using System.Linq; -#if FEATURE_HTTPWEBREQUEST +#if !DOTNETCORE using System.Net; #endif @@ -203,7 +203,7 @@ private void HandleElasticsearchClientException(RequestData data, Exception clie //This causes it to behave differently to .NET FULL. We already wrapped the WebExeption //under ElasticsearchServerException and it exposes way more information as part of it's //exception message e.g the the root cause of the server error body. -#if FEATURE_HTTPWEBREQUEST +#if !DOTNETCORE if (a.OriginalException is WebException) a.OriginalException = clientException; #endif diff --git a/src/Elasticsearch.sln b/src/Elasticsearch.sln index 47ac69a99d7..d3559461807 100644 --- a/src/Elasticsearch.sln +++ b/src/Elasticsearch.sln @@ -3,26 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27130.2003 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Build", "_Build", "{432D5575-2347-4D3C-BF8C-3E38410C46CA}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "RelatedFiles", "RelatedFiles", "{432D5575-2347-4D3C-BF8C-3E38410C46CA}" ProjectSection(SolutionItems) = preProject - ..\.editorconfig = ..\.editorconfig - ..\.gitignore = ..\.gitignore - ..\.travis.yml = ..\.travis.yml - ..\appveyor.yml = ..\appveyor.yml - ..\build.bat = ..\build.bat - ..\build.sh = ..\build.sh - ..\build\Clients.Common.targets = ..\build\Clients.Common.targets - ..\contributing.md = ..\contributing.md - ..\build\Elasticsearch.Net.nuspec = ..\build\Elasticsearch.Net.nuspec - ..\global.json = ..\global.json - ..\license.txt = ..\license.txt - ..\build\NEST.JsonNetSerializer.nuspec = ..\build\NEST.JsonNetSerializer.nuspec - ..\build\NEST.nuspec = ..\build\NEST.nuspec - ..\NuGet.config = ..\NuGet.config - ..\paket.bat = ..\paket.bat - ..\paket.dependencies = ..\paket.dependencies - ..\readme.md = ..\readme.md - outputpath.props = outputpath.props + ..\src\PublishArtifacts.build.props = ..\src\PublishArtifacts.build.props + ..\src\Artifacts.build.props = ..\src\Artifacts.build.props + ..\src\Library.build.props = ..\src\Library.build.props Directory.build.props = Directory.build.props EndProjectSection EndProject @@ -65,6 +50,30 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.Reproduce", "Tests\Te EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.ScratchPad", "Tests\Tests.ScratchPad\Tests.ScratchPad.csproj", "{CE7AC1D4-15AF-47FB-83FA-F7137DFD9076}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Root", "Root", "{EAE89579-CCA9-45CE-AF83-3DCD98690EA8}" +ProjectSection(SolutionItems) = preProject + ..\.editorconfig = ..\.editorconfig + ..\.gitignore = ..\.gitignore + ..\.travis.yml = ..\.travis.yml + ..\appveyor.yml = ..\appveyor.yml + ..\global.json = ..\global.json +EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Nuget", "Nuget", "{C7865979-1D1C-46AF-BDE8-1DA6F3ED81B3}" +ProjectSection(SolutionItems) = preProject + ..\build\NEST.JsonNetSerializer.nuspec = ..\build\NEST.JsonNetSerializer.nuspec + ..\build\NEST.nuspec = ..\build\NEST.nuspec + ..\NuGet.config = ..\NuGet.config + ..\build\Elasticsearch.Net.nuspec = ..\build\Elasticsearch.Net.nuspec +EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Markdown", "Markdown", "{2FABB663-F4DB-499A-89F8-3A08828D1D91}" +ProjectSection(SolutionItems) = preProject + ..\contributing.md = ..\contributing.md + ..\license.txt = ..\license.txt + ..\readme.md = ..\readme.md +EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -80,7 +89,6 @@ Global {56A87048-9065-459B-826D-3DF68B409845} = {93331BEE-0AA0-47B7-B1D2-BD5BD31634D1} {98400F59-4BA8-4534-9A78-9C7FA0B42901} = {93331BEE-0AA0-47B7-B1D2-BD5BD31634D1} {CDC8DEC8-3872-4337-9C40-9CDE5724BBDD} = {14241027-0A92-466D-B024-E0063F338915} - {D6997ADC-E933-418E-831C-DE1A78897493} = {432D5575-2347-4D3C-BF8C-3E38410C46CA} {5B393962-7586-49BA-BD99-3B1E35F48E94} = {6C4A2627-AF22-4388-9DF7-7A9AEACFD635} {BAA9802A-A664-4DB7-9A34-5FA84BEBDF81} = {6C4A2627-AF22-4388-9DF7-7A9AEACFD635} {AC554BF8-8ED9-4C45-BB65-8833219CAC93} = {6C4A2627-AF22-4388-9DF7-7A9AEACFD635} @@ -90,6 +98,9 @@ Global {8C119416-DB47-4971-A9EC-566217241D95} = {6C4A2627-AF22-4388-9DF7-7A9AEACFD635} {30FB80AE-3B37-4FBB-8450-9666969EEE1A} = {6C4A2627-AF22-4388-9DF7-7A9AEACFD635} {CE7AC1D4-15AF-47FB-83FA-F7137DFD9076} = {6C4A2627-AF22-4388-9DF7-7A9AEACFD635} + {EAE89579-CCA9-45CE-AF83-3DCD98690EA8} = {432D5575-2347-4D3C-BF8C-3E38410C46CA} + {C7865979-1D1C-46AF-BDE8-1DA6F3ED81B3} = {432D5575-2347-4D3C-BF8C-3E38410C46CA} + {2FABB663-F4DB-499A-89F8-3A08828D1D91} = {432D5575-2347-4D3C-BF8C-3E38410C46CA} EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {5B393962-7586-49BA-BD99-3B1E35F48E94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU diff --git a/src/Library.build.props b/src/Library.build.props new file mode 100644 index 00000000000..b4485df17cd --- /dev/null +++ b/src/Library.build.props @@ -0,0 +1,28 @@ + + + + + 6.0.0 + 6.0.0 + 6.0.0 + + $(CurrentVersion) + $(CurrentVersion) + + $(CurrentAssemblyVersion) + + $(CurrentAssemblyFileVersion) + + $(DefineConstants);DOTNETCORE + $(DefineConstants);DOTNETCORE + $(DefineConstants);DOTNETCORE + + https://raw.githubusercontent.com/elastic/elasticsearch-net + Elasticsearch BV + Elasticsearch BV + https://github.com/elastic/elasticsearch-net + https://github.com/elastic/elasticsearch-net/blob/master/license.txt + See https://github.com/elastic/elasticsearch-net/releases + https://raw.githubusercontent.com/elastic/elasticsearch-net/master/build/nuget-icon.png + + \ No newline at end of file diff --git a/src/Nest/Nest.csproj b/src/Nest/Nest.csproj index ebb65fc0252..d65c806c16d 100644 --- a/src/Nest/Nest.csproj +++ b/src/Nest/Nest.csproj @@ -1,6 +1,6 @@  - + netstandard2.0;net461 netstandard2.0 @@ -11,5 +11,4 @@ - \ No newline at end of file diff --git a/build/Clients.Common.targets b/src/PublishArtifacts.build.props similarity index 78% rename from build/Clients.Common.targets rename to src/PublishArtifacts.build.props index 1c89339618a..6760a486440 100644 --- a/build/Clients.Common.targets +++ b/src/PublishArtifacts.build.props @@ -1,9 +1,14 @@ + + + true - $(MSBuildThisFileDirectory)\keys\keypair.snk + $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), build.bat))\build\keys\keypair.snk true 1591,1572,1571,1573,1587,1570 false @@ -12,21 +17,19 @@ $(BaseIntermediateOutputPath)\sl-$(MsBuildProjectName)-$(TargetFramework).json - true - $(DefineConstants);FEATURE_HTTPWEBREQUEST - + - + - + - + - + diff --git a/src/Serializers/Nest.JsonNetSerializer/Nest.JsonNetSerializer.csproj b/src/Serializers/Nest.JsonNetSerializer/Nest.JsonNetSerializer.csproj index d710831d99c..15cc67e0c12 100644 --- a/src/Serializers/Nest.JsonNetSerializer/Nest.JsonNetSerializer.csproj +++ b/src/Serializers/Nest.JsonNetSerializer/Nest.JsonNetSerializer.csproj @@ -1,6 +1,6 @@  - + netstandard2.0;net461 netstandard2.0 @@ -11,5 +11,4 @@ - \ No newline at end of file diff --git a/src/Tests/Directory.build.props b/src/Tests/Directory.build.props index 570da452c6a..1e1bf445ede 100644 --- a/src/Tests/Directory.build.props +++ b/src/Tests/Directory.build.props @@ -2,6 +2,5 @@ ../../../build/output/_packages;https://api.nuget.org/v3/index.json - $(DefineConstants);TESTINGNUGETPACKAGE \ No newline at end of file diff --git a/src/Tests/Tests.Benchmarking/Tests.Benchmarking.csproj b/src/Tests/Tests.Benchmarking/Tests.Benchmarking.csproj index 31cba11504f..edd65a5e378 100644 --- a/src/Tests/Tests.Benchmarking/Tests.Benchmarking.csproj +++ b/src/Tests/Tests.Benchmarking/Tests.Benchmarking.csproj @@ -1,4 +1,5 @@  + netcoreapp2.1;net461 Exe @@ -11,5 +12,4 @@ - \ No newline at end of file diff --git a/src/Tests/Tests.ClusterLauncher/Tests.ClusterLauncher.csproj b/src/Tests/Tests.ClusterLauncher/Tests.ClusterLauncher.csproj index 1ad4d5e905a..0d93a64973b 100644 --- a/src/Tests/Tests.ClusterLauncher/Tests.ClusterLauncher.csproj +++ b/src/Tests/Tests.ClusterLauncher/Tests.ClusterLauncher.csproj @@ -1,4 +1,5 @@  + Exe netcoreapp2.1 @@ -6,5 +7,4 @@ - \ No newline at end of file diff --git a/src/Tests/Tests.Configuration/EnvironmentConfiguration.cs b/src/Tests/Tests.Configuration/EnvironmentConfiguration.cs index d5b5b368b3f..4da72fae3b4 100644 --- a/src/Tests/Tests.Configuration/EnvironmentConfiguration.cs +++ b/src/Tests/Tests.Configuration/EnvironmentConfiguration.cs @@ -34,7 +34,6 @@ public EnvironmentConfiguration() { SourceSerializer = RandomBoolConfig("SOURCESERIALIZER", randomizer), TypedKeys = RandomBoolConfig("TYPEDKEYS", randomizer), - OldConnection = RandomBoolConfig("OLDCONNECTION", randomizer), }; } diff --git a/src/Tests/Tests.Configuration/ITestConfiguration.cs b/src/Tests/Tests.Configuration/ITestConfiguration.cs index 5f7bc18795f..c33f826cdcc 100644 --- a/src/Tests/Tests.Configuration/ITestConfiguration.cs +++ b/src/Tests/Tests.Configuration/ITestConfiguration.cs @@ -22,7 +22,5 @@ public class RandomConfiguration { public bool SourceSerializer { get; set; } public bool TypedKeys { get; set; } - public bool OldConnection { get; set; } } - } diff --git a/src/Tests/Tests.Configuration/Tests.Configuration.csproj b/src/Tests/Tests.Configuration/Tests.Configuration.csproj index 17d3b29f8ff..928922db11f 100644 --- a/src/Tests/Tests.Configuration/Tests.Configuration.csproj +++ b/src/Tests/Tests.Configuration/Tests.Configuration.csproj @@ -1,4 +1,5 @@  + netstandard2.0 diff --git a/src/Tests/Tests.Configuration/YamlConfiguration.cs b/src/Tests/Tests.Configuration/YamlConfiguration.cs index c41ad107dea..46c9fa7be04 100644 --- a/src/Tests/Tests.Configuration/YamlConfiguration.cs +++ b/src/Tests/Tests.Configuration/YamlConfiguration.cs @@ -41,7 +41,6 @@ public YamlConfiguration(string configurationFile) { SourceSerializer = this.RandomBool("source_serializer", randomizer), TypedKeys = this.RandomBool("typed_keys", randomizer), - OldConnection = this.RandomBool("old_connection", randomizer) }; } diff --git a/src/Tests/Tests.Core/Client/Settings/TestConnectionSettings.cs b/src/Tests/Tests.Core/Client/Settings/TestConnectionSettings.cs index e8a57007651..7b273d33e39 100644 --- a/src/Tests/Tests.Core/Client/Settings/TestConnectionSettings.cs +++ b/src/Tests/Tests.Core/Client/Settings/TestConnectionSettings.cs @@ -38,7 +38,6 @@ public TestConnectionSettings( : ConnectionConfiguration.DefaultConnectionLimit; internal ConnectionSettings ApplyTestSettings() => this - .ApplyFiddlerProxyWhenNeeded() //TODO make this random //.EnableHttpCompression() #if DEBUG @@ -54,13 +53,6 @@ internal ConnectionSettings ApplyTestSettings() => this foreach (var d in r.DeprecationWarnings) XunitRunState.SeenDeprecations.Add(d); }); - private ConnectionSettings ApplyFiddlerProxyWhenNeeded() - { - if (!TestConfiguration.Instance.Random.OldConnection) return this; - if (!RunningFiddler) return this; - return this.Proxy(new Uri("http://localhost:8888"), null, null); - } - private static SourceSerializerFactory CreateSerializerFactory(SourceSerializerFactory provided) { if (provided != null) return provided; diff --git a/src/Tests/Tests.Core/Extensions/TestConfigurationExtensions.cs b/src/Tests/Tests.Core/Extensions/TestConfigurationExtensions.cs index 6d73843f729..9bddf2cfa2d 100644 --- a/src/Tests/Tests.Core/Extensions/TestConfigurationExtensions.cs +++ b/src/Tests/Tests.Core/Extensions/TestConfigurationExtensions.cs @@ -8,7 +8,7 @@ public static class TestConfigurationExtensions { //on this branch HttpConnection is either webrequest or httpclient based depending on the TFM private static IConnection CreateLiveConnection(this ITestConfiguration configuration) => - configuration.Random.OldConnection ? (IConnection) new HttpWebRequestConnection() : new HttpConnection(); + new HttpConnection(); public static IConnection CreateConnection(this ITestConfiguration configuration, bool forceInMemory = false) => configuration.RunIntegrationTests && !forceInMemory ? configuration.CreateLiveConnection() : new InMemoryConnection(); diff --git a/src/Tests/Tests.Core/Tests.Core.csproj b/src/Tests/Tests.Core/Tests.Core.csproj index 001075ad94b..50aa941ee60 100644 --- a/src/Tests/Tests.Core/Tests.Core.csproj +++ b/src/Tests/Tests.Core/Tests.Core.csproj @@ -1,4 +1,5 @@  + netstandard2.0 diff --git a/src/Tests/Tests.Core/Xunit/NestXunitRunOptions.cs b/src/Tests/Tests.Core/Xunit/NestXunitRunOptions.cs index a77088ecd0d..ea8f604bef6 100644 --- a/src/Tests/Tests.Core/Xunit/NestXunitRunOptions.cs +++ b/src/Tests/Tests.Core/Xunit/NestXunitRunOptions.cs @@ -48,7 +48,6 @@ private static void DumpConfiguration() Console.WriteLine($" - Random:"); Console.WriteLine($" \t- {nameof(config.Random.SourceSerializer)}: {config.Random.SourceSerializer}"); Console.WriteLine($" \t- {nameof(config.Random.TypedKeys)}: {config.Random.TypedKeys}"); - Console.WriteLine($" \t- {nameof(config.Random.OldConnection)}: {config.Random.OldConnection}"); Console.WriteLine(new string('-', 20)); } @@ -115,9 +114,6 @@ private static string ReproduceCommandLine(ConcurrentBag> AppendExplictConfig(nameof(RandomConfiguration.SourceSerializer), sb); AppendExplictConfig(nameof(RandomConfiguration.TypedKeys), sb); -#if FEATURE_HTTPWEBREQUEST - AppendExplictConfig(nameof(RandomConfiguration.OldConnection), sb); -#endif if (runningIntegrations) sb.Append("integrate ") diff --git a/src/Tests/Tests.Domain/Tests.Domain.csproj b/src/Tests/Tests.Domain/Tests.Domain.csproj index 7dcaccbdb14..2fd21b9925a 100644 --- a/src/Tests/Tests.Domain/Tests.Domain.csproj +++ b/src/Tests/Tests.Domain/Tests.Domain.csproj @@ -1,4 +1,5 @@  + netstandard2.0 diff --git a/src/Tests/Tests.Profiling/Tests.Profiling.csproj b/src/Tests/Tests.Profiling/Tests.Profiling.csproj index d375711eccf..b5a3a4cc513 100644 --- a/src/Tests/Tests.Profiling/Tests.Profiling.csproj +++ b/src/Tests/Tests.Profiling/Tests.Profiling.csproj @@ -1,4 +1,5 @@  + netcoreapp2.1 Exe @@ -19,5 +20,4 @@ - \ No newline at end of file diff --git a/src/Tests/Tests.Reproduce/Tests.Reproduce.csproj b/src/Tests/Tests.Reproduce/Tests.Reproduce.csproj index 85b2328935d..ab7edd57e59 100644 --- a/src/Tests/Tests.Reproduce/Tests.Reproduce.csproj +++ b/src/Tests/Tests.Reproduce/Tests.Reproduce.csproj @@ -1,4 +1,5 @@  + netcoreapp2.1 diff --git a/src/Tests/Tests.ScratchPad/Tests.ScratchPad.csproj b/src/Tests/Tests.ScratchPad/Tests.ScratchPad.csproj index db556c4bd2b..636587a5103 100644 --- a/src/Tests/Tests.ScratchPad/Tests.ScratchPad.csproj +++ b/src/Tests/Tests.ScratchPad/Tests.ScratchPad.csproj @@ -1,4 +1,5 @@  + Exe netcoreapp2.1 @@ -10,5 +11,4 @@ - \ No newline at end of file diff --git a/src/Tests/Tests/ClientConcepts/Certificates/WorkingWithCertificates.doc.cs b/src/Tests/Tests/ClientConcepts/Certificates/WorkingWithCertificates.doc.cs index 3b7b59cc030..858a60951a7 100644 --- a/src/Tests/Tests/ClientConcepts/Certificates/WorkingWithCertificates.doc.cs +++ b/src/Tests/Tests/ClientConcepts/Certificates/WorkingWithCertificates.doc.cs @@ -34,11 +34,8 @@ public class WorkingWithCertificates * by setting */ #if !DOTNETCORE - public void ServerValidationCallback() - { - ServicePointManager.ServerCertificateValidationCallback += - (sender, cert, chain, errors) => true; - } + public void ServerValidationCallback() => ServicePointManager.ServerCertificateValidationCallback += + (sender, cert, chain, errors) => true; #endif /** * validation will not be performed for HTTPS connections to *both* Elasticsearch *and* that external web service. @@ -175,7 +172,7 @@ protected override ConnectionSettings ConnectionSettings(ConnectionSettings s) = * the local CA certificate is part of the chain that was used to generate the servers key. */ -#if FEATURE_HTTPWEBREQUEST +#if !DOTNETCORE /** * ==== Client Certificates * @@ -207,7 +204,7 @@ public PkiCluster() : base(new SslAndKpiClusterConfiguration protected override ConnectionSettings Authenticate(ConnectionSettings s) => s // <1> Set the client certificate on `ConnectionSettings` .ClientCertificate( - ClientCertificate.LoadWithPrivateKey( + Elasticsearch.Net.ClientCertificate.LoadWithPrivateKey( this.ClusterConfiguration.FileSystem.ClientCertificate, // <2> The path to the `.cer` file this.ClusterConfiguration.FileSystem.ClientPrivateKey, // <3> The path to the `.key` file "") // <4> The password for the private key @@ -229,7 +226,7 @@ protected override ConnectionSettings Authenticate(ConnectionSettings s) => s // #endif } -#if FEATURE_HTTPWEBREQUEST +#if !DOTNETCORE /** * Or per request on `RequestConfiguration` which will take precedence over the ones defined on `ConnectionConfiguration` */ diff --git a/src/Tests/Tests/ClientConcepts/Connection/HttpConnectionTests.cs b/src/Tests/Tests/ClientConcepts/Connection/HttpConnectionTests.cs index 1eb10c7544a..3c11ad0bde9 100644 --- a/src/Tests/Tests/ClientConcepts/Connection/HttpConnectionTests.cs +++ b/src/Tests/Tests/ClientConcepts/Connection/HttpConnectionTests.cs @@ -56,25 +56,17 @@ [I] public async Task SingleInstanceOfHttpClient() connection.ClientCount.Should().Be(1); } - [I] public async Task MultipleInstancesOfHttpClientWhenRequestTimeoutChanges() - { - await MultipleInstancesOfHttpClientWhen(() => CreateRequestData(TimeSpan.FromSeconds(30))); - } + [I] public async Task MultipleInstancesOfHttpClientWhenRequestTimeoutChanges() => + await MultipleInstancesOfHttpClientWhen(() => CreateRequestData(TimeSpan.FromSeconds(30))); - [I] public async Task MultipleInstancesOfHttpClientWhenProxyChanges() - { + [I] public async Task MultipleInstancesOfHttpClientWhenProxyChanges() => await MultipleInstancesOfHttpClientWhen(() => CreateRequestData(proxyAddress: new Uri("http://localhost:9400"))); - } - [I] public async Task MultipleInstancesOfHttpClientWhenAutomaticProxyDetectionChanges() - { + [I] public async Task MultipleInstancesOfHttpClientWhenAutomaticProxyDetectionChanges() => await MultipleInstancesOfHttpClientWhen(() => CreateRequestData(disableAutomaticProxyDetection: true)); - } - [I] public async Task MultipleInstancesOfHttpClientWhenHttpCompressionChanges() - { + [I] public async Task MultipleInstancesOfHttpClientWhenHttpCompressionChanges() => await MultipleInstancesOfHttpClientWhen(() => CreateRequestData(httpCompression: true)); - } private static async Task MultipleInstancesOfHttpClientWhen(Func differentRequestData) { diff --git a/src/Tests/Tests/ClientConcepts/Connection/ModifyingDefaultConnection.doc.cs b/src/Tests/Tests/ClientConcepts/Connection/ModifyingDefaultConnection.doc.cs index 1d21eeecc28..36341d6f580 100644 --- a/src/Tests/Tests/ClientConcepts/Connection/ModifyingDefaultConnection.doc.cs +++ b/src/Tests/Tests/ClientConcepts/Connection/ModifyingDefaultConnection.doc.cs @@ -123,7 +123,7 @@ public void InMemoryConnectionOverloadedCtor() * If you are running on the Desktop CLR you can override specific properties for the current `ServicePoint` easily * by overriding `AlterServicePoint` on an `IConnection` implementation deriving from `HttpConnection` */ -#if FEATURE_HTTPWEBREQUEST +#if !DOTNETCORE public class MyCustomHttpConnection : HttpConnection { protected override void AlterServicePoint(ServicePoint requestServicePoint, RequestData requestData) diff --git a/src/Tests/Tests/Tests.csproj b/src/Tests/Tests/Tests.csproj index 9c8ea43f139..9ac9a316943 100644 --- a/src/Tests/Tests/Tests.csproj +++ b/src/Tests/Tests/Tests.csproj @@ -1,7 +1,8 @@  + - netcoreapp2.1 + netcoreapp2.1;net461 6.0.0 alpha $(NoWarn);xUnit1013 @@ -25,5 +26,4 @@ - \ No newline at end of file diff --git a/src/outputpath.props b/src/outputpath.props deleted file mode 100644 index 04e4b70743e..00000000000 --- a/src/outputpath.props +++ /dev/null @@ -1,6 +0,0 @@ - - - - $(OutputPathBaseDir)\$(MSBuildProjectName)\ - - \ No newline at end of file