computer_connect.cpp
Go to the documentation of this file.
1 
11 #include "common.h"
12 
13 #include <opc/ua/client/remote_server.h>
14 
15 #include <stdexcept>
16 
17 TEST(Server, EstablishValidConnection)
18 {
19  const std::string endpoint = GetEndpoint();
20  std::unique_ptr<OpcUa::Services> computer;
21  ASSERT_NO_THROW(computer = OpcUa::Connect(endpoint));
22  ASSERT_TRUE(computer.get());
23 }
24 
25 TEST(Server, ErrorIfInvalidUri)
26 {
27  const std::string endpoint = "invalid uri";
28  ASSERT_THROW(OpcUa::Connect(endpoint), std::logic_error);
29 }
30 
31 TEST(Server, ErrorIdUnknownHost)
32 {
33  const std::string endpoint = "opc.tcp://host.at.tne.mars:4840";
34  ASSERT_THROW(OpcUa::Connect(endpoint), std::logic_error);
35 }
36 
TEST(Server, EstablishValidConnection)
Test Remote computer connection. GNU LGPL.
#define ASSERT_THROW(statement, expected_exception)
#define ASSERT_NO_THROW(statement)
#define ASSERT_TRUE(condition)
EndpointDescription GetEndpoint(OpcUa::Binary::IOStream &stream)
std::unique_ptr< RemoteConnection > Connect(const std::string &host, unsigned port, const Common::Logger::SharedPtr &logger)
const char Server[]
Definition: strings.h:121
computer
Definition: test.py:6


ros_opcua_impl_freeopcua
Author(s): Denis Štogl
autogenerated on Tue Jan 19 2021 03:06:04