Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement DDS Participants #466

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions ddsrouter_core/src/cpp/core/ParticipantFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
#include <ddspipe_participants/configuration/SimpleParticipantConfiguration.hpp>
#include <ddspipe_participants/configuration/XmlParticipantConfiguration.hpp>
#include <ddspipe_participants/participant/auxiliar/EchoParticipant.hpp>
#include <ddspipe_participants/participant/rtps/DiscoveryServerParticipant.hpp>
#include <ddspipe_participants/participant/rtps/InitialPeersParticipant.hpp>
#include <ddspipe_participants/participant/rtps/SimpleParticipant.hpp>
#include <ddspipe_participants/participant/dds/DiscoveryServerParticipant.hpp>
#include <ddspipe_participants/participant/dds/InitialPeersParticipant.hpp>
#include <ddspipe_participants/participant/dds/SimpleParticipant.hpp>
#include <ddspipe_participants/participant/dds/XmlParticipant.hpp>

#include <ddsrouter_core/types/ParticipantKind.hpp>
Expand Down Expand Up @@ -104,7 +104,7 @@ std::shared_ptr<ddspipe::core::IParticipant> ParticipantFactory::create_particip
case types::ParticipantKind::simple:
return generic_create_participant_with_init<
ddspipe::participants::SimpleParticipantConfiguration,
ddspipe::participants::rtps::SimpleParticipant>
ddspipe::participants::dds::SimpleParticipant>
(
kind,
participant_configuration,
Expand All @@ -115,7 +115,7 @@ std::shared_ptr<ddspipe::core::IParticipant> ParticipantFactory::create_particip
case types::ParticipantKind::discovery_server:
return generic_create_participant_with_init<
ddspipe::participants::DiscoveryServerParticipantConfiguration,
ddspipe::participants::rtps::DiscoveryServerParticipant>
ddspipe::participants::dds::DiscoveryServerParticipant>
(
kind,
participant_configuration,
Expand All @@ -126,7 +126,7 @@ std::shared_ptr<ddspipe::core::IParticipant> ParticipantFactory::create_particip
case types::ParticipantKind::initial_peers:
return generic_create_participant_with_init<
ddspipe::participants::InitialPeersParticipantConfiguration,
ddspipe::participants::rtps::InitialPeersParticipant>
ddspipe::participants::dds::InitialPeersParticipant>
(
kind,
participant_configuration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <cpp_utils/testing/LogChecker.hpp>

#include <ddspipe_core/types/topic/filter/WildcardDdsFilterTopic.hpp>
#include <ddspipe_participants/configuration/SimpleParticipantConfiguration.hpp>

#include <ddsrouter_core/core/DdsRouter.hpp>

Expand Down Expand Up @@ -50,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 @@ -79,13 +81,24 @@ 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;
}

// Two simple participants
Expand Down Expand Up @@ -225,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 @@ -242,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
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <cpp_utils/testing/LogChecker.hpp>

#include <ddspipe_core/types/topic/filter/WildcardDdsFilterTopic.hpp>
#include <ddspipe_participants/configuration/SimpleParticipantConfiguration.hpp>

#include <ddsrouter_core/core/DdsRouter.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@
#include <fastdds/rtps/attributes/RTPSParticipantAttributes.hpp>
#include <fastdds/rtps/transport/UDPv4TransportDescriptor.hpp>

#include <cpp_utils/testing/gtest_aux.hpp>
#include <cpp_utils/Log.hpp>

#include <ddspipe_participants/configuration/SimpleParticipantConfiguration.hpp>

#include <ddsrouter_core/core/DdsRouter.hpp>

#include "HelloWorld/HelloWorldPubSubTypes.hpp"
#include "HelloWorldKeyed/HelloWorldKeyedPubSubTypes.hpp"

Expand Down
18 changes: 9 additions & 9 deletions ddsrouter_core/test/unittest/ParticipantFactoryTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@

#include <ddspipe_core/interface/IParticipant.hpp>
#include <ddspipe_participants/participant/auxiliar/EchoParticipant.hpp>
#include <ddspipe_participants/participant/rtps/SimpleParticipant.hpp>
#include <ddspipe_participants/participant/rtps/DiscoveryServerParticipant.hpp>
#include <ddspipe_participants/participant/rtps/InitialPeersParticipant.hpp>
#include <ddspipe_participants/participant/dds/SimpleParticipant.hpp>
#include <ddspipe_participants/participant/dds/DiscoveryServerParticipant.hpp>
#include <ddspipe_participants/participant/dds/InitialPeersParticipant.hpp>
#include <ddspipe_participants/participant/dds/XmlParticipant.hpp>

#include <ddspipe_participants/testing/random_values.hpp>
Expand All @@ -61,35 +61,35 @@ class EchoTestClass : public ddspipe::participants::EchoParticipant
* It provides public access to the protected member 'configuration_' from its base class
* ddspipe::participants::SimpleParticipant.
*/
class SimpleTestClass : public ddspipe::participants::rtps::SimpleParticipant
class SimpleTestClass : public ddspipe::participants::dds::SimpleParticipant
{
public:

using ddspipe::participants::rtps::SimpleParticipant::configuration_; // Make protected member accessible
using ddspipe::participants::dds::SimpleParticipant::configuration_; // Make protected member accessible
};

/**
* This class is a subclass of ddspipe::participants::DiscoveryServerParticipant.
* It provides public access to the protected member 'configuration_' from its base class
* ddspipe::participants::DiscoveryServerParticipant.
*/
class DiscoveryServerTestClass : public ddspipe::participants::rtps::DiscoveryServerParticipant
class DiscoveryServerTestClass : public ddspipe::participants::dds::DiscoveryServerParticipant
{
public:

using ddspipe::participants::rtps::DiscoveryServerParticipant::configuration_; // Make protected member accessible
using ddspipe::participants::dds::DiscoveryServerParticipant::configuration_; // Make protected member accessible
};

/**
* This class is a subclass of ddspipe::participants::InitialPeersParticipant.
* It provides public access to the protected member 'configuration_' from its base class
* ddspipe::participants::InitialPeersParticipant.
*/
class InitialPeersTestClass : public ddspipe::participants::rtps::InitialPeersParticipant
class InitialPeersTestClass : public ddspipe::participants::dds::InitialPeersParticipant
{
public:

using ddspipe::participants::rtps::InitialPeersParticipant::configuration_; // Make protected member accessible
using ddspipe::participants::dds::InitialPeersParticipant::configuration_; // Make protected member accessible
};

/**
Expand Down
Loading