8 #include <gtest/gtest.h>
15 using namespace HCE::sphinx::reduce_task;
16 using namespace HCE::sphinx;
17 using namespace HCE::reduce;
38 matchInfo1.addAttrInfo(attrInfo1);
39 matchInfo2.addAttrInfo(attrInfo1);
40 matchInfo3.addAttrInfo(attrInfo1);
41 matchInfo4.addAttrInfo(attrInfo1);
43 sphinxRequestInfo1.setNodeName(
"nodeName1");
44 sphinxRequestInfo1.setMaxResultsNumber(5);
45 sphinxRequestInfo1.setQuery(query1);
46 sphinxRequestInfo1.setTotal(totalRes1);
47 sphinxRequestInfo1.setTotalFound(totalFound1);
48 sphinxRequestInfo1.setTimeMsec(time1);
49 sphinxRequestInfo1.addWordInfo(word1);
50 sphinxRequestInfo1.addWordInfo(word2);
52 sphinxRequestInfo2.setNodeName(
"nodeName2");
53 sphinxRequestInfo2.setMaxResultsNumber(5);
54 sphinxRequestInfo2.addWordInfo(word1);
55 sphinxRequestInfo2.addWordInfo(word2);
57 sphinxResultData1.addMatchInfo(matchInfo1);
58 sphinxResultData1.addMatchInfo(matchInfo2);
59 sphinxResultData1.addRequestInfo(sphinxRequestInfo1);
61 sphinxResultData2.addMatchInfo(matchInfo3);
62 sphinxResultData2.addMatchInfo(matchInfo4);
63 sphinxResultData2.addRequestInfo(sphinxRequestInfo2);
108 unsigned long long taskId = 2442352714LLU;
110 sphinxTaskReducerFactory, sphinxResultJSONConvertor);
114 ASSERT_TRUE(sphinxTaskReducersManager.
isReducerExist(taskId) ==
true);
123 int taskId = 2442352714LLU;
126 sphinxTaskReducerFactory, sphinxResultJSONConvertor);
132 ASSERT_EQ(json, reducedJSON);
140 int invalidTaskId = 1;
143 sphinxTaskReducerFactory, sphinxResultJSONConvertor);
145 ASSERT_THROW(sphinxTaskReducersManager.
addDataInReducer(invalidTaskId, validJSON),
152 string invalidJSON =
"data";
156 sphinxTaskReducerFactory, sphinxResultJSONConvertor);
160 ASSERT_THROW(sphinxTaskReducersManager.
addDataInReducer(taskId, invalidJSON),
172 sphinxTaskReducerFactory, sphinxResultJSONConvertor);
178 ASSERT_EQ(json, reducedJSON);
185 buildExpectedSphinxResult(reducedSphinxResult);
193 sphinxTaskReducerFactory, sphinxResultJSONConvertor);
201 ASSERT_EQ(expectedJSON, reducedJSON);