9 #include <utl/Reader.h>
10 #include <cppunit/extensions/HelperMacros.h>
11 #include <mysql/mysql.h>
22 CPPUNIT_TEST(testMasterConnection);
23 CPPUNIT_TEST_SUITE_END();
35 Reader reader(MASTERDBLIST, Reader::eSCHEMA);
37 const string database =
"Atm_Aerosol_1_A";
39 bool connectionPresent =
false;
45 const auto servers = dbB.GetChild(
"server").Get<vector<string>>();
47 for (
const auto& ser : servers) {
49 cerr <<
"Testing connection to " << ser << endl;
51 const auto userName = dbB.GetChild(
"userName").Get<
string>();
52 const auto password = dbB.GetChild(
"password").Get<
string>();
53 const auto port = dbB.GetChild(
"port").Get<
unsigned int>();
55 MYSQL*
const mySQL = mysql_init(
nullptr);
56 CPPUNIT_ASSERT(mySQL);
58 if (mysql_real_connect(mySQL, ser.c_str(), userName.c_str(), password.c_str(),
59 database.c_str(), port,
nullptr, 0)) {
60 connectionPresent =
true;
64 cerr <<
"Connection to the database '" << database <<
"' at "
65 << userName <<
':' << password <<
'@' << ser <<
':' << port <<
" "
66 "failed. Error message: \"" << mysql_error(mySQL) <<
'"' << endl;
73 if (connectionPresent)
78 CPPUNIT_ASSERT(connectionPresent);
CPPUNIT_TEST_SUITE_REGISTRATION(testAiresShowerFile)
Branch GetTopBranch() const
Get the top Branch (represents same entity as document node)
Branch GetNextSibling() const
Get next sibling of this branch.
Utility for parsing XML files.
Class representing a document branch.
virtual ~DBConnectionTest()
void testMasterConnection()
Branch GetFirstChild() const
Get first child of this Branch.