Skip to content

Commit 2b7b576

Browse files
Change DataWriter::write return value from bool to ReturnCode_t and fix tests
Signed-off-by: Lucia Echevarria <luciaechevarria@eprosima.com>
1 parent 21c1cee commit 2b7b576

3 files changed

Lines changed: 25 additions & 20 deletions

File tree

ddsrouter_core/test/blackbox/ddsrouter_core/dds/local/DDSTestLocal.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,20 @@
1515
#include <atomic>
1616
#include <thread>
1717

18-
#include <cpp_utils/testing/gtest_aux.hpp>
19-
#include <gtest/gtest.h>
18+
#include <fastdds/dds/core/detail/DDSReturnCode.hpp>
2019

21-
#include <cpp_utils/testing/LogChecker.hpp>
2220
#include <cpp_utils/Log.hpp>
21+
#include <cpp_utils/testing/gtest_aux.hpp>
22+
#include <cpp_utils/testing/LogChecker.hpp>
2323

2424
#include <ddspipe_core/types/topic/filter/WildcardDdsFilterTopic.hpp>
2525

2626
#include <ddsrouter_core/core/DdsRouter.hpp>
2727

2828
#include <test_participants.hpp>
2929

30+
#include <gtest/gtest.h>
31+
3032
using namespace eprosima;
3133
using namespace eprosima::ddspipe;
3234
using namespace eprosima::ddsrouter::core;
@@ -163,7 +165,7 @@ void test_local_communication(
163165
for (samples_sent = 0; samples_sent < samples_to_receive; samples_sent++)
164166
{
165167
msg.index(samples_sent);
166-
ASSERT_TRUE(publisher.publish(msg));
168+
ASSERT_EQ(publisher.publish(msg), eprosima::fastdds::dds::RETCODE_OK);
167169

168170
// If time is 0 do not wait
169171
if (time_between_samples > 0)

ddsrouter_core/test/blackbox/ddsrouter_core/dds/local/DDSTestLocalDisposeKey.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,20 @@
1515
#include <atomic>
1616
#include <thread>
1717

18-
#include <cpp_utils/testing/gtest_aux.hpp>
19-
#include <gtest/gtest.h>
18+
#include <fastdds/dds/core/detail/DDSReturnCode.hpp>
2019

21-
#include <cpp_utils/testing/LogChecker.hpp>
2220
#include <cpp_utils/Log.hpp>
21+
#include <cpp_utils/testing/gtest_aux.hpp>
22+
#include <cpp_utils/testing/LogChecker.hpp>
2323

2424
#include <ddspipe_core/types/topic/filter/WildcardDdsFilterTopic.hpp>
2525

2626
#include <ddsrouter_core/core/DdsRouter.hpp>
2727

2828
#include <test_participants.hpp>
2929

30+
#include <gtest/gtest.h>
31+
3032
using namespace eprosima;
3133
using namespace eprosima::ddspipe;
3234
using namespace eprosima::ddsrouter::core;
@@ -132,7 +134,7 @@ void test_local_communication_key_dispose(
132134
while (samples_received.load() < samples_to_receive)
133135
{
134136
msg.index(++samples_sent);
135-
ASSERT_TRUE(publisher.publish(msg)) << samples_sent;
137+
ASSERT_EQ(publisher.publish(msg), fastdds::dds::RETCODE_OK) << samples_sent;
136138

137139
// If time is 0 do not wait
138140
if (time_between_samples > 0)
@@ -150,7 +152,7 @@ void test_local_communication_key_dispose(
150152
while (samples_received.load() < samples_to_receive)
151153
{
152154
msg.index(++samples_sent);
153-
ASSERT_TRUE(publisher.publish(msg)) << samples_sent;
155+
ASSERT_EQ(publisher.publish(msg), fastdds::dds::RETCODE_OK) << samples_sent;
154156

155157
// If time is 0 do not wait
156158
if (time_between_samples > 0)

ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/test_participants.hpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,9 @@
1818
#include <iostream>
1919
#include <condition_variable>
2020

21-
#include <gtest/gtest.h>
22-
23-
#include <cpp_utils/testing/gtest_aux.hpp>
24-
#include <cpp_utils/Log.hpp>
25-
26-
#include <ddspipe_participants/configuration/SimpleParticipantConfiguration.hpp>
27-
28-
#include <ddsrouter_core/core/DdsRouter.hpp>
29-
3021
#include <fastdds/dds/common/InstanceHandle.hpp>
3122
#include <fastdds/dds/core/detail/DDSReturnCode.hpp>
23+
#include <fastdds/dds/core/detail/DDSReturnCode.hpp>
3224
#include <fastdds/dds/domain/DomainParticipant.hpp>
3325
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
3426
#include <fastdds/dds/publisher/DataWriter.hpp>
@@ -45,9 +37,18 @@
4537
#include <fastdds/rtps/attributes/RTPSParticipantAttributes.hpp>
4638
#include <fastdds/rtps/transport/UDPv4TransportDescriptor.hpp>
4739

40+
#include <cpp_utils/testing/gtest_aux.hpp>
41+
#include <cpp_utils/Log.hpp>
42+
43+
#include <ddspipe_participants/configuration/SimpleParticipantConfiguration.hpp>
44+
45+
#include <ddsrouter_core/core/DdsRouter.hpp>
46+
4847
#include "HelloWorld/HelloWorldPubSubTypes.hpp"
4948
#include "HelloWorldKeyed/HelloWorldKeyedPubSubTypes.hpp"
5049

50+
#include <gtest/gtest.h>
51+
5152

5253
namespace test {
5354

@@ -154,7 +155,7 @@ class TestPublisher
154155
}
155156

156157
//! Publish a sample
157-
bool publish(
158+
eprosima::fastdds::dds::ReturnCode_t publish(
158159
MsgStruct msg)
159160
{
160161
hello_.index(msg.index());
@@ -238,7 +239,7 @@ class TestPublisher
238239
};
239240

240241
template <>
241-
bool TestPublisher<HelloWorldKeyed>::publish(
242+
eprosima::fastdds::dds::ReturnCode_t TestPublisher<HelloWorldKeyed>::publish(
242243
HelloWorldKeyed msg)
243244
{
244245
hello_.index(msg.index());

0 commit comments

Comments
 (0)