Skip to content

Commit

Permalink
Only insert the used topic into builtin topics
Browse files Browse the repository at this point in the history
Signed-off-by: Irene Bandera <irenebandera@eprosima.com>
  • Loading branch information
irenebm committed Sep 2, 2024
1 parent 46fc0d2 commit e2bf4b3
Showing 1 changed file with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ constexpr const uint32_t DEFAULT_MESSAGE_SIZE = 1; // x50 bytes
*/
DdsRouterConfiguration dds_test_simple_configuration(
bool disable_dynamic_discovery = false,
bool transient_local_readers = false)
bool transient_local_readers = false,
bool keyed = false)
{
DdsRouterConfiguration conf;

Expand Down Expand Up @@ -80,13 +81,22 @@ DdsRouterConfiguration dds_test_simple_configuration(
topic.type_name = "HelloWorld";
topic.topic_qos = qos;

core::types::DdsTopic topic_keyed(topic);
topic_keyed.type_name = "HelloWorldKeyed";
topic_keyed.topic_qos.keyed = true;
// DDS Participants cannot have two topics with the same name.
// Since this test does not require two distinct topics, we can simply avoid inserting
// the other topic if it isn't needed.
if (!keyed)
{
conf.ddspipe_configuration.builtin_topics.insert(utils::Heritable<core::types::DdsTopic>::make_heritable(topic));
}
else
{
core::types::DdsTopic topic_keyed(topic);
topic_keyed.type_name = "HelloWorldKeyed";
topic_keyed.topic_qos.keyed = true;

conf.ddspipe_configuration.builtin_topics.insert(utils::Heritable<core::types::DdsTopic>::make_heritable(topic));
conf.ddspipe_configuration.builtin_topics.insert(utils::Heritable<core::types::DdsTopic>::make_heritable(
topic_keyed));
conf.ddspipe_configuration.builtin_topics.insert(utils::Heritable<core::types::DdsTopic>::make_heritable(
topic_keyed));
}

conf.ddspipe_configuration.discovery_trigger = core::DiscoveryTrigger::NONE;
}
Expand Down Expand Up @@ -228,7 +238,7 @@ TEST(DDSTestLocal, end_to_end_local_communication)
TEST(DDSTestLocal, end_to_end_local_communication_keyed)
{
test::test_local_communication<HelloWorldKeyed, HelloWorldKeyedPubSubType>(
test::dds_test_simple_configuration());
test::dds_test_simple_configuration(false, false, true));
}

/**
Expand All @@ -245,7 +255,7 @@ TEST(DDSTestLocal, end_to_end_local_communication_disable_dynamic_discovery)
TEST(DDSTestLocal, end_to_end_local_communication_disable_dynamic_discovery_keyed)
{
test::test_local_communication<HelloWorldKeyed, HelloWorldKeyedPubSubType>(
test::dds_test_simple_configuration(true));
test::dds_test_simple_configuration(true,false,true));
}

/**
Expand Down

0 comments on commit e2bf4b3

Please sign in to comment.