feat(worker): implement 6 MXAccess COM commands in executor
Wire up the previously-unimplemented Suspend, Activate, AuthenticateUser, ArchestrAUserToId, AddBufferedItem, and SetBufferedUpdateInterval command kinds in MxAccessCommandExecutor. These are real COM calls and run on the STA via the executor. - IMxAccessServer gains the 6 methods; MxAccessComServer routes them to the right interface version (Suspend/Activate -> ILMXProxyServer4 out MxStatus, AuthenticateUser -> base ILMXProxyServer, ArchestrAUserToId -> ILMXProxyServer2, AddBufferedItem/SetBufferedUpdateInterval -> ILMXProxyServer5). - Suspend/Activate surface the native MxStatus, converted to MxStatusProxy via the existing MxStatusProxyConverter. - AuthenticateUser hands the credential straight to MXAccess and never logs it; native HResult failures propagate via the dispatcher. - MxAccessSession gains matching pass-throughs; AddBufferedItem registers the item handle in the handle registry. - Unit tests (fake IMxAccessServer / fake COM object) cover each arm plus a password-non-leak assertion; existing IMxAccessServer fakes updated. No proto changes (all request/reply messages already exist).
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using ZB.MOM.WW.MxGateway.Worker.Conversion;
|
||||
using ZB.MOM.WW.MxGateway.Worker.MxAccess;
|
||||
|
||||
namespace ZB.MOM.WW.MxGateway.Worker.Tests.TestSupport;
|
||||
@@ -55,14 +56,10 @@ internal sealed class NoopMxAccessServer : IMxAccessServer
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Suspend(int serverHandle, int itemHandle)
|
||||
{
|
||||
}
|
||||
public object Suspend(int serverHandle, int itemHandle) => new FakeMxStatus();
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Activate(int serverHandle, int itemHandle)
|
||||
{
|
||||
}
|
||||
public object Activate(int serverHandle, int itemHandle) => new FakeMxStatus();
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Write(int serverHandle, int itemHandle, object? value, int userId)
|
||||
@@ -85,8 +82,29 @@ internal sealed class NoopMxAccessServer : IMxAccessServer
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public int AuthenticateUser(string userName, string password) => 0;
|
||||
public int AuthenticateUser(int serverHandle, string verifyUser, string verifyUserPassword) => 0;
|
||||
|
||||
/// <inheritdoc />
|
||||
public int ArchestrAUserToId(string userName) => 0;
|
||||
public int ArchestrAUserToId(int serverHandle, string userIdGuid) => 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Minimal stand-in for the native <c>ArchestrA.MxAccess.MxStatus</c> struct.
|
||||
/// <see cref="MxStatusProxyConverter"/> reflects over the public
|
||||
/// <c>success</c>, <c>category</c>, <c>detectedBy</c>, and <c>detail</c>
|
||||
/// fields, so this fake exposes the same field shape with all-OK values.
|
||||
/// </summary>
|
||||
internal sealed class FakeMxStatus
|
||||
{
|
||||
/// <summary>Success indicator field read by the status converter.</summary>
|
||||
public int success;
|
||||
|
||||
/// <summary>Status category field read by the status converter.</summary>
|
||||
public int category;
|
||||
|
||||
/// <summary>Status detected-by field read by the status converter.</summary>
|
||||
public int detectedBy;
|
||||
|
||||
/// <summary>Status detail field read by the status converter.</summary>
|
||||
public int detail;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user