1 #define BOOST_TEST_MODULE ( databaseconfiguration test)
3 #include "boost/test/auto_unit_test.hpp"
12 #include "otsdaq-core/ConfigurationInterface/ConfigurationManager.h"
13 #include "otsdaq-core/ConfigurationInterface/ConfigurationInterface.h"
17 #include "otsdaq-core/PluginMakers/MakeInterfaceConfiguration.h"
18 #include "otsdaq-core/PluginMakers/MakeInterface.h"
19 #include "artdaq-database/StorageProviders/FileSystemDB/provider_filedb_index.h"
20 #include "artdaq-database/JsonDocument/JSONDocument.h"
24 BOOST_AUTO_TEST_SUITE( databaseconfiguration_test )
32 std::vector<std::string> configTables;
35 setenv(
"CONFIGURATION_DATA_PATH",(std::string(getenv(
"USER_DATA")) +
"/ConfigurationDataExamples").c_str(),1);
36 std::string configDir = std::string(getenv(
"CONFIGURATION_DATA_PATH")) +
'/';
40 setenv(
"CONFIGURATION_TYPE",
"File",1);
44 std::cout << __COUT_HDR_FL__ <<
"ConfigurationDir: " << configDir << std::endl;
49 if((dp = opendir(configDir.c_str())) == 0)
51 std::cout << __COUT_HDR_FL__<<
"ERROR:(" << errno <<
"). Can't open directory: " << configDir << std::endl;
55 const unsigned char isDir = 0x4;
56 while ((dirp = readdir(dp)) != 0)
57 if(dirp->d_type == isDir && dirp->d_name[0] !=
'.' )
59 std::cout << __COUT_HDR_FL__<< dirp->d_name << std::endl;
60 configTables.push_back(dirp->d_name);
68 for(
unsigned int i = 0; i < configTables.size(); ++i)
70 theInterface_ = ConfigurationInterface::getInstance(
true);
72 std::cout << __COUT_HDR_FL__ << std::endl;
73 std::cout << __COUT_HDR_FL__ << std::endl;
74 std::cout << __COUT_HDR_FL__ << (i+1) <<
" of " << configTables.size() <<
": " << configTables[i] << std::endl;
76 theInterface_->get(base,configTables[i], 0, 0,
false,
79 std::cout << __COUT_HDR_FL__ <<
"loaded " << configTables[i]<< std::endl;
86 std::cout << __COUT_HDR_FL__ <<
"Current version: " << base->getViewVersion() << std::endl;
91 theInterface_ = ConfigurationInterface::getInstance(
false);
98 theInterface_->saveNewVersion(base,tmpView);
105 std::cout << __COUT_HDR_FL__ <<
"end of debugging Configuration!" << std::endl;
112 std::vector<std::string> configTables;
115 setenv(
"CONFIGURATION_DATA_PATH",(std::string(getenv(
"USER_DATA")) +
"/ConfigurationDataExamples").c_str(),1);
116 std::string configDir = std::string(getenv(
"CONFIGURATION_DATA_PATH")) +
'/';
120 setenv(
"CONFIGURATION_TYPE",
"File",1);
124 std::cout << __COUT_HDR_FL__ <<
"ConfigurationDir: " << configDir << std::endl;
129 if((dp = opendir(configDir.c_str())) == 0)
131 std::cout << __COUT_HDR_FL__<<
"ERROR:(" << errno <<
"). Can't open directory: " << configDir << std::endl;
135 const unsigned char isDir = 0x4;
136 while ((dirp = readdir(dp)) != 0)
137 if(dirp->d_type == isDir && dirp->d_name[0] !=
'.' )
139 std::cout << __COUT_HDR_FL__<< dirp->d_name << std::endl;
140 configTables.push_back(dirp->d_name);
148 for(
unsigned int i = 0; i < configTables.size(); ++i)
150 theInterface_ = ConfigurationInterface::getInstance(
false);
152 std::cout << __COUT_HDR_FL__ << std::endl;
153 std::cout << __COUT_HDR_FL__ << std::endl;
154 std::cout << __COUT_HDR_FL__ << (i+1) <<
" of " << configTables.size() <<
": " << configTables[i] << std::endl;
156 theInterface_->get(base,configTables[i], 0, 0,
false,
ConfigurationVersion(ConfigurationVersion::DEFAULT));
158 std::cout << __COUT_HDR_FL__ <<
"loaded " << configTables[i]<< std::endl;
162 std::cout << __COUT_HDR_FL__ <<
"Current version: " << base->getViewVersion() << std::endl;
172 theInterface_->saveNewVersion(base,tmpView);
178 std::cout << __COUT_HDR_FL__ <<
"end of debugging Configuration!" << std::endl;
182 BOOST_AUTO_TEST_SUITE_END()