00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 #include "common.h" 00012 00013 #include <opc/ua/client/remote_server.h> 00014 00015 #include <stdexcept> 00016 00017 TEST(Server, EstablishValidConnection) 00018 { 00019 const std::string endpoint = GetEndpoint(); 00020 std::unique_ptr<OpcUa::Services> computer; 00021 ASSERT_NO_THROW(computer = OpcUa::Connect(endpoint)); 00022 ASSERT_TRUE(computer.get()); 00023 } 00024 00025 TEST(Server, ErrorIfInvalidUri) 00026 { 00027 const std::string endpoint = "invalid uri"; 00028 ASSERT_THROW(OpcUa::Connect(endpoint), std::logic_error); 00029 } 00030 00031 TEST(Server, ErrorIdUnknownHost) 00032 { 00033 const std::string endpoint = "opc.tcp://host.at.tne.mars:4840"; 00034 ASSERT_THROW(OpcUa::Connect(endpoint), std::logic_error); 00035 } 00036