Skip to content

Commit ee59595

Browse files
committed
Added RPC tests and deleted request/replier tests
Signed-off-by: zesk1999 <zesk1999@gmail.com>
1 parent aef48d6 commit ee59595

File tree

5 files changed

+469
-232
lines changed

5 files changed

+469
-232
lines changed

sustainml_cpp/src/cpp/core/GenericServiceNodeImpl.hpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ class GenericServiceNodeImpl : public ServerBase
6161
throw ::InternalError("update_configuration: node is shutting down");
6262
}
6363

64-
std::cout << "[RPC SERVER/" << tag_ << "] update_configuration cfg='"
65-
<< configuration << "'\n";
66-
6764
types::RequestType req;
6865
types::ResponseType res;
6966

@@ -77,12 +74,14 @@ class GenericServiceNodeImpl : public ServerBase
7774
{
7875
throw ::InternalError(std::string("update_configuration: ") + e.what());
7976
}
80-
catch (...)
81-
{
82-
throw ::InternalError("update_configuration: unknown error");
83-
}
8477

85-
return res.configuration();
78+
// Copy into owned std::string
79+
std::string reply = res.configuration();
80+
81+
std::cout << "[RPC SERVER/" << tag_
82+
<< "] returning cfg='" << reply << "'\n";
83+
84+
return reply; // Safe
8685
}
8786

8887
private:

sustainml_cpp/test/blackbox/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515

1616
file(GLOB BLACKBOXTESTS_TEST_SOURCE "common/BlackboxTests*.cpp")
17-
list(FILTER BLACKBOXTESTS_TEST_SOURCE EXCLUDE REGEX ".*ResponseNodes.*\\.cpp$") # Old behavior tests
1817
set(BLACKBOXTESTS_SOURCE ${BLACKBOXTESTS_TEST_SOURCE}
1918
${PROJECT_SOURCE_DIR}/src/cpp/types/typesImplTypeObjectSupport.cxx
2019
${PROJECT_SOURCE_DIR}/src/cpp/types/typesImplPubSubTypes.cxx

sustainml_cpp/test/blackbox/api/ManagedNode.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ class ManagedNode
133133
~ManagedNode()
134134
{
135135
stop();
136-
th_->join();
137136
}
138137

139138
void start()
@@ -149,6 +148,11 @@ class ManagedNode
149148
void stop()
150149
{
151150
_NODE_TYPE::terminate();
151+
152+
if (th_ && th_->joinable())
153+
{
154+
th_->join();
155+
}
152156
}
153157

154158
void prepare_expected_samples(
@@ -198,4 +202,3 @@ class ManagedNode
198202
};
199203

200204
#endif // _TEST_BLACKBOX_MANAGEDNODE_HPP_
201-

0 commit comments

Comments
 (0)