feat(config): remove the SystemPlatform NamespaceKind (capstone) — Galaxy is Equipment-kind
This commit is contained in:
@@ -29,14 +29,14 @@ public sealed class UnsTreeServiceTagTests
|
||||
/// <summary>
|
||||
/// Seeds an area→line→equipment path in <paramref name="equipmentCluster"/>. The equipment id is
|
||||
/// always <c>EQ-1</c>. Optionally seeds an Equipment-kind driver (<c>DRV-EQ</c>) in the equipment's
|
||||
/// cluster, a SystemPlatform-kind driver (<c>DRV-SP</c>) in the equipment's cluster, and an
|
||||
/// Equipment-kind driver (<c>DRV-OTHER</c>) in <paramref name="otherCluster"/>.
|
||||
/// cluster, a non-Equipment-kind (Simulated) driver (<c>DRV-SP</c>) in the equipment's cluster, and
|
||||
/// an Equipment-kind driver (<c>DRV-OTHER</c>) in <paramref name="otherCluster"/>.
|
||||
/// </summary>
|
||||
private static void SeedHierarchyAndDrivers(
|
||||
string dbName,
|
||||
string equipmentCluster,
|
||||
bool seedEquipmentDriver = false,
|
||||
bool seedSystemPlatformDriver = false,
|
||||
bool seedNonEquipmentDriver = false,
|
||||
string? otherCluster = null)
|
||||
{
|
||||
using var db = UnsTreeTestDb.CreateNamed(dbName);
|
||||
@@ -59,12 +59,12 @@ public sealed class UnsTreeServiceTagTests
|
||||
Kind = NamespaceKind.Equipment,
|
||||
NamespaceUri = "urn:zb:eq",
|
||||
});
|
||||
// SystemPlatform-kind namespace in the equipment's cluster.
|
||||
// Non-Equipment-kind (Simulated) namespace in the equipment's cluster.
|
||||
db.Namespaces.Add(new Namespace
|
||||
{
|
||||
NamespaceId = "NS-SP",
|
||||
ClusterId = equipmentCluster,
|
||||
Kind = NamespaceKind.SystemPlatform,
|
||||
Kind = NamespaceKind.Simulated,
|
||||
NamespaceUri = "urn:zb:sp",
|
||||
});
|
||||
|
||||
@@ -81,15 +81,15 @@ public sealed class UnsTreeServiceTagTests
|
||||
});
|
||||
}
|
||||
|
||||
if (seedSystemPlatformDriver)
|
||||
if (seedNonEquipmentDriver)
|
||||
{
|
||||
db.DriverInstances.Add(new DriverInstance
|
||||
{
|
||||
DriverInstanceId = "DRV-SP",
|
||||
ClusterId = equipmentCluster,
|
||||
NamespaceId = "NS-SP",
|
||||
Name = "galaxy driver",
|
||||
DriverType = "Galaxy",
|
||||
Name = "non-equipment driver",
|
||||
DriverType = "ModbusTcp",
|
||||
DriverConfig = "{}",
|
||||
});
|
||||
}
|
||||
@@ -187,12 +187,12 @@ public sealed class UnsTreeServiceTagTests
|
||||
db.Tags.Any(t => t.TagId == "TAG-1").ShouldBeFalse();
|
||||
}
|
||||
|
||||
/// <summary>Binding a tree tag to a driver in a SystemPlatform-kind namespace is blocked.</summary>
|
||||
/// <summary>Binding a tree tag to a driver in a non-Equipment-kind namespace is blocked.</summary>
|
||||
[Fact]
|
||||
public async Task CreateTag_driver_systemplatform_namespace_blocked()
|
||||
public async Task CreateTag_driver_non_equipment_namespace_blocked()
|
||||
{
|
||||
var (service, dbName) = Fresh();
|
||||
SeedHierarchyAndDrivers(dbName, equipmentCluster: "MAIN", seedSystemPlatformDriver: true);
|
||||
SeedHierarchyAndDrivers(dbName, equipmentCluster: "MAIN", seedNonEquipmentDriver: true);
|
||||
|
||||
var result = await service.CreateTagAsync("EQ-1", Input("TAG-1", "speed", "DRV-SP"));
|
||||
|
||||
@@ -340,7 +340,7 @@ public sealed class UnsTreeServiceTagTests
|
||||
|
||||
/// <summary>
|
||||
/// The driver loader returns only Equipment-kind drivers in the equipment's cluster — excluding
|
||||
/// SystemPlatform-kind drivers in the same cluster and Equipment-kind drivers in other clusters.
|
||||
/// non-Equipment-kind drivers in the same cluster and Equipment-kind drivers in other clusters.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task LoadTagDriversForEquipment_returns_only_equipment_kind_drivers_in_cluster()
|
||||
@@ -350,7 +350,7 @@ public sealed class UnsTreeServiceTagTests
|
||||
dbName,
|
||||
equipmentCluster: "MAIN",
|
||||
seedEquipmentDriver: true,
|
||||
seedSystemPlatformDriver: true,
|
||||
seedNonEquipmentDriver: true,
|
||||
otherCluster: "SITE-A");
|
||||
|
||||
var drivers = await service.LoadTagDriversForEquipmentAsync("EQ-1");
|
||||
|
||||
Reference in New Issue
Block a user