Renames all 11 projects (5 src + 6 tests), the .slnx solution file, all source-file namespaces, all axaml namespace references, and all v1 documentation references in CLAUDE.md and docs/*.md (excluding docs/v2/ which is already in OtOpcUa form). Also updates the TopShelf service registration name from "LmxOpcUa" to "OtOpcUa" per Phase 0 Task 0.6.
Preserves runtime identifiers per Phase 0 Out-of-Scope rules to avoid breaking v1/v2 client trust during coexistence: OPC UA `ApplicationUri` defaults (`urn:{GalaxyName}:LmxOpcUa`), server `EndpointPath` (`/LmxOpcUa`), `ServerName` default (feeds cert subject CN), `MxAccessConfiguration.ClientName` default (defensive — stays "LmxOpcUa" for MxAccess audit-trail consistency), client OPC UA identifiers (`ApplicationName = "LmxOpcUaClient"`, `ApplicationUri = "urn:localhost:LmxOpcUaClient"`, cert directory `%LocalAppData%\LmxOpcUaClient\pki\`), and the `LmxOpcUaServer` class name (class rename out of Phase 0 scope per Task 0.5 sed pattern; happens in Phase 1 alongside `LmxNodeManager → GenericDriverNodeManager` Core extraction). 23 LmxOpcUa references retained, all enumerated and justified in `docs/v2/implementation/exit-gate-phase-0.md`.
Build clean: 0 errors, 30 warnings (lower than baseline 167). Tests at strict improvement over baseline: 821 passing / 1 failing vs baseline 820 / 2 (one flaky pre-existing failure passed this run; the other still fails — both pre-existing and unrelated to the rename). `Client.UI.Tests`, `Historian.Aveva.Tests`, `Client.Shared.Tests`, `IntegrationTests` all match baseline exactly. Exit gate compliance results recorded in `docs/v2/implementation/exit-gate-phase-0.md` with all 7 checks PASS or DEFERRED-to-PR-review (#7 service install verification needs Windows service permissions on the reviewer's box).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
127 lines
5.6 KiB
C#
127 lines
5.6 KiB
C#
using System.Collections.Generic;
|
|
using Shouldly;
|
|
using Xunit;
|
|
using ZB.MOM.WW.OtOpcUa.Host;
|
|
using ZB.MOM.WW.OtOpcUa.Host.Configuration;
|
|
using ZB.MOM.WW.OtOpcUa.Host.Domain;
|
|
using ZB.MOM.WW.OtOpcUa.Host.OpcUa;
|
|
using ZB.MOM.WW.OtOpcUa.Tests.Helpers;
|
|
|
|
namespace ZB.MOM.WW.OtOpcUa.Tests.EndToEnd
|
|
{
|
|
/// <summary>
|
|
/// THE ULTIMATE SMOKE TEST: Full service with fakes, verifying the complete data flow.
|
|
/// (1) Address space built, (2) MXAccess data change → callback, (3) read → correct tag ref,
|
|
/// (4) write → correct tag+value, (5) dashboard has real data.
|
|
/// </summary>
|
|
public class FullDataFlowTest
|
|
{
|
|
/// <summary>
|
|
/// Confirms that the fake-backed bridge can start, build the address space, and expose coherent status data end to
|
|
/// end.
|
|
/// </summary>
|
|
[Fact]
|
|
public void FullDataFlow_EndToEnd()
|
|
{
|
|
var config = new AppConfiguration
|
|
{
|
|
OpcUa = new OpcUaConfiguration { Port = 14842, GalaxyName = "TestGalaxy", EndpointPath = "/LmxOpcUa" },
|
|
MxAccess = new MxAccessConfiguration
|
|
{ ClientName = "Test", ReadTimeoutSeconds = 2, WriteTimeoutSeconds = 2 },
|
|
GalaxyRepository = new GalaxyRepositoryConfiguration { ChangeDetectionIntervalSeconds = 60 },
|
|
Dashboard = new DashboardConfiguration { Enabled = false }
|
|
};
|
|
|
|
var proxy = new FakeMxProxy();
|
|
var repo = new FakeGalaxyRepository
|
|
{
|
|
Hierarchy = new List<GalaxyObjectInfo>
|
|
{
|
|
new() { GobjectId = 1, TagName = "DEV", BrowseName = "DEV", ParentGobjectId = 0, IsArea = true },
|
|
new()
|
|
{
|
|
GobjectId = 2, TagName = "TestMachine_001", BrowseName = "TestMachine_001", ParentGobjectId = 1,
|
|
IsArea = false
|
|
},
|
|
new()
|
|
{
|
|
GobjectId = 3, TagName = "DelmiaReceiver_001", ContainedName = "DelmiaReceiver",
|
|
BrowseName = "DelmiaReceiver", ParentGobjectId = 2, IsArea = false
|
|
}
|
|
},
|
|
Attributes = new List<GalaxyAttributeInfo>
|
|
{
|
|
new()
|
|
{
|
|
GobjectId = 2, TagName = "TestMachine_001", AttributeName = "MachineID",
|
|
FullTagReference = "TestMachine_001.MachineID", MxDataType = 5, IsArray = false
|
|
},
|
|
new()
|
|
{
|
|
GobjectId = 3, TagName = "DelmiaReceiver_001", AttributeName = "DownloadPath",
|
|
FullTagReference = "DelmiaReceiver_001.DownloadPath", MxDataType = 5, IsArray = false
|
|
},
|
|
new()
|
|
{
|
|
GobjectId = 3, TagName = "DelmiaReceiver_001", AttributeName = "JobStepNumber",
|
|
FullTagReference = "DelmiaReceiver_001.JobStepNumber", MxDataType = 2, IsArray = false
|
|
}
|
|
}
|
|
};
|
|
|
|
var service = new OpcUaService(config, proxy, repo);
|
|
service.Start();
|
|
|
|
try
|
|
{
|
|
// (1) OPC UA server host created
|
|
service.ServerHost.ShouldNotBeNull();
|
|
|
|
// (2) MXAccess connected and proxy registered
|
|
proxy.IsRegistered.ShouldBe(true);
|
|
service.MxClient.ShouldNotBeNull();
|
|
service.MxClient!.State.ShouldBe(ConnectionState.Connected);
|
|
|
|
// (3) Address space model can be built from the same data
|
|
var model = AddressSpaceBuilder.Build(repo.Hierarchy, repo.Attributes);
|
|
model.NodeIdToTagReference.ContainsKey("TestMachine_001.MachineID").ShouldBe(true);
|
|
model.NodeIdToTagReference.ContainsKey("DelmiaReceiver_001.DownloadPath").ShouldBe(true);
|
|
model.NodeIdToTagReference.ContainsKey("DelmiaReceiver_001.JobStepNumber").ShouldBe(true);
|
|
model.VariableCount.ShouldBe(3);
|
|
model.ObjectCount.ShouldBe(2); // TestMachine + DelmiaReceiver (DEV is area)
|
|
|
|
// (4) Tag reference resolves correctly for read/write
|
|
var tagRef = model.NodeIdToTagReference["DelmiaReceiver_001.DownloadPath"];
|
|
tagRef.ShouldBe("DelmiaReceiver_001.DownloadPath");
|
|
|
|
// (5) Galaxy stats have real data
|
|
service.GalaxyStatsInstance.ShouldNotBeNull();
|
|
service.GalaxyStatsInstance!.GalaxyName.ShouldBe("TestGalaxy");
|
|
service.GalaxyStatsInstance.DbConnected.ShouldBe(true);
|
|
service.GalaxyStatsInstance.ObjectCount.ShouldBe(3);
|
|
service.GalaxyStatsInstance.AttributeCount.ShouldBe(3);
|
|
|
|
// (5b) Status report has real data
|
|
service.StatusReportInstance.ShouldNotBeNull();
|
|
var html = service.StatusReportInstance!.GenerateHtml();
|
|
html.ShouldContain("TestGalaxy");
|
|
html.ShouldContain("Connected");
|
|
|
|
var json = service.StatusReportInstance.GenerateJson();
|
|
json.ShouldContain("TestGalaxy");
|
|
|
|
service.StatusReportInstance.IsHealthy().ShouldBe(true);
|
|
|
|
// Verify change detection is wired
|
|
service.ChangeDetectionInstance.ShouldNotBeNull();
|
|
|
|
// Verify metrics created
|
|
service.Metrics.ShouldNotBeNull();
|
|
}
|
|
finally
|
|
{
|
|
service.Stop();
|
|
}
|
|
}
|
|
}
|
|
} |