using Akka.Actor; using Akka.TestKit; using ZB.MOM.WW.OtOpcUa.Runtime.OpcUa; namespace ZB.MOM.WW.OtOpcUa.Runtime.Tests.Harness; /// /// Gitea #601 — since the deploy ack waits for 's /// reply, a bare standing in for the /// publish actor would hold every Applied ack until the outcome timeout (and then ack it degraded). Tests /// that are not ABOUT the ack's honesty use this probe instead: it still records every message exactly /// like a plain probe (the auto-pilot runs in addition to queueing), and answers each /// that asks for an outcome with a CLEAN one — the /// reply the real publish actor gives a clean apply. /// public static class PublishProbes { /// Creates a publish-actor probe that reports a clean address-space outcome for every rebuild /// carrying . /// The calling TestKit. /// The probe. public static TestProbe CreateCleanOutcomePublishProbe(this TestKitBase kit) { var probe = kit.CreateTestProbe(); probe.SetAutoPilot(new DelegateAutoPilot((sender, message) => { if (message is OpcUaPublishActor.RebuildAddressSpace { ReportOutcome: true } rebuild) sender.Tell(new OpcUaPublishActor.RebuildCompleted( rebuild.Correlation, rebuild.DeploymentId, Degraded: false, DegradedReason: null)); return AutoPilot.KeepRunning; })); return probe; } }