feat(lmxproxy): phase 3 — host gRPC server, security, configuration, service hosting

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Joseph Doherty
2026-03-22 00:05:36 -04:00
parent 64c92c63e5
commit 16d1b95e9a
20 changed files with 1575 additions and 2 deletions

View File

@@ -0,0 +1,46 @@
using FluentAssertions;
using Xunit;
namespace ZB.MOM.WW.LmxProxy.Host.Tests.Security
{
public class ApiKeyInterceptorTests
{
[Theory]
[InlineData("/scada.ScadaService/Write")]
[InlineData("/scada.ScadaService/WriteBatch")]
[InlineData("/scada.ScadaService/WriteBatchAndWait")]
public void WriteProtectedMethods_AreCorrectlyDefined(string method)
{
// This test verifies the set of write-protected methods is correct.
// The actual interceptor logic is tested via integration tests.
var writeProtected = new System.Collections.Generic.HashSet<string>(
System.StringComparer.OrdinalIgnoreCase)
{
"/scada.ScadaService/Write",
"/scada.ScadaService/WriteBatch",
"/scada.ScadaService/WriteBatchAndWait"
};
writeProtected.Should().Contain(method);
}
[Theory]
[InlineData("/scada.ScadaService/Connect")]
[InlineData("/scada.ScadaService/Disconnect")]
[InlineData("/scada.ScadaService/GetConnectionState")]
[InlineData("/scada.ScadaService/Read")]
[InlineData("/scada.ScadaService/ReadBatch")]
[InlineData("/scada.ScadaService/Subscribe")]
[InlineData("/scada.ScadaService/CheckApiKey")]
public void ReadMethods_AreNotWriteProtected(string method)
{
var writeProtected = new System.Collections.Generic.HashSet<string>(
System.StringComparer.OrdinalIgnoreCase)
{
"/scada.ScadaService/Write",
"/scada.ScadaService/WriteBatch",
"/scada.ScadaService/WriteBatchAndWait"
};
writeProtected.Should().NotContain(method);
}
}
}