refactor: rename ScadaLink → ZB.MOM.WW.ScadaBridge (code + projects + namespaces)
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.
This commit is contained in:
@@ -13,11 +13,11 @@
|
||||
### Task 1: Create ManagementService project and test project
|
||||
|
||||
**Files:**
|
||||
- Create: `src/ScadaLink.ManagementService/ScadaLink.ManagementService.csproj`
|
||||
- Create: `src/ScadaLink.ManagementService/ServiceCollectionExtensions.cs`
|
||||
- Create: `src/ScadaLink.ManagementService/ManagementServiceOptions.cs`
|
||||
- Create: `tests/ScadaLink.ManagementService.Tests/ScadaLink.ManagementService.Tests.csproj`
|
||||
- Modify: `ScadaLink.slnx` — add both projects
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.ManagementService/ZB.MOM.WW.ScadaBridge.ManagementService.csproj`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.ManagementService/ServiceCollectionExtensions.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.ManagementService/ManagementServiceOptions.cs`
|
||||
- Create: `tests/ZB.MOM.WW.ScadaBridge.ManagementService.Tests/ZB.MOM.WW.ScadaBridge.ManagementService.Tests.csproj`
|
||||
- Modify: `ZB.MOM.WW.ScadaBridge.slnx` — add both projects
|
||||
|
||||
**Step 1:** Create the csproj following the existing pattern (net10.0, TreatWarningsAsErrors, ImplicitUsings). Reference Commons plus all service component projects needed: TemplateEngine, DeploymentManager, Communication, ExternalSystemGateway, NotificationService, Security, HealthMonitoring. Add Akka.Cluster.Tools 1.5.62.
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
|
||||
**Step 3:** Create the test project csproj (xUnit, NSubstitute, reference ManagementService + Commons).
|
||||
|
||||
**Step 4:** Add both projects to `ScadaLink.slnx`.
|
||||
**Step 4:** Add both projects to `ZB.MOM.WW.ScadaBridge.slnx`.
|
||||
|
||||
**Step 5:** Build: `dotnet build ScadaLink.slnx`
|
||||
**Step 5:** Build: `dotnet build ZB.MOM.WW.ScadaBridge.slnx`
|
||||
|
||||
**Step 6:** Commit: `feat: scaffold ManagementService project and test project`
|
||||
|
||||
@@ -36,18 +36,18 @@
|
||||
### Task 2: Define management message contracts in Commons
|
||||
|
||||
**Files:**
|
||||
- Create: `src/ScadaLink.Commons/Messages/Management/ManagementEnvelope.cs`
|
||||
- Create: `src/ScadaLink.Commons/Messages/Management/ManagementResponse.cs`
|
||||
- Create: `src/ScadaLink.Commons/Messages/Management/TemplateCommands.cs`
|
||||
- Create: `src/ScadaLink.Commons/Messages/Management/InstanceCommands.cs`
|
||||
- Create: `src/ScadaLink.Commons/Messages/Management/SiteCommands.cs`
|
||||
- Create: `src/ScadaLink.Commons/Messages/Management/DataConnectionCommands.cs`
|
||||
- Create: `src/ScadaLink.Commons/Messages/Management/DeploymentCommands.cs`
|
||||
- Create: `src/ScadaLink.Commons/Messages/Management/ExternalSystemCommands.cs`
|
||||
- Create: `src/ScadaLink.Commons/Messages/Management/NotificationCommands.cs`
|
||||
- Create: `src/ScadaLink.Commons/Messages/Management/SecurityCommands.cs`
|
||||
- Create: `src/ScadaLink.Commons/Messages/Management/AuditLogCommands.cs`
|
||||
- Create: `src/ScadaLink.Commons/Messages/Management/HealthCommands.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.Commons/Messages/Management/ManagementEnvelope.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.Commons/Messages/Management/ManagementResponse.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.Commons/Messages/Management/TemplateCommands.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.Commons/Messages/Management/InstanceCommands.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.Commons/Messages/Management/SiteCommands.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.Commons/Messages/Management/DataConnectionCommands.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.Commons/Messages/Management/DeploymentCommands.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.Commons/Messages/Management/ExternalSystemCommands.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.Commons/Messages/Management/NotificationCommands.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.Commons/Messages/Management/SecurityCommands.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.Commons/Messages/Management/AuditLogCommands.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.Commons/Messages/Management/HealthCommands.cs`
|
||||
|
||||
**Step 1:** Create `ManagementEnvelope.cs` — wrapper record carrying `AuthenticatedUser` (username, displayName, roles, permittedSiteIds) and the inner command:
|
||||
```csharp
|
||||
@@ -67,7 +67,7 @@ public record ManagementUnauthorized(string CorrelationId, string Message);
|
||||
- `InstanceCommands.cs`: `ListInstancesCommand(int? SiteId, int? TemplateId)`, `CreateInstanceCommand(string Name, int TemplateId, int SiteId)`, `DeployInstanceCommand(int InstanceId)`, `EnableInstanceCommand(int InstanceId)`, etc.
|
||||
- Continue for all 10 message groups from the component doc.
|
||||
|
||||
**Step 4:** Build: `dotnet build ScadaLink.slnx`
|
||||
**Step 4:** Build: `dotnet build ZB.MOM.WW.ScadaBridge.slnx`
|
||||
|
||||
**Step 5:** Commit: `feat: define management message contracts in Commons`
|
||||
|
||||
@@ -76,7 +76,7 @@ public record ManagementUnauthorized(string CorrelationId, string Message);
|
||||
### Task 3: Implement ManagementActor
|
||||
|
||||
**Files:**
|
||||
- Create: `src/ScadaLink.ManagementService/ManagementActor.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.ManagementService/ManagementActor.cs`
|
||||
|
||||
**Step 1:** Create `ManagementActor` extending `ReceiveActor`. Constructor takes `IServiceProvider` (to resolve scoped services per request). Register `Receive<ManagementEnvelope>` handler.
|
||||
|
||||
@@ -89,7 +89,7 @@ public record ManagementUnauthorized(string CorrelationId, string Message);
|
||||
|
||||
**Step 3:** Implement handler methods for each command group. Each handler follows the same pattern — resolve service from scope, call the existing service method, wrap result in response. Start with Templates and Instances as they're the most exercised.
|
||||
|
||||
**Step 4:** Build: `dotnet build ScadaLink.slnx`
|
||||
**Step 4:** Build: `dotnet build ZB.MOM.WW.ScadaBridge.slnx`
|
||||
|
||||
**Step 5:** Commit: `feat: implement ManagementActor with all command handlers`
|
||||
|
||||
@@ -98,9 +98,9 @@ public record ManagementUnauthorized(string CorrelationId, string Message);
|
||||
### Task 4: Register ManagementActor on Central and set up ClusterClientReceptionist
|
||||
|
||||
**Files:**
|
||||
- Modify: `src/ScadaLink.Host/Actors/AkkaHostedService.cs` — RegisterCentralActors
|
||||
- Modify: `src/ScadaLink.Host/Program.cs` — Central role, add `services.AddManagementService()`
|
||||
- Modify: `src/ScadaLink.ManagementService/ServiceCollectionExtensions.cs` — ensure DI is wired
|
||||
- Modify: `src/ZB.MOM.WW.ScadaBridge.Host/Actors/AkkaHostedService.cs` — RegisterCentralActors
|
||||
- Modify: `src/ZB.MOM.WW.ScadaBridge.Host/Program.cs` — Central role, add `services.AddManagementService()`
|
||||
- Modify: `src/ZB.MOM.WW.ScadaBridge.ManagementService/ServiceCollectionExtensions.cs` — ensure DI is wired
|
||||
|
||||
**Step 1:** In `RegisterCentralActors()`, after creating CentralCommunicationActor:
|
||||
```csharp
|
||||
@@ -123,15 +123,15 @@ _logger.LogInformation("ManagementActor registered with ClusterClientReceptionis
|
||||
### Task 5: Create CLI project with System.CommandLine scaffolding
|
||||
|
||||
**Files:**
|
||||
- Create: `src/ScadaLink.CLI/ScadaLink.CLI.csproj`
|
||||
- Create: `src/ScadaLink.CLI/Program.cs`
|
||||
- Create: `src/ScadaLink.CLI/CliConfig.cs`
|
||||
- Create: `src/ScadaLink.CLI/ClusterConnection.cs`
|
||||
- Modify: `ScadaLink.slnx` — add CLI project
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.CLI/ZB.MOM.WW.ScadaBridge.CLI.csproj`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.CLI/Program.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.CLI/CliConfig.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.CLI/ClusterConnection.cs`
|
||||
- Modify: `ZB.MOM.WW.ScadaBridge.slnx` — add CLI project
|
||||
|
||||
**Step 1:** Create csproj as console app. Reference Commons (for messages), Akka + Akka.Remote + Akka.Cluster.Tools (for ClusterClient), System.CommandLine, Novell.Directory.Ldap.NETStandard (for LDAP auth — same lib used by Security component).
|
||||
|
||||
**Step 2:** Create `CliConfig.cs` — reads config from env vars, `~/.scadalink/config.json`, and CLI options. Properties: ContactPoints, LdapServer, LdapPort, LdapUseTls, DefaultFormat.
|
||||
**Step 2:** Create `CliConfig.cs` — reads config from env vars, `~/.scadabridge/config.json`, and CLI options. Properties: ContactPoints, LdapServer, LdapPort, LdapUseTls, DefaultFormat.
|
||||
|
||||
**Step 3:** Create `ClusterConnection.cs` — manages the ActorSystem and ClusterClient lifecycle:
|
||||
```csharp
|
||||
@@ -145,7 +145,7 @@ public class ClusterConnection : IAsyncDisposable
|
||||
|
||||
**Step 4:** Create `Program.cs` with root command, global options (`--contact-points`, `--username`, `--password`, `--format`), and placeholder subcommands. Wire up LDAP auth flow in the root handler.
|
||||
|
||||
**Step 5:** Add to `ScadaLink.slnx`. Build: `dotnet build ScadaLink.slnx`.
|
||||
**Step 5:** Add to `ZB.MOM.WW.ScadaBridge.slnx`. Build: `dotnet build ZB.MOM.WW.ScadaBridge.slnx`.
|
||||
|
||||
**Step 6:** Commit: `feat: scaffold CLI project with ClusterClient connection`
|
||||
|
||||
@@ -154,17 +154,17 @@ public class ClusterConnection : IAsyncDisposable
|
||||
### Task 6: Implement CLI command groups
|
||||
|
||||
**Files:**
|
||||
- Create: `src/ScadaLink.CLI/Commands/TemplateCommands.cs`
|
||||
- Create: `src/ScadaLink.CLI/Commands/InstanceCommands.cs`
|
||||
- Create: `src/ScadaLink.CLI/Commands/SiteCommands.cs`
|
||||
- Create: `src/ScadaLink.CLI/Commands/DeployCommands.cs`
|
||||
- Create: `src/ScadaLink.CLI/Commands/DataConnectionCommands.cs`
|
||||
- Create: `src/ScadaLink.CLI/Commands/ExternalSystemCommands.cs`
|
||||
- Create: `src/ScadaLink.CLI/Commands/NotificationCommands.cs`
|
||||
- Create: `src/ScadaLink.CLI/Commands/SecurityCommands.cs`
|
||||
- Create: `src/ScadaLink.CLI/Commands/AuditLogCommands.cs`
|
||||
- Create: `src/ScadaLink.CLI/Commands/HealthCommands.cs`
|
||||
- Create: `src/ScadaLink.CLI/OutputFormatter.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.CLI/Commands/TemplateCommands.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.CLI/Commands/InstanceCommands.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.CLI/Commands/SiteCommands.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.CLI/Commands/DeployCommands.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.CLI/Commands/DataConnectionCommands.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.CLI/Commands/ExternalSystemCommands.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.CLI/Commands/NotificationCommands.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.CLI/Commands/SecurityCommands.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.CLI/Commands/AuditLogCommands.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.CLI/Commands/HealthCommands.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.CLI/OutputFormatter.cs`
|
||||
|
||||
**Step 1:** Create `OutputFormatter.cs` — handles JSON and table output:
|
||||
```csharp
|
||||
@@ -182,7 +182,7 @@ public static class OutputFormatter
|
||||
|
||||
**Step 3:** Register all command groups in Program.cs root command.
|
||||
|
||||
**Step 4:** Build: `dotnet build ScadaLink.slnx`
|
||||
**Step 4:** Build: `dotnet build ZB.MOM.WW.ScadaBridge.slnx`
|
||||
|
||||
**Step 5:** Commit: `feat: implement all CLI command groups`
|
||||
|
||||
@@ -191,7 +191,7 @@ public static class OutputFormatter
|
||||
### Task 7: Write ManagementActor unit tests
|
||||
|
||||
**Files:**
|
||||
- Create: `tests/ScadaLink.ManagementService.Tests/ManagementActorTests.cs`
|
||||
- Create: `tests/ZB.MOM.WW.ScadaBridge.ManagementService.Tests/ManagementActorTests.cs`
|
||||
|
||||
**Step 1:** Test authorization enforcement — send commands without required role, verify `ManagementUnauthorized` response.
|
||||
|
||||
@@ -199,7 +199,7 @@ public static class OutputFormatter
|
||||
|
||||
**Step 3:** Test instance operations — mock services, send `CreateInstanceCommand`, verify delegation.
|
||||
|
||||
**Step 4:** Run tests: `dotnet test tests/ScadaLink.ManagementService.Tests/`
|
||||
**Step 4:** Run tests: `dotnet test tests/ZB.MOM.WW.ScadaBridge.ManagementService.Tests/`
|
||||
|
||||
**Step 5:** Commit: `test: add ManagementActor unit tests`
|
||||
|
||||
@@ -209,7 +209,7 @@ public static class OutputFormatter
|
||||
|
||||
**Step 1:** Start Central with ManagementActor registered. Verify log shows "ManagementActor registered with ClusterClientReceptionist".
|
||||
|
||||
**Step 2:** Run CLI: `dotnet run --project src/ScadaLink.CLI -- --contact-points akka.tcp://scadalink@localhost:8081 --username admin --password password template list`
|
||||
**Step 2:** Run CLI: `dotnet run --project src/ZB.MOM.WW.ScadaBridge.CLI -- --contact-points akka.tcp://scadabridge@localhost:8081 --username admin --password password template list`
|
||||
|
||||
**Step 3:** Verify CLI connects, authenticates, sends command, receives response, prints templates.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user