fix(adminui): canonicalize Modbus driver-type string on "Modbus" (was ModbusTcp)
This commit is contained in:
@@ -16,7 +16,12 @@ public sealed class TagConfigValidatorTests
|
||||
|
||||
[Fact]
|
||||
public void Modbus_has_no_required_field_so_empty_config_is_valid()
|
||||
=> TagConfigValidator.Validate("ModbusTcp", "{}").ShouldBeNull();
|
||||
=> TagConfigValidator.Validate("Modbus", "{}").ShouldBeNull();
|
||||
|
||||
[Fact]
|
||||
public void Resolve_Modbus_dispatches_typed_editor()
|
||||
=> TagConfigEditorMap.Resolve("Modbus")
|
||||
.ShouldBe(typeof(ZB.MOM.WW.OtOpcUa.AdminUI.Components.Shared.Uns.TagEditors.ModbusTagConfigEditor));
|
||||
|
||||
// Drivers whose Validate() requires a field: blank config must return an error string.
|
||||
[Theory]
|
||||
|
||||
@@ -114,7 +114,7 @@ public sealed class UnsTreeServiceAreaLineTests
|
||||
ClusterId = "MAIN",
|
||||
NamespaceId = "NS-1",
|
||||
Name = "drv",
|
||||
DriverType = "ModbusTcp",
|
||||
DriverType = "Modbus",
|
||||
DriverConfig = "{}",
|
||||
});
|
||||
db.SaveChanges();
|
||||
@@ -156,7 +156,7 @@ public sealed class UnsTreeServiceAreaLineTests
|
||||
ClusterId = "SITE-A",
|
||||
NamespaceId = "NS-1",
|
||||
Name = "drv",
|
||||
DriverType = "ModbusTcp",
|
||||
DriverType = "Modbus",
|
||||
DriverConfig = "{}",
|
||||
});
|
||||
db.Equipment.Add(new Equipment
|
||||
@@ -358,7 +358,7 @@ public sealed class UnsTreeServiceAreaLineTests
|
||||
ClusterId = "MAIN",
|
||||
NamespaceId = "NS-1",
|
||||
Name = "drv",
|
||||
DriverType = "ModbusTcp",
|
||||
DriverType = "Modbus",
|
||||
DriverConfig = "{}",
|
||||
});
|
||||
db.Equipment.Add(new Equipment
|
||||
|
||||
+1
-1
@@ -107,7 +107,7 @@ public sealed class UnsTreeServiceDeleteClusterTests
|
||||
ClusterId = "CL-DRV",
|
||||
NamespaceId = "NS-1",
|
||||
Name = "drv",
|
||||
DriverType = "ModbusTcp",
|
||||
DriverType = "Modbus",
|
||||
DriverConfig = "{}",
|
||||
});
|
||||
db.SaveChanges();
|
||||
|
||||
@@ -43,7 +43,7 @@ public sealed class UnsTreeServiceEquipmentTests
|
||||
ClusterId = driverCluster,
|
||||
NamespaceId = "NS-1",
|
||||
Name = "drv",
|
||||
DriverType = "ModbusTcp",
|
||||
DriverType = "Modbus",
|
||||
DriverConfig = "{}",
|
||||
});
|
||||
}
|
||||
@@ -174,7 +174,7 @@ public sealed class UnsTreeServiceEquipmentTests
|
||||
ClusterId = "MAIN",
|
||||
NamespaceId = "NS-1",
|
||||
Name = "drv",
|
||||
DriverType = "ModbusTcp",
|
||||
DriverType = "Modbus",
|
||||
DriverConfig = "{}",
|
||||
});
|
||||
db.SaveChanges();
|
||||
|
||||
@@ -38,7 +38,7 @@ public sealed class UnsTreeServiceImportTests
|
||||
ClusterId = driverCluster,
|
||||
NamespaceId = "NS-1",
|
||||
Name = "drv",
|
||||
DriverType = "ModbusTcp",
|
||||
DriverType = "Modbus",
|
||||
DriverConfig = "{}",
|
||||
});
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ public sealed class UnsTreeServiceLoadEditTests
|
||||
ClusterId = UnsTreeTestDb.PopulatedClusterId,
|
||||
NamespaceId = "NS-1",
|
||||
Name = "modbus-b",
|
||||
DriverType = "ModbusTcp",
|
||||
DriverType = "Modbus",
|
||||
DriverConfig = "{}",
|
||||
});
|
||||
db.DriverInstances.Add(new DriverInstance
|
||||
@@ -141,7 +141,7 @@ public sealed class UnsTreeServiceLoadEditTests
|
||||
drivers[0].DriverInstanceId.ShouldBe("DRV-A");
|
||||
drivers[0].Display.ShouldBe("DRV-A — galaxy-a (Galaxy)");
|
||||
drivers[1].DriverInstanceId.ShouldBe("DRV-B");
|
||||
drivers[1].Display.ShouldBe("DRV-B — modbus-b (ModbusTcp)");
|
||||
drivers[1].Display.ShouldBe("DRV-B — modbus-b (Modbus)");
|
||||
}
|
||||
|
||||
/// <summary>Loading a seeded tag maps its fields, owning equipment, and a non-empty RowVersion.</summary>
|
||||
|
||||
@@ -58,7 +58,7 @@ public sealed class UnsTreeServiceTagDriversTests
|
||||
ClusterId = "MAIN",
|
||||
NamespaceId = "NS-EQ",
|
||||
Name = "equipment driver",
|
||||
DriverType = "ModbusTcp",
|
||||
DriverType = "Modbus",
|
||||
DriverConfig = """{"endpoint":"10.0.0.1:502"}""",
|
||||
});
|
||||
db.SaveChanges();
|
||||
@@ -70,7 +70,7 @@ public sealed class UnsTreeServiceTagDriversTests
|
||||
|
||||
drivers.Count.ShouldBe(1);
|
||||
drivers[0].DriverInstanceId.ShouldBe("DRV-EQ");
|
||||
drivers[0].DriverType.ShouldBe("ModbusTcp");
|
||||
drivers[0].DriverType.ShouldBe("Modbus");
|
||||
// The picker (Galaxy live-browse) opens its session against the selected driver's config.
|
||||
drivers[0].DriverConfig.ShouldBe("""{"endpoint":"10.0.0.1:502"}""");
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public sealed class UnsTreeServiceTagTests
|
||||
ClusterId = equipmentCluster,
|
||||
NamespaceId = "NS-EQ",
|
||||
Name = "equipment driver",
|
||||
DriverType = "ModbusTcp",
|
||||
DriverType = "Modbus",
|
||||
DriverConfig = "{}",
|
||||
});
|
||||
}
|
||||
@@ -89,7 +89,7 @@ public sealed class UnsTreeServiceTagTests
|
||||
ClusterId = equipmentCluster,
|
||||
NamespaceId = "NS-SP",
|
||||
Name = "non-equipment driver",
|
||||
DriverType = "ModbusTcp",
|
||||
DriverType = "Modbus",
|
||||
DriverConfig = "{}",
|
||||
});
|
||||
}
|
||||
@@ -110,7 +110,7 @@ public sealed class UnsTreeServiceTagTests
|
||||
ClusterId = otherCluster,
|
||||
NamespaceId = "NS-OTHER",
|
||||
Name = "other-cluster driver",
|
||||
DriverType = "ModbusTcp",
|
||||
DriverType = "Modbus",
|
||||
DriverConfig = "{}",
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user