1 #include <gtest/gtest.h>
2 #include <gmock/gmock.h>
7 using namespace HCE::reduce::core;
12 using ::testing::InSequence;
13 using ::testing::Return;
14 using ::testing::ReturnPointee;
15 using ::testing::SetArgReferee;
17 TEST(scheduleStrategySingle, sequenceCallEmptyObjects)
21 SharedPtr<IterableMock>reduceStorageMock(
new IterableMock());
28 EXPECT_CALL(*reduceJobMock.get(), getDataStorage())
29 .WillOnce(ReturnPointee(&reduceStorageMock));
30 EXPECT_CALL(*reduceJobMock.get(), getReduceTask())
31 .WillOnce(ReturnPointee(&reduceTaskMock));
32 EXPECT_CALL(*reduceStorageMock.get(), reset())
34 EXPECT_CALL(*reduceStorageMock.get(), hasNext())
35 .WillOnce(Return(
false));
36 EXPECT_CALL(*reduceJobMock.get(), getReduceResult())
37 .WillOnce(ReturnPointee(&reduceResultMock));
39 EXPECT_CALL(*reduceJobMock.get(), getReduceTask())
40 .WillOnce(ReturnPointee(&reduceTaskMock));
42 EXPECT_CALL(*reduceTaskMock.get(), fillReduceResult(_))
45 scheduleStrategySingle.
executeJob(reduceJobMock);
49 TEST(scheduleStrategySingle, sequenceCallProcessSomeData)
53 SharedPtr<IterableMock>reduceStorageMock(
new IterableMock());
62 EXPECT_CALL(*reduceJobMock.get(), getDataStorage())
63 .WillOnce(ReturnPointee(&reduceStorageMock));
64 EXPECT_CALL(*reduceJobMock.get(), getReduceTask())
65 .WillOnce(ReturnPointee(&reduceTaskMock));
66 EXPECT_CALL(*reduceStorageMock.get(), reset())
68 EXPECT_CALL(*reduceStorageMock.get(), hasNext())
69 .WillOnce(Return(
true));
71 EXPECT_CALL(*reduceStorageMock.get(), getNext(_, _))
72 .WillOnce(DoAll(SetArgReferee<0>(val), SetArgReferee<1>(val)));
74 EXPECT_CALL(*reduceTaskMock.get(), addKeyValue(_, _))
76 EXPECT_CALL(*reduceStorageMock.get(), hasNext())
77 .WillOnce(Return(
false));
79 EXPECT_CALL(*reduceJobMock.get(), getReduceResult())
80 .WillOnce(ReturnPointee(&reduceResultMock));
81 EXPECT_CALL(*reduceJobMock.get(), getReduceTask())
82 .WillOnce(ReturnPointee(&reduceTaskMock));
83 EXPECT_CALL(*reduceTaskMock.get(), fillReduceResult(_))
86 scheduleStrategySingle.
executeJob(reduceJobMock);