fix(test): align DualEndpointTests SDK to 1.5.374.126 + sync API
This commit is contained in:
@@ -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<string[]> 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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user