test(v3): migrate OpcUaServer.Tests + Host.IntegrationTests to v3 dark address space
Migrate the server composer/applier + 2-node harness tests off the retired
Namespace/NamespaceKind + equipment→driver/device binding schema onto the v3
greenfield shape (raw-only Tag; DriverInstance-RawFolderId; equipment via UnsLine).
OpcUaServer.Tests (134 build errors -> green, 335 pass / 4 skip):
- LIVE (migrated, passing): VirtualTag-historize + ScriptedAlarm composition,
composer purity/hierarchy, applier MaterialiseHierarchy + MaterialiseEquipmentTags
idempotency (hand-fed applier, not dark).
- SKIP dark-until-Batch-4: {{equip}} token expansion, applier equipment-namespace
E2E (equipment-tag variable materialization).
- RETIRE-with-comment / skip: alias-tag (Tag.EquipmentId binding gone) + device-host
equipment binding (architecturally removed).
- Add local DarkAddressSpaceReasons Skip-reason constants (mirrors Runtime.Tests).
Host.IntegrationTests (green, in-memory): drop deleted-Namespace seeds from
MultiClusterScoping + DriverReconnect; reshape EquipmentNamespaceMaterialization to
assert the DARK contract (folder nodes decode, EquipmentTags empty despite a seeded
v3 raw tag) with the full raw-tag->EquipmentTag materialization kept as a
Batch-4-pending Skip.
Tests-only; no src/ changes.
This commit is contained in:
+14
-34
@@ -1,7 +1,6 @@
|
||||
using Shouldly;
|
||||
using Xunit;
|
||||
using ZB.MOM.WW.OtOpcUa.Configuration.Entities;
|
||||
using ZB.MOM.WW.OtOpcUa.Configuration.Enums;
|
||||
|
||||
namespace ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests;
|
||||
|
||||
@@ -10,6 +9,13 @@ namespace ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests;
|
||||
/// reserved <c>{{equip}}</c> token in a shared VirtualTag script with each owning equipment's
|
||||
/// derived tag base (from its child-tag <c>FullName</c>s) — so one script reused across N
|
||||
/// identical machines resolves to N machine-specific dependency graphs.
|
||||
///
|
||||
/// <para><b>v3 Batch-1 DARK:</b> the per-equipment tag base is DERIVED from equipment-tag
|
||||
/// <c>FullName</c>s, and equipment-tag variable plans do not materialize until Batch 4 (the composer
|
||||
/// no longer takes tags — <c>baseByEquip</c> is empty this batch). With no base to substitute, the
|
||||
/// <c>{{equip}}</c> token stays literal and these per-machine assertions have nothing to compare, so
|
||||
/// the test is Skipped-with-reason. The seed + assertions are preserved verbatim (minus the retired
|
||||
/// entity columns) so re-enabling in Batch 4 is a one-line change once the fan-out feeds the base.</para>
|
||||
/// </summary>
|
||||
public sealed class AddressSpaceComposerEquipTokenTests
|
||||
{
|
||||
@@ -17,21 +23,17 @@ public sealed class AddressSpaceComposerEquipTokenTests
|
||||
/// to two equipments (TestMachine_001 / _002) each with one equipment Tag whose FullName carries
|
||||
/// the per-machine base. Compose must expand the token per equipment in both the Expression and
|
||||
/// the parsed DependencyRefs.</summary>
|
||||
[Fact]
|
||||
[Fact(Skip = DarkAddressSpaceReasons.EquipmentTagsDarkBatch4)]
|
||||
public void Compose_substitutes_equip_token_per_equipment()
|
||||
{
|
||||
var ns = new Namespace
|
||||
{
|
||||
NamespaceId = "ns-eq",
|
||||
ClusterId = "c1",
|
||||
Kind = NamespaceKind.Equipment,
|
||||
NamespaceUri = "urn:eq",
|
||||
};
|
||||
// v3: no Namespace entity; DriverInstance no longer binds a Namespace; Equipment no longer
|
||||
// binds a driver. In Batch 4 the {{equip}} base derives from the equipment's child-tag
|
||||
// FullNames — here TestMachine_001.Source / TestMachine_002.Source — which flow through the
|
||||
// (dark this batch) equipment-tag plan set. Seeded for intent; not passed to Compose.
|
||||
var driver1 = new DriverInstance
|
||||
{
|
||||
DriverInstanceId = "drv-1",
|
||||
ClusterId = "c1",
|
||||
NamespaceId = "ns-eq",
|
||||
Name = "Modbus1",
|
||||
DriverType = "Modbus",
|
||||
DriverConfig = "{}",
|
||||
@@ -40,35 +42,14 @@ public sealed class AddressSpaceComposerEquipTokenTests
|
||||
{
|
||||
DriverInstanceId = "drv-2",
|
||||
ClusterId = "c1",
|
||||
NamespaceId = "ns-eq",
|
||||
Name = "Modbus2",
|
||||
DriverType = "Modbus",
|
||||
DriverConfig = "{}",
|
||||
};
|
||||
var area = new UnsArea { UnsAreaId = "area-1", ClusterId = "c1", Name = "filling" };
|
||||
var line = new UnsLine { UnsLineId = "line-1", UnsAreaId = "area-1", Name = "line-1" };
|
||||
var equip1 = new Equipment { EquipmentId = "eq-1", DriverInstanceId = "drv-1", UnsLineId = "line-1", Name = "TestMachine_001", MachineCode = "TESTMACHINE_001" };
|
||||
var equip2 = new Equipment { EquipmentId = "eq-2", DriverInstanceId = "drv-2", UnsLineId = "line-1", Name = "TestMachine_002", MachineCode = "TESTMACHINE_002" };
|
||||
var tag1 = new Tag
|
||||
{
|
||||
TagId = "tag-1",
|
||||
DriverInstanceId = "drv-1",
|
||||
EquipmentId = "eq-1",
|
||||
Name = "Source",
|
||||
DataType = "Int32",
|
||||
AccessLevel = TagAccessLevel.Read,
|
||||
TagConfig = "{\"FullName\":\"TestMachine_001.Source\",\"DataType\":\"Int32\"}",
|
||||
};
|
||||
var tag2 = new Tag
|
||||
{
|
||||
TagId = "tag-2",
|
||||
DriverInstanceId = "drv-2",
|
||||
EquipmentId = "eq-2",
|
||||
Name = "Source",
|
||||
DataType = "Int32",
|
||||
AccessLevel = TagAccessLevel.Read,
|
||||
TagConfig = "{\"FullName\":\"TestMachine_002.Source\",\"DataType\":\"Int32\"}",
|
||||
};
|
||||
var equip1 = new Equipment { EquipmentId = "eq-1", UnsLineId = "line-1", Name = "TestMachine_001", MachineCode = "TESTMACHINE_001" };
|
||||
var equip2 = new Equipment { EquipmentId = "eq-2", UnsLineId = "line-1", Name = "TestMachine_002", MachineCode = "TESTMACHINE_002" };
|
||||
var script = new Script
|
||||
{
|
||||
ScriptId = "s-equip",
|
||||
@@ -82,7 +63,6 @@ public sealed class AddressSpaceComposerEquipTokenTests
|
||||
var result = AddressSpaceComposer.Compose(
|
||||
new[] { area }, new[] { line }, new[] { equip1, equip2 },
|
||||
new[] { driver1, driver2 }, Array.Empty<ScriptedAlarm>(),
|
||||
new[] { tag1, tag2 }, new[] { ns },
|
||||
virtualTags: new[] { vt1, vt2 },
|
||||
scripts: new[] { script });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user