From 419e5c4b93e4b4f951fdeaf3192f032feadd5c92 Mon Sep 17 00:00:00 2001 From: Mario Dominguez Date: Wed, 25 Sep 2024 14:44:12 +0200 Subject: [PATCH 01/15] Refs #21710: DataReader get_matched_publications() get_matched_publication_data() test implementation Signed-off-by: Mario Dominguez --- .../common/DDSBlackboxTestsDataReader.cpp | 293 ++++++++++++++++++ 1 file changed, 293 insertions(+) diff --git a/test/blackbox/common/DDSBlackboxTestsDataReader.cpp b/test/blackbox/common/DDSBlackboxTestsDataReader.cpp index c45a2dd5db1..485b5d51279 100644 --- a/test/blackbox/common/DDSBlackboxTestsDataReader.cpp +++ b/test/blackbox/common/DDSBlackboxTestsDataReader.cpp @@ -535,6 +535,299 @@ TEST(DDSDataReader, datareader_qos_use_topic_qos) ASSERT_EQ(control_qos, test_qos); } +bool validate_publication_builtin_topic_data( + const eprosima::fastdds::dds::builtin::PublicationBuiltinTopicData& pubdata, + const eprosima::fastdds::dds::DataWriter& datawriter) +{ + bool ret = true; + + auto dw_qos = datawriter.get_qos(); + auto pub_qos = datawriter.get_publisher()->get_qos(); + + eprosima::fastdds::dds::builtin::BuiltinTopicKey_t dw_key, part_key; + GuidPrefix_t guid_prefix = datawriter.get_publisher()->get_participant()->guid().guidPrefix; + + // This conversions may be included later in utils + dw_key.value[0] = 0; + dw_key.value[1] = 0; + dw_key.value[2] = static_cast(datawriter.guid().entityId.value[0]) << 24 + | static_cast(datawriter.guid().entityId.value[1]) << 16 + | static_cast(datawriter.guid().entityId.value[2]) << 8 + | static_cast(datawriter.guid().entityId.value[3]); + + part_key.value[0] = static_cast(guid_prefix.value[0]) << 24 + | static_cast(guid_prefix.value[1]) << 16 + | static_cast(guid_prefix.value[2]) << 8 + | static_cast(guid_prefix.value[3]); + part_key.value[1] = static_cast(guid_prefix.value[4]) << 24 + | static_cast(guid_prefix.value[5]) << 16 + | static_cast(guid_prefix.value[6]) << 8 + | static_cast(guid_prefix.value[7]); + part_key.value[2] = static_cast(guid_prefix.value[8]) << 24 + | static_cast(guid_prefix.value[9]) << 16 + | static_cast(guid_prefix.value[10]) << 8 + | static_cast(guid_prefix.value[11]); + + ret &= (0 == memcmp(pubdata.key.value, dw_key.value, sizeof(eprosima::fastdds::dds::builtin::BuiltinTopicKey_t))); + ret &= + (0 == + memcmp(pubdata.participant_key.value, part_key.value, + sizeof(eprosima::fastdds::dds::builtin::BuiltinTopicKey_t))); + ret &= (pubdata.topic_name == datawriter.get_topic()->get_name()); + ret &= (pubdata.type_name == datawriter.get_topic()->get_type_name()); + + // DataWriter Qos + ret &= (pubdata.durability == dw_qos.durability()); + ret &= (pubdata.durability_service == dw_qos.durability_service()); + ret &= (pubdata.deadline == dw_qos.deadline()); + ret &= (pubdata.latency_budget == dw_qos.latency_budget()); + ret &= (pubdata.liveliness == dw_qos.liveliness()); + ret &= (pubdata.reliability == dw_qos.reliability()); + ret &= (pubdata.lifespan == dw_qos.lifespan()); + ret &= (pubdata.user_data == dw_qos.user_data()); + ret &= (pubdata.ownership == dw_qos.ownership()); + ret &= (pubdata.ownership_strength == dw_qos.ownership_strength()); + ret &= (pubdata.destination_order == dw_qos.destination_order()); + + // Publisher Qos + ret &= (pubdata.presentation == pub_qos.presentation()); + ret &= (pubdata.partition == pub_qos.partition()); + // topicdata not implemented + ret &= (pubdata.group_data == pub_qos.group_data()); + + return ret; +} + +/** + * Refers to DDS-DR-API-GMPD-01 from the test plan. + * + * get_matched_publication_data() must return RETCODE_BAD_PARAMETER + * if the publication is not matched. + */ +TEST(DDSDataReader, datareader_get_matched_publication_data_bad_parameter) +{ + PubSubReader reader(TEST_TOPIC_NAME); + PubSubWriter writer_1(TEST_TOPIC_NAME); + PubSubWriter writer_2(TEST_TOPIC_NAME); + + eprosima::fastdds::dds::builtin::PublicationBuiltinTopicData pubdata; + + reader.reliability(RELIABLE_RELIABILITY_QOS) + .init(); + + writer_1.reliability(BEST_EFFORT_RELIABILITY_QOS) + .init(); + writer_2.ownership_strength(10) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer_1.isInitialized()); + ASSERT_TRUE(writer_2.isInitialized()); + + // Reader should not be matched with any writer + reader.wait_discovery(std::chrono::seconds(2), 2); + + ASSERT_TRUE(!reader.is_matched()); + + auto& native_reader = reader.get_native_reader(); + + InstanceHandle_t w1_handle = writer_1.get_native_writer().get_instance_handle(); + ReturnCode_t ret = native_reader.get_matched_publication_data(pubdata, w1_handle); + + ASSERT_EQ(ret, ReturnCode_t::RETCODE_BAD_PARAMETER); + + InstanceHandle_t w2_handle = writer_2.get_native_writer().get_instance_handle(); + ret = native_reader.get_matched_publication_data(pubdata, w2_handle); + + ASSERT_EQ(ret, ReturnCode_t::RETCODE_BAD_PARAMETER); +} + +/** + * Refers to DDS-DR-API-GMPD-02 from the test plan. + * + * The operation must succeed when the publication is matched and correctly + * retrieve the publication data. Parameterize the test for different transports. + */ +TEST_P(DDSDataReader, datareader_get_matched_publication_data_correctly_behaves) +{ + PubSubReader reader(TEST_TOPIC_NAME); + PubSubWriter writer_1(TEST_TOPIC_NAME); + PubSubWriter writer_2(TEST_TOPIC_NAME); + + eprosima::fastdds::dds::builtin::PublicationBuiltinTopicData w1_pubdata, w2_pubdata; + + reader.init(); + + writer_1.init(); + writer_2.reliability(BEST_EFFORT_RELIABILITY_QOS) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer_1.isInitialized()); + ASSERT_TRUE(writer_2.isInitialized()); + + // Reader must match with both writers + reader.wait_discovery(std::chrono::seconds::zero(), 2); + + ASSERT_EQ(reader.get_matched(), 2u); + + auto& native_reader = reader.get_native_reader(); + + InstanceHandle_t w1_handle = writer_1.get_native_writer().get_instance_handle(); + ReturnCode_t ret = native_reader.get_matched_publication_data(w1_pubdata, w1_handle); + + ASSERT_EQ(ret, ReturnCode_t::RETCODE_OK); + ASSERT_TRUE(validate_publication_builtin_topic_data(w1_pubdata, writer_1.get_native_writer())); + + InstanceHandle_t w2_handle = writer_1.get_native_writer().get_instance_handle(); + ret = native_reader.get_matched_publication_data(w2_pubdata, w2_handle); + + ASSERT_EQ(ret, ReturnCode_t::RETCODE_OK); + ASSERT_TRUE(validate_publication_builtin_topic_data(w2_pubdata, writer_2.get_native_writer())); +} + +/** + * Refers to DDS-DR-API-GMP-01 from the test plan. + * + * get_matched_publications() must return RETCODE_OK + * with an empty list if no DataWriters are matched. + */ +TEST(DDSDataReader, datareader_get_matched_publications_ok_empty_list) +{ + PubSubReader reader(TEST_TOPIC_NAME); + PubSubWriter writer_1(TEST_TOPIC_NAME); + PubSubWriter writer_2(TEST_TOPIC_NAME); + + std::vector pub_handles; + + reader.reliability(RELIABLE_RELIABILITY_QOS) + .init(); + + writer_1.reliability(BEST_EFFORT_RELIABILITY_QOS) + .init(); + + writer_2.ownership_strength(10) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer_1.isInitialized()); + ASSERT_TRUE(writer_2.isInitialized()); + + // Reader should not be matched with any writer + reader.wait_discovery(std::chrono::seconds(2), 2); + ASSERT_FALSE(reader.is_matched()); + + auto& native_reader = reader.get_native_reader(); + ReturnCode_t ret = native_reader.get_matched_publications(pub_handles); + + ASSERT_EQ(ret, ReturnCode_t::RETCODE_OK); + ASSERT_EQ(pub_handles.size(), 0u); +} + +/** + * Refers to DDS-DR-API-GMP-02 from the test plan. + * + * get_matched_publications() must provide the correct list of matched publication handles. + * Parameterize the test for different transports. + */ +TEST_P(DDSDataReader, datareader_get_matched_publications_correctly_behaves) +{ + const size_t num_writers = 5; + + PubSubReader reader(TEST_TOPIC_NAME); + std::vector>> writers; + std::vector expected_pub_handles; + std::vector pub_handles; + + writers.reserve(num_writers); + pub_handles.reserve(num_writers); + + reader.reliability(RELIABLE_RELIABILITY_QOS) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + + for (size_t i = 0; i < num_writers; ++i) + { + writers.emplace_back(new PubSubWriter(TEST_TOPIC_NAME)); + writers.back()->init(); + ASSERT_TRUE(writers.back()->isInitialized()); + expected_pub_handles.emplace_back(writers.back()->get_native_writer().get_instance_handle()); + } + + // Wait for discovery + reader.wait_discovery(std::chrono::seconds::zero(), num_writers); + ASSERT_EQ(reader.get_matched(), num_writers); + + auto& native_reader = reader.get_native_reader(); + ReturnCode_t ret = native_reader.get_matched_publications(pub_handles); + + // Check that the list of matched publication handles is correct + ASSERT_EQ(ret, ReturnCode_t::RETCODE_OK); + ASSERT_EQ(pub_handles.size(), num_writers); + ASSERT_TRUE(std::is_permutation(pub_handles.begin(), pub_handles.end(), expected_pub_handles.begin())); + + // Remove two writers and check that the list of matched publication handles is updated + writers.pop_back(); + writers.pop_back(); + expected_pub_handles.pop_back(); + expected_pub_handles.pop_back(); + + // Wait for undiscovery + reader.wait_writer_undiscovery(static_cast(num_writers - 2)); + + pub_handles.clear(); + ret = native_reader.get_matched_publications(pub_handles); + ASSERT_EQ(ret, ReturnCode_t::RETCODE_OK); + ASSERT_EQ(pub_handles.size(), static_cast(num_writers - 2)); + ASSERT_TRUE(std::is_permutation(pub_handles.begin(), pub_handles.end(), expected_pub_handles.begin())); +} + +/** + * Refers to DDS-DR-API-GMP-03 from the test plan. + * + * The operation must provide the correct list of matched publication handles in multiple + * participants scenario. Parameterize the test for different transports. + */ +TEST_P(DDSDataReader, datareader_get_matched_publications_multiple_participants_correctly_behave) +{ + PubSubParticipant part_1(1, 1, 1, 1); + PubSubParticipant part_2(1, 1, 1, 1); + + part_1.sub_topic_name(TEST_TOPIC_NAME + "_1"); + part_2.pub_topic_name(TEST_TOPIC_NAME + "_1"); + + ASSERT_TRUE(part_1.init_participant()); + ASSERT_TRUE(part_1.init_publisher(0)); + ASSERT_TRUE(part_1.init_subscriber(0)); + + ASSERT_TRUE(part_2.init_participant()); + ASSERT_TRUE(part_2.init_subscriber(0)); + ASSERT_TRUE(part_2.init_publisher(0)); + + part_1.pub_wait_discovery(); + part_1.sub_wait_discovery(); + + part_2.pub_wait_discovery(); + part_2.sub_wait_discovery(); + + auto& reader_p1 = part_1.get_native_reader(0); + auto& reader_p2 = part_2.get_native_reader(0); + + std::vector pub_handles_p1; + std::vector pub_handles_p2; + + ReturnCode_t ret = reader_p1.get_matched_publications(pub_handles_p1); + ASSERT_EQ(ret, ReturnCode_t::RETCODE_OK); + ASSERT_EQ(pub_handles_p1.size(), 1u); + ASSERT_EQ(pub_handles_p1[0], part_2.get_native_writer(0).get_instance_handle()); + + ret = reader_p2.get_matched_publications(pub_handles_p2); + ASSERT_EQ(ret, ReturnCode_t::RETCODE_OK); + ASSERT_EQ(pub_handles_p2.size(), 1u); + ASSERT_EQ(pub_handles_p2[0], part_1.get_native_writer(0).get_instance_handle()); +} + #ifdef INSTANTIATE_TEST_SUITE_P #define GTEST_INSTANTIATE_TEST_MACRO(x, y, z, w) INSTANTIATE_TEST_SUITE_P(x, y, z, w) #else From bfdb23e2ce20cf0c056a068277187d61fa51593e Mon Sep 17 00:00:00 2001 From: Mario Dominguez Date: Wed, 25 Sep 2024 14:44:39 +0200 Subject: [PATCH 02/15] Refs #21710: DataWriter get_matched_subscriptions() get_matched_subscription_data() test implementation Signed-off-by: Mario Dominguez --- .../common/DDSBlackboxTestsDataWriter.cpp | 301 ++++++++++++++++++ 1 file changed, 301 insertions(+) diff --git a/test/blackbox/common/DDSBlackboxTestsDataWriter.cpp b/test/blackbox/common/DDSBlackboxTestsDataWriter.cpp index 14444fe20fe..fd6be5a07cc 100644 --- a/test/blackbox/common/DDSBlackboxTestsDataWriter.cpp +++ b/test/blackbox/common/DDSBlackboxTestsDataWriter.cpp @@ -34,6 +34,7 @@ #include #include "BlackboxTests.hpp" +#include "PubSubParticipant.hpp" #include "PubSubReader.hpp" #include "PubSubWriter.hpp" @@ -533,6 +534,306 @@ TEST(DDSDataWriter, datawriter_qos_use_topic_qos) ASSERT_EQ(control_qos, test_qos); } +bool validate_subscription_builtin_topic_data( + const eprosima::fastdds::dds::builtin::SubscriptionBuiltinTopicData& subdata, + const eprosima::fastdds::dds::DataReader& datareader) +{ + bool ret = true; + + auto dr_qos = datareader.get_qos(); + auto pub_qos = datareader.get_subscriber()->get_qos(); + + eprosima::fastdds::dds::builtin::BuiltinTopicKey_t dr_key, part_key; + eprosima::fastrtps::rtps::GuidPrefix_t part_guid_prefix = + datareader.get_subscriber()->get_participant()->guid().guidPrefix; + + // This conversions may be included later in utils + dr_key.value[0] = 0; + dr_key.value[1] = 0; + dr_key.value[2] = static_cast(datareader.guid().entityId.value[0]) << 24 + | static_cast(datareader.guid().entityId.value[1]) << 16 + | static_cast(datareader.guid().entityId.value[2]) << 8 + | static_cast(datareader.guid().entityId.value[3]); + + part_key.value[0] = static_cast(part_guid_prefix.value[0]) << 24 + | static_cast(part_guid_prefix.value[1]) << 16 + | static_cast(part_guid_prefix.value[2]) << 8 + | static_cast(part_guid_prefix.value[3]); + part_key.value[1] = static_cast(part_guid_prefix.value[4]) << 24 + | static_cast(part_guid_prefix.value[5]) << 16 + | static_cast(part_guid_prefix.value[6]) << 8 + | static_cast(part_guid_prefix.value[7]); + part_key.value[2] = static_cast(part_guid_prefix.value[8]) << 24 + | static_cast(part_guid_prefix.value[9]) << 16 + | static_cast(part_guid_prefix.value[10]) << 8 + | static_cast(part_guid_prefix.value[11]); + + ret &= (0 == memcmp(subdata.key.value, dr_key.value, sizeof(eprosima::fastdds::dds::builtin::BuiltinTopicKey_t))); + ret &= + (0 == + memcmp(subdata.participant_key.value, part_key.value, + sizeof(eprosima::fastdds::dds::builtin::BuiltinTopicKey_t))); + ret &= (subdata.topic_name == datareader.get_topicdescription()->get_name()); + ret &= (subdata.type_name == datareader.get_topicdescription()->get_type_name()); + + // DataReader Qos + ret &= (subdata.durability == dr_qos.durability()); + ret &= (subdata.deadline == dr_qos.deadline()); + ret &= (subdata.latency_budget == dr_qos.latency_budget()); + ret &= (subdata.liveliness == dr_qos.liveliness()); + ret &= (subdata.reliability == dr_qos.reliability()); + ret &= (subdata.ownership == dr_qos.ownership()); + ret &= (subdata.destination_order == dr_qos.destination_order()); + ret &= (subdata.user_data == dr_qos.user_data()); + // time based filter not implemented + + // Subscriber Qos + ret &= (subdata.presentation == pub_qos.presentation()); + ret &= (subdata.partition == pub_qos.partition()); + ret &= (subdata.group_data == pub_qos.group_data()); + + return ret; +} + +/** + * Refers to DDS-DW-API-GMSD-01 from the test plan. + * + * get_matched_subscription_data() must return RETCODE_BAD_PARAMETER + * if the subscription is not matched. + */ +TEST(DDSDataWriter, datawriter_get_matched_subscription_data_bad_parameter) +{ + using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; + + PubSubWriter writer(TEST_TOPIC_NAME); + PubSubReader reader_1(TEST_TOPIC_NAME); + PubSubReader reader_2(TEST_TOPIC_NAME); + + eprosima::fastdds::dds::builtin::SubscriptionBuiltinTopicData subdata; + + writer.reliability(BEST_EFFORT_RELIABILITY_QOS) + .init(); + + reader_1.reliability(RELIABLE_RELIABILITY_QOS) + .init(); + reader_2.ownership_exclusive() + .init(); + + ASSERT_TRUE(writer.isInitialized()); + ASSERT_TRUE(reader_1.isInitialized()); + ASSERT_TRUE(reader_2.isInitialized()); + + // Writer should not be matched with any reader + writer.wait_discovery(2, std::chrono::seconds(2)); + + ASSERT_TRUE(!writer.is_matched()); + + auto& native_writer = writer.get_native_writer(); + + InstanceHandle_t r1_handle = reader_1.get_native_reader().get_instance_handle(); + ReturnCode_t ret = native_writer.get_matched_subscription_data(subdata, r1_handle); + + ASSERT_EQ(ret, ReturnCode_t::RETCODE_BAD_PARAMETER); + + InstanceHandle_t r2_handle = reader_2.get_native_reader().get_instance_handle(); + ret = native_writer.get_matched_subscription_data(subdata, r2_handle); + + ASSERT_EQ(ret, ReturnCode_t::RETCODE_BAD_PARAMETER); +} + +/** + * Refers to DDS-DW-API-GMSD-02 from the test plan. + * + * The operation must succeed when the subscription is matched and correctly + * retrieve the publication data. Parameterize the test for different transports. + */ +TEST_P(DDSDataWriter, datawriter_get_matched_subscription_data_correctly_behaves) +{ + using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; + + PubSubWriter writer(TEST_TOPIC_NAME); + PubSubReader reader_1(TEST_TOPIC_NAME); + PubSubReader reader_2(TEST_TOPIC_NAME); + + eprosima::fastdds::dds::builtin::SubscriptionBuiltinTopicData r1_subdata, r2_subdata; + + writer.init(); + + reader_1.init(); + reader_2.reliability(RELIABLE_RELIABILITY_QOS) + .init(); + + ASSERT_TRUE(writer.isInitialized()); + ASSERT_TRUE(reader_1.isInitialized()); + ASSERT_TRUE(reader_2.isInitialized()); + + // Writer must match with both readers + writer.wait_discovery(2, std::chrono::seconds::zero()); + + ASSERT_EQ(writer.get_matched(), 2u); + + auto& native_writer = writer.get_native_writer(); + + InstanceHandle_t r1_handle = reader_1.get_native_reader().get_instance_handle(); + ReturnCode_t ret = native_writer.get_matched_subscription_data(r1_subdata, r1_handle); + + ASSERT_EQ(ret, ReturnCode_t::RETCODE_OK); + ASSERT_TRUE(validate_subscription_builtin_topic_data(r1_subdata, reader_1.get_native_reader())); + + InstanceHandle_t r2_handle = reader_2.get_native_reader().get_instance_handle(); + ret = native_writer.get_matched_subscription_data(r2_subdata, r2_handle); + + ASSERT_EQ(ret, ReturnCode_t::RETCODE_OK); + ASSERT_TRUE(validate_subscription_builtin_topic_data(r2_subdata, reader_2.get_native_reader())); +} + +/** + * Refers to DDS-DW-API-GMS-01 from the test plan. + * + * get_matched_subscriptions() must return RETCODE_OK + * with an empty list if no DataWriters are matched. + */ +TEST(DDSDataWriter, datawriter_get_matched_subscriptions_ok_empty_list) +{ + using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; + + PubSubWriter writer(TEST_TOPIC_NAME); + PubSubReader reader_1(TEST_TOPIC_NAME); + PubSubReader reader_2(TEST_TOPIC_NAME); + + std::vector sub_handles; + + writer.reliability(BEST_EFFORT_RELIABILITY_QOS) + .init(); + + reader_1.reliability(RELIABLE_RELIABILITY_QOS) + .init(); + + reader_2.ownership_exclusive() + .init(); + + ASSERT_TRUE(writer.isInitialized()); + ASSERT_TRUE(reader_1.isInitialized()); + ASSERT_TRUE(reader_2.isInitialized()); + + // Writer should not be matched with any reader + writer.wait_discovery(2, std::chrono::seconds(2)); + ASSERT_FALSE(writer.is_matched()); + + auto& native_writer = writer.get_native_writer(); + ReturnCode_t ret = native_writer.get_matched_subscriptions(sub_handles); + + ASSERT_EQ(ret, ReturnCode_t::RETCODE_OK); + ASSERT_EQ(sub_handles.size(), 0u); +} + +/** + * Refers to DDS-DW-API-GMS-02 from the test plan. + * + * get_matched_subscriptions() must provide the correct list of matched subscription handles. + * Parameterize the test for different transports. + */ +TEST_P(DDSDataWriter, datawriter_get_matched_subscriptions_correctly_behaves) +{ + using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; + + const size_t num_readers = 5; + + PubSubWriter writer(TEST_TOPIC_NAME); + std::vector>> readers; + std::vector expected_sub_handles; + std::vector sub_handles; + + readers.reserve(num_readers); + sub_handles.reserve(num_readers); + + writer.init(); + + ASSERT_TRUE(writer.isInitialized()); + + for (size_t i = 0; i < num_readers; ++i) + { + readers.emplace_back(new PubSubReader(TEST_TOPIC_NAME)); + readers.back()->init(); + ASSERT_TRUE(readers.back()->isInitialized()); + expected_sub_handles.emplace_back(readers.back()->get_native_reader().get_instance_handle()); + } + + // Wait for discovery + writer.wait_discovery(num_readers, std::chrono::seconds::zero()); + ASSERT_EQ(writer.get_matched(), num_readers); + + auto& native_writer = writer.get_native_writer(); + ReturnCode_t ret = native_writer.get_matched_subscriptions(sub_handles); + + // Check that the list of matched publication handles is correct + ASSERT_EQ(ret, ReturnCode_t::RETCODE_OK); + ASSERT_EQ(sub_handles.size(), num_readers); + ASSERT_TRUE(std::is_permutation(sub_handles.begin(), sub_handles.end(), expected_sub_handles.begin())); + + // Remove two readers and check that the list of matched publication handles is updated + readers.pop_back(); + readers.pop_back(); + expected_sub_handles.pop_back(); + expected_sub_handles.pop_back(); + + // Wait for undiscovery + writer.wait_reader_undiscovery(static_cast(num_readers - 2)); + + sub_handles.clear(); + ret = native_writer.get_matched_subscriptions(sub_handles); + ASSERT_EQ(ret, ReturnCode_t::RETCODE_OK); + ASSERT_EQ(sub_handles.size(), static_cast(num_readers - 2)); + ASSERT_TRUE(std::is_permutation(sub_handles.begin(), sub_handles.end(), expected_sub_handles.begin())); +} + +/** + * Refers to DDS-DW-API-GMS-03 from the test plan. + * + * The operation must provide the correct list of matched subscription handles in multiple + * participants scenario. Parameterize the test for different transports. + */ +TEST_P(DDSDataWriter, datawriter_get_matched_subscriptions_multiple_participants_correctly_behave) +{ + using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; + + PubSubParticipant part_1(1, 1, 1, 1); + PubSubParticipant part_2(1, 1, 1, 1); + + part_1.sub_topic_name(TEST_TOPIC_NAME + "_1"); + part_2.pub_topic_name(TEST_TOPIC_NAME + "_1"); + + ASSERT_TRUE(part_1.init_participant()); + ASSERT_TRUE(part_1.init_publisher(0)); + ASSERT_TRUE(part_1.init_subscriber(0)); + + ASSERT_TRUE(part_2.init_participant()); + ASSERT_TRUE(part_2.init_subscriber(0)); + ASSERT_TRUE(part_2.init_publisher(0)); + + part_1.pub_wait_discovery(); + part_1.sub_wait_discovery(); + + part_2.pub_wait_discovery(); + part_2.sub_wait_discovery(); + + auto& writer_p1 = part_1.get_native_writer(0); + auto& writer_p2 = part_2.get_native_writer(0); + + std::vector sub_handles_p1; + std::vector sub_handles_p2; + + ReturnCode_t ret = writer_p1.get_matched_subscriptions(sub_handles_p1); + ASSERT_EQ(ret, ReturnCode_t::RETCODE_OK); + ASSERT_EQ(sub_handles_p1.size(), 1u); + ASSERT_EQ(sub_handles_p1[0], part_2.get_native_reader(0).get_instance_handle()); + + ret = writer_p2.get_matched_subscriptions(sub_handles_p2); + ASSERT_EQ(ret, ReturnCode_t::RETCODE_OK); + ASSERT_EQ(sub_handles_p2.size(), 1u); + ASSERT_EQ(sub_handles_p2[0], part_1.get_native_reader(0).get_instance_handle()); +} + #ifdef INSTANTIATE_TEST_SUITE_P #define GTEST_INSTANTIATE_TEST_MACRO(x, y, z, w) INSTANTIATE_TEST_SUITE_P(x, y, z, w) #else From afed24d8badd60e57d30f851433c95c3fb460550 Mon Sep 17 00:00:00 2001 From: Mario Dominguez Date: Wed, 25 Sep 2024 14:46:08 +0200 Subject: [PATCH 03/15] Refs #21710: Empty APIs in RTPSParticipant, RTPSWriter, RTPSReader Signed-off-by: Mario Dominguez --- .../rtps/participant/RTPSParticipant.h | 26 +++++++++++++++++++ include/fastdds/rtps/reader/RTPSReader.h | 9 +++++++ include/fastdds/rtps/writer/RTPSWriter.h | 9 +++++++ src/cpp/rtps/participant/RTPSParticipant.cpp | 14 ++++++++++ src/cpp/rtps/reader/RTPSReader.cpp | 6 +++++ src/cpp/rtps/writer/RTPSWriter.cpp | 6 +++++ .../rtps/participant/RTPSParticipant.h | 12 +++++++++ 7 files changed, 82 insertions(+) diff --git a/include/fastdds/rtps/participant/RTPSParticipant.h b/include/fastdds/rtps/participant/RTPSParticipant.h index 1b3a19abd56..76bafb74608 100644 --- a/include/fastdds/rtps/participant/RTPSParticipant.h +++ b/include/fastdds/rtps/participant/RTPSParticipant.h @@ -54,6 +54,8 @@ namespace dds { namespace builtin { class TypeLookupManager; +struct PublicationBuiltinTopicData; +struct SubscriptionBuiltinTopicData; } // namespace builtin } // namespace dds @@ -306,6 +308,30 @@ class RTPS_DllAPI RTPSParticipant */ std::vector get_netmask_filter_info() const; + /** + * @brief Fills the provided PublicationBuiltinTopicData with the information of the + * writer identified by writer_guid. + * + * @param[out] data PublicationBuiltinTopicData to fill. + * @param[in] writer_guid GUID of the writer to get the information from. + * @return True if the writer was found and the data was filled. + */ + bool get_publication_info( + const GUID_t& writer_guid, + fastdds::dds::builtin::PublicationBuiltinTopicData& data) const; + + /** + * @brief Fills the provided SubscriptionBuiltinTopicData with the information of the + * reader identified by reader_guid. + * + * @param[out] data SubscriptionBuiltinTopicData to fill. + * @param[in] reader_guid GUID of the reader to get the information from. + * @return True if the reader was found and the data was filled. + */ + bool get_subscription_info( + const GUID_t& reader_guid, + fastdds::dds::builtin::SubscriptionBuiltinTopicData& data) const; + #if HAVE_SECURITY /** diff --git a/include/fastdds/rtps/reader/RTPSReader.h b/include/fastdds/rtps/reader/RTPSReader.h index 6db4528e617..000a64bc841 100644 --- a/include/fastdds/rtps/reader/RTPSReader.h +++ b/include/fastdds/rtps/reader/RTPSReader.h @@ -276,6 +276,15 @@ class RTPSReader data_filter_ = filter; } + /** + * @brief Fills the provided vector with the GUIDs of the matched writers. + * + * @param[out] guids Vector to be filled with the GUIDs of the matched writers. + * @return True if the operation was successful. + */ + RTPS_DllAPI bool get_matched_guids( + std::vector& guids) const; + /*! * @brief Returns there is a clean state with all Writers. * It occurs when the Reader received all samples sent by Writers. In other words, diff --git a/include/fastdds/rtps/writer/RTPSWriter.h b/include/fastdds/rtps/writer/RTPSWriter.h index b4503bd18bf..6a821ce98e1 100644 --- a/include/fastdds/rtps/writer/RTPSWriter.h +++ b/include/fastdds/rtps/writer/RTPSWriter.h @@ -317,6 +317,15 @@ class RTPSWriter return false; } + /** + * @brief Fills the provided vector with the GUIDs of the matched readers. + * + * @param[out] guids Vector to be filled with the GUIDs of the matched readers. + * @return True if the operation was successful. + */ + RTPS_DllAPI bool get_matched_guids( + std::vector& guids) const; + /** * Tries to remove a change waiting a maximum of the provided microseconds. * @param max_blocking_time_point Maximum time to wait for. diff --git a/src/cpp/rtps/participant/RTPSParticipant.cpp b/src/cpp/rtps/participant/RTPSParticipant.cpp index f6a32273acb..18140c3be3d 100644 --- a/src/cpp/rtps/participant/RTPSParticipant.cpp +++ b/src/cpp/rtps/participant/RTPSParticipant.cpp @@ -201,6 +201,20 @@ std::vector RTPSParticipant::get_netm return mp_impl->get_netmask_filter_info(); } +bool RTPSParticipant::get_publication_info( + const GUID_t&, + fastdds::dds::builtin::PublicationBuiltinTopicData&) const +{ + return false; +} + +bool RTPSParticipant::get_subscription_info( + const GUID_t&, + fastdds::dds::builtin::SubscriptionBuiltinTopicData&) const +{ + return false; +} + #if HAVE_SECURITY bool RTPSParticipant::is_security_enabled_for_writer( diff --git a/src/cpp/rtps/reader/RTPSReader.cpp b/src/cpp/rtps/reader/RTPSReader.cpp index 297feee6ef9..3bacdab992d 100644 --- a/src/cpp/rtps/reader/RTPSReader.cpp +++ b/src/cpp/rtps/reader/RTPSReader.cpp @@ -435,6 +435,12 @@ bool RTPSReader::is_sample_valid( return true; } +bool RTPSReader::get_matched_guids( + std::vector&) const +{ + return false; +} + #ifdef FASTDDS_STATISTICS bool RTPSReader::add_statistics_listener( diff --git a/src/cpp/rtps/writer/RTPSWriter.cpp b/src/cpp/rtps/writer/RTPSWriter.cpp index ec7527bd75f..316a7b5994e 100644 --- a/src/cpp/rtps/writer/RTPSWriter.cpp +++ b/src/cpp/rtps/writer/RTPSWriter.cpp @@ -462,6 +462,12 @@ bool RTPSWriter::send_nts( locator_selector.locator_selector.end(), max_blocking_time_point); } +bool RTPSWriter::get_matched_guids( + std::vector&) const +{ + return false; +} + #ifdef FASTDDS_STATISTICS bool RTPSWriter::add_statistics_listener( diff --git a/test/mock/rtps/RTPSParticipant/fastdds/rtps/participant/RTPSParticipant.h b/test/mock/rtps/RTPSParticipant/fastdds/rtps/participant/RTPSParticipant.h index 26326c84327..8e63ba66794 100644 --- a/test/mock/rtps/RTPSParticipant/fastdds/rtps/participant/RTPSParticipant.h +++ b/test/mock/rtps/RTPSParticipant/fastdds/rtps/participant/RTPSParticipant.h @@ -49,6 +49,8 @@ namespace dds { namespace builtin { class TypeLookupManager; +struct PublicationBuiltinTopicData; +struct SubscriptionBuiltinTopicData; } // namespace builtin } // namespace dds @@ -225,6 +227,16 @@ class RTPS_DllAPI RTPSParticipant return {}; } + MOCK_METHOD2( + get_publication_info, bool( + const GUID_t& writer_guid, + fastdds::dds::builtin::PublicationBuiltinTopicData& data)); + + MOCK_METHOD2( + get_subscription_info, bool( + const GUID_t& writer_guid, + fastdds::dds::builtin::SubscriptionBuiltinTopicData& data)); + const RTPSParticipantAttributes& getRTPSParticipantAttributes() { return attributes_; From 539cf6e2054b6f0c7a1a1e4ff5c6b8acbd50673f Mon Sep 17 00:00:00 2001 From: Mario Dominguez Date: Wed, 25 Sep 2024 16:22:37 +0200 Subject: [PATCH 04/15] Refs #21710: RTPS APIs tests Signed-off-by: Mario Dominguez --- .../common/RTPSBlackboxTestsBasic.cpp | 164 ++++++++++++++++++ .../common/RTPSBlackboxTestsReader.cpp | 153 ++++++++++++++++ .../common/RTPSBlackboxTestsWriter.cpp | 153 ++++++++++++++++ .../common/RTPSWithRegistrationReader.hpp | 15 ++ .../common/RTPSWithRegistrationWriter.hpp | 20 +++ 5 files changed, 505 insertions(+) create mode 100644 test/blackbox/common/RTPSBlackboxTestsReader.cpp create mode 100644 test/blackbox/common/RTPSBlackboxTestsWriter.cpp diff --git a/test/blackbox/common/RTPSBlackboxTestsBasic.cpp b/test/blackbox/common/RTPSBlackboxTestsBasic.cpp index 409fdc3dff8..62a377afb20 100644 --- a/test/blackbox/common/RTPSBlackboxTestsBasic.cpp +++ b/test/blackbox/common/RTPSBlackboxTestsBasic.cpp @@ -21,6 +21,9 @@ #include +#include +#include +#include #include #include #include @@ -1276,6 +1279,167 @@ TEST(RTPS, max_output_message_size_writer) } +bool validate_publication_builtin_topic_data( + const eprosima::fastdds::dds::builtin::PublicationBuiltinTopicData& pubdata, + const RTPSWriter& writer, + const TopicAttributes& topic_atts, + const WriterQos& writer_qos, + const GUID_t& participant_guid) +{ + bool ret = true; + + eprosima::fastdds::dds::builtin::BuiltinTopicKey_t w_key, part_key; + GuidPrefix_t guid_prefix = participant_guid.guidPrefix; + + // This conversions may be included later in utils + w_key.value[0] = 0; + w_key.value[1] = 0; + w_key.value[2] = static_cast(writer.getGuid().entityId.value[0]) << 24 + | static_cast(writer.getGuid().entityId.value[1]) << 16 + | static_cast(writer.getGuid().entityId.value[2]) << 8 + | static_cast(writer.getGuid().entityId.value[3]); + + part_key.value[0] = static_cast(guid_prefix.value[0]) << 24 + | static_cast(guid_prefix.value[1]) << 16 + | static_cast(guid_prefix.value[2]) << 8 + | static_cast(guid_prefix.value[3]); + part_key.value[1] = static_cast(guid_prefix.value[4]) << 24 + | static_cast(guid_prefix.value[5]) << 16 + | static_cast(guid_prefix.value[6]) << 8 + | static_cast(guid_prefix.value[7]); + part_key.value[2] = static_cast(guid_prefix.value[8]) << 24 + | static_cast(guid_prefix.value[9]) << 16 + | static_cast(guid_prefix.value[10]) << 8 + | static_cast(guid_prefix.value[11]); + + ret &= (0 == memcmp(pubdata.key.value, w_key.value, sizeof(eprosima::fastdds::dds::builtin::BuiltinTopicKey_t))); + ret &= + (0 == + memcmp(pubdata.participant_key.value, part_key.value, + sizeof(eprosima::fastdds::dds::builtin::BuiltinTopicKey_t))); + ret &= (pubdata.topic_name == topic_atts.topicName.to_string()); + ret &= (pubdata.type_name == topic_atts.topicDataType.to_string()); + + // Writer Qos + ret &= (pubdata.durability == writer_qos.m_durability); + ret &= (pubdata.durability_service == writer_qos.m_durabilityService); + ret &= (pubdata.deadline == writer_qos.m_deadline); + ret &= (pubdata.latency_budget == writer_qos.m_latencyBudget); + ret &= (pubdata.liveliness == writer_qos.m_liveliness); + ret &= (pubdata.reliability == writer_qos.m_reliability); + ret &= (pubdata.lifespan == writer_qos.m_lifespan); + ret &= (pubdata.user_data == writer_qos.m_userData); + ret &= (pubdata.ownership == writer_qos.m_ownership); + ret &= (pubdata.ownership_strength == writer_qos.m_ownershipStrength); + ret &= (pubdata.destination_order == writer_qos.m_destinationOrder); + + // Publisher Qos + ret &= (pubdata.presentation == writer_qos.m_presentation); + ret &= (pubdata.partition == writer_qos.m_partition); + // topicdata not implemented + ret &= (pubdata.group_data == writer_qos.m_groupData); + + return ret; +} + +bool validate_subscription_builtin_topic_data( + const eprosima::fastdds::dds::builtin::SubscriptionBuiltinTopicData& subdata, + const RTPSReader& reader, + const TopicAttributes& topic_atts, + const ReaderQos& reader_qos, + const GUID_t& participant_guid) +{ + bool ret = true; + + eprosima::fastdds::dds::builtin::BuiltinTopicKey_t r_key, part_key; + eprosima::fastrtps::rtps::GuidPrefix_t part_guid_prefix = participant_guid.guidPrefix; + + // This conversions may be included later in utils + r_key.value[0] = 0; + r_key.value[1] = 0; + r_key.value[2] = static_cast(reader.getGuid().entityId.value[0]) << 24 + | static_cast(reader.getGuid().entityId.value[1]) << 16 + | static_cast(reader.getGuid().entityId.value[2]) << 8 + | static_cast(reader.getGuid().entityId.value[3]); + + part_key.value[0] = static_cast(part_guid_prefix.value[0]) << 24 + | static_cast(part_guid_prefix.value[1]) << 16 + | static_cast(part_guid_prefix.value[2]) << 8 + | static_cast(part_guid_prefix.value[3]); + part_key.value[1] = static_cast(part_guid_prefix.value[4]) << 24 + | static_cast(part_guid_prefix.value[5]) << 16 + | static_cast(part_guid_prefix.value[6]) << 8 + | static_cast(part_guid_prefix.value[7]); + part_key.value[2] = static_cast(part_guid_prefix.value[8]) << 24 + | static_cast(part_guid_prefix.value[9]) << 16 + | static_cast(part_guid_prefix.value[10]) << 8 + | static_cast(part_guid_prefix.value[11]); + + ret &= (0 == memcmp(subdata.key.value, r_key.value, sizeof(eprosima::fastdds::dds::builtin::BuiltinTopicKey_t))); + ret &= + (0 == + memcmp(subdata.participant_key.value, part_key.value, + sizeof(eprosima::fastdds::dds::builtin::BuiltinTopicKey_t))); + ret &= (subdata.topic_name == topic_atts.topicName.to_string()); + ret &= (subdata.type_name == topic_atts.topicDataType.to_string()); + + // RTPS Reader + ret &= (subdata.durability == reader_qos.m_durability); + ret &= (subdata.deadline == reader_qos.m_deadline); + ret &= (subdata.latency_budget == reader_qos.m_latencyBudget); + ret &= (subdata.liveliness == reader_qos.m_liveliness); + ret &= (subdata.reliability == reader_qos.m_reliability); + ret &= (subdata.ownership == reader_qos.m_ownership); + ret &= (subdata.destination_order == reader_qos.m_destinationOrder); + ret &= (subdata.user_data == reader_qos.m_userData); + // time based filter not implemented + + // Subscriber Qos + ret &= (subdata.presentation == reader_qos.m_presentation); + ret &= (subdata.partition == reader_qos.m_partition); + ret &= (subdata.group_data == reader_qos.m_groupData); + + return ret; +} + +/** + * Tests get_publication_info() get_subscription_info() RTPSParticipant APIs + */ +TEST_P(RTPS, rtps_participant_get_pubsub_info) +{ + RTPSWithRegistrationWriter writer(TEST_TOPIC_NAME); + RTPSWithRegistrationReader reader(TEST_TOPIC_NAME); + + writer.init(); + reader.init(); + + ASSERT_TRUE(writer.isInitialized()); + ASSERT_TRUE(reader.isInitialized()); + + writer.wait_discovery(); + reader.wait_discovery(); + + ASSERT_TRUE(writer.get_matched()); + ASSERT_TRUE(reader.get_matched()); + + eprosima::fastdds::dds::builtin::PublicationBuiltinTopicData pubdata; + eprosima::fastdds::dds::builtin::SubscriptionBuiltinTopicData subdata; + + // Get publication info from the reader participant and validate it + bool ret = reader.get_rtps_participant()->get_publication_info(writer.guid(), pubdata); + ASSERT_TRUE(ret); + ASSERT_TRUE(validate_publication_builtin_topic_data(pubdata, writer.get_native_writer(), + writer.get_topic_attributes(), + writer.get_writerqos(), reader.get_rtps_participant()->getGuid())); + + // Get subscription info from the reader participant and validate it + ret = writer.get_rtps_participant()->get_subscription_info(reader.guid(), subdata); + ASSERT_TRUE(ret); + ASSERT_TRUE(validate_subscription_builtin_topic_data(subdata, reader.get_native_reader(), + reader.get_topic_attributes(), + reader.get_readerqos(), reader.get_rtps_participant()->getGuid())); +} + #ifdef INSTANTIATE_TEST_SUITE_P #define GTEST_INSTANTIATE_TEST_MACRO(x, y, z, w) INSTANTIATE_TEST_SUITE_P(x, y, z, w) #else diff --git a/test/blackbox/common/RTPSBlackboxTestsReader.cpp b/test/blackbox/common/RTPSBlackboxTestsReader.cpp new file mode 100644 index 00000000000..2ddb8d0210f --- /dev/null +++ b/test/blackbox/common/RTPSBlackboxTestsReader.cpp @@ -0,0 +1,153 @@ +// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "BlackboxTests.hpp" + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "RTPSWithRegistrationReader.hpp" +#include "RTPSWithRegistrationWriter.hpp" + +using namespace eprosima::fastrtps; +using namespace eprosima::fastrtps::rtps; + +enum communication_type +{ + TRANSPORT, + INTRAPROCESS +}; + +class RTPSReaderTests : public testing::TestWithParam +{ +public: + + void SetUp() override + { + LibrarySettingsAttributes library_settings; + switch (GetParam()) + { + case INTRAPROCESS: + library_settings.intraprocess_delivery = IntraprocessDeliveryType::INTRAPROCESS_FULL; + xmlparser::XMLProfileManager::library_settings(library_settings); + break; + case TRANSPORT: + default: + break; + } + } + + void TearDown() override + { + LibrarySettingsAttributes library_settings; + switch (GetParam()) + { + case INTRAPROCESS: + library_settings.intraprocess_delivery = IntraprocessDeliveryType::INTRAPROCESS_OFF; + xmlparser::XMLProfileManager::library_settings(library_settings); + break; + case TRANSPORT: + default: + break; + } + } + +}; + +/** + * Tests get_matched_guids() RTPSReader API + */ +TEST_P(RTPSReaderTests, rtpsreader_get_matched_guids) +{ + RTPSWithRegistrationReader reader(TEST_TOPIC_NAME); + RTPSWithRegistrationWriter writer(TEST_TOPIC_NAME); + + reader.reliability(eprosima::fastrtps::rtps::RELIABLE) + .init(); + + writer.reliability(eprosima::fastrtps::rtps::BEST_EFFORT) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer.isInitialized()); + + // Expect not to discover + reader.wait_discovery(std::chrono::seconds(1)); + ASSERT_FALSE(reader.get_matched()); + + std::vector matched_guids; + auto& native_rtps_reader = reader.get_native_reader(); + ASSERT_FALSE(native_rtps_reader.get_matched_guids(matched_guids)); + ASSERT_TRUE(matched_guids.empty()); + + writer.destroy(); + reader.wait_undiscovery(); + + const size_t num_matched_writers = 3; + std::vector>> writers; + std::vector expected_matched_guids; + + writers.reserve(num_matched_writers); + expected_matched_guids.reserve(num_matched_writers); + + for (size_t i = 0; i < num_matched_writers; ++i) + { + writers.emplace_back(new RTPSWithRegistrationWriter(TEST_TOPIC_NAME)); + writers.back()->init(); + expected_matched_guids.emplace_back(writers.back()->guid()); + } + + reader.wait_discovery(num_matched_writers, std::chrono::seconds::zero()); + ASSERT_EQ(num_matched_writers, reader.get_matched()); + native_rtps_reader.get_matched_guids(matched_guids); + ASSERT_EQ(expected_matched_guids.size(), matched_guids.size()); + ASSERT_TRUE(std::is_permutation(expected_matched_guids.begin(), expected_matched_guids.end(), + matched_guids.begin())); +} + +#ifdef INSTANTIATE_TEST_SUITE_P +#define GTEST_INSTANTIATE_TEST_MACRO(x, y, z, w) INSTANTIATE_TEST_SUITE_P(x, y, z, w) +#else +#define GTEST_INSTANTIATE_TEST_MACRO(x, y, z, w) INSTANTIATE_TEST_CASE_P(x, y, z, w) +#endif // ifdef INSTANTIATE_TEST_SUITE_P + +GTEST_INSTANTIATE_TEST_MACRO(RTPSReaderTests, + RTPSReaderTests, + testing::Values(TRANSPORT, INTRAPROCESS), + [](const testing::TestParamInfo& info) + { + switch (info.param) + { + case INTRAPROCESS: + return "Intraprocess"; + break; + case TRANSPORT: + default: + return "Transport"; + } + + }); diff --git a/test/blackbox/common/RTPSBlackboxTestsWriter.cpp b/test/blackbox/common/RTPSBlackboxTestsWriter.cpp new file mode 100644 index 00000000000..5a48f620f04 --- /dev/null +++ b/test/blackbox/common/RTPSBlackboxTestsWriter.cpp @@ -0,0 +1,153 @@ +// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "BlackboxTests.hpp" + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "RTPSWithRegistrationReader.hpp" +#include "RTPSWithRegistrationWriter.hpp" + +using namespace eprosima::fastrtps; +using namespace eprosima::fastrtps::rtps; + +enum communication_type +{ + TRANSPORT, + INTRAPROCESS +}; + +class RTPSWriterTests : public testing::TestWithParam +{ +public: + + void SetUp() override + { + LibrarySettingsAttributes library_settings; + switch (GetParam()) + { + case INTRAPROCESS: + library_settings.intraprocess_delivery = IntraprocessDeliveryType::INTRAPROCESS_FULL; + xmlparser::XMLProfileManager::library_settings(library_settings); + break; + case TRANSPORT: + default: + break; + } + } + + void TearDown() override + { + LibrarySettingsAttributes library_settings; + switch (GetParam()) + { + case INTRAPROCESS: + library_settings.intraprocess_delivery = IntraprocessDeliveryType::INTRAPROCESS_OFF; + xmlparser::XMLProfileManager::library_settings(library_settings); + break; + case TRANSPORT: + default: + break; + } + } + +}; + +/** + * Tests get_matched_guids() RTPSWriter API + */ +TEST_P(RTPSWriterTests, rtpswriter_get_matched_guids) +{ + RTPSWithRegistrationWriter writer(TEST_TOPIC_NAME); + RTPSWithRegistrationReader reader(TEST_TOPIC_NAME); + + writer.reliability(eprosima::fastrtps::rtps::BEST_EFFORT) + .init(); + + reader.reliability(eprosima::fastrtps::rtps::RELIABLE) + .init(); + + ASSERT_TRUE(writer.isInitialized()); + ASSERT_TRUE(reader.isInitialized()); + + // Expect not to discover + writer.wait_discovery(std::chrono::seconds(1)); + ASSERT_FALSE(writer.get_matched()); + + std::vector matched_guids; + auto& native_rtps_writer = writer.get_native_writer(); + ASSERT_FALSE(native_rtps_writer.get_matched_guids(matched_guids)); + ASSERT_TRUE(matched_guids.empty()); + + reader.destroy(); + writer.wait_undiscovery(); + + const size_t num_matched_readers = 3; + std::vector>> readers; + std::vector expected_matched_guids; + + readers.reserve(num_matched_readers); + expected_matched_guids.reserve(num_matched_readers); + + for (size_t i = 0; i < num_matched_readers; ++i) + { + readers.emplace_back(new RTPSWithRegistrationReader(TEST_TOPIC_NAME)); + readers.back()->init(); + expected_matched_guids.emplace_back(readers.back()->guid()); + } + + writer.wait_discovery(num_matched_readers, std::chrono::seconds::zero()); + ASSERT_EQ(num_matched_readers, writer.get_matched()); + native_rtps_writer.get_matched_guids(matched_guids); + ASSERT_EQ(expected_matched_guids.size(), matched_guids.size()); + ASSERT_TRUE(std::is_permutation(expected_matched_guids.begin(), expected_matched_guids.end(), + matched_guids.begin())); +} + +#ifdef INSTANTIATE_TEST_SUITE_P +#define GTEST_INSTANTIATE_TEST_MACRO(x, y, z, w) INSTANTIATE_TEST_SUITE_P(x, y, z, w) +#else +#define GTEST_INSTANTIATE_TEST_MACRO(x, y, z, w) INSTANTIATE_TEST_CASE_P(x, y, z, w) +#endif // ifdef INSTANTIATE_TEST_SUITE_P + +GTEST_INSTANTIATE_TEST_MACRO(RTPSWriterTests, + RTPSWriterTests, + testing::Values(TRANSPORT, INTRAPROCESS), + [](const testing::TestParamInfo& info) + { + switch (info.param) + { + case INTRAPROCESS: + return "Intraprocess"; + break; + case TRANSPORT: + default: + return "Transport"; + } + + }); diff --git a/test/blackbox/common/RTPSWithRegistrationReader.hpp b/test/blackbox/common/RTPSWithRegistrationReader.hpp index d48300ca830..3d92b25c1bc 100644 --- a/test/blackbox/common/RTPSWithRegistrationReader.hpp +++ b/test/blackbox/common/RTPSWithRegistrationReader.hpp @@ -551,6 +551,21 @@ class RTPSWithRegistrationReader return *reader_; } + eprosima::fastrtps::ReaderQos& get_readerqos() + { + return reader_qos_; + } + + eprosima::fastrtps::TopicAttributes& get_topic_attributes() + { + return topic_attr_; + } + + eprosima::fastrtps::rtps::RTPSParticipant* get_rtps_participant() + { + return participant_; + } + private: void receive_one( diff --git a/test/blackbox/common/RTPSWithRegistrationWriter.hpp b/test/blackbox/common/RTPSWithRegistrationWriter.hpp index 0b35f07cd9e..448ef3669bc 100644 --- a/test/blackbox/common/RTPSWithRegistrationWriter.hpp +++ b/test/blackbox/common/RTPSWithRegistrationWriter.hpp @@ -573,6 +573,26 @@ class RTPSWithRegistrationWriter return writer_->getGuid(); } + eprosima::fastrtps::rtps::RTPSWriter& get_native_writer() const + { + return *writer_; + } + + eprosima::fastrtps::WriterQos& get_writerqos() + { + return writer_qos_; + } + + eprosima::fastrtps::TopicAttributes& get_topic_attributes() + { + return topic_attr_; + } + + eprosima::fastrtps::rtps::RTPSParticipant* get_rtps_participant() + { + return participant_; + } + private: void on_reader_discovery( From e369c22c49d3c73a7cd4b3f7f24030d8be324934 Mon Sep 17 00:00:00 2001 From: Mario Dominguez Date: Thu, 26 Sep 2024 09:28:45 +0200 Subject: [PATCH 05/15] Refs #21710: Rename get_matched_guids() method to matched_writers/readers_guids() Signed-off-by: Mario Dominguez --- include/fastdds/rtps/reader/RTPSReader.h | 2 +- include/fastdds/rtps/writer/RTPSWriter.h | 2 +- src/cpp/rtps/reader/RTPSReader.cpp | 2 +- src/cpp/rtps/writer/RTPSWriter.cpp | 2 +- test/blackbox/common/RTPSBlackboxTestsReader.cpp | 8 ++++---- test/blackbox/common/RTPSBlackboxTestsWriter.cpp | 8 ++++---- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/fastdds/rtps/reader/RTPSReader.h b/include/fastdds/rtps/reader/RTPSReader.h index 000a64bc841..124d7258d53 100644 --- a/include/fastdds/rtps/reader/RTPSReader.h +++ b/include/fastdds/rtps/reader/RTPSReader.h @@ -282,7 +282,7 @@ class RTPSReader * @param[out] guids Vector to be filled with the GUIDs of the matched writers. * @return True if the operation was successful. */ - RTPS_DllAPI bool get_matched_guids( + RTPS_DllAPI bool matched_writers_guids( std::vector& guids) const; /*! diff --git a/include/fastdds/rtps/writer/RTPSWriter.h b/include/fastdds/rtps/writer/RTPSWriter.h index 6a821ce98e1..d8d0c753a7d 100644 --- a/include/fastdds/rtps/writer/RTPSWriter.h +++ b/include/fastdds/rtps/writer/RTPSWriter.h @@ -323,7 +323,7 @@ class RTPSWriter * @param[out] guids Vector to be filled with the GUIDs of the matched readers. * @return True if the operation was successful. */ - RTPS_DllAPI bool get_matched_guids( + RTPS_DllAPI bool matched_readers_guids( std::vector& guids) const; /** diff --git a/src/cpp/rtps/reader/RTPSReader.cpp b/src/cpp/rtps/reader/RTPSReader.cpp index 3bacdab992d..17822930d3a 100644 --- a/src/cpp/rtps/reader/RTPSReader.cpp +++ b/src/cpp/rtps/reader/RTPSReader.cpp @@ -435,7 +435,7 @@ bool RTPSReader::is_sample_valid( return true; } -bool RTPSReader::get_matched_guids( +bool RTPSReader::matched_writers_guids( std::vector&) const { return false; diff --git a/src/cpp/rtps/writer/RTPSWriter.cpp b/src/cpp/rtps/writer/RTPSWriter.cpp index 316a7b5994e..8ce1b9eb3e2 100644 --- a/src/cpp/rtps/writer/RTPSWriter.cpp +++ b/src/cpp/rtps/writer/RTPSWriter.cpp @@ -462,7 +462,7 @@ bool RTPSWriter::send_nts( locator_selector.locator_selector.end(), max_blocking_time_point); } -bool RTPSWriter::get_matched_guids( +bool RTPSWriter::matched_readers_guids( std::vector&) const { return false; diff --git a/test/blackbox/common/RTPSBlackboxTestsReader.cpp b/test/blackbox/common/RTPSBlackboxTestsReader.cpp index 2ddb8d0210f..1099f01567c 100644 --- a/test/blackbox/common/RTPSBlackboxTestsReader.cpp +++ b/test/blackbox/common/RTPSBlackboxTestsReader.cpp @@ -79,9 +79,9 @@ class RTPSReaderTests : public testing::TestWithParam }; /** - * Tests get_matched_guids() RTPSReader API + * Tests matched_writers_guids() RTPSReader API */ -TEST_P(RTPSReaderTests, rtpsreader_get_matched_guids) +TEST_P(RTPSReaderTests, rtpsreader_matched_writers_guids) { RTPSWithRegistrationReader reader(TEST_TOPIC_NAME); RTPSWithRegistrationWriter writer(TEST_TOPIC_NAME); @@ -101,7 +101,7 @@ TEST_P(RTPSReaderTests, rtpsreader_get_matched_guids) std::vector matched_guids; auto& native_rtps_reader = reader.get_native_reader(); - ASSERT_FALSE(native_rtps_reader.get_matched_guids(matched_guids)); + ASSERT_FALSE(native_rtps_reader.matched_writers_guids(matched_guids)); ASSERT_TRUE(matched_guids.empty()); writer.destroy(); @@ -123,7 +123,7 @@ TEST_P(RTPSReaderTests, rtpsreader_get_matched_guids) reader.wait_discovery(num_matched_writers, std::chrono::seconds::zero()); ASSERT_EQ(num_matched_writers, reader.get_matched()); - native_rtps_reader.get_matched_guids(matched_guids); + native_rtps_reader.matched_writers_guids(matched_guids); ASSERT_EQ(expected_matched_guids.size(), matched_guids.size()); ASSERT_TRUE(std::is_permutation(expected_matched_guids.begin(), expected_matched_guids.end(), matched_guids.begin())); diff --git a/test/blackbox/common/RTPSBlackboxTestsWriter.cpp b/test/blackbox/common/RTPSBlackboxTestsWriter.cpp index 5a48f620f04..f75275ad8d0 100644 --- a/test/blackbox/common/RTPSBlackboxTestsWriter.cpp +++ b/test/blackbox/common/RTPSBlackboxTestsWriter.cpp @@ -79,9 +79,9 @@ class RTPSWriterTests : public testing::TestWithParam }; /** - * Tests get_matched_guids() RTPSWriter API + * Tests matched_readers_guids() RTPSWriter API */ -TEST_P(RTPSWriterTests, rtpswriter_get_matched_guids) +TEST_P(RTPSWriterTests, rtpswriter_matched_readers_guids) { RTPSWithRegistrationWriter writer(TEST_TOPIC_NAME); RTPSWithRegistrationReader reader(TEST_TOPIC_NAME); @@ -101,7 +101,7 @@ TEST_P(RTPSWriterTests, rtpswriter_get_matched_guids) std::vector matched_guids; auto& native_rtps_writer = writer.get_native_writer(); - ASSERT_FALSE(native_rtps_writer.get_matched_guids(matched_guids)); + ASSERT_FALSE(native_rtps_writer.matched_readers_guids(matched_guids)); ASSERT_TRUE(matched_guids.empty()); reader.destroy(); @@ -123,7 +123,7 @@ TEST_P(RTPSWriterTests, rtpswriter_get_matched_guids) writer.wait_discovery(num_matched_readers, std::chrono::seconds::zero()); ASSERT_EQ(num_matched_readers, writer.get_matched()); - native_rtps_writer.get_matched_guids(matched_guids); + native_rtps_writer.matched_readers_guids(matched_guids); ASSERT_EQ(expected_matched_guids.size(), matched_guids.size()); ASSERT_TRUE(std::is_permutation(expected_matched_guids.begin(), expected_matched_guids.end(), matched_guids.begin())); From 828275fdb630c0ba9fbd01abdef8d3bfcd826d5e Mon Sep 17 00:00:00 2001 From: Mario Dominguez Date: Fri, 27 Sep 2024 09:31:14 +0200 Subject: [PATCH 06/15] Refs #21709: Minor changes to be coherent with latest design updates Signed-off-by: Mario Dominguez --- include/fastdds/rtps/participant/RTPSParticipant.h | 8 ++++---- src/cpp/rtps/participant/RTPSParticipant.cpp | 8 ++++---- test/blackbox/common/RTPSBlackboxTestsBasic.cpp | 4 ++-- .../fastdds/rtps/participant/RTPSParticipant.h | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/fastdds/rtps/participant/RTPSParticipant.h b/include/fastdds/rtps/participant/RTPSParticipant.h index 76bafb74608..1dd9de4f389 100644 --- a/include/fastdds/rtps/participant/RTPSParticipant.h +++ b/include/fastdds/rtps/participant/RTPSParticipant.h @@ -317,8 +317,8 @@ class RTPS_DllAPI RTPSParticipant * @return True if the writer was found and the data was filled. */ bool get_publication_info( - const GUID_t& writer_guid, - fastdds::dds::builtin::PublicationBuiltinTopicData& data) const; + fastdds::dds::builtin::PublicationBuiltinTopicData& data, + const GUID_t& writer_guid) const; /** * @brief Fills the provided SubscriptionBuiltinTopicData with the information of the @@ -329,8 +329,8 @@ class RTPS_DllAPI RTPSParticipant * @return True if the reader was found and the data was filled. */ bool get_subscription_info( - const GUID_t& reader_guid, - fastdds::dds::builtin::SubscriptionBuiltinTopicData& data) const; + fastdds::dds::builtin::SubscriptionBuiltinTopicData& data, + const GUID_t& reader_guid) const; #if HAVE_SECURITY diff --git a/src/cpp/rtps/participant/RTPSParticipant.cpp b/src/cpp/rtps/participant/RTPSParticipant.cpp index 18140c3be3d..ce4263aa2ef 100644 --- a/src/cpp/rtps/participant/RTPSParticipant.cpp +++ b/src/cpp/rtps/participant/RTPSParticipant.cpp @@ -202,15 +202,15 @@ std::vector RTPSParticipant::get_netm } bool RTPSParticipant::get_publication_info( - const GUID_t&, - fastdds::dds::builtin::PublicationBuiltinTopicData&) const + fastdds::dds::builtin::PublicationBuiltinTopicData&, + const GUID_t&) const { return false; } bool RTPSParticipant::get_subscription_info( - const GUID_t&, - fastdds::dds::builtin::SubscriptionBuiltinTopicData&) const + fastdds::dds::builtin::SubscriptionBuiltinTopicData&, + const GUID_t&) const { return false; } diff --git a/test/blackbox/common/RTPSBlackboxTestsBasic.cpp b/test/blackbox/common/RTPSBlackboxTestsBasic.cpp index 62a377afb20..a3d11bf7840 100644 --- a/test/blackbox/common/RTPSBlackboxTestsBasic.cpp +++ b/test/blackbox/common/RTPSBlackboxTestsBasic.cpp @@ -1426,14 +1426,14 @@ TEST_P(RTPS, rtps_participant_get_pubsub_info) eprosima::fastdds::dds::builtin::SubscriptionBuiltinTopicData subdata; // Get publication info from the reader participant and validate it - bool ret = reader.get_rtps_participant()->get_publication_info(writer.guid(), pubdata); + bool ret = reader.get_rtps_participant()->get_publication_info(pubdata, writer.guid()); ASSERT_TRUE(ret); ASSERT_TRUE(validate_publication_builtin_topic_data(pubdata, writer.get_native_writer(), writer.get_topic_attributes(), writer.get_writerqos(), reader.get_rtps_participant()->getGuid())); // Get subscription info from the reader participant and validate it - ret = writer.get_rtps_participant()->get_subscription_info(reader.guid(), subdata); + ret = writer.get_rtps_participant()->get_subscription_info(subdata, reader.guid()); ASSERT_TRUE(ret); ASSERT_TRUE(validate_subscription_builtin_topic_data(subdata, reader.get_native_reader(), reader.get_topic_attributes(), diff --git a/test/mock/rtps/RTPSParticipant/fastdds/rtps/participant/RTPSParticipant.h b/test/mock/rtps/RTPSParticipant/fastdds/rtps/participant/RTPSParticipant.h index 8e63ba66794..f8502e94e3d 100644 --- a/test/mock/rtps/RTPSParticipant/fastdds/rtps/participant/RTPSParticipant.h +++ b/test/mock/rtps/RTPSParticipant/fastdds/rtps/participant/RTPSParticipant.h @@ -229,13 +229,13 @@ class RTPS_DllAPI RTPSParticipant MOCK_METHOD2( get_publication_info, bool( - const GUID_t& writer_guid, - fastdds::dds::builtin::PublicationBuiltinTopicData& data)); + fastdds::dds::builtin::PublicationBuiltinTopicData& data, + const GUID_t& writer_guid)); MOCK_METHOD2( get_subscription_info, bool( - const GUID_t& writer_guid, - fastdds::dds::builtin::SubscriptionBuiltinTopicData& data)); + fastdds::dds::builtin::SubscriptionBuiltinTopicData& data, + const GUID_t& reader_guid)); const RTPSParticipantAttributes& getRTPSParticipantAttributes() { From 1e157331fbc96b56bd5594ef22fa3e938b4c6852 Mon Sep 17 00:00:00 2001 From: Mario Dominguez Date: Mon, 30 Sep 2024 15:35:18 +0200 Subject: [PATCH 07/15] Refs #21709: Add one RTPS participant test and Update comments to latest design Signed-off-by: Mario Dominguez --- .../common/RTPSBlackboxTestsBasic.cpp | 35 ++++++++++++++++++- .../common/RTPSBlackboxTestsReader.cpp | 2 +- .../common/RTPSBlackboxTestsWriter.cpp | 2 +- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/test/blackbox/common/RTPSBlackboxTestsBasic.cpp b/test/blackbox/common/RTPSBlackboxTestsBasic.cpp index a3d11bf7840..70da7f29a63 100644 --- a/test/blackbox/common/RTPSBlackboxTestsBasic.cpp +++ b/test/blackbox/common/RTPSBlackboxTestsBasic.cpp @@ -1403,7 +1403,40 @@ bool validate_subscription_builtin_topic_data( } /** - * Tests get_publication_info() get_subscription_info() RTPSParticipant APIs + * Refers to RTPS-PART-API-GSI-GPI-01 from the test plan. + */ +TEST(RTPS, rtps_participant_get_pubsub_info_negative) +{ + RTPSWithRegistrationWriter writer(TEST_TOPIC_NAME); + RTPSWithRegistrationReader reader(TEST_TOPIC_NAME); + + writer.reliability(BEST_EFFORT) + .init(); + reader.reliability(RELIABLE) + .init(); + + ASSERT_TRUE(writer.isInitialized()); + ASSERT_TRUE(reader.isInitialized()); + + writer.wait_discovery(std::chrono::seconds(1)); + + ASSERT_FALSE(writer.get_matched()); + ASSERT_FALSE(reader.get_matched()); + + eprosima::fastdds::dds::builtin::PublicationBuiltinTopicData pubdata; + eprosima::fastdds::dds::builtin::SubscriptionBuiltinTopicData subdata; + + // Get publication info from the reader participant and validate it + bool ret = reader.get_rtps_participant()->get_publication_info(pubdata, writer.guid()); + ASSERT_FALSE(ret); + + // Get subscription info from the reader participant and validate it + ret = writer.get_rtps_participant()->get_subscription_info(subdata, reader.guid()); + ASSERT_FALSE(ret); +} + +/** + * Refers to RTPS-PART-API-GSI-GPI-02 from the test plan. */ TEST_P(RTPS, rtps_participant_get_pubsub_info) { diff --git a/test/blackbox/common/RTPSBlackboxTestsReader.cpp b/test/blackbox/common/RTPSBlackboxTestsReader.cpp index 1099f01567c..2c92621ee70 100644 --- a/test/blackbox/common/RTPSBlackboxTestsReader.cpp +++ b/test/blackbox/common/RTPSBlackboxTestsReader.cpp @@ -79,7 +79,7 @@ class RTPSReaderTests : public testing::TestWithParam }; /** - * Tests matched_writers_guids() RTPSReader API + * Refers to RTPS-READER-API-MWG-01 from the test plan. */ TEST_P(RTPSReaderTests, rtpsreader_matched_writers_guids) { diff --git a/test/blackbox/common/RTPSBlackboxTestsWriter.cpp b/test/blackbox/common/RTPSBlackboxTestsWriter.cpp index f75275ad8d0..df6cba1f0b4 100644 --- a/test/blackbox/common/RTPSBlackboxTestsWriter.cpp +++ b/test/blackbox/common/RTPSBlackboxTestsWriter.cpp @@ -79,7 +79,7 @@ class RTPSWriterTests : public testing::TestWithParam }; /** - * Tests matched_readers_guids() RTPSWriter API + * Refers to RTPS-WRITER-API-MRG-01 from the test plan. */ TEST_P(RTPSWriterTests, rtpswriter_matched_readers_guids) { From 4c4bf4ceab332a6fb473ec63a8ecca411edae0a6 Mon Sep 17 00:00:00 2001 From: Mario Dominguez Date: Tue, 1 Oct 2024 15:33:23 +0200 Subject: [PATCH 08/15] Refs #21709: Add additional proptection to PubSUbParticipant API Signed-off-by: Mario Dominguez --- test/blackbox/api/dds-pim/PubSubParticipant.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/blackbox/api/dds-pim/PubSubParticipant.hpp b/test/blackbox/api/dds-pim/PubSubParticipant.hpp index bc4afb9800a..534bd71dd09 100644 --- a/test/blackbox/api/dds-pim/PubSubParticipant.hpp +++ b/test/blackbox/api/dds-pim/PubSubParticipant.hpp @@ -334,6 +334,12 @@ class PubSubParticipant return false; } + if (publisher_topicname_.empty()) + { + EPROSIMA_LOG_ERROR(PUBSUBPARTICIPANT, "Publisher topic name not set"); + return false; + } + eprosima::fastdds::dds::Topic* topic = dynamic_cast(participant_->lookup_topicdescription( publisher_topicname_)); @@ -371,6 +377,12 @@ class PubSubParticipant return false; } + if (subscriber_topicname_.empty()) + { + EPROSIMA_LOG_ERROR(PUBSUBPARTICIPANT, "Subscriber topic name not set"); + return false; + } + eprosima::fastdds::dds::Topic* topic = dynamic_cast(participant_->lookup_topicdescription( subscriber_topicname_)); From 1aaeddd0f38a4ba6469d42ca72bc2f79d76db2c4 Mon Sep 17 00:00:00 2001 From: Mario Dominguez Date: Tue, 1 Oct 2024 15:35:32 +0200 Subject: [PATCH 09/15] Refs #21709: Change userData() to snake case in PubSubWriter/Reader API Signed-off-by: Mario Dominguez --- test/blackbox/api/dds-pim/PubSubReader.hpp | 2 +- test/blackbox/api/dds-pim/PubSubWriter.hpp | 2 +- test/blackbox/common/BlackboxTestsDiscovery.cpp | 2 +- test/blackbox/common/BlackboxTestsPubSubBasic.cpp | 6 +++--- test/blackbox/common/BlackboxTestsSecurity.cpp | 2 +- test/blackbox/common/DDSBlackboxTestsPersistence.cpp | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/blackbox/api/dds-pim/PubSubReader.hpp b/test/blackbox/api/dds-pim/PubSubReader.hpp index 1a277c56280..b4af750d732 100644 --- a/test/blackbox/api/dds-pim/PubSubReader.hpp +++ b/test/blackbox/api/dds-pim/PubSubReader.hpp @@ -1453,7 +1453,7 @@ class PubSubReader return *this; } - PubSubReader& userData( + PubSubReader& user_data( std::vector user_data) { participant_qos_.user_data() = user_data; diff --git a/test/blackbox/api/dds-pim/PubSubWriter.hpp b/test/blackbox/api/dds-pim/PubSubWriter.hpp index 672a9396991..3649cd3987c 100644 --- a/test/blackbox/api/dds-pim/PubSubWriter.hpp +++ b/test/blackbox/api/dds-pim/PubSubWriter.hpp @@ -1391,7 +1391,7 @@ class PubSubWriter return *this; } - PubSubWriter& userData( + PubSubWriter& user_data( std::vector user_data) { participant_qos_.user_data() = user_data; diff --git a/test/blackbox/common/BlackboxTestsDiscovery.cpp b/test/blackbox/common/BlackboxTestsDiscovery.cpp index 6894fe523e5..40b1536f77d 100644 --- a/test/blackbox/common/BlackboxTestsDiscovery.cpp +++ b/test/blackbox/common/BlackboxTestsDiscovery.cpp @@ -934,7 +934,7 @@ TEST_P(Discovery, PubSubAsReliableHelloworldUserData) PubSubWriter writer(TEST_TOPIC_NAME); writer.history_depth(100). - userData({'a', 'b', 'c', 'd'}).init(); + user_data({'a', 'b', 'c', 'd'}).init(); ASSERT_TRUE(writer.isInitialized()); diff --git a/test/blackbox/common/BlackboxTestsPubSubBasic.cpp b/test/blackbox/common/BlackboxTestsPubSubBasic.cpp index 913991e1b53..79972bd89f7 100644 --- a/test/blackbox/common/BlackboxTestsPubSubBasic.cpp +++ b/test/blackbox/common/BlackboxTestsPubSubBasic.cpp @@ -385,7 +385,7 @@ TEST_P(PubSubBasic, ReceivedDynamicDataWithNoSizeLimit) writer.history_depth(100) .partition("A").partition("B").partition("C") - .userData({'a', 'b', 'c', 'd'}).init(); + .user_data({'a', 'b', 'c', 'd'}).init(); ASSERT_TRUE(writer.isInitialized()); @@ -418,7 +418,7 @@ TEST_P(PubSubBasic, ReceivedDynamicDataWithinSizeLimit) writer.history_depth(100) .partition("A").partition("B").partition("C") - .userData({'a', 'b', 'c', 'd'}).init(); + .user_data({'a', 'b', 'c', 'd'}).init(); ASSERT_TRUE(writer.isInitialized()); @@ -452,7 +452,7 @@ TEST_P(PubSubBasic, ReceivedUserDataExceedsSizeLimit) PubSubWriter writer(TEST_TOPIC_NAME); writer.history_depth(100) - .userData({'a', 'b', 'c', 'd', 'e', 'f'}).init(); + .user_data({'a', 'b', 'c', 'd', 'e', 'f'}).init(); ASSERT_TRUE(writer.isInitialized()); diff --git a/test/blackbox/common/BlackboxTestsSecurity.cpp b/test/blackbox/common/BlackboxTestsSecurity.cpp index 944a9d166cf..7de019ac43d 100644 --- a/test/blackbox/common/BlackboxTestsSecurity.cpp +++ b/test/blackbox/common/BlackboxTestsSecurity.cpp @@ -2706,7 +2706,7 @@ TEST_P(Security, BuiltinAuthenticationAndCryptoPlugin_user_data) pub_property_policy.properties().emplace_back("rtps.endpoint.payload_protection_kind", "ENCRYPT"); writer.history_depth(100). - userData({ 'a', 'b', 'c', 'd', 'e' }). + user_data({ 'a', 'b', 'c', 'd', 'e' }). property_policy(pub_part_property_policy). entity_property_policy(pub_property_policy).init(); diff --git a/test/blackbox/common/DDSBlackboxTestsPersistence.cpp b/test/blackbox/common/DDSBlackboxTestsPersistence.cpp index ba702e05d3b..68c9413aed7 100644 --- a/test/blackbox/common/DDSBlackboxTestsPersistence.cpp +++ b/test/blackbox/common/DDSBlackboxTestsPersistence.cpp @@ -404,7 +404,7 @@ TEST_P(PersistenceLargeData, PubSubAsReliablePubPersistentWithStaticDiscovery) .multicastLocatorList(WriterMulticastLocators) .setPublisherIDs(1, 2) .setManualTopicName(std::string("BlackBox_StaticDiscovery_") + TOPIC_RANDOM_NUMBER) - .userData({'V', 'G', 'W', 0x78, 0x73, 0x69, 0x74, 0x65, 0x72, 0x5f, 0x70, 0x65, 0x72, 0x73, 0x5f, 0x67, + .user_data({'V', 'G', 'W', 0x78, 0x73, 0x69, 0x74, 0x65, 0x72, 0x5f, 0x70, 0x65, 0x72, 0x73, 0x5f, 0x67, 0x75, 0x69}) .init(); From 8177dff846e0e6418c8262bc26301d77627d0829 Mon Sep 17 00:00:00 2001 From: Mario Dominguez Date: Tue, 1 Oct 2024 15:39:00 +0200 Subject: [PATCH 10/15] Refs #21709: Minor adjustments after feature impl Signed-off-by: Mario Dominguez --- .../common/DDSBlackboxTestsDataReader.cpp | 23 ++++++--- .../common/DDSBlackboxTestsDataWriter.cpp | 26 ++++++---- .../common/RTPSBlackboxTestsBasic.cpp | 51 ++++++++++--------- .../common/RTPSBlackboxTestsReader.cpp | 2 +- .../common/RTPSBlackboxTestsWriter.cpp | 2 +- 5 files changed, 61 insertions(+), 43 deletions(-) diff --git a/test/blackbox/common/DDSBlackboxTestsDataReader.cpp b/test/blackbox/common/DDSBlackboxTestsDataReader.cpp index 485b5d51279..36cd8890313 100644 --- a/test/blackbox/common/DDSBlackboxTestsDataReader.cpp +++ b/test/blackbox/common/DDSBlackboxTestsDataReader.cpp @@ -584,16 +584,17 @@ bool validate_publication_builtin_topic_data( ret &= (pubdata.liveliness == dw_qos.liveliness()); ret &= (pubdata.reliability == dw_qos.reliability()); ret &= (pubdata.lifespan == dw_qos.lifespan()); - ret &= (pubdata.user_data == dw_qos.user_data()); + ret &= ( + 0 == memcmp(pubdata.user_data.data(), dw_qos.user_data().data(), pubdata.user_data.size())); ret &= (pubdata.ownership == dw_qos.ownership()); ret &= (pubdata.ownership_strength == dw_qos.ownership_strength()); ret &= (pubdata.destination_order == dw_qos.destination_order()); // Publisher Qos ret &= (pubdata.presentation == pub_qos.presentation()); - ret &= (pubdata.partition == pub_qos.partition()); - // topicdata not implemented - ret &= (pubdata.group_data == pub_qos.group_data()); + ret &= (pubdata.partition.getNames() == pub_qos.partition().getNames()); + // topic_data not implemented + // group_data too return ret; } @@ -656,10 +657,14 @@ TEST_P(DDSDataReader, datareader_get_matched_publication_data_correctly_behaves) eprosima::fastdds::dds::builtin::PublicationBuiltinTopicData w1_pubdata, w2_pubdata; - reader.init(); + reader.partition("*") + .init(); - writer_1.init(); - writer_2.reliability(BEST_EFFORT_RELIABILITY_QOS) + writer_1.partition("*") + .init(); + writer_2.user_data({'u', 's', 'e', 'r', 'd', 'a', 't', 'a'}) + .partition("*") + .reliability(BEST_EFFORT_RELIABILITY_QOS) .init(); ASSERT_TRUE(reader.isInitialized()); @@ -679,7 +684,7 @@ TEST_P(DDSDataReader, datareader_get_matched_publication_data_correctly_behaves) ASSERT_EQ(ret, ReturnCode_t::RETCODE_OK); ASSERT_TRUE(validate_publication_builtin_topic_data(w1_pubdata, writer_1.get_native_writer())); - InstanceHandle_t w2_handle = writer_1.get_native_writer().get_instance_handle(); + InstanceHandle_t w2_handle = writer_2.get_native_writer().get_instance_handle(); ret = native_reader.get_matched_publication_data(w2_pubdata, w2_handle); ASSERT_EQ(ret, ReturnCode_t::RETCODE_OK); @@ -794,8 +799,10 @@ TEST_P(DDSDataReader, datareader_get_matched_publications_multiple_participants_ PubSubParticipant part_1(1, 1, 1, 1); PubSubParticipant part_2(1, 1, 1, 1); + part_1.pub_topic_name(TEST_TOPIC_NAME); part_1.sub_topic_name(TEST_TOPIC_NAME + "_1"); part_2.pub_topic_name(TEST_TOPIC_NAME + "_1"); + part_2.sub_topic_name(TEST_TOPIC_NAME); ASSERT_TRUE(part_1.init_participant()); ASSERT_TRUE(part_1.init_publisher(0)); diff --git a/test/blackbox/common/DDSBlackboxTestsDataWriter.cpp b/test/blackbox/common/DDSBlackboxTestsDataWriter.cpp index fd6be5a07cc..d9128dca17d 100644 --- a/test/blackbox/common/DDSBlackboxTestsDataWriter.cpp +++ b/test/blackbox/common/DDSBlackboxTestsDataWriter.cpp @@ -541,7 +541,7 @@ bool validate_subscription_builtin_topic_data( bool ret = true; auto dr_qos = datareader.get_qos(); - auto pub_qos = datareader.get_subscriber()->get_qos(); + auto sub_qos = datareader.get_subscriber()->get_qos(); eprosima::fastdds::dds::builtin::BuiltinTopicKey_t dr_key, part_key; eprosima::fastrtps::rtps::GuidPrefix_t part_guid_prefix = @@ -584,13 +584,15 @@ bool validate_subscription_builtin_topic_data( ret &= (subdata.reliability == dr_qos.reliability()); ret &= (subdata.ownership == dr_qos.ownership()); ret &= (subdata.destination_order == dr_qos.destination_order()); - ret &= (subdata.user_data == dr_qos.user_data()); + ret &= ( + 0 == memcmp(subdata.user_data.data(), dr_qos.user_data().data(), subdata.user_data.size())); // time based filter not implemented // Subscriber Qos - ret &= (subdata.presentation == pub_qos.presentation()); - ret &= (subdata.partition == pub_qos.partition()); - ret &= (subdata.group_data == pub_qos.group_data()); + ret &= (subdata.presentation == sub_qos.presentation()); + ret &= (subdata.partition.getNames() == sub_qos.partition().getNames()); + // topic_data not implemented + // group_data too return ret; } @@ -624,7 +626,7 @@ TEST(DDSDataWriter, datawriter_get_matched_subscription_data_bad_parameter) ASSERT_TRUE(reader_2.isInitialized()); // Writer should not be matched with any reader - writer.wait_discovery(2, std::chrono::seconds(2)); + writer.wait_discovery(2, std::chrono::seconds(1)); ASSERT_TRUE(!writer.is_matched()); @@ -657,10 +659,14 @@ TEST_P(DDSDataWriter, datawriter_get_matched_subscription_data_correctly_behaves eprosima::fastdds::dds::builtin::SubscriptionBuiltinTopicData r1_subdata, r2_subdata; - writer.init(); + writer.partition("*") + .init(); - reader_1.init(); - reader_2.reliability(RELIABLE_RELIABILITY_QOS) + reader_1.partition("*") + .init(); + reader_2.user_data({'u', 's', 'e', 'r', 'd', 'a', 't', 'a'}) + .partition("*") + .reliability(RELIABLE_RELIABILITY_QOS) .init(); ASSERT_TRUE(writer.isInitialized()); @@ -800,8 +806,10 @@ TEST_P(DDSDataWriter, datawriter_get_matched_subscriptions_multiple_participants PubSubParticipant part_1(1, 1, 1, 1); PubSubParticipant part_2(1, 1, 1, 1); + part_1.pub_topic_name(TEST_TOPIC_NAME); part_1.sub_topic_name(TEST_TOPIC_NAME + "_1"); part_2.pub_topic_name(TEST_TOPIC_NAME + "_1"); + part_2.sub_topic_name(TEST_TOPIC_NAME); ASSERT_TRUE(part_1.init_participant()); ASSERT_TRUE(part_1.init_publisher(0)); diff --git a/test/blackbox/common/RTPSBlackboxTestsBasic.cpp b/test/blackbox/common/RTPSBlackboxTestsBasic.cpp index 70da7f29a63..604ef74e1ca 100644 --- a/test/blackbox/common/RTPSBlackboxTestsBasic.cpp +++ b/test/blackbox/common/RTPSBlackboxTestsBasic.cpp @@ -1328,16 +1328,17 @@ bool validate_publication_builtin_topic_data( ret &= (pubdata.liveliness == writer_qos.m_liveliness); ret &= (pubdata.reliability == writer_qos.m_reliability); ret &= (pubdata.lifespan == writer_qos.m_lifespan); - ret &= (pubdata.user_data == writer_qos.m_userData); + ret &= ( + 0 == memcmp(pubdata.user_data.data(), writer_qos.m_userData.data(), pubdata.user_data.size())); ret &= (pubdata.ownership == writer_qos.m_ownership); ret &= (pubdata.ownership_strength == writer_qos.m_ownershipStrength); ret &= (pubdata.destination_order == writer_qos.m_destinationOrder); // Publisher Qos ret &= (pubdata.presentation == writer_qos.m_presentation); - ret &= (pubdata.partition == writer_qos.m_partition); - // topicdata not implemented - ret &= (pubdata.group_data == writer_qos.m_groupData); + ret &= (pubdata.partition.getNames() == writer_qos.m_partition.getNames()); + // ignore topic_data not implemented + // ignore group_data return ret; } @@ -1391,13 +1392,15 @@ bool validate_subscription_builtin_topic_data( ret &= (subdata.reliability == reader_qos.m_reliability); ret &= (subdata.ownership == reader_qos.m_ownership); ret &= (subdata.destination_order == reader_qos.m_destinationOrder); - ret &= (subdata.user_data == reader_qos.m_userData); + ret &= ( + 0 == memcmp(subdata.user_data.data(), reader_qos.m_userData.data(), subdata.user_data.size())); // time based filter not implemented // Subscriber Qos ret &= (subdata.presentation == reader_qos.m_presentation); - ret &= (subdata.partition == reader_qos.m_partition); - ret &= (subdata.group_data == reader_qos.m_groupData); + ret &= (subdata.partition.getNames() == reader_qos.m_partition.getNames()); + // ignore topic_data not implemented + // ignore group_data return ret; } @@ -1410,28 +1413,25 @@ TEST(RTPS, rtps_participant_get_pubsub_info_negative) RTPSWithRegistrationWriter writer(TEST_TOPIC_NAME); RTPSWithRegistrationReader reader(TEST_TOPIC_NAME); - writer.reliability(BEST_EFFORT) - .init(); - reader.reliability(RELIABLE) - .init(); + writer.init(); + reader.init(); ASSERT_TRUE(writer.isInitialized()); ASSERT_TRUE(reader.isInitialized()); - writer.wait_discovery(std::chrono::seconds(1)); - - ASSERT_FALSE(writer.get_matched()); - ASSERT_FALSE(reader.get_matched()); - eprosima::fastdds::dds::builtin::PublicationBuiltinTopicData pubdata; eprosima::fastdds::dds::builtin::SubscriptionBuiltinTopicData subdata; // Get publication info from the reader participant and validate it - bool ret = reader.get_rtps_participant()->get_publication_info(pubdata, writer.guid()); + GUID_t unknown_writer_guid = writer.guid(); + unknown_writer_guid.entityId.value[3] = 0x44; + bool ret = reader.get_rtps_participant()->get_publication_info(pubdata, unknown_writer_guid); ASSERT_FALSE(ret); + GUID_t unknown_reader_guid = reader.guid(); + unknown_reader_guid.entityId.value[3] = 0x44; // Get subscription info from the reader participant and validate it - ret = writer.get_rtps_participant()->get_subscription_info(subdata, reader.guid()); + ret = writer.get_rtps_participant()->get_subscription_info(subdata, unknown_reader_guid); ASSERT_FALSE(ret); } @@ -1443,8 +1443,14 @@ TEST_P(RTPS, rtps_participant_get_pubsub_info) RTPSWithRegistrationWriter writer(TEST_TOPIC_NAME); RTPSWithRegistrationReader reader(TEST_TOPIC_NAME); - writer.init(); - reader.init(); + std::vector partitions{"*"}; + + writer.user_data({'u', 's', 'e', 'r', 'd', 'a', 't', 'a'}) + .partitions(partitions) + .init(); + reader.user_data({'u', 's', 'e', 'r', 'd', 'a', 't', 'a'}) + .partitions(partitions) + .init(); ASSERT_TRUE(writer.isInitialized()); ASSERT_TRUE(reader.isInitialized()); @@ -1452,9 +1458,6 @@ TEST_P(RTPS, rtps_participant_get_pubsub_info) writer.wait_discovery(); reader.wait_discovery(); - ASSERT_TRUE(writer.get_matched()); - ASSERT_TRUE(reader.get_matched()); - eprosima::fastdds::dds::builtin::PublicationBuiltinTopicData pubdata; eprosima::fastdds::dds::builtin::SubscriptionBuiltinTopicData subdata; @@ -1463,7 +1466,7 @@ TEST_P(RTPS, rtps_participant_get_pubsub_info) ASSERT_TRUE(ret); ASSERT_TRUE(validate_publication_builtin_topic_data(pubdata, writer.get_native_writer(), writer.get_topic_attributes(), - writer.get_writerqos(), reader.get_rtps_participant()->getGuid())); + writer.get_writerqos(), writer.get_rtps_participant()->getGuid())); // Get subscription info from the reader participant and validate it ret = writer.get_rtps_participant()->get_subscription_info(subdata, reader.guid()); diff --git a/test/blackbox/common/RTPSBlackboxTestsReader.cpp b/test/blackbox/common/RTPSBlackboxTestsReader.cpp index 2c92621ee70..adc81422730 100644 --- a/test/blackbox/common/RTPSBlackboxTestsReader.cpp +++ b/test/blackbox/common/RTPSBlackboxTestsReader.cpp @@ -101,7 +101,7 @@ TEST_P(RTPSReaderTests, rtpsreader_matched_writers_guids) std::vector matched_guids; auto& native_rtps_reader = reader.get_native_reader(); - ASSERT_FALSE(native_rtps_reader.matched_writers_guids(matched_guids)); + ASSERT_TRUE(native_rtps_reader.matched_writers_guids(matched_guids)); ASSERT_TRUE(matched_guids.empty()); writer.destroy(); diff --git a/test/blackbox/common/RTPSBlackboxTestsWriter.cpp b/test/blackbox/common/RTPSBlackboxTestsWriter.cpp index df6cba1f0b4..7201ab6c16f 100644 --- a/test/blackbox/common/RTPSBlackboxTestsWriter.cpp +++ b/test/blackbox/common/RTPSBlackboxTestsWriter.cpp @@ -101,7 +101,7 @@ TEST_P(RTPSWriterTests, rtpswriter_matched_readers_guids) std::vector matched_guids; auto& native_rtps_writer = writer.get_native_writer(); - ASSERT_FALSE(native_rtps_writer.matched_readers_guids(matched_guids)); + ASSERT_TRUE(native_rtps_writer.matched_readers_guids(matched_guids)); ASSERT_TRUE(matched_guids.empty()); reader.destroy(); From 2baf2e8c919fe3c2ef3da23e0519e0a651d577a8 Mon Sep 17 00:00:00 2001 From: Mario Dominguez Date: Tue, 1 Oct 2024 15:41:24 +0200 Subject: [PATCH 11/15] Refs #21709: Linter Signed-off-by: Mario Dominguez --- test/blackbox/common/DDSBlackboxTestsPersistence.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/blackbox/common/DDSBlackboxTestsPersistence.cpp b/test/blackbox/common/DDSBlackboxTestsPersistence.cpp index 68c9413aed7..2cbdbacf442 100644 --- a/test/blackbox/common/DDSBlackboxTestsPersistence.cpp +++ b/test/blackbox/common/DDSBlackboxTestsPersistence.cpp @@ -405,7 +405,7 @@ TEST_P(PersistenceLargeData, PubSubAsReliablePubPersistentWithStaticDiscovery) .setPublisherIDs(1, 2) .setManualTopicName(std::string("BlackBox_StaticDiscovery_") + TOPIC_RANDOM_NUMBER) .user_data({'V', 'G', 'W', 0x78, 0x73, 0x69, 0x74, 0x65, 0x72, 0x5f, 0x70, 0x65, 0x72, 0x73, 0x5f, 0x67, - 0x75, 0x69}) + 0x75, 0x69}) .init(); ASSERT_TRUE(writer.isInitialized()); From e982e89ef8b92ac71f1ae364f57638c0f70ba389 Mon Sep 17 00:00:00 2001 From: Mario Dominguez Date: Mon, 7 Oct 2024 10:18:00 +0200 Subject: [PATCH 12/15] Refs 21710: Apply Ricardo's review Signed-off-by: Mario Dominguez --- .../rtps/participant/RTPSParticipant.h | 12 ++-- test/blackbox/common/BlackboxTests.cpp | 33 +++++++++- test/blackbox/common/BlackboxTests.hpp | 23 +++++++ .../common/DDSBlackboxTestsDataReader.cpp | 38 +++-------- .../common/DDSBlackboxTestsDataWriter.cpp | 39 +++-------- test/blackbox/common/RTPSBlackboxTests.cpp | 33 +++++++++- .../common/RTPSBlackboxTestsBasic.cpp | 65 +++++-------------- .../common/RTPSBlackboxTestsReader.cpp | 5 +- .../common/RTPSWithRegistrationReader.hpp | 4 +- .../common/RTPSWithRegistrationWriter.hpp | 4 +- .../rtps/participant/RTPSParticipant.h | 16 ++--- 11 files changed, 145 insertions(+), 127 deletions(-) diff --git a/include/fastdds/rtps/participant/RTPSParticipant.h b/include/fastdds/rtps/participant/RTPSParticipant.h index 1dd9de4f389..b3da5e5eb78 100644 --- a/include/fastdds/rtps/participant/RTPSParticipant.h +++ b/include/fastdds/rtps/participant/RTPSParticipant.h @@ -309,26 +309,26 @@ class RTPS_DllAPI RTPSParticipant std::vector get_netmask_filter_info() const; /** - * @brief Fills the provided PublicationBuiltinTopicData with the information of the + * @brief Fills the provided @ref PublicationBuiltinTopicData with the information of the * writer identified by writer_guid. * - * @param[out] data PublicationBuiltinTopicData to fill. + * @param[out] data @ref PublicationBuiltinTopicData to fill. * @param[in] writer_guid GUID of the writer to get the information from. * @return True if the writer was found and the data was filled. */ - bool get_publication_info( + RTPS_DllAPI bool get_publication_info( fastdds::dds::builtin::PublicationBuiltinTopicData& data, const GUID_t& writer_guid) const; /** - * @brief Fills the provided SubscriptionBuiltinTopicData with the information of the + * @brief Fills the provided @ref SubscriptionBuiltinTopicData with the information of the * reader identified by reader_guid. * - * @param[out] data SubscriptionBuiltinTopicData to fill. + * @param[out] data @ref SubscriptionBuiltinTopicData to fill. * @param[in] reader_guid GUID of the reader to get the information from. * @return True if the reader was found and the data was filled. */ - bool get_subscription_info( + RTPS_DllAPI bool get_subscription_info( fastdds::dds::builtin::SubscriptionBuiltinTopicData& data, const GUID_t& reader_guid) const; diff --git a/test/blackbox/common/BlackboxTests.cpp b/test/blackbox/common/BlackboxTests.cpp index 55eee5beb5a..b8f2b684370 100644 --- a/test/blackbox/common/BlackboxTests.cpp +++ b/test/blackbox/common/BlackboxTests.cpp @@ -16,9 +16,10 @@ #include +#include +#include #include #include -#include #include #include @@ -85,6 +86,36 @@ class BlackboxEnvironment : public ::testing::Environment }; +void entity_id_to_builtin_topic_key( + eprosima::fastdds::dds::builtin::BuiltinTopicKey_t& bt_key, + const eprosima::fastrtps::rtps::EntityId_t& entity_id) +{ + bt_key.value[0] = 0; + bt_key.value[1] = 0; + bt_key.value[2] = static_cast(entity_id.value[0]) << 24 + | static_cast(entity_id.value[1]) << 16 + | static_cast(entity_id.value[2]) << 8 + | static_cast(entity_id.value[3]); +} + +void guid_prefix_to_builtin_topic_key( + eprosima::fastdds::dds::builtin::BuiltinTopicKey_t& bt_key, + const eprosima::fastrtps::rtps::GuidPrefix_t& guid_prefix) +{ + bt_key.value[0] = static_cast(guid_prefix.value[0]) << 24 + | static_cast(guid_prefix.value[1]) << 16 + | static_cast(guid_prefix.value[2]) << 8 + | static_cast(guid_prefix.value[3]); + bt_key.value[1] = static_cast(guid_prefix.value[4]) << 24 + | static_cast(guid_prefix.value[5]) << 16 + | static_cast(guid_prefix.value[6]) << 8 + | static_cast(guid_prefix.value[7]); + bt_key.value[2] = static_cast(guid_prefix.value[8]) << 24 + | static_cast(guid_prefix.value[9]) << 16 + | static_cast(guid_prefix.value[10]) << 8 + | static_cast(guid_prefix.value[11]); +} + int main( int argc, char** argv) diff --git a/test/blackbox/common/BlackboxTests.hpp b/test/blackbox/common/BlackboxTests.hpp index 9665b329977..f193294d915 100644 --- a/test/blackbox/common/BlackboxTests.hpp +++ b/test/blackbox/common/BlackboxTests.hpp @@ -46,6 +46,18 @@ #include #include +namespace eprosima { +namespace fastdds { +namespace dds { +namespace builtin { + +struct BuiltinTopicKey_t; + +} // namespace builtin +} // namespace dds +} // namespace fastdds +} // namespace eprosima + #if HAVE_SECURITY extern void blackbox_security_init(); #endif // if HAVE_SECURITY @@ -202,4 +214,15 @@ void print_non_received_messages( /***** End auxiliary lambda function *****/ +/****** Auxiliary conversion helpers *******/ +void entity_id_to_builtin_topic_key( + eprosima::fastdds::dds::builtin::BuiltinTopicKey_t& bt_key, + const eprosima::fastrtps::rtps::EntityId_t& entity_id); + +void guid_prefix_to_builtin_topic_key( + eprosima::fastdds::dds::builtin::BuiltinTopicKey_t& bt_key, + const eprosima::fastrtps::rtps::GuidPrefix_t& guid_prefix); + +/****** End Auxiliary conversion helpers *******/ + #endif // __BLACKBOX_BLACKBOXTESTS_HPP__ diff --git a/test/blackbox/common/DDSBlackboxTestsDataReader.cpp b/test/blackbox/common/DDSBlackboxTestsDataReader.cpp index 36cd8890313..b6576d08021 100644 --- a/test/blackbox/common/DDSBlackboxTestsDataReader.cpp +++ b/test/blackbox/common/DDSBlackboxTestsDataReader.cpp @@ -545,28 +545,9 @@ bool validate_publication_builtin_topic_data( auto pub_qos = datawriter.get_publisher()->get_qos(); eprosima::fastdds::dds::builtin::BuiltinTopicKey_t dw_key, part_key; - GuidPrefix_t guid_prefix = datawriter.get_publisher()->get_participant()->guid().guidPrefix; - - // This conversions may be included later in utils - dw_key.value[0] = 0; - dw_key.value[1] = 0; - dw_key.value[2] = static_cast(datawriter.guid().entityId.value[0]) << 24 - | static_cast(datawriter.guid().entityId.value[1]) << 16 - | static_cast(datawriter.guid().entityId.value[2]) << 8 - | static_cast(datawriter.guid().entityId.value[3]); - - part_key.value[0] = static_cast(guid_prefix.value[0]) << 24 - | static_cast(guid_prefix.value[1]) << 16 - | static_cast(guid_prefix.value[2]) << 8 - | static_cast(guid_prefix.value[3]); - part_key.value[1] = static_cast(guid_prefix.value[4]) << 24 - | static_cast(guid_prefix.value[5]) << 16 - | static_cast(guid_prefix.value[6]) << 8 - | static_cast(guid_prefix.value[7]); - part_key.value[2] = static_cast(guid_prefix.value[8]) << 24 - | static_cast(guid_prefix.value[9]) << 16 - | static_cast(guid_prefix.value[10]) << 8 - | static_cast(guid_prefix.value[11]); + + entity_id_to_builtin_topic_key(dw_key, datawriter.guid().entityId); + guid_prefix_to_builtin_topic_key(part_key, datawriter.get_publisher()->get_participant()->guid().guidPrefix); ret &= (0 == memcmp(pubdata.key.value, dw_key.value, sizeof(eprosima::fastdds::dds::builtin::BuiltinTopicKey_t))); ret &= @@ -585,7 +566,8 @@ bool validate_publication_builtin_topic_data( ret &= (pubdata.reliability == dw_qos.reliability()); ret &= (pubdata.lifespan == dw_qos.lifespan()); ret &= ( - 0 == memcmp(pubdata.user_data.data(), dw_qos.user_data().data(), pubdata.user_data.size())); + (pubdata.user_data.size() == dw_qos.user_data().size()) && + (0 == memcmp(pubdata.user_data.data(), dw_qos.user_data().data(), pubdata.user_data.size()))); ret &= (pubdata.ownership == dw_qos.ownership()); ret &= (pubdata.ownership_strength == dw_qos.ownership_strength()); ret &= (pubdata.destination_order == dw_qos.destination_order()); @@ -600,7 +582,7 @@ bool validate_publication_builtin_topic_data( } /** - * Refers to DDS-DR-API-GMPD-01 from the test plan. + * @test DDS-DR-API-GMPD-01 * * get_matched_publication_data() must return RETCODE_BAD_PARAMETER * if the publication is not matched. @@ -644,7 +626,7 @@ TEST(DDSDataReader, datareader_get_matched_publication_data_bad_parameter) } /** - * Refers to DDS-DR-API-GMPD-02 from the test plan. + * @test DDS-DR-API-GMPD-02 * * The operation must succeed when the publication is matched and correctly * retrieve the publication data. Parameterize the test for different transports. @@ -692,7 +674,7 @@ TEST_P(DDSDataReader, datareader_get_matched_publication_data_correctly_behaves) } /** - * Refers to DDS-DR-API-GMP-01 from the test plan. + * @test DDS-DR-API-GMP-01 * * get_matched_publications() must return RETCODE_OK * with an empty list if no DataWriters are matched. @@ -730,7 +712,7 @@ TEST(DDSDataReader, datareader_get_matched_publications_ok_empty_list) } /** - * Refers to DDS-DR-API-GMP-02 from the test plan. + * @test DDS-DR-API-GMP-02 * * get_matched_publications() must provide the correct list of matched publication handles. * Parameterize the test for different transports. @@ -789,7 +771,7 @@ TEST_P(DDSDataReader, datareader_get_matched_publications_correctly_behaves) } /** - * Refers to DDS-DR-API-GMP-03 from the test plan. + * @test DDS-DR-API-GMP-03 * * The operation must provide the correct list of matched publication handles in multiple * participants scenario. Parameterize the test for different transports. diff --git a/test/blackbox/common/DDSBlackboxTestsDataWriter.cpp b/test/blackbox/common/DDSBlackboxTestsDataWriter.cpp index d9128dca17d..29ca1cf7de6 100644 --- a/test/blackbox/common/DDSBlackboxTestsDataWriter.cpp +++ b/test/blackbox/common/DDSBlackboxTestsDataWriter.cpp @@ -544,29 +544,9 @@ bool validate_subscription_builtin_topic_data( auto sub_qos = datareader.get_subscriber()->get_qos(); eprosima::fastdds::dds::builtin::BuiltinTopicKey_t dr_key, part_key; - eprosima::fastrtps::rtps::GuidPrefix_t part_guid_prefix = - datareader.get_subscriber()->get_participant()->guid().guidPrefix; - - // This conversions may be included later in utils - dr_key.value[0] = 0; - dr_key.value[1] = 0; - dr_key.value[2] = static_cast(datareader.guid().entityId.value[0]) << 24 - | static_cast(datareader.guid().entityId.value[1]) << 16 - | static_cast(datareader.guid().entityId.value[2]) << 8 - | static_cast(datareader.guid().entityId.value[3]); - - part_key.value[0] = static_cast(part_guid_prefix.value[0]) << 24 - | static_cast(part_guid_prefix.value[1]) << 16 - | static_cast(part_guid_prefix.value[2]) << 8 - | static_cast(part_guid_prefix.value[3]); - part_key.value[1] = static_cast(part_guid_prefix.value[4]) << 24 - | static_cast(part_guid_prefix.value[5]) << 16 - | static_cast(part_guid_prefix.value[6]) << 8 - | static_cast(part_guid_prefix.value[7]); - part_key.value[2] = static_cast(part_guid_prefix.value[8]) << 24 - | static_cast(part_guid_prefix.value[9]) << 16 - | static_cast(part_guid_prefix.value[10]) << 8 - | static_cast(part_guid_prefix.value[11]); + + entity_id_to_builtin_topic_key(dr_key, datareader.guid().entityId); + guid_prefix_to_builtin_topic_key(part_key, datareader.get_subscriber()->get_participant()->guid().guidPrefix); ret &= (0 == memcmp(subdata.key.value, dr_key.value, sizeof(eprosima::fastdds::dds::builtin::BuiltinTopicKey_t))); ret &= @@ -585,7 +565,8 @@ bool validate_subscription_builtin_topic_data( ret &= (subdata.ownership == dr_qos.ownership()); ret &= (subdata.destination_order == dr_qos.destination_order()); ret &= ( - 0 == memcmp(subdata.user_data.data(), dr_qos.user_data().data(), subdata.user_data.size())); + (subdata.user_data.size() == dr_qos.user_data().size()) && + (0 == memcmp(subdata.user_data.data(), dr_qos.user_data().data(), subdata.user_data.size()))); // time based filter not implemented // Subscriber Qos @@ -598,7 +579,7 @@ bool validate_subscription_builtin_topic_data( } /** - * Refers to DDS-DW-API-GMSD-01 from the test plan. + * @test DDS-DW-API-GMSD-01 * * get_matched_subscription_data() must return RETCODE_BAD_PARAMETER * if the subscription is not matched. @@ -644,7 +625,7 @@ TEST(DDSDataWriter, datawriter_get_matched_subscription_data_bad_parameter) } /** - * Refers to DDS-DW-API-GMSD-02 from the test plan. + * @test DDS-DW-API-GMSD-02 * * The operation must succeed when the subscription is matched and correctly * retrieve the publication data. Parameterize the test for different transports. @@ -694,7 +675,7 @@ TEST_P(DDSDataWriter, datawriter_get_matched_subscription_data_correctly_behaves } /** - * Refers to DDS-DW-API-GMS-01 from the test plan. + * @test DDS-DW-API-GMS-01 * * get_matched_subscriptions() must return RETCODE_OK * with an empty list if no DataWriters are matched. @@ -734,7 +715,7 @@ TEST(DDSDataWriter, datawriter_get_matched_subscriptions_ok_empty_list) } /** - * Refers to DDS-DW-API-GMS-02 from the test plan. + * @test DDS-DW-API-GMS-02 * * get_matched_subscriptions() must provide the correct list of matched subscription handles. * Parameterize the test for different transports. @@ -794,7 +775,7 @@ TEST_P(DDSDataWriter, datawriter_get_matched_subscriptions_correctly_behaves) } /** - * Refers to DDS-DW-API-GMS-03 from the test plan. + * @test DDS-DW-API-GMS-03 * * The operation must provide the correct list of matched subscription handles in multiple * participants scenario. Parameterize the test for different transports. diff --git a/test/blackbox/common/RTPSBlackboxTests.cpp b/test/blackbox/common/RTPSBlackboxTests.cpp index b8f5ce212a1..3ebdf137140 100644 --- a/test/blackbox/common/RTPSBlackboxTests.cpp +++ b/test/blackbox/common/RTPSBlackboxTests.cpp @@ -21,9 +21,10 @@ #include +#include +#include #include #include -#include #include #include @@ -83,6 +84,36 @@ class BlackboxEnvironment : public ::testing::Environment }; +void entity_id_to_builtin_topic_key( + eprosima::fastdds::dds::builtin::BuiltinTopicKey_t& bt_key, + const eprosima::fastrtps::rtps::EntityId_t& entity_id) +{ + bt_key.value[0] = 0; + bt_key.value[1] = 0; + bt_key.value[2] = static_cast(entity_id.value[0]) << 24 + | static_cast(entity_id.value[1]) << 16 + | static_cast(entity_id.value[2]) << 8 + | static_cast(entity_id.value[3]); +} + +void guid_prefix_to_builtin_topic_key( + eprosima::fastdds::dds::builtin::BuiltinTopicKey_t& bt_key, + const eprosima::fastrtps::rtps::GuidPrefix_t& guid_prefix) +{ + bt_key.value[0] = static_cast(guid_prefix.value[0]) << 24 + | static_cast(guid_prefix.value[1]) << 16 + | static_cast(guid_prefix.value[2]) << 8 + | static_cast(guid_prefix.value[3]); + bt_key.value[1] = static_cast(guid_prefix.value[4]) << 24 + | static_cast(guid_prefix.value[5]) << 16 + | static_cast(guid_prefix.value[6]) << 8 + | static_cast(guid_prefix.value[7]); + bt_key.value[2] = static_cast(guid_prefix.value[8]) << 24 + | static_cast(guid_prefix.value[9]) << 16 + | static_cast(guid_prefix.value[10]) << 8 + | static_cast(guid_prefix.value[11]); +} + int main( int argc, char** argv) diff --git a/test/blackbox/common/RTPSBlackboxTestsBasic.cpp b/test/blackbox/common/RTPSBlackboxTestsBasic.cpp index 604ef74e1ca..a67d991d7e4 100644 --- a/test/blackbox/common/RTPSBlackboxTestsBasic.cpp +++ b/test/blackbox/common/RTPSBlackboxTestsBasic.cpp @@ -1289,28 +1289,9 @@ bool validate_publication_builtin_topic_data( bool ret = true; eprosima::fastdds::dds::builtin::BuiltinTopicKey_t w_key, part_key; - GuidPrefix_t guid_prefix = participant_guid.guidPrefix; - - // This conversions may be included later in utils - w_key.value[0] = 0; - w_key.value[1] = 0; - w_key.value[2] = static_cast(writer.getGuid().entityId.value[0]) << 24 - | static_cast(writer.getGuid().entityId.value[1]) << 16 - | static_cast(writer.getGuid().entityId.value[2]) << 8 - | static_cast(writer.getGuid().entityId.value[3]); - - part_key.value[0] = static_cast(guid_prefix.value[0]) << 24 - | static_cast(guid_prefix.value[1]) << 16 - | static_cast(guid_prefix.value[2]) << 8 - | static_cast(guid_prefix.value[3]); - part_key.value[1] = static_cast(guid_prefix.value[4]) << 24 - | static_cast(guid_prefix.value[5]) << 16 - | static_cast(guid_prefix.value[6]) << 8 - | static_cast(guid_prefix.value[7]); - part_key.value[2] = static_cast(guid_prefix.value[8]) << 24 - | static_cast(guid_prefix.value[9]) << 16 - | static_cast(guid_prefix.value[10]) << 8 - | static_cast(guid_prefix.value[11]); + + entity_id_to_builtin_topic_key(w_key, writer.getGuid().entityId); + guid_prefix_to_builtin_topic_key(part_key, participant_guid.guidPrefix); ret &= (0 == memcmp(pubdata.key.value, w_key.value, sizeof(eprosima::fastdds::dds::builtin::BuiltinTopicKey_t))); ret &= @@ -1329,7 +1310,8 @@ bool validate_publication_builtin_topic_data( ret &= (pubdata.reliability == writer_qos.m_reliability); ret &= (pubdata.lifespan == writer_qos.m_lifespan); ret &= ( - 0 == memcmp(pubdata.user_data.data(), writer_qos.m_userData.data(), pubdata.user_data.size())); + (pubdata.user_data.size() == writer_qos.m_userData.size()) && + (0 == memcmp(pubdata.user_data.data(), writer_qos.m_userData.data(), pubdata.user_data.size()))); ret &= (pubdata.ownership == writer_qos.m_ownership); ret &= (pubdata.ownership_strength == writer_qos.m_ownershipStrength); ret &= (pubdata.destination_order == writer_qos.m_destinationOrder); @@ -1353,28 +1335,9 @@ bool validate_subscription_builtin_topic_data( bool ret = true; eprosima::fastdds::dds::builtin::BuiltinTopicKey_t r_key, part_key; - eprosima::fastrtps::rtps::GuidPrefix_t part_guid_prefix = participant_guid.guidPrefix; - - // This conversions may be included later in utils - r_key.value[0] = 0; - r_key.value[1] = 0; - r_key.value[2] = static_cast(reader.getGuid().entityId.value[0]) << 24 - | static_cast(reader.getGuid().entityId.value[1]) << 16 - | static_cast(reader.getGuid().entityId.value[2]) << 8 - | static_cast(reader.getGuid().entityId.value[3]); - - part_key.value[0] = static_cast(part_guid_prefix.value[0]) << 24 - | static_cast(part_guid_prefix.value[1]) << 16 - | static_cast(part_guid_prefix.value[2]) << 8 - | static_cast(part_guid_prefix.value[3]); - part_key.value[1] = static_cast(part_guid_prefix.value[4]) << 24 - | static_cast(part_guid_prefix.value[5]) << 16 - | static_cast(part_guid_prefix.value[6]) << 8 - | static_cast(part_guid_prefix.value[7]); - part_key.value[2] = static_cast(part_guid_prefix.value[8]) << 24 - | static_cast(part_guid_prefix.value[9]) << 16 - | static_cast(part_guid_prefix.value[10]) << 8 - | static_cast(part_guid_prefix.value[11]); + + entity_id_to_builtin_topic_key(r_key, reader.getGuid().entityId); + guid_prefix_to_builtin_topic_key(part_key, participant_guid.guidPrefix); ret &= (0 == memcmp(subdata.key.value, r_key.value, sizeof(eprosima::fastdds::dds::builtin::BuiltinTopicKey_t))); ret &= @@ -1393,7 +1356,8 @@ bool validate_subscription_builtin_topic_data( ret &= (subdata.ownership == reader_qos.m_ownership); ret &= (subdata.destination_order == reader_qos.m_destinationOrder); ret &= ( - 0 == memcmp(subdata.user_data.data(), reader_qos.m_userData.data(), subdata.user_data.size())); + (subdata.user_data.size() == reader_qos.m_userData.size()) && + (0 == memcmp(subdata.user_data.data(), reader_qos.m_userData.data(), subdata.user_data.size()))); // time based filter not implemented // Subscriber Qos @@ -1406,7 +1370,9 @@ bool validate_subscription_builtin_topic_data( } /** - * Refers to RTPS-PART-API-GSI-GPI-01 from the test plan. + * @test RTPS-PART-API-GSI-GPI-01 + * + * get_subscription/publication_info() must return false if the entity is not found. */ TEST(RTPS, rtps_participant_get_pubsub_info_negative) { @@ -1436,7 +1402,10 @@ TEST(RTPS, rtps_participant_get_pubsub_info_negative) } /** - * Refers to RTPS-PART-API-GSI-GPI-02 from the test plan. + * @test RTPS-PART-API-GSI-GPI-02 + * + * get_subscription/publication_info() must succeed when the guid is known and correctly retrieve the publication/subscription data. + * Parameterize the test for different transports (Transport, Datasharing and Intraprocess). */ TEST_P(RTPS, rtps_participant_get_pubsub_info) { diff --git a/test/blackbox/common/RTPSBlackboxTestsReader.cpp b/test/blackbox/common/RTPSBlackboxTestsReader.cpp index adc81422730..7129e3678a7 100644 --- a/test/blackbox/common/RTPSBlackboxTestsReader.cpp +++ b/test/blackbox/common/RTPSBlackboxTestsReader.cpp @@ -79,7 +79,10 @@ class RTPSReaderTests : public testing::TestWithParam }; /** - * Refers to RTPS-READER-API-MWG-01 from the test plan. + * @test RTPS-READER-API-MWG-01 + * + * matched_writers_guids() must return true with empty list when the entitiy is not matched. + * matched_writers_guids() must return true with a correct list when the entitiy is matched. */ TEST_P(RTPSReaderTests, rtpsreader_matched_writers_guids) { diff --git a/test/blackbox/common/RTPSWithRegistrationReader.hpp b/test/blackbox/common/RTPSWithRegistrationReader.hpp index 3d92b25c1bc..56c9130817f 100644 --- a/test/blackbox/common/RTPSWithRegistrationReader.hpp +++ b/test/blackbox/common/RTPSWithRegistrationReader.hpp @@ -551,12 +551,12 @@ class RTPSWithRegistrationReader return *reader_; } - eprosima::fastrtps::ReaderQos& get_readerqos() + const eprosima::fastrtps::ReaderQos& get_readerqos() const { return reader_qos_; } - eprosima::fastrtps::TopicAttributes& get_topic_attributes() + const eprosima::fastrtps::TopicAttributes& get_topic_attributes() const { return topic_attr_; } diff --git a/test/blackbox/common/RTPSWithRegistrationWriter.hpp b/test/blackbox/common/RTPSWithRegistrationWriter.hpp index 448ef3669bc..af66ff7cfdf 100644 --- a/test/blackbox/common/RTPSWithRegistrationWriter.hpp +++ b/test/blackbox/common/RTPSWithRegistrationWriter.hpp @@ -578,12 +578,12 @@ class RTPSWithRegistrationWriter return *writer_; } - eprosima::fastrtps::WriterQos& get_writerqos() + const eprosima::fastrtps::WriterQos& get_writerqos() const { return writer_qos_; } - eprosima::fastrtps::TopicAttributes& get_topic_attributes() + const eprosima::fastrtps::TopicAttributes& get_topic_attributes() const { return topic_attr_; } diff --git a/test/mock/rtps/RTPSParticipant/fastdds/rtps/participant/RTPSParticipant.h b/test/mock/rtps/RTPSParticipant/fastdds/rtps/participant/RTPSParticipant.h index f8502e94e3d..60fea577b93 100644 --- a/test/mock/rtps/RTPSParticipant/fastdds/rtps/participant/RTPSParticipant.h +++ b/test/mock/rtps/RTPSParticipant/fastdds/rtps/participant/RTPSParticipant.h @@ -227,15 +227,13 @@ class RTPS_DllAPI RTPSParticipant return {}; } - MOCK_METHOD2( - get_publication_info, bool( - fastdds::dds::builtin::PublicationBuiltinTopicData& data, - const GUID_t& writer_guid)); - - MOCK_METHOD2( - get_subscription_info, bool( - fastdds::dds::builtin::SubscriptionBuiltinTopicData& data, - const GUID_t& reader_guid)); + MOCK_METHOD(bool, get_publication_info, + (fastdds::dds::builtin::PublicationBuiltinTopicData&, + const GUID_t&), (const)); + + MOCK_METHOD(bool, get_subscription_info, + (fastdds::dds::builtin::SubscriptionBuiltinTopicData&, + const GUID_t&), (const)); const RTPSParticipantAttributes& getRTPSParticipantAttributes() { From bb888766f5f5430eafc84726809c80cba7cc4741 Mon Sep 17 00:00:00 2001 From: Mario Dominguez Date: Tue, 8 Oct 2024 09:21:29 +0200 Subject: [PATCH 13/15] Refs #21710: Apply missing rev comment Signed-off-by: Mario Dominguez --- test/blackbox/common/RTPSBlackboxTestsWriter.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/blackbox/common/RTPSBlackboxTestsWriter.cpp b/test/blackbox/common/RTPSBlackboxTestsWriter.cpp index 7201ab6c16f..6ba28624e72 100644 --- a/test/blackbox/common/RTPSBlackboxTestsWriter.cpp +++ b/test/blackbox/common/RTPSBlackboxTestsWriter.cpp @@ -79,7 +79,10 @@ class RTPSWriterTests : public testing::TestWithParam }; /** - * Refers to RTPS-WRITER-API-MRG-01 from the test plan. + * @test RTPS-WRITER-API-MRG-01 + * + * matched_readers_guids() must return true with empty list when the entitiy is not matched. + * matched_readers_guids() must return true with a correct list when the entitiy is matched. */ TEST_P(RTPSWriterTests, rtpswriter_matched_readers_guids) { From f140875a99670ea052dd464b3707f42d5152fb7c Mon Sep 17 00:00:00 2001 From: Mario Dominguez Date: Tue, 8 Oct 2024 09:22:06 +0200 Subject: [PATCH 14/15] Refs #21710: Remove RTPS_Dll API because the class is already marked with it and windows complains Signed-off-by: Mario Dominguez --- include/fastdds/rtps/participant/RTPSParticipant.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/fastdds/rtps/participant/RTPSParticipant.h b/include/fastdds/rtps/participant/RTPSParticipant.h index b3da5e5eb78..248f715ced9 100644 --- a/include/fastdds/rtps/participant/RTPSParticipant.h +++ b/include/fastdds/rtps/participant/RTPSParticipant.h @@ -316,7 +316,7 @@ class RTPS_DllAPI RTPSParticipant * @param[in] writer_guid GUID of the writer to get the information from. * @return True if the writer was found and the data was filled. */ - RTPS_DllAPI bool get_publication_info( + bool get_publication_info( fastdds::dds::builtin::PublicationBuiltinTopicData& data, const GUID_t& writer_guid) const; @@ -328,7 +328,7 @@ class RTPS_DllAPI RTPSParticipant * @param[in] reader_guid GUID of the reader to get the information from. * @return True if the reader was found and the data was filled. */ - RTPS_DllAPI bool get_subscription_info( + bool get_subscription_info( fastdds::dds::builtin::SubscriptionBuiltinTopicData& data, const GUID_t& reader_guid) const; From 0efc48d4a85d8ebfdbd6b1aff398a11182c00cf9 Mon Sep 17 00:00:00 2001 From: Mario Dominguez Date: Tue, 8 Oct 2024 10:16:49 +0200 Subject: [PATCH 15/15] Refs #21710: Avoid docs compilation failure: remove @ref in doxygen for forward declared types Signed-off-by: Mario Dominguez --- include/fastdds/rtps/participant/RTPSParticipant.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/fastdds/rtps/participant/RTPSParticipant.h b/include/fastdds/rtps/participant/RTPSParticipant.h index 248f715ced9..c94868f7584 100644 --- a/include/fastdds/rtps/participant/RTPSParticipant.h +++ b/include/fastdds/rtps/participant/RTPSParticipant.h @@ -309,10 +309,10 @@ class RTPS_DllAPI RTPSParticipant std::vector get_netmask_filter_info() const; /** - * @brief Fills the provided @ref PublicationBuiltinTopicData with the information of the + * @brief Fills the provided fastdds::dds::builtin::PublicationBuiltinTopicData with the information of the * writer identified by writer_guid. * - * @param[out] data @ref PublicationBuiltinTopicData to fill. + * @param[out] data fastdds::dds::builtin::PublicationBuiltinTopicData to fill. * @param[in] writer_guid GUID of the writer to get the information from. * @return True if the writer was found and the data was filled. */ @@ -321,10 +321,10 @@ class RTPS_DllAPI RTPSParticipant const GUID_t& writer_guid) const; /** - * @brief Fills the provided @ref SubscriptionBuiltinTopicData with the information of the + * @brief Fills the provided fastdds::dds::builtin::SubscriptionBuiltinTopicData with the information of the * reader identified by reader_guid. * - * @param[out] data @ref SubscriptionBuiltinTopicData to fill. + * @param[out] data fastdds::dds::builtin::SubscriptionBuiltinTopicData to fill. * @param[in] reader_guid GUID of the reader to get the information from. * @return True if the reader was found and the data was filled. */