test(v3): migrate 6 driver IntegrationTests to RawTags API
Replace pre-declared options.Tags (typed <Driver>TagDefinition lists) with options.RawTags (IReadOnlyList<RawTagEntry>) across all 6 Docker-gated driver integration suites so they COMPILE against the v3 driver API. Each project gets a local <Driver>RawTags helper mirroring the unit-test project's helper: it serialises a typed def back to its TagConfig blob via the driver's <Driver>TagDefinitionFactory.ToTagConfig and packages it as a RawTagEntry (RawPath = def.Name; DeviceName = def.DeviceHostAddress for the multi-device drivers AbCip/AbLegacy/TwinCAT/FOCAS). Test intent (addresses, data types, device routing, assertions) is unchanged — only the tag-authoring/config-delivery shape was migrated. Docker-gated: these still skip at runtime without fixtures; COMPILE is the gate.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using ZB.MOM.WW.OtOpcUa.Core.Abstractions;
|
||||
|
||||
namespace ZB.MOM.WW.OtOpcUa.Driver.AbCip.IntegrationTests;
|
||||
|
||||
/// <summary>
|
||||
/// Test helper bridging the pre-v3 pre-declared-tag authoring style (a typed
|
||||
/// <see cref="AbCipTagDefinition"/>) to the v3 RawPath seam the driver now consumes
|
||||
/// (<see cref="RawTagEntry"/>). Each typed def is serialised to its <c>TagConfig</c> blob via
|
||||
/// <see cref="AbCipTagDefinitionFactory.ToTagConfig"/>, and the def's identity (<c>Name</c> → RawPath),
|
||||
/// device routing key (<c>DeviceHostAddress</c> → <see cref="RawTagEntry.DeviceName"/>) and
|
||||
/// write-idempotence travel on the entry — exactly the shape the deploy artifact delivers. Lets the
|
||||
/// driver's integration smoke tests keep expressing fixtures as typed definitions while exercising the
|
||||
/// v3 <c>RawTags</c> → <c>FromTagConfig</c> table-build path. Mirrors the unit-test project's helper of
|
||||
/// the same name.
|
||||
/// </summary>
|
||||
internal static class AbCipRawTags
|
||||
{
|
||||
/// <summary>Projects typed definitions to the driver's <c>RawTags</c> option shape.</summary>
|
||||
/// <param name="defs">The typed definitions to project.</param>
|
||||
/// <returns>The equivalent <see cref="RawTagEntry"/> list.</returns>
|
||||
public static IReadOnlyList<RawTagEntry> From(params AbCipTagDefinition[] defs) =>
|
||||
[.. defs.Select(d => new RawTagEntry(
|
||||
RawPath: d.Name,
|
||||
TagConfig: AbCipTagDefinitionFactory.ToTagConfig(d),
|
||||
WriteIdempotent: d.WriteIdempotent,
|
||||
DeviceName: d.DeviceHostAddress))];
|
||||
}
|
||||
+1
-1
@@ -37,7 +37,7 @@ public sealed class AbCipReadSmokeTests
|
||||
var drv = new AbCipDriver(new AbCipDriverOptions
|
||||
{
|
||||
Devices = [new AbCipDeviceOptions(deviceUri, profile.Family)],
|
||||
Tags = [new AbCipTagDefinition("Counter", deviceUri, "TestDINT", AbCipDataType.DInt)],
|
||||
RawTags = AbCipRawTags.From(new AbCipTagDefinition("Counter", deviceUri, "TestDINT", AbCipDataType.DInt)),
|
||||
Timeout = TimeSpan.FromSeconds(5),
|
||||
}, $"drv-smoke-{profile.Family}");
|
||||
|
||||
|
||||
+2
-3
@@ -54,7 +54,7 @@ public sealed class AbCipEmulateAlmdTests
|
||||
Devices = [new AbCipDeviceOptions($"ab://{endpoint}/1,0")],
|
||||
EnableAlarmProjection = true,
|
||||
AlarmPollInterval = TimeSpan.FromMilliseconds(200),
|
||||
Tags = [
|
||||
RawTags = AbCipRawTags.From(
|
||||
new AbCipTagDefinition(
|
||||
Name: "HighTempAlarm",
|
||||
DeviceHostAddress: $"ab://{endpoint}/1,0",
|
||||
@@ -72,8 +72,7 @@ public sealed class AbCipEmulateAlmdTests
|
||||
DeviceHostAddress: $"ab://{endpoint}/1,0",
|
||||
TagPath: "SimulateAlarm",
|
||||
DataType: AbCipDataType.Bool,
|
||||
Writable: true),
|
||||
],
|
||||
Writable: true)),
|
||||
};
|
||||
|
||||
await using var drv = new AbCipDriver(options, driverInstanceId: "emulate-almd");
|
||||
|
||||
+2
-3
@@ -51,7 +51,7 @@ public sealed class AbCipEmulateUdtReadTests
|
||||
var options = new AbCipDriverOptions
|
||||
{
|
||||
Devices = [new AbCipDeviceOptions($"ab://{endpoint}/1,0")],
|
||||
Tags = [
|
||||
RawTags = AbCipRawTags.From(
|
||||
new AbCipTagDefinition(
|
||||
Name: "Motor1",
|
||||
DeviceHostAddress: $"ab://{endpoint}/1,0",
|
||||
@@ -61,8 +61,7 @@ public sealed class AbCipEmulateUdtReadTests
|
||||
new AbCipStructureMember("Speed", AbCipDataType.DInt),
|
||||
new AbCipStructureMember("Torque", AbCipDataType.Real),
|
||||
new AbCipStructureMember("Status", AbCipDataType.DInt),
|
||||
]),
|
||||
],
|
||||
])),
|
||||
Timeout = TimeSpan.FromSeconds(5),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user