Files
UA-.NETStandard/tests/Opc.Ua.OpenUsd.Tests/IntentOpenUsdRepresentationTests.cs
Marc Schier 6795073d2d Mount OpenUSD representations with HasAddIn (#4239)
# Description

Mount every `OpenUsdRepresentation` AddIn with `HasAddIn` rather than
plain
`HasComponent`.

- Correct the `IOpenUsdRepresentedType` placeholder in the OpenUSD
NodeSet.
- Route Pump, Minimal Robot, and Intent sample authoring through the
shared
  `CreateRepresentation` helper.
- Remove redundant representation subtree rebasing from sample call
sites.
- Add model, in-process sample, and over-the-wire regression coverage.
- Update the OpenUSD documentation and sample diagrams.

`HasAddIn` is a subtype of `HasComponent`, so the incorrect reference
still
browsed and rendered successfully but failed companion-model
conformance.

## Related Issues

No related issue.

## Validation

- `Opc.Ua.OpenUsd.Tests`: 914 passed on .NET 10.
- Pump and Minimal Robot sample builds completed without warnings.
- Pump and Robot `RepresentationsAreMountedWithHasAddInAsync` E2E tests
passed.

## Checklist

- [ ] I have signed the
[CLA](https://opcfoundation.org/license/cla/ContributorLicenseAgreementv1.0.pdf)
and read the
[CONTRIBUTING](https://github.com/OPCFoundation/UA-.NETStandard/blob/master/CONTRIBUTING.md)
doc.
- [x] I have added tests that prove my fix is effective or that my
feature works and increased code coverage.
- [x] I have added all necessary documentation.
- [x] I have verified that my changes do not introduce (new) build or
analyzer warnings.
- [ ] I ran **all** tests locally using the **UA.slnx** solution against
at least .net **framework** and .net **10**, and all passed.
- [ ] I fixed **all** failing and flaky tests in the CI pipelines and
**all** CodeQL warnings.
- [x] I have addressed **all** PR feedback received.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 19119d71-e1bc-41c9-ba0d-2d1dea437167
2026-08-12 11:31:55 +02:00

62 lines
2.4 KiB
C#

/* ========================================================================
* 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/
* ======================================================================*/
#if NET10_0
using NUnit.Framework;
using Opc.Ua.OpenUsd.Server.Tests;
using Robotics.IntentEnabledRobot;
namespace Opc.Ua.OpenUsd.Tests
{
[TestFixture]
[Category("OpenUsd")]
[Category("RobotIntent")]
public sealed class IntentOpenUsdRepresentationTests
{
[Test]
public void IntentSampleMountsRepresentationsAsAddIns()
{
(SystemContext context, ushort ns) = OpenUsdAuthoringHarness.NewContext();
OpenUsdRootState root = OpenUsdAuthoringHarness.NewFacility(context, ns);
OpenUsdStageState stage = OpenUsdAuthoringHarness.NewStage(context, root, ns, "Cell");
BaseObjectState owner = OpenUsdAuthoringHarness.NewOwner(context, ns, "Controller");
_ = IntentRobotCell.AttachRepresentation(
context,
stage,
owner,
"/World/IntentCommand",
ns);
OpenUsdRepresentationMountAssert.AllAreAddIns(context, owner);
}
}
}
#endif