2525
2626#include " ../common.h"
2727
28+ #ifndef MOCK_TEST
2829#include " Transport/Transport.h"
30+ #else
31+ #include " IGatewayMock.h"
32+ #endif
2933
3034#include < string>
3135#include < stdio.h>
3236
33- #ifdef UNIT_TEST
34- #include " IGateway.h"
35- #endif
36-
3737namespace FireboltSDK
3838{
3939
4040 using EventCallback = std::function<void (const std::string & /* eventName */ , const JsonObject & /* parameters */ , Firebolt::Error /* error */ )>;
4141
42- #ifndef UNIT_TEST
42+ #ifndef MOCK_TEST
4343 class GatewayImpl
44- #else
45- class GatewayImpl : public IGateway
46- #endif
4744 {
4845
4946 Transport<WPEFramework::Core::JSON::IElement> *transport;
47+ #else
48+ class GatewayImpl : public IGatewayMock
49+ {
50+ #endif
5051
5152 public:
5253 GatewayImpl ()
@@ -56,10 +57,10 @@ namespace FireboltSDK
5657 public:
5758 void TransportUpdated (Transport<WPEFramework::Core::JSON::IElement> *transport)
5859 {
59- this ->transport = transport;
60+ this ->transport = transport;
6061 }
6162
62- #ifndef UNIT_TEST
63+ #ifndef MOCK_TEST
6364 template <typename RESPONSE>
6465 Firebolt::Error Request (const std::string &method, const JsonObject ¶meters, RESPONSE &response)
6566 {
@@ -69,25 +70,6 @@ namespace FireboltSDK
6970 }
7071 return transport->Invoke (method, parameters, response);
7172 }
72- #else
73- Firebolt::Error Request (const std::string &method, const JsonObject ¶meters, FireboltSDK::JSON::String &response)
74- {
75- if (transport == nullptr )
76- {
77- return Firebolt::Error::NotConnected;
78- }
79- return transport->Invoke (method, parameters, response);
80- }
81-
82- Firebolt::Error Request (const std::string &method, const JsonObject ¶meters, Firebolt::Authentication::JsonData_Token &response)
83- {
84- if (transport == nullptr )
85- {
86- return Firebolt::Error::NotConnected;
87- }
88- return transport->Invoke (method, parameters, response);
89- }
90-
9173#endif
9274
9375 Firebolt::Error Response (unsigned id, const std::string &method, const JsonObject &response)
@@ -126,3 +108,4 @@ namespace FireboltSDK
126108 }
127109 };
128110}
111+
0 commit comments