@@ -548,8 +548,6 @@ TEST(DDSDiscovery, UpdateMatchedStatus)
548548 datawriter_2.destroy ();
549549}
550550
551- <<<<<<< HEAD
552- =======
553551/*
554552 * This is a regression test for redmine issue 21355.
555553 *
@@ -669,133 +667,6 @@ TEST(DDSDiscovery, MatchedCallbackListenerMultithread)
669667 EXPECT_EQ (listener.writer_other_calls .load (), 0u );
670668}
671669
672- TEST (DDSDiscovery, EndpointMatchingCallbackAlwaysTrue)
673- {
674- using namespace std ::chrono_literals;
675-
676- std::atomic_uint32_t writer_calls {0 };
677- std::atomic_uint32_t reader_calls {0 };
678-
679- PubSubWriter<HelloWorldPubSubType> writer (TEST_TOPIC_NAME );
680- writer.set_should_endpoints_match_function (
681- [&](const eprosima::fastdds::dds::SubscriptionBuiltinTopicData&,
682- const eprosima::fastdds::dds::PublicationBuiltinTopicData&)
683- {
684- ++writer_calls;
685- return true ;
686- });
687-
688- PubSubReader<HelloWorldPubSubType> reader (TEST_TOPIC_NAME );
689- reader.set_should_endpoints_match_function (
690- [&](const eprosima::fastdds::dds::SubscriptionBuiltinTopicData&,
691- const eprosima::fastdds::dds::PublicationBuiltinTopicData&)
692- {
693- ++reader_calls;
694- return true ;
695- });
696-
697- reader.init ();
698- ASSERT_TRUE (reader.isInitialized ());
699-
700- writer.init ();
701- ASSERT_TRUE (writer.isInitialized ());
702-
703- reader.wait_discovery (3s, 1u );
704- writer.wait_discovery (1u , 3s);
705-
706- ASSERT_EQ (reader.get_matched (), 1u );
707- ASSERT_EQ (writer.get_matched (), 1u );
708- ASSERT_GE (reader_calls.load (), 1u );
709- ASSERT_GE (writer_calls.load (), 1u );
710- }
711-
712- TEST (DDSDiscovery, EndpointMatchingCallbackAlwaysFalse)
713- {
714- using namespace std ::chrono_literals;
715-
716- std::atomic_uint32_t writer_calls {0 };
717- std::atomic_uint32_t reader_calls {0 };
718-
719- PubSubWriter<HelloWorldPubSubType> writer (TEST_TOPIC_NAME );
720- writer.set_should_endpoints_match_function (
721- [&](const eprosima::fastdds::dds::SubscriptionBuiltinTopicData&,
722- const eprosima::fastdds::dds::PublicationBuiltinTopicData&)
723- {
724- ++writer_calls;
725- return false ;
726- });
727-
728- PubSubReader<HelloWorldPubSubType> reader (TEST_TOPIC_NAME );
729- reader.set_should_endpoints_match_function (
730- [&](const eprosima::fastdds::dds::SubscriptionBuiltinTopicData&,
731- const eprosima::fastdds::dds::PublicationBuiltinTopicData&)
732- {
733- ++reader_calls;
734- return false ;
735- });
736-
737- reader.init ();
738- ASSERT_TRUE (reader.isInitialized ());
739-
740- writer.init ();
741- ASSERT_TRUE (writer.isInitialized ());
742-
743- reader.wait_discovery (2s, 1u );
744- writer.wait_discovery (1u , 2s);
745-
746- ASSERT_FALSE (reader.is_matched ());
747- ASSERT_FALSE (writer.is_matched ());
748- ASSERT_GE (reader_calls.load (), 1u );
749- ASSERT_GE (writer_calls.load (), 1u );
750- ASSERT_EQ (reader.get_matched (), 0u );
751- ASSERT_EQ (writer.get_matched (), 0u );
752- }
753-
754- TEST (DDSDiscovery, EndpointMatchingCallbackSelectivelyMatchesOneWriter)
755- {
756- using namespace std ::chrono_literals;
757-
758- // Writer that will be matched
759- PubSubWriter<HelloWorldPubSubType> allowed_writer (TEST_TOPIC_NAME );
760- allowed_writer.setPublisherIDs (1u , 1u );
761- allowed_writer.init ();
762- ASSERT_TRUE (allowed_writer.isInitialized ());
763-
764- // Writer that wont be matched due to the callback
765- PubSubWriter<HelloWorldPubSubType> rejected_writer (TEST_TOPIC_NAME );
766- rejected_writer.setPublisherIDs (2u , 2u );
767- rejected_writer.init ();
768- ASSERT_TRUE (rejected_writer.isInitialized ());
769-
770- const auto allowed_entity_id = allowed_writer.datawriter_guid ().entityId ;
771-
772- std::atomic_uint32_t reader_calls {0 };
773-
774-
775- PubSubReader<HelloWorldPubSubType> reader (TEST_TOPIC_NAME );
776- reader.set_should_endpoints_match_function (
777- [&, allowed_entity_id](
778- const eprosima::fastdds::dds::SubscriptionBuiltinTopicData&,
779- const eprosima::fastdds::dds::PublicationBuiltinTopicData& writer_info)
780- {
781- // Simple callback that will only accept the allowed_writer
782- ++reader_calls;
783- return writer_info.guid .entityId == allowed_entity_id;
784- });
785- reader.init ();
786- ASSERT_TRUE (reader.isInitialized ());
787-
788- reader.wait_discovery (3s, 1u );
789- allowed_writer.wait_discovery (1u , 3s);
790-
791- // Check that only the allowed writer is matched from the reader's perspective
792- ASSERT_EQ (reader.get_matched (), 1u );
793- ASSERT_GE (reader_calls.load (), 1u );
794-
795- // NOTE: Beware, the rejected_writer hasn't rejected the reader, so it believes it is matched.
796- }
797-
798- >>>>>>> de70d42f6 (Make `on_xxx_matched` thread-safe (#6371 ))
799670/* *
800671 * This test checks that the physical properties are correctly sent on the DATA[p], and that the
801672 * ParticipantProxyData on the receiver side has the correct values.
0 commit comments