Skip to content

Commit 34d6e3d

Browse files
authored
Update dependencies and configurations (#66)
* Update dependencies and configurations Upgraded several package references and configurations across multiple projects to ensure compatibility and performance. Replaced deprecated syntax, optimized namespaces, and enhanced directory structures for better maintainability. * Simplify EphemeralCluster configuration Removed unnecessary commented-out configuration options for clarity. The change ensures the code is more readable and maintainable by using a clean, straightforward cluster configuration.
1 parent a83d4f4 commit 34d6e3d

File tree

18 files changed

+47
-53
lines changed

18 files changed

+47
-53
lines changed

build/scripts/CommandLine.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ with
2727
interface IArgParserTemplate with
2828
member this.Usage =
2929
match this with
30-
| Clean _ -> "clean known output locations"
31-
| Build _ -> "Run build and tests"
32-
| Release _ -> "runs build, and create an validates the packages shy of publishing them"
33-
| Publish _ -> "Runs the full release"
30+
| Clean -> "clean known output locations"
31+
| Build -> "Run build and tests"
32+
| Release -> "runs build, and create an validates the packages shy of publishing them"
33+
| Publish -> "Runs the full release"
3434

3535
| SingleTarget _ -> "Runs the provided sub command without running their dependencies"
3636
| Token _ -> "Token to be used to authenticate with github"

examples/Elastic.Ephemeral.Example/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
using HttpMethod = Elastic.Transport.HttpMethod;
1212

1313

14-
var config = new EphemeralClusterConfiguration("8.7.0", XPack | Security | SSL);
14+
var config = new EphemeralClusterConfiguration("8.15.0");
1515
using var cluster = new EphemeralCluster(config);
1616

1717
var exitEvent = new ManualResetEvent(false);

examples/Elastic.Managed.Example/Program.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,26 @@
33
// See the LICENSE file in the project root for more information
44

55
using System;
6+
using System.IO;
67
using Elastic.Elasticsearch.Managed;
78
using Elastic.Elasticsearch.Managed.Configuration;
89
using Elastic.Elasticsearch.Managed.ConsoleWriters;
10+
using Elastic.Stack.ArtifactsApi;
11+
using Elastic.Stack.ArtifactsApi.Products;
912

1013
namespace Elastic.Managed.Example
1114
{
1215
public static class Program
1316
{
1417
public static void Main(string[] args)
1518
{
16-
var version = "6.3.0";
17-
var esHome =
18-
Environment.ExpandEnvironmentVariables(
19-
$@"%LOCALAPPDATA%\ElasticManaged\{version}\elasticsearch-{version}");
19+
ElasticVersion version = "latest-8";
20+
var folderName = version.Artifact(Product.Elasticsearch).LocalFolderName;
2021

21-
var clusterConfiguration = new ClusterConfiguration(version, esHome, 2);
22+
var temp = Path.Combine(Path.GetTempPath(), "elastic", folderName, "my-cluster");
23+
var home = Path.Combine(temp, "home");
24+
25+
var clusterConfiguration = new ClusterConfiguration(version, home, 2);
2226
using (var cluster = new ElasticsearchCluster(clusterConfiguration))
2327
cluster.Start(new ConsoleLineWriter(), TimeSpan.FromMinutes(2));
2428

examples/Elastic.Xunit.ExampleComplex/Clusters.cs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ namespace Elastic.Xunit.ExampleComplex
1212
{
1313
internal static class EphemeralClusterExtensions
1414
{
15-
private static readonly ConcurrentDictionary<IEphemeralCluster, IElasticClient> Clients =
16-
new ConcurrentDictionary<IEphemeralCluster, IElasticClient>();
15+
private static readonly ConcurrentDictionary<IEphemeralCluster, IElasticClient> Clients = new();
1716

1817
public static IElasticClient GetOrAddClient(this IEphemeralCluster cluster) =>
19-
Clients.GetOrAdd(cluster, (c) =>
18+
Clients.GetOrAdd(cluster, c =>
2019
{
2120
var connectionPool = new StaticConnectionPool(c.NodesUris());
2221
var settings = new ConnectionSettings(connectionPool);
@@ -30,15 +29,11 @@ public interface IMyCluster
3029
IElasticClient Client { get; }
3130
}
3231

33-
public abstract class MyClusterBase : XunitClusterBase, IMyCluster
32+
public abstract class MyClusterBase() : XunitClusterBase(new XunitClusterConfiguration(MyRunOptions.TestVersion)
33+
{
34+
ShowElasticsearchOutputAfterStarted = false,
35+
}), IMyCluster
3436
{
35-
protected MyClusterBase() : base(new XunitClusterConfiguration(MyRunOptions.TestVersion)
36-
{
37-
ShowElasticsearchOutputAfterStarted = false,
38-
})
39-
{
40-
}
41-
4237
public IElasticClient Client => this.GetOrAddClient();
4338
}
4439

examples/Elastic.Xunit.ExampleComplex/Elastic.Xunit.ExampleComplex.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
</PropertyGroup>
66
<ItemGroup>
77
<ProjectReference Include="..\..\src\Elastic.Elasticsearch.Ephemeral\Elastic.Elasticsearch.Ephemeral.csproj" />
8-
<PackageReference Include="xunit" Version="2.4.1" />
9-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
8+
<PackageReference Include="xunit" Version="2.9.2" />
9+
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
1010
<PrivateAssets>all</PrivateAssets>
1111
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1212
</PackageReference>

examples/Elastic.Xunit.ExampleComplex/Tests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
33
// See the LICENSE file in the project root for more information
44

5-
using Elastic.Elasticsearch.Managed;
65
using Elastic.Elasticsearch.Xunit.XunitPlumbing;
76
using Elasticsearch.Net;
87
using FluentAssertions;
9-
using Xunit;
108

119
namespace Elastic.Xunit.ExampleComplex
1210
{

examples/Elastic.Xunit.ExampleMinimal/Elastic.Xunit.ExampleMinimal.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<IsPackable>False</IsPackable>
55
</PropertyGroup>
66
<ItemGroup>
7-
<PackageReference Include="xunit" Version="2.4.1" />
8-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
7+
<PackageReference Include="xunit" Version="2.9.2" />
8+
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
99
<PrivateAssets>all</PrivateAssets>
1010
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1111
</PackageReference>

examples/Elastic.Xunit.ExampleMinimal/ExampleTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class MyTestCluster : XunitClusterBase
2121
/// We pass our configuration instance to the base class.
2222
/// We only configure it to run version 6.2.3 here but lots of additional options are available.
2323
/// </summary>
24-
public MyTestCluster() : base(new XunitClusterConfiguration("latest-8") { })
24+
public MyTestCluster() : base(new XunitClusterConfiguration("latest-8"))
2525
{
2626
}
2727
}

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "6.0.302",
3+
"version": "8.0.100",
44
"rollForward": "latestFeature",
55
"allowPrerelease": false
66
}

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@
3333

3434
<ItemGroup>
3535
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
36-
<PackageReference Include="ConfigureAwaitChecker.Analyzer" Version="4.0.0" PrivateAssets="All" />
36+
<PackageReference Include="ConfigureAwaitChecker.Analyzer" Version="5.0.0.1" PrivateAssets="All" />
3737
</ItemGroup>
3838
</Project>

src/Elastic.Elasticsearch.Ephemeral/Elastic.Elasticsearch.Ephemeral.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@
77
</PropertyGroup>
88
<ItemGroup>
99
<PackageReference Include="SharpZipLib.NETStandard" Version="1.0.7" />
10-
<PackageReference Condition="'$(TargetFramework)' == 'net461'" Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
1110
</ItemGroup>
1211
<ItemGroup>
1312
<ProjectReference Include="..\Elastic.Elasticsearch.Managed\Elastic.Elasticsearch.Managed.csproj" />
1413
</ItemGroup>
14+
15+
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
16+
<Reference Include="System.Net.Http" />
17+
</ItemGroup>
1518
</Project>

src/Elastic.Elasticsearch.Managed/ClusterBase.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,8 @@ public interface ICluster<out TConfiguration> : ICluster,IDisposable
5353
}
5454

5555

56-
public abstract class ClusterBase : ClusterBase<ClusterConfiguration>
57-
{
58-
protected ClusterBase(ClusterConfiguration clusterConfiguration) : base(clusterConfiguration)
59-
{
60-
}
61-
}
56+
public abstract class ClusterBase(ClusterConfiguration clusterConfiguration)
57+
: ClusterBase<ClusterConfiguration>(clusterConfiguration);
6258

6359
public abstract class ClusterBase<TConfiguration> : ICluster<TConfiguration>
6460
where TConfiguration : IClusterConfiguration<NodeFileSystem>

src/Elastic.Elasticsearch.Managed/Elastic.Elasticsearch.Managed.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
</PropertyGroup>
1111
<ItemGroup>
1212
<PackageReference Include="Proc" Version="0.6.1" />
13-
<!--<ProjectReference Include="..\..\..\..\proc\src\Proc\Proc.csproj" />-->
14-
<PackageReference Include="System.Net.Http" Version="4.3.1" />
1513
</ItemGroup>
1614
<ItemGroup>
1715
<ProjectReference Include="..\Elastic.Stack.ArtifactsApi\Elastic.Stack.ArtifactsApi.csproj" />

src/Elastic.Elasticsearch.Managed/ElasticsearchCluster.cs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@
44

55
using Elastic.Elasticsearch.Managed.Configuration;
66

7-
namespace Elastic.Elasticsearch.Managed
8-
{
9-
public class ElasticsearchCluster : ClusterBase
10-
{
11-
public ElasticsearchCluster(ClusterConfiguration clusterConfiguration) : base(clusterConfiguration)
12-
{
13-
}
14-
}
15-
}
7+
namespace Elastic.Elasticsearch.Managed;
8+
9+
public class ElasticsearchCluster(ClusterConfiguration clusterConfiguration)
10+
: ClusterBase(clusterConfiguration);

src/Elastic.Elasticsearch.Xunit/Elastic.Elasticsearch.Xunit.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99
<ItemGroup>
1010
<PackageReference Include="Nullean.Xunit.Partitions" Version="0.5.0" />
11-
<PackageReference Include="xunit" Version="2.4.1" />
11+
<PackageReference Include="xunit" Version="2.9.2" />
1212
</ItemGroup>
1313
<ItemGroup>
1414
<ProjectReference Include="..\Elastic.Elasticsearch.Ephemeral\Elastic.Elasticsearch.Ephemeral.csproj" />

src/Elastic.Stack.ArtifactsApi/Elastic.Stack.ArtifactsApi.csproj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77

88
<ItemGroup>
99
<PackageReference Include="SemanticVersioning" Version="1.3.0" />
10-
<PackageReference Include="System.Text.Json" Version="4.6.0" />
10+
<PackageReference Include="System.Text.Json" Version="8.0.5" />
11+
</ItemGroup>
12+
13+
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
14+
<Reference Include="System.Net.Http" />
15+
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
1116
</ItemGroup>
1217

1318
</Project>

src/Elastic.Stack.ArtifactsApi/Resolvers/SnapshotApiResolver.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ namespace Elastic.Stack.ArtifactsApi.Resolvers
1818
{
1919
public static class SnapshotApiResolver
2020
{
21-
public static readonly System.Lazy<IReadOnlyCollection<Version>> AvailableVersions =
22-
new System.Lazy<IReadOnlyCollection<Version>>(LoadVersions, LazyThreadSafetyMode.ExecutionAndPublication);
21+
public static readonly Lazy<IReadOnlyCollection<Version>> AvailableVersions =
22+
new(LoadVersions, LazyThreadSafetyMode.ExecutionAndPublication);
2323

2424
private static Regex PackageProductRegex { get; } =
2525
new Regex(@"(.*?)-(\d+\.\d+\.\d+(?:-(?:SNAPSHOT|alpha\d+|beta\d+|rc\d+))?)");

src/Nest.TypescriptExporter/Nest.TypescriptExporter.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
<!--<PackageReference Include="TypeLite" Version="1.1.0" />-->
1212
<Reference Include="TypeLite.dll" />
1313
<PackageReference Include="NEST" Version="7.7.1" />
14-
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
14+
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
1515
</ItemGroup>
1616
</Project>

0 commit comments

Comments
 (0)