/* ========================================================================
* Copyright (c) 2005-2026 The OPC Foundation, Inc. All rights reserved.
*
* OPC Foundation MIT License 1.00
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* The complete license agreement can be found here:
* http://opcfoundation.org/License/MIT/1.00/
* ======================================================================*/
using Opc.Ua.CoverageTest;
using Opc.Ua.CoverageTestSecondary;
using Quickstarts.ReferenceServer;
namespace Opc.Ua.Server.Tests.CoverageNodeSet
{
///
/// A that hosts the kitchen-sink coverage
/// model through the source-generation pipeline. The model XML is
/// consumed at compile time via
/// <AdditionalFiles ModelSourceGeneratorPrefix="Opc.Ua.CoverageTest">;
/// the generated AddOpcUaCoverageTest extension composes the
/// predefined nodes — each authored node materialising as its strongly
/// typed, generated subclass — inside the
/// hand-written .
///
public sealed class CoverageTestSourceGenServer : ReferenceServer
{
///
/// The model namespace URI shared by both coverage pipelines.
///
public const string NamespaceUri = CoverageTestCatalogue.NamespaceUri;
///
/// Initializes the server and registers the source-generation node
/// manager factory for the coverage model.
///
///
/// Telemetry context forwarded to the base server.
///
public CoverageTestSourceGenServer(ITelemetryContext telemetry)
: base(telemetry)
{
AddNodeManager(new CoverageTestNodeManagerFactory());
}
}
///
/// The for the source-generation coverage
/// node manager.
///
public sealed class CoverageTestNodeManagerFactory : INodeManagerFactory
{
///
public ArrayOf NamespacesUris =>
[CoverageTestCatalogue.NamespaceUri, CoverageTestCatalogue.SecondaryNamespaceUri];
///
public INodeManager Create(IServerInternal server, ApplicationConfiguration configuration)
{
return new CoverageTestNodeManager(server, configuration);
}
}
///
/// A that composes the coverage model from
/// the source-generated AddOpcUaCoverageTest extension. It owns both
/// the primary and the secondary (dependent) namespaces and composes both
/// generated node sets.
///
public sealed class CoverageTestNodeManager : CustomNodeManager2
{
///
/// Initializes the node manager for the coverage model namespaces.
///
///
/// The server that owns the node manager.
///
///
/// The application configuration.
///
public CoverageTestNodeManager(
IServerInternal server,
ApplicationConfiguration configuration)
: base(
server,
configuration,
CoverageTestCatalogue.NamespaceUri,
CoverageTestCatalogue.SecondaryNamespaceUri)
{
}
///
protected override NodeStateCollection LoadPredefinedNodes(ISystemContext context)
{
var predefinedNodes = new NodeStateCollection();
predefinedNodes.AddOpcUaCoverageTest(context);
predefinedNodes.AddOpcUaCoverageTestSecondary(context);
return predefinedNodes;
}
}
}