a5256e9b12
'Pattern 4: Integration Routing' — RouteIntegrationCallAsync → SiteEnvelope(IntegrationCallRequest) → SiteCommunicationActor integration handler — was plumbed end to end but connected at neither end: no producer (zero callers) and no handler (AkkaHostedService never registered LocalHandlerType.Integration). It was an early scaffold the architecture routed around — the brokered External→Central→Site→Central round-trip is served by the Inbound API's routed-site-script path (the RouteTo* verbs, driven from CommunicationServiceInstanceRouter), which is live, tested, and shares IntegrationTimeout. Decision (#32): delete. Removed the IntegrationCall{Request,Response} messages, RouteIntegrationCallAsync, the SiteCommunicationActor receive block + _integrationHandler field + LocalHandlerType.Integration, and the four tests that covered them (2 actor, 2 message-contract, 1 dispatcher- reject, 1 mapper-reject). KEPT IntegrationTimeout — it is the live timeout for the RouteTo* verbs. Updated the exclusion-narrative comments (proto/mapper/dispatcher), design §4, the components doc timeout table, and marked the known-issue RESOLVED. Full solution build clean (0/0); Communication 634 + Host 421 green. Net -172/+20 across 14 files. Not in the gRPC proto (was deliberately excluded there), so no wire-format change.
79 lines
2.9 KiB
C#
79 lines
2.9 KiB
C#
using ZB.MOM.WW.ScadaBridge.Commons.Messages.RemoteQuery;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.Communication.Tests;
|
|
|
|
/// <summary>
|
|
/// WP-1: Tests that message contracts have correlation IDs and proper structure.
|
|
/// </summary>
|
|
public class MessageContractTests
|
|
{
|
|
[Fact]
|
|
public void EventLogQueryRequest_HasCorrelationId()
|
|
{
|
|
var msg = new EventLogQueryRequest(
|
|
"corr-456", "site1", null, null, null, null, null, null, null, 25, DateTimeOffset.UtcNow);
|
|
|
|
Assert.Equal("corr-456", msg.CorrelationId);
|
|
}
|
|
|
|
[Fact]
|
|
public void EventLogQueryResponse_HasCorrelationId()
|
|
{
|
|
var msg = new EventLogQueryResponse(
|
|
"corr-456", "site1", [], null, false, true, null, DateTimeOffset.UtcNow);
|
|
|
|
Assert.Equal("corr-456", msg.CorrelationId);
|
|
}
|
|
|
|
[Fact]
|
|
public void ParkedMessageQueryRequest_HasCorrelationId()
|
|
{
|
|
var msg = new ParkedMessageQueryRequest(
|
|
"corr-789", "site1", 1, 25, DateTimeOffset.UtcNow);
|
|
|
|
Assert.Equal("corr-789", msg.CorrelationId);
|
|
}
|
|
|
|
[Fact]
|
|
public void ParkedMessageQueryResponse_HasCorrelationId()
|
|
{
|
|
var msg = new ParkedMessageQueryResponse(
|
|
"corr-789", "site1", [], 0, 1, 25, true, null, DateTimeOffset.UtcNow);
|
|
|
|
Assert.Equal("corr-789", msg.CorrelationId);
|
|
}
|
|
|
|
[Fact]
|
|
public void AllMessagePatterns_ExistAsRecordTypes()
|
|
{
|
|
// Verify all 8 patterns have proper request/response types
|
|
// Pattern 1: Deployment
|
|
Assert.True(typeof(Commons.Messages.Deployment.DeployInstanceCommand).IsValueType == false);
|
|
Assert.True(typeof(Commons.Messages.Deployment.DeploymentStatusResponse).IsValueType == false);
|
|
|
|
// Pattern 2: Lifecycle
|
|
Assert.True(typeof(Commons.Messages.Lifecycle.DisableInstanceCommand).IsValueType == false);
|
|
Assert.True(typeof(Commons.Messages.Lifecycle.InstanceLifecycleResponse).IsValueType == false);
|
|
|
|
// Pattern 3: Artifacts
|
|
Assert.True(typeof(Commons.Messages.Artifacts.DeployArtifactsCommand).IsValueType == false);
|
|
Assert.True(typeof(Commons.Messages.Artifacts.ArtifactDeploymentResponse).IsValueType == false);
|
|
|
|
// Pattern 5: Debug View
|
|
Assert.True(typeof(Commons.Messages.DebugView.SubscribeDebugViewRequest).IsValueType == false);
|
|
Assert.True(typeof(Commons.Messages.DebugView.DebugViewSnapshot).IsValueType == false);
|
|
|
|
// Pattern 6: Health
|
|
Assert.True(typeof(Commons.Messages.Health.SiteHealthReport).IsValueType == false);
|
|
|
|
// Pattern 7: Remote Queries
|
|
Assert.True(typeof(EventLogQueryRequest).IsValueType == false);
|
|
Assert.True(typeof(EventLogQueryResponse).IsValueType == false);
|
|
Assert.True(typeof(ParkedMessageQueryRequest).IsValueType == false);
|
|
Assert.True(typeof(ParkedMessageQueryResponse).IsValueType == false);
|
|
|
|
// Pattern 8: Heartbeat
|
|
Assert.True(typeof(Commons.Messages.Health.HeartbeatMessage).IsValueType == false);
|
|
}
|
|
}
|