chore: organize solution into module folders (Core/Server/Drivers/Client/Tooling)
Group all 69 projects into category subfolders under src/ and tests/ so the Rider Solution Explorer mirrors the module structure. Folders: Core, Server, Drivers (with a nested Driver CLIs subfolder), Client, Tooling. - Move every project folder on disk with git mv (history preserved as renames). - Recompute relative paths in 57 .csproj files: cross-category ProjectReferences, the lib/ HintPath+None refs in Driver.Historian.Wonderware, and the external mxaccessgw refs in Driver.Galaxy and its test project. - Rebuild ZB.MOM.WW.OtOpcUa.slnx with nested solution folders. - Re-prefix project paths in functional scripts (e2e, compliance, smoke SQL, integration, install). Build green (0 errors); unit tests pass. Docs left for a separate pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Shouldly;
|
||||
using Xunit;
|
||||
using ZB.MOM.WW.OtOpcUa.Configuration.LocalCache;
|
||||
using ZB.MOM.WW.OtOpcUa.Server;
|
||||
|
||||
namespace ZB.MOM.WW.OtOpcUa.Server.Tests;
|
||||
|
||||
[Trait("Category", "Unit")]
|
||||
public sealed class NodeBootstrapTests
|
||||
{
|
||||
private sealed class StubCache : ILocalConfigCache
|
||||
{
|
||||
public GenerationSnapshot? Stored { get; set; }
|
||||
public Task<GenerationSnapshot?> GetMostRecentAsync(string _, CancellationToken __) => Task.FromResult(Stored);
|
||||
public Task PutAsync(GenerationSnapshot _, CancellationToken __) => Task.CompletedTask;
|
||||
public Task PruneOldGenerationsAsync(string _, int __, CancellationToken ___) => Task.CompletedTask;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Falls_back_to_cache_when_DB_unreachable()
|
||||
{
|
||||
var cache = new StubCache
|
||||
{
|
||||
Stored = new GenerationSnapshot
|
||||
{
|
||||
ClusterId = "c", GenerationId = 42, CachedAt = DateTime.UtcNow, PayloadJson = "{}",
|
||||
},
|
||||
};
|
||||
|
||||
var bootstrap = new NodeBootstrap(
|
||||
new NodeOptions
|
||||
{
|
||||
NodeId = "n",
|
||||
ClusterId = "c",
|
||||
ConfigDbConnectionString = "Server=127.0.0.1,59999;Database=nope;User Id=x;Password=x;TrustServerCertificate=True;Connect Timeout=1;",
|
||||
},
|
||||
cache,
|
||||
NullLogger<NodeBootstrap>.Instance);
|
||||
|
||||
var result = await bootstrap.LoadCurrentGenerationAsync(CancellationToken.None);
|
||||
|
||||
result.Source.ShouldBe(BootstrapSource.LocalCache);
|
||||
result.GenerationId.ShouldBe(42);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Throws_BootstrapException_when_DB_unreachable_and_cache_empty()
|
||||
{
|
||||
var bootstrap = new NodeBootstrap(
|
||||
new NodeOptions
|
||||
{
|
||||
NodeId = "n",
|
||||
ClusterId = "c",
|
||||
ConfigDbConnectionString = "Server=127.0.0.1,59999;Database=nope;User Id=x;Password=x;TrustServerCertificate=True;Connect Timeout=1;",
|
||||
},
|
||||
new StubCache(),
|
||||
NullLogger<NodeBootstrap>.Instance);
|
||||
|
||||
await Should.ThrowAsync<BootstrapException>(() =>
|
||||
bootstrap.LoadCurrentGenerationAsync(CancellationToken.None));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user