7b0b9c7365
Solution + 23 src projects + 26 test projects renamed; folders, csproj, namespaces, and ScadaLinkDbContext/ScadaBridgeDbContext class updated. ActorSystem "scadalink" → "scadabridge", Akka seed-node URLs migrated. SQL roles/logins, LDAP domains, CLI command name, and CLI config dir (~/.scadalink → ~/.scadabridge) also renamed. Build green; 5 Host.Tests fail awaiting SQL login rename in next commit. Pre-existing StaleTagMonitor timing flakes unchanged. Rename script committed at tools/rename-to-scadabridge.sh.
81 lines
2.0 KiB
C#
81 lines
2.0 KiB
C#
using Akka.Actor;
|
|
using Akka.Configuration;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.Host.Tests;
|
|
|
|
/// <summary>
|
|
/// WP-13: Tests for Akka.NET actor system bootstrap.
|
|
/// </summary>
|
|
public class AkkaBootstrapTests : IDisposable
|
|
{
|
|
private ActorSystem? _actorSystem;
|
|
|
|
public void Dispose()
|
|
{
|
|
_actorSystem?.Dispose();
|
|
}
|
|
|
|
[Fact]
|
|
public void ActorSystem_CreatesWithClusterConfig()
|
|
{
|
|
var hocon = @"
|
|
akka {
|
|
actor {
|
|
provider = cluster
|
|
}
|
|
remote {
|
|
dot-netty.tcp {
|
|
hostname = ""localhost""
|
|
port = 0
|
|
}
|
|
}
|
|
cluster {
|
|
seed-nodes = [""akka.tcp://scadabridge-test@localhost:0""]
|
|
roles = [""Central""]
|
|
min-nr-of-members = 1
|
|
}
|
|
coordinated-shutdown {
|
|
run-by-clr-shutdown-hook = on
|
|
}
|
|
}";
|
|
var config = ConfigurationFactory.ParseString(hocon);
|
|
_actorSystem = ActorSystem.Create("scadabridge-test", config);
|
|
|
|
Assert.NotNull(_actorSystem);
|
|
Assert.Equal("scadabridge-test", _actorSystem.Name);
|
|
}
|
|
|
|
[Fact]
|
|
public void ActorSystem_HoconConfig_IncludesCoordinatedShutdown()
|
|
{
|
|
var hocon = @"
|
|
akka {
|
|
actor {
|
|
provider = cluster
|
|
}
|
|
remote {
|
|
dot-netty.tcp {
|
|
hostname = ""localhost""
|
|
port = 0
|
|
}
|
|
}
|
|
cluster {
|
|
seed-nodes = [""akka.tcp://scadabridge-test@localhost:0""]
|
|
roles = [""Central""]
|
|
run-coordinated-shutdown-when-down = on
|
|
}
|
|
coordinated-shutdown {
|
|
run-by-clr-shutdown-hook = on
|
|
}
|
|
}";
|
|
var config = ConfigurationFactory.ParseString(hocon);
|
|
_actorSystem = ActorSystem.Create("scadabridge-cs-test", config);
|
|
|
|
var csConfig = _actorSystem.Settings.Config.GetString("akka.coordinated-shutdown.run-by-clr-shutdown-hook");
|
|
Assert.Equal("on", csConfig);
|
|
|
|
var clusterShutdown = _actorSystem.Settings.Config.GetString("akka.cluster.run-coordinated-shutdown-when-down");
|
|
Assert.Equal("on", clusterShutdown);
|
|
}
|
|
}
|