hce-node application
1.4.3
HCE Hierarchical Cluster Engine node application
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
TestUtils.cpp
Go to the documentation of this file.
1
/*
2
* TestUtils.cpp
3
*
4
* Created on: May 29, 2013
5
* Author: igor
6
*/
7
8
#include "
TestUtils.hpp
"
9
#include "
ReducingExceptionsTranslatorIf.hpp
"
10
11
using namespace
HCE::reduce;
12
13
bool
isEqualReducingBaseMessage
(
ReducingBaseMessage
& first,
14
ReducingBaseMessage
& second)
15
{
16
return
(first.
getProcessingType
() == second.
getProcessingType
()) &&
17
(first.
getBody
() == second.
getBody
() &&
18
(first.
getTTL
() == second.
getTTL
()));
19
}
20
21
22
bool
isEqualReducingInputMessage
(
ReducingInputMessage
& first,
ReducingInputMessage
& second)
23
{
24
return
isEqualReducingBaseMessage
(first, second);
25
}
26
27
28
bool
isEqualReducingOutputMessage
(
ReducingOutputMessage
& first,
29
ReducingOutputMessage
& second)
30
{
31
if
(
isEqualReducingBaseMessage
(first, second)){
32
if
((first.
getProcessingErrorCode
() == second.
getProcessingErrorCode
()) &&
33
(first.
getProcessingErrorMsg
() == second.
getProcessingErrorMsg
()) &&
34
(first.
getProcessingElapsedTime
() == second.
getProcessingElapsedTime
())
35
){
36
return
true
;
37
}
38
}
39
return
false
;
40
}
41
42
43
SharedPtr<ReducingOutputMessage>
buildEtalonFrom
(
44
types::MessageType
managerType,
int
ttl
,
string
& json)
45
{
46
int
errCode = 0;
47
string
errMsg =
""
;
48
int
elapsedTime
= 0;
49
SharedPtr<ReducingOutputMessage> etalonMessage(
50
new
ReducingOutputMessage
(managerType, ttl, json,
51
errCode, errMsg, elapsedTime));
52
return
etalonMessage;
53
}
54
55
SharedPtr<ReducingOutputMessage>
buildEtalonFrom
(
NotFoundByKeyException
& e)
56
{
57
int
elapsedTime
= 0;
58
int
ttl
= 0;
59
string
emptyJSON =
""
;
60
SharedPtr<ReducingOutputMessage> etalonMessage(
61
new
ReducingOutputMessage
(types::MessageType::mtNull, ttl, emptyJSON,
62
INTERNAL_ERROR
, e.
what
(),
elapsedTime
));
63
return
etalonMessage;
64
}
65
66
SharedPtr<ReducingInputMessage>
buildReducingInputMessage
(
67
types::MessageType
managerType,
int
ttl
,
string
& json)
68
{
69
SharedPtr<ReducingInputMessage>inputMessage(
70
new
ReducingInputMessage
(managerType, ttl, json));
71
return
inputMessage;
72
}
sources
utils
reduceHandler
tests
TestUtils.cpp
Generated on Tue Jun 30 2015 19:42:15 for hce-node application by
1.8.1.2