2 #define BOOST_TEST_MODULE (databaseconfiguration test)
4 #include "boost/test/auto_unit_test.hpp"
14 #include "otsdaq-core/ConfigurationInterface/ConfigurationInterface.h"
15 #include "otsdaq-core/ConfigurationInterface/ConfigurationManager.h"
19 #include "artdaq-database/JsonDocument/JSONDocument.h"
20 #include "artdaq-database/StorageProviders/FileSystemDB/provider_filedb_index.h"
21 #include "otsdaq-core/PluginMakers/MakeInterface.h"
22 #include "otsdaq-core/PluginMakers/MakeInterfaceTable.h"
26 BOOST_AUTO_TEST_SUITE(databaseconfiguration_test)
33 std::vector<std::string> configTables;
36 setenv(
"CONFIGURATION_DATA_PATH",
37 (std::string(__ENV__(
"USER_DATA")) +
"/ConfigurationDataExamples").c_str(),
39 std::string configDir = std::string(__ENV__(
"CONFIGURATION_DATA_PATH")) +
'/';
44 setenv(
"CONFIGURATION_TYPE",
"File", 1);
48 __COUT__ <<
"ConfigurationDir: " << configDir << __E__;
53 if((dp = opendir(configDir.c_str())) == 0)
55 __COUT__ <<
"ERROR:(" << errno <<
"). Can't open directory: " << configDir
60 const unsigned char isDir = 0x4;
61 while((dirp = readdir(dp)) != 0)
62 if(dirp->d_type == isDir && dirp->d_name[0] !=
'.')
64 __COUT__ << dirp->d_name << __E__;
65 configTables.push_back(dirp->d_name);
73 for(
unsigned int i = 0; i < configTables.size(); ++i)
75 theInterface_ = ConfigurationInterface::getInstance(
true);
79 __COUT__ << (i + 1) <<
" of " << configTables.size() <<
": " << configTables[i]
90 __COUT__ <<
"loaded " << configTables[i] << __E__;
95 __COUT__ <<
"Current version: " << base->getViewVersion() << __E__;
100 theInterface_ = ConfigurationInterface::getInstance(
false);
107 base->createTemporaryView(
TableVersion(TableVersion::DEFAULT));
108 theInterface_->saveNewVersion(base, tmpView);
115 __COUT__ <<
"end of debugging Configuration!" << __E__;
122 std::vector<std::string> configTables;
125 setenv(
"CONFIGURATION_DATA_PATH",
126 (std::string(__ENV__(
"USER_DATA")) +
"/ConfigurationDataExamples").c_str(),
128 std::string configDir = std::string(__ENV__(
"CONFIGURATION_DATA_PATH")) +
'/';
133 setenv(
"CONFIGURATION_TYPE",
"File", 1);
137 __COUT__ <<
"ConfigurationDir: " << configDir << __E__;
142 if((dp = opendir(configDir.c_str())) == 0)
144 __COUT__ <<
"ERROR:(" << errno <<
"). Can't open directory: " << configDir
149 const unsigned char isDir = 0x4;
150 while((dirp = readdir(dp)) != 0)
151 if(dirp->d_type == isDir && dirp->d_name[0] !=
'.')
153 __COUT__ << dirp->d_name << __E__;
154 configTables.push_back(dirp->d_name);
162 for(
unsigned int i = 0; i < configTables.size(); ++i)
164 theInterface_ = ConfigurationInterface::getInstance(
false);
168 __COUT__ << (i + 1) <<
" of " << configTables.size() <<
": " << configTables[i]
179 __COUT__ <<
"loaded " << configTables[i] << __E__;
182 __COUT__ <<
"Current version: " << base->getViewVersion() << __E__;
192 base->createTemporaryView(
TableVersion(TableVersion::DEFAULT));
193 theInterface_->saveNewVersion(base, tmpView);
199 __COUT__ <<
"end of debugging Configuration!" << __E__;
203 BOOST_AUTO_TEST_SUITE_END()