Horizon Official Technical Documentation
AuthServerTest.cpp File Reference
#include "Server/Auth/Auth.hpp"
#include <boost/test/included/unit_test.hpp>
+ Include dependency graph for AuthServerTest.cpp:

Macros

#define BOOST_TEST_MODULE   AuthServerTest
 

Functions

 BOOST_AUTO_TEST_CASE (AuthServerTest)
 
 BOOST_AUTO_TEST_CASE (DatabaseProcessTest)
 

Macro Definition Documentation

◆ BOOST_TEST_MODULE

#define BOOST_TEST_MODULE   AuthServerTest

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/2]

BOOST_AUTO_TEST_CASE ( AuthServerTest  )
39{
40 try {
41 sAuth->general_conf().set_test_run(TEST_RUN_MINIMAL);
42
43 sAuth->general_conf().set_config_file_path("config/auth-server.lua.dist");
44 sAuth->read_config();
46 // Running initialize() in a separate thread will cause a memory leak due to the singleton pattern.
47 // Always invoked on the main thread.
48 sAuth->initialize();
49 } catch(std::length_error &e) {
50 std::cerr << "Exception caught: " << e.what() << std::endl;
51 } catch(std::bad_alloc &e) {
52 std::cerr << "Exception caught: " << e.what() << std::endl;
53 } catch(std::exception &e) {
54 std::cerr << "Exception caught: " << e.what() << std::endl;
55 } catch(...) {
56 std::cerr << "Unknown exception caught." << std::endl;
57 }
58}
#define sAuth
Definition: Auth.hpp:131
@ TEST_RUN_MINIMAL
Definition: ServerConfiguration.hpp:40
void set_shutdown_signal(int signal)
Definition: Server.hpp:73
@ SHUTDOWN_INITIATED
Definition: Server.hpp:65

References sAuth, set_shutdown_signal(), SHUTDOWN_INITIATED, and TEST_RUN_MINIMAL.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/2]

BOOST_AUTO_TEST_CASE ( DatabaseProcessTest  )
61{
62 // Feel free to change any of these values to what you see suit
63 std::string host = "127.0.0.1";
64 int port = 3306;
65 std::string user = "horizon";
66 std::string pass = "horizon";
67 std::string database = "horizon";
68 int segment_number = -1;
69
70 // Create the component
71 boost::asio::io_context ctx;
72 DatabaseProcess proc;
73
74 // Use it
75 try {
76 proc.initialize(ctx, segment_number, host, port, user, pass, database);
77 } catch(const std::exception &e) {
78 std::cerr << "Exception caught: " << e.what() << std::endl;
79 }
80}
Definition: Server.hpp:371
void initialize(int segment_number=1) override
Definition: Server.hpp:382

References DatabaseProcess::initialize().

+ Here is the call graph for this function: