diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/test_participants.hpp b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/test_participants.hpp index e2d806b79..7a1dba444 100644 --- a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/test_participants.hpp +++ b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/test_participants.hpp @@ -77,18 +77,7 @@ class TestPublisher { if (participant_ != nullptr) { - if (publisher_ != nullptr) - { - if (writer_ != nullptr) - { - publisher_->delete_datawriter(writer_); - } - participant_->delete_publisher(publisher_); - } - if (topic_ != nullptr) - { - participant_->delete_topic(topic_); - } + participant_->delete_contained_entities(); eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->delete_participant(participant_); } } @@ -281,18 +270,7 @@ class TestSubscriber { if (participant_ != nullptr) { - if (topic_ != nullptr) - { - participant_->delete_topic(topic_); - } - if (subscriber_ != nullptr) - { - if (reader_ != nullptr) - { - subscriber_->delete_datareader(reader_); - } - participant_->delete_subscriber(subscriber_); - } + participant_->delete_contained_entities(); eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->delete_participant(participant_); } }