Wire Galaxy security_classification to OPC UA AccessLevel (ReadOnly for SecuredWrite/VerifiedWrite/ViewOnly). Use deployed package chain for attribute queries to exclude undeployed attributes. Group primitive attributes under their parent variable node (merged Variable+Object). Add is_historized and is_alarm detection via HistoryExtension/AlarmExtension primitives. Implement OPC UA HistoryRead backed by Wonderware Historian Runtime database. Implement AlarmConditionState nodes driven by InAlarm with condition refresh support. Add historyread and alarms CLI commands for testing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
64 lines
2.1 KiB
C#
64 lines
2.1 KiB
C#
using Shouldly;
|
|
using Xunit;
|
|
using ZB.MOM.WW.LmxOpcUa.Host.Domain;
|
|
|
|
namespace ZB.MOM.WW.LmxOpcUa.Tests.Domain
|
|
{
|
|
/// <summary>
|
|
/// Verifies default and extended-field behavior for Galaxy attribute metadata objects.
|
|
/// </summary>
|
|
public class GalaxyAttributeInfoTests
|
|
{
|
|
/// <summary>
|
|
/// Confirms that a default attribute metadata object starts with empty strings for its text fields.
|
|
/// </summary>
|
|
[Fact]
|
|
public void DefaultValues_AreEmpty()
|
|
{
|
|
var info = new GalaxyAttributeInfo();
|
|
info.PrimitiveName.ShouldBe("");
|
|
info.AttributeSource.ShouldBe("");
|
|
info.TagName.ShouldBe("");
|
|
info.AttributeName.ShouldBe("");
|
|
info.FullTagReference.ShouldBe("");
|
|
info.DataTypeName.ShouldBe("");
|
|
info.SecurityClassification.ShouldBe(1);
|
|
info.IsHistorized.ShouldBeFalse();
|
|
info.IsAlarm.ShouldBeFalse();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Confirms that primitive-name and attribute-source fields can be populated for extended metadata rows.
|
|
/// </summary>
|
|
[Fact]
|
|
public void ExtendedFields_CanBeSet()
|
|
{
|
|
var info = new GalaxyAttributeInfo
|
|
{
|
|
PrimitiveName = "UDO",
|
|
AttributeSource = "primitive"
|
|
};
|
|
info.PrimitiveName.ShouldBe("UDO");
|
|
info.AttributeSource.ShouldBe("primitive");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Confirms that standard attribute rows leave the extended metadata fields empty.
|
|
/// </summary>
|
|
[Fact]
|
|
public void StandardAttributes_HaveEmptyExtendedFields()
|
|
{
|
|
var info = new GalaxyAttributeInfo
|
|
{
|
|
GobjectId = 1,
|
|
TagName = "TestObj",
|
|
AttributeName = "MachineID",
|
|
FullTagReference = "TestObj.MachineID",
|
|
MxDataType = 5
|
|
};
|
|
info.PrimitiveName.ShouldBe("");
|
|
info.AttributeSource.ShouldBe("");
|
|
}
|
|
}
|
|
}
|