6 #include <boost/test/included/unit_test.hpp>
8 using namespace boost::unit_test_framework;
13 static void testExampleSet();
16 void checkNode(
const std::string& node, std::shared_ptr<ua_uaadapter> uaadapter) {
17 UA_NodeId result = UA_NODEID_NULL;
18 UA_Server_readNodeId(uaadapter->
getMappedServer(), UA_NODEID_STRING(1,
const_cast<char*
>(node.c_str())), &result);
19 BOOST_CHECK(UA_NodeId_isNull(&result) == UA_FALSE);
20 UA_NodeId_clear(&result);
24 cout <<
"General PV mapping test." << endl;
38 checkNode(
"llrfCtrl_hzdr/1/FOLDERDir", uaadapter);
39 checkNode(
"llrfCtrl_hzdr/copyWithSourceTestDir", uaadapter);
40 checkNode(
"llrfCtrl_hzdr/copyWithSourceTest/defaultSepDir", uaadapter);
41 checkNode(
"llrfCtrl_hzdr/copyWithSourceTest/defaultSep/stringScalar", uaadapter);
42 checkNode(
"llrfCtrl_hzdr/linkWithSourceTestDir", uaadapter);
43 UA_BrowseDescription bd;
44 bd.includeSubtypes =
false;
45 bd.nodeId = UA_NODEID_STRING(1, (
char*)
"llrfCtrl_hzdr/linkWithSourceTestDir");
46 bd.referenceTypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_ORGANIZES);
47 bd.resultMask = UA_BROWSERESULTMASK_BROWSENAME;
48 bd.nodeClassMask = UA_NODECLASS_OBJECT;
49 bd.browseDirection = UA_BROWSEDIRECTION_FORWARD;
50 UA_BrowseResult br = UA_Server_browse(uaadapter->
getMappedServer(), 1000, &bd);
51 BOOST_CHECK(br.referencesSize > 0);
52 for(
size_t j = 0; j < br.referencesSize; ++j) {
53 UA_String compareString = UA_STRING((
char*)
"defaultSep");
54 BOOST_CHECK(UA_String_equal(&br.references[j].browseName.name, &compareString) == UA_TRUE);
56 UA_BrowseResult_clear(&br);
58 bd.nodeId = UA_NODEID_STRING(1, (
char*)
"llrfCtrl_hzdr/2/FOLDERDir");
59 bd.referenceTypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT);
60 bd.resultMask = UA_BROWSERESULTMASK_BROWSENAME;
61 bd.nodeClassMask = UA_NODECLASS_VARIABLE;
62 bd.browseDirection = UA_BROWSEDIRECTION_BOTH;
64 BOOST_CHECK(br.referencesSize > 0);
65 for(
size_t j = 0; j < br.referencesSize; ++j) {
66 UA_String compareString = UA_STRING((
char*)
"stringScalar");
67 BOOST_CHECK(UA_String_equal(&br.references[j].browseName.name, &compareString) == UA_TRUE);
69 UA_BrowseResult_clear(&br);