From a5412c16a357bb169ad415a1c332d6a2c88f9d73 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Tue, 26 May 2026 11:34:01 -0400 Subject: [PATCH] fix(test): align DualEndpointTests SDK to 1.5.374.126 + sync API --- .../DualEndpointTests.cs | 22 +++++++------------ ...tOpcUa.OpcUaServer.IntegrationTests.csproj | 8 +++++-- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests/DualEndpointTests.cs b/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests/DualEndpointTests.cs index d1652dd..61b0f49 100644 --- a/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests/DualEndpointTests.cs +++ b/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests/DualEndpointTests.cs @@ -3,7 +3,6 @@ using System.Net.Sockets; using Microsoft.Extensions.Logging.Abstractions; using Opc.Ua; using Opc.Ua.Client; -using Opc.Ua.Configuration; using Opc.Ua.Server; using Shouldly; using Xunit; @@ -70,6 +69,9 @@ public sealed class DualEndpointTests private static async Task ReadServerArrayAsync(string endpointUrl) { + // SDK 1.5.374 sync-style session-open path — mirrors src/Client/.../DefaultSessionFactory.cs + // and DefaultApplicationConfigurationFactory.cs. The 1.5.378 telemetry/async overloads are + // not available at this pinned version. var appConfig = new ApplicationConfiguration { ApplicationName = "OtOpcUa.DualEndpointClient", @@ -82,31 +84,23 @@ public sealed class DualEndpointTests }, ClientConfiguration = new ClientConfiguration { DefaultSessionTimeout = 60_000 }, }; - // SDK 1.5.378 deprecates the no-arg ctors of CertificateValidator / DefaultSessionFactory - // and the non-telemetry overloads of SelectEndpointAsync. Inject a no-op telemetry context - // so the integration test (with TreatWarningsAsErrors=true) doesn't trip the CS0618 wall. - var telemetry = DefaultTelemetry.Create(static _ => { }); - await appConfig.ValidateAsync(ApplicationType.Client, CancellationToken.None); + await appConfig.Validate(ApplicationType.Client); appConfig.CertificateValidator.CertificateValidation += (_, e) => e.Accept = true; - var endpoint = await CoreClientUtils.SelectEndpointAsync( - appConfig, endpointUrl, useSecurity: false, discoverTimeout: 15_000, telemetry, - CancellationToken.None); + var endpoint = CoreClientUtils.SelectEndpoint(appConfig, endpointUrl, useSecurity: false); var endpointConfiguration = EndpointConfiguration.Create(appConfig); var configuredEndpoint = new ConfiguredEndpoint(null, endpoint, endpointConfiguration); - var factory = new DefaultSessionFactory(telemetry); - using var session = (ClientSession)await factory.CreateAsync( + using var session = await ClientSession.Create( appConfig, configuredEndpoint, updateBeforeConnect: false, sessionName: "DualEndpointTests", sessionTimeout: 60_000, identity: new UserIdentity(new AnonymousIdentityToken()), - preferredLocales: null, - CancellationToken.None); + preferredLocales: null); - var value = await session.ReadValueAsync(VariableIds.Server_ServerArray, CancellationToken.None); + var value = session.ReadValue(VariableIds.Server_ServerArray); return (string[])value.Value; } diff --git a/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests.csproj b/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests.csproj index 707f8ce..3d51e7a 100644 --- a/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests.csproj +++ b/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests.csproj @@ -11,8 +11,12 @@ - - + + + all