2 #define BOOST_TEST_MODULE (databaseconfiguration test)
4 #include "boost/test/auto_unit_test.hpp"
14 #include "otsdaq/ConfigurationInterface/ConfigurationInterface.h"
15 #include "otsdaq/ConfigurationInterface/ConfigurationManager.h"
19 #include "artdaq-database/JsonDocument/JSONDocument.h"
20 #include "artdaq-database/StorageProviders/FileSystemDB/provider_filedb_index.h"
21 #include "otsdaq/PluginMakers/MakeInterface.h"
22 #include "otsdaq/PluginMakers/MakeInterfaceTable.h"
26 BOOST_AUTO_TEST_SUITE(databaseconfiguration_test)
33 std::vector<std::string> configTables;
36 setenv(
"CONFIGURATION_DATA_PATH", (std::string(__ENV__(
"USER_DATA")) +
"/ConfigurationDataExamples").c_str(), 1);
37 std::string configDir = std::string(__ENV__(
"CONFIGURATION_DATA_PATH")) +
'/';
42 setenv(
"CONFIGURATION_TYPE",
"File", 1);
46 __COUT__ <<
"ConfigurationDir: " << configDir << __E__;
51 if((dp = opendir(configDir.c_str())) == 0)
53 __COUT__ <<
"ERROR:(" << errno <<
"). Can't open directory: " << configDir << __E__;
57 const unsigned char isDir = 0x4;
58 while((dirp = readdir(dp)) != 0)
59 if(dirp->d_type == isDir && dirp->d_name[0] !=
'.')
61 __COUT__ << dirp->d_name << __E__;
62 configTables.push_back(dirp->d_name);
70 for(
unsigned int i = 0; i < configTables.size(); ++i)
72 theInterface_ = ConfigurationInterface::getInstance(
true);
76 __COUT__ << (i + 1) <<
" of " << configTables.size() <<
": " << configTables[i] << __E__;
78 theInterface_->get(base, configTables[i], 0, 0,
false,
81 __COUT__ <<
"loaded " << configTables[i] << __E__;
84 __COUT__ <<
"Current version: " << base->getViewVersion() << __E__;
89 theInterface_ = ConfigurationInterface::getInstance(
false);
96 theInterface_->saveNewVersion(base, tmpView);
103 __COUT__ <<
"end of debugging Configuration!" << __E__;
110 std::vector<std::string> configTables;
113 setenv(
"CONFIGURATION_DATA_PATH", (std::string(__ENV__(
"USER_DATA")) +
"/ConfigurationDataExamples").c_str(), 1);
114 std::string configDir = std::string(__ENV__(
"CONFIGURATION_DATA_PATH")) +
'/';
119 setenv(
"CONFIGURATION_TYPE",
"File", 1);
123 __COUT__ <<
"ConfigurationDir: " << configDir << __E__;
128 if((dp = opendir(configDir.c_str())) == 0)
130 __COUT__ <<
"ERROR:(" << errno <<
"). Can't open directory: " << configDir << __E__;
134 const unsigned char isDir = 0x4;
135 while((dirp = readdir(dp)) != 0)
136 if(dirp->d_type == isDir && dirp->d_name[0] !=
'.')
138 __COUT__ << dirp->d_name << __E__;
139 configTables.push_back(dirp->d_name);
147 for(
unsigned int i = 0; i < configTables.size(); ++i)
149 theInterface_ = ConfigurationInterface::getInstance(
false);
153 __COUT__ << (i + 1) <<
" of " << configTables.size() <<
": " << configTables[i] << __E__;
155 theInterface_->get(base, configTables[i], 0, 0,
false,
158 __COUT__ <<
"loaded " << configTables[i] << __E__;
161 __COUT__ <<
"Current version: " << base->getViewVersion() << __E__;
171 theInterface_->saveNewVersion(base, tmpView);
177 __COUT__ <<
"end of debugging Configuration!" << __E__;
181 BOOST_AUTO_TEST_SUITE_END()