34 #include <gmock/gmock.h> 35 #include <gtest/gtest.h> 68 OpcUa::NodeManagementServices::SharedPtr nodes = Services->NodeManagement();
80 std::vector<OpcUa::AddNodesResult> result = nodes->AddNodes({item});
81 return result[0].AddedNodeId;
95 Services->NodeManagement()->AddNodes({variable});
105 object.ParentNodeId = objectId;
109 object.Attributes = attrs;
110 Services->NodeManagement()->AddNodes({
object});
116 const OpcUa::NodeId & resultTypeId = CreateEmptyObjectType();
117 const OpcUa::NodeId & objectTypeWithVar = CreateObjectTypeWithOneVariable();
121 object.ParentNodeId = resultTypeId;
123 object.TypeDefinition = objectTypeWithVar;
126 object.Attributes = attrs;
127 Services->NodeManagement()->AddNodes({
object});
165 const char * objectDesc =
"Empty object.";
171 ASSERT_EQ(
object.GetBrowseName(), browseName) <<
"Real name: " <<
object.GetBrowseName().Name;
173 std::vector<OpcUa::Model::Variable> variables =
object.GetVariables();
179 const OpcUa::NodeId & typeId = CreateObjectTypeWithOneVariable();
182 const char * objectDesc =
"object_with_var.";
188 ASSERT_EQ(
object.GetBrowseName(), browseName) <<
"Real name: " <<
object.GetBrowseName().Name;
190 std::vector<OpcUa::Model::Variable> variables =
object.GetVariables();
196 const OpcUa::NodeId & typeId = CreateObjectTypeWithOneUntypedObject();
199 const char * objectDesc =
"object_with_var.";
205 ASSERT_EQ(
object.GetBrowseName(), browseName) <<
"Real name: " <<
object.GetBrowseName().Name;
207 std::vector<OpcUa::Model::Object>
objects =
object.GetObjects();
220 const OpcUa::NodeId & typeId = CreateObjectTypeWithOneTypedObject();
224 const char * objectDesc =
"object_with_var.";
237 ASSERT_EQ(
object.GetBrowseName(), browseName) <<
"Real name: " <<
object.GetBrowseName().Name;
240 std::vector<OpcUa::Model::Object>
objects =
object.GetObjects();
246 std::vector<OpcUa::Model::Variable> variables;
275 std::cout <<
"1" << std::endl;
277 std::cout <<
"2" << std::endl;
279 std::cout <<
"3" << std::endl;
281 std::cout <<
"4" << std::endl;
283 std::cout <<
"5" << std::endl;
285 std::cout <<
"6" << std::endl;
287 std::cout <<
"7" << std::endl;
const char ServerStatus[]
Object GetObject(const NodeId &id) const
TEST_F(TestInfoTest, Names)
OpcUa::NodeId CreateObjectTypeWithOneTypedObject()
OpcUa::Services::SharedPtr Services
LocalizedText Description
const char ServicesRegistryAddonId[]
DataValue GetValue() const
OpcUa::RelativePathElement GetHierarchicalElement(const std::string &browseName)
OpcUa::NodeId CreateEmptyObjectType()
OpcUa::NodeId CreateObjectTypeWithOneVariable()
#define ASSERT_NE(val1, val2)
Variable CreateVariable(const QualifiedName &browseName, const Variant &value)
Create a new variable.
void RegisterStandardNamespace(Common::AddonsManager &addons)
AddonsManager::UniquePtr CreateAddonsManager(const Common::Logger::SharedPtr &logger)
Get instance of addons core.
std::vector< RelativePathElement > Elements
void RegisterServicesRegistry(Common::AddonsManager &addons)
LocalizedText DisplayName
void RegisterAddressSpace(Common::AddonsManager &addons)
#define ASSERT_NO_THROW(statement)
QualifiedName GetBrowseName() const
OpcUa::NodeId CreateObjectTypeWithOneUntypedObject()
Object RootObject() const
#define ASSERT_EQ(val1, val2)
virtual std::shared_ptr< OpcUa::Services > GetServer() const =0
Variable GetVariable(const QualifiedName &name) const
Get variable of the object by it name.
ObjectType GetObjectType(const NodeId &typeId) const
Object CreateObject(const ObjectType &type, const QualifiedName &browseName)
NodeAttributes Attributes
Common::AddonsManager::UniquePtr Addons
LocalizedText DisplayName
Common::Logger::SharedPtr Logger
#define EXPECT_EQ(expected, actual)
std::shared_ptr< logger > stderr_color_mt(const std::string &logger_name)
LocalizedText GetDisplayName() const
LocalizedText DisplayName