hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
SphinxFunctionalTest.cpp
Go to the documentation of this file.
1 #include <gtest/gtest.h>
2 #include <iomanip>
3 #include <sstream>
4 #include <fstream>
5 #include <set>
6 
7 #include <Poco/SharedPtr.h>
8 #include "SphinxTestPrinter.hpp"
9 #include "SphinxError.hpp"
12 
13 namespace HCE
14 {
15 namespace sphinx
16 {
17 namespace tests
18 {
19 //-----------------------------------------------------------------------------
20 extern Poco::SharedPtr<SphinxFunctionalObject> pObj;
21 extern std::string homeDir;
22 extern TestPerfomanceData perfomanceData;
23 
24 const std::string nodeName = "test_node";
25 const std::string defaultIndex = "i001";
26 const std::string indexName = "i003";
27 const std::string copyIndexName = "i004";
28 const std::string renameIndexName = "i005";
29 //-----------------------------------------------------------------------------
30 static std::string printError(SphinxFunctionalObject& fObj)
31 {
32  std::ostringstream outMsg;
33  outMsg << "ErrorCode: " << fObj.getErrorCode() << " ErrorMsg: " << fObj.getErrorMsg() << std::endl;
34  return outMsg.str();
35 }
36 //-----------------------------------------------------------------------------
37 //-----------------------------------------------------------------------------
38 class SphinxFunctionalTest : public ::testing::Test
39 {
40 protected:
41  static void SetUpTestCase(void)
42  {
43  pObj = Poco::SharedPtr<SphinxFunctionalObject>(new SphinxFunctionalObject(nodeName, 234, homeDir));
44 // pObj->setLogStream(std::cout);
45  }
46  static void TearDownTestCase(void)
47  {
48  pObj = nullptr;
49  }
50 };
51 //-----------------------------------------------------------------------------
52 //-----------------------------------------------------------------------------
53 TEST_F(SphinxFunctionalTest, isCreatedSphinxFunctionalObject)
54 {
55  ASSERT_FALSE(pObj.isNull());
56 }
57 //-----------------------------------------------------------------------------
58 TEST_F(SphinxFunctionalTest, changeSearchIndex)
59 {
61  ASSERT_FALSE(pObj->isError()) << printError(*pObj);
62 }
63 //-----------------------------------------------------------------------------
64 TEST_F(SphinxFunctionalTest, autoGettingPortsSearchd)
65 {
67  ASSERT_FALSE(pObj->isError()) << printError(*pObj);
68 }
69 //-----------------------------------------------------------------------------
70 TEST_F(SphinxFunctionalTest, fullIndexerTest)
71 {
73  ASSERT_FALSE(pObj->isError()) << printError(*pObj);
74 }
75 //-----------------------------------------------------------------------------
76 TEST_F(SphinxFunctionalTest, fullSearcherTest)
77 {
79  ASSERT_FALSE(pObj->isError()) << printError(*pObj);
80 }
81 //-----------------------------------------------------------------------------
82 TEST_F(SphinxFunctionalTest, differentFiltersTest)
83 {
85  ASSERT_FALSE(pObj->isError()) << printError(*pObj);
86 }
87 //-----------------------------------------------------------------------------
89 {
91  std::cout << "Use 64 Bit = " << std::boolalpha << ret << std::endl;
92  ASSERT_FALSE(pObj->isError()) << printError(*pObj);
93 }
94 //-----------------------------------------------------------------------------
95 TEST(SphinxPerfomance, testPerfomance)
96 {
97 // const size_t indexCount = 10;
98 // const std::string dataFileName = "./test1000.dat";
100 }
101 //-----------------------------------------------------------------------------
102 //-----------------------------------------------------------------------------
103 } // end namespace tests
104 } // end namespace sphinx
105 } // end namespace HCE
106 
107 
108 
109 
110