feat(esg): per-system TimeoutSeconds column on ExternalSystemDefinition (spec Component-ExternalSystemGateway Timeout) — entity + EF + migration

Claude-Session: https://claude.ai/code/session_01MtdgwpEeCUn6cUA5f1LMPj
This commit is contained in:
Joseph Doherty
2026-07-10 03:55:26 -04:00
parent 153b82c880
commit 2767e4bca1
7 changed files with 2097 additions and 0 deletions
@@ -0,0 +1,19 @@
using ZB.MOM.WW.ScadaBridge.Commons.Entities.ExternalSystems;
namespace ZB.MOM.WW.ScadaBridge.Commons.Tests.Entities;
/// <summary>
/// Locks the <see cref="ExternalSystemDefinition"/> construction invariants — in particular
/// that the per-system <see cref="ExternalSystemDefinition.TimeoutSeconds"/> defaults to 0,
/// meaning "unset — use the gateway's configured DefaultHttpTimeout".
/// </summary>
public class ExternalSystemDefinitionTests
{
[Fact]
public void ExternalSystemDefinition_TimeoutSeconds_DefaultsToZeroMeaningUseGatewayDefault()
{
var system = new ExternalSystemDefinition("sys", "http://x", "none");
Assert.Equal(0, system.TimeoutSeconds);
}
}
@@ -45,6 +45,21 @@ public class ExternalSystemRepositoryTests : IDisposable
Assert.Equal("Sys", loaded!.Name);
}
[Fact]
public async Task AddExternalSystem_TimeoutSeconds_RoundTrips()
{
var def = new ExternalSystemDefinition("Sys", "https://example.test", "ApiKey")
{
TimeoutSeconds = 15,
};
await _repository.AddExternalSystemAsync(def);
await _repository.SaveChangesAsync();
var loaded = await _repository.GetExternalSystemByIdAsync(def.Id);
Assert.NotNull(loaded);
Assert.Equal(15, loaded!.TimeoutSeconds);
}
[Fact]
public async Task GetMethodsByExternalSystemId_FiltersByParent()
{