dc6cc7779d
Projected variables advertise Historizing + the HistoryRead access bit (never HistoryWrite) only when the definition says so. The Raw/Processed/AtTime overrides split authorized handles: local ones go to the H1 port unchanged, projected ones to IProjectedHistoryAccess, each written back to its own slot; nothing waits under Lock. HistoryCursorKind.Remote stores the projection's cursor in the SDK session store; disposing the point (session close, eviction, releaseContinuationPoints, faulted request) releases it at the origin. Mapped HistoryRead is opened deliberately in DataPlaneAuthorizer; other mapped operations outside the allowlist stay closed.
40 lines
2.1 KiB
C#
40 lines
2.1 KiB
C#
using Opc.Ua;
|
|
using Opc.Ua.Client;
|
|
using Shouldly;
|
|
using Xunit;
|
|
|
|
namespace ZB.MOM.WW.OtOpcUa.Runtime.Tests.DataConnections;
|
|
|
|
public sealed partial class GrpcDataConfiguredDiscoveryWireTests
|
|
{
|
|
/// <summary>
|
|
/// H2 review 7: <c>DataOperationPolicy</c> now maps OPC UA HistoryRead to the mapping's HistoryRead bit, so a mapped
|
|
/// HistoryRead is AUTHORISABLE before H3 projects history. Pin that a projected node with the mapping bit AND a local
|
|
/// HistoryRead grant still answers a clean refusal — never data, never a fault — until H3.
|
|
/// </summary>
|
|
[Fact(Timeout = 90000)]
|
|
[Trait("Phase", "H2")]
|
|
public async Task HistoryRead_on_a_projected_node_stays_a_clean_refusal_until_H3()
|
|
{
|
|
using var origin = new LocalDataFixture(servingGeneration: 1);
|
|
await WithComposedServer(origin, origin.Raw, async (session, _, _, _, _, _, anchor) =>
|
|
{
|
|
var client = (SessionClient)session;
|
|
await BrowseAll(client, anchor, 1);
|
|
var details = new ReadRawModifiedDetails
|
|
{
|
|
StartTime = DateTime.UtcNow.AddHours(-1), EndTime = DateTime.UtcNow, NumValuesPerNode = 10,
|
|
IsReadModified = false, ReturnBounds = false,
|
|
};
|
|
var response = await client.HistoryReadAsync(new RequestHeader(), new ExtensionObject(details), TimestampsToReturn.Both, false,
|
|
[new HistoryReadValueId { NodeId = anchor }], TestContext.Current.CancellationToken);
|
|
var result = response.Results.ToArray()!.Single();
|
|
// Pinned: the projected variable carries no HistoryRead access-level bit, so the SDK refuses before any history code.
|
|
result.StatusCode.Code.ShouldBe(StatusCodes.BadHistoryOperationUnsupported.Code);
|
|
(result.HistoryData.IsNull || ExtensionObject.ToEncodeable(result.HistoryData) is not HistoryData { DataValues.Count: > 0 })
|
|
.ShouldBeTrue("no data is served from a projected node before H3");
|
|
result.ContinuationPoint.IsEmpty.ShouldBeTrue();
|
|
}, localPermissions: 15, allowHistory: true);
|
|
}
|
|
}
|