Search in sources :

Example 1 with UaReference

use of com.prosysopc.ua.nodes.UaReference in project FAAAST-Service by FraunhoferIOSB.

the class TestUtils method checkType.

/**
 * Checks if the given Node is of the desired type.
 *
 * @param client The OPC UA Client
 * @param node The desired Node
 * @param typeNode The expected type.
 * @throws ServiceException If the operation fails
 * @throws AddressSpaceException If the operation fails
 * @throws ServiceResultException If the operation fails
 */
public static void checkType(UaClient client, NodeId node, NodeId typeNode) throws ServiceException, AddressSpaceException, ServiceResultException {
    UaNode uanode = client.getAddressSpace().getNode(node);
    Assert.assertNotNull("checkType UaNode Null", uanode);
    UaReference ref = uanode.getReference(Identifiers.HasTypeDefinition, false);
    Assert.assertNotNull("checkType Reference Null", ref);
    NodeId refId = client.getAddressSpace().getNamespaceTable().toNodeId(ref.getTargetId());
    Assert.assertEquals("type not equal", typeNode, refId);
}
Also used : NodeId(com.prosysopc.ua.stack.builtintypes.NodeId) ExpandedNodeId(com.prosysopc.ua.stack.builtintypes.ExpandedNodeId) UaNode(com.prosysopc.ua.nodes.UaNode) UaReference(com.prosysopc.ua.nodes.UaReference)

Aggregations

UaNode (com.prosysopc.ua.nodes.UaNode)1 UaReference (com.prosysopc.ua.nodes.UaReference)1 ExpandedNodeId (com.prosysopc.ua.stack.builtintypes.ExpandedNodeId)1 NodeId (com.prosysopc.ua.stack.builtintypes.NodeId)1