Skip to content

Commit 6e47398

Browse files
committed
Refs #21183: Add register_two_identical_typesupports regression test
Signed-off-by: eduponz <eduardoponz@eprosima.com>
1 parent 6828aab commit 6e47398

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

test/blackbox/common/DDSBlackboxTestsBasic.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,31 @@ TEST(DDSBasic, max_output_message_size_writer)
901901

902902
}
903903

904+
/**
905+
* @test This test checks that it is possible to register two TypeSupport instances of the same type
906+
* under the same DomainParticipant.
907+
*/
908+
TEST(DDSBasic, register_two_identical_typesupports)
909+
{
910+
// Set DomainParticipantFactory to create disabled entities
911+
DomainParticipantFactory* factory = DomainParticipantFactory::get_instance();
912+
ASSERT_NE(nullptr, factory);
913+
914+
// Create a disabled DomainParticipant, setting it to in turn create disable entities
915+
DomainParticipant* participant = factory->create_participant((uint32_t)GET_PID() % 230, PARTICIPANT_QOS_DEFAULT);
916+
ASSERT_NE(nullptr, participant);
917+
918+
// Register a type support
919+
TypeSupport type_support_1;
920+
type_support_1.reset(new HelloWorldPubSubType());
921+
EXPECT_EQ(RETCODE_OK, participant->register_type(type_support_1));
922+
923+
// Register a second instance of the type support with the same TopicDataType
924+
TypeSupport type_support_2;
925+
type_support_2.reset(new HelloWorldPubSubType());
926+
EXPECT_EQ(RETCODE_OK, participant->register_type(type_support_2));
927+
}
928+
904929
} // namespace dds
905930
} // namespace fastdds
906931
} // namespace eprosima

0 commit comments

Comments
 (0)