/* **************************************************************************** * * ok - */ TEST(versionTreat, ok) { ConnectionInfo ci("/version", "GET", "1.1"); std::string out; out = restService(&ci, rs); // FIXME P2: Some day we'll do this ... // // char* expected = // "<orion>\n" // " <version>" ORION_VERSION "</version>\n" // " <uptime>*</uptime>" // " <git_hash>*</git_hash>\n" // " <compile_time>*</compile_time>\n" // " <compiled_by>*</compiled_by>\n" // " <compiled_in>*</compiled_in>\n" // "</orion>\n"; // bool match; // match = std::regex_match(expected, out.c_str()); EXPECT_TRUE(strstr(out.c_str(), "<orion>") != NULL); EXPECT_TRUE(strstr(out.c_str(), "<version>") != NULL); EXPECT_TRUE(strstr(out.c_str(), "</version>") != NULL); EXPECT_TRUE(strstr(out.c_str(), "<uptime>") != NULL); EXPECT_TRUE(strstr(out.c_str(), "</uptime>") != NULL); EXPECT_TRUE(strstr(out.c_str(), "<git_hash>") != NULL); EXPECT_TRUE(strstr(out.c_str(), "</git_hash>") != NULL); EXPECT_TRUE(strstr(out.c_str(), "<compile_time>") != NULL); EXPECT_TRUE(strstr(out.c_str(), "</compile_time>") != NULL); EXPECT_TRUE(strstr(out.c_str(), "<compiled_in>") != NULL); EXPECT_TRUE(strstr(out.c_str(), "</compiled_in>") != NULL); EXPECT_TRUE(strstr(out.c_str(), "</orion>") != NULL); extern const char* orionUnitTestVersion; std::string expected = std::string("<version>") + orionUnitTestVersion + "</version>"; EXPECT_TRUE(strstr(out.c_str(), expected.c_str()) != NULL); versionSet("1.2.3"); out = restService(&ci, rs); EXPECT_TRUE(strstr(out.c_str(), "<version>1.2.3</version>") != NULL); versionSet("1.2.3"); std::string version = versionGet(); EXPECT_EQ("1.2.3", version); }
/* **************************************************************************** * * orionInit - */ void orionInit ( OrionExitFunction exitFunction, const char* version, SemOpType reqPolicy, bool _countersStatistics, bool _semWaitStatistics, bool _timingStatistics, bool _notifQueueStatistics, bool _checkIdv1 ) { // Give the rest library the correct version string of this executable versionSet(version); // The function to call on fatal error orionExitFunction = exitFunction; // Initialize the semaphore used by mongoBackend semInit(reqPolicy, _semWaitStatistics); // Set timer object (singleton) setTimer(new Timer()); // startTime for log library if (gettimeofday(&logStartTime, NULL) != 0) { fprintf(stderr, "gettimeofday: %s\n", strerror(errno)); orionExitFunction(1, "gettimeofday error"); } // Set start time and statisticsTime used by REST interface startTime = logStartTime.tv_sec; statisticsTime = startTime; // Set other flags related with statistics countersStatistics = _countersStatistics; timingStatistics = _timingStatistics; notifQueueStatistics = _notifQueueStatistics; strncpy(transactionId, "N/A", sizeof(transactionId)); checkIdv1 = _checkIdv1; }