Skip to content
Snippets Groups Projects
Commit 6b5ce761 authored by athatheocsd's avatar athatheocsd
Browse files

Updated MessageParser::execute function

Added test basics
parent d93fbc55
No related branches found
No related tags found
No related merge requests found
...@@ -46,6 +46,6 @@ IF (EXISTS "${PROJECT_SOURCE_DIR}/lib/Catch2/CMakeLists.txt") ...@@ -46,6 +46,6 @@ IF (EXISTS "${PROJECT_SOURCE_DIR}/lib/Catch2/CMakeLists.txt")
add_executable(tests add_executable(tests
$<TARGET_OBJECTS:common> $<TARGET_OBJECTS:common>
${test_main_SRC} ${test_main_SRC}
${test_SRC}) ${test_SRC} test/Services/EventActionService.cpp)
target_link_libraries(tests Catch2::Catch2) target_link_libraries(tests Catch2::Catch2)
ENDIF () ENDIF ()
...@@ -97,7 +97,7 @@ public: ...@@ -97,7 +97,7 @@ public:
* Custom function that is called right after an event takes place, to initiate * Custom function that is called right after an event takes place, to initiate
* the execution of the action * the execution of the action
*/ */
void executeAction(); void execute(Message &message);
/** /**
* Setter for event-action function status * Setter for event-action function status
...@@ -105,6 +105,11 @@ public: ...@@ -105,6 +105,11 @@ public:
void setEventActionFunctionStatus(EventActionFunctionStatus e) { void setEventActionFunctionStatus(EventActionFunctionStatus e) {
eventActionFunctionStatus = e; eventActionFunctionStatus = e;
} }
/**
* The purpose of this instance is to access the execute function
*/
static EventActionService instance;
}; };
#endif //ECSS_SERVICES_EVENTACTIONSERVICE_HPP #endif //ECSS_SERVICES_EVENTACTIONSERVICE_HPP
#include <cstring> #include <cstring>
#include <Services/EventActionService.hpp>
#include "ErrorHandler.hpp" #include "ErrorHandler.hpp"
#include "MessageParser.hpp" #include "MessageParser.hpp"
#include "macros.hpp" #include "macros.hpp"
...@@ -7,6 +8,7 @@ ...@@ -7,6 +8,7 @@
TestService TestService::instance; TestService TestService::instance;
RequestVerificationService RequestVerificationService::instance; RequestVerificationService RequestVerificationService::instance;
EventActionService EventActionService::instance;
void MessageParser::execute(Message &message) { void MessageParser::execute(Message &message) {
switch (message.serviceType) { switch (message.serviceType) {
...@@ -16,6 +18,8 @@ void MessageParser::execute(Message &message) { ...@@ -16,6 +18,8 @@ void MessageParser::execute(Message &message) {
case 17: case 17:
TestService::instance.execute(message); TestService::instance.execute(message);
break; break;
case 19:
EventActionService::instance.execute(message);
default: default:
// cout is very bad for embedded systems // cout is very bad for embedded systems
std::cout << "This service hasn't been implemented yet or it doesn't exist"; std::cout << "This service hasn't been implemented yet or it doesn't exist";
......
...@@ -171,7 +171,7 @@ void EventActionService::disableEventActionFunction(Message message) { ...@@ -171,7 +171,7 @@ void EventActionService::disableEventActionFunction(Message message) {
} }
} }
void EventActionService::executeAction() { void EventActionService::execute(Message &message) {
// Custom function // Custom function
if (eventActionFunctionStatus == enabledFunction) { if (eventActionFunctionStatus == enabledFunction) {
......
#include <catch2/catch.hpp>
#include <Services/EventActionService.hpp>
#include <Message.hpp>
#include "ServiceTests.hpp"
#include <cstring>
TEST_CASE("Add event-action definitions TC[19,1]", "[service][st09]") {
}
TEST_CASE("Delete event-action definitions TC[19,2]", "[service][st09]") {
}
TEST_CASE("Delete all event-action definitions TC[19,3]", "[service][st09]") {
}
TEST_CASE("Enable event-action definitions TC[19,4]", "[service][st09]") {
}
TEST_CASE("Disable event-action definitions TC[19,5]", "[service][st09]") {
}
TEST_CASE("Request event-action definition status TC[19,6]", "[service][st09]") {
}
TEST_CASE("Event-action status report TM[19,7]", "[service][st09]") {
}
TEST_CASE("Enable event-action function TC[19,8]", "[service][st09]") {
}
TEST_CASE("Disable event-action function TC[19,1]", "[service][st09]") {
}
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include <cstring> #include <cstring>
/* /*
* @todo Change the reinterpret_cast * @todo: Change the reinterpret_cast
*/ */
TEST_CASE("Informative Event Report TM[5,1]", "[service][st05]") { TEST_CASE("Informative Event Report TM[5,1]", "[service][st05]") {
EventReportService eventReportService; EventReportService eventReportService;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment