hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
SphinxTaskReducersStorageTest.cpp
Go to the documentation of this file.
1 /*
2  * SphinxTaskReducersStorageTest.cpp
3  *
4  * Created on: May 20, 2013
5  * Author: igor
6  */
7 
8 #include <gtest/gtest.h>
10 #include "Exceptions.hpp"
11 
12 using namespace HCE::sphinx;
13 using namespace HCE::reduce;
14 using namespace HCE::sphinx::reduce_task;
15 using namespace Poco;
16 
17 TEST(SphinxTaskReducersStorage, returnReducerByValidKey)
18 {
19  SphinxTaskReducersStorage sphinxTaskReducersStorage;
20  SharedPtr<SphinxTaskReducerIf>sphinxTaskReducer;
21  int taskId = 1;
22 
23  sphinxTaskReducersStorage.addWithKey(taskId, sphinxTaskReducer);
24 
25  ASSERT_EQ(sphinxTaskReducer, sphinxTaskReducersStorage.findByKey(taskId));
26 }
27 
28 
29 TEST(SphinxTaskReducersStorage, throwNotFoundSphinxTaskReducerExceptionWhileSearchByInvalidKey)
30 {
31  SphinxTaskReducersStorage sphinxTaskReducersStorage;
32  int invalidTaskId = 8;
33 
34  ASSERT_THROW(sphinxTaskReducersStorage.findByKey(invalidTaskId),
36 }
37 
38 
39 TEST(SphinxTaskReducersStorage, throwNotFoundSphinxTaskReducerExceptionWhileDeleteByInvalidKey)
40 {
41  SphinxTaskReducersStorage sphinxTaskReducersStorage;
42  int invalidTaskId = 8;
43 
44  ASSERT_THROW(sphinxTaskReducersStorage.deleteByKey(invalidTaskId),
46 }
47 
48 
49 TEST(SphinxTaskReducersStorage, correctDeleteSphinxTaskReducerByValidKey)
50 {
51  SphinxTaskReducersStorage sphinxTaskReducersStorage;
52  SharedPtr<SphinxTaskReducerIf>sphinxTaskReducer;
53 
54  int taskId = 1;
55  sphinxTaskReducersStorage.addWithKey(taskId, sphinxTaskReducer);
56  sphinxTaskReducersStorage.deleteByKey(taskId);
57 
58  ASSERT_THROW(sphinxTaskReducersStorage.findByKey(taskId),
60 }
61