diff --git a/.gitignore b/.gitignore index 51b3ef6fd83..9de475e4cf1 100644 --- a/.gitignore +++ b/.gitignore @@ -69,6 +69,8 @@ Session.vim .netrwhist *~ +### VisualStudio Code ### +*.vscode ### VisualStudio ### ## Ignore Visual Studio temporary files, build results, and @@ -433,7 +435,11 @@ target/ # Eclipse .cproject .project +.settings .pydevproject compile_commands.json + +# Visual Studio Code +.vscode diff --git a/configure.ac b/configure.ac index e2f86dfee6e..e9c5b28ef66 100644 --- a/configure.ac +++ b/configure.ac @@ -21,7 +21,7 @@ # m4_define([version_major],[1]) m4_define([version_minor],[8]) -m4_define([version_micro],[0]) +m4_define([version_micro],[1]) AC_INIT([fastrtps], [version_major.version_minor.version_micro], [support@eprosima.com], [eProsima FastRTPS], [http://eprosima.com/]) CONFIG_ARGS="$*" diff --git a/examples/C++/LivelinessQoS/CMakeLists.txt b/examples/C++/LivelinessQoS/CMakeLists.txt new file mode 100644 index 00000000000..1347c32d093 --- /dev/null +++ b/examples/C++/LivelinessQoS/CMakeLists.txt @@ -0,0 +1,51 @@ +# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cmake_minimum_required(VERSION 2.8.12) + +if(NOT CMAKE_VERSION VERSION_LESS 3.0) + cmake_policy(SET CMP0048 NEW) +endif() + +project(LivelinessQoS) + +# Find requirements +if(NOT fastcdr_FOUND) + find_package(fastcdr REQUIRED) +endif() + +if(NOT fastrtps_FOUND) + find_package(fastrtps REQUIRED) +endif() + +# Set C++11 +include(CheckCXXCompilerFlag) +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG OR + CMAKE_CXX_COMPILER_ID MATCHES "Clang") + check_cxx_compiler_flag(-std=c++11 SUPPORTS_CXX11) + if(SUPPORTS_CXX11) + add_compile_options(-std=c++11) + else() + message(FATAL_ERROR "Compiler doesn't support C++11") + endif() +endif() + +message(STATUS "Configuring HelloWorld example...") +file(GLOB LIVELINESSQOS_SOURCES_CXX "*.cxx") +file(GLOB LIVELINESSQOS_SOURCES_CPP "*.cpp") + +add_executable(LivelinessQoS ${LIVELINESSQOS_SOURCES_CXX} ${LIVELINESSQOS_SOURCES_CPP}) +target_link_libraries(LivelinessQoS fastrtps fastcdr) +install(TARGETS LivelinessQoS + RUNTIME DESTINATION examples/C++/LivelinessQoS/${BIN_INSTALL_DIR}) diff --git a/examples/C++/LivelinessQoS/LivelinessPublisher.cpp b/examples/C++/LivelinessQoS/LivelinessPublisher.cpp new file mode 100644 index 00000000000..6372e51fbf9 --- /dev/null +++ b/examples/C++/LivelinessQoS/LivelinessPublisher.cpp @@ -0,0 +1,145 @@ +// Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @file LivelinessPublisher.cpp + * + */ + +#include "LivelinessPublisher.h" +#include +#include +#include +#include +#include +#include + +#include + +using namespace eprosima::fastrtps; +using namespace eprosima::fastrtps::rtps; + +LivelinessPublisher::LivelinessPublisher() + : participant_(nullptr) + , publisher_(nullptr) +{ +} + +bool LivelinessPublisher::init( + LivelinessQosPolicyKind kind, + int liveliness_ms) +{ + topic_.index(0); + topic_.message("HelloWorld"); + + ParticipantAttributes PParam; + PParam.rtps.builtin.use_SIMPLE_RTPSParticipantDiscoveryProtocol = true; + PParam.rtps.builtin.use_SIMPLE_EndpointDiscoveryProtocol = true; + PParam.rtps.builtin.m_simpleEDP.use_PublicationReaderANDSubscriptionWriter = true; + PParam.rtps.builtin.m_simpleEDP.use_PublicationWriterANDSubscriptionReader = true; + PParam.rtps.builtin.domainId = 0; + PParam.rtps.builtin.use_WriterLivelinessProtocol = true; + PParam.rtps.setName("Participant_pub"); + participant_ = Domain::createParticipant(PParam); + if(participant_==nullptr) + { + return false; + } + Domain::registerType(participant_,&type_); + + PublisherAttributes Wparam; + Wparam.topic.topicKind = NO_KEY; + Wparam.topic.topicDataType = "Topic"; + Wparam.topic.topicName = "Name"; + Wparam.qos.m_reliability.kind = RELIABLE_RELIABILITY_QOS; + Wparam.topic.historyQos.kind = KEEP_LAST_HISTORY_QOS; + Wparam.topic.historyQos.depth = 30; + Wparam.qos.m_liveliness.lease_duration = Duration_t(liveliness_ms * 1e-3); + Wparam.qos.m_liveliness.announcement_period = Duration_t(liveliness_ms * 1e-3 * 0.5); + Wparam.qos.m_liveliness.kind = kind; + publisher_ = Domain::createPublisher(participant_, Wparam, &listener_); + if(publisher_ == nullptr) + { + return false; + } + return true; +} + +LivelinessPublisher::~LivelinessPublisher() +{ + Domain::removeParticipant(participant_); +} + +void LivelinessPublisher::PubListener::onPublicationMatched(Publisher* /*pub*/,MatchingInfo& info) +{ + if(info.status == MATCHED_MATCHING) + { + n_matched++; + first_connected = true; + std::cout << "Publisher matched" << std::endl; + } + else + { + n_matched--; + std::cout << "Publisher unmatched" << std::endl; + } +} + +void LivelinessPublisher::PubListener::on_liveliness_lost( + Publisher *pub, + const LivelinessLostStatus &status) +{ + std::cout << "Publisher " << pub->getGuid() << " lost liveliness: " << status.total_count << std::endl; +} + +void LivelinessPublisher::run(uint32_t samples, uint32_t sleep) +{ + std::thread thread1(&LivelinessPublisher::runThread, this, publisher_, samples, sleep); + thread1.join(); +} + +void LivelinessPublisher::runThread( + Publisher* pub, + uint32_t samples, + uint32_t sleep) +{ + + for(uint32_t i = 0;igetGuid() << std::endl; + } + eClock::my_sleep(sleep); + } + + std::cin.ignore(); +} + +bool LivelinessPublisher::publish( + Publisher* pub, + bool waitForListener) +{ + if(listener_.first_connected || !waitForListener || listener_.n_matched > 0) + { + topic_.index(topic_.index()+1); + pub->write((void*)&topic_); + return true; + } + return false; +} diff --git a/examples/C++/LivelinessQoS/LivelinessPublisher.h b/examples/C++/LivelinessQoS/LivelinessPublisher.h new file mode 100644 index 00000000000..ab78220b87d --- /dev/null +++ b/examples/C++/LivelinessQoS/LivelinessPublisher.h @@ -0,0 +1,94 @@ +// Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @file LivelinessPublisher.h + * + */ + +#ifndef LivelinessPublisher_H_ +#define LivelinessPublisher_H_ + +#include "TopicType.h" +#include "Topic.h" + +#include +#include +#include + +#include + +class LivelinessPublisher { +public: + + //! Constructor + LivelinessPublisher(); + + //! Destructor + virtual ~LivelinessPublisher(); + + //! Initialize + bool init( + eprosima::fastrtps::LivelinessQosPolicyKind kind, + int liveliness_ms); + + //! Publish a sample + bool publish( + eprosima::fastrtps::Publisher* pub, + bool waitForListener = true); + + //! Run for number samples + void run(uint32_t number, uint32_t sleep); + +private: + + Topic topic_; + TopicType type_; + + eprosima::fastrtps::Participant* participant_; + eprosima::fastrtps::Publisher* publisher_; + + class PubListener : public eprosima::fastrtps::PublisherListener + { + public: + PubListener() + : n_matched(0) + , first_connected(false) + {} + + ~PubListener() + {} + + void onPublicationMatched( + eprosima::fastrtps::Publisher* pub, + eprosima::fastrtps::rtps::MatchingInfo& info) override; + + void on_liveliness_lost( + eprosima::fastrtps::Publisher* pub, + const eprosima::fastrtps::LivelinessLostStatus& status) override; + + int n_matched; + bool first_connected; + }; + PubListener listener_; + + void runThread( + eprosima::fastrtps::Publisher *pub, + uint32_t number, + uint32_t sleep); +}; + + + +#endif /* LivelinessPublisher_H_ */ diff --git a/examples/C++/LivelinessQoS/LivelinessSubscriber.cpp b/examples/C++/LivelinessQoS/LivelinessSubscriber.cpp new file mode 100644 index 00000000000..57f54dbe8f9 --- /dev/null +++ b/examples/C++/LivelinessQoS/LivelinessSubscriber.cpp @@ -0,0 +1,158 @@ +// Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @file LivelinessSubscriber.cpp + * + */ + +#include "LivelinessSubscriber.h" +#include +#include +#include +#include +#include +#include + +using namespace eprosima::fastrtps; +using namespace eprosima::fastrtps::rtps; + +LivelinessSubscriber::LivelinessSubscriber() + : participant_(nullptr) + , subscriber_(nullptr) +{ +} + +bool LivelinessSubscriber::init( + LivelinessQosPolicyKind kind, + int liveliness_ms) +{ + ParticipantAttributes PParam; + PParam.rtps.builtin.use_SIMPLE_RTPSParticipantDiscoveryProtocol = true; + PParam.rtps.builtin.use_SIMPLE_EndpointDiscoveryProtocol = true; + PParam.rtps.builtin.m_simpleEDP.use_PublicationReaderANDSubscriptionWriter = true; + PParam.rtps.builtin.m_simpleEDP.use_PublicationWriterANDSubscriptionReader = true; + PParam.rtps.builtin.domainId = 0; + PParam.rtps.builtin.use_WriterLivelinessProtocol = true; + PParam.rtps.setName("Participant_sub"); + participant_ = Domain::createParticipant(PParam, &part_listener_); + if(participant_==nullptr) + { + return false; + } + Domain::registerType(participant_, &type_); + + SubscriberAttributes Rparam; + Rparam.topic.topicKind = NO_KEY; + Rparam.topic.topicDataType = "Topic"; + Rparam.topic.topicName = "Name"; + Rparam.topic.historyQos.depth = 30; + Rparam.topic.historyQos.kind = KEEP_LAST_HISTORY_QOS; + Rparam.qos.m_durability.kind = TRANSIENT_LOCAL_DURABILITY_QOS; + Rparam.qos.m_reliability.kind = RELIABLE_RELIABILITY_QOS; + Rparam.qos.m_liveliness.lease_duration = Duration_t(liveliness_ms * 1e-3); + Rparam.qos.m_liveliness.announcement_period = Duration_t(liveliness_ms * 1e-3 * 0.5); + Rparam.qos.m_liveliness.kind = kind; + subscriber_ = Domain::createSubscriber(participant_, Rparam, &listener_); + if(subscriber_ == nullptr) + { + return false; + } + return true; +} + +LivelinessSubscriber::~LivelinessSubscriber() +{ + // TODO Auto-generated destructor stub + Domain::removeParticipant(participant_); +} + +void LivelinessSubscriber::SubListener::onSubscriptionMatched(Subscriber* /*sub*/,MatchingInfo& info) +{ + if(info.status == MATCHED_MATCHING) + { + n_matched++; + std::cout << "Subscriber matched"<takeNextData((void*)&topic, &m_info)) + { + if(m_info.sampleKind == ALIVE) + { + this->n_samples++; + + std::cout << "Message with index " << topic.index()<< " RECEIVED" << std::endl; + } + } +} + +void LivelinessSubscriber::SubListener::on_liveliness_changed( + Subscriber *sub, + const LivelinessChangedStatus &status) +{ + (void)sub; + + if (status.alive_count_change == 1) + { + std::cout << "Publisher " << status.last_publication_handle << " recovered liveliness" << std::endl; + } + else if (status.not_alive_count_change == 1) + { + std::cout << "Publisher " << status.last_publication_handle << " lost liveliness" << std::endl; + } +} + +void LivelinessSubscriber::run() +{ + std::cout << "Subscriber running. Please press enter to stop the Subscriber" << std::endl; + std::cin.ignore(); +} + +void LivelinessSubscriber::run(uint32_t number) +{ + std::cout << "Subscriber running until "<< number << "samples have been received"< this->listener_.n_samples) + { + eClock::my_sleep(500); + } +} + +void LivelinessSubscriber::PartListener::onParticipantDiscovery( + Participant* participant, + rtps::ParticipantDiscoveryInfo&& info) +{ + (void)participant; + + if (info.status == rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT) + { + std::cout << "Participant discovered" << std::endl; + } + else if (info.status == rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT) + { + std::cout << "Participant dropped" << std::endl; + } + else if (info.status == rtps::ParticipantDiscoveryInfo::REMOVED_PARTICIPANT) + { + std::cout << "Participant removed" << std::endl; + } +} diff --git a/examples/C++/LivelinessQoS/LivelinessSubscriber.h b/examples/C++/LivelinessQoS/LivelinessSubscriber.h new file mode 100644 index 00000000000..f085721241d --- /dev/null +++ b/examples/C++/LivelinessQoS/LivelinessSubscriber.h @@ -0,0 +1,99 @@ +// Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @file LivelinessSubscriber.h + * + */ + +#ifndef LIVELINESSSUBSCRIBER_H_ +#define LIVELINESSSUBSCRIBER_H_ + +#include "TopicType.h" +#include "Topic.h" + +#include +#include +#include +#include +#include +#include + +class LivelinessSubscriber +{ +public: + + //! Constructor + LivelinessSubscriber(); + + //! Destructor + virtual ~LivelinessSubscriber(); + + //! Initialize the subscriber + bool init( + eprosima::fastrtps::LivelinessQosPolicyKind kind, + int liveliness_ms); + + //! RUN the subscriber + void run(); + + //! Run the subscriber until number samples have been recevied. + void run(uint32_t number); + +private: + + TopicType type_; + eprosima::fastrtps::Participant* participant_; + eprosima::fastrtps::Subscriber* subscriber_; + + class SubListener : public eprosima::fastrtps::SubscriberListener + { + public: + + SubListener() + : n_matched(0) + , n_samples(0) + {} + + ~SubListener() + {} + + void onSubscriptionMatched( + eprosima::fastrtps::Subscriber* sub, + eprosima::fastrtps::rtps::MatchingInfo& info) override; + + void onNewDataMessage(eprosima::fastrtps::Subscriber* sub) override; + + void on_liveliness_changed( + eprosima::fastrtps::Subscriber* sub, + const eprosima::fastrtps::LivelinessChangedStatus& status) override; + + + eprosima::fastrtps::SampleInfo_t m_info; + int n_matched; + uint32_t n_samples; + Topic topic; + }; + SubListener listener_; + + class PartListener : public eprosima::fastrtps::ParticipantListener + { + virtual void onParticipantDiscovery(eprosima::fastrtps::Participant* participant, + eprosima::fastrtps::rtps::ParticipantDiscoveryInfo&& info) override; + }; + PartListener part_listener_; + +}; + +#endif diff --git a/examples/C++/LivelinessQoS/Liveliness_main.cpp b/examples/C++/LivelinessQoS/Liveliness_main.cpp new file mode 100644 index 00000000000..3fb0551b2ef --- /dev/null +++ b/examples/C++/LivelinessQoS/Liveliness_main.cpp @@ -0,0 +1,229 @@ +// Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @file Liveliness_main.cpp + * + */ + +#include "LivelinessPublisher.h" +#include "LivelinessSubscriber.h" + +#include +#include +#include +#include + +using namespace eprosima; +using namespace fastrtps; +using namespace rtps; + +//! +//! \brief Parses command line artuments +//! \param argc Number of command line arguments +//! \param argv Array of arguments +//! \param type Publisher or subscriber +//! \param lease_duration_ms Lease duration in ms +//! \param kind Liveliness kind +//! \param sleep_ms Sleep time between consecutive writes +//! \param samples Number of samples to write +//! \return True if command line arguments were parsed correctly +//! +bool parse_arguments(int argc, + char** argv, + int& type, + int& lease_duration_ms, + LivelinessQosPolicyKind &kind, + int& sleep_ms, + int& samples); + +int main(int argc, char** argv) +{ + int type = 1; + int lease_duration_ms = 100; + int sleep_ms = 1000; + int count = 10; + + eprosima::fastrtps::LivelinessQosPolicyKind kind = eprosima::fastrtps::AUTOMATIC_LIVELINESS_QOS; + + if (!parse_arguments( + argc, + argv, + type, + lease_duration_ms, + kind, + sleep_ms, + count)) + { + std::cout << "Usage: " << std::endl; + std::cout << argv[0] << " publisher "; + std::cout << "[--lease_duration ] "; + std::cout << "[--kind ]"; + std::cout << "[--sleep ] "; + std::cout << "[--samples ]" << std::endl; + + std::cout << "OR" << std::endl; + std::cout << argv[0] << " subscriber "; + std::cout << "[--lease_duration ]"; + std::cout << "[--kind ]" << std::endl << std::endl; + + std::cout << "Default values:" << std::endl; + std::cout << "lease_duration_ms = 100" << std::endl; + std::cout << "kind = AUTOMATIC" << std::endl; + std::cout << "writer_sleep_ms = 1000" << std::endl; + std::cout << "samples = 10" << std::endl; + return 0; + } + + switch(type) + { + case 1: + { + LivelinessPublisher mypub; + if(mypub.init(kind, lease_duration_ms)) + { + mypub.run(count, sleep_ms); + } + break; + } + case 2: + { + LivelinessSubscriber mysub; + if(mysub.init(kind, lease_duration_ms)) + { + mysub.run(); + } + break; + } +} + Domain::stopAll(); + Log::Reset(); + return 0; +} + +bool parse_arguments( + int argc, + char** argv, + int& type, + int& lease_duration_ms, + eprosima::fastrtps::LivelinessQosPolicyKind& kind, + int& sleep_ms, + int& samples) +{ + if (argc == 1) + { + // No arguments provided + return false; + } + + for (int i=0; i $(@:%.cxx.o=%.cxx.d) + @echo Compiling $< + @$(CC) $(CFLAGS) $(INCLUDES) $< -o $@ + +output/%.cpp.o:%.cpp + @echo Calculating dependencies $< + @$(CPP) $(CFLAGS) -MM $(CFLAGS) $(INCLUDES) $< | sed "s/^.*:/output\/&/g" > $(@:%.cpp.o=%.cpp.d) + @echo Compiling $< + @$(CPP) $(CFLAGS) $(INCLUDES) $< -o $@ + +.PHONY: LivelinessQoS + +clean: + @rm -f $(OBJS) + @rm -f $(DEPS) + +ifneq ($(MAKECMDGOALS), clean) +-include $(DEPS) +endif + +%.dir : + @echo "Checking directory $*" + @if [ ! -d $* ]; then \ + echo "Making directory $*"; \ + mkdir -p $* ; \ + fi; diff --git a/examples/C++/LivelinessQoS/README.md b/examples/C++/LivelinessQoS/README.md new file mode 100644 index 00000000000..6c647efa9b9 --- /dev/null +++ b/examples/C++/LivelinessQoS/README.md @@ -0,0 +1,53 @@ +## Liveliness QoS example + +This example illustrates the Liveliness QoS feature on a Fast-RTPS application. + +To launch this example open two different consoles: + +In the first one launch: ./LivelinessQoS publisher +In the second one launch: ./LivelinessQoS subscriber + +## Application behaviour + +When running a publisher, the application uses by default a liveliness kind of `AUTOMATIC_LIVELINESS_QOS` and a lease +duration of 100ms. In addition, it publishes 10 samples, one per second. + +When running a subscriber, the application uses by default the same liveliness kind and lease duration as the default +publisher. + +The default behaviour can be changed by providing the following command line arguments: + +./LivelinessQoS publisher [--lease_duration <lease_duration_ms>] [--kind <kind>] [--sleep <writer_sleep_ms>] [--samples <samples>] +./LivelinessQoS subscriber [--lease_duration <lease_duration_ms>] [--kind <kind>] + +For example: + +./LivelinessQoS publisher --lease_duration 1000 --kind AUTOMATIC --sleep 500 --samples 5 +./LivelinessQoS subscriber --lease_duration 1000 --kind AUTOMATIC + +will setup the publisher and subscriber to use a lease duration of 1000 ms with kind AUTOMATIC, the publisher will +write a new sample every 500 ms, and a total of 5 samples will be sent. + +Possible values for liveliness kind are AUTOMATIC, MANUAL_BY_PARTICIPANT or MANUAL_BY_TOPIC. + +## Examples + +### Publisher writing too slow + +Execute the example with the following parameters: + +./LivelinessQoS publisher --lease_duration 100 --kind MANUAL_BY_TOPIC --sleep 500 --samples 5 +./LivelinessQoS subscriber --lease_duration 300 --kind MANUAL_BY_TOPIC + +As the lease duration for both publisher and subscriber is smaller than the publisher write rate, +liveliness will be lost after sending a sample and recovered when writing the next one. + +### Publisher writing fast enough + +Execute the example with the following parameters: + +./LivelinessQoS publisher --lease_duration 600 --kind MANUAL_BY_TOPIC --sleep 500 --samples 5 +./LivelinessQoS subscriber --lease_duration 600 --kind MANUAL_BY_TOPIC + +In this case, as the lease duration is greater than the publishwer write rate, liveliness will only be lost after +sending the last sample. diff --git a/examples/C++/LivelinessQoS/Topic.cxx b/examples/C++/LivelinessQoS/Topic.cxx new file mode 100644 index 00000000000..e6abbc0c2f5 --- /dev/null +++ b/examples/C++/LivelinessQoS/Topic.cxx @@ -0,0 +1,129 @@ +// Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file Topic.cpp + * This source file contains the definition of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifdef _WIN32 +// Remove linker warning LNK4221 on Visual Studio +namespace { char dummy; } +#endif + +#include "Topic.h" + +#include + +using namespace eprosima::fastcdr::exception; + +#include + +Topic::Topic() +{ + index_ = 0; + +} + +Topic::~Topic() +{ +} + +Topic::Topic(const Topic &x) +{ + index_ = x.index_; + message_ = x.message_; +} + +Topic::Topic(Topic &&x) +{ + index_ = x.index_; + message_ = std::move(x.message_); +} + +Topic& Topic::operator=(const Topic &x) +{ + index_ = x.index_; + message_ = x.message_; + + return *this; +} + +Topic& Topic::operator=(Topic &&x) +{ + index_ = x.index_; + message_ = std::move(x.message_); + + return *this; +} + +size_t Topic::getMaxCdrSerializedSize(size_t current_alignment) +{ + size_t initial_alignment = current_alignment; + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + 255 + 1; + + + return current_alignment - initial_alignment; +} + +size_t Topic::getCdrSerializedSize(const Topic& data, size_t current_alignment) +{ + size_t initial_alignment = current_alignment; + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); + + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.message().size() + 1; + + + return current_alignment - initial_alignment; +} + +void Topic::serialize(eprosima::fastcdr::Cdr &scdr) const +{ + scdr << index_; + + scdr << message_; +} + +void Topic::deserialize(eprosima::fastcdr::Cdr &dcdr) +{ + dcdr >> index_; + dcdr >> message_; +} + +size_t Topic::getKeyMaxCdrSerializedSize(size_t current_alignment) +{ + size_t current_align = current_alignment; + + + + + return current_align; +} + +bool Topic::isKeyDefined() +{ + return false; +} + +void Topic::serializeKey(eprosima::fastcdr::Cdr&) const +{ + + +} diff --git a/examples/C++/LivelinessQoS/Topic.h b/examples/C++/LivelinessQoS/Topic.h new file mode 100644 index 00000000000..d2a9b06a26d --- /dev/null +++ b/examples/C++/LivelinessQoS/Topic.h @@ -0,0 +1,219 @@ +// Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file Topic.h + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool gen. + */ + +#ifndef _Topic_H_ +#define _Topic_H_ + +#include +#include +#include +#include + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif +#else +#define eProsima_user_DllExport +#endif + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(Topic_SOURCE) +#define Topic_DllAPI __declspec( dllexport ) +#else +#define Topic_DllAPI __declspec( dllimport ) +#endif // Topic_SOURCE +#else +#define Topic_DllAPI +#endif +#else +#define Topic_DllAPI +#endif // _WIN32 + +namespace eprosima { +namespace fastcdr { +class Cdr; +} +} + +/*! + * @brief This class represents the structure Topic defined by the user in the IDL file. + * @ingroup Topic + */ +class Topic +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport Topic(); + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~Topic(); + + /*! + * @brief Copy constructor. + * @param x Reference to the object Topic that will be copied. + */ + eProsima_user_DllExport Topic(const Topic &x); + + /*! + * @brief Move constructor. + * @param x Reference to the object Topic that will be copied. + */ + eProsima_user_DllExport Topic(Topic &&x); + + /*! + * @brief Copy assignment. + * @param x Reference to the object Topic that will be copied. + */ + eProsima_user_DllExport Topic& operator=(const Topic &x); + + /*! + * @brief Move assignment. + * @param x Reference to the object Topic that will be copied. + */ + eProsima_user_DllExport Topic& operator=(Topic &&x); + + /*! + * @brief This function sets a value in member index + * @param _index New value for member index + */ + inline eProsima_user_DllExport void index(uint32_t _index) + { + index_ = _index; + } + + /*! + * @brief This function returns the value of member index + * @return Value of member index + */ + inline eProsima_user_DllExport uint32_t index() const + { + return index_; + } + + /*! + * @brief This function returns a reference to member index + * @return Reference to member index + */ + inline eProsima_user_DllExport uint32_t& index() + { + return index_; + } + /*! + * @brief This function copies the value in member message + * @param _message New value to be copied in member message + */ + inline eProsima_user_DllExport void message(const std::string &_message) + { + message_ = _message; + } + + /*! + * @brief This function moves the value in member message + * @param _message New value to be moved in member message + */ + inline eProsima_user_DllExport void message(std::string &&_message) + { + message_ = std::move(_message); + } + + /*! + * @brief This function returns a constant reference to member message + * @return Constant reference to member message + */ + inline eProsima_user_DllExport const std::string& message() const + { + return message_; + } + + /*! + * @brief This function returns a reference to member message + * @return Reference to member message + */ + inline eProsima_user_DllExport std::string& message() + { + return message_; + } + + /*! + * @brief This function returns the maximum serialized size of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getMaxCdrSerializedSize(size_t current_alignment = 0); + + /*! + * @brief This function returns the serialized size of a data depending on the buffer alignment. + * @param data Data which is calculated its serialized size. + * @param current_alignment Buffer alignment. + * @return Serialized size. + */ + eProsima_user_DllExport static size_t getCdrSerializedSize(const Topic& data, size_t current_alignment = 0); + + + /*! + * @brief This function serializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serialize(eprosima::fastcdr::Cdr &cdr) const; + + /*! + * @brief This function deserializes an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void deserialize(eprosima::fastcdr::Cdr &cdr); + + + + /*! + * @brief This function returns the maximum serialized size of the Key of an object + * depending on the buffer alignment. + * @param current_alignment Buffer alignment. + * @return Maximum serialized size. + */ + eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize(size_t current_alignment = 0); + + /*! + * @brief This function tells you if the Key has been defined for this type + */ + eProsima_user_DllExport static bool isKeyDefined(); + + /*! + * @brief This function serializes the key members of an object using CDR serialization. + * @param cdr CDR serialization object. + */ + eProsima_user_DllExport void serializeKey(eprosima::fastcdr::Cdr &cdr) const; + +private: + uint32_t index_; + std::string message_; +}; + +#endif // _Topic_H_ diff --git a/examples/C++/LivelinessQoS/Topic.idl b/examples/C++/LivelinessQoS/Topic.idl new file mode 100644 index 00000000000..0fd2c355aee --- /dev/null +++ b/examples/C++/LivelinessQoS/Topic.idl @@ -0,0 +1,5 @@ +struct HelloWorld +{ + unsigned long index; + string message; +}; diff --git a/examples/C++/LivelinessQoS/TopicType.cxx b/examples/C++/LivelinessQoS/TopicType.cxx new file mode 100644 index 00000000000..85d89d670d2 --- /dev/null +++ b/examples/C++/LivelinessQoS/TopicType.cxx @@ -0,0 +1,122 @@ +// Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file TopicTypes.cpp + * This header file contains the implementation of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + +#include +#include + +#include "TopicType.h" + +using namespace eprosima::fastrtps; +using namespace eprosima::fastrtps::rtps; + +TopicType::TopicType() +{ + setName("Topic"); + m_typeSize = (uint32_t)Topic::getMaxCdrSerializedSize() + 4 /*encapsulation*/; + m_isGetKeyDefined = Topic::isKeyDefined(); + m_keyBuffer = (unsigned char*)malloc(Topic::getKeyMaxCdrSerializedSize()>16 ? Topic::getKeyMaxCdrSerializedSize() : 16); +} + +TopicType::~TopicType() +{ + if(m_keyBuffer!=nullptr) + free(m_keyBuffer); +} + +bool TopicType::serialize(void *data, SerializedPayload_t *payload) { + Topic *p_type = (Topic*) data; + eprosima::fastcdr::FastBuffer fastbuffer((char*) payload->data, payload->max_size); // Object that manages the raw buffer. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, + eprosima::fastcdr::Cdr::DDS_CDR); + payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + // Serialize encapsulation + ser.serialize_encapsulation(); + + try + { + p_type->serialize(ser); // Serialize the object: + } + catch(eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + payload->length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length + return true; +} + +bool TopicType::deserialize(SerializedPayload_t* payload, void* data) { + Topic* p_type = (Topic*) data; //Convert DATA to pointer of your type + eprosima::fastcdr::FastBuffer fastbuffer((char*)payload->data, payload->length); // Object that manages the raw buffer. + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, + eprosima::fastcdr::Cdr::DDS_CDR); // Object that deserializes the data. + // Deserialize encapsulation. + deser.read_encapsulation(); + payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + + try + { + p_type->deserialize(deser); //Deserialize the object: + } + catch(eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/) + { + return false; + } + + return true; +} + +std::function TopicType::getSerializedSizeProvider(void* data) { + return [data]() -> uint32_t { + return (uint32_t)type::getCdrSerializedSize(*static_cast(data)) + 4 /*encapsulation*/; + }; +} + +void* TopicType::createData() { + return (void*)new Topic(); +} + +void TopicType::deleteData(void* data) { + delete((Topic*)data); +} + +bool TopicType::getKey(void *data, InstanceHandle_t* handle, bool force_md5) { + if(!m_isGetKeyDefined) + return false; + Topic* p_type = (Topic*) data; + eprosima::fastcdr::FastBuffer fastbuffer((char*)m_keyBuffer,Topic::getKeyMaxCdrSerializedSize()); // Object that manages the raw buffer. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); // Object that serializes the data. + p_type->serializeKey(ser); + if(force_md5 || Topic::getKeyMaxCdrSerializedSize()>16) { + m_md5.init(); + m_md5.update(m_keyBuffer,(unsigned int)ser.getSerializedDataLength()); + m_md5.finalize(); + for(uint8_t i = 0;i<16;++i) { + handle->value[i] = m_md5.digest[i]; + } + } + else { + for(uint8_t i = 0;i<16;++i) { + handle->value[i] = m_keyBuffer[i]; + } + } + return true; +} diff --git a/examples/C++/LivelinessQoS/TopicType.h b/examples/C++/LivelinessQoS/TopicType.h new file mode 100644 index 00000000000..f9a4fda76b7 --- /dev/null +++ b/examples/C++/LivelinessQoS/TopicType.h @@ -0,0 +1,54 @@ +// Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file TopicTypes.h + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastcdrgen. + */ + + +#ifndef _TOPIC_TYPE_H_ +#define _TOPIC_TYPE_H_ + +#include "Topic.h" +#include + +/*! + * @brief This class represents the TopicDataType of the type Topic defined by the user in the IDL file. + */ +class TopicType : public eprosima::fastrtps::TopicDataType +{ +public: + typedef Topic type; + + TopicType(); + + virtual ~TopicType(); + + bool serialize(void *data, eprosima::fastrtps::rtps::SerializedPayload_t *payload); + bool deserialize(eprosima::fastrtps::rtps::SerializedPayload_t *payload, void *data); + bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle, bool force_md5); + + void* createData(); + void deleteData(void * data); + + std::function getSerializedSizeProvider(void* data); + + MD5 m_md5; + unsigned char* m_keyBuffer; +}; + +#endif diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 9a5f2933a91..8dec1833aec 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -30,6 +30,7 @@ add_subdirectory(C++/HistoryKind) add_subdirectory(C++/Keys) add_subdirectory(C++/LateJoiners) add_subdirectory(C++/LifespanQoSExample) +add_subdirectory(C++/LivelinessQoS) add_subdirectory(C++/SampleConfig_Controller) add_subdirectory(C++/SampleConfig_Events) add_subdirectory(C++/SampleConfig_Multimedia) diff --git a/fastrtpsgen/build.gradle b/fastrtpsgen/build.gradle index beb7f5b35bd..e24310a91cb 100644 --- a/fastrtpsgen/build.gradle +++ b/fastrtpsgen/build.gradle @@ -85,8 +85,10 @@ jar { compileJava.dependsOn buildIDLParser,copyResources compileJava { - sourceCompatibility = 1.7 - targetCompatibility = 1.7 + sourceCompatibility = 1.8 + targetCompatibility = 1.8 + options.compilerArgs.add('-Xlint:deprecation') + options.compilerArgs.add('-Xlint:unchecked') } test { diff --git a/fastrtpsgen/src/main/java/com/eprosima/fastrtps/fastrtpsgen.java b/fastrtpsgen/src/main/java/com/eprosima/fastrtps/fastrtpsgen.java index 01be777d5a2..e8892eb1e65 100644 --- a/fastrtpsgen/src/main/java/com/eprosima/fastrtps/fastrtpsgen.java +++ b/fastrtpsgen/src/main/java/com/eprosima/fastrtps/fastrtpsgen.java @@ -82,7 +82,7 @@ public class fastrtpsgen { private boolean m_subscribercode = true; private boolean m_atLeastOneStructure = false; protected static String m_localAppProduct = "fastrtps"; - private ArrayList m_includePaths = new ArrayList(); + private ArrayList m_includePaths = new ArrayList(); private String m_command = null; private String m_extra_command = null; @@ -962,7 +962,7 @@ String callPreprocessor(String idlFilename) final String METHOD_NAME = "callPreprocessor"; // Set line command. - ArrayList lineCommand = new ArrayList(); + ArrayList lineCommand = new ArrayList(); String [] lineCommandArray = null; String outputfile = Util.getIDLFileOnly(idlFilename) + ".cc"; int exitVal = -1; diff --git a/fastrtpsgen/src/main/java/com/eprosima/fastrtps/idl/grammar/Context.java b/fastrtpsgen/src/main/java/com/eprosima/fastrtps/idl/grammar/Context.java index aa198feeef0..e7051d8b36e 100644 --- a/fastrtpsgen/src/main/java/com/eprosima/fastrtps/idl/grammar/Context.java +++ b/fastrtpsgen/src/main/java/com/eprosima/fastrtps/idl/grammar/Context.java @@ -26,7 +26,7 @@ public class Context extends com.eprosima.idl.context.Context implements com.eprosima.fastcdr.idl.context.Context { // TODO Remove middleware parameter. It is temporal while cdr and rest don't have async functions. - public Context(String filename, String file, ArrayList includePaths, boolean subscribercode, boolean publishercode, + public Context(String filename, String file, ArrayList includePaths, boolean subscribercode, boolean publishercode, String appProduct, boolean generate_type_object) { super(filename, file, includePaths); diff --git a/fastrtpsgen/src/main/java/com/eprosima/fastrtps/solution/Project.java b/fastrtpsgen/src/main/java/com/eprosima/fastrtps/solution/Project.java index 51220ece056..a49a23f437b 100644 --- a/fastrtpsgen/src/main/java/com/eprosima/fastrtps/solution/Project.java +++ b/fastrtpsgen/src/main/java/com/eprosima/fastrtps/solution/Project.java @@ -22,16 +22,16 @@ public class Project extends com.eprosima.solution.Project { - public Project(String name, String file, LinkedHashSet dependencies) + public Project(String name, String file, LinkedHashSet dependencies) { super(name, file, dependencies); - m_subscribersrcfiles = new ArrayList(); - m_subscriberincludefiles = new ArrayList(); - m_publishersrcfiles = new ArrayList(); - m_publisherincludefiles = new ArrayList(); - m_projectincludefiles = new ArrayList(); - m_projectsrcfiles = new ArrayList(); + m_subscribersrcfiles = new ArrayList(); + m_subscriberincludefiles = new ArrayList(); + m_publishersrcfiles = new ArrayList(); + m_publisherincludefiles = new ArrayList(); + m_projectincludefiles = new ArrayList(); + m_projectsrcfiles = new ArrayList(); m_jnisrcfiles = new ArrayList(); m_jniincludefiles = new ArrayList(); m_idlincludefiles = new ArrayList(); @@ -214,13 +214,13 @@ public ArrayList getIDLIncludeFiles() } private boolean m_containsInterfaces = false; - private ArrayList m_subscribersrcfiles = null; - private ArrayList m_subscriberincludefiles = null; - private ArrayList m_publishersrcfiles = null; - private ArrayList m_publisherincludefiles = null; + private ArrayList m_subscribersrcfiles = null; + private ArrayList m_subscriberincludefiles = null; + private ArrayList m_publishersrcfiles = null; + private ArrayList m_publisherincludefiles = null; - private ArrayList m_projectsrcfiles = null; - private ArrayList m_projectincludefiles = null; + private ArrayList m_projectsrcfiles = null; + private ArrayList m_projectincludefiles = null; private boolean m_hasStruct = false; private ArrayList m_jnisrcfiles = null; private ArrayList m_jniincludefiles = null; diff --git a/include/fastrtps/participant/Participant.h b/include/fastrtps/participant/Participant.h index 6f9db3436c1..11dab5dbf2c 100644 --- a/include/fastrtps/participant/Participant.h +++ b/include/fastrtps/participant/Participant.h @@ -95,6 +95,11 @@ class RTPS_DllAPI Participant const rtps::GUID_t& readerGuid, rtps::ReaderProxyData& returnedInfo); + /** + * @brief Asserts liveliness of manual by participant publishers + */ + void assert_liveliness(); + private: Participant(); diff --git a/include/fastrtps/qos/LivelinessChangedStatus.h b/include/fastrtps/qos/LivelinessChangedStatus.h index 44e9ddbc0e1..318a70a7fbb 100644 --- a/include/fastrtps/qos/LivelinessChangedStatus.h +++ b/include/fastrtps/qos/LivelinessChangedStatus.h @@ -32,20 +32,20 @@ struct LivelinessChangedStatus //! or when a publisher previously considered to be not alive reasserts its liveliness. The count decreases //! when a publisher considered alive fails to assert its liveliness and becomes not alive, whether because //! it was deleted normally or for some other reason - uint32_t alive_count = 0; + int32_t alive_count = 0; //! @brief The total count of current publishers that write the topic read by the subscriber that are no longer //! asserting their liveliness //! @details This count increases when a publisher considered alive fails to assert its liveliness and becomes //! not alive for some reason other than the normal deletion of that publisher. It decreases when a previously //! not alive publisher either reasserts its liveliness or is deleted normally - uint32_t not_alive_count = 0; + int32_t not_alive_count = 0; //! @brief The change in the alive_count since the last time the listener was called or the status was read - uint32_t alive_count_change = 0; + int32_t alive_count_change = 0; //! @brief The change in the not_alive_count since the last time the listener was called or the status was read - uint32_t not_alive_count_change = 0; + int32_t not_alive_count_change = 0; //! @brief Handle to the last publisher whose change in liveliness caused this status to change rtps::InstanceHandle_t last_publication_handle; diff --git a/include/fastrtps/rtps/attributes/ReaderAttributes.h b/include/fastrtps/rtps/attributes/ReaderAttributes.h index 6ba4eec15c0..09da8df190c 100644 --- a/include/fastrtps/rtps/attributes/ReaderAttributes.h +++ b/include/fastrtps/rtps/attributes/ReaderAttributes.h @@ -23,6 +23,8 @@ #include "../common/Time_t.h" #include "../common/Guid.h" #include "EndpointAttributes.h" +#include "../../qos/QosPolicies.h" + namespace eprosima{ namespace fastrtps{ namespace rtps{ @@ -64,7 +66,9 @@ class ReaderAttributes public: ReaderAttributes() - : expectsInlineQos(false) + : liveliness_kind_(AUTOMATIC_LIVELINESS_QOS) + , liveliness_lease_duration(c_TimeInfinite) + , expectsInlineQos(false) , disable_positive_acks(false) { endpoint.endpointKind = READER; @@ -77,9 +81,15 @@ class ReaderAttributes //!Attributes of the associated endpoint. EndpointAttributes endpoint; - //!Times associated with this reader. + //!Times associated with this reader (only for stateful readers) ReaderTimes times; + //! Liveliness kind + LivelinessQosPolicyKind liveliness_kind_; + + //! Liveliness lease duration + Duration_t liveliness_lease_duration; + //!Indicates if the reader expects Inline qos, default value 0. bool expectsInlineQos; @@ -95,7 +105,8 @@ class RemoteWriterAttributes { public: RemoteWriterAttributes() - : livelinessLeaseDuration(c_TimeInfinite) + : liveliness_kind(AUTOMATIC_LIVELINESS_QOS) + , liveliness_lease_duration(c_TimeInfinite) , ownershipStrength(0) , is_eprosima_endpoint(true) { @@ -103,7 +114,8 @@ class RemoteWriterAttributes } RemoteWriterAttributes(const VendorId_t& vendor_id) - : livelinessLeaseDuration(c_TimeInfinite) + : liveliness_kind(AUTOMATIC_LIVELINESS_QOS) + , liveliness_lease_duration(c_TimeInfinite) , ownershipStrength(0) , is_eprosima_endpoint(vendor_id == c_VendorId_eProsima) { @@ -112,7 +124,6 @@ class RemoteWriterAttributes virtual ~RemoteWriterAttributes() { - } //!Attributes of the associated endpoint. @@ -121,8 +132,11 @@ class RemoteWriterAttributes //!GUID_t of the writer, can be unknown if the reader is best effort. GUID_t guid; - //!Liveliness lease duration, default value c_TimeInfinite. - Duration_t livelinessLeaseDuration; + //! Liveliness kind + LivelinessQosPolicyKind liveliness_kind; + + //! Liveliness lease duration, default value c_TimeInfinite. + Duration_t liveliness_lease_duration; //!Ownership Strength of the associated writer. uint16_t ownershipStrength; diff --git a/include/fastrtps/rtps/attributes/WriterAttributes.h b/include/fastrtps/rtps/attributes/WriterAttributes.h index 4e6804db9dd..f2c51514e19 100644 --- a/include/fastrtps/rtps/attributes/WriterAttributes.h +++ b/include/fastrtps/rtps/attributes/WriterAttributes.h @@ -24,6 +24,7 @@ #include "../flowcontrol/ThroughputControllerDescriptor.h" #include "EndpointAttributes.h" #include "../../utils/collections/ResourceLimitedContainerConfig.hpp" +#include "../../qos/QosPolicies.h" #include @@ -83,7 +84,9 @@ class WriterAttributes public: WriterAttributes() - : mode(SYNCHRONOUS_WRITER) + : liveliness_kind(AUTOMATIC_LIVELINESS_QOS) + , liveliness_lease_duration(c_TimeInfinite) + , mode(SYNCHRONOUS_WRITER) , disable_heartbeat_piggyback(false) , disable_positive_acks(false) , keep_duration(c_TimeInfinite) @@ -101,6 +104,12 @@ class WriterAttributes //!Writer Times (only used for RELIABLE). WriterTimes times; + //! Liveliness kind + LivelinessQosPolicyKind liveliness_kind; + + //! Liveliness lease duration + Duration_t liveliness_lease_duration; + //!Indicates if the Writer is synchronous or asynchronous RTPSWriterPublishMode mode; diff --git a/include/fastrtps/rtps/builtin/data/WriterProxyData.h b/include/fastrtps/rtps/builtin/data/WriterProxyData.h index 149843722e1..31b664a15a2 100644 --- a/include/fastrtps/rtps/builtin/data/WriterProxyData.h +++ b/include/fastrtps/rtps/builtin/data/WriterProxyData.h @@ -244,21 +244,6 @@ class WriterProxyData return m_typeMaxSerialized; } - RTPS_DllAPI void isAlive(bool isAlive) - { - m_isAlive = isAlive; - } - - RTPS_DllAPI bool isAlive() const - { - return m_isAlive; - } - - RTPS_DllAPI bool& isAlive() - { - return m_isAlive; - } - RTPS_DllAPI void topicKind(TopicKind_t topicKind) { m_topicKind = topicKind; @@ -376,9 +361,6 @@ class WriterProxyData //!Maximum size of the type associated with this Wrtiter, serialized. uint32_t m_typeMaxSerialized; - //!Indicates if the Writer is Alive. - bool m_isAlive; - //!Topic kind TopicKind_t m_topicKind; diff --git a/include/fastrtps/rtps/builtin/discovery/participant/PDPSimple.h b/include/fastrtps/rtps/builtin/discovery/participant/PDPSimple.h index 97b3cbb7376..505902f0db6 100644 --- a/include/fastrtps/rtps/builtin/discovery/participant/PDPSimple.h +++ b/include/fastrtps/rtps/builtin/discovery/participant/PDPSimple.h @@ -24,10 +24,7 @@ #include #include "../../../common/Guid.h" #include "../../../attributes/RTPSParticipantAttributes.h" - -#include "../../../../qos/QosPolicies.h" - - +#include "../../../messages/CDRMessage.h" namespace eprosima { namespace fastrtps{ @@ -187,19 +184,6 @@ class PDPSimple */ void assertRemoteParticipantLiveliness(const GuidPrefix_t& guidP); - /** - * Assert the liveliness of a Local Writer. - * @param kind LivilinessQosPolicyKind to be asserted. - */ - void assertLocalWritersLiveliness(LivelinessQosPolicyKind kind); - - /** - * Assert the liveliness of remote writers. - * @param guidP GuidPrefix_t of the participant whose writers liveliness is begin asserted. - * @param kind LivelinessQosPolicyKind of the writers. - */ - void assertRemoteWritersLiveliness(GuidPrefix_t& guidP,LivelinessQosPolicyKind kind); - /** * Activate a new Remote Endpoint that has been statically discovered. * @param pguid GUID_t of the participant. diff --git a/include/fastrtps/rtps/builtin/liveliness/WLP.h b/include/fastrtps/rtps/builtin/liveliness/WLP.h index 3978ada0357..d5e4bd3d5e1 100644 --- a/include/fastrtps/rtps/builtin/liveliness/WLP.h +++ b/include/fastrtps/rtps/builtin/liveliness/WLP.h @@ -25,26 +25,29 @@ #include "../../common/Time_t.h" #include "../../common/Locator.h" #include "../../common/Guid.h" +#include "../../../qos/QosPolicies.h" namespace eprosima { namespace fastrtps{ +class ReaderQos; class WriterQos; - namespace rtps { +class BuiltinProtocols; +class LivelinessManager; +class ReaderHistory; +class ReaderProxyData; class RTPSParticipantImpl; -class StatefulWriter; -class StatefulReader; +class RTPSReader; class RTPSWriter; -class BuiltinProtocols; +class StatefulReader; +class StatefulWriter; class ParticipantProxyData; class WLivelinessPeriodicAssertion; class WLPListener; class WriterHistory; -class ReaderHistory; -class ReaderProxyData; class WriterProxyData; /** @@ -53,75 +56,87 @@ class WriterProxyData; */ class WLP { - friend class WLPListener; - friend class WLivelinessPeriodicAssertion; + friend class WLPListener; + friend class WLivelinessPeriodicAssertion; + friend class StatefulReader; + friend class StatelessReader; + public: - /** - * Constructor - * @param prot Pointer to the BuiltinProtocols object. - */ - WLP(BuiltinProtocols* prot); - virtual ~WLP(); - /** - * Initialize the WLP protocol. - * @param p Pointer to the RTPS participant implementation. - * @return true if the initialziacion was succesful. - */ - bool initWL(RTPSParticipantImpl* p); - /** - * Create the endpoitns used in the WLP. - * @return true if correct. - */ - bool createEndpoints(); - /** - * Assign the remote endpoints for a newly discovered RTPSParticipant. - * @param pdata Pointer to the RTPSParticipantProxyData object. - * @return True if correct. - */ - bool assignRemoteEndpoints(const ParticipantProxyData& pdata); - /** - * Remove remote endpoints from the liveliness protocol. - * @param pdata Pointer to the ParticipantProxyData to remove - */ - void removeRemoteEndpoints(ParticipantProxyData* pdata); - /** - * Add a local writer to the liveliness protocol. - * @param W Pointer to the RTPSWriter. - * @param wqos Quality of service policies for the writer. + /** + * Constructor + * @param prot Pointer to the BuiltinProtocols object. + */ + WLP(BuiltinProtocols* prot); + virtual ~WLP(); + /** + * Initialize the WLP protocol. + * @param p Pointer to the RTPS participant implementation. + * @return true if the initialziacion was succesful. + */ + bool initWL(RTPSParticipantImpl* p); + /** + * Assign the remote endpoints for a newly discovered RTPSParticipant. + * @param pdata Pointer to the RTPSParticipantProxyData object. + * @return True if correct. + */ + bool assignRemoteEndpoints(const ParticipantProxyData& pdata); + /** + * Remove remote endpoints from the liveliness protocol. + * @param pdata Pointer to the ParticipantProxyData to remove + */ + void removeRemoteEndpoints(ParticipantProxyData* pdata); + /** + * Add a local writer to the liveliness protocol. + * @param W Pointer to the RTPSWriter. + * @param wqos Quality of service policies for the writer. * @return True if correct. - */ - bool addLocalWriter(RTPSWriter* W, const WriterQos& wqos); - /** - * Remove a local writer from the liveliness protocol. - * @param W Pointer to the RTPSWriter. - * @return True if removed. - */ - bool removeLocalWriter(RTPSWriter* W); - - //!MInimum time of the automatic writers liveliness period. - double m_minAutomatic_MilliSec; - //!Minimum time of the manual by participant writers liveliness period. - double m_minManRTPSParticipant_MilliSec; - - /** - * Get the builtin protocols - * @return Builtin protocols - */ - BuiltinProtocols* getBuiltinProtocols(){return mp_builtinProtocols;}; - - /** - * Update local writer. - * @param W Writer to update - * @param wqos New writer QoS - * @return True on success - */ - bool updateLocalWriter(RTPSWriter* W, const WriterQos& wqos); - - /** - * Get the RTPS participant - * @return RTPS participant - */ - inline RTPSParticipantImpl* getRTPSParticipant(){return mp_participant;} + */ + bool add_local_writer(RTPSWriter* W, const WriterQos& wqos); + /** + * Remove a local writer from the liveliness protocol. + * @param W Pointer to the RTPSWriter. + * @return True if removed. + */ + bool remove_local_writer(RTPSWriter* W); + + /** + * @brief Adds a local reader to the liveliness protocol + * @param reader Pointer to the RTPS reader + * @param rqos Quality of service policies for the reader + * @return True if added successfully + */ + bool add_local_reader(RTPSReader* reader, const ReaderQos& rqos); + + /** + * @brief Removes a local reader from the livliness protocol + * @param reader Pointer to the reader to remove + * @return True if removed successfully + */ + bool remove_local_reader(RTPSReader* reader); + + /** + * @brief A method to assert liveliness of a given writer + * @param writer The writer, specified via its id + * @param kind The writer liveliness kind + * @param lease_duration The writer lease duration + * @return True if liveliness was asserted + */ + bool assert_liveliness( + GUID_t writer, + LivelinessQosPolicyKind kind, + Duration_t lease_duration); + + /** + * @brief A method to assert liveliness of MANUAL_BY_PARTICIPANT writers + * @return True if there were any MANUAL_BY_PARTICIPANT writers + */ + bool assert_liveliness_manual_by_participant(); + + /** + * Get the builtin protocols + * @return Builtin protocols + */ + BuiltinProtocols* getBuiltinProtocols(){return mp_builtinProtocols;}; /** * Get the livelines builtin writer @@ -134,7 +149,7 @@ class WLP * @return writer history */ WriterHistory* getBuiltinWriterHistory(); - + #if HAVE_SECURITY bool pairing_remote_reader_with_local_writer_after_security(const GUID_t& local_writer, const ReaderProxyData& remote_reader_data); @@ -144,28 +159,99 @@ class WLP #endif private: - //!Pointer to the local RTPSParticipant. - RTPSParticipantImpl* mp_participant; - //!Pointer to the builtinprotocol class. - BuiltinProtocols* mp_builtinProtocols; - //!Pointer to the builtinRTPSParticipantMEssageWriter. - StatefulWriter* mp_builtinWriter; - //!Pointer to the builtinRTPSParticipantMEssageReader. - StatefulReader* mp_builtinReader; - //!Writer History - WriterHistory* mp_builtinWriterHistory; - //!Reader History - ReaderHistory* mp_builtinReaderHistory; - //!Listener object. - WLPListener* mp_listener; - //!Pointer to the periodic assertion timer object for the automatic liveliness writers. - WLivelinessPeriodicAssertion* mp_livelinessAutomatic; - //!Pointer to the periodic assertion timer object for the manual by RTPSParticipant liveliness writers. - WLivelinessPeriodicAssertion* mp_livelinessManRTPSParticipant; - //!List of the writers using automatic liveliness. - std::vector m_livAutomaticWriters; - //!List of the writers using manual by RTPSParticipant liveliness. - std::vector m_livManRTPSParticipantWriters; + /** + * Create the endpoints used in the WLP. + * @return true if correct. + */ + bool createEndpoints(); + + /** + * Get the RTPS participant + * @return RTPS participant + */ + inline RTPSParticipantImpl* getRTPSParticipant(){return mp_participant;} + + //! Minimum time among liveliness periods of automatic writers, in milliseconds + double min_automatic_ms_; + //! Minimum time among liveliness periods of manual by participant writers, in milliseconds + double min_manual_by_participant_ms_; + //!Pointer to the local RTPSParticipant. + RTPSParticipantImpl* mp_participant; + //!Pointer to the builtinprotocol class. + BuiltinProtocols* mp_builtinProtocols; + //!Pointer to the builtinRTPSParticipantMEssageWriter. + StatefulWriter* mp_builtinWriter; + //!Pointer to the builtinRTPSParticipantMEssageReader. + StatefulReader* mp_builtinReader; + //!Writer History + WriterHistory* mp_builtinWriterHistory; + //!Reader History + ReaderHistory* mp_builtinReaderHistory; + //!Listener object. + WLPListener* mp_listener; + //!Pointer to the periodic assertion timer object for automatic liveliness writers + WLivelinessPeriodicAssertion* automatic_liveliness_assertion_; + //!Pointer to the periodic assertion timer object for manual by participant liveliness writers + WLivelinessPeriodicAssertion* manual_liveliness_assertion_; + //! List of the writers using automatic liveliness. + std::vector automatic_writers_; + //! List of the writers using manual by participant liveliness. + std::vector manual_by_participant_writers_; + //! List of writers using manual by topic liveliness + std::vector manual_by_topic_writers_; + + //! List of readers + std::vector readers_; + //! A boolean indicating that there is at least one reader requesting automatic liveliness + bool automatic_readers_; + + //! A class used by writers in this participant to keep track of their liveliness + LivelinessManager* pub_liveliness_manager_; + //! A class used by readers in this participant to keep track of liveliness of matched writers + LivelinessManager* sub_liveliness_manager_; + + /** + * @brief A method invoked by pub_liveliness_manager_ to inform that a writer changed its liveliness + * @param writer The writer losing liveliness + * @param kind The liveliness kind + * @param lease_duration The liveliness lease duration + * @param alive_change The change in the alive count + * @param not_alive_change The change in the not alive count + */ + void pub_liveliness_changed( + const GUID_t& writer, + const LivelinessQosPolicyKind& kind, + const Duration_t& lease_duration, + int32_t alive_change, + int32_t not_alive_change); + + /** + * @brief A method invoked by sub_liveliness_manager_ to inform that a writer changed its liveliness + * @param writer The writer losing liveliness + * @param kind The liveliness kind of the writer losing liveliness + * @param lease_duration The liveliness lease duration of the writer losing liveliness + * @param alive_change The change in the alive count + * @param not_alive_change The change in the not alive count + */ + void sub_liveliness_changed( + const GUID_t& writer, + const LivelinessQosPolicyKind& kind, + const Duration_t& lease_duration, + int32_t alive_change, + int32_t not_alive_change); + + /** + * @brief A method to update the liveliness changed status of a given reader + * @param writer The writer changing liveliness, specified by its guid + * @param reader The reader whose liveliness needs to be updated + * @param alive_change The change requested for alive count. Should be -1, 0 or +1 + * @param not_alive_change The change requested for not alive count. Should be -1, 0 or +1 + */ + void update_liveliness_changed_status( + GUID_t writer, + RTPSReader* reader, + int32_t alive_change, + int32_t not_alive_change); #if HAVE_SECURITY //!Pointer to the builtinRTPSParticipantMEssageWriter. diff --git a/include/fastrtps/rtps/builtin/liveliness/WLPListener.h b/include/fastrtps/rtps/builtin/liveliness/WLPListener.h index 21a2e2ae39a..e6943cc6e29 100644 --- a/include/fastrtps/rtps/builtin/liveliness/WLPListener.h +++ b/include/fastrtps/rtps/builtin/liveliness/WLPListener.h @@ -47,22 +47,29 @@ struct CacheChange_t; */ class WLPListener: public ReaderListener { public: + /** - * Constructor - * @param pwlp Pointer to the WLP object. + * @brief Constructor + * @param pwlp Pointer to the writer liveliness protocol */ WLPListener(WLP* pwlp); + + /** + * @brief Destructor + */ virtual ~WLPListener(); /** - * - * @param reader - * @param change - */ + * @brief Method call when this class is notified of a new cache change + * @param reader The reader receiving the cache change + * @param change The cache change + */ void onNewCacheChangeAdded( RTPSReader* reader, const CacheChange_t* const change) override; +private: + /** * Separate the Key between the GuidPrefix_t and the liveliness Kind * @param key InstanceHandle_t to separate. @@ -70,7 +77,8 @@ class WLPListener: public ReaderListener { * @param liveliness Liveliness Kind Pointer. * @return True if correctly separated. */ - bool separateKey(InstanceHandle_t& key, + bool separateKey( + InstanceHandle_t& key, GuidPrefix_t* guidP, LivelinessQosPolicyKind* liveliness); @@ -80,7 +88,7 @@ class WLPListener: public ReaderListener { */ bool computeKey(CacheChange_t* change); -private: + //! A pointer to the writer liveliness protocol WLP* mp_WLP; }; diff --git a/include/fastrtps/rtps/builtin/liveliness/timedevent/WLivelinessPeriodicAssertion.h b/include/fastrtps/rtps/builtin/liveliness/timedevent/WLivelinessPeriodicAssertion.h index ddddf86176c..28ee9fcea6d 100644 --- a/include/fastrtps/rtps/builtin/liveliness/timedevent/WLivelinessPeriodicAssertion.h +++ b/include/fastrtps/rtps/builtin/liveliness/timedevent/WLivelinessPeriodicAssertion.h @@ -20,12 +20,11 @@ #ifndef WLIVELINESSPERIODICASSERTION_H_ #define WLIVELINESSPERIODICASSERTION_H_ #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + #include "../../../../qos/QosPolicies.h" #include "../../../resources/TimedEvent.h" #include "../../../../qos/ParameterList.h" - - namespace eprosima { namespace fastrtps{ namespace rtps { @@ -33,38 +32,61 @@ namespace rtps { class WLP; /** - * Class WLivelinessPeriodicAssertion, used to assert the liveliness of the writers in a RTPSParticipant. + * @brief A timed event used to assert liveliness of writers in a participant + * @details Makes the built-in message writer (as defined in the RTPS standard) send a cache change * @ingroup LIVELINESS_MODULE */ -class WLivelinessPeriodicAssertion: public TimedEvent { +class WLivelinessPeriodicAssertion: public TimedEvent +{ public: - /** - * Constructor - * @param pwlp Pointer to the WLP object. - * @param kind Kind of the periodic assertion timed event - */ - WLivelinessPeriodicAssertion(WLP* pwlp,LivelinessQosPolicyKind kind); - virtual ~WLivelinessPeriodicAssertion(); - /** - * Method invoked when the event occurs - * @param code Code representing the status of the event - * @param msg Message associated to the event - */ - void event(EventCode code, const char* msg= nullptr); - //!Liveliness Kind that is being asserted by this object. - LivelinessQosPolicyKind m_livelinessKind; - //!Pointer to the WLP object. - WLP* mp_WLP; - //!Assert the liveliness of AUTOMATIC kind Writers. - bool AutomaticLivelinessAssertion(); - //!Assert the liveliness of MANUAL_BY_PARTICIPANT kind writers. - bool ManualByRTPSParticipantLivelinessAssertion(); - //!Message to store the data. - CDRMessage_t m_msg; - //!Instance Handle - InstanceHandle_t m_iHandle; - //!GuidPrefix_t - GuidPrefix_t m_guidP; + /** + * @brief Constructor + * @param pwlp Pointer to the WLP object. + * @param kind Kind of the periodic assertion timed event + */ + WLivelinessPeriodicAssertion( + WLP* pwlp, + LivelinessQosPolicyKind kind); + + /** + * @brief Destructor + */ + virtual ~WLivelinessPeriodicAssertion(); + + /** + * @brief Method invoked when the event occurs + * @param code Code representing the status of the event + * @param msg Message associated to the event + */ + void event( + EventCode code, + const char* msg= nullptr) override; + +private: + + //! @brief Asserts the liveliness of AUTOMATIC kind writers + //! @return True if liveliness was successfully asserted + bool automatic_liveliness_assertion(); + + //! @brief Asserts the liveliness of MANUAL_BY_PARTICIPANT kind writers + //! @return True if liveliness was successfully asserted + bool manual_by_participant_liveliness_assertion(); + + //! @brief Adds a cache change to the writer history + //! @return True if the cache change was added + bool add_cache_change(); + + //! Liveliness Kind that is being asserted by this object. + LivelinessQosPolicyKind m_livelinessKind; + //! Pointer to the WLP object. + WLP* mp_WLP; + //! Message to store the data. + CDRMessage_t m_msg; + //! Instance Handle + InstanceHandle_t m_iHandle; + //! GuidPrefix_t + GuidPrefix_t m_guidP; + }; } /* namespace rtps */ diff --git a/include/fastrtps/rtps/common/Time_t.h b/include/fastrtps/rtps/common/Time_t.h index 7a5668fa66e..61be574fa23 100644 --- a/include/fastrtps/rtps/common/Time_t.h +++ b/include/fastrtps/rtps/common/Time_t.h @@ -26,12 +26,6 @@ namespace eprosima{ namespace fastrtps{ -namespace rtps{ -// 1 fraction = 1/(2^32) seconds -constexpr long double FRACTION_TO_NANO = 0.23283064365386962890625; // 1000000000 / 4294967296 -constexpr long double NANO_TO_FRACTION = 4.294967296; // 4294967296 / 1000000000 -} // namespace rtps - /** * Structure Time_t, used to describe times. * @ingroup COMMON_MODULE diff --git a/include/fastrtps/rtps/network/ReceiverResource.h b/include/fastrtps/rtps/network/ReceiverResource.h index 9ef3aa0646a..e4e4eb41192 100644 --- a/include/fastrtps/rtps/network/ReceiverResource.h +++ b/include/fastrtps/rtps/network/ReceiverResource.h @@ -68,12 +68,18 @@ class ReceiverResource : public TransportReceiverInterface */ void UnregisterReceiver(MessageReceiver* receiver); + /** + * Closes related ChannelResources. + */ + void disable(); + /** * Resources can only be transfered through move semantics. Copy, assignment, and * construction outside of the factory are forbidden. */ ReceiverResource(ReceiverResource&&); - ~ReceiverResource(); + + ~ReceiverResource() override; private: ReceiverResource() = delete; diff --git a/include/fastrtps/rtps/participant/RTPSParticipant.h b/include/fastrtps/rtps/participant/RTPSParticipant.h index a7f825c600c..a03c287bc2b 100644 --- a/include/fastrtps/rtps/participant/RTPSParticipant.h +++ b/include/fastrtps/rtps/participant/RTPSParticipant.h @@ -42,6 +42,7 @@ class RTPSReader; class WriterProxyData; class ReaderProxyData; class ResourceEvent; +class WLP; /** * @brief Class RTPSParticipant, contains the public API for a RTPSParticipant. @@ -196,6 +197,12 @@ class RTPS_DllAPI RTPSParticipant ResourceEvent& get_resource_event() const; + /** + * @brief A method to retrieve the built-in writer liveliness protocol + * @return Writer liveliness protocol + */ + WLP* wlp() const; + private: //!Pointer to the implementation. diff --git a/include/fastrtps/rtps/reader/RTPSReader.h b/include/fastrtps/rtps/reader/RTPSReader.h index 0d01718e02e..d179d6e6783 100644 --- a/include/fastrtps/rtps/reader/RTPSReader.h +++ b/include/fastrtps/rtps/reader/RTPSReader.h @@ -25,6 +25,7 @@ #include "../Endpoint.h" #include "../attributes/ReaderAttributes.h" #include "../common/SequenceNumber.h" +#include "../../qos/LivelinessChangedStatus.h" #include @@ -33,12 +34,14 @@ namespace fastrtps { namespace rtps { // Forward declarations -class ReaderListener; +class FragmentedChangePitStop; +class LivelinessManager; class ReaderHistory; -struct CacheChange_t; +class ReaderListener; class WriterProxy; struct SequenceNumber_t; class FragmentedChangePitStop; +struct CacheChange_t; /** * Class RTPSReader, manages the reception of data from its matched writers. @@ -50,6 +53,7 @@ class RTPSReader : public Endpoint friend class RTPSParticipantImpl; friend class MessageReceiver; friend class EDP; + friend class WLP; protected: @@ -225,6 +229,9 @@ class RTPSReader : public Endpoint */ virtual bool isInCleanState() = 0; + //! The liveliness changed status struct as defined in the DDS + LivelinessChangedStatus liveliness_changed_status_; + protected: void setTrustedWriter(EntityId_t writer) @@ -295,6 +302,13 @@ class RTPSReader : public Endpoint //TODO Select one FragmentedChangePitStop* fragmentedChangePitStop_; +protected: + + //! The liveliness kind of this reader + LivelinessQosPolicyKind liveliness_kind_; + //! The liveliness lease duration of this reader + Duration_t liveliness_lease_duration_; + private: RTPSReader& operator=(const RTPSReader&) = delete; diff --git a/include/fastrtps/rtps/reader/ReaderListener.h b/include/fastrtps/rtps/reader/ReaderListener.h index 2ce723ca107..8a13d5b6e19 100644 --- a/include/fastrtps/rtps/reader/ReaderListener.h +++ b/include/fastrtps/rtps/reader/ReaderListener.h @@ -21,7 +21,10 @@ #define READERLISTENER_H_ #include "../common/MatchingInfo.h" +#include + #include + namespace eprosima{ namespace fastrtps{ namespace rtps{ @@ -35,40 +38,53 @@ struct CacheChange_t; */ class RTPS_DllAPI ReaderListener { - public: +public: + + ReaderListener() = default; - ReaderListener() = default; + virtual ~ReaderListener() = default; - virtual ~ReaderListener() = default; + /** + * This method is invoked when a new reader matches + * @param reader Matching reader + * @param info Matching information of the reader + */ + virtual void onReaderMatched( + RTPSReader* reader, + MatchingInfo& info) + { + (void)reader; + (void)info; + } - /** - * This method is invoked when a new reader matches - * @param reader Matching reader - * @param info Matching information of the reader - */ - virtual void onReaderMatched( - RTPSReader* reader, - MatchingInfo& info) - { - (void)reader; - (void)info; - } + /** + * This method is called when a new CacheChange_t is added to the ReaderHistory. + * @param reader Pointer to the reader. + * @param change Pointer to the CacheChange_t. This is a const pointer to const data + * to indicate that the user should not dispose of this data himself. + * To remove the data call the remove_change method of the ReaderHistory. + * reader->getHistory()->remove_change((CacheChange_t*)change). + */ + virtual void onNewCacheChangeAdded( + RTPSReader* reader, + const CacheChange_t* const change) + { + (void)reader; + (void)change; + } - /** - * This method is called when a new CacheChange_t is added to the ReaderHistory. - * @param reader Pointer to the reader. - * @param change Pointer to the CacheChange_t. This is a const pointer to const data - * to indicate that the user should not dispose of this data himself. - * To remove the data call the remove_change method of the ReaderHistory. - * reader->getHistory()->remove_change((CacheChange_t*)change). - */ - virtual void onNewCacheChangeAdded( - RTPSReader* reader, - const CacheChange_t* const change) - { - (void)reader; - (void)change; - } + /** + * @brief Method called when the livelivess of a reader changes + * @param reader The reader + * @param status The liveliness changed status + */ + virtual void on_liveliness_changed( + RTPSReader* reader, + const LivelinessChangedStatus& status) + { + (void)reader; + (void)status; + } }; //Namespace enders diff --git a/include/fastrtps/rtps/reader/StatefulReader.h b/include/fastrtps/rtps/reader/StatefulReader.h index 235376e9b5f..864b38f1671 100644 --- a/include/fastrtps/rtps/reader/StatefulReader.h +++ b/include/fastrtps/rtps/reader/StatefulReader.h @@ -43,8 +43,12 @@ class StatefulReader:public RTPSReader protected: - StatefulReader(RTPSParticipantImpl*,GUID_t& guid, - ReaderAttributes& att,ReaderHistory* hist,ReaderListener* listen=nullptr); + StatefulReader( + RTPSParticipantImpl*, + GUID_t& guid, + ReaderAttributes& att, + ReaderHistory* hist, + ReaderListener* listen = nullptr); public: /** @@ -54,14 +58,6 @@ class StatefulReader:public RTPSReader */ bool matched_writer_add(RemoteWriterAttributes& wdata) override; - /** - * Remove a WriterProxyData from the matached writers. - * @param wdata Pointer to the WPD object. - * @param deleteWP If the Reader has to delete the associated WP object or not. - * @return True if correct. - */ - bool matched_writer_remove(const RemoteWriterAttributes& wdata,bool deleteWP); - /** * Remove a WriterProxyData from the matached writers. * @param wdata Pointer to the WPD object. diff --git a/include/fastrtps/rtps/reader/StatelessReader.h b/include/fastrtps/rtps/reader/StatelessReader.h index d249bc2f6f3..b8bb3710538 100644 --- a/include/fastrtps/rtps/reader/StatelessReader.h +++ b/include/fastrtps/rtps/reader/StatelessReader.h @@ -169,6 +169,16 @@ class StatelessReader: public RTPSReader bool thereIsUpperRecordOf(GUID_t& guid, SequenceNumber_t& seq); + /** + * @brief A method to find writer attributes by given guid + * @param guid The guid of the remote writer + * @param att The remote writer attributes + * @return True if attributes were found + */ + bool find_remote_writer_attributes( + const GUID_t& guid, + RemoteWriterAttributes& att); + //!List of GUID_t os matched writers. //!Is only used in the Discovery, to correctly notify the user using SubscriptionListener::onSubscriptionMatched(); std::vector m_matched_writers; diff --git a/include/fastrtps/rtps/reader/WriterProxy.h b/include/fastrtps/rtps/reader/WriterProxy.h index 4897c009460..69457393d54 100644 --- a/include/fastrtps/rtps/reader/WriterProxy.h +++ b/include/fastrtps/rtps/reader/WriterProxy.h @@ -125,29 +125,11 @@ namespace eprosima uint32_t m_lastHeartbeatCount; //!Timed event to postpone the heartbeatResponse. HeartbeatResponseDelay* mp_heartbeatResponse; - //!TO check the liveliness Status periodically. - WriterProxyLiveliness* mp_writerProxyLiveliness; //! Timed event to send initial acknack. InitialAckNack* mp_initialAcknack; //!Indicates if the heartbeat has the final flag set. bool m_heartbeatFinalFlag; - /** - * Check if the writer is alive - * @return true if the writer is alive - */ - inline bool isAlive(){return m_isAlive;}; - - /** - * Set the writer as alive - */ - void assertLiveliness(); - /** - * Set the writer as not alive - * @return - */ - inline void setNotAlive(){m_isAlive = false;}; - /** * Get the mutex * @return Associated mutex @@ -185,8 +167,6 @@ namespace eprosima void cleanup(); - //!Is the writer alive - bool m_isAlive; //Print Method for log purposes void print_changes_fromWriter_test2(); diff --git a/include/fastrtps/rtps/reader/timedevent/WriterProxyLiveliness.h b/include/fastrtps/rtps/reader/timedevent/WriterProxyLiveliness.h deleted file mode 100644 index c091f81ff61..00000000000 --- a/include/fastrtps/rtps/reader/timedevent/WriterProxyLiveliness.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @file WriterProxyLiveliness.h - * - */ - -#ifndef WRITERPROXYLIVELINESS_H_ -#define WRITERPROXYLIVELINESS_H_ -#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC -#include "../../resources/TimedEvent.h" - -namespace eprosima { -namespace fastrtps{ -namespace rtps { - -class WriterProxy; -/** - * Class WriterProxyLiveliness, timed event to check the liveliness of a writer each leaseDuration. - * @ingroup READER_MODULE - */ -class WriterProxyLiveliness: public TimedEvent { -public: - /** - * @param wp - * @param interval - */ - WriterProxyLiveliness(WriterProxy* wp,double interval); - virtual ~WriterProxyLiveliness(); - /** - * Method invoked when the event occurs - * - * @param code Code representing the status of the event - * @param msg Message associated to the event - */ - void event(EventCode code, const char* msg= nullptr); - //!Pointer to the WriterProxy associated with this specific event. - WriterProxy* mp_WP; -}; -} -} /* namespace rtps */ -} /* namespace eprosima */ -#endif -#endif /* WRITERPROXYLIVELINESS_H_ */ diff --git a/include/fastrtps/rtps/writer/LivelinessData.h b/include/fastrtps/rtps/writer/LivelinessData.h new file mode 100644 index 00000000000..c8e0195f250 --- /dev/null +++ b/include/fastrtps/rtps/writer/LivelinessData.h @@ -0,0 +1,116 @@ +// Copyright 2016-2019 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @file LivelinessData.h + */ +#ifndef LIVELINESS_DATA_H_ +#define LIVELINESS_DATA_H_ + +#include "../../qos/QosPolicies.h" +#include "../common/Time_t.h" + +#include + +namespace eprosima { +namespace fastrtps { +namespace rtps { + +/** + * @brief A struct keeping relevant liveliness information of a writer + * @ingroup WRITER_MODULE + */ +struct LivelinessData +{ + enum WriterStatus + { + //! Writer is matched but liveliness has not been asserted yet + NOT_ASSERTED = 0, + //! Writer is alive + ALIVE = 1, + //! Writer is not alive + NOT_ALIVE = 2 + }; + + /** + * @brief Constructor + * @param guid_in GUID of the writer + * @param kind_in Liveliness kind + * @param lease_duration_in Liveliness lease duration + */ + LivelinessData( + GUID_t guid_in, + LivelinessQosPolicyKind kind_in, + Duration_t lease_duration_in) + : guid(guid_in) + , kind(kind_in) + , lease_duration(lease_duration_in) + , status(WriterStatus::NOT_ASSERTED) + {} + + LivelinessData() + : guid() + , kind(AUTOMATIC_LIVELINESS_QOS) + , lease_duration(c_TimeInfinite) + , status(WriterStatus::NOT_ASSERTED) + {} + + ~LivelinessData() + {} + + /** + * @brief Equality operator + * @param other Liveliness data to compare to + * @return True if equal + */ + bool operator==(const LivelinessData& other) const + { + return ((guid == other.guid) && + (kind == other.kind) && + (lease_duration == other.lease_duration)); + } + + /** + * @brief Inequality operator + * @param other Liveliness data to compare to + * @return True if different + */ + bool operator!=(const LivelinessData& other) const + { + return (!operator==(other)); + } + + //! GUID of the writer + GUID_t guid; + + //! Writer liveliness kind + LivelinessQosPolicyKind kind; + + //! The lease duration + Duration_t lease_duration; + + //! The number of times the writer is being counted + unsigned int count = 1; + + //! The writer status + WriterStatus status; + + //! The time when the writer will lose liveliness + std::chrono::steady_clock::time_point time; +}; + +} /* namespace rtps */ +} /* namespace fastrtps */ +} /* namespace eprosima */ +#endif /* LIVELINESS_DATA_H_ */ diff --git a/include/fastrtps/rtps/writer/LivelinessManager.h b/include/fastrtps/rtps/writer/LivelinessManager.h new file mode 100644 index 00000000000..12544195cbb --- /dev/null +++ b/include/fastrtps/rtps/writer/LivelinessManager.h @@ -0,0 +1,180 @@ +// Copyright 2016-2019 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @file LivelinessManager.h + */ +#ifndef LIVELINESS_MANAGER_H_ +#define LIVELINESS_MANAGER_H_ + +#include "LivelinessData.h" +#include "../timedevent/TimedCallback.h" +#include "../../utils/collections/ResourceLimitedVector.hpp" + +#include + +namespace eprosima { +namespace fastrtps { +namespace rtps { + +using LivelinessCallback = std::function; + +/** + * @brief A class managing the liveliness of a set of writers. Writers are represented by their LivelinessData + * @details Uses a shared timed event and informs outside classes on liveliness changes + * @ingroup WRITER_MODULE + */ +class LivelinessManager +{ +public: + + /** + * @brief Constructor + * @param callback A callback that will be invoked when a writer changes its liveliness status + * @param service The asio I/O service + * @param event_thread The event thread + * @param manage_automatic True to manage writers with automatic liveliness, false otherwise + */ + LivelinessManager( + const LivelinessCallback& callback, + asio::io_service& service, + const std::thread& event_thread, + bool manage_automatic = true); + + /** + * @brief Constructor + */ + ~LivelinessManager(); + + /** + * @brief LivelinessManager + * @param other + */ + LivelinessManager(const LivelinessManager& other) = delete; + + /** + * @brief Adds a writer to the set + * @param guid GUID of the writer + * @param kind Liveliness kind + * @param lease_duration Liveliness lease duration + * @return True if the writer was successfully added + */ + bool add_writer( + GUID_t guid, + LivelinessQosPolicyKind kind, + Duration_t lease_duration); + + /** + * @brief Removes a writer + * @param guid GUID of the writer + * @param kind Liveliness kind + * @param lease_duration Liveliness lease duration + * @return True if the writer was successfully removed + */ + bool remove_writer( + GUID_t guid, + LivelinessQosPolicyKind kind, + Duration_t lease_duration); + + /** + * @brief Asserts liveliness of a writer in the set + * @param guid The writer to assert liveliness of + * @param kind The kind of the writer + * @param lease_duration The lease duration + * @return True if liveliness was successfully asserted + */ + bool assert_liveliness( + GUID_t guid, + LivelinessQosPolicyKind kind, + Duration_t lease_duration); + + /** + * @brief Asserts liveliness of writers with given liveliness kind + * @param kind Liveliness kind + * @return True if liveliness was successfully asserted + */ + bool assert_liveliness(LivelinessQosPolicyKind kind); + + /** + * @brief A method to check any writer of the given kind is alive + * @param kind The liveliness kind to check for + * @return True if at least one writer of this kind is alive. False otherwise + */ + bool is_any_alive(LivelinessQosPolicyKind kind); + + /** + * @brief A method to return liveliness data + * @details Should only be used for testing purposes + * @return Vector of liveliness data + */ + const ResourceLimitedVector &get_liveliness_data() const; + +private: + + //! @brief A method responsible for invoking the callback when liveliness is asserted + //! @param writer The liveliness data of the writer asserting liveliness + //! + void assert_writer_liveliness(LivelinessData& writer); + + /** + * @brief A method to calculate the time when the next writer is going to lose liveliness + * @details This method is public for testing purposes but it should not be used from outside this class + * @return True if at least one writer is alive + */ + bool calculate_next(); + + //! @brief A method to find a writer from a guid, liveliness kind and lease duration + //! @param guid The guid of the writer + //! @param kind The liveliness kind + //! @param lease_duration The lease duration + //! @param wit_out Returns an iterator to the writer liveliness data + //! @return Returns true if writer was found, false otherwise + bool find_writer( + const GUID_t &guid, + const LivelinessQosPolicyKind &kind, + const Duration_t &lease_duration, + ResourceLimitedVector::iterator* wit_out); + + + //! A method called if the timer expires + void timer_expired(); + + //! A callback to inform outside classes that a writer changed its liveliness status + LivelinessCallback callback_; + + //! A boolean indicating whether we are managing writers with automatic liveliness + bool manage_automatic_; + + //! A vector of liveliness data + ResourceLimitedVector writers_; + + //! A mutex to protect the liveliness data + std::mutex mutex_; + + //! The timer owner, i.e. the writer which is next due to lose its liveliness + LivelinessData* timer_owner_; + + //! A timed callback expiring when a writer (the timer owner) loses its liveliness + TimedCallback timer_; +}; + +} /* namespace rtps */ +} /* namespace fastrtps */ +} /* namespace eprosima */ +#endif /* LIVELINESS_MANAGER_H_ */ diff --git a/include/fastrtps/rtps/writer/RTPSWriter.h b/include/fastrtps/rtps/writer/RTPSWriter.h index 995f78f9015..a28a28dcdfe 100644 --- a/include/fastrtps/rtps/writer/RTPSWriter.h +++ b/include/fastrtps/rtps/writer/RTPSWriter.h @@ -22,7 +22,9 @@ #include "../Endpoint.h" #include "../messages/RTPSMessageGroup.h" #include "../attributes/WriterAttributes.h" +#include "../../qos/LivelinessLostStatus.h" #include "../../utils/collections/ResourceLimitedVector.hpp" + #include #include #include @@ -75,8 +77,10 @@ class RTPSWriter : public Endpoint } - RTPS_DllAPI CacheChange_t* new_change(const std::function& dataCdrSerializedSize, - ChangeKind_t changeKind, InstanceHandle_t handle = c_InstanceHandle_Unknown); + RTPS_DllAPI CacheChange_t* new_change( + const std::function& dataCdrSerializedSize, + ChangeKind_t changeKind, + InstanceHandle_t handle = c_InstanceHandle_Unknown); /** * Add a matched reader. @@ -154,19 +158,6 @@ class RTPSWriter : public Endpoint */ RTPS_DllAPI inline WriterListener* getListener() { return mp_listener; } - /** - * Get the asserted liveliness - * @return Asserted liveliness - */ - RTPS_DllAPI inline bool getLivelinessAsserted() { return m_livelinessAsserted; } - - /** - * Set the asserted liveliness - * @param l asserted liveliness - * @return asserted liveliness - */ - RTPS_DllAPI inline void setLivelinessAsserted(bool l) { m_livelinessAsserted = l; } - /** * Get the publication mode * @return publication mode @@ -265,14 +256,27 @@ class RTPSWriter : public Endpoint return writer_guid == m_guid; } + /** + * @brief A method to retrieve the liveliness kind + * @return Liveliness kind + */ + const LivelinessQosPolicyKind& get_liveliness_kind() const; + + /** + * @brief A method to retrieve the liveliness lease duration + * @return Lease durtation + */ + const Duration_t& get_liveliness_lease_duration() const; + + //! Liveliness lost status of this writer + LivelinessLostStatus liveliness_lost_status_; + protected: //!Is the data sent directly or announced by HB and THEN send to the ones who ask for it?. bool m_pushMode; //!Group created to send messages more efficiently RTPSMessageGroup_t m_cdrmessages; - //!INdicates if the liveliness has been asserted - bool m_livelinessAsserted; //!WriterHistory WriterHistory* mp_history; //!Listener @@ -315,6 +319,11 @@ class RTPSWriter : public Endpoint bool encrypt_cachechange(CacheChange_t* change); #endif + //! The liveliness kind of this reader + LivelinessQosPolicyKind liveliness_kind_; + //! The liveliness lease duration of this reader + Duration_t liveliness_lease_duration_; + private: RTPSWriter& operator=(const RTPSWriter&) = delete; diff --git a/include/fastrtps/rtps/writer/StatefulWriter.h b/include/fastrtps/rtps/writer/StatefulWriter.h index ee19ce145f7..120b7927d9e 100644 --- a/include/fastrtps/rtps/writer/StatefulWriter.h +++ b/include/fastrtps/rtps/writer/StatefulWriter.h @@ -204,13 +204,23 @@ class StatefulWriter : public RTPSWriter SequenceNumber_t next_sequence_number() const; - bool send_periodic_heartbeat(); + /** + * @brief Sends a periodic heartbeat + * @param final Final flag + * @param liveliness Liveliness flag + * @return True on success + */ + bool send_periodic_heartbeat( + bool final = false, + bool liveliness = false); /*! * @brief Sends a heartbeat to a remote reader. * @remarks This function is non thread-safe. */ - void send_heartbeat_to_nts(ReaderProxy& remoteReaderProxy); + void send_heartbeat_to_nts( + ReaderProxy& remoteReaderProxy, + bool liveliness = false); void perform_nack_response(); @@ -270,7 +280,8 @@ class StatefulWriter : public RTPSWriter const std::vector& remote_readers, const LocatorList_t& locators, RTPSMessageGroup& message_group, - bool final = false); + bool final, + bool liveliness = false); void check_acked_status(); diff --git a/include/fastrtps/rtps/writer/WriterListener.h b/include/fastrtps/rtps/writer/WriterListener.h index 97fdb8f9123..85bf22a7b83 100644 --- a/include/fastrtps/rtps/writer/WriterListener.h +++ b/include/fastrtps/rtps/writer/WriterListener.h @@ -22,6 +22,8 @@ #include "../common/MatchingInfo.h" +#include + namespace eprosima{ namespace fastrtps{ namespace rtps{ @@ -35,37 +37,50 @@ struct CacheChange_t; */ class RTPS_DllAPI WriterListener { - public: - WriterListener() = default; +public: + WriterListener() = default; + + virtual ~WriterListener() = default; - virtual ~WriterListener() = default; + /** + * This method is called when a new Reader is matched with this Writer by the builtin protocols + * @param writer Pointer to the RTPSWriter. + * @param info Matching Information. + */ + virtual void onWriterMatched( + RTPSWriter* writer, + MatchingInfo& info) + { + (void)writer; + (void)info; + } - /** - * This method is called when a new Reader is matched with this Writer by hte builtin protocols - * @param writer Pointer to the RTPSWriter. - * @param info Matching Information. - */ - virtual void onWriterMatched( - RTPSWriter* writer, - MatchingInfo& info) - { - (void)writer; - (void)info; - } + /** + * This method is called when all the readers matched with this Writer acknowledge that a cache + * change has been received. + * @param writer Pointer to the RTPSWriter. + * @param change Pointer to the affected CacheChange_t. + */ + virtual void onWriterChangeReceivedByAll( + RTPSWriter* writer, + CacheChange_t* change) + { + (void)writer; + (void)change; + } - /** - * This method is called when all the readers matched with this Writer acknowledge that a cache - * change has been received. - * @param writer Pointer to the RTPSWriter. - * @param change Pointer to the affected CacheChange_t. - */ - virtual void onWriterChangeReceivedByAll( - RTPSWriter* writer, - CacheChange_t* change) - { - (void)writer; - (void)change; - } + /** + * @brief Method called when the livelivess of a writer is lost + * @param writer The writer + * @param status The liveliness lost status + */ + virtual void on_liveliness_lost( + RTPSWriter* writer, + const LivelinessLostStatus& status) + { + (void)writer; + (void)status; + } }; } /* namespace rtps */ diff --git a/include/fastrtps/transport/UDPChannelResource.h b/include/fastrtps/transport/UDPChannelResource.h index 9732b17f8eb..2a106d6aef4 100644 --- a/include/fastrtps/transport/UDPChannelResource.h +++ b/include/fastrtps/transport/UDPChannelResource.h @@ -16,6 +16,7 @@ #define UDP_CHANNEL_RESOURCE_INFO_ #include +#include #include namespace eprosima{ @@ -23,6 +24,7 @@ namespace fastrtps{ namespace rtps{ class TransportReceiverInterface; +class UDPTransportInterface; #if defined(ASIO_HAS_MOVE) // Typedefs @@ -73,14 +75,16 @@ class TransportReceiverInterface; class UDPChannelResource : public ChannelResource { public: - UDPChannelResource(eProsimaUDPSocket& socket); UDPChannelResource( + UDPTransportInterface* transport, eProsimaUDPSocket& socket, - uint32_t maxMsgSize); + uint32_t maxMsgSize, + const Locator_t& locator, + const std::string& sInterface, + TransportReceiverInterface* receiver); - UDPChannelResource(UDPChannelResource&& channelResource); - virtual ~UDPChannelResource(); + virtual ~UDPChannelResource() override; UDPChannelResource& operator=(UDPChannelResource&& channelResource) { @@ -91,7 +95,7 @@ class UDPChannelResource : public ChannelResource void only_multicast_purpose(const bool value) { only_multicast_purpose_ = value; - }; + } bool& only_multicast_purpose() { @@ -132,12 +136,44 @@ class UDPChannelResource : public ChannelResource return message_receiver_; } + inline virtual void disable() override + { + ChannelResource::disable(); + } + + void release(); + +protected: + /** + * Function to be called from a new thread, which takes cares of performing a blocking receive + * operation on the ReceiveResource + * @param input_locator - Locator that triggered the creation of the resource + */ + void perform_listen_operation( + Locator_t input_locator); + + /** + * Blocking Receive from the specified channel. + * @param receive_buffer vector with enough capacity (not size) to accomodate a full receive buffer. That + * capacity must not be less than the receive_buffer_size supplied to this class during construction. + * @param receive_buffer_capacity Maximum size of the receive_buffer. + * @param[out] receive_buffer_size Size of the received buffer. + * @param[out] remote_locator Locator describing the remote restination we received a packet from. + */ + bool Receive( + octet* receive_buffer, + uint32_t receive_buffer_capacity, + uint32_t& receive_buffer_size, + Locator_t& remote_locator); + private: TransportReceiverInterface* message_receiver_; //Associated Readers/Writers inside of MessageReceiver eProsimaUDPSocket socket_; bool only_multicast_purpose_; std::string interface_; + UDPTransportInterface* transport_; + UDPChannelResource(const UDPChannelResource&) = delete; UDPChannelResource& operator=(const UDPChannelResource&) = delete; }; diff --git a/include/fastrtps/transport/UDPTransportInterface.h b/include/fastrtps/transport/UDPTransportInterface.h index 1b99360f56e..5253c7e4416 100644 --- a/include/fastrtps/transport/UDPTransportInterface.h +++ b/include/fastrtps/transport/UDPTransportInterface.h @@ -64,21 +64,6 @@ class UDPTransportInterface : public TransportInterface SendResourceList& sender_resource_list, const Locator_t&) override; - /** - * Blocking Receive from the specified channel. - * @param p_channel_resource Pointer to the channer resource that stores the socket. - * @param receive_buffer vector with enough capacity (not size) to accomodate a full receive buffer. That - * capacity must not be less than the receive_buffer_size supplied to this class during construction. - * @param receive_buffer_capacity Maximum size of the receive_buffer. - * @param[out] receive_buffer_size Size of the received buffer. - * @param[out] remote_locator Locator describing the remote restination we received a packet from. - */ - bool Receive(UDPChannelResource* p_channel_resource, octet* receive_buffer, - uint32_t receive_buffer_capacity, uint32_t& receive_buffer_size, Locator_t& remote_locator); - - //! Release the listening socket for the specified port. - bool ReleaseInputChannel(const Locator_t& locator, const asio::ip::address& interface_address); - /** * Converts a given remote locator (that is, a locator referring to a remote * destination) to the main local locator whose channel can write to that @@ -117,6 +102,8 @@ class UDPTransportInterface : public TransportInterface protected: + friend class UDPChannelResource; + // For UDPv6, the notion of channel corresponds to a port + direction tuple. asio::io_service io_service_; std::vector currentInterfaces; @@ -162,14 +149,6 @@ class UDPTransportInterface : public TransportInterface virtual eProsimaUDPSocket OpenAndBindInputSocket(const std::string& sIp, uint16_t port, bool is_multicast) = 0; eProsimaUDPSocket OpenAndBindUnicastOutputSocket(const asio::ip::udp::endpoint& endpoint, uint16_t& port); - /** - * Function to be called from a new thread, which takes cares of performing a blocking receive - * operation on the ReceiveResource - * @param p_channel_resource - Associated ChannelResource - * @param input_locator - Locator that triggered the creation of the resource - */ - void perform_listen_operation(UDPChannelResource* p_channel_resource, Locator_t input_locator); - virtual void set_receive_buffer_size(uint32_t size) = 0; virtual void set_send_buffer_size(uint32_t size) = 0; virtual void SetSocketOutboundInterface(eProsimaUDPSocket&, const std::string&) = 0; diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index 8249018d387..a4b4ba6c4dd 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -33,6 +33,7 @@ set(${PROJECT_NAME}_source_files rtps/resources/AsyncWriterThread.cpp rtps/resources/AsyncInterestTree.cpp rtps/timedevent/TimedCallback.cpp + rtps/writer/LivelinessManager.cpp rtps/writer/RTPSWriter.cpp rtps/writer/StatefulWriter.cpp rtps/writer/ReaderProxy.cpp @@ -46,7 +47,6 @@ set(${PROJECT_NAME}_source_files rtps/history/WriterHistory.cpp rtps/history/ReaderHistory.cpp rtps/reader/timedevent/HeartbeatResponseDelay.cpp - rtps/reader/timedevent/WriterProxyLiveliness.cpp rtps/reader/timedevent/InitialAckNack.cpp rtps/reader/WriterProxy.cpp rtps/reader/StatefulReader.cpp diff --git a/src/cpp/participant/Participant.cpp b/src/cpp/participant/Participant.cpp index 7b7257e2db5..5519b1418db 100644 --- a/src/cpp/participant/Participant.cpp +++ b/src/cpp/participant/Participant.cpp @@ -70,3 +70,8 @@ bool Participant::get_remote_reader_info( { return mp_impl->get_remote_reader_info(readerGuid, returnedInfo); } + +void Participant::assert_liveliness() +{ + mp_impl->assert_liveliness(); +} diff --git a/src/cpp/participant/ParticipantImpl.cpp b/src/cpp/participant/ParticipantImpl.cpp index 1437e5d2b39..84989db3dae 100644 --- a/src/cpp/participant/ParticipantImpl.cpp +++ b/src/cpp/participant/ParticipantImpl.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include @@ -189,6 +190,8 @@ Publisher* ParticipantImpl::createPublisher( watt.endpoint.setUserDefinedID((uint8_t)att.getUserDefinedID()); } watt.times = att.times; + watt.liveliness_kind = att.qos.m_liveliness.kind; + watt.liveliness_lease_duration = att.qos.m_liveliness.lease_duration; watt.matched_readers_allocation = att.matched_subscriber_allocation; // TODO(Ricardo) Remove in future @@ -308,6 +311,8 @@ Subscriber* ParticipantImpl::createSubscriber( if(att.getUserDefinedID()>0) ratt.endpoint.setUserDefinedID((uint8_t)att.getUserDefinedID()); ratt.times = att.times; + ratt.liveliness_kind_ = att.qos.m_liveliness.kind; + ratt.liveliness_lease_duration = att.qos.m_liveliness.lease_duration; // TODO(Ricardo) Remove in future // Insert topic_name and partitions @@ -512,3 +517,15 @@ ResourceEvent& ParticipantImpl::get_resource_event() const { return mp_rtpsParticipant->get_resource_event(); } + +void ParticipantImpl::assert_liveliness() +{ + if (mp_rtpsParticipant->wlp() != nullptr) + { + mp_rtpsParticipant->wlp()->assert_liveliness_manual_by_participant(); + } + else + { + logError(PARTICIPANT, "Invalid WLP, cannot assert liveliness of participant"); + } +} diff --git a/src/cpp/participant/ParticipantImpl.h b/src/cpp/participant/ParticipantImpl.h index db0768ab04e..9af95198e8a 100644 --- a/src/cpp/participant/ParticipantImpl.h +++ b/src/cpp/participant/ParticipantImpl.h @@ -160,6 +160,11 @@ class ParticipantImpl rtps::ResourceEvent& get_resource_event() const; + /** + * @brief Asserts liveliness of manual by participant readers + */ + void assert_liveliness(); + private: //!Participant Attributes ParticipantAttributes m_att; diff --git a/src/cpp/publisher/Publisher.cpp b/src/cpp/publisher/Publisher.cpp index a8972e1407c..8a5127db675 100644 --- a/src/cpp/publisher/Publisher.cpp +++ b/src/cpp/publisher/Publisher.cpp @@ -97,11 +97,10 @@ void Publisher::get_offered_deadline_missed_status(OfferedDeadlineMissedStatus & void Publisher::get_liveliness_lost_status(LivelinessLostStatus &status) { - (void)status; - logWarning(PUBLISHER, "get_liveliness_lost_status() is not implemented yet"); + mp_impl->get_liveliness_lost_status(status); } void Publisher::assert_liveliness() { - logWarning(PUBLISHER, "assert_liveliness() is not implemented yet"); + mp_impl->assert_liveliness(); } diff --git a/src/cpp/publisher/PublisherImpl.cpp b/src/cpp/publisher/PublisherImpl.cpp index d6fcc364ee5..1ece7ba4f98 100644 --- a/src/cpp/publisher/PublisherImpl.cpp +++ b/src/cpp/publisher/PublisherImpl.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -33,6 +34,8 @@ #include #include #include +#include +#include #include @@ -386,6 +389,20 @@ void PublisherImpl::PublisherWriterListener::onWriterChangeReceivedByAll( } } +void PublisherImpl::PublisherWriterListener::on_liveliness_lost( + RTPSWriter *writer, + const LivelinessLostStatus &status) +{ + (void)writer; + + if (mp_publisherImpl->mp_listener != nullptr) + { + mp_publisherImpl->mp_listener->on_liveliness_lost( + mp_publisherImpl->mp_userPublisher, + status); + } +} + bool PublisherImpl::wait_for_all_acked(const eprosima::fastrtps::Time_t& max_wait) { return mp_writer->wait_for_all_acked(max_wait); @@ -481,3 +498,36 @@ void PublisherImpl::lifespan_expired() lifespan_timer_.update_interval_millisec((double)duration_cast(interval).count()); lifespan_timer_.restart_timer(); } + +void PublisherImpl::get_liveliness_lost_status(LivelinessLostStatus &status) +{ + std::unique_lock lock(mp_writer->getMutex()); + + status = mp_writer->liveliness_lost_status_; + + mp_writer->liveliness_lost_status_.total_count_change = 0u; +} + +void PublisherImpl::assert_liveliness() +{ + if (!mp_rtpsParticipant->wlp()->assert_liveliness( + mp_writer->getGuid(), + mp_writer->get_liveliness_kind(), + mp_writer->get_liveliness_lease_duration())) + { + logError(PUBLISHER, "Could not assert liveliness of writer " << mp_writer->getGuid()); + } + + if (m_att.qos.m_liveliness.kind == MANUAL_BY_TOPIC_LIVELINESS_QOS) + { + // As described in the RTPS specification, if liveliness kind is manual a heartbeat must be sent + // This only applies to stateful writers, as stateless writers do not send heartbeats + + StatefulWriter* stateful_writer = dynamic_cast(mp_writer); + + if (stateful_writer != nullptr) + { + stateful_writer->send_periodic_heartbeat(true, true); + } + } +} diff --git a/src/cpp/publisher/PublisherImpl.h b/src/cpp/publisher/PublisherImpl.h index f4ac2e8ee99..619c1422396 100644 --- a/src/cpp/publisher/PublisherImpl.h +++ b/src/cpp/publisher/PublisherImpl.h @@ -135,6 +135,17 @@ class PublisherImpl */ void get_offered_deadline_missed_status(OfferedDeadlineMissedStatus& status); + /** + * @brief Returns the liveliness lost status + * @param status Liveliness lost status + */ + void get_liveliness_lost_status(LivelinessLostStatus& status); + + /** + * @brief Asserts liveliness + */ + void assert_liveliness(); + private: ParticipantImpl* mp_participant; //! Pointer to the associated Data Writer. @@ -153,8 +164,16 @@ class PublisherImpl public: PublisherWriterListener(PublisherImpl* p):mp_publisherImpl(p){}; virtual ~PublisherWriterListener(){}; - void onWriterMatched(rtps::RTPSWriter* writer, rtps::MatchingInfo& info); - void onWriterChangeReceivedByAll(rtps::RTPSWriter* writer, rtps::CacheChange_t* change); + void onWriterMatched( + rtps::RTPSWriter* writer, + rtps::MatchingInfo& info) override; + void onWriterChangeReceivedByAll( + rtps::RTPSWriter* writer, + rtps::CacheChange_t* change) override; + void on_liveliness_lost( + rtps::RTPSWriter* writer, + const LivelinessLostStatus& status) override; + PublisherImpl* mp_publisherImpl; }m_writerListener; diff --git a/src/cpp/qos/ReaderQos.cpp b/src/cpp/qos/ReaderQos.cpp index 80d2cb0bc8e..48eac03ca97 100644 --- a/src/cpp/qos/ReaderQos.cpp +++ b/src/cpp/qos/ReaderQos.cpp @@ -157,6 +157,12 @@ bool ReaderQos::canQosBeUpdated(const ReaderQos& qos) const logWarning(RTPS_QOS_CHECK,"Liveliness Kind cannot be changed after the creation of a subscriber."); } + if (m_liveliness.lease_duration != qos.m_liveliness.lease_duration) + { + updatable = false; + logWarning(RTPS_QOS_CHECK,"Liveliness lease duration cannot be changed after the creation of a subscriber."); + } + if(m_reliability.kind != qos.m_reliability.kind) { updatable = false; diff --git a/src/cpp/qos/WriterQos.cpp b/src/cpp/qos/WriterQos.cpp index d12ab7ab227..4bf89d7cbe7 100644 --- a/src/cpp/qos/WriterQos.cpp +++ b/src/cpp/qos/WriterQos.cpp @@ -182,6 +182,12 @@ bool WriterQos::canQosBeUpdated(const WriterQos& qos) const logWarning(RTPS_QOS_CHECK,"Liveliness Kind cannot be changed after the creation of a subscriber."); } + if (m_liveliness.lease_duration != qos.m_liveliness.lease_duration) + { + updatable = false; + logWarning(RTPS_QOS_CHECK,"Liveliness lease duration cannot be changed after the creation of a subscriber."); + } + if(m_reliability.kind != qos.m_reliability.kind) { updatable = false; diff --git a/src/cpp/rtps/builtin/BuiltinProtocols.cpp b/src/cpp/rtps/builtin/BuiltinProtocols.cpp index 63c4355fb93..9a073acd804 100644 --- a/src/cpp/rtps/builtin/BuiltinProtocols.cpp +++ b/src/cpp/rtps/builtin/BuiltinProtocols.cpp @@ -113,7 +113,7 @@ bool BuiltinProtocols::addLocalWriter(RTPSWriter* w, const fastrtps::TopicAttrib } if(mp_WLP !=nullptr) { - ok|= mp_WLP->addLocalWriter(w,wqos); + ok|= mp_WLP->add_local_writer(w,wqos); } else { @@ -133,6 +133,10 @@ bool BuiltinProtocols::addLocalReader(RTPSReader* R, const fastrtps::TopicAttrib { logWarning(RTPS_EDP, "EDP is not used in this Participant, register a Reader is impossible"); } + if (mp_WLP != nullptr) + { + ok|= mp_WLP->add_local_reader(R, rqos); + } return ok; } @@ -143,10 +147,6 @@ bool BuiltinProtocols::updateLocalWriter(RTPSWriter* W, const TopicAttributes& t { ok |= mp_PDP->getEDP()->updatedLocalWriter(W, topicAtt, wqos); } - if(mp_WLP!=nullptr) - { - ok |= mp_WLP->updateLocalWriter(W, wqos); - } return ok; } @@ -165,11 +165,11 @@ bool BuiltinProtocols::removeLocalWriter(RTPSWriter* W) bool ok = false; if(mp_WLP !=nullptr) { - ok|= mp_WLP->removeLocalWriter(W); + ok |= mp_WLP->remove_local_writer(W); } if(mp_PDP!=nullptr && mp_PDP->getEDP() != nullptr) { - ok|= mp_PDP->getEDP()->removeLocalWriter(W); + ok |= mp_PDP->getEDP()->removeLocalWriter(W); } return ok; } @@ -177,9 +177,13 @@ bool BuiltinProtocols::removeLocalWriter(RTPSWriter* W) bool BuiltinProtocols::removeLocalReader(RTPSReader* R) { bool ok = false; + if (mp_WLP != nullptr) + { + ok |= mp_WLP->remove_local_reader(R); + } if(mp_PDP!=nullptr && mp_PDP->getEDP() != nullptr) { - ok|= mp_PDP->getEDP()->removeLocalReader(R); + ok |= mp_PDP->getEDP()->removeLocalReader(R); } return ok; } diff --git a/src/cpp/rtps/builtin/data/WriterProxyData.cpp b/src/cpp/rtps/builtin/data/WriterProxyData.cpp index 0296d37ea6f..9398ad8ac6e 100644 --- a/src/cpp/rtps/builtin/data/WriterProxyData.cpp +++ b/src/cpp/rtps/builtin/data/WriterProxyData.cpp @@ -37,7 +37,6 @@ WriterProxyData::WriterProxyData() : m_userDefinedId(0) #endif , m_typeMaxSerialized(0) - , m_isAlive(true) , m_topicKind(NO_KEY) , m_topicDiscoveryKind(NO_CHECK) { @@ -60,7 +59,6 @@ WriterProxyData::WriterProxyData(const WriterProxyData& writerInfo) , m_topicName(writerInfo.m_topicName) , m_userDefinedId(writerInfo.m_userDefinedId) , m_typeMaxSerialized(writerInfo.m_typeMaxSerialized) - , m_isAlive(writerInfo.m_isAlive) , m_topicKind(writerInfo.m_topicKind) , persistence_guid_(writerInfo.persistence_guid_) , m_topicDiscoveryKind(writerInfo.m_topicDiscoveryKind) @@ -90,7 +88,6 @@ WriterProxyData& WriterProxyData::operator=(const WriterProxyData& writerInfo) m_topicName = writerInfo.m_topicName; m_userDefinedId = writerInfo.m_userDefinedId; m_typeMaxSerialized = writerInfo.m_typeMaxSerialized; - m_isAlive = writerInfo.m_isAlive; m_topicKind = writerInfo.m_topicKind; persistence_guid_ = writerInfo.persistence_guid_; m_qos.setQos(writerInfo.m_qos, true); @@ -521,7 +518,6 @@ void WriterProxyData::clear() m_userDefinedId = 0; m_qos = WriterQos(); m_typeMaxSerialized = 0; - m_isAlive = true; m_topicKind = NO_KEY; persistence_guid_ = c_Guid_Unknown; } @@ -538,7 +534,6 @@ void WriterProxyData::copy(WriterProxyData* wdata) m_userDefinedId = wdata->m_userDefinedId; m_qos = wdata->m_qos; m_typeMaxSerialized = wdata->m_typeMaxSerialized; - m_isAlive = wdata->m_isAlive; m_topicKind = wdata->m_topicKind; persistence_guid_ = wdata->persistence_guid_; m_topicDiscoveryKind = wdata->m_topicDiscoveryKind; @@ -555,8 +550,6 @@ void WriterProxyData::update(WriterProxyData* wdata) m_unicastLocatorList = wdata->m_unicastLocatorList; m_multicastLocatorList = wdata->m_multicastLocatorList; m_qos.setQos(wdata->m_qos,false); - m_isAlive = wdata->m_isAlive; - } RemoteWriterAttributes WriterProxyData::toRemoteWriterAttributes() const @@ -564,7 +557,8 @@ RemoteWriterAttributes WriterProxyData::toRemoteWriterAttributes() const RemoteWriterAttributes remoteAtt; remoteAtt.guid = m_guid; - remoteAtt.livelinessLeaseDuration = m_qos.m_liveliness.lease_duration; + remoteAtt.liveliness_kind = m_qos.m_liveliness.kind; + remoteAtt.liveliness_lease_duration = m_qos.m_liveliness.lease_duration; remoteAtt.ownershipStrength = (uint16_t)m_qos.m_ownershipStrength.value; remoteAtt.endpoint.durabilityKind = m_qos.m_durability.durabilityKind(); remoteAtt.endpoint.endpointKind = WRITER; diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp b/src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp index e50fd0ef520..cf6d8cfb74c 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp @@ -153,7 +153,6 @@ bool EDP::newLocalWriterProxyData(RTPSWriter* writer, const TopicAttributes& att { logInfo(RTPS_EDP,"Adding " << writer->getGuid().entityId << " in topic "<getGuid()); wpd.key() = wpd.guid(); wpd.multicastLocatorList(writer->getAttributes().multicastLocatorList); @@ -283,7 +282,6 @@ bool EDP::updatedLocalWriter(RTPSWriter* writer, const TopicAttributes& att, con { ParticipantProxyData pdata; WriterProxyData wdata; - wdata.isAlive(true); wdata.guid(writer->getGuid()); wdata.key() = wdata.guid(); wdata.multicastLocatorList(writer->getAttributes().multicastLocatorList); @@ -441,6 +439,18 @@ bool EDP::validMatching(const WriterProxyData* wdata, const ReaderProxyData* rda logWarning(RTPS_EDP, "Incompatible Disable Positive Acks QoS: writer is enabled but reader is not"); return false; } + if (wdata->m_qos.m_liveliness.lease_duration > rdata->m_qos.m_liveliness.lease_duration) + { + logWarning(RTPS_EDP, "Incompatible liveliness lease durations: offered lease duration " + << wdata->m_qos.m_liveliness.lease_duration << " must be <= requested lease duration " + << rdata->m_qos.m_liveliness.lease_duration); + return false; + } + if (wdata->m_qos.m_liveliness.kind < rdata->m_qos.m_liveliness.kind) + { + logWarning(RTPS_EDP, "Incompatible liveliness kinds: offered kind is < requested kind"); + return false; + } #if HAVE_SECURITY // TODO: Check EndpointSecurityInfo @@ -520,11 +530,6 @@ bool EDP::validMatching(const ReaderProxyData* rdata, const WriterProxyData* wda logInfo(RTPS_EDP, "Matching failed on checkTypeIdentifier."); return false; } - if(!wdata->isAlive()) //Matching - { - logWarning(RTPS_EDP, "WriterProxyData " << wdata->guid() << " is NOT alive"); - return false; - } if(rdata->m_qos.m_reliability.kind == RELIABLE_RELIABILITY_QOS && wdata->m_qos.m_reliability.kind == BEST_EFFORT_RELIABILITY_QOS) //Means our reader is reliable but hte writer is not { @@ -554,7 +559,18 @@ bool EDP::validMatching(const ReaderProxyData* rdata, const WriterProxyData* wda logWarning(RTPS_EDP, "Incompatible Disable Positive Acks QoS: writer is enabled but reader is not"); return false; } - + if (wdata->m_qos.m_liveliness.lease_duration > rdata->m_qos.m_liveliness.lease_duration) + { + logWarning(RTPS_EDP, "Incompatible liveliness lease durations: offered lease duration " + << wdata->m_qos.m_liveliness.lease_duration << " must be <= requested lease duration " + << rdata->m_qos.m_liveliness.lease_duration); + return false; + } + if (wdata->m_qos.m_liveliness.kind < rdata->m_qos.m_liveliness.kind) + { + logWarning(RTPS_EDP, "Incompatible liveliness kinds: offered kind is < than requested kind"); + return false; + } #if HAVE_SECURITY // TODO: Check EndpointSecurityInfo #endif diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp index 0c80b9e9bb9..8e0abcce3d7 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp @@ -664,8 +664,6 @@ bool PDPSimple::addWriterProxyData(WriterProxyData* wdata, ParticipantProxyData& wdata->unicastLocatorList((*pit)->m_defaultUnicastLocatorList); wdata->multicastLocatorList((*pit)->m_defaultMulticastLocatorList); } - // Set as alive. - wdata->isAlive(true); // Copy participant data to be used outside. pdata.copy(**pit); @@ -897,61 +895,6 @@ void PDPSimple::assertRemoteParticipantLiveliness(const GuidPrefix_t& guidP) } } -void PDPSimple::assertLocalWritersLiveliness(LivelinessQosPolicyKind kind) -{ - logInfo(RTPS_LIVELINESS,"of type " << (kind==AUTOMATIC_LIVELINESS_QOS?"AUTOMATIC":"") - <<(kind==MANUAL_BY_PARTICIPANT_LIVELINESS_QOS?"MANUAL_BY_PARTICIPANT":"")); - std::lock_guard guard(*this->mp_mutex); - for(std::vector::iterator wit = this->m_participantProxies.front()->m_writers.begin(); - wit!=this->m_participantProxies.front()->m_writers.end();++wit) - { - if((*wit)->m_qos.m_liveliness.kind == kind) - { - logInfo(RTPS_LIVELINESS,"Local Writer "<< (*wit)->guid().entityId << " marked as ALIVE"); - (*wit)->isAlive(true); - } - } -} - -void PDPSimple::assertRemoteWritersLiveliness(GuidPrefix_t& guidP,LivelinessQosPolicyKind kind) -{ - std::lock_guard guardP(*mp_RTPSParticipant->getParticipantMutex()); - std::lock_guard pguard(*this->mp_mutex); - logInfo(RTPS_LIVELINESS,"of type " << (kind==AUTOMATIC_LIVELINESS_QOS?"AUTOMATIC":"") - <<(kind==MANUAL_BY_PARTICIPANT_LIVELINESS_QOS?"MANUAL_BY_PARTICIPANT":"")); - - for(std::vector::iterator pit=this->m_participantProxies.begin(); - pit!=this->m_participantProxies.end();++pit) - { - if((*pit)->m_guid.guidPrefix == guidP) - { - for(std::vector::iterator wit = (*pit)->m_writers.begin(); - wit != (*pit)->m_writers.end();++wit) - { - if((*wit)->m_qos.m_liveliness.kind == kind) - { - (*wit)->isAlive(true); - for(std::vector::iterator rit = mp_RTPSParticipant->userReadersListBegin(); - rit!=mp_RTPSParticipant->userReadersListEnd();++rit) - { - if((*rit)->getAttributes().reliabilityKind == RELIABLE) - { - StatefulReader* sfr = (StatefulReader*)(*rit); - WriterProxy* WP; - if(sfr->matched_writer_lookup((*wit)->guid(), &WP)) - { - WP->assertLiveliness(); - continue; - } - } - } - } - } - break; - } - } -} - bool PDPSimple::newRemoteEndpointStaticallyDiscovered(const GUID_t& pguid, int16_t userDefinedId,EndpointKind_t kind) { ParticipantProxyData pdata; diff --git a/src/cpp/rtps/builtin/liveliness/WLP.cpp b/src/cpp/rtps/builtin/liveliness/WLP.cpp index dbbaecc5c3c..d6b20466524 100644 --- a/src/cpp/rtps/builtin/liveliness/WLP.cpp +++ b/src/cpp/rtps/builtin/liveliness/WLP.cpp @@ -23,9 +23,12 @@ #include #include "../../participant/RTPSParticipantImpl.h" #include +#include +#include #include #include #include +#include #include #include @@ -44,79 +47,142 @@ namespace fastrtps{ namespace rtps { -WLP::WLP(BuiltinProtocols* p): m_minAutomatic_MilliSec(std::numeric_limits::max()), - m_minManRTPSParticipant_MilliSec(std::numeric_limits::max()), - mp_participant(nullptr), - mp_builtinProtocols(p), - mp_builtinWriter(nullptr), - mp_builtinReader(nullptr), - mp_builtinWriterHistory(nullptr), - mp_builtinReaderHistory(nullptr), - mp_listener(nullptr), - mp_livelinessAutomatic(nullptr), - mp_livelinessManRTPSParticipant(nullptr) +WLP::WLP(BuiltinProtocols* p) + : min_automatic_ms_(std::numeric_limits::max()) + , min_manual_by_participant_ms_(std::numeric_limits::max()) + , mp_participant(nullptr) + , mp_builtinProtocols(p) + , mp_builtinWriter(nullptr) + , mp_builtinReader(nullptr) + , mp_builtinWriterHistory(nullptr) + , mp_builtinReaderHistory(nullptr) + , automatic_liveliness_assertion_(nullptr) + , manual_liveliness_assertion_(nullptr) + , automatic_writers_() + , manual_by_participant_writers_() + , manual_by_topic_writers_() + , readers_() + , automatic_readers_(false) + , pub_liveliness_manager_(nullptr) + , sub_liveliness_manager_(nullptr) #if HAVE_SECURITY - ,mp_builtinWriterSecure(nullptr) - ,mp_builtinReaderSecure(nullptr) - ,mp_builtinWriterSecureHistory(nullptr) - ,mp_builtinReaderSecureHistory(nullptr) + , mp_builtinWriterSecure(nullptr) + , mp_builtinReaderSecure(nullptr) + , mp_builtinWriterSecureHistory(nullptr) + , mp_builtinReaderSecureHistory(nullptr) #endif { } WLP::~WLP() { + if (automatic_liveliness_assertion_ != nullptr) + { + delete automatic_liveliness_assertion_; + automatic_liveliness_assertion_ = nullptr; + } + if (manual_liveliness_assertion_ != nullptr) + { + delete this->manual_liveliness_assertion_; + manual_liveliness_assertion_ = nullptr; + } + #if HAVE_SECURITY mp_participant->deleteUserEndpoint(mp_builtinReaderSecure); mp_participant->deleteUserEndpoint(mp_builtinWriterSecure); - delete(this->mp_builtinReaderSecureHistory); - delete(this->mp_builtinWriterSecureHistory); + delete this->mp_builtinReaderSecureHistory; + delete this->mp_builtinWriterSecureHistory; #endif mp_participant->deleteUserEndpoint(mp_builtinReader); mp_participant->deleteUserEndpoint(mp_builtinWriter); - delete(this->mp_builtinReaderHistory); - delete(this->mp_builtinWriterHistory); - delete(this->mp_listener); - if(this->mp_livelinessAutomatic!=nullptr) - delete(mp_livelinessAutomatic); - if(this->mp_livelinessManRTPSParticipant!=nullptr) - delete(this->mp_livelinessManRTPSParticipant); + delete this->mp_builtinReaderHistory; + delete this->mp_builtinWriterHistory; + delete this->mp_listener; + + delete pub_liveliness_manager_; + delete sub_liveliness_manager_; } bool WLP::initWL(RTPSParticipantImpl* p) { - logInfo(RTPS_LIVELINESS,"Beginning Liveliness Protocol"); + logInfo(RTPS_LIVELINESS,"Initializing Liveliness Protocol"); + mp_participant = p; + pub_liveliness_manager_ = new LivelinessManager( + [&](const GUID_t& guid, + const LivelinessQosPolicyKind& kind, + const Duration_t& lease_duration, + int alive_count, + int not_alive_count) -> void + { + pub_liveliness_changed( + guid, + kind, + lease_duration, + alive_count, + not_alive_count); + }, + mp_participant->getEventResource().getIOService(), + mp_participant->getEventResource().getThread(), + false); + + sub_liveliness_manager_ = new LivelinessManager( + [&](const GUID_t& guid, + const LivelinessQosPolicyKind& kind, + const Duration_t& lease_duration, + int alive_count, + int not_alive_count) -> void + { + sub_liveliness_changed( + guid, + kind, + lease_duration, + alive_count, + not_alive_count); + }, + mp_participant->getEventResource().getIOService(), + mp_participant->getEventResource().getThread()); + bool retVal = createEndpoints(); #if HAVE_SECURITY - if(retVal) createSecureEndpoints(); + if (retVal) createSecureEndpoints(); #endif return retVal; } bool WLP::createEndpoints() { - //CREATE WRITER + // Built-in writer history + HistoryAttributes hatt; hatt.initialReservedCaches = 20; hatt.maximumReservedCaches = 1000; hatt.payloadMaxSize = BUILTIN_PARTICIPANT_DATA_MAX_SIZE; mp_builtinWriterHistory = new WriterHistory(hatt); + + // Built-in writer + WriterAttributes watt; watt.endpoint.unicastLocatorList = mp_builtinProtocols->m_metatrafficUnicastLocatorList; watt.endpoint.multicastLocatorList = mp_builtinProtocols->m_metatrafficMulticastLocatorList; watt.endpoint.remoteLocatorList = mp_builtinProtocols->m_initialPeersList; - // Wparam.topic.topicName = "DCPSRTPSParticipantMessage"; - // Wparam.topic.topicDataType = "RTPSParticipantMessageData"; watt.endpoint.topicKind = WITH_KEY; watt.endpoint.durabilityKind = TRANSIENT_LOCAL; watt.endpoint.reliabilityKind = RELIABLE; - if(mp_participant->getRTPSParticipantAttributes().throughputController.bytesPerPeriod != UINT32_MAX && + if (mp_participant->getRTPSParticipantAttributes().throughputController.bytesPerPeriod != UINT32_MAX && mp_participant->getRTPSParticipantAttributes().throughputController.periodMillisecs != 0) + { watt.mode = ASYNCHRONOUS_WRITER; + } RTPSWriter* wout; - if(mp_participant->createWriter(&wout,watt,mp_builtinWriterHistory,nullptr,c_EntityId_WriterLiveliness,true)) + if (mp_participant->createWriter( + &wout, + watt, + mp_builtinWriterHistory, + nullptr, + c_EntityId_WriterLiveliness, + true)) { mp_builtinWriter = dynamic_cast(wout); logInfo(RTPS_LIVELINESS,"Builtin Liveliness Writer created"); @@ -128,10 +194,20 @@ bool WLP::createEndpoints() mp_builtinWriterHistory = nullptr; return false; } + + // Built-in reader history + hatt.initialReservedCaches = 100; hatt.maximumReservedCaches = 2000; hatt.payloadMaxSize = BUILTIN_PARTICIPANT_DATA_MAX_SIZE; mp_builtinReaderHistory = new ReaderHistory(hatt); + + // WLP listener + + mp_listener = new WLPListener(this); + + // Built-in reader + ReaderAttributes ratt; ratt.endpoint.topicKind = WITH_KEY; ratt.endpoint.durabilityKind = TRANSIENT_LOCAL; @@ -140,13 +216,15 @@ bool WLP::createEndpoints() ratt.endpoint.unicastLocatorList = mp_builtinProtocols->m_metatrafficUnicastLocatorList; ratt.endpoint.multicastLocatorList = mp_builtinProtocols->m_metatrafficMulticastLocatorList; ratt.endpoint.remoteLocatorList = mp_builtinProtocols->m_initialPeersList; - //Rparam.topic.topicName = "DCPSRTPSParticipantMessage"; - //Rparam.topic.topicDataType = "RTPSParticipantMessageData"; ratt.endpoint.topicKind = WITH_KEY; - //LISTENER CREATION - mp_listener = new WLPListener(this); RTPSReader* rout; - if(mp_participant->createReader(&rout,ratt,mp_builtinReaderHistory,(ReaderListener*)mp_listener,c_EntityId_ReaderLiveliness,true)) + if (mp_participant->createReader( + &rout, + ratt, + mp_builtinReaderHistory, + (ReaderListener*)mp_listener, + c_EntityId_ReaderLiveliness, + true)) { mp_builtinReader = dynamic_cast(rout); logInfo(RTPS_LIVELINESS,"Builtin Liveliness Reader created"); @@ -237,7 +315,13 @@ bool WLP::createSecureEndpoints() sec_attrs->plugin_endpoint_attributes |= PLUGIN_ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_SUBMESSAGE_ORIGIN_AUTHENTICATED; } RTPSReader* rout; - if (mp_participant->createReader(&rout, ratt, mp_builtinReaderSecureHistory, (ReaderListener*)mp_listener, c_EntityId_ReaderLivelinessSecure, true)) + if (mp_participant->createReader( + &rout, + ratt, + mp_builtinReaderSecureHistory, + (ReaderListener*)mp_listener, + c_EntityId_ReaderLivelinessSecure, + true)) { mp_builtinReaderSecure = dynamic_cast(rout); logInfo(RTPS_LIVELINESS, "Builtin Liveliness Reader created"); @@ -289,7 +373,7 @@ bool WLP::assignRemoteEndpoints(const ParticipantProxyData& pdata) partdet &= DISC_BUILTIN_ENDPOINT_PARTICIPANT_DETECTOR; //Habria que quitar esta linea que comprueba si tiene PDP. auxendp &= BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_WRITER; - if((auxendp!=0 || partdet!=0) && this->mp_builtinReader!=nullptr) + if ((auxendp!=0 || partdet!=0) && this->mp_builtinReader!=nullptr) { logInfo(RTPS_LIVELINESS,"Adding remote writer to my local Builtin Reader"); RemoteWriterAttributes watt(pdata.m_VendorId); @@ -305,7 +389,7 @@ bool WLP::assignRemoteEndpoints(const ParticipantProxyData& pdata) } auxendp = endp; auxendp &=BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_READER; - if((auxendp!=0 || partdet!=0) && this->mp_builtinWriter!=nullptr) + if ((auxendp!=0 || partdet!=0) && this->mp_builtinWriter!=nullptr) { logInfo(RTPS_LIVELINESS,"Adding remote reader to my local Builtin Writer"); RemoteReaderAttributes ratt(pdata.m_VendorId); @@ -335,7 +419,7 @@ bool WLP::assignRemoteEndpoints(const ParticipantProxyData& pdata) watt.topicKind(WITH_KEY); watt.m_qos.m_durability.kind = TRANSIENT_LOCAL_DURABILITY_QOS; watt.m_qos.m_reliability.kind = RELIABLE_RELIABILITY_QOS; - if(!mp_participant->security_manager().discovered_builtin_writer( + if (!mp_participant->security_manager().discovered_builtin_writer( mp_builtinReaderSecure->getGuid(), pdata.m_guid, watt, mp_builtinReaderSecure->getAttributes().security_attributes())) { @@ -379,7 +463,7 @@ void WLP::removeRemoteEndpoints(ParticipantProxyData* pdata) partdet &= DISC_BUILTIN_ENDPOINT_PARTICIPANT_DETECTOR; //Habria que quitar esta linea que comprueba si tiene PDP. auxendp &= BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_WRITER; - if((auxendp!=0 || partdet!=0) && this->mp_builtinReader!=nullptr) + if ((auxendp!=0 || partdet!=0) && this->mp_builtinReader!=nullptr) { logInfo(RTPS_LIVELINESS,"Removing remote writer from my local Builtin Reader"); RemoteWriterAttributes watt; @@ -395,7 +479,7 @@ void WLP::removeRemoteEndpoints(ParticipantProxyData* pdata) } auxendp = endp; auxendp &=BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_READER; - if((auxendp!=0 || partdet!=0) && this->mp_builtinWriter!=nullptr) + if ((auxendp!=0 || partdet!=0) && this->mp_builtinWriter!=nullptr) { logInfo(RTPS_LIVELINESS,"Removing remote reader from my local Builtin Writer"); RemoteReaderAttributes ratt; @@ -456,216 +540,247 @@ void WLP::removeRemoteEndpoints(ParticipantProxyData* pdata) #endif } - - -bool WLP::addLocalWriter(RTPSWriter* W, const WriterQos& wqos) +bool WLP::add_local_writer(RTPSWriter* W, const WriterQos& wqos) { std::lock_guard guard(*mp_builtinProtocols->mp_PDP->getMutex()); logInfo(RTPS_LIVELINESS, W->getGuid().entityId << " to Liveliness Protocol"); double wAnnouncementPeriodMilliSec(TimeConv::Duration_t2MilliSecondsDouble(wqos.m_liveliness.announcement_period)); - if(wqos.m_liveliness.kind == AUTOMATIC_LIVELINESS_QOS ) + if (wqos.m_liveliness.kind == AUTOMATIC_LIVELINESS_QOS ) { - if(mp_livelinessAutomatic == nullptr) + if (automatic_liveliness_assertion_ == nullptr) { - mp_livelinessAutomatic = new WLivelinessPeriodicAssertion(this,AUTOMATIC_LIVELINESS_QOS); - mp_livelinessAutomatic->update_interval_millisec(wAnnouncementPeriodMilliSec); - mp_livelinessAutomatic->restart_timer(); - m_minAutomatic_MilliSec = wAnnouncementPeriodMilliSec; + automatic_liveliness_assertion_ = new WLivelinessPeriodicAssertion(this,AUTOMATIC_LIVELINESS_QOS); + automatic_liveliness_assertion_->update_interval_millisec(wAnnouncementPeriodMilliSec); + automatic_liveliness_assertion_->restart_timer(); + min_automatic_ms_ = wAnnouncementPeriodMilliSec; } - else if(m_minAutomatic_MilliSec > wAnnouncementPeriodMilliSec) + else if (min_automatic_ms_ > wAnnouncementPeriodMilliSec) { - m_minAutomatic_MilliSec = wAnnouncementPeriodMilliSec; - mp_livelinessAutomatic->update_interval_millisec(wAnnouncementPeriodMilliSec); + min_automatic_ms_ = wAnnouncementPeriodMilliSec; + automatic_liveliness_assertion_->update_interval_millisec(wAnnouncementPeriodMilliSec); //CHECK IF THE TIMER IS GOING TO BE CALLED AFTER THIS NEW SET LEASE DURATION - if(mp_livelinessAutomatic->getRemainingTimeMilliSec() > m_minAutomatic_MilliSec) + if (automatic_liveliness_assertion_->getRemainingTimeMilliSec() > min_automatic_ms_) { - mp_livelinessAutomatic->cancel_timer(); + automatic_liveliness_assertion_->cancel_timer(); } - mp_livelinessAutomatic->restart_timer(); + automatic_liveliness_assertion_->restart_timer(); } - m_livAutomaticWriters.push_back(W); + automatic_writers_.push_back(W); } - else if(wqos.m_liveliness.kind == MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) + else if (wqos.m_liveliness.kind == MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) { - if(mp_livelinessManRTPSParticipant == nullptr) + if (manual_liveliness_assertion_ == nullptr) { - mp_livelinessManRTPSParticipant = new WLivelinessPeriodicAssertion(this,MANUAL_BY_PARTICIPANT_LIVELINESS_QOS); - mp_livelinessManRTPSParticipant->update_interval_millisec(wAnnouncementPeriodMilliSec); - mp_livelinessManRTPSParticipant->restart_timer(); - m_minManRTPSParticipant_MilliSec = wAnnouncementPeriodMilliSec; + manual_liveliness_assertion_ = new WLivelinessPeriodicAssertion(this,MANUAL_BY_PARTICIPANT_LIVELINESS_QOS); + manual_liveliness_assertion_->update_interval_millisec(wAnnouncementPeriodMilliSec); + manual_liveliness_assertion_->restart_timer(); + min_manual_by_participant_ms_ = wAnnouncementPeriodMilliSec; } - else if(m_minManRTPSParticipant_MilliSec > wAnnouncementPeriodMilliSec) + else if (min_manual_by_participant_ms_ > wAnnouncementPeriodMilliSec) { - m_minManRTPSParticipant_MilliSec = wAnnouncementPeriodMilliSec; - mp_livelinessManRTPSParticipant->update_interval_millisec(m_minManRTPSParticipant_MilliSec); + min_manual_by_participant_ms_ = wAnnouncementPeriodMilliSec; + manual_liveliness_assertion_->update_interval_millisec(min_manual_by_participant_ms_); //CHECK IF THE TIMER IS GOING TO BE CALLED AFTER THIS NEW SET LEASE DURATION - if(mp_livelinessManRTPSParticipant->getRemainingTimeMilliSec() > m_minManRTPSParticipant_MilliSec) + if (manual_liveliness_assertion_->getRemainingTimeMilliSec() > min_manual_by_participant_ms_) { - mp_livelinessManRTPSParticipant->cancel_timer(); + manual_liveliness_assertion_->cancel_timer(); } - mp_livelinessManRTPSParticipant->restart_timer(); + manual_liveliness_assertion_->restart_timer(); + } + manual_by_participant_writers_.push_back(W); + + if (!pub_liveliness_manager_->add_writer( + W->getGuid(), + wqos.m_liveliness.kind, + wqos.m_liveliness.lease_duration)) + { + logError(RTPS_LIVELINESS, "Could not add writer " << W->getGuid() << " to liveliness manager"); + } + } + else if (wqos.m_liveliness.kind == MANUAL_BY_TOPIC_LIVELINESS_QOS) + { + manual_by_topic_writers_.push_back(W); + + if (!pub_liveliness_manager_->add_writer( + W->getGuid(), + wqos.m_liveliness.kind, + wqos.m_liveliness.lease_duration)) + { + logError(RTPS_LIVELINESS, "Could not add writer " << W->getGuid() << " to liveliness manager"); } - m_livManRTPSParticipantWriters.push_back(W); } + return true; } typedef std::vector::iterator t_WIT; -bool WLP::removeLocalWriter(RTPSWriter* W) +bool WLP::remove_local_writer(RTPSWriter* W) { std::lock_guard guard(*mp_builtinProtocols->mp_PDP->getMutex()); - logInfo(RTPS_LIVELINESS,W->getGuid().entityId - <<" from Liveliness Protocol"); + + logInfo(RTPS_LIVELINESS, W->getGuid().entityId <<" from Liveliness Protocol"); + t_WIT wToEraseIt; ParticipantProxyData pdata; WriterProxyData wdata; - if(this->mp_builtinProtocols->mp_PDP->lookupWriterProxyData(W->getGuid(), wdata, pdata)) + if (this->mp_builtinProtocols->mp_PDP->lookupWriterProxyData(W->getGuid(), wdata, pdata)) { bool found = false; - if(wdata.m_qos.m_liveliness.kind == AUTOMATIC_LIVELINESS_QOS) + if (wdata.m_qos.m_liveliness.kind == AUTOMATIC_LIVELINESS_QOS) { - m_minAutomatic_MilliSec = std::numeric_limits::max(); - for(t_WIT it= m_livAutomaticWriters.begin();it!=m_livAutomaticWriters.end();++it) + min_automatic_ms_ = std::numeric_limits::max(); + for (t_WIT it = automatic_writers_.begin(); it != automatic_writers_.end(); ++it) { ParticipantProxyData pdata2; WriterProxyData wdata2; - if(this->mp_builtinProtocols->mp_PDP->lookupWriterProxyData((*it)->getGuid(), wdata2, pdata2)) + if (this->mp_builtinProtocols->mp_PDP->lookupWriterProxyData((*it)->getGuid(), wdata2, pdata2)) { double mintimeWIT(TimeConv::Duration_t2MilliSecondsDouble( wdata2.m_qos.m_liveliness.announcement_period)); - if(W->getGuid().entityId == (*it)->getGuid().entityId) + if (W->getGuid().entityId == (*it)->getGuid().entityId) { found = true; wToEraseIt = it; continue; } - if(m_minAutomatic_MilliSec > mintimeWIT) + if (min_automatic_ms_ > mintimeWIT) { - m_minAutomatic_MilliSec = mintimeWIT; + min_automatic_ms_ = mintimeWIT; } } } - if(found) + if (found) { - m_livAutomaticWriters.erase(wToEraseIt); - if(mp_livelinessAutomatic!=nullptr) + automatic_writers_.erase(wToEraseIt); + if (automatic_liveliness_assertion_ != nullptr) { - if(m_livAutomaticWriters.size()>0) - mp_livelinessAutomatic->update_interval_millisec(m_minAutomatic_MilliSec); + if (automatic_writers_.size() > 0) + { + automatic_liveliness_assertion_->update_interval_millisec(min_automatic_ms_); + } else { - delete(mp_livelinessAutomatic); - mp_livelinessAutomatic = nullptr; - + automatic_liveliness_assertion_->cancel_timer(); } } } } - else if(wdata.m_qos.m_liveliness.kind == MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) + else if (wdata.m_qos.m_liveliness.kind == MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) { - m_minManRTPSParticipant_MilliSec = std::numeric_limits::max(); - for(t_WIT it= m_livManRTPSParticipantWriters.begin();it!=m_livManRTPSParticipantWriters.end();++it) + min_manual_by_participant_ms_ = std::numeric_limits::max(); + for(t_WIT it = manual_by_participant_writers_.begin(); it != manual_by_participant_writers_.end(); ++it) { ParticipantProxyData pdata2; WriterProxyData wdata2; - if(this->mp_builtinProtocols->mp_PDP->lookupWriterProxyData((*it)->getGuid(), wdata2, pdata2)) + if (this->mp_builtinProtocols->mp_PDP->lookupWriterProxyData((*it)->getGuid(), wdata2, pdata2)) { double mintimeWIT(TimeConv::Duration_t2MilliSecondsDouble( wdata2.m_qos.m_liveliness.announcement_period)); - if(W->getGuid().entityId == (*it)->getGuid().entityId) + if (W->getGuid().entityId == (*it)->getGuid().entityId) { found = true; wToEraseIt = it; continue; } - if(m_minManRTPSParticipant_MilliSec > mintimeWIT) + if (min_manual_by_participant_ms_ > mintimeWIT) { - m_minManRTPSParticipant_MilliSec = mintimeWIT; + min_manual_by_participant_ms_ = mintimeWIT; } } } - if(found) + if (found) { - m_livManRTPSParticipantWriters.erase(wToEraseIt); - if(mp_livelinessManRTPSParticipant!=nullptr) + manual_by_participant_writers_.erase(wToEraseIt); + if (manual_liveliness_assertion_ != nullptr) { - if(m_livManRTPSParticipantWriters.size()>0) - mp_livelinessManRTPSParticipant->update_interval_millisec(m_minManRTPSParticipant_MilliSec); + if (manual_by_participant_writers_.size() > 0) + { + manual_liveliness_assertion_->update_interval_millisec(min_manual_by_participant_ms_); + } else { - delete(mp_livelinessManRTPSParticipant); - mp_livelinessManRTPSParticipant = nullptr; + manual_liveliness_assertion_->cancel_timer(); } } } + + if (!pub_liveliness_manager_->remove_writer( + W->getGuid(), + wdata.m_qos.m_liveliness.kind, + wdata.m_qos.m_liveliness.lease_duration)) + { + logError(RTPS_LIVELINESS, "Could not remove writer " << W->getGuid() << " from liveliness manager"); + } } - else // OTHER VALUE OF LIVELINESS (BY TOPIC) - return true; - if(found) + else if (wdata.m_qos.m_liveliness.kind == MANUAL_BY_TOPIC_LIVELINESS_QOS) + { + for (auto it=manual_by_topic_writers_.begin(); it!=manual_by_topic_writers_.end(); ++it) + { + if (W->getGuid().entityId == (*it)->getGuid().entityId) + { + found = true; + wToEraseIt = it; + } + } + if (found) + { + manual_by_topic_writers_.erase(wToEraseIt); + } + + if (!pub_liveliness_manager_->remove_writer( + W->getGuid(), + wdata.m_qos.m_liveliness.kind, + wdata.m_qos.m_liveliness.lease_duration)) + { + logError(RTPS_LIVELINESS, "Could not remove writer " << W->getGuid() << " from liveliness manager"); + } + } + + if (found) + { return true; + } else + { return false; + } } logWarning(RTPS_LIVELINESS,"Writer "<getGuid().entityId << " not found."); return false; } -bool WLP::updateLocalWriter(RTPSWriter* W, const WriterQos& wqos) +bool WLP::add_local_reader(RTPSReader* reader, const ReaderQos &rqos) { - - // Unused in release mode. - (void)W; - std::lock_guard guard(*mp_builtinProtocols->mp_PDP->getMutex()); - logInfo(RTPS_LIVELINESS, W->getGuid().entityId); - double wAnnouncementPeriodMilliSec(TimeConv::Duration_t2MilliSecondsDouble(wqos.m_liveliness.announcement_period)); - if(wqos.m_liveliness.kind == AUTOMATIC_LIVELINESS_QOS ) + + if (rqos.m_liveliness.kind == AUTOMATIC_LIVELINESS_QOS) { - if(mp_livelinessAutomatic == nullptr) - { - mp_livelinessAutomatic = new WLivelinessPeriodicAssertion(this,AUTOMATIC_LIVELINESS_QOS); - mp_livelinessAutomatic->update_interval_millisec(wAnnouncementPeriodMilliSec); - mp_livelinessAutomatic->restart_timer(); - m_minAutomatic_MilliSec = wAnnouncementPeriodMilliSec; - } - else if(m_minAutomatic_MilliSec > wAnnouncementPeriodMilliSec) - { - m_minAutomatic_MilliSec = wAnnouncementPeriodMilliSec; - mp_livelinessAutomatic->update_interval_millisec(wAnnouncementPeriodMilliSec); - //CHECK IF THE TIMER IS GOING TO BE CALLED AFTER THIS NEW SET LEASE DURATION - if(mp_livelinessAutomatic->getRemainingTimeMilliSec() > m_minAutomatic_MilliSec) - { - mp_livelinessAutomatic->cancel_timer(); - } - mp_livelinessAutomatic->restart_timer(); - } + automatic_readers_ = true; } - else if(wqos.m_liveliness.kind == MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) + + readers_.push_back(reader); + + return true; +} + +bool WLP::remove_local_reader(RTPSReader* reader) +{ + auto it = std::find( + readers_.begin(), + readers_.end(), + reader); + if (it != readers_.end()) { - if(mp_livelinessManRTPSParticipant == nullptr) - { - mp_livelinessManRTPSParticipant = new WLivelinessPeriodicAssertion(this,MANUAL_BY_PARTICIPANT_LIVELINESS_QOS); - mp_livelinessManRTPSParticipant->update_interval_millisec(wAnnouncementPeriodMilliSec); - mp_livelinessManRTPSParticipant->restart_timer(); - m_minManRTPSParticipant_MilliSec = wAnnouncementPeriodMilliSec; - } - else if(m_minManRTPSParticipant_MilliSec > wAnnouncementPeriodMilliSec) - { - m_minManRTPSParticipant_MilliSec = wAnnouncementPeriodMilliSec; - mp_livelinessManRTPSParticipant->update_interval_millisec(m_minManRTPSParticipant_MilliSec); - //CHECK IF THE TIMER IS GOING TO BE CALLED AFTER THIS NEW SET LEASE DURATION - if(mp_livelinessManRTPSParticipant->getRemainingTimeMilliSec() > m_minManRTPSParticipant_MilliSec) - { - mp_livelinessManRTPSParticipant->cancel_timer(); - } - mp_livelinessManRTPSParticipant->restart_timer(); - } + readers_.erase(it); + return true; } - return true; + + logWarning(RTPS_LIVELINESS, "Reader not removed from WLP, unknown reader"); + return false; } StatefulWriter* WLP::getBuiltinWriter() @@ -696,6 +811,154 @@ WriterHistory* WLP::getBuiltinWriterHistory() return ret_val; } +bool WLP::assert_liveliness( + GUID_t writer, + LivelinessQosPolicyKind kind, + Duration_t lease_duration) +{ + return pub_liveliness_manager_->assert_liveliness( + writer, + kind, + lease_duration); +} + +bool WLP::assert_liveliness_manual_by_participant() +{ + if (manual_by_participant_writers_.size() > 0) + { + return pub_liveliness_manager_->assert_liveliness(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS); + } + return false; +} + +void WLP::pub_liveliness_changed( + const GUID_t& writer, + const LivelinessQosPolicyKind& kind, + const Duration_t& lease_duration, + int32_t alive_change, + int32_t not_alive_change) +{ + (void)lease_duration; + (void)alive_change; + + // On the publishing side we only have to notify if one of our writers loses liveliness + if (not_alive_change != 1) + { + return; + } + + if (kind == AUTOMATIC_LIVELINESS_QOS) + { + for (RTPSWriter* w: automatic_writers_) + { + if (w->getGuid() == writer) + { + std::unique_lock lock(w->getMutex()); + + w->liveliness_lost_status_.total_count++; + w->liveliness_lost_status_.total_count_change++; + if (w->getListener() != nullptr) + { + w->getListener()->on_liveliness_lost(w, w->liveliness_lost_status_); + } + w->liveliness_lost_status_.total_count_change = 0u; + + return; + } + } + } + else if (kind == MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) + { + for (RTPSWriter* w: manual_by_participant_writers_) + { + if (w->getGuid() == writer) + { + std::unique_lock lock(w->getMutex()); + + w->liveliness_lost_status_.total_count++; + w->liveliness_lost_status_.total_count_change++; + if (w->getListener() != nullptr) + { + w->getListener()->on_liveliness_lost(w, w->liveliness_lost_status_); + } + w->liveliness_lost_status_.total_count_change = 0u; + + return; + } + } + } + else if (kind == MANUAL_BY_TOPIC_LIVELINESS_QOS) + { + for (RTPSWriter* w: manual_by_topic_writers_) + { + if (w->getGuid() == writer) + { + std::unique_lock lock(w->getMutex()); + + w->liveliness_lost_status_.total_count++; + w->liveliness_lost_status_.total_count_change++; + if (w->getListener() != nullptr) + { + w->getListener()->on_liveliness_lost(w, w->liveliness_lost_status_); + } + w->liveliness_lost_status_.total_count_change = 0u; + + return; + } + } + } +} + +void WLP::sub_liveliness_changed( + const GUID_t& writer, + const LivelinessQosPolicyKind& kind, + const Duration_t& lease_duration, + int32_t alive_change, + int32_t not_alive_change) +{ + // Writer with given guid lost liveliness, check which readers were matched and inform them + + RemoteWriterAttributes ratt; + ratt.guid = writer; + + for (RTPSReader* reader : readers_) + { + if (reader->liveliness_kind_ == kind && + reader->liveliness_lease_duration_ == lease_duration) + { + if (reader->matched_writer_is_matched(ratt)) + { + update_liveliness_changed_status( + writer, + reader, + alive_change, + not_alive_change); + } + } + } +} + +void WLP::update_liveliness_changed_status( + GUID_t writer, + RTPSReader* reader, + int32_t alive_change, + int32_t not_alive_change) +{ + reader->liveliness_changed_status_.alive_count += alive_change; + reader->liveliness_changed_status_.alive_count_change += alive_change; + reader->liveliness_changed_status_.not_alive_count += not_alive_change; + reader->liveliness_changed_status_.not_alive_count_change += not_alive_change; + reader->liveliness_changed_status_.last_publication_handle = writer; + + if (reader->getListener() != nullptr) + { + reader->getListener()->on_liveliness_changed(reader, reader->liveliness_changed_status_); + + reader->liveliness_changed_status_.alive_count_change = 0; + reader->liveliness_changed_status_.not_alive_count_change = 0; + } +} + } /* namespace rtps */ } /* namespace fastrtps */ } /* namespace eprosima */ diff --git a/src/cpp/rtps/builtin/liveliness/WLPListener.cpp b/src/cpp/rtps/builtin/liveliness/WLPListener.cpp index 346655eac5d..8db4f82e852 100644 --- a/src/cpp/rtps/builtin/liveliness/WLPListener.cpp +++ b/src/cpp/rtps/builtin/liveliness/WLPListener.cpp @@ -26,7 +26,7 @@ #include #include - +#include #include #include @@ -38,7 +38,8 @@ namespace fastrtps{ namespace rtps { -WLPListener::WLPListener(WLP* plwp) : mp_WLP(plwp) +WLPListener::WLPListener(WLP* plwp) + : mp_WLP(plwp) { } @@ -46,85 +47,97 @@ WLPListener::~WLPListener() { } - typedef std::vector::iterator WPIT; void WLPListener::onNewCacheChangeAdded( RTPSReader* reader, const CacheChange_t* const changeIN) { - std::lock_guard guard2(*mp_WLP->getBuiltinProtocols()->mp_PDP->getMutex()); - logInfo(RTPS_LIVELINESS,""); - GuidPrefix_t guidP; - LivelinessQosPolicyKind livelinessKind; - CacheChange_t* change = (CacheChange_t*)changeIN; - if(!computeKey(change)) - { - logWarning(RTPS_LIVELINESS,"Problem obtaining the Key"); - return; - } - //Check the serializedPayload: + + std::lock_guard guard2(*mp_WLP->getBuiltinProtocols()->mp_PDP->getMutex()); + + GuidPrefix_t guidP; + LivelinessQosPolicyKind livelinessKind; + CacheChange_t* change = (CacheChange_t*)changeIN; + if(!computeKey(change)) + { + logWarning(RTPS_LIVELINESS,"Problem obtaining the Key"); + return; + } + //Check the serializedPayload: auto history = reader->getHistory(); - for(auto ch = history->changesBegin(); ch!=history->changesEnd();++ch) - { - if((*ch)->instanceHandle == change->instanceHandle && - (*ch)->sequenceNumber < change->sequenceNumber) - { - history->remove_change(*ch); - break; - } - } - if(change->serializedPayload.length>0) - { - for(uint8_t i =0;i<12;++i) - { - guidP.value[i] = change->serializedPayload.data[i]; - } - livelinessKind = (LivelinessQosPolicyKind)(change->serializedPayload.data[15]-0x01); - - } - else - { - if(!separateKey(change->instanceHandle,&guidP,&livelinessKind)) - return; - } - logInfo(RTPS_LIVELINESS,"RTPSParticipant "<getGuid().guidPrefix) - { - logInfo(RTPS_LIVELINESS,"Message from own RTPSParticipant, ignoring"); + for(auto ch = history->changesBegin(); ch!=history->changesEnd();++ch) + { + if((*ch)->instanceHandle == change->instanceHandle && (*ch)->sequenceNumber < change->sequenceNumber) + { + history->remove_change(*ch); + break; + } + } + if(change->serializedPayload.length>0) + { + for(uint8_t i =0;i<12;++i) + { + guidP.value[i] = change->serializedPayload.data[i]; + } + livelinessKind = (LivelinessQosPolicyKind)(change->serializedPayload.data[15]-0x01); + + } + else + { + if(!separateKey( + change->instanceHandle, + &guidP, + &livelinessKind)) + { + return; + } + } + + if(guidP == reader->getGuid().guidPrefix) + { + logInfo(RTPS_LIVELINESS,"Message from own RTPSParticipant, ignoring"); history->remove_change(change); - return; - } - this->mp_WLP->getBuiltinProtocols()->mp_PDP->assertRemoteWritersLiveliness(guidP,livelinessKind); - - return; + return; + } + + if (mp_WLP->automatic_readers_) + { + mp_WLP->sub_liveliness_manager_->assert_liveliness(AUTOMATIC_LIVELINESS_QOS); + } + if (livelinessKind == MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) + { + mp_WLP->sub_liveliness_manager_->assert_liveliness(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS); + } + return; } -bool WLPListener::separateKey(InstanceHandle_t& key,GuidPrefix_t* guidP,LivelinessQosPolicyKind* liveliness) +bool WLPListener::separateKey( + InstanceHandle_t& key, + GuidPrefix_t* guidP, + LivelinessQosPolicyKind* liveliness) { - for(uint8_t i=0;i<12;++i) - { - guidP->value[i] = key.value[i]; - } - *liveliness = (LivelinessQosPolicyKind)key.value[15]; - return true; + for(uint8_t i=0;i<12;++i) + { + guidP->value[i] = key.value[i]; + } + *liveliness = (LivelinessQosPolicyKind)key.value[15]; + return true; } bool WLPListener::computeKey(CacheChange_t* change) { - if(change->instanceHandle == c_InstanceHandle_Unknown) - { - SerializedPayload_t* pl = &change->serializedPayload; - if(pl->length >= 16) - { - memcpy(change->instanceHandle.value, pl->data, 16); - return true; - } - return false; - } - return true; + if(change->instanceHandle == c_InstanceHandle_Unknown) + { + SerializedPayload_t* pl = &change->serializedPayload; + if(pl->length >= 16) + { + memcpy(change->instanceHandle.value, pl->data, 16); + return true; + } + return false; + } + return true; } diff --git a/src/cpp/rtps/builtin/liveliness/timedevent/WLivelinessPeriodicAssertion.cpp b/src/cpp/rtps/builtin/liveliness/timedevent/WLivelinessPeriodicAssertion.cpp index a251a1eb8ae..efe35409ae2 100644 --- a/src/cpp/rtps/builtin/liveliness/timedevent/WLivelinessPeriodicAssertion.cpp +++ b/src/cpp/rtps/builtin/liveliness/timedevent/WLivelinessPeriodicAssertion.cpp @@ -31,6 +31,7 @@ #include #include +#include #include @@ -40,25 +41,32 @@ namespace fastrtps{ namespace rtps { -WLivelinessPeriodicAssertion::WLivelinessPeriodicAssertion(WLP* pwlp,LivelinessQosPolicyKind kind): - TimedEvent(pwlp->getRTPSParticipant()->getEventResource().getIOService(), - pwlp->getRTPSParticipant()->getEventResource().getThread(), 0), - m_livelinessKind(kind), mp_WLP(pwlp) +WLivelinessPeriodicAssertion::WLivelinessPeriodicAssertion( + WLP* pwlp, + LivelinessQosPolicyKind kind) + : TimedEvent( + pwlp->getRTPSParticipant()->getEventResource().getIOService(), + pwlp->getRTPSParticipant()->getEventResource().getThread(), + 0) + , m_livelinessKind(kind) + , mp_WLP(pwlp) +{ + m_guidP = this->mp_WLP->getRTPSParticipant()->getGuid().guidPrefix; + for(uint8_t i =0;i<12;++i) { - m_guidP = this->mp_WLP->getRTPSParticipant()->getGuid().guidPrefix; - for(uint8_t i =0;i<12;++i) - { - m_iHandle.value[i] = m_guidP.value[i]; - } - m_iHandle.value[15] = m_livelinessKind+0x01; + m_iHandle.value[i] = m_guidP.value[i]; } + m_iHandle.value[15] = m_livelinessKind+0x01; +} WLivelinessPeriodicAssertion::~WLivelinessPeriodicAssertion() { destroy(); } -void WLivelinessPeriodicAssertion::event(EventCode code, const char* msg) +void WLivelinessPeriodicAssertion::event( + EventCode code, + const char* msg) { // Unused in release mode. @@ -70,11 +78,14 @@ void WLivelinessPeriodicAssertion::event(EventCode code, const char* msg) if(this->mp_WLP->getBuiltinWriter()->getMatchedReadersSize()>0) { if(m_livelinessKind == AUTOMATIC_LIVELINESS_QOS) - AutomaticLivelinessAssertion(); + { + automatic_liveliness_assertion(); + } else if(m_livelinessKind == MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) - ManualByRTPSParticipantLivelinessAssertion(); + { + manual_by_participant_liveliness_assertion(); + } } - this->mp_WLP->getBuiltinProtocols()->mp_PDP->assertLocalWritersLiveliness(m_livelinessKind); this->restart_timer(); } else if(code == EVENT_ABORT) @@ -87,89 +98,73 @@ void WLivelinessPeriodicAssertion::event(EventCode code, const char* msg) } } -bool WLivelinessPeriodicAssertion::AutomaticLivelinessAssertion() +bool WLivelinessPeriodicAssertion::automatic_liveliness_assertion() { std::lock_guard guard(*this->mp_WLP->getBuiltinProtocols()->mp_PDP->getMutex()); - if(this->mp_WLP->m_livAutomaticWriters.size()>0) + + if(this->mp_WLP->automatic_writers_.size() > 0) { - auto writer = this->mp_WLP->getBuiltinWriter(); - auto history = this->mp_WLP->getBuiltinWriterHistory(); - std::lock_guard wguard(writer->getMutex()); - CacheChange_t* change=writer->new_change([]() -> uint32_t {return BUILTIN_PARTICIPANT_DATA_MAX_SIZE;}, ALIVE,m_iHandle); - if(change!=nullptr) - { - //change->instanceHandle = m_iHandle; -#if __BIG_ENDIAN__ - change->serializedPayload.encapsulation = (uint16_t)PL_CDR_BE; -#else - change->serializedPayload.encapsulation = (uint16_t)PL_CDR_LE; -#endif - memcpy(change->serializedPayload.data,m_guidP.value,12); - for(uint8_t i =12;i<24;++i) - change->serializedPayload.data[i] = 0; - change->serializedPayload.data[15] = m_livelinessKind+1; - change->serializedPayload.length = 12+4+4+4; - if(history->getHistorySize() > 0) - { - for(std::vector::iterator chit = history->changesBegin(); - chit!=history->changesEnd();++chit) - { - if((*chit)->instanceHandle == change->instanceHandle) - { - history->remove_change(*chit); - break; - } - } - } - history->add_change(change); - } + return add_cache_change(); } return true; } -bool WLivelinessPeriodicAssertion::ManualByRTPSParticipantLivelinessAssertion() +bool WLivelinessPeriodicAssertion::manual_by_participant_liveliness_assertion() { std::lock_guard guard(*this->mp_WLP->getBuiltinProtocols()->mp_PDP->getMutex()); - bool livelinessAsserted = false; - for(std::vector::iterator wit=this->mp_WLP->m_livManRTPSParticipantWriters.begin(); - wit!=this->mp_WLP->m_livManRTPSParticipantWriters.end();++wit) + + if (mp_WLP->manual_by_participant_writers_.size() > 0) { - if((*wit)->getLivelinessAsserted()) + // Liveliness was asserted for at least one of the writers using MANUAL_BY_PARTICIPANT + if(mp_WLP->pub_liveliness_manager_->is_any_alive(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS)) { - livelinessAsserted = true; + return add_cache_change(); } - (*wit)->setLivelinessAsserted(false); } - if(livelinessAsserted) + return false; +} + +bool WLivelinessPeriodicAssertion::add_cache_change() +{ + auto writer = mp_WLP->getBuiltinWriter(); + auto history = mp_WLP->getBuiltinWriterHistory(); + + std::lock_guard wguard(writer->getMutex()); + + CacheChange_t* change=writer->new_change( + []() -> uint32_t { return BUILTIN_PARTICIPANT_DATA_MAX_SIZE; }, + ALIVE, + m_iHandle); + + if(change != nullptr) { - auto writer = this->mp_WLP->getBuiltinWriter(); - auto history = this->mp_WLP->getBuiltinWriterHistory(); - std::lock_guard wguard(writer->getMutex()); - CacheChange_t* change=writer->new_change([]() -> uint32_t {return BUILTIN_PARTICIPANT_DATA_MAX_SIZE;}, ALIVE); - if(change!=nullptr) - { - change->instanceHandle = m_iHandle; #if __BIG_ENDIAN__ - change->serializedPayload.encapsulation = (uint16_t)PL_CDR_BE; + change->serializedPayload.encapsulation = (uint16_t)PL_CDR_BE; #else - change->serializedPayload.encapsulation = (uint16_t)PL_CDR_LE; + change->serializedPayload.encapsulation = (uint16_t)PL_CDR_LE; #endif - memcpy(change->serializedPayload.data,m_guidP.value,12); - - for(uint8_t i =12;i<24;++i) - change->serializedPayload.data[i] = 0; - change->serializedPayload.data[15] = m_livelinessKind+1; - change->serializedPayload.length = 12+4+4+4; - for(auto ch = history->changesBegin(); - ch!=history->changesEnd();++ch) + memcpy(change->serializedPayload.data,m_guidP.value,12); + + for(uint8_t i =12;i<24;++i) + { + change->serializedPayload.data[i] = 0; + } + change->serializedPayload.data[15] = m_livelinessKind+1; + change->serializedPayload.length = 12+4+4+4; + + if(history->getHistorySize() > 0) + { + for(auto chit = history->changesBegin(); chit != history->changesEnd(); ++chit) { - if((*ch)->instanceHandle == change->instanceHandle) + if((*chit)->instanceHandle == change->instanceHandle) { - history->remove_change(*ch); + history->remove_change(*chit); + break; } } - history->add_change(change); } + history->add_change(change); + return true; } return false; } diff --git a/src/cpp/rtps/common/Time_t.cpp b/src/cpp/rtps/common/Time_t.cpp index 8f8fa28be4e..74e0cc26543 100644 --- a/src/cpp/rtps/common/Time_t.cpp +++ b/src/cpp/rtps/common/Time_t.cpp @@ -19,6 +19,24 @@ using namespace eprosima::fastrtps; +namespace { // unnamed namespace for inline functions in compilation unit. Better practice than static inline. + +constexpr uint64_t C_FRACTIONS_PER_SEC = 4294967296ULL; +constexpr uint64_t C_NANOSECONDS_PER_SEC = 1000000000ULL; + +inline uint32_t frac_to_nano( + uint32_t fractions) +{ + return static_cast((fractions * C_NANOSECONDS_PER_SEC) / C_FRACTIONS_PER_SEC); +} + +inline uint32_t nano_to_frac( + uint32_t nanosecs) +{ + return static_cast((nanosecs * C_FRACTIONS_PER_SEC) / C_NANOSECONDS_PER_SEC); +} +} // unnamed namespace + Time_t::Time_t() { seconds = 0; @@ -37,7 +55,7 @@ Time_t::Time_t( long double sec) { seconds = static_cast(sec); - nanosec = static_cast((sec - seconds) * 1000000000ULL); + nanosec = static_cast((sec - seconds) * C_NANOSECONDS_PER_SEC); } void Time_t::fraction( @@ -45,21 +63,22 @@ void Time_t::fraction( { nanosec = (frac == 0xffffffff) ? 0xffffffff - : static_cast(std::lroundl(frac * rtps::FRACTION_TO_NANO)); + : frac_to_nano(frac); } uint32_t Time_t::fraction() const { - if (nanosec == 0xffffffff) - { - return nanosec; - } + uint32_t fraction = (nanosec == 0xffffffff) + ? 0xffffffff + : nano_to_frac(nanosec); - uint32_t fraction = static_cast(std::lroundl(nanosec * rtps::NANO_TO_FRACTION)); - uint32_t nano_check = static_cast(std::lroundl(fraction * rtps::FRACTION_TO_NANO)); - while (nano_check != nanosec) + if (fraction != 0xffffffff) { - nano_check = static_cast(std::lroundl(++fraction * rtps::FRACTION_TO_NANO)); + uint32_t nano_check = frac_to_nano(fraction); + while (nano_check != nanosec) + { + nano_check = frac_to_nano(++fraction); + } } return fraction; @@ -67,7 +86,7 @@ uint32_t Time_t::fraction() const int64_t Time_t::to_ns() const { - int64_t nano = seconds * 1000000000ULL; + int64_t nano = seconds * static_cast(C_NANOSECONDS_PER_SEC); nano += nanosec; return nano; } @@ -91,7 +110,7 @@ rtps::Time_t::Time_t( long double sec) { seconds_ = static_cast(sec); - set_fraction(static_cast((sec - seconds_) * 4294967296ULL)); + set_fraction(static_cast((sec - seconds_) * C_FRACTIONS_PER_SEC)); } rtps::Time_t::Time_t( @@ -103,7 +122,7 @@ rtps::Time_t::Time_t( int64_t rtps::Time_t::to_ns() const { - int64_t nano = seconds_ * 1000000000ULL; + int64_t nano = seconds_ * static_cast(C_NANOSECONDS_PER_SEC); nano += nanosec_; return nano; } @@ -132,7 +151,7 @@ uint32_t rtps::Time_t::nanosec() const void rtps::Time_t::nanosec( uint32_t nanos) { - const uint32_t s_to_nano = 1000000000UL; + const uint32_t s_to_nano = static_cast(C_NANOSECONDS_PER_SEC); if (nanos >= s_to_nano) { nanos %= s_to_nano; // Remove the seconds @@ -168,23 +187,24 @@ void rtps::Time_t::set_fraction( fraction_ = frac; nanosec_ = (fraction_ == 0xffffffff) ? 0xffffffff - : static_cast(std::lroundl(fraction_ * FRACTION_TO_NANO)); + : frac_to_nano(fraction_); } void rtps::Time_t::set_nanosec( uint32_t nanos) { nanosec_ = nanos; - fraction_ = (nanosec_ == 0xffffffff) + + fraction_ = (nanos == 0xffffffff) ? 0xffffffff - : static_cast(std::lroundl(nanosec_ * NANO_TO_FRACTION)); + : nano_to_frac(nanos); if (fraction_ != 0xffffffff) { - uint32_t nano_check = static_cast(std::lroundl(fraction_ * FRACTION_TO_NANO)); + uint32_t nano_check = frac_to_nano(fraction_); while (nano_check != nanosec_) { - nano_check = static_cast(std::lroundl(++fraction_ * FRACTION_TO_NANO)); + nano_check = frac_to_nano(++fraction_); } } -} \ No newline at end of file +} diff --git a/src/cpp/rtps/history/ReaderHistory.cpp b/src/cpp/rtps/history/ReaderHistory.cpp index e6cb555209d..867aabb9e29 100644 --- a/src/cpp/rtps/history/ReaderHistory.cpp +++ b/src/cpp/rtps/history/ReaderHistory.cpp @@ -125,18 +125,7 @@ bool ReaderHistory::remove_changes_with_guid(const GUID_t& a_guid) std::lock_guard guard(*mp_mutex); for(std::vector::iterator chit = m_changes.begin(); chit!=m_changes.end();++chit) { - bool matches = true; - unsigned int size = a_guid.guidPrefix.size; - if( !std::equal( (*chit)->writerGUID.guidPrefix.value , (*chit)->writerGUID.guidPrefix.value + size -1, a_guid.guidPrefix.value ) ) - { - matches = false; - } - size = a_guid.entityId.size; - if( !std::equal( (*chit)->writerGUID.entityId.value , (*chit)->writerGUID.entityId.value + size -1, a_guid.entityId.value ) ) - { - matches = false; - } - if(matches) + if((*chit)->writerGUID == a_guid) { changes_to_remove.push_back( (*chit) ); } diff --git a/src/cpp/rtps/network/ReceiverResource.cpp b/src/cpp/rtps/network/ReceiverResource.cpp index b872ffc9dea..61180e7468e 100644 --- a/src/cpp/rtps/network/ReceiverResource.cpp +++ b/src/cpp/rtps/network/ReceiverResource.cpp @@ -26,7 +26,10 @@ namespace fastrtps{ namespace rtps{ ReceiverResource::ReceiverResource(TransportInterface& transport, const Locator_t& locator, uint32_t max_size) - : mValid(false) + : Cleanup(nullptr) + , LocatorMapsToManagedChannel(nullptr) + , mValid(false) + , mtx() , receiver(nullptr) , msg(0) { @@ -98,7 +101,7 @@ void ReceiverResource::OnDataReceived(const octet * data, const uint32_t size, } -ReceiverResource::~ReceiverResource() +void ReceiverResource::disable() { if (Cleanup) { @@ -106,6 +109,10 @@ ReceiverResource::~ReceiverResource() } } +ReceiverResource::~ReceiverResource() +{ +} + } // namespace rtps } // namespace fastrtps } // namespace eprosima diff --git a/src/cpp/rtps/participant/RTPSParticipant.cpp b/src/cpp/rtps/participant/RTPSParticipant.cpp index 1e9eb520e79..56a8b60d841 100644 --- a/src/cpp/rtps/participant/RTPSParticipant.cpp +++ b/src/cpp/rtps/participant/RTPSParticipant.cpp @@ -120,6 +120,11 @@ ResourceEvent& RTPSParticipant::get_resource_event() const return mp_impl->getEventResource(); } +WLP* RTPSParticipant::wlp() const +{ + return mp_impl->wlp(); +} + } /* namespace rtps */ } /* namespace fastrtps */ } /* namespace eprosima */ diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp index 5b3675d087d..3befb9696a4 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp @@ -122,7 +122,8 @@ RTPSParticipantImpl::RTPSParticipantImpl(const RTPSParticipantAttributes& PParam /// Creation of metatraffic locator and receiver resources uint32_t metatraffic_multicast_port = m_att.port.getMulticastPort(m_att.builtin.domainId); - uint32_t metatraffic_unicast_port = m_att.port.getUnicastPort(m_att.builtin.domainId, m_att.participantID); + uint32_t metatraffic_unicast_port = m_att.port.getUnicastPort(m_att.builtin.domainId, + static_cast(m_att.participantID)); /* If metatrafficMulticastLocatorList is empty, add mandatory default Locators Else -> Take them */ @@ -249,16 +250,17 @@ RTPSParticipantImpl::~RTPSParticipantImpl() for(auto& block : m_receiverResourcelist) { block.Receiver->UnregisterReceiver(block.mp_receiver); + block.disable(); } while(m_userReaderList.size() > 0) { - deleteUserEndpoint((Endpoint*)*m_userReaderList.begin()); + deleteUserEndpoint(static_cast(*m_userReaderList.begin())); } while(m_userWriterList.size() > 0) { - deleteUserEndpoint((Endpoint*)*m_userWriterList.begin()); + deleteUserEndpoint(static_cast(*m_userWriterList.begin())); } delete(this->mp_builtinProtocols); @@ -298,7 +300,7 @@ bool RTPSParticipantImpl::createWriter( std::string type = (param.endpoint.reliabilityKind == RELIABLE) ? "RELIABLE" :"BEST_EFFORT"; logInfo(RTPS_PARTICIPANT," of type " << type); EntityId_t entId; - if(entityId== c_EntityId_Unknown) + if(entityId == c_EntityId_Unknown) { if(param.endpoint.topicKind == NO_KEY) { @@ -309,9 +311,9 @@ bool RTPSParticipantImpl::createWriter( entId.value[3] = 0x02; } uint32_t idnum; - if(param.endpoint.getEntityID()>0) + if(param.endpoint.getEntityID() > 0) { - idnum = param.endpoint.getEntityID(); + idnum = static_cast(param.endpoint.getEntityID()); } else { @@ -319,11 +321,11 @@ bool RTPSParticipantImpl::createWriter( idnum = IdCounter; } - octet* c = (octet*)&idnum; + octet* c = reinterpret_cast(&idnum); entId.value[2] = c[0]; entId.value[1] = c[1]; entId.value[0] = c[2]; - if(this->existsEntityId(entId,WRITER)) + if(this->existsEntityId(entId, WRITER)) { logError(RTPS_PARTICIPANT,"A writer with the same entityId already exists in this RTPSParticipant"); return false; @@ -375,14 +377,14 @@ bool RTPSParticipantImpl::createWriter( if (param.endpoint.reliabilityKind == BEST_EFFORT) { SWriter = (persistence == nullptr) ? - (RTPSWriter*) new StatelessWriter(this, guid, param, hist, listen) : - (RTPSWriter*) new StatelessPersistentWriter(this, guid, param, hist, listen, persistence); + new StatelessWriter(this, guid, param, hist, listen) : + new StatelessPersistentWriter(this, guid, param, hist, listen, persistence); } else if (param.endpoint.reliabilityKind == RELIABLE) { SWriter = (persistence == nullptr) ? - (RTPSWriter*) new StatefulWriter(this, guid, param, hist, listen) : - (RTPSWriter*) new StatefulPersistentWriter(this, guid, param, hist, listen, persistence); + new StatefulWriter(this, guid, param, hist, listen) : + new StatefulPersistentWriter(this, guid, param, hist, listen, persistence); } if (SWriter == nullptr) @@ -411,10 +413,10 @@ bool RTPSParticipantImpl::createWriter( } #endif - createSendResources((Endpoint *)SWriter); + createSendResources(SWriter); if (param.endpoint.reliabilityKind == RELIABLE) { - if (!createAndAssociateReceiverswithEndpoint((Endpoint *)SWriter)) + if (!createAndAssociateReceiverswithEndpoint(SWriter)) { delete(SWriter); return false; @@ -469,7 +471,7 @@ bool RTPSParticipantImpl::createReader( uint32_t idnum; if (param.endpoint.getEntityID() > 0) { - idnum = param.endpoint.getEntityID(); + idnum = static_cast(param.endpoint.getEntityID()); } else { @@ -477,7 +479,7 @@ bool RTPSParticipantImpl::createReader( idnum = IdCounter; } - octet* c = (octet*)&idnum; + octet* c = reinterpret_cast(&idnum); entId.value[2] = c[0]; entId.value[1] = c[1]; entId.value[0] = c[2]; @@ -526,14 +528,14 @@ bool RTPSParticipantImpl::createReader( if (param.endpoint.reliabilityKind == BEST_EFFORT) { SReader = (persistence == nullptr) ? - (RTPSReader*) new StatelessReader(this, guid, param, hist, listen) : - (RTPSReader*) new StatelessPersistentReader(this, guid, param, hist, listen, persistence); + new StatelessReader(this, guid, param, hist, listen) : + new StatelessPersistentReader(this, guid, param, hist, listen, persistence); } else if (param.endpoint.reliabilityKind == RELIABLE) { SReader = (persistence == nullptr) ? - (RTPSReader*) new StatefulReader(this, guid, param, hist, listen) : - (RTPSReader*) new StatefulPersistentReader(this, guid, param, hist, listen, persistence); + new StatefulReader(this, guid, param, hist, listen) : + new StatefulPersistentReader(this, guid, param, hist, listen, persistence); } if (SReader == nullptr) @@ -565,7 +567,7 @@ bool RTPSParticipantImpl::createReader( if (param.endpoint.reliabilityKind == RELIABLE) { - createSendResources((Endpoint *)SReader); + createSendResources(SReader); } if (isBuiltin) @@ -575,7 +577,7 @@ bool RTPSParticipantImpl::createReader( if (enable) { - if (!createAndAssociateReceiverswithEndpoint((Endpoint *)SReader)) + if (!createAndAssociateReceiverswithEndpoint(SReader)) { delete(SReader); return false; @@ -594,7 +596,7 @@ bool RTPSParticipantImpl::createReader( bool RTPSParticipantImpl::enableReader(RTPSReader *reader) { - if (!assignEndpointListenResources((Endpoint*)reader)) + if (!assignEndpointListenResources(reader)) { return false; } @@ -794,7 +796,7 @@ void RTPSParticipantImpl::createReceiverResources(LocatorList_t& Locator_list, b { std::lock_guard lock(m_receiverResourcelistMutex); //Push the new items into the ReceiverResource buffer - m_receiverResourcelist.push_back(ReceiverControlBlock(std::move(*it_buffer))); + m_receiverResourcelist.emplace_back(*it_buffer); //Create and init the MessageReceiver auto mr = new MessageReceiver(this, size); m_receiverResourcelist.back().mp_receiver = mr; @@ -892,7 +894,7 @@ bool RTPSParticipantImpl::deleteUserEndpoint(Endpoint* p_endpoint) { if (found_in_users) { - mp_builtinProtocols->removeLocalWriter((RTPSWriter*)p_endpoint); + mp_builtinProtocols->removeLocalWriter(static_cast(p_endpoint)); } #if HAVE_SECURITY @@ -907,7 +909,7 @@ bool RTPSParticipantImpl::deleteUserEndpoint(Endpoint* p_endpoint) { if (found_in_users) { - mp_builtinProtocols->removeLocalReader((RTPSReader*)p_endpoint); + mp_builtinProtocols->removeLocalReader(static_cast(p_endpoint)); } #if HAVE_SECURITY @@ -1111,6 +1113,11 @@ PDPSimple* RTPSParticipantImpl::pdpsimple() return mp_builtinProtocols->mp_PDP; } +WLP* RTPSParticipantImpl::wlp() +{ + return mp_builtinProtocols->mp_WLP; +} + bool RTPSParticipantImpl::get_remote_writer_info(const GUID_t& writerGuid, WriterProxyData& returnedInfo) { ParticipantProxyData pdata; diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.h b/src/cpp/rtps/participant/RTPSParticipantImpl.h index e98339471f1..b5e4c6fb303 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.h +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.h @@ -79,6 +79,7 @@ class StatefulReader; class PDPSimple; class FlowController; class IPersistenceService; +class WLP; /** * @brief Class RTPSParticipantImpl, it contains the private implementation of the RTPSParticipant functions and @@ -97,12 +98,21 @@ class RTPSParticipantImpl { std::shared_ptr Receiver; MessageReceiver* mp_receiver; //Associated Readers/Writers inside of MessageReceiver - ReceiverControlBlock(std::shared_ptr&& rec) :Receiver(std::move(rec)), mp_receiver(nullptr) + ReceiverControlBlock(std::shared_ptr& rec) :Receiver(rec), mp_receiver(nullptr) { } - ReceiverControlBlock(ReceiverControlBlock&& origen) :Receiver(std::move(origen.Receiver)), mp_receiver(origen.mp_receiver) + ReceiverControlBlock(ReceiverControlBlock&& origen) :Receiver(origen.Receiver), mp_receiver(origen.mp_receiver) { origen.mp_receiver = nullptr; + origen.Receiver.reset(); + } + + void disable() + { + if (Receiver != nullptr) + { + Receiver->disable(); + } } private: @@ -232,6 +242,8 @@ class RTPSParticipantImpl PDPSimple* pdpsimple(); + WLP* wlp(); + bool get_remote_writer_info(const GUID_t& writerGuid, WriterProxyData& returnedInfo); bool get_remote_reader_info(const GUID_t& readerGuid, ReaderProxyData& returnedInfo); diff --git a/src/cpp/rtps/reader/RTPSReader.cpp b/src/cpp/rtps/reader/RTPSReader.cpp index c35b078c4e7..b7068c66e2b 100644 --- a/src/cpp/rtps/reader/RTPSReader.cpp +++ b/src/cpp/rtps/reader/RTPSReader.cpp @@ -23,6 +23,8 @@ #include "FragmentedChangePitStop.h" #include +#include +#include "../participant/RTPSParticipantImpl.h" #include @@ -30,21 +32,31 @@ namespace eprosima { namespace fastrtps{ namespace rtps { -RTPSReader::RTPSReader(RTPSParticipantImpl*pimpl,GUID_t& guid, - ReaderAttributes& att,ReaderHistory* hist,ReaderListener* rlisten): - Endpoint(pimpl,guid,att.endpoint), - mp_history(hist), - mp_listener(rlisten), - m_acceptMessagesToUnknownReaders(true), - m_acceptMessagesFromUnkownWriters(true), - m_expectsInlineQos(att.expectsInlineQos), - fragmentedChangePitStop_(nullptr) - { - mp_history->mp_reader = this; - mp_history->mp_mutex = &mp_mutex; - fragmentedChangePitStop_ = new FragmentedChangePitStop(this); - logInfo(RTPS_READER,"RTPSReader created correctly"); - } +RTPSReader::RTPSReader( + RTPSParticipantImpl*pimpl, + GUID_t& guid, + ReaderAttributes& att, + ReaderHistory* hist, + ReaderListener* rlisten) + : Endpoint( + pimpl, + guid, + att.endpoint) + , mp_history(hist) + , mp_listener(rlisten) + , m_acceptMessagesToUnknownReaders(true) + , m_acceptMessagesFromUnkownWriters(true) + , m_expectsInlineQos(att.expectsInlineQos) + , fragmentedChangePitStop_(nullptr) + , liveliness_kind_(att.liveliness_kind_) + , liveliness_lease_duration_(att.liveliness_lease_duration) +{ + mp_history->mp_reader = this; + mp_history->mp_mutex = &mp_mutex; + fragmentedChangePitStop_ = new FragmentedChangePitStop(this); + + logInfo(RTPS_READER,"RTPSReader created correctly"); +} RTPSReader::~RTPSReader() { @@ -85,7 +97,8 @@ bool RTPSReader::setListener(ReaderListener *target) return true; } -CacheChange_t* RTPSReader::findCacheInFragmentedCachePitStop(const SequenceNumber_t& sequence_number, +CacheChange_t* RTPSReader::findCacheInFragmentedCachePitStop( + const SequenceNumber_t& sequence_number, const GUID_t& writer_guid) { return fragmentedChangePitStop_->find(sequence_number, writer_guid); diff --git a/src/cpp/rtps/reader/StatefulReader.cpp b/src/cpp/rtps/reader/StatefulReader.cpp index d93e4a32741..e0adac6c00d 100644 --- a/src/cpp/rtps/reader/StatefulReader.cpp +++ b/src/cpp/rtps/reader/StatefulReader.cpp @@ -28,6 +28,9 @@ #include "../participant/RTPSParticipantImpl.h" #include "FragmentedChangePitStop.h" #include +#include +#include +#include #include #include @@ -92,45 +95,28 @@ bool StatefulReader::matched_writer_add(RemoteWriterAttributes& wdata) add_persistence_guid(wdata); wp->loaded_from_storage_nts(get_last_notified(wdata.guid)); matched_writers.push_back(wp); - logInfo(RTPS_READER,"Writer Proxy " <m_att.guid <<" added to " < lock(mp_mutex); - - //Remove cachechanges belonging to the unmatched writer - mp_history->remove_changes_with_guid(wdata.guid); - for(std::vector::iterator it=matched_writers.begin();it!=matched_writers.end();++it) + if (liveliness_lease_duration_ < c_TimeInfinite) { - if((*it)->m_att.guid == wdata.guid) + auto wlp = this->mp_RTPSParticipant->wlp(); + if ( wlp != nullptr) { - logInfo(RTPS_READER,"Writer Proxy removed: " <<(*it)->m_att.guid); - wproxy = *it; - matched_writers.erase(it); - remove_persistence_guid(wdata); - break; + wlp->sub_liveliness_manager_->add_writer( + wdata.guid, + liveliness_kind_, + liveliness_lease_duration_); + } + else + { + logError(RTPS_LIVELINESS, "Finite liveliness lease duration but WLP not enabled, cannot add writer"); } } - lock.unlock(); - - if(wproxy != nullptr) - { - delete wproxy; - return true; - } - - logInfo(RTPS_READER,"Writer Proxy " << wdata.guid << " doesn't exist in reader "<getGuid().entityId); - return false; + logInfo(RTPS_READER,"Writer Proxy " <m_att.guid <<" added to " < lock(mp_mutex); @@ -142,6 +128,22 @@ bool StatefulReader::matched_writer_remove( { if((*it)->m_att.guid == wdata.guid) { + if (liveliness_lease_duration_ < c_TimeInfinite) + { + auto wlp = this->mp_RTPSParticipant->wlp(); + if ( wlp != nullptr) + { + wlp->sub_liveliness_manager_->remove_writer( + wdata.guid, + liveliness_kind_, + liveliness_lease_duration_); + } + else + { + logError(RTPS_LIVELINESS, "Finite liveliness lease duration but WLP not enabled, cannot remove writer"); + } + } + logInfo(RTPS_READER,"Writer Proxy removed: " <<(*it)->m_att.guid); wproxy = *it; matched_writers.erase(it); @@ -152,9 +154,9 @@ bool StatefulReader::matched_writer_remove( lock.unlock(); - if(wproxy != nullptr && deleteWP) + if(wproxy != nullptr) { - delete(wproxy); + delete wproxy; return true; } @@ -225,6 +227,26 @@ bool StatefulReader::processDataMsg(CacheChange_t *change) if(acceptMsgFrom(change->writerGUID, &pWP)) { + if (liveliness_lease_duration_ < c_TimeInfinite) + { + if (liveliness_kind_ == MANUAL_BY_TOPIC_LIVELINESS_QOS || + pWP->m_att.liveliness_kind == MANUAL_BY_TOPIC_LIVELINESS_QOS) + { + auto wlp = this->mp_RTPSParticipant->wlp(); + if ( wlp != nullptr) + { + wlp->sub_liveliness_manager_->assert_liveliness( + change->writerGUID, + liveliness_kind_, + liveliness_lease_duration_); + } + else + { + logError(RTPS_LIVELINESS, "Finite liveliness lease duration but WLP not enabled"); + } + } + } + // Check if CacheChange was received. if(!pWP->change_was_received(change->sequenceNumber)) { @@ -266,13 +288,6 @@ bool StatefulReader::processDataMsg(CacheChange_t *change) return false; } - // Assertion has to be done before call change_received, - // because this function can unlock the StatefulReader timed_mutex. - if(pWP != nullptr) - { - pWP->assertLiveliness(); //Asser liveliness since you have received a DATA MESSAGE. - } - if(!change_received(change_to_add, pWP)) { logInfo(RTPS_MSG_IN,IDSTRING"MessageReceiver not add change "<sequenceNumber); @@ -302,6 +317,26 @@ bool StatefulReader::processDataFragMsg( if(acceptMsgFrom(incomingChange->writerGUID, &pWP)) { + if (liveliness_lease_duration_ < c_TimeInfinite) + { + if (liveliness_kind_ == MANUAL_BY_TOPIC_LIVELINESS_QOS || + pWP->m_att.liveliness_kind == MANUAL_BY_TOPIC_LIVELINESS_QOS) + { + auto wlp = this->mp_RTPSParticipant->wlp(); + if ( wlp != nullptr) + { + wlp->sub_liveliness_manager_->assert_liveliness( + incomingChange->writerGUID, + liveliness_kind_, + liveliness_lease_duration_); + } + else + { + logError(RTPS_LIVELINESS, "Finite liveliness lease duration but WLP not enabled"); + } + } + } + // Check if CacheChange was received. if(!pWP->change_was_received(incomingChange->sequenceNumber)) { @@ -335,17 +370,11 @@ bool StatefulReader::processDataFragMsg( releaseCache(change_to_add); #endif - // Assertion has to be done before call change_received, - // because this function can unlock the StatefulReader mutex. - if(pWP != nullptr) - { - pWP->assertLiveliness(); //Asser liveliness since you have received a DATA MESSAGE. - } - if(change_completed != nullptr) { if(!change_received(change_completed, pWP)) { + logInfo(RTPS_MSG_IN, IDSTRING"MessageReceiver not add change " << change_completed->sequenceNumber.to64long()); // Assert liveliness because it is a participant discovery info. @@ -379,6 +408,7 @@ bool StatefulReader::processHeartbeatMsg( { std::unique_lock wpLock(*pWP->getMutex()); + if(pWP->m_lastHeartbeatCount < hbCount) { // If it is the first heartbeat message, we can try to cancel initial ack. @@ -415,11 +445,27 @@ bool StatefulReader::processHeartbeatMsg( pWP->mp_heartbeatResponse->restart_timer(); } } - - //FIXME: livelinessFlag - if(livelinessFlag )//TODOG && WP->m_att->m_qos.m_liveliness.kind == MANUAL_BY_TOPIC_LIVELINESS_QOS) + else if (livelinessFlag) { - pWP->assertLiveliness(); + if (liveliness_lease_duration_ < c_TimeInfinite) + { + if (liveliness_kind_ == MANUAL_BY_TOPIC_LIVELINESS_QOS || + pWP->m_att.liveliness_kind == MANUAL_BY_TOPIC_LIVELINESS_QOS) + { + auto wlp = this->mp_RTPSParticipant->wlp(); + if ( wlp != nullptr) + { + wlp->sub_liveliness_manager_->assert_liveliness( + writerGUID, + liveliness_kind_, + liveliness_lease_duration_); + } + else + { + logError(RTPS_LIVELINESS, "Finite liveliness lease duration but WLP not enabled"); + } + } + } } wpLock.unlock(); @@ -603,24 +649,6 @@ bool StatefulReader::nextUntakenCache( takeok = true; break; - // if((*it)->kind == ALIVE) - // { - // this->mp_type->deserialize(&(*it)->serializedPayload,data); - // } - // (*it)->isRead = true; - // if(info!=NULL) - // { - // info->sampleKind = (*it)->kind; - // info->writerGUID = (*it)->writerGUID; - // info->sourceTimestamp = (*it)->sourceTimestamp; - // info->iHandle = (*it)->instanceHandle; - // if(this->m_qos.m_ownership.kind == EXCLUSIVE_OWNERSHIP_QOS) - // info->ownershipStrength = wp->m_data->m_qos.m_ownershipStrength.value; - // } - // m_reader_cache.decreaseUnreadCount(); - // logInfo(RTPS_READER,this->getGuid().entityId<<": reading change "<< (*it)->sequenceNumber.to64long()); - // readok = true; - // break; } } else diff --git a/src/cpp/rtps/reader/StatelessReader.cpp b/src/cpp/rtps/reader/StatelessReader.cpp index 49bbd9d224f..5bea210017e 100644 --- a/src/cpp/rtps/reader/StatelessReader.cpp +++ b/src/cpp/rtps/reader/StatelessReader.cpp @@ -22,6 +22,9 @@ #include #include #include +#include +#include +#include #include "../participant/RTPSParticipantImpl.h" #include "FragmentedChangePitStop.h" @@ -58,33 +61,76 @@ StatelessReader::StatelessReader( bool StatelessReader::matched_writer_add(RemoteWriterAttributes& wdata) { std::lock_guard guard(mp_mutex); - for(auto it = m_matched_writers.begin();it!=m_matched_writers.end();++it) + + for(const RemoteWriterAttributes& rwa : m_matched_writers) { - if((*it).guid == wdata.guid) + if(rwa.guid == wdata.guid) + { return false; + } } getRTPSParticipant()->createSenderResources(wdata.endpoint.remoteLocatorList, false); logInfo(RTPS_READER,"Writer " << wdata.guid << " added to "<mp_RTPSParticipant->wlp(); + if ( wlp != nullptr) + { + wlp->sub_liveliness_manager_->add_writer( + wdata.guid, + liveliness_kind_, + liveliness_lease_duration_); + } + else + { + logError(RTPS_LIVELINESS, "Finite liveliness lease duration but WLP not enabled"); + } + } + return true; } + bool StatelessReader::matched_writer_remove(const RemoteWriterAttributes& wdata) { std::lock_guard guard(mp_mutex); + for(auto it = m_matched_writers.begin();it!=m_matched_writers.end();++it) { if((*it).guid == wdata.guid) { logInfo(RTPS_READER,"Writer " <mp_RTPSParticipant->wlp(); + if ( wlp != nullptr) + { + wlp->sub_liveliness_manager_->remove_writer( + wdata.guid, + liveliness_kind_, + liveliness_lease_duration_); + } + else + { + logError(RTPS_LIVELINESS, + "Finite liveliness lease duration but WLP not enabled, cannot remove writer"); + } + } + m_matched_writers.erase(it); remove_persistence_guid(wdata); + return true; } } + return false; } @@ -174,6 +220,47 @@ bool StatelessReader::processDataMsg(CacheChange_t *change) { logInfo(RTPS_MSG_IN,IDSTRING"Trying to add change " << change->sequenceNumber <<" TO reader: "<< getGuid().entityId); + if (liveliness_lease_duration_ < c_TimeInfinite) + { + if (liveliness_kind_ == MANUAL_BY_TOPIC_LIVELINESS_QOS) + { + auto wlp = this->mp_RTPSParticipant->wlp(); + if ( wlp != nullptr) + { + wlp->sub_liveliness_manager_->assert_liveliness( + change->writerGUID, + liveliness_kind_, + liveliness_lease_duration_); + } + else + { + logError(RTPS_LIVELINESS, "Finite liveliness lease duration but WLP not enabled"); + } + } + else + { + RemoteWriterAttributes att; + if (find_remote_writer_attributes( + change->writerGUID, + att) && + att.liveliness_kind == MANUAL_BY_TOPIC_LIVELINESS_QOS) + { + auto wlp = this->mp_RTPSParticipant->wlp(); + if ( wlp != nullptr) + { + wlp->sub_liveliness_manager_->assert_liveliness( + change->writerGUID, + liveliness_kind_, + liveliness_lease_duration_); + } + else + { + logError(RTPS_LIVELINESS, "Finite liveliness lease duration but WLP not enabled"); + } + } + } + } + CacheChange_t* change_to_add; if(reserveCache(&change_to_add, change->serializedPayload.length)) //Reserve a new cache from the corresponding cache pool @@ -226,7 +313,10 @@ bool StatelessReader::processDataMsg(CacheChange_t *change) return true; } -bool StatelessReader::processDataFragMsg(CacheChange_t *incomingChange, uint32_t sampleSize, uint32_t fragmentStartingNum) +bool StatelessReader::processDataFragMsg( + CacheChange_t *incomingChange, + uint32_t sampleSize, + uint32_t fragmentStartingNum) { assert(incomingChange); @@ -234,6 +324,47 @@ bool StatelessReader::processDataFragMsg(CacheChange_t *incomingChange, uint32_t if (acceptMsgFrom(incomingChange->writerGUID)) { + if (liveliness_lease_duration_ < c_TimeInfinite) + { + if (liveliness_kind_ == MANUAL_BY_TOPIC_LIVELINESS_QOS) + { + auto wlp = this->mp_RTPSParticipant->wlp(); + if ( wlp != nullptr) + { + wlp->sub_liveliness_manager_->assert_liveliness( + incomingChange->writerGUID, + liveliness_kind_, + liveliness_lease_duration_); + } + else + { + logError(RTPS_LIVELINESS, "Finite liveliness lease duration but WLP not enabled"); + } + } + else + { + RemoteWriterAttributes att; + if (find_remote_writer_attributes( + incomingChange->writerGUID, + att) && + att.liveliness_kind == MANUAL_BY_TOPIC_LIVELINESS_QOS) + { + auto wlp = this->mp_RTPSParticipant->wlp(); + if ( wlp != nullptr) + { + wlp->sub_liveliness_manager_->assert_liveliness( + incomingChange->writerGUID, + liveliness_kind_, + liveliness_lease_duration_); + } + else + { + logError(RTPS_LIVELINESS, "Finite liveliness lease duration but WLP not enabled"); + } + } + } + } + // Check if CacheChange was received. if(!thereIsUpperRecordOf(incomingChange->writerGUID, incomingChange->sequenceNumber)) { @@ -341,3 +472,18 @@ bool StatelessReader::thereIsUpperRecordOf(GUID_t& guid, SequenceNumber_t& seq) { return get_last_notified(guid) >= seq; } + +bool StatelessReader::find_remote_writer_attributes( + const GUID_t& guid, + RemoteWriterAttributes& att) +{ + for (const RemoteWriterAttributes& rwa : m_matched_writers) + { + if (rwa.guid == guid) + { + att = rwa; + return true; + } + } + return false; +} diff --git a/src/cpp/rtps/reader/WriterProxy.cpp b/src/cpp/rtps/reader/WriterProxy.cpp index d222437dd10..c46e173cd47 100644 --- a/src/cpp/rtps/reader/WriterProxy.cpp +++ b/src/cpp/rtps/reader/WriterProxy.cpp @@ -26,7 +26,6 @@ #include #include -#include #include using namespace eprosima::fastrtps::rtps; @@ -90,48 +89,34 @@ void WriterProxy::for_each_set_status_from_and_maybe_remove(decltype(WriterProxy } } -static const int WRITERPROXY_LIVELINESS_PERIOD_MULTIPLIER = 1; - - WriterProxy::~WriterProxy() { if(mp_initialAcknack != nullptr) delete(mp_initialAcknack); - if(mp_writerProxyLiveliness!=nullptr) - delete(mp_writerProxyLiveliness); delete(mp_heartbeatResponse); delete(mp_mutex); } -WriterProxy::WriterProxy(const RemoteWriterAttributes& watt, - StatefulReader* SR) : - mp_SFR(SR), - m_att(watt), - m_lastHeartbeatCount(0), - mp_heartbeatResponse(nullptr), - mp_writerProxyLiveliness(nullptr), - mp_initialAcknack(nullptr), - m_heartbeatFinalFlag(false), - m_isAlive(true), - mp_mutex(new std::recursive_mutex()) - +WriterProxy::WriterProxy( + const RemoteWriterAttributes& watt, + StatefulReader* SR) + : mp_SFR(SR) + , m_att(watt) + , m_lastHeartbeatCount(0) + , mp_heartbeatResponse(nullptr) + , mp_initialAcknack(nullptr) + , m_heartbeatFinalFlag(false) + , mp_mutex(new std::recursive_mutex()) { m_changesFromW.clear(); //Create Events - mp_writerProxyLiveliness = new WriterProxyLiveliness( - this, - TimeConv::Duration_t2MilliSecondsDouble(m_att.livelinessLeaseDuration) * - WRITERPROXY_LIVELINESS_PERIOD_MULTIPLIER); - mp_heartbeatResponse = new HeartbeatResponseDelay( this, TimeConv::Duration_t2MilliSecondsDouble(mp_SFR->getTimes().heartbeatResponseDelay)); mp_initialAcknack = new InitialAckNack( this, TimeConv::Duration_t2MilliSecondsDouble(mp_SFR->getTimes().initialAcknackDelay)); - if(m_att.livelinessLeaseDuration < c_TimeInfinite) - mp_writerProxyLiveliness->restart_timer(); logInfo(RTPS_READER,"Writer Proxy created in reader: "<getGuid().entityId); } @@ -371,19 +356,6 @@ void WriterProxy::print_changes_fromWriter_test2() logInfo(RTPS_READER,auxstr;); } -void WriterProxy::assertLiveliness() -{ - - logInfo(RTPS_READER,this->m_att.guid.entityId << " Liveliness asserted"); - - //std::lock_guard guard(*mp_mutex); - - m_isAlive=true; - - this->mp_writerProxyLiveliness->cancel_timer(); - this->mp_writerProxyLiveliness->restart_timer(); -} - void WriterProxy::setNotValid(const SequenceNumber_t& seqNum) { std::lock_guard guard(*mp_mutex); diff --git a/src/cpp/rtps/reader/timedevent/WriterProxyLiveliness.cpp b/src/cpp/rtps/reader/timedevent/WriterProxyLiveliness.cpp deleted file mode 100644 index f33fbebb760..00000000000 --- a/src/cpp/rtps/reader/timedevent/WriterProxyLiveliness.cpp +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @file WriterProxyLiveliness.cpp - * - */ - -#include -#include -#include -#include -#include -#include - -#include "../../participant/RTPSParticipantImpl.h" - -#include - - - -namespace eprosima { -namespace fastrtps{ -namespace rtps { - - -WriterProxyLiveliness::WriterProxyLiveliness( - WriterProxy* p_WP, - double interval) - : TimedEvent( - p_WP->mp_SFR->getRTPSParticipant()->getEventResource().getIOService(), - p_WP->mp_SFR->getRTPSParticipant()->getEventResource().getThread(), - interval, - TimedEvent::ON_SUCCESS) - , mp_WP(p_WP) -{ -} - -WriterProxyLiveliness::~WriterProxyLiveliness() -{ - destroy(); -} - -void WriterProxyLiveliness::event(EventCode code, const char* msg) -{ - // Unused in release mode. - (void)msg; - - if(code == EVENT_SUCCESS) - { - - logInfo(RTPS_LIVELINESS,"Deleting Writer: "<m_att.guid); -// if(!mp_WP->isAlive()) -// { - //logWarning(RTPS_LIVELINESS,"Liveliness failed, leaseDuration was "<< this->getIntervalMilliSec()<< " ms"); - if(mp_WP->mp_SFR->matched_writer_remove(mp_WP->m_att,false)) - { - if(mp_WP->mp_SFR->getListener()!=nullptr) - { - MatchingInfo info(REMOVED_MATCHING,mp_WP->m_att.guid); - mp_WP->mp_SFR->getListener()->onReaderMatched((RTPSReader*)mp_WP->mp_SFR,info); - } - } - - mp_WP->mp_writerProxyLiveliness = nullptr; - delete(mp_WP); -// } -// mp_WP->setNotAlive(); -// this->restart_timer(); - } - else if(code == EVENT_ABORT) - { - logInfo(RTPS_LIVELINESS, "WriterProxyLiveliness aborted"); - } - else - { - logInfo(RTPS_LIVELINESS,"message: " <sequenceNumber; if(security_manager_.participant_stateless_message_writer_history_->add_change(p_change)) { - remote_participant_info->change_sequence_number_ = p_change->sequenceNumber; + remote_participant_info->change_sequence_number_ = seq_number; } //TODO (Ricardo) What to do if not added? } diff --git a/src/cpp/rtps/writer/LivelinessManager.cpp b/src/cpp/rtps/writer/LivelinessManager.cpp new file mode 100644 index 00000000000..615027e7b8e --- /dev/null +++ b/src/cpp/rtps/writer/LivelinessManager.cpp @@ -0,0 +1,336 @@ +#include +#include + +#include + +using namespace std::chrono; + +namespace eprosima { +namespace fastrtps { +namespace rtps { + +using LivelinessDataIterator = ResourceLimitedVector::iterator; + +LivelinessManager::LivelinessManager( + const LivelinessCallback& callback, + asio::io_service& service, + const std::thread& event_thread, + bool manage_automatic) + : callback_(callback) + , manage_automatic_(manage_automatic) + , writers_() + , mutex_() + , timer_owner_(nullptr) + , timer_( + std::bind(&LivelinessManager::timer_expired, this), + 0, + service, + event_thread) +{ +} + +LivelinessManager::~LivelinessManager() +{ + std::unique_lock lock(mutex_); + timer_owner_ = nullptr; + timer_.cancel_timer(); +} + +bool LivelinessManager::add_writer( + GUID_t guid, + LivelinessQosPolicyKind kind, + Duration_t lease_duration) +{ + std::unique_lock lock(mutex_); + + if (!manage_automatic_ && kind == AUTOMATIC_LIVELINESS_QOS) + { + logWarning(RTPS_WRITER, "Liveliness manager not managing automatic writers, writer not added"); + return false; + } + + for (LivelinessData& writer : writers_) + { + if (writer.guid == guid && + writer.kind == kind && + writer.lease_duration == lease_duration) + { + writer.count++; + return true; + } + } + writers_.emplace_back(guid, kind, lease_duration); + return true; +} + +bool LivelinessManager::remove_writer( + GUID_t guid, + LivelinessQosPolicyKind kind, + Duration_t lease_duration) +{ + std::unique_lock lock(mutex_); + + for (LivelinessData& writer: writers_) + { + if (writer.guid == guid && + writer.kind == kind && + writer.lease_duration == lease_duration) + { + if (--writer.count == 0) + { + writers_.remove(writer); + + if (callback_ != nullptr) + { + if (writer.status == LivelinessData::WriterStatus::ALIVE) + { + callback_(writer.guid, + writer.kind, + writer.lease_duration, + -1, + 0); + } + else if (writer.status == LivelinessData::WriterStatus::NOT_ALIVE) + { + callback_(writer.guid, + writer.kind, + writer.lease_duration, + 0, + -1); + } + } + + if (timer_owner_ != nullptr && timer_owner_->guid == guid) + { + timer_owner_ = nullptr; + if (!calculate_next()) + { + timer_.cancel_timer(); + return true; + } + + // Some times the interval could be negative if a writer expired during the call to this function + // Once in this situation there is not much we can do but let asio timers expire inmediately + auto interval = timer_owner_->time - steady_clock::now(); + timer_.update_interval_millisec((double)duration_cast(interval).count()); + timer_.restart_timer(); + } + return true; + } + } + } + + return false; +} + +bool LivelinessManager::assert_liveliness( + GUID_t guid, + LivelinessQosPolicyKind kind, + Duration_t lease_duration) +{ + std::unique_lock lock(mutex_); + + ResourceLimitedVector::iterator wit; + if (!find_writer( + guid, + kind, + lease_duration, + &wit)) + { + return false; + } + + timer_.cancel_timer(); + + if (wit->kind == MANUAL_BY_PARTICIPANT_LIVELINESS_QOS || + wit->kind == AUTOMATIC_LIVELINESS_QOS) + { + for (LivelinessData& w: writers_) + { + if (w.kind == wit->kind) + { + assert_writer_liveliness(w); + } + } + } + else if (wit->kind == MANUAL_BY_TOPIC_LIVELINESS_QOS) + { + assert_writer_liveliness(*wit); + } + + // Updates the timer owner + if (!calculate_next()) + { + logError(RTPS_WRITER, "Error when restarting liveliness timer"); + return false; + } + + // Some times the interval could be negative if a writer expired during the call to this function + // Once in this situation there is not much we can do but let asio timers expire inmediately + auto interval = timer_owner_->time - steady_clock::now(); + timer_.update_interval_millisec((double)duration_cast(interval).count()); + timer_.restart_timer(); + + return true; +} + +bool LivelinessManager::assert_liveliness(LivelinessQosPolicyKind kind) +{ + std::unique_lock lock(mutex_); + + if (!manage_automatic_ && kind == AUTOMATIC_LIVELINESS_QOS) + { + logWarning(RTPS_WRITER, "Liveliness manager not managing automatic writers, writer not added"); + return false; + } + + if (writers_.empty()) + { + return true; + } + + timer_.cancel_timer(); + + for (LivelinessData& writer: writers_) + { + if (writer.kind == kind) + { + assert_writer_liveliness(writer); + } + } + + // Updates the timer owner + if (!calculate_next()) + { + logError(RTPS_WRITER, "Error when restarting liveliness timer: " << writers_.size() << " writers, liveliness " << kind); + return false; + } + + // Some times the interval could be negative if a writer expired during the call to this function + // Once in this situation there is not much we can do but let asio timers expire inmediately + auto interval = timer_owner_->time - steady_clock::now(); + timer_.update_interval_millisec((double)duration_cast(interval).count()); + timer_.restart_timer(); + + return true; +} + +bool LivelinessManager::calculate_next() +{ + + timer_owner_ = nullptr; + + steady_clock::time_point min_time = steady_clock::now() + nanoseconds(c_TimeInfinite.to_ns()); + + bool any_alive = false; + + for (LivelinessDataIterator it=writers_.begin(); it!=writers_.end(); ++it) + { + if (it->status == LivelinessData::WriterStatus::ALIVE) + { + if (it->time < min_time) + { + min_time = it->time; + timer_owner_ = &*it; + } + any_alive = true; + } + } + return any_alive; +} + +void LivelinessManager::timer_expired() +{ + std::unique_lock lock(mutex_); + + if (timer_owner_ == nullptr) + { + logError(RTPS_WRITER, "Liveliness timer expired but there is no writer"); + return; + } + + if (callback_ != nullptr) + { + callback_(timer_owner_->guid, + timer_owner_->kind, + timer_owner_->lease_duration, + -1, + 1); + } + timer_owner_->status = LivelinessData::WriterStatus::NOT_ALIVE; + + if (calculate_next()) + { + // Some times the interval could be negative if a writer expired during the call to this function + // Once in this situation there is not much we can do but let asio timers expire inmediately + auto interval = timer_owner_->time - steady_clock::now(); + timer_.update_interval_millisec((double)duration_cast(interval).count()); + timer_.restart_timer(); + } +} + +bool LivelinessManager::find_writer( + const GUID_t& guid, + const LivelinessQosPolicyKind& kind, + const Duration_t& lease_duration, + ResourceLimitedVector::iterator *wit_out) +{ + for (LivelinessDataIterator it=writers_.begin(); it!=writers_.end(); ++it) + { + if (it->guid == guid && + it->kind == kind && + it->lease_duration == lease_duration) + { + *wit_out = it; + return true; + } + } + return false; +} + +bool LivelinessManager::is_any_alive(LivelinessQosPolicyKind kind) +{ + for (const auto& writer : writers_) + { + if (writer.kind == kind && writer.status == LivelinessData::WriterStatus::ALIVE) + { + return true; + } + } + return false; +} + +void LivelinessManager::assert_writer_liveliness(LivelinessData& writer) +{ + if (callback_ != nullptr) + { + if (writer.status == LivelinessData::WriterStatus::NOT_ASSERTED) + { + callback_(writer.guid, + writer.kind, + writer.lease_duration, + 1, + 0); + } + else if (writer.status == LivelinessData::WriterStatus::NOT_ALIVE) + { + callback_(writer.guid, + writer.kind, + writer.lease_duration, + 1, + -1); + } + } + + writer.status = LivelinessData::WriterStatus::ALIVE; + writer.time = steady_clock::now() + nanoseconds(writer.lease_duration.to_ns()); +} + +const ResourceLimitedVector& LivelinessManager::get_liveliness_data() const +{ + return writers_; +} + +} +} +} diff --git a/src/cpp/rtps/writer/RTPSWriter.cpp b/src/cpp/rtps/writer/RTPSWriter.cpp index f25298d81bd..3bbd5f2a4d1 100644 --- a/src/cpp/rtps/writer/RTPSWriter.cpp +++ b/src/cpp/rtps/writer/RTPSWriter.cpp @@ -46,7 +46,6 @@ RTPSWriter::RTPSWriter( impl->getMaxMessageSize() > impl->getRTPSParticipantAttributes().throughputController.bytesPerPeriod ? impl->getRTPSParticipantAttributes().throughputController.bytesPerPeriod : impl->getMaxMessageSize(), impl->getGuid().guidPrefix) - , m_livelinessAsserted(false) , mp_history(hist) , mp_listener(listen) , is_async_(att.mode == SYNCHRONOUS_WRITER ? false : true) @@ -55,6 +54,8 @@ RTPSWriter::RTPSWriter( #if HAVE_SECURITY , encrypt_payload_(mp_history->getTypeMaxSerialized()) #endif + , liveliness_kind_(att.liveliness_kind) + , liveliness_lease_duration_(att.liveliness_lease_duration) { mp_history->mp_writer = this; mp_history->mp_mutex = &mp_mutex; @@ -71,8 +72,10 @@ RTPSWriter::~RTPSWriter() mp_history->mp_mutex = nullptr; } -CacheChange_t* RTPSWriter::new_change(const std::function& dataCdrSerializedSize, - ChangeKind_t changeKind, InstanceHandle_t handle) +CacheChange_t* RTPSWriter::new_change( + const std::function& dataCdrSerializedSize, + ChangeKind_t changeKind, + InstanceHandle_t handle) { logInfo(RTPS_WRITER, "Creating new change"); CacheChange_t* ch = nullptr; @@ -233,6 +236,16 @@ bool RTPSWriter::encrypt_cachechange(CacheChange_t* change) } #endif +const LivelinessQosPolicyKind& RTPSWriter::get_liveliness_kind() const +{ + return liveliness_kind_; +} + +const Duration_t& RTPSWriter::get_liveliness_lease_duration() const +{ + return liveliness_lease_duration_; +} + } // namespace rtps } // namespace fastrtps } // namespace eprosima diff --git a/src/cpp/rtps/writer/StatefulWriter.cpp b/src/cpp/rtps/writer/StatefulWriter.cpp index 1effd56601f..42ad9b29509 100644 --- a/src/cpp/rtps/writer/StatefulWriter.cpp +++ b/src/cpp/rtps/writer/StatefulWriter.cpp @@ -40,6 +40,9 @@ #include #include +#include +#include + #include "RTPSWriterCollector.h" #include "StatefulWriterOrganizer.h" @@ -109,6 +112,12 @@ StatefulWriter::~StatefulWriter() delete ack_timer_; } + if(nack_response_event_ != nullptr) + { + delete(nack_response_event_); + nack_response_event_ = nullptr; + } + // Stop all active proxies and pass them to the pool while (!matched_readers_.empty()) { @@ -118,12 +127,6 @@ StatefulWriter::~StatefulWriter() matched_readers_pool_.push_back(remote_reader); } - if(nack_response_event_ != nullptr) - { - delete(nack_response_event_); - nack_response_event_ = nullptr; - } - // Destroy heartbeat event if (mp_periodicHB != nullptr) { @@ -136,6 +139,7 @@ StatefulWriter::~StatefulWriter() { delete(remote_reader); } + } /* @@ -152,9 +156,6 @@ void StatefulWriter::unsent_change_added_to_history( encrypt_cachechange(change); #endif - //TODO Think about when set liveliness assertion when writer is asynchronous. - this->setLivelinessAsserted(true); - if(!matched_readers_.empty()) { if(!isAsync()) @@ -279,6 +280,14 @@ void StatefulWriter::unsent_change_added_to_history( ack_timer_->update_interval_millisec((double)duration_cast(interval).count()); ack_timer_->restart_timer(); } + + if (liveliness_lease_duration_ < c_TimeInfinite) + { + mp_RTPSParticipant->wlp()->assert_liveliness( + getGuid(), + liveliness_kind_, + liveliness_lease_duration_); + } } else { @@ -1005,7 +1014,9 @@ SequenceNumber_t StatefulWriter::next_sequence_number() const return mp_history->next_sequence_number(); } -bool StatefulWriter::send_periodic_heartbeat() +bool StatefulWriter::send_periodic_heartbeat( + bool final, + bool liveliness) { std::lock_guard guardW(mp_mutex); @@ -1016,13 +1027,12 @@ bool StatefulWriter::send_periodic_heartbeat() { if (it->has_unacknowledged()) { - // FinalFlag is always false because this class is used only by StatefulWriter in Reliable. - send_heartbeat_to_nts(*it); + send_heartbeat_to_nts(*it, liveliness); unacked_changes = true; } } } - else + else if (!liveliness) { SequenceNumber_t firstSeq, lastSeq; @@ -1047,13 +1057,19 @@ bool StatefulWriter::send_periodic_heartbeat() { try { - RTPSMessageGroup group(mp_RTPSParticipant, this, RTPSMessageGroup::WRITER, m_cdrmessages, - mAllShrinkedLocatorList, all_remote_readers_); + RTPSMessageGroup group( + mp_RTPSParticipant, + this, + RTPSMessageGroup::WRITER, + m_cdrmessages, + mAllShrinkedLocatorList, + all_remote_readers_); send_heartbeat_nts_( all_remote_readers_, mAllShrinkedLocatorList, group, - disable_positive_acks_); + disable_positive_acks_, + liveliness); } catch(const RTPSMessageGroup::timeout&) { @@ -1062,11 +1078,37 @@ bool StatefulWriter::send_periodic_heartbeat() } } } + else + { + // This is a liveliness heartbeat, we don't care about checking sequence numbers + try + { + RTPSMessageGroup group( + mp_RTPSParticipant, + this, + RTPSMessageGroup::WRITER, + m_cdrmessages, + mAllShrinkedLocatorList, + all_remote_readers_); + send_heartbeat_nts_( + all_remote_readers_, + mAllShrinkedLocatorList, + group, + final, + liveliness); + } + catch(const RTPSMessageGroup::timeout&) + { + logError(RTPS_WRITER, "Max blocking time reached"); + } + } return unacked_changes; } -void StatefulWriter::send_heartbeat_to_nts(ReaderProxy& remoteReaderProxy) +void StatefulWriter::send_heartbeat_to_nts( + ReaderProxy& remoteReaderProxy, + bool liveliness) { try { @@ -1079,7 +1121,8 @@ void StatefulWriter::send_heartbeat_to_nts(ReaderProxy& remoteReaderProxy) guids, locators, group, - disable_positive_acks_); + disable_positive_acks_, + liveliness); } catch(const RTPSMessageGroup::timeout&) { @@ -1088,10 +1131,11 @@ void StatefulWriter::send_heartbeat_to_nts(ReaderProxy& remoteReaderProxy) } void StatefulWriter::send_heartbeat_nts_( - const std::vector& remote_readers, - const LocatorList_t& locators, - RTPSMessageGroup& message_group, - bool final) + const std::vector& remote_readers, + const LocatorList_t& locators, + RTPSMessageGroup& message_group, + bool final, + bool liveliness) { SequenceNumber_t firstSeq = get_seq_num_min(); @@ -1101,7 +1145,7 @@ void StatefulWriter::send_heartbeat_nts_( { assert(firstSeq == c_SequenceNumber_Unknown && lastSeq == c_SequenceNumber_Unknown); - if(remote_readers.size() == 1) + if(remote_readers.size() == 1 || liveliness) { firstSeq = next_sequence_number(); lastSeq = firstSeq - 1; @@ -1117,15 +1161,13 @@ void StatefulWriter::send_heartbeat_nts_( } incrementHBCount(); - - // FinalFlag is always false because this class is used only by StatefulWriter in Reliable. message_group.add_heartbeat( remote_readers, firstSeq, lastSeq, m_heartbeatCount, final, - false, + liveliness, locators); // Update calculate of heartbeat piggyback. currentUsageSendBufferSize_ = static_cast(sendBufferSize_); diff --git a/src/cpp/rtps/writer/StatelessWriter.cpp b/src/cpp/rtps/writer/StatelessWriter.cpp index ec088cbd74b..6b58ce4d28a 100644 --- a/src/cpp/rtps/writer/StatelessWriter.cpp +++ b/src/cpp/rtps/writer/StatelessWriter.cpp @@ -25,6 +25,8 @@ #include "../flowcontrol/FlowController.h" #include "../history/HistoryAttributesExtension.hpp" #include "RTPSWriterCollector.h" +#include +#include #include #include @@ -112,8 +114,6 @@ void StatelessWriter::unsent_change_added_to_history( { try { - setLivelinessAsserted(true); - if(m_separateSendingEnabled) { std::vector guids(1); @@ -161,6 +161,14 @@ void StatelessWriter::unsent_change_added_to_history( unsent_changes_.push_back(ChangeForReader_t(change)); AsyncWriterThread::wakeUp(this); } + + if (liveliness_lease_duration_ < c_TimeInfinite) + { + mp_RTPSParticipant->wlp()->assert_liveliness( + getGuid(), + liveliness_kind_, + liveliness_lease_duration_); + } } else { diff --git a/src/cpp/subscriber/Subscriber.cpp b/src/cpp/subscriber/Subscriber.cpp index b7a0ffa3a5e..f38f12c3f97 100644 --- a/src/cpp/subscriber/Subscriber.cpp +++ b/src/cpp/subscriber/Subscriber.cpp @@ -71,6 +71,5 @@ void Subscriber::get_requested_deadline_missed_status(RequestedDeadlineMissedSta void Subscriber::get_liveliness_changed_status(LivelinessChangedStatus &status) { - (void)status; - logWarning(SUBSCRIBER, "get_liveliness_changed_status is not implemented yet"); + mp_impl->get_liveliness_changed_status(status); } diff --git a/src/cpp/subscriber/SubscriberImpl.cpp b/src/cpp/subscriber/SubscriberImpl.cpp index d341d4a7a85..0b1947e4f30 100644 --- a/src/cpp/subscriber/SubscriberImpl.cpp +++ b/src/cpp/subscriber/SubscriberImpl.cpp @@ -233,6 +233,20 @@ void SubscriberImpl::SubscriberReaderListener::onReaderMatched(RTPSReader* /*rea } } +void SubscriberImpl::SubscriberReaderListener::on_liveliness_changed( + RTPSReader *reader, + const LivelinessChangedStatus &status) +{ + (void)reader; + + if (mp_subscriberImpl->mp_listener != nullptr) + { + mp_subscriberImpl->mp_listener->on_liveliness_changed( + mp_subscriberImpl->mp_userSubscriber, + status); + } +} + bool SubscriberImpl::onNewCacheChangeAdded(const CacheChange_t* const change_in) { if (m_att.qos.m_deadline.period != c_TimeInfinite) @@ -402,5 +416,15 @@ void SubscriberImpl::lifespan_expired() lifespan_timer_.restart_timer(); } +void SubscriberImpl::get_liveliness_changed_status(LivelinessChangedStatus &status) +{ + std::unique_lock lock(mp_reader->getMutex()); + + status = mp_reader->liveliness_changed_status_; + + mp_reader->liveliness_changed_status_.alive_count_change = 0u; + mp_reader->liveliness_changed_status_.not_alive_count_change = 0u; +} + } /* namespace fastrtps */ } /* namespace eprosima */ diff --git a/src/cpp/subscriber/SubscriberImpl.h b/src/cpp/subscriber/SubscriberImpl.h index f22a1230be7..f2eb8a6c823 100644 --- a/src/cpp/subscriber/SubscriberImpl.h +++ b/src/cpp/subscriber/SubscriberImpl.h @@ -134,6 +134,12 @@ class SubscriberImpl { */ void get_requested_deadline_missed_status(RequestedDeadlineMissedStatus& status); + /** + * @brief Returns the liveliness changed status + * @param status Liveliness changed status + */ + void get_liveliness_changed_status(LivelinessChangedStatus& status); + private: //!Participant @@ -161,6 +167,9 @@ class SubscriberImpl { void onNewCacheChangeAdded( rtps::RTPSReader* reader, const rtps::CacheChange_t* const change) override; + void on_liveliness_changed( + rtps::RTPSReader* reader, + const LivelinessChangedStatus& status) override; SubscriberImpl* mp_subscriberImpl; } m_readerListener; diff --git a/src/cpp/transport/UDPChannelResource.cpp b/src/cpp/transport/UDPChannelResource.cpp index c5fdd6897f1..1c3a4d7e9b2 100644 --- a/src/cpp/transport/UDPChannelResource.cpp +++ b/src/cpp/transport/UDPChannelResource.cpp @@ -13,39 +13,108 @@ // limitations under the License. #include +#include #include #include +#include namespace eprosima { namespace fastrtps { namespace rtps { -UDPChannelResource::UDPChannelResource(eProsimaUDPSocket& socket) - : message_receiver_(nullptr) +UDPChannelResource::UDPChannelResource( + UDPTransportInterface* transport, + eProsimaUDPSocket& socket, + uint32_t maxMsgSize, + const Locator_t& locator, + const std::string& sInterface, + TransportReceiverInterface* receiver) + : ChannelResource(maxMsgSize) + , message_receiver_(receiver) , socket_(moveSocket(socket)) , only_multicast_purpose_(false) + , interface_(sInterface) + , transport_(transport) { + thread(std::thread(&UDPChannelResource::perform_listen_operation, this, locator)); } -UDPChannelResource::UDPChannelResource(eProsimaUDPSocket& socket, uint32_t maxMsgSize) - : ChannelResource(maxMsgSize) - , message_receiver_(nullptr) - , socket_(moveSocket(socket)) - , only_multicast_purpose_(false) +UDPChannelResource::~UDPChannelResource() { + message_receiver_ = nullptr; } -UDPChannelResource::UDPChannelResource(UDPChannelResource&& channelResource) - : message_receiver_(channelResource.message_receiver_) - , socket_(moveSocket(channelResource.socket_)) - , only_multicast_purpose_(channelResource.only_multicast_purpose_) +void UDPChannelResource::perform_listen_operation(Locator_t input_locator) { - channelResource.message_receiver_ = nullptr; + Locator_t remote_locator; + + while (alive()) + { + // Blocking receive. + auto& msg = message_buffer(); + if (!Receive(msg.buffer, msg.max_size, msg.length, remote_locator)) + { + continue; + } + + // Processes the data through the CDR Message interface. + if (message_receiver() != nullptr) + { + message_receiver()->OnDataReceived(msg.buffer, msg.length, input_locator, remote_locator); + } + else if (alive()) + { + logWarning(RTPS_MSG_IN, "Received Message, but no receiver attached"); + } + } + + message_receiver(nullptr); } -UDPChannelResource::~UDPChannelResource() +bool UDPChannelResource::Receive( + octet* receive_buffer, + uint32_t receive_buffer_capacity, + uint32_t& receive_buffer_size, + Locator_t& remote_locator) { - message_receiver_ = nullptr; + try + { + asio::ip::udp::endpoint senderEndpoint; + + size_t bytes = socket()->receive_from(asio::buffer(receive_buffer, receive_buffer_capacity), senderEndpoint); + receive_buffer_size = static_cast(bytes); + if (receive_buffer_size > 0) + { + // This is not necessary anymore but it's left here for back compatibility with versions older than 1.8.1 + if (receive_buffer_size == 13 && memcmp(receive_buffer, "EPRORTPSCLOSE", 13) == 0) + { + return false; + } + transport_->endpoint_to_locator(senderEndpoint, remote_locator); + } + return (receive_buffer_size > 0); + } + catch (const std::exception& error) + { + (void)error; + logWarning(RTPS_MSG_OUT, "Error receiving data: " << error.what() << " - " << message_receiver() + << " (" << this << ")"); + return false; + } +} + +void UDPChannelResource::release() +{ + // Cancel all asynchronous operations associated with the socket. + socket()->cancel(); + // Disable receives on the socket. + // shutdown always returns a 'shutdown: Transport endpoint is not connected' error, + // since the endpoint is indeed not connected. However, it unblocks the synchronous receive + // in Windows and Linux anyways, which is what we want. + asio::error_code ec; + socket()->shutdown(asio::socket_base::shutdown_type::shutdown_receive, ec); + // On OSX shutdown does not unblock the listening thread, but close does. + socket()->close(); } } // namespace rtps diff --git a/src/cpp/transport/UDPTransportInterface.cpp b/src/cpp/transport/UDPTransportInterface.cpp index 8128c1028a9..90432c9eb96 100644 --- a/src/cpp/transport/UDPTransportInterface.cpp +++ b/src/cpp/transport/UDPTransportInterface.cpp @@ -22,6 +22,7 @@ #include #include #include +#include using namespace std; using namespace asio; @@ -83,30 +84,12 @@ bool UDPTransportInterface::CloseInputChannel(const Locator_t& locator) } - std::map addresses; - // It may sound redundant, but we must mark all the related channel to be killed first. - // Mostly in Windows, but in Linux can happen too, if we access to the endpoint - // of an already closed socket we get an exception. So we store the interface address to - // be used in the ReleaseInputChannel call later. - for (UDPChannelResource* channel_resource : channel_resources) - { - if (channel_resource->alive()) - { - addresses[channel_resource] = channel_resource->socket()->local_endpoint().address(); - } - else - { - addresses[channel_resource] = asio::ip::address(); - } - channel_resource->disable(); - } - - // Then we release the channels + // We now disable and release the channels for (UDPChannelResource* channel : channel_resources) { - ReleaseInputChannel(locator, addresses[channel]); - channel->socket()->cancel(); - channel->socket()->close(); + channel->disable(); + channel->release(); + channel->clear(); delete channel; } @@ -136,7 +119,7 @@ bool UDPTransportInterface::init() { socket_base::send_buffer_size option; socket.get_option(option); - set_send_buffer_size(option.value()); + set_send_buffer_size(static_cast(option.value())); if (configuration()->sendBufferSize < s_minimumSocketBuffer) { @@ -149,7 +132,7 @@ bool UDPTransportInterface::init() { socket_base::receive_buffer_size option; socket.get_option(option); - set_receive_buffer_size(option.value()); + set_receive_buffer_size(static_cast(option.value())); if (configuration()->receiveBufferSize < s_minimumSocketBuffer) { @@ -221,15 +204,17 @@ bool UDPTransportInterface::OpenAndBindInputSockets(const Locator_t& locator, Tr return true; } -UDPChannelResource* UDPTransportInterface::CreateInputChannelResource(const std::string& sInterface, const Locator_t& locator, - bool is_multicast, uint32_t maxMsgSize, TransportReceiverInterface* receiver) +UDPChannelResource* UDPTransportInterface::CreateInputChannelResource( + const std::string& sInterface, + const Locator_t& locator, + bool is_multicast, + uint32_t maxMsgSize, + TransportReceiverInterface* receiver) { - eProsimaUDPSocket unicastSocket = OpenAndBindInputSocket(sInterface, IPLocator::getPhysicalPort(locator), is_multicast); - UDPChannelResource* p_channel_resource = new UDPChannelResource(unicastSocket, maxMsgSize); - p_channel_resource->message_receiver(receiver); - p_channel_resource->interface(sInterface); - p_channel_resource->thread(std::thread(&UDPTransportInterface::perform_listen_operation, this, - p_channel_resource, locator)); + eProsimaUDPSocket unicastSocket = OpenAndBindInputSocket(sInterface, + IPLocator::getPhysicalPort(locator), is_multicast); + UDPChannelResource* p_channel_resource = new UDPChannelResource(this, unicastSocket, maxMsgSize, locator, + sInterface, receiver); return p_channel_resource; } @@ -241,7 +226,7 @@ eProsimaUDPSocket UDPTransportInterface::OpenAndBindUnicastOutputSocket( getSocketPtr(socket)->open(generate_protocol()); if (mSendBufferSize != 0) { - getSocketPtr(socket)->set_option(socket_base::send_buffer_size(mSendBufferSize)); + getSocketPtr(socket)->set_option(socket_base::send_buffer_size(static_cast(mSendBufferSize))); } getSocketPtr(socket)->set_option(ip::multicast::hops(configuration()->TTL)); getSocketPtr(socket)->bind(endpoint); @@ -372,120 +357,6 @@ bool UDPTransportInterface::OpenOutputChannel( return true; } -void UDPTransportInterface::perform_listen_operation(UDPChannelResource* p_channel_resource, Locator_t input_locator) -{ - Locator_t remote_locator; - - while (p_channel_resource->alive()) - { - // Blocking receive. - auto& msg = p_channel_resource->message_buffer(); - if (!Receive(p_channel_resource, msg.buffer, msg.max_size, msg.length, remote_locator)) - { - continue; - } - - // Processes the data through the CDR Message interface. - auto receiver = p_channel_resource->message_receiver(); - if (receiver != nullptr) - { - receiver->OnDataReceived(msg.buffer, msg.length, input_locator, remote_locator); - } - else - { - logWarning(RTPS_MSG_IN, "Received Message, but no receiver attached"); - } - } -} - -bool UDPTransportInterface::Receive(UDPChannelResource* p_channel_resource, octet* receive_buffer, - uint32_t receive_buffer_capacity, uint32_t& receive_buffer_size, Locator_t& remote_locator) -{ - try - { - ip::udp::endpoint senderEndpoint; - - size_t bytes = p_channel_resource->socket()->receive_from(asio::buffer(receive_buffer, receive_buffer_capacity), senderEndpoint); - receive_buffer_size = static_cast(bytes); - if (receive_buffer_size > 0) - { - if (receive_buffer_size == 13 && memcmp(receive_buffer, "EPRORTPSCLOSE", 13) == 0) - { - return false; - } - endpoint_to_locator(senderEndpoint, remote_locator); - } - return (receive_buffer_size > 0); - } - catch (const std::exception& error) - { - (void)error; - logWarning(RTPS_MSG_OUT, "Error receiving data: " << error.what()); - return false; - } -} - -bool UDPTransportInterface::ReleaseInputChannel(const Locator_t& locator, const asio::ip::address& interface_address) -{ - try - { - uint16_t port = IPLocator::getPhysicalPort(locator); - - if(is_interface_whitelist_empty()) - { - Locator_t localLocator; - fill_local_ip(localLocator); - - ip::udp::socket socket(io_service_); - socket.open(generate_protocol()); - socket.bind(generate_local_endpoint(localLocator, 0)); - - // We first send directly to localhost, in case all network interfaces are disabled - // (which would mean that multicast traffic may not be sent) - auto localEndpoint = generate_local_endpoint(localLocator, port); - socket.send_to(asio::buffer("EPRORTPSCLOSE", 13), localEndpoint); - - // We then send to the address of the input locator - auto destinationEndpoint = generate_local_endpoint(locator, port); - - asio::error_code ec; - socket_base::message_flags flags = 0; - - // We ignore the error message because some OS don't allow this functionality like Windows (WSAENETUNREACH) or Mac (EADDRNOTAVAIL) - socket.send_to(asio::buffer("EPRORTPSCLOSE", 13), destinationEndpoint,flags, ec); - - socket.close(); - } - else - { - ip::udp::socket socket(io_service_); - socket.open(generate_protocol()); - socket.bind(asio::ip::udp::endpoint(interface_address, 0)); - - auto localEndpoint = ip::udp::endpoint(interface_address, port); - socket.send_to(asio::buffer("EPRORTPSCLOSE", 13), localEndpoint); - - // We then send to the address of the input locator - auto destinationEndpoint = generate_local_endpoint(locator, port); - - asio::error_code ec; - socket_base::message_flags flags = 0; - - // We ignore the error message because some OS don't allow this functionality like Windows (WSAENETUNREACH) or Mac (EADDRNOTAVAIL) - socket.send_to(asio::buffer("EPRORTPSCLOSE", 13), destinationEndpoint, flags, ec); - - socket.close(); - } - } - catch (const std::exception& error) - { - logError(RTPS_MSG_OUT, "Error: " << error.what()); - return false; - } - - return true; -} - Locator_t UDPTransportInterface::RemoteToMainLocal(const Locator_t& remote) const { if (!IsLocatorSupported(remote)) diff --git a/src/cpp/xmlparser/XMLParser.cpp b/src/cpp/xmlparser/XMLParser.cpp index 9842f2fb67a..30ec8a35113 100644 --- a/src/cpp/xmlparser/XMLParser.cpp +++ b/src/cpp/xmlparser/XMLParser.cpp @@ -2543,8 +2543,9 @@ XMLP_ret XMLParser::loadXML(const std::string& filename, up_base_node_t& root) if (tinyxml2::XMLError::XML_SUCCESS != xmlDoc.LoadFile(filename.c_str())) { if (filename != std::string(DEFAULT_FASTRTPS_PROFILES)) + { logError(XMLPARSER, "Error opening '" << filename << "'"); - + } return XMLP_ret::XML_ERROR; } diff --git a/test/blackbox/BlackboxTests.cpp b/test/blackbox/BlackboxTests.cpp index 68a0529b936..e050a51ef22 100644 --- a/test/blackbox/BlackboxTests.cpp +++ b/test/blackbox/BlackboxTests.cpp @@ -37,6 +37,8 @@ using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::rtps; +//#define cout "Use Log instead!" + uint16_t global_port = 0; uint16_t get_port() diff --git a/test/blackbox/BlackboxTests.hpp b/test/blackbox/BlackboxTests.hpp index 46827b3c2c5..fa287090d50 100644 --- a/test/blackbox/BlackboxTests.hpp +++ b/test/blackbox/BlackboxTests.hpp @@ -15,21 +15,6 @@ #ifndef __BLACKBOX_BLACKBOXTESTS_HPP__ #define __BLACKBOX_BLACKBOXTESTS_HPP__ -#if defined(PREALLOCATED_WITH_REALLOC_MEMORY_MODE_TEST) -#define MEMORY_MODE_STRING ReallocMem -#define MEMORY_MODE_BYTE 1 -#elif defined(DYNAMIC_RESERVE_MEMORY_MODE_TEST) -#define MEMORY_MODE_STRING DynMem -#define MEMORY_MODE_BYTE 2 -#else -#define MEMORY_MODE_STRING PreallocMem -#define MEMORY_MODE_BYTE 3 -#endif - -#define PASTER(x, y) x ## _ ## y -#define EVALUATOR(x, y) PASTER(x, y) -#define BLACKBOXTEST(test_case_name, test_name) TEST(EVALUATOR(test_case_name, MEMORY_MODE_STRING), test_name) -#define BLACKBOXTEST_F(test_case_name, test_name) TEST_F(EVALUATOR(test_case_name, MEMORY_MODE_STRING), test_name) #define TEST_TOPIC_NAME std::string(test_info_->test_case_name() + std::string("_") + test_info_->name()) #if defined(_WIN32) diff --git a/test/blackbox/BlackboxTestsAcknackQos.cpp b/test/blackbox/BlackboxTestsAcknackQos.cpp index 4063ec09279..76bf2d3aebc 100644 --- a/test/blackbox/BlackboxTestsAcknackQos.cpp +++ b/test/blackbox/BlackboxTestsAcknackQos.cpp @@ -25,7 +25,7 @@ using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::rtps; -BLACKBOXTEST(AcknackQos, RecoverAfterLosingCommunicationWithDisablePositiveAck) +TEST(AcknackQos, RecoverAfterLosingCommunicationWithDisablePositiveAck) { // This test makes the writer send a few samples // and checks that those changes were received by the reader. @@ -91,7 +91,7 @@ BLACKBOXTEST(AcknackQos, RecoverAfterLosingCommunicationWithDisablePositiveAck) reader.block_for_all(); } -BLACKBOXTEST(AcknackQos, NotRecoverAfterLosingCommunicationWithDisablePositiveAck) +TEST(AcknackQos, NotRecoverAfterLosingCommunicationWithDisablePositiveAck) { // This test makes the writer send a few samples // and checks that those changes were received by the reader. diff --git a/test/blackbox/BlackboxTestsDeadlineQos.cpp b/test/blackbox/BlackboxTestsDeadlineQos.cpp index 0b31f43310e..ca3b4563d8c 100644 --- a/test/blackbox/BlackboxTestsDeadlineQos.cpp +++ b/test/blackbox/BlackboxTestsDeadlineQos.cpp @@ -24,7 +24,7 @@ using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::rtps; -BLACKBOXTEST(DeadlineQos, NoKeyTopicLongDeadline) +TEST(DeadlineQos, NoKeyTopicLongDeadline) { // This test sets a long deadline (long in comparison to the write rate), // makes the writer send a few samples and checks that the deadline was @@ -71,7 +71,7 @@ BLACKBOXTEST(DeadlineQos, NoKeyTopicLongDeadline) EXPECT_EQ(reader.missed_deadlines(), 0u); } -BLACKBOXTEST(DeadlineQos, NoKeyTopicShortDeadline) +TEST(DeadlineQos, NoKeyTopicShortDeadline) { // This test sets a short deadline (short compared to the write rate), // makes the writer send a few samples and checks that the deadline was missed every time @@ -118,7 +118,7 @@ BLACKBOXTEST(DeadlineQos, NoKeyTopicShortDeadline) EXPECT_GE(reader.missed_deadlines(), writer_samples); } -BLACKBOXTEST(DeadlineQos, KeyedTopicLongDeadline) +TEST(DeadlineQos, KeyedTopicLongDeadline) { // This test sets a long deadline (long in comparison to the write rate), // makes the writer send a few samples and checks that the deadline was met @@ -167,7 +167,7 @@ BLACKBOXTEST(DeadlineQos, KeyedTopicLongDeadline) EXPECT_EQ(reader.missed_deadlines(), 0u); } -BLACKBOXTEST(DeadlineQos, KeyedTopicShortDeadline) +TEST(DeadlineQos, KeyedTopicShortDeadline) { // This test sets a short deadline (short compared to the write rate), // makes the writer send a few samples and checks that the deadline was missed every time diff --git a/test/blackbox/BlackboxTestsDiscovery.cpp b/test/blackbox/BlackboxTestsDiscovery.cpp index 45a5c51de05..315199b44a7 100644 --- a/test/blackbox/BlackboxTestsDiscovery.cpp +++ b/test/blackbox/BlackboxTestsDiscovery.cpp @@ -14,6 +14,7 @@ #include "BlackboxTests.hpp" +#include "PubSubWriterReader.hpp" #include "PubSubReader.hpp" #include "PubSubWriter.hpp" @@ -22,7 +23,7 @@ using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::rtps; -BLACKBOXTEST(BlackBox, ParticipantRemoval) +TEST(BlackBox, ParticipantRemoval) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -53,7 +54,7 @@ BLACKBOXTEST(BlackBox, ParticipantRemoval) reader.wait_participant_undiscovery(); } -BLACKBOXTEST(BlackBox, StaticDiscovery) +TEST(BlackBox, StaticDiscovery) { //Log::SetVerbosity(Log::Info); char* value = nullptr; @@ -163,7 +164,7 @@ BLACKBOXTEST(BlackBox, StaticDiscovery) reader.block_for_all(); } -BLACKBOXTEST(BlackBox, EDPSlaveReaderAttachment) +TEST(BlackBox, EDPSlaveReaderAttachment) { PubSubWriter checker(TEST_TOPIC_NAME); PubSubReader* reader = new PubSubReader(TEST_TOPIC_NAME); @@ -196,7 +197,7 @@ BLACKBOXTEST(BlackBox, EDPSlaveReaderAttachment) } // Used to detect Github issue #155 -BLACKBOXTEST(BlackBox, EndpointRediscovery) +TEST(BlackBox, EndpointRediscovery) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -235,7 +236,7 @@ BLACKBOXTEST(BlackBox, EndpointRediscovery) } // Used to detect Github issue #457 -BLACKBOXTEST(BlackBox, EndpointRediscovery_2) +TEST(BlackBox, EndpointRediscovery_2) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -267,7 +268,7 @@ BLACKBOXTEST(BlackBox, EndpointRediscovery_2) } // Regression test of Refs #2535, github micro-RTPS #1 -BLACKBOXTEST(BlackBox, PubXmlLoadedPartition) +TEST(BlackBox, PubXmlLoadedPartition) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -301,7 +302,7 @@ BLACKBOXTEST(BlackBox, PubXmlLoadedPartition) } // Used to detect Github issue #154 -BLACKBOXTEST(BlackBox, LocalInitialPeers) +TEST(BlackBox, LocalInitialPeers) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -351,7 +352,7 @@ BLACKBOXTEST(BlackBox, LocalInitialPeers) } // Test created to check bug #2010 (Github #90) -BLACKBOXTEST(BlackBox, PubSubAsReliableHelloworldPartitions) +TEST(BlackBox, PubSubAsReliableHelloworldPartitions) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -405,7 +406,7 @@ BLACKBOXTEST(BlackBox, PubSubAsReliableHelloworldPartitions) reader.block_for_all(); } -BLACKBOXTEST(BlackBox, PubSubAsReliableHelloworldParticipantDiscovery) +TEST(BlackBox, PubSubAsReliableHelloworldParticipantDiscovery) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -449,7 +450,7 @@ BLACKBOXTEST(BlackBox, PubSubAsReliableHelloworldParticipantDiscovery) reader.wait_discovery_result(); } -BLACKBOXTEST(BlackBox, PubSubAsReliableHelloworldUserData) +TEST(BlackBox, PubSubAsReliableHelloworldUserData) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -481,3 +482,120 @@ BLACKBOXTEST(BlackBox, PubSubAsReliableHelloworldUserData) reader.wait_discovery_result(); } + +//! Tests discovery of 20 participants, having one publisher and one subscriber each +TEST(Discovery, TwentyParticipants) +{ + // Number of participants + constexpr size_t n_participants = 20; + // Wait time for discovery + constexpr unsigned int wait_ms = 20; + + std::vector>> pubsub; + pubsub.reserve(n_participants); + + for (unsigned int i=0; i>(TEST_TOPIC_NAME)); + } + + // Initialization of all the participants + for (auto& ps : pubsub) + { + ps->init(); + ASSERT_EQ(ps->isInitialized(), true); + } + + bool all_discovered = false; + while (!all_discovered) + { + all_discovered = true; + + for (auto& ps : pubsub) + { + if ((ps->get_num_discovered_participants() < n_participants - 1) || + (ps->get_num_discovered_publishers() < n_participants) || + (ps->get_num_discovered_subscribers() < n_participants) || + (ps->get_publication_matched() < n_participants) || + (ps->get_subscription_matched() < n_participants)) + { + all_discovered = false; + break; + } + } + + if (!all_discovered) + { + // Give some time so that participants can discover each other + std::this_thread::sleep_for(std::chrono::milliseconds(wait_ms)); + } + } + + // Test will fail by timeout if a discovery error happens + std::cout << "All discovered. Closing participants..." << std::endl; + for (auto& ps : pubsub) + { + ps->destroy(); + } +} + +//! Regression for ROS2 #280 and #281 +TEST(Discovery, TwentyParticipantsSeveralEndpoints) +{ + // Number of participants + constexpr size_t n_participants = 20; + // Number of endpoints + constexpr size_t n_topics = 10; + // Total number of discovered endpoints + constexpr size_t n_total_endpoints = n_participants * n_topics; + // Wait time for discovery + constexpr unsigned int wait_ms = 20; + + std::vector>> pubsub; + pubsub.reserve(n_participants); + + for (unsigned int i = 0; i < n_participants; i++) + { + pubsub.emplace_back(std::make_shared>(TEST_TOPIC_NAME)); + } + + // Initialization of all the participants + for (auto& ps : pubsub) + { + ps->init(); + ASSERT_EQ(ps->isInitialized(), true); + ASSERT_TRUE(ps->create_additional_topics(n_topics - 1)); + } + + bool all_discovered = false; + while (!all_discovered) + { + all_discovered = true; + + for (auto& ps : pubsub) + { + if ((ps->get_num_discovered_participants() < n_participants - 1) || + (ps->get_num_discovered_publishers() < n_total_endpoints) || + (ps->get_num_discovered_subscribers() < n_total_endpoints) || + (ps->get_publication_matched() < n_total_endpoints) || + (ps->get_subscription_matched() < n_total_endpoints)) + { + all_discovered = false; + break; + } + } + + if (!all_discovered) + { + // Give some time so that participants can discover each other + std::this_thread::sleep_for(std::chrono::milliseconds(wait_ms)); + } + } + + // Test will fail by timeout if a discovery error happens + std::cout << "All discovered. Closing participants..." << std::endl; + for (auto& ps : pubsub) + { + ps->destroy(); + } +} diff --git a/test/blackbox/BlackboxTestsLifespanQoS.cpp b/test/blackbox/BlackboxTestsLifespanQoS.cpp index bfe0f609852..b565279069c 100644 --- a/test/blackbox/BlackboxTestsLifespanQoS.cpp +++ b/test/blackbox/BlackboxTestsLifespanQoS.cpp @@ -24,7 +24,7 @@ using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::rtps; -BLACKBOXTEST(LifespanQos, LongLifespan) +TEST(LifespanQos, LongLifespan) { // This test sets a long lifespan, makes the writer send a few samples // and checks that those changes can be removed from the history @@ -74,7 +74,7 @@ BLACKBOXTEST(LifespanQos, LongLifespan) EXPECT_EQ(reader.takeNextData(&msg, &info), true); } -BLACKBOXTEST(LifespanQos, ShortLifespan) +TEST(LifespanQos, ShortLifespan) { // This test sets a short lifespan, makes the writer send a few samples // and checks that those samples cannot be removed from the history as diff --git a/test/blackbox/BlackboxTestsLivelinessQos.cpp b/test/blackbox/BlackboxTestsLivelinessQos.cpp new file mode 100644 index 00000000000..d592b12ac47 --- /dev/null +++ b/test/blackbox/BlackboxTestsLivelinessQos.cpp @@ -0,0 +1,1596 @@ +// Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "BlackboxTests.hpp" + +#include "PubSubReader.hpp" +#include "PubSubWriter.hpp" +#include "PubSubParticipant.hpp" +#include "ReqRepAsReliableHelloWorldRequester.hpp" +#include "ReqRepAsReliableHelloWorldReplier.hpp" + +using namespace eprosima::fastrtps; +using namespace eprosima::fastrtps::rtps; + +//! Tests that when kind is automatic liveliness is never lost, even if the writer never sends data +TEST(LivelinessQos, Liveliness_Automatic_Reliable) +{ + PubSubReader reader(TEST_TOPIC_NAME); + PubSubWriter writer(TEST_TOPIC_NAME); + + // Liveliness lease duration and announcement period + uint32_t liveliness_ms = 200; + Duration_t liveliness_s(liveliness_ms * 1e-3); + Duration_t announcement_period(liveliness_ms * 1e-3 * 0.5); + + reader.reliability(RELIABLE_RELIABILITY_QOS) + .liveliness_kind(AUTOMATIC_LIVELINESS_QOS) + .liveliness_lease_duration(liveliness_s) + .init(); + writer.reliability(RELIABLE_RELIABILITY_QOS) + .liveliness_kind(AUTOMATIC_LIVELINESS_QOS) + .liveliness_announcement_period(announcement_period) + .liveliness_lease_duration(liveliness_s) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer.isInitialized()); + + // Wait for discovery. + writer.wait_discovery(); + reader.wait_discovery(); + + std::this_thread::sleep_for(std::chrono::milliseconds(liveliness_ms * 10)); + + // When using automatic kind, liveliness on both publisher and subscriber should never be lost + // It would only be lost if the publishing application crashed, which can't be reproduced in the tests + EXPECT_EQ(writer.times_liveliness_lost(), 0u); + EXPECT_EQ(reader.times_liveliness_recovered(), 1u); + EXPECT_EQ(reader.times_liveliness_lost(), 0u); +} + +//! Same as above using best-effort reliability +TEST(LivelinessQos, Liveliness_Automatic_BestEffort) +{ + PubSubReader reader(TEST_TOPIC_NAME); + PubSubWriter writer(TEST_TOPIC_NAME); + + // Liveliness lease duration and announcement period + uint32_t liveliness_ms = 200; + Duration_t liveliness_s(liveliness_ms * 1e-3); + Duration_t announcement_period(liveliness_ms * 1e-3 * 0.5); + + reader.reliability(BEST_EFFORT_RELIABILITY_QOS) + .liveliness_kind(AUTOMATIC_LIVELINESS_QOS) + .liveliness_lease_duration(liveliness_s) + .init(); + writer.reliability(BEST_EFFORT_RELIABILITY_QOS) + .liveliness_kind(AUTOMATIC_LIVELINESS_QOS) + .liveliness_announcement_period(announcement_period) + .liveliness_lease_duration(liveliness_s) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer.isInitialized()); + + // Wait for discovery. + writer.wait_discovery(); + reader.wait_discovery(); + + std::this_thread::sleep_for(std::chrono::milliseconds(liveliness_ms * 10)); + + // When using automatic kind, liveliness on both publisher and subscriber should never be lost + // It would only be lost if the publishing application crashed, which can't be reproduced in the tests + EXPECT_EQ(writer.times_liveliness_lost(), 0u); + EXPECT_EQ(reader.times_liveliness_recovered(), 1u); + EXPECT_EQ(reader.times_liveliness_lost(), 0u); +} + +//! Tests liveliness with the following paramters +//! Writer is reliable, and MANUAL_BY_PARTICIPANT +//! Reader is reliable, and MANUAL_BY_PARTICIPANT +//! Liveliness lease duration is short in comparison to writer write/assert rate +TEST(LivelinessQos, ShortLiveliness_ManualByParticipant_Reliable) +{ + PubSubReader reader(TEST_TOPIC_NAME); + PubSubWriter writer(TEST_TOPIC_NAME); + + // Write rate in milliseconds and number of samples to write + uint32_t writer_sleep_ms = 200; + uint32_t num_samples = 2; + + // Liveliness lease duration and announcement period, in seconds + Duration_t liveliness_s(writer_sleep_ms * 0.05 * 1e-3); + Duration_t announcement_period(writer_sleep_ms * 0.05 * 1e-3 * 0.9); + + reader.reliability(RELIABLE_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) + .liveliness_lease_duration(liveliness_s) + .init(); + writer.reliability(RELIABLE_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) + .liveliness_announcement_period(announcement_period) + .liveliness_lease_duration(liveliness_s) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer.isInitialized()); + + // Wait for discovery. + writer.wait_discovery(); + reader.wait_discovery(); + + auto data = default_helloworld_data_generator(num_samples); + reader.startReception(data); + + size_t count = 0; + for (auto data_sample : data) + { + writer.send_sample(data_sample); + ++count; + reader.block_for_at_least(count); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + + EXPECT_EQ(writer.times_liveliness_lost(), num_samples); + EXPECT_EQ(reader.times_liveliness_lost(), num_samples); + EXPECT_EQ(reader.times_liveliness_recovered(), num_samples); + + for (count = 0; count < num_samples; count++) + { + writer.assert_liveliness(); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + + EXPECT_EQ(writer.times_liveliness_lost(), num_samples * 2); + EXPECT_EQ(reader.times_liveliness_lost(), num_samples * 2); + EXPECT_EQ(reader.times_liveliness_recovered(), num_samples * 2); +} + +//! Tests liveliness with the following paramters +//! Writer is best-effort, and MANUAL_BY_PARTICIPANT +//! Reader is best-effort, and MANUAL_BY_PARTICIPANT +//! Liveliness lease duration is short in comparison to writer write/assert rate +TEST(LivelinessQos, ShortLiveliness_ManualByParticipant_BestEffort) +{ + PubSubReader reader(TEST_TOPIC_NAME); + PubSubWriter writer(TEST_TOPIC_NAME); + + // Write rate in milliseconds and number of samples to write + uint32_t writer_sleep_ms = 200; + uint32_t num_samples = 3; + + // Liveliness lease duration and announcement period, in seconds + Duration_t liveliness_s(writer_sleep_ms * 0.05 * 1e-3); + Duration_t announcement_period(writer_sleep_ms * 0.05 * 1e-3 * 0.9); + + reader.reliability(BEST_EFFORT_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) + .liveliness_lease_duration(liveliness_s) + .init(); + writer.reliability(BEST_EFFORT_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) + .liveliness_announcement_period(announcement_period) + .liveliness_lease_duration(liveliness_s) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer.isInitialized()); + + // Wait for discovery. + writer.wait_discovery(); + reader.wait_discovery(); + + auto data = default_helloworld_data_generator(num_samples); + reader.startReception(data); + + size_t count = 0; + for (auto data_sample : data) + { + writer.send_sample(data_sample); + ++count; + reader.block_for_at_least(count); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + + EXPECT_EQ(writer.times_liveliness_lost(), num_samples); + EXPECT_EQ(reader.times_liveliness_lost(), num_samples); + EXPECT_EQ(reader.times_liveliness_recovered(), num_samples); + + for (count = 0; count reader(TEST_TOPIC_NAME); + PubSubWriter writer(TEST_TOPIC_NAME); + + // Write rate in milliseconds and number of samples to write + uint32_t writer_sleep_ms = 10; + uint32_t num_samples = 3; + + // Liveliness lease duration and announcement period, in seconds + Duration_t liveliness_s(writer_sleep_ms * 100.0 * 1e-3); + Duration_t announcement_period(writer_sleep_ms * 100.0 * 1e-3 * 0.1); + + reader.reliability(RELIABLE_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) + .liveliness_lease_duration(liveliness_s) + .init(); + writer.reliability(RELIABLE_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) + .liveliness_announcement_period(announcement_period) + .liveliness_lease_duration(liveliness_s) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer.isInitialized()); + + // Wait for discovery. + writer.wait_discovery(); + reader.wait_discovery(); + + auto data = default_helloworld_data_generator(num_samples); + reader.startReception(data); + + size_t count = 0; + for (auto data_sample : data) + { + writer.send_sample(data_sample); + ++count; + reader.block_for_at_least(count); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + for (count = 0; count < num_samples; count++) + { + writer.assert_liveliness(); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + reader.wait_liveliness_recovered(); + + // Liveliness shouldn't have been lost + EXPECT_EQ(writer.times_liveliness_lost(), 0u); + EXPECT_EQ(reader.times_liveliness_lost(), 0u); + EXPECT_EQ(reader.times_liveliness_recovered(), 1u); +} + +//! Tests liveliness with the following paramters +//! Writer is best-effort, and MANUAL_BY_PARTICIPANT +//! Reader is best-effort, and MANUAL_BY_PARTICIPANT +//! Liveliness lease duration is long in comparison to writer write/assert rate +TEST(LivelinessQos, LongLiveliness_ManualByParticipant_BestEffort) +{ + PubSubReader reader(TEST_TOPIC_NAME); + PubSubWriter writer(TEST_TOPIC_NAME); + + // Write rate in milliseconds and number of samples to write + uint32_t writer_sleep_ms = 10; + uint32_t writer_samples = 3; + + // Liveliness lease duration and announcement period, in seconds + Duration_t liveliness_s(writer_sleep_ms * 100.0 * 1e-3); + Duration_t announcement_period(writer_sleep_ms * 100.0 * 1e-3 * 0.1); + + reader.reliability(BEST_EFFORT_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) + .liveliness_lease_duration(liveliness_s) + .init(); + writer.reliability(BEST_EFFORT_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) + .liveliness_announcement_period(announcement_period) + .liveliness_lease_duration(liveliness_s) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer.isInitialized()); + + // Wait for discovery. + writer.wait_discovery(); + reader.wait_discovery(); + + auto data = default_helloworld_data_generator(writer_samples); + reader.startReception(data); + + size_t count = 0; + for (auto data_sample : data) + { + writer.send_sample(data_sample); + ++count; + reader.block_for_at_least(count); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + for (count = 0; count < writer_samples; count++) + { + writer.assert_liveliness(); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + reader.wait_liveliness_recovered(); + + // Liveliness shouldn't have been lost + EXPECT_EQ(writer.times_liveliness_lost(), 0u); + EXPECT_EQ(reader.times_liveliness_lost(), 0u); + EXPECT_EQ(reader.times_liveliness_recovered(), 1u); +} + +//! Tests liveliness with the following paramters +//! Writer is reliable, and MANUAL_BY_TOPIC +//! Reader is reliable, and MANUAL_BY_TOPIC +//! Liveliness lease duration is short in comparison to writer write/assert rate +TEST(LivelinessQos, ShortLiveliness_ManualByTopic_Reliable) +{ + PubSubReader reader(TEST_TOPIC_NAME); + PubSubWriter writer(TEST_TOPIC_NAME); + + // Write rate in milliseconds and number of samples to write + uint32_t writer_sleep_ms = 100; + uint32_t num_samples = 3; + + // Liveliness lease duration and announcement period, in seconds + Duration_t liveliness_s(writer_sleep_ms * 0.1 * 1e-3); + Duration_t announcement_period(writer_sleep_ms * 0.1 * 1e-3 * 0.9); + + reader.reliability(RELIABLE_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_TOPIC_LIVELINESS_QOS) + .liveliness_lease_duration(liveliness_s) + .init(); + writer.reliability(RELIABLE_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_TOPIC_LIVELINESS_QOS) + .liveliness_announcement_period(announcement_period) + .liveliness_lease_duration(liveliness_s) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer.isInitialized()); + + // Wait for discovery. + writer.wait_discovery(); + reader.wait_discovery(); + + auto data = default_helloworld_data_generator(num_samples); + reader.startReception(data); + + size_t count = 0; + for (auto data_sample : data) + { + // Send data + writer.send_sample(data_sample); + ++count; + reader.block_for_at_least(count); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + EXPECT_EQ(writer.times_liveliness_lost(), num_samples); + EXPECT_EQ(reader.times_liveliness_lost(), num_samples); + EXPECT_EQ(reader.times_liveliness_recovered(), num_samples); + + for (count = 0; count < num_samples; count++) + { + writer.assert_liveliness(); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + EXPECT_EQ(writer.times_liveliness_lost(), num_samples * 2); + EXPECT_EQ(reader.times_liveliness_lost(), num_samples * 2); + EXPECT_EQ(reader.times_liveliness_recovered(), num_samples * 2); +} + +//! Tests liveliness with the following paramters +//! Writer is best-effort, and MANUAL_BY_TOPIC +//! Reader is best-effort, and MANUAL_BY_TOPIC +//! Liveliness lease duration is short in comparison to writer write/assert rate +TEST(LivelinessQos, ShortLiveliness_ManualByTopic_BestEffort) +{ + PubSubReader reader(TEST_TOPIC_NAME); + PubSubWriter writer(TEST_TOPIC_NAME); + + // Write rate in milliseconds and number of samples to write + uint32_t writer_sleep_ms = 100; + uint32_t num_samples = 3; + + // Liveliness lease duration and announcement period, in seconds + Duration_t liveliness_s(writer_sleep_ms * 0.1 * 1e-3); + Duration_t announcement_period(writer_sleep_ms * 0.1 * 1e-3 * 0.9); + + reader.reliability(BEST_EFFORT_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_TOPIC_LIVELINESS_QOS) + .liveliness_lease_duration(liveliness_s) + .init(); + writer.reliability(BEST_EFFORT_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_TOPIC_LIVELINESS_QOS) + .liveliness_announcement_period(announcement_period) + .liveliness_lease_duration(liveliness_s) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer.isInitialized()); + + // Wait for discovery. + writer.wait_discovery(); + reader.wait_discovery(); + + auto data = default_helloworld_data_generator(num_samples); + reader.startReception(data); + + size_t count = 0; + for (auto data_sample : data) + { + // Send data + writer.send_sample(data_sample); + ++count; + reader.block_for_at_least(count); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + EXPECT_EQ(writer.times_liveliness_lost(), num_samples); + EXPECT_EQ(reader.times_liveliness_lost(), num_samples); + EXPECT_EQ(reader.times_liveliness_recovered(), num_samples); + + for (count = 0; count < num_samples; count++) + { + writer.assert_liveliness(); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + EXPECT_EQ(writer.times_liveliness_lost(), num_samples * 2); + // Note that in MANUAL_BY_TOPIC liveliness, the assert_liveliness() method relies on sending a heartbeat + // However best-effort writers don't send heartbeats, so the reader in this case will never get notified + EXPECT_EQ(reader.times_liveliness_lost(), num_samples); + EXPECT_EQ(reader.times_liveliness_recovered(), num_samples); +} + +//! Tests liveliness with the following paramters +//! Writer is reliable, and MANUAL_BY_TOPIC +//! Reader is reliable, and MANUAL_BY_TOPIC +//! Liveliness lease duration is long in comparison to writer write/assert rate +TEST(LivelinessQos, LongLiveliness_ManualByTopic_Reliable) +{ + PubSubReader reader(TEST_TOPIC_NAME); + PubSubWriter writer(TEST_TOPIC_NAME); + + // Write rate in milliseconds and number of samples to write + uint32_t writer_sleep_ms = 10; + uint32_t num_samples = 3; + + // Liveliness lease duration and announcement period, in seconds + Duration_t liveliness_s(writer_sleep_ms * 100 * 1e-3); + Duration_t announcement_period(writer_sleep_ms * 100 * 1e-3 * 0.1); + + reader.reliability(RELIABLE_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_TOPIC_LIVELINESS_QOS) + .liveliness_lease_duration(liveliness_s) + .init(); + writer.reliability(RELIABLE_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_TOPIC_LIVELINESS_QOS) + .liveliness_announcement_period(announcement_period) + .liveliness_lease_duration(liveliness_s) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer.isInitialized()); + + // Wait for discovery. + writer.wait_discovery(); + reader.wait_discovery(); + + auto data = default_helloworld_data_generator(num_samples); + reader.startReception(data); + + size_t count = 0; + for (auto data_sample : data) + { + // Send data + writer.send_sample(data_sample); + ++count; + reader.block_for_at_least(count); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + for (count=0; count reader(TEST_TOPIC_NAME); + PubSubWriter writer(TEST_TOPIC_NAME); + + // Write rate in milliseconds and number of samples to write + uint32_t writer_sleep_ms = 10; + uint32_t num_samples = 3; + + // Liveliness lease duration and announcement period, in seconds + Duration_t liveliness_s(writer_sleep_ms * 100 * 1e-3); + Duration_t announcement_period(writer_sleep_ms * 100 * 1e-3 * 0.1); + + reader.reliability(BEST_EFFORT_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_TOPIC_LIVELINESS_QOS) + .liveliness_lease_duration(liveliness_s) + .init(); + writer.reliability(BEST_EFFORT_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_TOPIC_LIVELINESS_QOS) + .liveliness_announcement_period(announcement_period) + .liveliness_lease_duration(liveliness_s) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer.isInitialized()); + + // Wait for discovery. + writer.wait_discovery(); + reader.wait_discovery(); + + auto data = default_helloworld_data_generator(num_samples); + reader.startReception(data); + + size_t count = 0; + for (auto data_sample : data) + { + // Send data + writer.send_sample(data_sample); + ++count; + reader.block_for_at_least(count); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + for(count = 0; count < num_samples; count++) + { + writer.assert_liveliness(); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + reader.wait_liveliness_recovered(); + + // Liveliness shouldn't have been lost + EXPECT_EQ(writer.times_liveliness_lost(), 0u); + EXPECT_EQ(reader.times_liveliness_lost(), 0u); + EXPECT_EQ(reader.times_liveliness_recovered(), 1u); +} + +//! Tests liveliness with the following parameters +//! Writer is reliable, liveliness is manual by participant +//! Reader is reliable, liveliness is automatic +//! Liveliness lease duration is long in comparison to the writer write/assert rate +TEST(LivelinessQos, LongLiveliness_ManualByParticipant_Automatic_Reliable) +{ + PubSubReader reader(TEST_TOPIC_NAME); + PubSubWriter writer(TEST_TOPIC_NAME); + + // Write rate in milliseconds and number of samples to write + uint32_t writer_sleep_ms = 10; + uint32_t num_samples = 3; + + // Liveliness lease duration and announcement period, in seconds + Duration_t liveliness_s(writer_sleep_ms * 100.0 * 1e-3); + Duration_t announcement_period(writer_sleep_ms * 100.0 * 1e-3 * 0.20); + + reader.reliability(RELIABLE_RELIABILITY_QOS) + .liveliness_kind(AUTOMATIC_LIVELINESS_QOS) + .liveliness_lease_duration(liveliness_s) + .init(); + writer.reliability(RELIABLE_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) + .liveliness_announcement_period(announcement_period) + .liveliness_lease_duration(liveliness_s) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer.isInitialized()); + + // Wait for discovery. + writer.wait_discovery(); + reader.wait_discovery(); + + auto data = default_helloworld_data_generator(num_samples); + reader.startReception(data); + + size_t count = 0; + for (auto data_sample : data) + { + // Send data + writer.send_sample(data_sample); + ++count; + reader.block_for_at_least(count); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + for (count = 0; count < num_samples; count++) + { + writer.assert_liveliness(); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + reader.wait_liveliness_recovered(); + + EXPECT_EQ(writer.times_liveliness_lost(), 0u); + EXPECT_EQ(reader.times_liveliness_lost(), 0u); + EXPECT_EQ(reader.times_liveliness_recovered(), 1u); +} + +//! Tests liveliness with the following parameters +//! Writer is reliable, liveliness is manual by participant +//! Reader is reliable, liveliness is automatic +//! Liveliness is short in comparison to the writer write/assert rate +TEST(LivelinessQos, ShortLiveliness_ManualByParticipant_Automatic_Reliable) +{ + PubSubReader reader(TEST_TOPIC_NAME); + PubSubWriter writer(TEST_TOPIC_NAME); + + // Write rate in milliseconds and number of samples to write + uint32_t writer_sleep_ms = 50; + uint32_t num_samples = 3; + + // Liveliness lease duration and announcement period, in seconds + Duration_t liveliness_s(writer_sleep_ms * 0.1 * 1e-3); + Duration_t announcement_period(writer_sleep_ms * 0.1 * 1e-3 * 0.1); + + reader.reliability(RELIABLE_RELIABILITY_QOS) + .liveliness_kind(AUTOMATIC_LIVELINESS_QOS) + .liveliness_lease_duration(liveliness_s) + .init(); + writer.reliability(RELIABLE_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) + .liveliness_announcement_period(announcement_period) + .liveliness_lease_duration(liveliness_s) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer.isInitialized()); + + // Wait for discovery. + writer.wait_discovery(); + reader.wait_discovery(); + + auto data = default_helloworld_data_generator(num_samples); + reader.startReception(data); + + size_t count = 0; + for (auto data_sample : data) + { + writer.send_sample(data_sample); + ++count; + reader.block_for_at_least(count); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + EXPECT_EQ(writer.times_liveliness_lost(), num_samples); + EXPECT_EQ(reader.times_liveliness_lost(), num_samples); + EXPECT_EQ(reader.times_liveliness_recovered(), num_samples); + + for (count = 0; count < num_samples; count++) + { + writer.assert_liveliness(); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + EXPECT_EQ(writer.times_liveliness_lost(), num_samples * 2); + EXPECT_EQ(reader.times_liveliness_lost(), num_samples * 2); + EXPECT_EQ(reader.times_liveliness_recovered(), num_samples * 2); +} + +//! Tests liveliness with the following parameters +//! Writer is best-effort, liveliness is manual by participant +//! Reader is best-effort, liveliness is automatic +//! Liveliness is long in comparison to the writer write/assert rate +TEST(LivelinessQos, LongLiveliness_ManualByParticipant_Automatic_BestEffort) +{ + PubSubReader reader(TEST_TOPIC_NAME); + PubSubWriter writer(TEST_TOPIC_NAME); + + // Write rate in milliseconds and number of samples to write + uint32_t writer_sleep_ms = 10; + uint32_t num_samples = 3; + + // Liveliness lease duration and announcement period, in seconds + Duration_t liveliness_s(writer_sleep_ms * 100.0 * 1e-3); + Duration_t announcement_period(writer_sleep_ms * 100.0 * 1e-3 * 0.1); + + reader.reliability(BEST_EFFORT_RELIABILITY_QOS) + .liveliness_kind(AUTOMATIC_LIVELINESS_QOS) + .liveliness_lease_duration(liveliness_s) + .init(); + writer.reliability(BEST_EFFORT_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) + .liveliness_announcement_period(announcement_period) + .liveliness_lease_duration(liveliness_s) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer.isInitialized()); + + // Wait for discovery. + writer.wait_discovery(); + reader.wait_discovery(); + + auto data = default_helloworld_data_generator(num_samples); + reader.startReception(data); + + size_t count = 0; + for (auto data_sample : data) + { + writer.send_sample(data_sample); + ++count; + reader.block_for_at_least(count); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + for (count = 0; count < num_samples; count++) + { + writer.assert_liveliness(); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + reader.wait_liveliness_recovered(); + + EXPECT_EQ(writer.times_liveliness_lost(), 0u); + EXPECT_EQ(reader.times_liveliness_lost(), 0u); + EXPECT_EQ(reader.times_liveliness_recovered(), 1u); +} + +//! Tests liveliness with the following parameters +//! Writer is best-effort, liveliness is manual by participant +//! Reader is best-effort, liveliness is automatic +//! Liveliness is short in comparison to the writer write/assert rate +TEST(LivelinessQos, ShortLiveliness_ManualByParticipant_Automatic_BestEffort) +{ + PubSubReader reader(TEST_TOPIC_NAME); + PubSubWriter writer(TEST_TOPIC_NAME); + + // Write rate in milliseconds and number of samples to write + uint32_t writer_sleep_ms = 100; + uint32_t num_samples = 3; + + // Liveliness lease duration and announcement period, in seconds + Duration_t liveliness_s(writer_sleep_ms * 0.1 * 1e-3); + Duration_t announcement_period(writer_sleep_ms * 0.1 * 1e-3 * 0.9); + + reader.reliability(BEST_EFFORT_RELIABILITY_QOS) + .liveliness_kind(AUTOMATIC_LIVELINESS_QOS) + .liveliness_lease_duration(liveliness_s) + .init(); + writer.reliability(BEST_EFFORT_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) + .liveliness_announcement_period(announcement_period) + .liveliness_lease_duration(liveliness_s) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer.isInitialized()); + + // Wait for discovery. + writer.wait_discovery(); + reader.wait_discovery(); + + auto data = default_helloworld_data_generator(num_samples); + reader.startReception(data); + + size_t count = 0; + for (auto data_sample : data) + { + writer.send_sample(data_sample); + ++count; + reader.block_for_at_least(count); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + EXPECT_EQ(writer.times_liveliness_lost(), num_samples); + EXPECT_EQ(reader.times_liveliness_lost(), num_samples); + EXPECT_EQ(reader.times_liveliness_recovered(), num_samples); + + for (count = 0; count < num_samples; count++) + { + writer.assert_liveliness(); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + EXPECT_EQ(writer.times_liveliness_lost(), num_samples * 2); + EXPECT_EQ(reader.times_liveliness_lost(), num_samples * 2); + EXPECT_EQ(reader.times_liveliness_recovered(), num_samples * 2); +} + +//! Tests liveliness with the following parameters +//! Writer is reliable, and uses manual by topic liveliness kind +//! Reader is reliable, and uses automatic liveliness kind +//! Liveliness lease duration is short in comparison to writer write/assert rate +TEST(LivelinessQos, ManualByTopic_Automatic_Reliable) +{ + PubSubReader reader(TEST_TOPIC_NAME); + PubSubWriter writer(TEST_TOPIC_NAME); + + // Write rate in milliseconds and number of samples to write + uint32_t writer_sleep_ms = 100; + uint32_t num_samples = 3; + + // Liveliness lease duration and announcement period, in seconds + Duration_t liveliness_s(writer_sleep_ms * 0.1 * 1e-3); + Duration_t announcement_period(writer_sleep_ms * 0.1 * 1e-3 * 0.9); + + reader.reliability(RELIABLE_RELIABILITY_QOS) + .liveliness_kind(AUTOMATIC_LIVELINESS_QOS) + .liveliness_lease_duration(liveliness_s) + .init(); + writer.reliability(RELIABLE_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_TOPIC_LIVELINESS_QOS) + .liveliness_announcement_period(announcement_period) + .liveliness_lease_duration(liveliness_s) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer.isInitialized()); + + // Wait for discovery. + writer.wait_discovery(); + reader.wait_discovery(); + + auto data = default_helloworld_data_generator(num_samples); + reader.startReception(data); + + // Write some samples + size_t count = 0; + for (auto data_sample : data) + { + // Send data + writer.send_sample(data_sample); + ++count; + reader.block_for_at_least(count); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + // Now use assert_liveliness() method + for (count = 0; count < num_samples; count++) + { + writer.assert_liveliness(); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + + EXPECT_EQ(writer.times_liveliness_lost(), num_samples * 2); + EXPECT_EQ(reader.times_liveliness_lost(), num_samples * 2); + EXPECT_EQ(reader.times_liveliness_recovered(), num_samples * 2); +} + +//! Tests liveliness with the following parameters +//! Writer is best-effort, and uses manual by topic liveliness kind +//! Reader is best-effort, and uses automatic liveliness kind +//! Liveliness lease duration is short in comparison to writer write/assert rate +TEST(LivelinessQos, ManualByTopic_Automatic_BestEffort) +{ + PubSubReader reader(TEST_TOPIC_NAME); + PubSubWriter writer(TEST_TOPIC_NAME); + + // Write rate in milliseconds and number of samples to write + uint32_t writer_sleep_ms = 100; + uint32_t num_samples = 3; + + // Liveliness lease duration and announcement period, in seconds + Duration_t liveliness_s(writer_sleep_ms * 0.1 * 1e-3); + Duration_t announcement_period(writer_sleep_ms * 0.1 * 1e-3 * 0.9); + + reader.reliability(BEST_EFFORT_RELIABILITY_QOS) + .liveliness_kind(AUTOMATIC_LIVELINESS_QOS) + .liveliness_lease_duration(liveliness_s) + .init(); + writer.reliability(BEST_EFFORT_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_TOPIC_LIVELINESS_QOS) + .liveliness_announcement_period(announcement_period) + .liveliness_lease_duration(liveliness_s) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer.isInitialized()); + + // Wait for discovery. + writer.wait_discovery(); + reader.wait_discovery(); + + auto data = default_helloworld_data_generator(num_samples); + reader.startReception(data); + + // Write some samples + size_t count = 0; + for (auto data_sample : data) + { + writer.send_sample(data_sample); + ++count; + reader.block_for_at_least(count); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + // Now use assert_liveliness() method + for (count = 0; count < num_samples; count++) + { + writer.assert_liveliness(); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + + EXPECT_EQ(writer.times_liveliness_lost(), num_samples * 2); + // As best-effort readers do not process heartbeats the expected number of times liveliness was lost + // and recovered corresponds to the bit in the test when we sent samples (not when we asserted liveliness) + EXPECT_EQ(reader.times_liveliness_lost(), num_samples); + EXPECT_EQ(reader.times_liveliness_recovered(), num_samples); +} + +//! Tests liveliness with the following parameters +//! Writer is reliable, and uses manual by topic liveliness kind +//! Reader is reliable, and uses manual by participant liveliness kind +//! Liveliness lease duration is short in comparison to writer write/assert rate +TEST(LivelinessQos, ManualByTopic_ManualByParticipant_Reliable) +{ + PubSubReader reader(TEST_TOPIC_NAME); + PubSubWriter writer(TEST_TOPIC_NAME); + + // Write rate in milliseconds and number of samples to write + uint32_t writer_sleep_ms = 100; + uint32_t num_samples = 3; + + // Liveliness lease duration and announcement period, in seconds + Duration_t liveliness_s(writer_sleep_ms * 0.1 * 1e-3); + Duration_t announcement_period(writer_sleep_ms * 0.1 * 1e-3 * 0.9); + + reader.reliability(RELIABLE_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) + .liveliness_lease_duration(liveliness_s) + .init(); + writer.reliability(RELIABLE_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_TOPIC_LIVELINESS_QOS) + .liveliness_announcement_period(announcement_period) + .liveliness_lease_duration(liveliness_s) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer.isInitialized()); + + // Wait for discovery. + writer.wait_discovery(); + reader.wait_discovery(); + + auto data = default_helloworld_data_generator(num_samples); + reader.startReception(data); + + // Write some samples + size_t count = 0; + for (auto data_sample : data) + { + // Send data + writer.send_sample(data_sample); + ++count; + reader.block_for_at_least(count); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + // Now use assert_liveliness() method + for (count = 0; count < num_samples; count++) + { + writer.assert_liveliness(); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + + EXPECT_EQ(writer.times_liveliness_lost(), num_samples * 2); + EXPECT_EQ(reader.times_liveliness_lost(), num_samples * 2); + EXPECT_EQ(reader.times_liveliness_recovered(), num_samples * 2); +} + +//! Tests liveliness with the following parameters +//! Writer is best-effort, and uses manual by topic liveliness kind +//! Reader is best-effort, and uses manual by participant liveliness kind +//! Liveliness lease duration is short in comparison to writer write/assert rate +TEST(LivelinessQos, ManualByTopic_ManualByParticipant_BestEffort) +{ + PubSubReader reader(TEST_TOPIC_NAME); + PubSubWriter writer(TEST_TOPIC_NAME); + + // Write rate in milliseconds and number of samples to write + uint32_t writer_sleep_ms = 100; + uint32_t num_samples = 3; + + // Liveliness lease duration and announcement period, in seconds + Duration_t liveliness_s(writer_sleep_ms * 0.1 * 1e-3); + Duration_t announcement_period(writer_sleep_ms * 0.1 * 1e-3 * 0.9); + + reader.reliability(BEST_EFFORT_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) + .liveliness_lease_duration(liveliness_s) + .init(); + writer.reliability(BEST_EFFORT_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_TOPIC_LIVELINESS_QOS) + .liveliness_announcement_period(announcement_period) + .liveliness_lease_duration(liveliness_s) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer.isInitialized()); + + // Wait for discovery. + writer.wait_discovery(); + reader.wait_discovery(); + + auto data = default_helloworld_data_generator(num_samples); + reader.startReception(data); + + // Write some samples + size_t count = 0; + for (auto data_sample : data) + { + writer.send_sample(data_sample); + ++count; + reader.block_for_at_least(count); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + // Now use assert_liveliness() method + for (count = 0; count < num_samples; count++) + { + writer.assert_liveliness(); + std::this_thread::sleep_for(std::chrono::milliseconds(writer_sleep_ms)); + } + + EXPECT_EQ(writer.times_liveliness_lost(), num_samples * 2); + // Note that, as best-effor readers do not proccess heartbeats and assert_liveliness() relies on sending a + // heartbeat to assess liveliness, the expected number of times liveliness was lost and recovered + // corresponds only to the bit in the test when the writer wrote samples + EXPECT_EQ(reader.times_liveliness_lost(), num_samples); + EXPECT_EQ(reader.times_liveliness_recovered(), num_samples); +} + +//! Tests liveliness in the following scenario +//! A participant with two publishers (AUTOMATIC and MANUAL_BY_PARTICIPANT) and a single topic +//! A participant with one subscriber (AUTOMATIC) +TEST(LivelinessQos, TwoWriters_OneReader_ManualByTopic) +{ + unsigned int num_pub = 2; + unsigned int num_sub = 1; + unsigned int lease_duration_ms = 500; + unsigned int announcement_period_ms = 250; + + // Publishers + PubSubParticipant publishers(num_pub, 0u, 2u, 0u); + ASSERT_TRUE(publishers.init_participant()); + publishers.pub_topic_name(TEST_TOPIC_NAME) + .reliability(RELIABLE_RELIABILITY_QOS) + .pub_liveliness_announcement_period(announcement_period_ms * 1e-3) + .pub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .pub_liveliness_kind(AUTOMATIC_LIVELINESS_QOS); + ASSERT_TRUE(publishers.init_publisher(0u)); + publishers.pub_topic_name(TEST_TOPIC_NAME) + .reliability(RELIABLE_RELIABILITY_QOS) + .pub_liveliness_announcement_period(announcement_period_ms * 1e-3) + .pub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .pub_liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS); + ASSERT_TRUE(publishers.init_publisher(1u)); + + // Subscribers + PubSubParticipant subscribers(0u, num_sub, 0u, 2u); + ASSERT_TRUE(subscribers.init_participant()); + subscribers.sub_topic_name(TEST_TOPIC_NAME) + .reliability(RELIABLE_RELIABILITY_QOS) + .sub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .sub_liveliness_kind(AUTOMATIC_LIVELINESS_QOS); + ASSERT_TRUE(subscribers.init_subscriber(0u)); + + publishers.pub_wait_discovery(); + subscribers.sub_wait_discovery(); + // Just sleep a bit to give the subscriber the chance to detect that writers are alive + std::this_thread::sleep_for(std::chrono::milliseconds(lease_duration_ms)); + + EXPECT_EQ(publishers.pub_times_liveliness_lost(), 0u); + EXPECT_EQ(subscribers.sub_times_liveliness_recovered(), 2u); + // Note that from the subscriber point of view both writers recovered liveliness, even if the + // MANUAL_BY_PARTICIPANT one didn't assert liveliness explicitly. This is the expected + // behaviour according to the RTPS standard, section 2.2.3.11 LIVELINESS +} + +//! Tests liveliness in the following scenario +//! A participant with two publishers and two topics +//! A participant with two subscribers and two topics +//! Manual by participant liveliness +//! Only one publisher asserts liveliness manually +TEST(LivelinessQos, TwoWriters_TwoReaders_ManualByParticipant) +{ + unsigned int num_pub = 2; + unsigned int num_sub = 2; + unsigned int lease_duration_ms = 1000; + unsigned int announcement_period_ms = 100; + + // Publishers + PubSubParticipant publishers(num_pub, 0u, num_sub, 0u); + ASSERT_TRUE(publishers.init_participant()); + publishers.pub_topic_name(TEST_TOPIC_NAME + "1") + .pub_liveliness_announcement_period(announcement_period_ms * 1e-3) + .pub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .pub_liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS); + ASSERT_TRUE(publishers.init_publisher(0u)); + publishers.pub_topic_name(TEST_TOPIC_NAME + "2") + .pub_liveliness_announcement_period(announcement_period_ms * 1e-3) + .pub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .pub_liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS); + ASSERT_TRUE(publishers.init_publisher(1u)); + + // Subscribers + PubSubParticipant subscribers(0u, num_sub, 0u, num_pub); + ASSERT_TRUE(subscribers.init_participant()); + subscribers.sub_topic_name(TEST_TOPIC_NAME + "1") + .sub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .sub_liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS); + ASSERT_TRUE(subscribers.init_subscriber(0u)); + subscribers.sub_topic_name(TEST_TOPIC_NAME + "2") + .sub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .sub_liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS); + ASSERT_TRUE(subscribers.init_subscriber(1u)); + + publishers.pub_wait_discovery(); + subscribers.sub_wait_discovery(); + + unsigned int num_assertions = 4; + unsigned int assert_rate_ms = 50; + for (unsigned int count = 0; count < num_assertions; count++) + { + publishers.assert_liveliness(0u); + std::this_thread::sleep_for(std::chrono::milliseconds(assert_rate_ms)); + } + // Only one publisher asserts liveliness but the other should be asserted by the QoS, as + // liveliness kind is manual by participant + EXPECT_EQ(publishers.pub_times_liveliness_lost(), 0u); + EXPECT_EQ(subscribers.sub_times_liveliness_recovered(), num_pub); + EXPECT_EQ(subscribers.sub_times_liveliness_lost(), 0u); + + subscribers.sub_wait_liveliness_lost(num_pub); + EXPECT_EQ(publishers.pub_times_liveliness_lost(), num_pub); + EXPECT_EQ(subscribers.sub_times_liveliness_recovered(), num_pub); + EXPECT_EQ(subscribers.sub_times_liveliness_lost(), num_pub); +} + +//! Tests liveliness in the same scenario as above but using manual by topic liveliness +//! A participant with two publishers and two topics +//! A participant with two subscribers and two topics +//! Manual by topic liveliness +//! Only one publisher asserts liveliness manually +TEST(LivelinessQos, TwoWriters_TwoReaders_ManualByTopic) +{ + unsigned int num_pub = 2; + unsigned int num_sub = 2; + unsigned int lease_duration_ms = 500; + unsigned int announcement_period_ms = 250; + + // Publishers + PubSubParticipant publishers(num_pub, 0u, num_sub, 0u); + ASSERT_TRUE(publishers.init_participant()); + publishers.pub_topic_name(TEST_TOPIC_NAME + "1") + .reliability(RELIABLE_RELIABILITY_QOS) + .pub_liveliness_announcement_period(announcement_period_ms * 1e-3) + .pub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .pub_liveliness_kind(MANUAL_BY_TOPIC_LIVELINESS_QOS); + ASSERT_TRUE(publishers.init_publisher(0u)); + publishers.pub_topic_name(TEST_TOPIC_NAME + "2") + .reliability(RELIABLE_RELIABILITY_QOS) + .pub_liveliness_announcement_period(announcement_period_ms * 1e-3) + .pub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .pub_liveliness_kind(MANUAL_BY_TOPIC_LIVELINESS_QOS); + ASSERT_TRUE(publishers.init_publisher(1u)); + + // Subscribers + PubSubParticipant subscribers(0u, num_sub, 0u, num_pub); + ASSERT_TRUE(subscribers.init_participant()); + subscribers.sub_topic_name(TEST_TOPIC_NAME + "1") + .reliability(RELIABLE_RELIABILITY_QOS) + .sub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .sub_liveliness_kind(MANUAL_BY_TOPIC_LIVELINESS_QOS); + ASSERT_TRUE(subscribers.init_subscriber(0u)); + subscribers.sub_topic_name(TEST_TOPIC_NAME + "2") + .reliability(RELIABLE_RELIABILITY_QOS) + .sub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .sub_liveliness_kind(MANUAL_BY_TOPIC_LIVELINESS_QOS); + ASSERT_TRUE(subscribers.init_subscriber(1u)); + + publishers.pub_wait_discovery(); + subscribers.sub_wait_discovery(); + + unsigned int num_assertions = 4; + unsigned int assert_rate_ms = 10; + for (unsigned int count = 0; count < num_assertions; count++) + { + publishers.assert_liveliness(0u); + std::this_thread::sleep_for(std::chrono::milliseconds(assert_rate_ms)); + } + EXPECT_EQ(publishers.pub_times_liveliness_lost(), 0u); + EXPECT_EQ(subscribers.sub_times_liveliness_recovered(), 1u); + EXPECT_EQ(subscribers.sub_times_liveliness_lost(), 0u); + + std::this_thread::sleep_for(std::chrono::milliseconds(lease_duration_ms * 2)); + EXPECT_EQ(publishers.pub_times_liveliness_lost(), 1u); + EXPECT_EQ(subscribers.sub_times_liveliness_recovered(), 1u); + EXPECT_EQ(subscribers.sub_times_liveliness_lost(), 1u); +} + +//! Tests liveliness in the following scenario +//! A participant with two publishers with different liveliness kinds +//! A participant with two subscribers with different liveliness kinds +TEST(LivelinessQos, TwoWriters_TwoReaders) +{ + unsigned int num_pub = 2; + unsigned int num_sub = 2; + unsigned int lease_duration_ms = 500; + unsigned int announcement_period_ms = 250; + + // Publishers + PubSubParticipant publishers(num_pub, 0u, 3u, 0u); + ASSERT_TRUE(publishers.init_participant()); + publishers.pub_topic_name(TEST_TOPIC_NAME) + .reliability(RELIABLE_RELIABILITY_QOS) + .pub_liveliness_announcement_period(announcement_period_ms * 1e-3) + .pub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .pub_liveliness_kind(AUTOMATIC_LIVELINESS_QOS); + ASSERT_TRUE(publishers.init_publisher(0u)); + publishers.pub_topic_name(TEST_TOPIC_NAME) + .reliability(RELIABLE_RELIABILITY_QOS) + .pub_liveliness_announcement_period(announcement_period_ms * 1e-3) + .pub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .pub_liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS); + ASSERT_TRUE(publishers.init_publisher(1u)); + + // Subscribers + PubSubParticipant subscribers(0u, num_sub, 0u, 3u); + ASSERT_TRUE(subscribers.init_participant()); + subscribers.sub_topic_name(TEST_TOPIC_NAME) + .reliability(RELIABLE_RELIABILITY_QOS) + .sub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .sub_liveliness_kind(AUTOMATIC_LIVELINESS_QOS); + ASSERT_TRUE(subscribers.init_subscriber(0u)); + subscribers.sub_topic_name(TEST_TOPIC_NAME) + .reliability(RELIABLE_RELIABILITY_QOS) + .sub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .sub_liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS); + ASSERT_TRUE(subscribers.init_subscriber(1u)); + + publishers.pub_wait_discovery(); + subscribers.sub_wait_discovery(); + + publishers.assert_liveliness(1u); + std::this_thread::sleep_for(std::chrono::milliseconds(announcement_period_ms * 2)); + + // All three subscribers are notified that liveliness was recovered + EXPECT_EQ(subscribers.sub_times_liveliness_recovered(), 3u); + + std::this_thread::sleep_for(std::chrono::milliseconds(lease_duration_ms * 2)); + EXPECT_EQ(publishers.pub_times_liveliness_lost(), 1u); + EXPECT_EQ(subscribers.sub_times_liveliness_lost(), 1u); +} + +//! Tests liveliness in the same scenario as above but using manual by topic liveliness +//! A participant with three publishers with different liveliness kinds +//! A participant with three subscribers with different liveliness kinds +TEST(LivelinessQos, ThreeWriters_ThreeReaders) +{ + unsigned int num_pub = 3; + unsigned int num_sub = 3; + unsigned int lease_duration_ms = 100; + unsigned int announcement_period_ms = 10; + + // Publishers + PubSubParticipant publishers(num_pub, 0u, 6u, 0u); + ASSERT_TRUE(publishers.init_participant()); + publishers.pub_topic_name(TEST_TOPIC_NAME) + .reliability(RELIABLE_RELIABILITY_QOS) + .pub_liveliness_announcement_period(announcement_period_ms * 1e-3) + .pub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .pub_liveliness_kind(AUTOMATIC_LIVELINESS_QOS); + ASSERT_TRUE(publishers.init_publisher(0u)); + publishers.pub_topic_name(TEST_TOPIC_NAME) + .reliability(RELIABLE_RELIABILITY_QOS) + .pub_liveliness_announcement_period(announcement_period_ms * 1e-3) + .pub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .pub_liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS); + ASSERT_TRUE(publishers.init_publisher(1u)); + publishers.pub_topic_name(TEST_TOPIC_NAME) + .reliability(RELIABLE_RELIABILITY_QOS) + .pub_liveliness_announcement_period(announcement_period_ms * 1e-3) + .pub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .pub_liveliness_kind(MANUAL_BY_TOPIC_LIVELINESS_QOS); + ASSERT_TRUE(publishers.init_publisher(2u)); + + // Subscribers + PubSubParticipant subscribers(0u, num_sub, 0u, 6u); + ASSERT_TRUE(subscribers.init_participant()); + subscribers.sub_topic_name(TEST_TOPIC_NAME) + .reliability(RELIABLE_RELIABILITY_QOS) + .sub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .sub_liveliness_kind(AUTOMATIC_LIVELINESS_QOS); + ASSERT_TRUE(subscribers.init_subscriber(0u)); + subscribers.sub_topic_name(TEST_TOPIC_NAME) + .reliability(RELIABLE_RELIABILITY_QOS) + .sub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .sub_liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS); + ASSERT_TRUE(subscribers.init_subscriber(1u)); + subscribers.sub_topic_name(TEST_TOPIC_NAME) + .reliability(RELIABLE_RELIABILITY_QOS) + .sub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .sub_liveliness_kind(MANUAL_BY_TOPIC_LIVELINESS_QOS); + ASSERT_TRUE(subscribers.init_subscriber(2u)); + + publishers.pub_wait_discovery(); + subscribers.sub_wait_discovery(); + + // From the point of view of the AUTOMATIC reader, the three writers will have recovered liveliness + subscribers.sub_wait_liveliness_recovered(3u); + EXPECT_EQ(subscribers.sub_times_liveliness_recovered(), 3u); + + // The manual by participant writer asserts liveliness + // The manual by participant reader will consider that both the manual by participant and manual by topic + // writers have recovered liveliness + publishers.assert_liveliness(1u); + subscribers.sub_wait_liveliness_recovered(5u); + EXPECT_EQ(subscribers.sub_times_liveliness_recovered(), 5u); + + // The manual by topic publisher asserts liveliness + // The manual by topic reader will detect that a new writer has recovered liveliness + publishers.assert_liveliness(2u); + subscribers.sub_wait_liveliness_recovered(6u); + EXPECT_EQ(subscribers.sub_times_liveliness_recovered(), 6u); + + // Wait so that the manual by participant and manual by topic writers lose liveliness + // The manual by participant subscriber will detect that two writers lost liveliness + // The manual by topic subscriber will detect that one writer lost liveliness + // This means that the subscribing participant will see that liveliness was lost three times + subscribers.sub_wait_liveliness_lost(3u); + EXPECT_EQ(publishers.pub_times_liveliness_lost(), 2u); + EXPECT_EQ(subscribers.sub_times_liveliness_lost(), 3u); +} + +//! Tests the case where a writer matched to two readers changes QoS and stays matched to only one reader +TEST(LivelinessQos, UnmatchedWriter) +{ + unsigned int num_pub = 1; + unsigned int num_sub = 2; + unsigned int lease_duration_ms = 500; + unsigned int announcement_period_ms = 250; + + // Publishers + PubSubParticipant publishers(num_pub, 0u, 2u, 0u); + ASSERT_TRUE(publishers.init_participant()); + publishers.pub_topic_name(TEST_TOPIC_NAME) + .pub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .pub_liveliness_announcement_period(announcement_period_ms * 1e-3) + .pub_liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) + .pub_deadline_period(0.15); + ASSERT_TRUE(publishers.init_publisher(0u)); + + // Subscribers + PubSubParticipant subscribers(0u, num_sub, 0u, 2u); + ASSERT_TRUE(subscribers.init_participant()); + subscribers.sub_topic_name(TEST_TOPIC_NAME) + .sub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .sub_liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) + .sub_deadline_period(0.5); + ASSERT_TRUE(subscribers.init_subscriber(0u)); + subscribers.sub_topic_name(TEST_TOPIC_NAME) + .sub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .sub_liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) + .sub_deadline_period(1.5); + ASSERT_TRUE(subscribers.init_subscriber(1u)); + + publishers.pub_wait_discovery(); + subscribers.sub_wait_discovery(); + + // Change deadline period of the first subscriber so that it no longer matches with the publisher + subscribers.sub_update_deadline_period(0.10, 0u); + + publishers.assert_liveliness(0u); + std::this_thread::sleep_for(std::chrono::milliseconds(announcement_period_ms * 2)); + EXPECT_EQ(subscribers.sub_times_liveliness_recovered(), 1u); +} + +//! Tests liveliness structs when a writer changes from being alive to losing liveliness +//! Writer is reliable, and MANUAL_BY_TOPIC +//! Reader is reliable, and MANUAL_BY_TOPIC +TEST(LivelinessQos, LivelinessChangedStatus_Alive_NotAlive) +{ + PubSubReader reader(TEST_TOPIC_NAME); + PubSubWriter writer(TEST_TOPIC_NAME); + + // Liveliness lease duration and announcement period, in seconds + Duration_t liveliness_s(100 * 1e-3); + Duration_t announcement_period(100 * 1e-3 * 0.5); + + reader.reliability(RELIABLE_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_TOPIC_LIVELINESS_QOS) + .liveliness_lease_duration(liveliness_s) + .init(); + writer.reliability(RELIABLE_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_TOPIC_LIVELINESS_QOS) + .liveliness_announcement_period(announcement_period) + .liveliness_lease_duration(liveliness_s) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer.isInitialized()); + + // Wait for discovery. + writer.wait_discovery(); + reader.wait_discovery(); + + LivelinessChangedStatus status = reader.liveliness_changed_status(); + EXPECT_EQ(status.alive_count, 0); + EXPECT_EQ(status.alive_count_change, 0); + EXPECT_EQ(status.not_alive_count, 0); + EXPECT_EQ(status.not_alive_count_change, 0); + + // Assert liveliness + writer.assert_liveliness(); + reader.wait_liveliness_recovered(); + + status = reader.liveliness_changed_status(); + EXPECT_EQ(status.alive_count, 1); + EXPECT_EQ(status.alive_count_change, 1); + EXPECT_EQ(status.not_alive_count, 0); + EXPECT_EQ(status.not_alive_count_change, 0); + + // Wait until liveliness is lost + reader.wait_liveliness_lost(); + + status = reader.liveliness_changed_status(); + EXPECT_EQ(status.alive_count, 0); + EXPECT_EQ(status.alive_count_change, -1); + EXPECT_EQ(status.not_alive_count, 1); + EXPECT_EQ(status.not_alive_count_change, 1); +} + +//! Tests liveliness structs when an alive writer is unmatched +//! Writer is reliable, and MANUAL_BY_TOPIC +//! Reader is reliable, and MANUAL_BY_TOPIC +TEST(LivelinessQos, LivelinessChangedStatus_Alive_Unmatched) +{ + PubSubReader reader(TEST_TOPIC_NAME); + PubSubWriter writer(TEST_TOPIC_NAME); + + // Liveliness lease duration and announcement period, in seconds + Duration_t liveliness_s(100 * 1e-3); + Duration_t announcement_period(100 * 1e-3 * 0.5); + + reader.reliability(RELIABLE_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_TOPIC_LIVELINESS_QOS) + .liveliness_lease_duration(liveliness_s) + .deadline_period(0.15) + .init(); + writer.reliability(RELIABLE_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_TOPIC_LIVELINESS_QOS) + .liveliness_announcement_period(announcement_period) + .liveliness_lease_duration(liveliness_s) + .deadline_period(0.15) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer.isInitialized()); + + // Wait for discovery. + writer.wait_discovery(); + reader.wait_discovery(); + + // Assert liveliness + writer.assert_liveliness(); + reader.wait_liveliness_recovered(); + + LivelinessChangedStatus status = reader.liveliness_changed_status(); + EXPECT_EQ(status.alive_count, 1); + EXPECT_EQ(status.alive_count_change, 1); + EXPECT_EQ(status.not_alive_count, 0); + EXPECT_EQ(status.not_alive_count_change, 0); + + // Now unmatch by changing the deadline period of the reader + reader.update_deadline_period(0.10); + + status = reader.liveliness_changed_status(); + EXPECT_EQ(status.alive_count, 0); + EXPECT_EQ(status.alive_count_change, -1); + EXPECT_EQ(status.not_alive_count, 0); + EXPECT_EQ(status.not_alive_count_change, 0); +} + +//! Tests liveliness structs when a not alive writer is unmatched +//! Writer is reliable, and MANUAL_BY_TOPIC +//! Reader is reliable, and MANUAL_BY_TOPIC +TEST(LivelinessQos, LivelinessChangedStatus_NotAlive_Unmatched) +{ + PubSubReader reader(TEST_TOPIC_NAME); + PubSubWriter writer(TEST_TOPIC_NAME); + + // Liveliness lease duration and announcement period, in seconds + Duration_t liveliness_s(100 * 1e-3); + Duration_t announcement_period(100 * 1e-3 * 0.5); + + reader.reliability(RELIABLE_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_TOPIC_LIVELINESS_QOS) + .liveliness_lease_duration(liveliness_s) + .deadline_period(0.15) + .init(); + writer.reliability(RELIABLE_RELIABILITY_QOS) + .liveliness_kind(MANUAL_BY_TOPIC_LIVELINESS_QOS) + .liveliness_announcement_period(announcement_period) + .liveliness_lease_duration(liveliness_s) + .deadline_period(0.15) + .init(); + + ASSERT_TRUE(reader.isInitialized()); + ASSERT_TRUE(writer.isInitialized()); + + // Wait for discovery. + writer.wait_discovery(); + reader.wait_discovery(); + + // Assert liveliness + writer.assert_liveliness(); + reader.wait_liveliness_recovered(); + + LivelinessChangedStatus status = reader.liveliness_changed_status(); + EXPECT_EQ(status.alive_count, 1); + EXPECT_EQ(status.alive_count_change, 1); + EXPECT_EQ(status.not_alive_count, 0); + EXPECT_EQ(status.not_alive_count_change, 0); + + // Wait for liveliness lost + reader.wait_liveliness_lost(); + + // Now unmatch by changing the deadline period of the reader + reader.update_deadline_period(0.10); + + status = reader.liveliness_changed_status(); + EXPECT_EQ(status.alive_count, 0); + EXPECT_EQ(status.alive_count_change, 0); + EXPECT_EQ(status.not_alive_count, 0); + EXPECT_EQ(status.not_alive_count_change, -1); +} + + +//! Tests the assert_liveliness on the participant +//! A participant with three publishers, two MANUAL_BY_PARTICIPANT liveliness, one MANUAL_BY_TOPIC +TEST(LivelinessQos, AssertLivelinessParticipant) +{ + unsigned int num_pub = 3; + unsigned int lease_duration_ms = 100; + unsigned int announcement_period_ms = 10; + + // Publishers + PubSubParticipant publishers(num_pub, 0u, 0u, 0u); + ASSERT_TRUE(publishers.init_participant()); + publishers.pub_topic_name(TEST_TOPIC_NAME) + .reliability(RELIABLE_RELIABILITY_QOS) + .pub_liveliness_announcement_period(announcement_period_ms * 1e-3) + .pub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .pub_liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS); + ASSERT_TRUE(publishers.init_publisher(0u)); + publishers.pub_topic_name(TEST_TOPIC_NAME) + .reliability(RELIABLE_RELIABILITY_QOS) + .pub_liveliness_announcement_period(announcement_period_ms * 1e-3) + .pub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .pub_liveliness_kind(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS); + ASSERT_TRUE(publishers.init_publisher(1u)); + publishers.pub_topic_name(TEST_TOPIC_NAME) + .reliability(RELIABLE_RELIABILITY_QOS) + .pub_liveliness_announcement_period(announcement_period_ms * 1e-3) + .pub_liveliness_lease_duration(lease_duration_ms * 1e-3) + .pub_liveliness_kind(MANUAL_BY_TOPIC_LIVELINESS_QOS); + ASSERT_TRUE(publishers.init_publisher(1u)); + + // Assert liveliness + publishers.assert_liveliness_participant(); + + // Wait for alive publishers (only the two MANUAL_BY_PARTICIPANT publishers should be alive) to lose liveliness + std::this_thread::sleep_for(std::chrono::milliseconds(lease_duration_ms * 4)); + + // Only the two MANUAL_BY_PARTICIPANT publishers will have lost liveliness, as the + // MANUAL_BY_TOPIC was never asserted + EXPECT_EQ(publishers.pub_times_liveliness_lost(), 2u); +} diff --git a/test/blackbox/BlackboxTestsNetworkConf.cpp b/test/blackbox/BlackboxTestsNetworkConf.cpp index e2a6f315d5a..f45e3e20813 100644 --- a/test/blackbox/BlackboxTestsNetworkConf.cpp +++ b/test/blackbox/BlackboxTestsNetworkConf.cpp @@ -39,7 +39,7 @@ static void GetIP4s(std::vector& interfaces) } //Verify that outLocatorList is used to select the desired output channel -BLACKBOXTEST(BlackBox, PubSubOutLocatorSelection) +TEST(BlackBox, PubSubOutLocatorSelection) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -87,7 +87,7 @@ BLACKBOXTEST(BlackBox, PubSubOutLocatorSelection) reader.block_for_all(); } -BLACKBOXTEST(BlackBox, PubSubInterfaceWhitelistLocalhost) +TEST(BlackBox, PubSubInterfaceWhitelistLocalhost) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -123,7 +123,7 @@ BLACKBOXTEST(BlackBox, PubSubInterfaceWhitelistLocalhost) reader.block_for_all(); } -BLACKBOXTEST(BlackBox, PubSubInterfaceWhitelistUnicast) +TEST(BlackBox, PubSubInterfaceWhitelistUnicast) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); diff --git a/test/blackbox/BlackboxTestsPersistence.cpp b/test/blackbox/BlackboxTestsPersistence.cpp index ab0d3cf9c2b..482847db473 100644 --- a/test/blackbox/BlackboxTestsPersistence.cpp +++ b/test/blackbox/BlackboxTestsPersistence.cpp @@ -23,7 +23,7 @@ using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::rtps; -class EVALUATOR(BlackBoxPersistence, MEMORY_MODE_STRING) : public ::testing::Test +class BlackBoxPersistence : public ::testing::Test { public: const std::string& db_file_name() const @@ -42,7 +42,10 @@ class EVALUATOR(BlackBoxPersistence, MEMORY_MODE_STRING) : public ::testing::Tes writer.wait_discovery(); reader.wait_discovery(); + std::cout << "Discovery finished." << std::endl; + auto data = default_helloworld_data_generator(); + size_t n_samples = data.size(); not_received_data.insert(not_received_data.end(), data.begin(), data.end()); reader.expected_data(not_received_data); @@ -56,21 +59,28 @@ class EVALUATOR(BlackBoxPersistence, MEMORY_MODE_STRING) : public ::testing::Tes // Block reader until reception finished or timeout. if (seq_check > 0) { + std::cout << "Reader waiting for sequence " << seq_check << "." << std::endl; reader.block_until_seq_number_greater_or_equal({ 0,seq_check }); } else { if (reliable) { + std::cout << "Reader waiting for " << n_samples << " samples." << std::endl; reader.block_for_all(); } else { + std::cout << "Reader waiting for 2 samples." << std::endl; reader.block_for_at_least(2); } } + std::cout << "Last received sequence was " << reader.get_last_received_sequence_number() << std::endl; + + std::cout << "Destroying reader..." << std::endl; reader.destroy(); + std::cout << "Destroying writer..." << std::endl; writer.destroy(); data = reader.not_received_data(); @@ -97,7 +107,7 @@ class EVALUATOR(BlackBoxPersistence, MEMORY_MODE_STRING) : public ::testing::Tes *p_value++ = info->line(); *p_value = GET_PID(); guid_prefix_.value[8] = HAVE_SECURITY; - guid_prefix_.value[9] = MEMORY_MODE_BYTE; + guid_prefix_.value[9] = 3; //PREALLOCATED_MEMORY_MODE eprosima::fastrtps::rtps::LocatorList_t loc; eprosima::fastrtps::rtps::IPFinder::getIP4Address(&loc); if (loc.size() > 0) @@ -118,7 +128,7 @@ class EVALUATOR(BlackBoxPersistence, MEMORY_MODE_STRING) : public ::testing::Tes } }; -BLACKBOXTEST_F(BlackBoxPersistence, RTPSAsNonReliableWithPersistence) +TEST_F(BlackBoxPersistence, RTPSAsNonReliableWithPersistence) { RTPSWithRegistrationReader reader(TEST_TOPIC_NAME); RTPSWithRegistrationWriter writer(TEST_TOPIC_NAME); @@ -151,7 +161,7 @@ BLACKBOXTEST_F(BlackBoxPersistence, RTPSAsNonReliableWithPersistence) std::cout << "Second round finished." << std::endl; } -BLACKBOXTEST_F(BlackBoxPersistence, AsyncRTPSAsNonReliableWithPersistence) +TEST_F(BlackBoxPersistence, AsyncRTPSAsNonReliableWithPersistence) { RTPSWithRegistrationReader reader(TEST_TOPIC_NAME); RTPSWithRegistrationWriter writer(TEST_TOPIC_NAME); @@ -183,7 +193,7 @@ BLACKBOXTEST_F(BlackBoxPersistence, AsyncRTPSAsNonReliableWithPersistence) std::cout << "Second round finished." << std::endl; } -BLACKBOXTEST_F(BlackBoxPersistence, RTPSAsReliableWithPersistence) +TEST_F(BlackBoxPersistence, RTPSAsReliableWithPersistence) { RTPSWithRegistrationReader reader(TEST_TOPIC_NAME); RTPSWithRegistrationWriter writer(TEST_TOPIC_NAME); @@ -215,7 +225,7 @@ BLACKBOXTEST_F(BlackBoxPersistence, RTPSAsReliableWithPersistence) std::cout << "Second round finished." << std::endl; } -BLACKBOXTEST_F(BlackBoxPersistence, AsyncRTPSAsReliableWithPersistence) +TEST_F(BlackBoxPersistence, AsyncRTPSAsReliableWithPersistence) { RTPSWithRegistrationReader reader(TEST_TOPIC_NAME); RTPSWithRegistrationWriter writer(TEST_TOPIC_NAME); diff --git a/test/blackbox/BlackboxTestsPubSubBasic.cpp b/test/blackbox/BlackboxTestsPubSubBasic.cpp index 53a8150161c..1989c7cadc7 100644 --- a/test/blackbox/BlackboxTestsPubSubBasic.cpp +++ b/test/blackbox/BlackboxTestsPubSubBasic.cpp @@ -22,7 +22,7 @@ using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::rtps; -BLACKBOXTEST(BlackBox, PubSubAsNonReliableHelloworld) +TEST(BlackBox, PubSubAsNonReliableHelloworld) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -50,7 +50,7 @@ BLACKBOXTEST(BlackBox, PubSubAsNonReliableHelloworld) reader.block_for_at_least(2); } -BLACKBOXTEST(BlackBox, AsyncPubSubAsNonReliableHelloworld) +TEST(BlackBox, AsyncPubSubAsNonReliableHelloworld) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -80,7 +80,7 @@ BLACKBOXTEST(BlackBox, AsyncPubSubAsNonReliableHelloworld) reader.block_for_at_least(2); } -BLACKBOXTEST(BlackBox, PubSubAsReliableHelloworld) +TEST(BlackBox, PubSubAsReliableHelloworld) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -111,7 +111,7 @@ BLACKBOXTEST(BlackBox, PubSubAsReliableHelloworld) reader.block_for_all(); } -BLACKBOXTEST(BlackBox, AsyncPubSubAsReliableHelloworld) +TEST(BlackBox, AsyncPubSubAsReliableHelloworld) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -143,7 +143,7 @@ BLACKBOXTEST(BlackBox, AsyncPubSubAsReliableHelloworld) reader.block_for_all(); } -BLACKBOXTEST(BlackBox, ReqRepAsReliableHelloworld) +TEST(BlackBox, ReqRepAsReliableHelloworld) { ReqRepAsReliableHelloWorldRequester requester; ReqRepAsReliableHelloWorldReplier replier; @@ -167,7 +167,7 @@ BLACKBOXTEST(BlackBox, ReqRepAsReliableHelloworld) } } -BLACKBOXTEST(BlackBox, PubSubAsReliableData64kb) +TEST(BlackBox, PubSubAsReliableData64kb) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -198,7 +198,7 @@ BLACKBOXTEST(BlackBox, PubSubAsReliableData64kb) reader.block_for_all(); } -BLACKBOXTEST(BlackBox, PubSubMoreThan256Unacknowledged) +TEST(BlackBox, PubSubMoreThan256Unacknowledged) { PubSubWriter writer(TEST_TOPIC_NAME); @@ -225,7 +225,7 @@ BLACKBOXTEST(BlackBox, PubSubMoreThan256Unacknowledged) reader.block_for_all(); } -BLACKBOXTEST(BlackBox, PubSubAsReliableHelloworldMulticastDisabled) +TEST(BlackBox, PubSubAsReliableHelloworldMulticastDisabled) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); diff --git a/test/blackbox/BlackboxTestsPubSubFlowControllers.cpp b/test/blackbox/BlackboxTestsPubSubFlowControllers.cpp index 534430cb57f..8427e885a47 100644 --- a/test/blackbox/BlackboxTestsPubSubFlowControllers.cpp +++ b/test/blackbox/BlackboxTestsPubSubFlowControllers.cpp @@ -20,7 +20,7 @@ using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::rtps; -BLACKBOXTEST(BlackBox, AsyncPubSubAsReliableData64kbWithParticipantFlowControl) +TEST(BlackBox, AsyncPubSubAsReliableData64kbWithParticipantFlowControl) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -56,7 +56,7 @@ BLACKBOXTEST(BlackBox, AsyncPubSubAsReliableData64kbWithParticipantFlowControl) reader.block_for_all(); } -BLACKBOXTEST(BlackBox, AsyncPubSubAsReliableData64kbWithParticipantFlowControlAndUserTransport) +TEST(BlackBox, AsyncPubSubAsReliableData64kbWithParticipantFlowControlAndUserTransport) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -96,7 +96,7 @@ BLACKBOXTEST(BlackBox, AsyncPubSubAsReliableData64kbWithParticipantFlowControlAn reader.block_for_all(); } -BLACKBOXTEST(BlackBox, AsyncPubSubWithFlowController64kb) +TEST(BlackBox, AsyncPubSubWithFlowController64kb) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter slowWriter(TEST_TOPIC_NAME); @@ -125,7 +125,7 @@ BLACKBOXTEST(BlackBox, AsyncPubSubWithFlowController64kb) ASSERT_EQ(reader.getReceivedCount(), 1u); } -BLACKBOXTEST(BlackBox, FlowControllerIfNotAsync) +TEST(BlackBox, FlowControllerIfNotAsync) { PubSubWriter writer(TEST_TOPIC_NAME); diff --git a/test/blackbox/BlackboxTestsPubSubFragments.cpp b/test/blackbox/BlackboxTestsPubSubFragments.cpp index 1b61b5f22c1..96ab3a82781 100644 --- a/test/blackbox/BlackboxTestsPubSubFragments.cpp +++ b/test/blackbox/BlackboxTestsPubSubFragments.cpp @@ -23,7 +23,7 @@ using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::rtps; -BLACKBOXTEST(BlackBox, PubSubAsNonReliableData300kb) +TEST(BlackBox, PubSubAsNonReliableData300kb) { // Mutes an expected error Log::SetErrorStringFilter(std::regex("^((?!Big data).)*$")); @@ -41,7 +41,7 @@ BLACKBOXTEST(BlackBox, PubSubAsNonReliableData300kb) ASSERT_FALSE(data.empty()); } -BLACKBOXTEST(BlackBox, PubSubAsReliableData300kb) +TEST(BlackBox, PubSubAsReliableData300kb) { // Mutes an expected error Log::SetErrorStringFilter(std::regex("^((?!Big data).)*$")); @@ -59,7 +59,7 @@ BLACKBOXTEST(BlackBox, PubSubAsReliableData300kb) ASSERT_FALSE(data.empty()); } -BLACKBOXTEST(BlackBox, AsyncPubSubAsNonReliableData300kb) +TEST(BlackBox, AsyncPubSubAsNonReliableData300kb) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -96,7 +96,7 @@ BLACKBOXTEST(BlackBox, AsyncPubSubAsNonReliableData300kb) reader.block_for_at_least(2); } -BLACKBOXTEST(BlackBox, AsyncPubSubAsReliableData300kb) +TEST(BlackBox, AsyncPubSubAsReliableData300kb) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -134,7 +134,7 @@ BLACKBOXTEST(BlackBox, AsyncPubSubAsReliableData300kb) reader.block_for_all(); } -BLACKBOXTEST(BlackBox, AsyncPubSubAsReliableData300kbInLossyConditions) +TEST(BlackBox, AsyncPubSubAsReliableData300kbInLossyConditions) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -186,7 +186,7 @@ BLACKBOXTEST(BlackBox, AsyncPubSubAsReliableData300kbInLossyConditions) ASSERT_EQ(eprosima::fastrtps::rtps::test_UDPv4Transport::test_UDPv4Transport_DropLog.size(), testTransport->dropLogLength); } -BLACKBOXTEST(BlackBox, AsyncFragmentSizeTest) +TEST(BlackBox, AsyncFragmentSizeTest) { // ThroghputController size large than maxMessageSize. { diff --git a/test/blackbox/BlackboxTestsPubSubHistory.cpp b/test/blackbox/BlackboxTestsPubSubHistory.cpp index 6b8cde4a1b0..d80e32dc38b 100644 --- a/test/blackbox/BlackboxTestsPubSubHistory.cpp +++ b/test/blackbox/BlackboxTestsPubSubHistory.cpp @@ -21,7 +21,7 @@ using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::rtps; // Test created to check bug #1568 (Github #34) -BLACKBOXTEST(BlackBox, PubSubAsNonReliableKeepLastReaderSmallDepth) +TEST(BlackBox, PubSubAsNonReliableKeepLastReaderSmallDepth) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -64,7 +64,7 @@ BLACKBOXTEST(BlackBox, PubSubAsNonReliableKeepLastReaderSmallDepth) } //Test created to deal with Issue 39 on Github -BLACKBOXTEST(BlackBox, CacheChangeReleaseTest) +TEST(BlackBox, CacheChangeReleaseTest) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -104,7 +104,7 @@ BLACKBOXTEST(BlackBox, CacheChangeReleaseTest) } // Test created to check bug #1555 (Github #31) -BLACKBOXTEST(BlackBox, PubSubAsReliableKeepLastReaderSmallDepth) +TEST(BlackBox, PubSubAsReliableKeepLastReaderSmallDepth) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -151,7 +151,7 @@ BLACKBOXTEST(BlackBox, PubSubAsReliableKeepLastReaderSmallDepth) } // Test created to check bug #1738 (Github #54) -BLACKBOXTEST(BlackBox, PubSubAsReliableKeepLastWriterSmallDepth) +TEST(BlackBox, PubSubAsReliableKeepLastWriterSmallDepth) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -183,7 +183,7 @@ BLACKBOXTEST(BlackBox, PubSubAsReliableKeepLastWriterSmallDepth) } // Test created to check bug #1558 (Github #33) -BLACKBOXTEST(BlackBox, PubSubKeepAll) +TEST(BlackBox, PubSubKeepAll) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -230,7 +230,7 @@ BLACKBOXTEST(BlackBox, PubSubKeepAll) } // Test created to check bug #1558 (Github #33) -BLACKBOXTEST(BlackBox, PubSubKeepAllTransient) +TEST(BlackBox, PubSubKeepAllTransient) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -277,7 +277,7 @@ BLACKBOXTEST(BlackBox, PubSubKeepAllTransient) } } -BLACKBOXTEST(BlackBox, PubReliableKeepAllSubNonReliable) +TEST(BlackBox, PubReliableKeepAllSubNonReliable) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -309,7 +309,7 @@ BLACKBOXTEST(BlackBox, PubReliableKeepAllSubNonReliable) } //Verify that Cachechanges are removed from History when the a Writer unmatches -BLACKBOXTEST(BlackBox, StatefulReaderCacheChangeRelease){ +TEST(BlackBox, StatefulReaderCacheChangeRelease){ PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -345,7 +345,7 @@ void send_async_data(PubSubWriter& writer, std::list data_t ASSERT_TRUE(data_to_send.empty()); } -BLACKBOXTEST(BlackBox, PubSubAsReliableMultithreadKeepLast1) +TEST(BlackBox, PubSubAsReliableMultithreadKeepLast1) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); diff --git a/test/blackbox/BlackboxTestsRTPS.cpp b/test/blackbox/BlackboxTestsRTPS.cpp index 9590e0ee55f..2a3cb07c7c0 100644 --- a/test/blackbox/BlackboxTestsRTPS.cpp +++ b/test/blackbox/BlackboxTestsRTPS.cpp @@ -23,7 +23,7 @@ using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::rtps; -BLACKBOXTEST(BlackBox, RTPSAsNonReliableSocket) +TEST(BlackBox, RTPSAsNonReliableSocket) { RTPSAsSocketReader reader(TEST_TOPIC_NAME); RTPSAsSocketWriter writer(TEST_TOPIC_NAME); @@ -50,7 +50,7 @@ BLACKBOXTEST(BlackBox, RTPSAsNonReliableSocket) reader.block_for_at_least(2); } -BLACKBOXTEST(BlackBox, AsyncRTPSAsNonReliableSocket) +TEST(BlackBox, AsyncRTPSAsNonReliableSocket) { RTPSAsSocketReader reader(TEST_TOPIC_NAME); RTPSAsSocketWriter writer(TEST_TOPIC_NAME); @@ -78,7 +78,7 @@ BLACKBOXTEST(BlackBox, AsyncRTPSAsNonReliableSocket) reader.block_for_at_least(2); } -BLACKBOXTEST(BlackBox, AsyncRTPSAsNonReliableSocketWithWriterSpecificFlowControl) +TEST(BlackBox, AsyncRTPSAsNonReliableSocketWithWriterSpecificFlowControl) { RTPSAsSocketReader reader(TEST_TOPIC_NAME); RTPSAsSocketWriter writer(TEST_TOPIC_NAME); @@ -109,7 +109,7 @@ BLACKBOXTEST(BlackBox, AsyncRTPSAsNonReliableSocketWithWriterSpecificFlowControl reader.block_for_at_least(2); } -BLACKBOXTEST(BlackBox, RTPSAsReliableSocket) +TEST(BlackBox, RTPSAsReliableSocket) { RTPSAsSocketReader reader(TEST_TOPIC_NAME); RTPSAsSocketWriter writer(TEST_TOPIC_NAME); @@ -138,7 +138,7 @@ BLACKBOXTEST(BlackBox, RTPSAsReliableSocket) reader.block_for_all(); } -BLACKBOXTEST(BlackBox, AsyncRTPSAsReliableSocket) +TEST(BlackBox, AsyncRTPSAsReliableSocket) { RTPSAsSocketReader reader(TEST_TOPIC_NAME); RTPSAsSocketWriter writer(TEST_TOPIC_NAME); @@ -168,7 +168,7 @@ BLACKBOXTEST(BlackBox, AsyncRTPSAsReliableSocket) reader.block_for_all(); } -BLACKBOXTEST(BlackBox, RTPSAsNonReliableWithRegistration) +TEST(BlackBox, RTPSAsNonReliableWithRegistration) { RTPSWithRegistrationReader reader(TEST_TOPIC_NAME); RTPSWithRegistrationWriter writer(TEST_TOPIC_NAME); @@ -198,7 +198,7 @@ BLACKBOXTEST(BlackBox, RTPSAsNonReliableWithRegistration) reader.block_for_at_least(2); } -BLACKBOXTEST(BlackBox, AsyncRTPSAsNonReliableWithRegistration) +TEST(BlackBox, AsyncRTPSAsNonReliableWithRegistration) { RTPSWithRegistrationReader reader(TEST_TOPIC_NAME); RTPSWithRegistrationWriter writer(TEST_TOPIC_NAME); @@ -229,7 +229,7 @@ BLACKBOXTEST(BlackBox, AsyncRTPSAsNonReliableWithRegistration) reader.block_for_at_least(2); } -BLACKBOXTEST(BlackBox, RTPSAsReliableWithRegistration) +TEST(BlackBox, RTPSAsReliableWithRegistration) { RTPSWithRegistrationReader reader(TEST_TOPIC_NAME); RTPSWithRegistrationWriter writer(TEST_TOPIC_NAME); @@ -261,7 +261,7 @@ BLACKBOXTEST(BlackBox, RTPSAsReliableWithRegistration) reader.block_for_all(); } -BLACKBOXTEST(BlackBox, AsyncRTPSAsReliableWithRegistration) +TEST(BlackBox, AsyncRTPSAsReliableWithRegistration) { RTPSWithRegistrationReader reader(TEST_TOPIC_NAME); RTPSWithRegistrationWriter writer(TEST_TOPIC_NAME); @@ -294,7 +294,7 @@ BLACKBOXTEST(BlackBox, AsyncRTPSAsReliableWithRegistration) } // Regression test of Refs #2786, github issue #194 -BLACKBOXTEST(BlackBox, RTPSAsReliableVolatileSocket) +TEST(BlackBox, RTPSAsReliableVolatileSocket) { RTPSAsSocketReader reader(TEST_TOPIC_NAME); RTPSAsSocketWriter writer(TEST_TOPIC_NAME); diff --git a/test/blackbox/BlackboxTestsRealtimeAllocations.cpp b/test/blackbox/BlackboxTestsRealtimeAllocations.cpp index c45d20a4f33..86eb6581892 100644 --- a/test/blackbox/BlackboxTestsRealtimeAllocations.cpp +++ b/test/blackbox/BlackboxTestsRealtimeAllocations.cpp @@ -20,10 +20,7 @@ using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::rtps; -// This tests only make sense when not allocating data on the history pool -#ifndef DYNAMIC_RESERVE_MEMORY_MODE_TEST - -BLACKBOXTEST(BlackBox, PubSubReliableWithLimitedSubscribers) +TEST(BlackBox, PubSubReliableWithLimitedSubscribers) { PubSubReader reader(TEST_TOPIC_NAME); PubSubReader reader2(TEST_TOPIC_NAME); @@ -75,7 +72,7 @@ BLACKBOXTEST(BlackBox, PubSubReliableWithLimitedSubscribers) ASSERT_EQ(reader2.getReceivedCount(), 0u); } -BLACKBOXTEST(BlackBox, AsyncPubSubReliableWithLimitedSubscribers) +TEST(BlackBox, AsyncPubSubReliableWithLimitedSubscribers) { PubSubReader reader(TEST_TOPIC_NAME); PubSubReader reader2(TEST_TOPIC_NAME); @@ -128,7 +125,7 @@ BLACKBOXTEST(BlackBox, AsyncPubSubReliableWithLimitedSubscribers) ASSERT_EQ(reader2.getReceivedCount(), 0u); } -BLACKBOXTEST(BlackBox, PubSubBestEffortWithLimitedSubscribers) +TEST(BlackBox, PubSubBestEffortWithLimitedSubscribers) { PubSubReader reader(TEST_TOPIC_NAME); PubSubReader reader2(TEST_TOPIC_NAME); @@ -179,7 +176,7 @@ BLACKBOXTEST(BlackBox, PubSubBestEffortWithLimitedSubscribers) ASSERT_EQ(reader2.getReceivedCount(), 0u); } -BLACKBOXTEST(BlackBox, AsyncPubSubBestEffortWithLimitedSubscribers) +TEST(BlackBox, AsyncPubSubBestEffortWithLimitedSubscribers) { PubSubReader reader(TEST_TOPIC_NAME); PubSubReader reader2(TEST_TOPIC_NAME); @@ -230,5 +227,3 @@ BLACKBOXTEST(BlackBox, AsyncPubSubBestEffortWithLimitedSubscribers) // Second reader should not receive data ASSERT_EQ(reader2.getReceivedCount(), 0u); } - -#endif \ No newline at end of file diff --git a/test/blackbox/BlackboxTestsSecurity.cpp b/test/blackbox/BlackboxTestsSecurity.cpp index 3c3a3b96e6d..0ea3f3fce74 100644 --- a/test/blackbox/BlackboxTestsSecurity.cpp +++ b/test/blackbox/BlackboxTestsSecurity.cpp @@ -27,7 +27,7 @@ using namespace eprosima::fastrtps::rtps; static const char* certs_path = nullptr; -BLACKBOXTEST(BlackBox, BuiltinAuthenticationPlugin_PKIDH_validation_ok) +TEST(BlackBox, BuiltinAuthenticationPlugin_PKIDH_validation_ok) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -84,7 +84,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationPlugin_PKIDH_validation_ok) } // Used to detect Github issue #106 -BLACKBOXTEST(BlackBox, BuiltinAuthenticationPlugin_PKIDH_validation_ok_same_participant) +TEST(BlackBox, BuiltinAuthenticationPlugin_PKIDH_validation_ok_same_participant) { PubSubWriterReader wreader(TEST_TOPIC_NAME); @@ -118,7 +118,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationPlugin_PKIDH_validation_ok_same_part wreader.block_for_all(); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationPlugin_PKIDH_validation_fail) +TEST(BlackBox, BuiltinAuthenticationPlugin_PKIDH_validation_fail) { { PubSubReader reader(TEST_TOPIC_NAME); @@ -178,7 +178,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationPlugin_PKIDH_validation_fail) } } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationPlugin_PKIDH_lossy_conditions) +TEST(BlackBox, BuiltinAuthenticationPlugin_PKIDH_lossy_conditions) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -232,7 +232,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationPlugin_PKIDH_lossy_conditions) reader.wait_discovery(); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_rtps_ok) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_rtps_ok) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -294,7 +294,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_rtps_ok) reader.block_for_at_least(2); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_rtps_ok) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_rtps_ok) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -357,7 +357,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_rtps_ok) } // Used to detect Github issue #106 -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_rtps_ok_same_participant) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_rtps_ok_same_participant) { PubSubWriterReader wreader(TEST_TOPIC_NAME); @@ -395,7 +395,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_rtps_ok_same_partici wreader.block_for_all(); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_large_string) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_large_string) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -457,7 +457,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_large_str reader.block_for_at_least(2); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_rtps_large_string) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_rtps_large_string) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -519,7 +519,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_rtps_large_ reader.block_for_all(); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_rtps_data300kb) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_rtps_data300kb) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -588,7 +588,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_rtps_data reader.block_for_at_least(2); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_rtps_data300kb) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_rtps_data300kb) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -657,7 +657,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_rtps_data30 reader.block_for_all(); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_submessage_ok) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_submessage_ok) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -722,7 +722,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_submessag reader.block_for_at_least(2); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_submessage_ok) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_submessage_ok) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -788,7 +788,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_submessage_ } // Used to detect Github issue #106 -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_submessage_ok_same_participant) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_submessage_ok_same_participant) { PubSubWriterReader wreader(TEST_TOPIC_NAME); @@ -829,7 +829,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_submessage_ok_same_p wreader.block_for_all(); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_submessage_large_string) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_submessage_large_string) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -894,7 +894,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_submessag reader.block_for_at_least(2); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_submessage_large_string) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_submessage_large_string) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -959,7 +959,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_submessage_ reader.block_for_all(); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_submessage_data300kb) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_submessage_data300kb) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -1031,7 +1031,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_submessag reader.block_for_at_least(2); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_submessage_data300kb) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_submessage_data300kb) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -1103,7 +1103,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_submessage_ reader.block_for_all(); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_payload_ok) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_payload_ok) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -1168,7 +1168,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_payload_o reader.block_for_at_least(2); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_payload_ok) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_payload_ok) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -1234,7 +1234,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_payload_ok) } // Used to detect Github issue #106 -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_payload_ok_same_participant) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_payload_ok_same_participant) { PubSubWriterReader wreader(TEST_TOPIC_NAME); @@ -1275,7 +1275,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_payload_ok_same_part wreader.block_for_all(); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_payload_large_string) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_payload_large_string) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -1340,7 +1340,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_payload_l reader.block_for_at_least(2); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_payload_large_string) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_payload_large_string) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -1405,7 +1405,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_payload_lar reader.block_for_all(); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_payload_data300kb) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_payload_data300kb) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -1477,7 +1477,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_payload_d reader.block_for_at_least(2); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_payload_data300kb) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_payload_data300kb) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -1549,7 +1549,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_payload_dat reader.block_for_all(); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_all_ok) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_all_ok) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -1618,7 +1618,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_all_ok) reader.block_for_at_least(2); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_all_ok) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_all_ok) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -1687,7 +1687,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_all_ok) reader.block_for_all(); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_all_large_string) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_all_large_string) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -1756,7 +1756,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_all_large reader.block_for_at_least(2); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_all_large_string) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_all_large_string) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -1825,7 +1825,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_all_large_s reader.block_for_all(); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_all_data300kb) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_all_data300kb) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -1901,7 +1901,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_besteffort_all_data3 reader.block_for_at_least(2); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_all_data300kb) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_all_data300kb) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -1978,7 +1978,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_all_data300 } // Regression test of Refs #2457 -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_all_data300kb_mix) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_all_data300kb_mix) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2055,7 +2055,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_reliable_all_data300 } // Regression test of Refs #2457, Github ros2 #438. -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_user_data) +TEST(BlackBox, BuiltinAuthenticationAndCryptoPlugin_user_data) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2201,7 +2201,7 @@ static void BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation reader.block_for_all(); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_enable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_enable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2210,7 +2210,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_enable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_enable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2219,7 +2219,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_disable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_disable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2229,7 +2229,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_disable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_disable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2238,7 +2238,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_enable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_enable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2247,7 +2247,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_enable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_enable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2256,7 +2256,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_disable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_disable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2266,7 +2266,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_disable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_disable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2275,7 +2275,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_enable_discovery_enable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_enable_discovery_enable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2284,7 +2284,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_disable_discovery_enable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_disable_discovery_enable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2293,7 +2293,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_disable_discovery_disable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_disable_discovery_disable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2303,7 +2303,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_enable_discovery_disable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_enable_discovery_disable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2312,7 +2312,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_enable_discovery_enable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_enable_discovery_enable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2321,7 +2321,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_disable_discovery_enable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_disable_discovery_enable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2330,7 +2330,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_disable_discovery_disable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_disable_discovery_disable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2340,7 +2340,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_enable_discovery_disable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_enable_discovery_disable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2349,7 +2349,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_enable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_enable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2358,7 +2358,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_enable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_enable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2367,7 +2367,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_disable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_disable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2377,7 +2377,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_disable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_disable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2386,7 +2386,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_enable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_enable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2395,7 +2395,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_enable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_enable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2404,7 +2404,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_disable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_disable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2414,7 +2414,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_disable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_disable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2423,7 +2423,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_enable_discovery_enable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_enable_discovery_enable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2432,7 +2432,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_disable_discovery_enable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_disable_discovery_enable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2441,7 +2441,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_disable_discovery_disable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_disable_discovery_disable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2451,7 +2451,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_enable_discovery_disable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_enable_discovery_disable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2460,7 +2460,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_enable_discovery_enable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_enable_discovery_enable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2469,7 +2469,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_disable_discovery_enable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_disable_discovery_enable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2478,7 +2478,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_disable_discovery_disable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_disable_discovery_disable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2488,7 +2488,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_enable_discovery_disable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_enable_discovery_disable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2497,7 +2497,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_enable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_enable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2506,7 +2506,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_enable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_enable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2515,7 +2515,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_disable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_disable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2525,7 +2525,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_disable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_disable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2534,7 +2534,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_enable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_enable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2543,7 +2543,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_enable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_enable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2552,7 +2552,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_disable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_disable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2562,7 +2562,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_disable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_disable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2571,7 +2571,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_enable_discovery_enable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_enable_discovery_enable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2580,7 +2580,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_disable_discovery_enable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_disable_discovery_enable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2589,7 +2589,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_disable_discovery_disable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_disable_discovery_disable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2599,7 +2599,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_enable_discovery_disable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_enable_discovery_disable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2608,7 +2608,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_enable_discovery_enable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_enable_discovery_enable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2617,7 +2617,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_disable_discovery_enable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_disable_discovery_enable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2626,7 +2626,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_disable_discovery_disable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_disable_discovery_disable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2636,7 +2636,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_enable_discovery_disable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_enable_discovery_disable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2645,7 +2645,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_enable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_enable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2654,7 +2654,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_enable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_enable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2663,7 +2663,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_disable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_disable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2673,7 +2673,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_disable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_disable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2682,7 +2682,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_enable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_enable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2691,7 +2691,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_enable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_enable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2700,7 +2700,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_disable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_disable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2710,7 +2710,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_disable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_disable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2719,7 +2719,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_enable_discovery_enable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_enable_discovery_enable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2728,7 +2728,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_disable_discovery_enable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_disable_discovery_enable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2737,7 +2737,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_disable_discovery_disable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_disable_discovery_disable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2747,7 +2747,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_enable_discovery_disable_access_encrypt) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_enable_discovery_disable_access_encrypt) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2756,7 +2756,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_enable_discovery_enable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_enable_discovery_enable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2765,7 +2765,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_disable_discovery_enable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_disable_discovery_enable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2774,7 +2774,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions_validation_ok_common(reader, writer, governance_file); } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_disable_discovery_disable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_disable_discovery_disable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -2784,7 +2784,7 @@ BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions } -BLACKBOXTEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_enable_discovery_disable_access_none) +TEST(BlackBox, BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_enable_discovery_disable_access_none) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); diff --git a/test/blackbox/BlackboxTestsTransportTCP.cpp b/test/blackbox/BlackboxTestsTransportTCP.cpp index fef254bb52c..a50201b0b2a 100644 --- a/test/blackbox/BlackboxTestsTransportTCP.cpp +++ b/test/blackbox/BlackboxTestsTransportTCP.cpp @@ -25,7 +25,7 @@ static const char* certs_path = nullptr; #endif // TCP and Domain management with logical ports tests -BLACKBOXTEST(BlackBox, TCPDomainHelloWorld_P0_P1_D0_D0) +TEST(BlackBox, TCPDomainHelloWorld_P0_P1_D0_D0) { TCPReqRepHelloWorldRequester requester; TCPReqRepHelloWorldReplier replier; @@ -54,7 +54,7 @@ BLACKBOXTEST(BlackBox, TCPDomainHelloWorld_P0_P1_D0_D0) } -BLACKBOXTEST(BlackBox, TCPDomainHelloWorld_P0_P1_D0_D1) +TEST(BlackBox, TCPDomainHelloWorld_P0_P1_D0_D1) { TCPReqRepHelloWorldRequester requester; TCPReqRepHelloWorldReplier replier; @@ -74,7 +74,7 @@ BLACKBOXTEST(BlackBox, TCPDomainHelloWorld_P0_P1_D0_D1) ASSERT_FALSE(replier.is_matched()); } -BLACKBOXTEST(BlackBox, TCPDomainHelloWorld_P0_P1_D1_D0) +TEST(BlackBox, TCPDomainHelloWorld_P0_P1_D1_D0) { TCPReqRepHelloWorldRequester requester; TCPReqRepHelloWorldReplier replier; @@ -95,7 +95,7 @@ BLACKBOXTEST(BlackBox, TCPDomainHelloWorld_P0_P1_D1_D0) } -BLACKBOXTEST(BlackBox, TCPDomainHelloWorld_P0_P3_D0_D0) +TEST(BlackBox, TCPDomainHelloWorld_P0_P3_D0_D0) { TCPReqRepHelloWorldRequester requester; TCPReqRepHelloWorldReplier replier; @@ -121,7 +121,7 @@ BLACKBOXTEST(BlackBox, TCPDomainHelloWorld_P0_P3_D0_D0) } -BLACKBOXTEST(BlackBox, TCPDomainHelloWorld_P0_P3_D0_D1) +TEST(BlackBox, TCPDomainHelloWorld_P0_P3_D0_D1) { TCPReqRepHelloWorldRequester requester; TCPReqRepHelloWorldReplier replier; @@ -141,7 +141,7 @@ BLACKBOXTEST(BlackBox, TCPDomainHelloWorld_P0_P3_D0_D1) ASSERT_FALSE(replier.is_matched()); } -BLACKBOXTEST(BlackBox, TCPDomainHelloWorld_P0_P3_D1_D0) +TEST(BlackBox, TCPDomainHelloWorld_P0_P3_D1_D0) { TCPReqRepHelloWorldRequester requester; TCPReqRepHelloWorldReplier replier; @@ -162,7 +162,7 @@ BLACKBOXTEST(BlackBox, TCPDomainHelloWorld_P0_P3_D1_D0) } -BLACKBOXTEST(BlackBox, TCPDomainHelloWorld_P3_P0_D0_D0) +TEST(BlackBox, TCPDomainHelloWorld_P3_P0_D0_D0) { TCPReqRepHelloWorldRequester requester; TCPReqRepHelloWorldReplier replier; @@ -191,7 +191,7 @@ BLACKBOXTEST(BlackBox, TCPDomainHelloWorld_P3_P0_D0_D0) } -BLACKBOXTEST(BlackBox, TCPDomainHelloWorld_P3_P0_D0_D1) +TEST(BlackBox, TCPDomainHelloWorld_P3_P0_D0_D1) { TCPReqRepHelloWorldRequester requester; TCPReqRepHelloWorldReplier replier; @@ -211,7 +211,7 @@ BLACKBOXTEST(BlackBox, TCPDomainHelloWorld_P3_P0_D0_D1) ASSERT_FALSE(replier.is_matched()); } -BLACKBOXTEST(BlackBox, TCPDomainHelloWorld_P3_P0_D1_D0) +TEST(BlackBox, TCPDomainHelloWorld_P3_P0_D1_D0) { TCPReqRepHelloWorldRequester requester; TCPReqRepHelloWorldReplier replier; @@ -232,7 +232,7 @@ BLACKBOXTEST(BlackBox, TCPDomainHelloWorld_P3_P0_D1_D0) } -BLACKBOXTEST(BlackBox, TCPDomainHelloWorld_P2_P3_D0_D0) +TEST(BlackBox, TCPDomainHelloWorld_P2_P3_D0_D0) { TCPReqRepHelloWorldRequester requester; TCPReqRepHelloWorldReplier replier; @@ -258,7 +258,7 @@ BLACKBOXTEST(BlackBox, TCPDomainHelloWorld_P2_P3_D0_D0) } -BLACKBOXTEST(BlackBox, TCPDomainHelloWorld_P2_P3_D0_D1) +TEST(BlackBox, TCPDomainHelloWorld_P2_P3_D0_D1) { TCPReqRepHelloWorldRequester requester; TCPReqRepHelloWorldReplier replier; @@ -278,7 +278,7 @@ BLACKBOXTEST(BlackBox, TCPDomainHelloWorld_P2_P3_D0_D1) ASSERT_FALSE(replier.is_matched()); } -BLACKBOXTEST(BlackBox, TCPDomainHelloWorld_P2_P3_D1_D0) +TEST(BlackBox, TCPDomainHelloWorld_P2_P3_D1_D0) { TCPReqRepHelloWorldRequester requester; TCPReqRepHelloWorldReplier replier; @@ -298,7 +298,7 @@ BLACKBOXTEST(BlackBox, TCPDomainHelloWorld_P2_P3_D1_D0) ASSERT_FALSE(replier.is_matched()); } -BLACKBOXTEST(BlackBox, TCPMaxInitialPeer_P0_4_P3) +TEST(BlackBox, TCPMaxInitialPeer_P0_4_P3) { TCPReqRepHelloWorldRequester requester; TCPReqRepHelloWorldReplier replier; @@ -319,7 +319,7 @@ BLACKBOXTEST(BlackBox, TCPMaxInitialPeer_P0_4_P3) ASSERT_TRUE(replier.is_matched()); } -BLACKBOXTEST(BlackBox, TCPMaxInitialPeer_P0_4_P4) +TEST(BlackBox, TCPMaxInitialPeer_P0_4_P4) { TCPReqRepHelloWorldRequester requester; TCPReqRepHelloWorldReplier replier; @@ -339,7 +339,7 @@ BLACKBOXTEST(BlackBox, TCPMaxInitialPeer_P0_4_P4) ASSERT_FALSE(replier.is_matched()); } -BLACKBOXTEST(BlackBox, TCPMaxInitialPeer_P0_5_P4) +TEST(BlackBox, TCPMaxInitialPeer_P0_5_P4) { TCPReqRepHelloWorldRequester requester; TCPReqRepHelloWorldReplier replier; @@ -361,7 +361,7 @@ BLACKBOXTEST(BlackBox, TCPMaxInitialPeer_P0_5_P4) } #if TLS_FOUND -BLACKBOXTEST(BlackBox, TCP_TLS) +TEST(BlackBox, TCP_TLS) { TCPReqRepHelloWorldRequester requester; TCPReqRepHelloWorldReplier replier; diff --git a/test/blackbox/BlackboxTestsTransportUDP.cpp b/test/blackbox/BlackboxTestsTransportUDP.cpp index 48b415d9421..a3d38b533f3 100644 --- a/test/blackbox/BlackboxTestsTransportUDP.cpp +++ b/test/blackbox/BlackboxTestsTransportUDP.cpp @@ -22,7 +22,7 @@ using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::rtps; -BLACKBOXTEST(BlackBox, UDPv4TransportWrongConfig) +TEST(BlackBox, UDPv4TransportWrongConfig) { { PubSubWriter writer(TEST_TOPIC_NAME); @@ -62,7 +62,7 @@ BLACKBOXTEST(BlackBox, UDPv4TransportWrongConfig) } // TODO - GASCO: UDPMaxInitialPeer tests should use static discovery through initial peers. -BLACKBOXTEST(BlackBox, UDPMaxInitialPeer_P0_4_P3) +TEST(BlackBox, UDPMaxInitialPeer_P0_4_P3) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -87,7 +87,7 @@ BLACKBOXTEST(BlackBox, UDPMaxInitialPeer_P0_4_P3) ASSERT_TRUE(reader.is_matched()); } -BLACKBOXTEST(BlackBox, UDPMaxInitialPeer_P0_4_P4) +TEST(BlackBox, UDPMaxInitialPeer_P0_4_P4) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -112,7 +112,7 @@ BLACKBOXTEST(BlackBox, UDPMaxInitialPeer_P0_4_P4) ASSERT_TRUE(reader.is_matched()); } -BLACKBOXTEST(BlackBox, UDPMaxInitialPeer_P5_4_P4) +TEST(BlackBox, UDPMaxInitialPeer_P5_4_P4) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -136,7 +136,7 @@ BLACKBOXTEST(BlackBox, UDPMaxInitialPeer_P5_4_P4) ASSERT_FALSE(reader.is_matched()); } -BLACKBOXTEST(BlackBox, UDPMaxInitialPeer_P5_6_P4) +TEST(BlackBox, UDPMaxInitialPeer_P5_6_P4) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -162,7 +162,7 @@ BLACKBOXTEST(BlackBox, UDPMaxInitialPeer_P5_6_P4) } // Used to reproduce VPN environment issue with multicast. -BLACKBOXTEST(BlackBox, MulticastCommunicationBadReader) +TEST(BlackBox, MulticastCommunicationBadReader) { PubSubWriter writer(TEST_TOPIC_NAME); @@ -194,7 +194,7 @@ BLACKBOXTEST(BlackBox, MulticastCommunicationBadReader) } // Used to reproduce VPN environment issue with multicast. -BLACKBOXTEST(BlackBox, MulticastCommunicationOkReader) +TEST(BlackBox, MulticastCommunicationOkReader) { PubSubWriter writer(TEST_TOPIC_NAME); @@ -224,7 +224,7 @@ BLACKBOXTEST(BlackBox, MulticastCommunicationOkReader) } // #4420 Using whitelists in localhost sometimes UDP doesn't receive the release input channel message. -BLACKBOXTEST(BlackBox, whitelisting_udp_localhost_multi) +TEST(BlackBox, whitelisting_udp_localhost_multi) { PubSubWriter writer(TEST_TOPIC_NAME); @@ -254,7 +254,7 @@ BLACKBOXTEST(BlackBox, whitelisting_udp_localhost_multi) } // #4420 Using whitelists in localhost sometimes UDP doesn't receive the release input channel message. -BLACKBOXTEST(BlackBox, whitelisting_udp_localhost_alone) +TEST(BlackBox, whitelisting_udp_localhost_alone) { auto transport = std::make_shared(); std::string ip0("127.0.0.1"); diff --git a/test/blackbox/BlackboxTestsVolatile.cpp b/test/blackbox/BlackboxTestsVolatile.cpp index ffd5ffbdca9..e48e890d2b6 100644 --- a/test/blackbox/BlackboxTestsVolatile.cpp +++ b/test/blackbox/BlackboxTestsVolatile.cpp @@ -22,7 +22,7 @@ #include "ReqRepAsReliableHelloWorldReplier.hpp" // Test created to check bug #3020 (Github ros2/demos #238) -BLACKBOXTEST(BlackBox, PubSubAsReliableVolatilePubRemoveWithoutSubs) +TEST(BlackBox, PubSubAsReliableVolatilePubRemoveWithoutSubs) { PubSubWriter writer(TEST_TOPIC_NAME); @@ -43,7 +43,7 @@ BLACKBOXTEST(BlackBox, PubSubAsReliableVolatilePubRemoveWithoutSubs) } // Test created to check bug #3087 (Github #230) -BLACKBOXTEST(BlackBox, AsyncPubSubAsNonReliableVolatileHelloworld) +TEST(BlackBox, AsyncPubSubAsNonReliableVolatileHelloworld) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -75,7 +75,7 @@ BLACKBOXTEST(BlackBox, AsyncPubSubAsNonReliableVolatileHelloworld) } // Test created to check a bug with writers that use BEST_EFFORT WITH VOLATILE that don't remove messages from history. -BLACKBOXTEST(BlackBox, AsyncPubSubAsNonReliableVolatileKeepAllHelloworld) +TEST(BlackBox, AsyncPubSubAsNonReliableVolatileKeepAllHelloworld) { RTPSAsSocketReader reader(TEST_TOPIC_NAME); RTPSAsSocketWriter writer(TEST_TOPIC_NAME); @@ -112,7 +112,7 @@ BLACKBOXTEST(BlackBox, AsyncPubSubAsNonReliableVolatileKeepAllHelloworld) } // Test created to check bug #3290 (ROS2 #539) -BLACKBOXTEST(BlackBox, AsyncVolatileKeepAllPubReliableSubNonReliable300Kb) +TEST(BlackBox, AsyncVolatileKeepAllPubReliableSubNonReliable300Kb) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -155,7 +155,7 @@ BLACKBOXTEST(BlackBox, AsyncVolatileKeepAllPubReliableSubNonReliable300Kb) } // Test created to check bug #3290 (ROS2 #539) -BLACKBOXTEST(BlackBox, VolatileKeepAllPubReliableSubNonReliableHelloWorld) +TEST(BlackBox, VolatileKeepAllPubReliableSubNonReliableHelloWorld) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -191,7 +191,7 @@ BLACKBOXTEST(BlackBox, VolatileKeepAllPubReliableSubNonReliableHelloWorld) } // Test created to check bug #3290 (ROS2 #539) -BLACKBOXTEST(BlackBox, AsyncVolatileKeepAllPubReliableSubNonReliableHelloWorld) +TEST(BlackBox, AsyncVolatileKeepAllPubReliableSubNonReliableHelloWorld) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); @@ -228,7 +228,7 @@ BLACKBOXTEST(BlackBox, AsyncVolatileKeepAllPubReliableSubNonReliableHelloWorld) } // Regression test of Refs #3376, github ros2/rmw_fastrtps #226 -BLACKBOXTEST(BlackBox, ReqRepVolatileHelloworldRequesterCheckWriteParams) +TEST(BlackBox, ReqRepVolatileHelloworldRequesterCheckWriteParams) { ReqRepAsReliableHelloWorldRequester requester; @@ -240,7 +240,7 @@ BLACKBOXTEST(BlackBox, ReqRepVolatileHelloworldRequesterCheckWriteParams) } // Test created to check bug #5423, github ros2/ros2 #703 -BLACKBOXTEST(BlackBox, AsyncVolatileSubBetweenPubs) +TEST(BlackBox, AsyncVolatileSubBetweenPubs) { PubSubReader reader(TEST_TOPIC_NAME); PubSubWriter writer(TEST_TOPIC_NAME); diff --git a/test/blackbox/CMakeLists.txt b/test/blackbox/CMakeLists.txt index 040263e8ab9..f5b203be633 100644 --- a/test/blackbox/CMakeLists.txt +++ b/test/blackbox/CMakeLists.txt @@ -12,77 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -macro(add_blackbox_gtest test memorymode) - # Parse arguments - set(multiValueArgs SOURCES ENVIRONMENTS LABELS) - cmake_parse_arguments(GTEST "" "" "${multiValueArgs}" ${ARGN}) - - if(GTEST_INDIVIDUAL) - if(WIN32) - set(WIN_PATH "$ENV{PATH}") - get_target_property(LINK_LIBRARIES_ ${test} LINK_LIBRARIES) - if(NOT "${LINK_LIBRARIES_}" STREQUAL "LINK_LIBRARIES_-NOTFOUND") - foreach(LIBRARY_LINKED ${LINK_LIBRARIES_}) - if(TARGET ${LIBRARY_LINKED}) - set(WIN_PATH "$;${WIN_PATH}") - endif() - endforeach() - endif() - string(REPLACE ";" "\\;" WIN_PATH "${WIN_PATH}") - endif() - - foreach(GTEST_SOURCE_FILE ${GTEST_SOURCES}) - file(STRINGS ${GTEST_SOURCE_FILE} GTEST_NAMES REGEX ^BLACKBOXTEST) - foreach(GTEST_NAME ${GTEST_NAMES}) - string(REGEX REPLACE ["\) \(,"] ";" GTEST_NAME ${GTEST_NAME}) - list(GET GTEST_NAME 1 GTEST_GROUP_NAME) - list(GET GTEST_NAME 3 GTEST_NAME) - add_test(NAME ${GTEST_GROUP_NAME}_${memorymode}.${GTEST_NAME} - COMMAND ${test} - --gtest_filter=${GTEST_GROUP_NAME}_${memorymode}.${GTEST_NAME}) - - # Add environment - if(WIN32) - set_tests_properties(${GTEST_GROUP_NAME}_${memorymode}.${GTEST_NAME} PROPERTIES ENVIRONMENT "PATH=${WIN_PATH}") - endif() - - foreach(property ${GTEST_ENVIRONMENTS}) - set_property(TEST ${GTEST_GROUP_NAME}_${memorymode}.${GTEST_NAME} APPEND PROPERTY ENVIRONMENT "${property}") - endforeach() - - # Add labels - set_property(TEST ${GTEST_GROUP_NAME}_${memorymode}.${GTEST_NAME} PROPERTY LABELS "${GTEST_LABELS}") - - endforeach() - endforeach() - else() - add_test(NAME ${test} COMMAND ${test}) - - # Add environment - if(WIN32) - set(WIN_PATH "$ENV{PATH}") - get_target_property(LINK_LIBRARIES_ ${test} LINK_LIBRARIES) - if(NOT "${LINK_LIBRARIES_}" STREQUAL "LINK_LIBRARIES_-NOTFOUND") - foreach(LIBRARY_LINKED ${LINK_LIBRARIES_}) - if(TARGET ${LIBRARY_LINKED}) - set(WIN_PATH "$;${WIN_PATH}") - endif() - endforeach() - endif() - string(REPLACE ";" "\\;" WIN_PATH "${WIN_PATH}") - set_tests_properties(${test} PROPERTIES ENVIRONMENT "PATH=${WIN_PATH}") - endif() - - foreach(property ${GTEST_ENVIRONMENTS}) - set_property(TEST ${test} APPEND PROPERTY ENVIRONMENT "${property}") - endforeach() - - # Add labels - set_property(TEST ${test} PROPERTY LABELS "${GTEST_LABELS}") - - endif() -endmacro() - if(NOT ((MSVC OR MSVC_IDE) AND EPROSIMA_INSTALLER) AND fastcdr_FOUND) include(${PROJECT_SOURCE_DIR}/cmake/common/gtest.cmake) check_gtest() @@ -145,45 +74,16 @@ if(NOT ((MSVC OR MSVC_IDE) AND EPROSIMA_INSTALLER) AND fastcdr_FOUND) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/PubSubReader.xml.in ${CMAKE_CURRENT_BINARY_DIR}/PubSubReader.xml) - add_executable(BlackboxTests_PreallocMem ${BLACKBOXTESTS_SOURCE}) - target_compile_definitions(BlackboxTests_PreallocMem PRIVATE - PREALLOCATED_MEMORY_MODE_TEST) - target_include_directories(BlackboxTests_PreallocMem PRIVATE ${GTEST_INCLUDE_DIRS}) - target_link_libraries(BlackboxTests_PreallocMem fastrtps fastcdr ${GTEST_LIBRARIES}) - add_blackbox_gtest(BlackboxTests_PreallocMem PreallocMem SOURCES ${BLACKBOXTESTS_TEST_SOURCE} - ENVIRONMENTS "CERTS_PATH=${PROJECT_SOURCE_DIR}/test/certs" - "TOPIC_RANDOM_NUMBER=${TOPIC_RANDOM_NUMBER}" - "W_UNICAST_PORT_RANDOM_NUMBER=${W_UNICAST_PORT_RANDOM_NUMBER}" - "R_UNICAST_PORT_RANDOM_NUMBER=${R_UNICAST_PORT_RANDOM_NUMBER}" - "MULTICAST_PORT_RANDOM_NUMBER=${MULTICAST_PORT_RANDOM_NUMBER}" - ) - - add_executable(BlackboxTests_ReallocMem ${BLACKBOXTESTS_SOURCE}) - target_compile_definitions(BlackboxTests_ReallocMem PRIVATE - PREALLOCATED_WITH_REALLOC_MEMORY_MODE_TEST) - target_include_directories(BlackboxTests_ReallocMem PRIVATE ${GTEST_INCLUDE_DIRS}) - target_link_libraries(BlackboxTests_ReallocMem fastrtps fastcdr ${GTEST_LIBRARIES}) - add_blackbox_gtest(BlackboxTests_ReallocMem ReallocMem SOURCES ${BLACKBOXTESTS_TEST_SOURCE} - ENVIRONMENTS "CERTS_PATH=${PROJECT_SOURCE_DIR}/test/certs" - "TOPIC_RANDOM_NUMBER=${TOPIC_RANDOM_NUMBER}" - "W_UNICAST_PORT_RANDOM_NUMBER=${W_UNICAST_PORT_RANDOM_NUMBER}" - "R_UNICAST_PORT_RANDOM_NUMBER=${R_UNICAST_PORT_RANDOM_NUMBER}" - "MULTICAST_PORT_RANDOM_NUMBER=${MULTICAST_PORT_RANDOM_NUMBER}" - LABELS "NoMemoryCheck" - ) - - add_executable(BlackboxTests_DynMem ${BLACKBOXTESTS_SOURCE}) - target_compile_definitions(BlackboxTests_DynMem PRIVATE - DYNAMIC_RESERVE_MEMORY_MODE_TEST) - target_include_directories(BlackboxTests_DynMem PRIVATE ${GTEST_INCLUDE_DIRS}) - target_link_libraries(BlackboxTests_DynMem fastrtps fastcdr ${GTEST_LIBRARIES}) - add_blackbox_gtest(BlackboxTests_DynMem DynMem SOURCES ${BLACKBOXTESTS_TEST_SOURCE} + add_executable(BlackboxTests ${BLACKBOXTESTS_SOURCE}) + target_compile_definitions(BlackboxTests PRIVATE) + target_include_directories(BlackboxTests PRIVATE ${GTEST_INCLUDE_DIRS}) + target_link_libraries(BlackboxTests fastrtps fastcdr ${GTEST_LIBRARIES}) + add_gtest(BlackboxTests SOURCES ${BLACKBOXTESTS_TEST_SOURCE} ENVIRONMENTS "CERTS_PATH=${PROJECT_SOURCE_DIR}/test/certs" "TOPIC_RANDOM_NUMBER=${TOPIC_RANDOM_NUMBER}" "W_UNICAST_PORT_RANDOM_NUMBER=${W_UNICAST_PORT_RANDOM_NUMBER}" "R_UNICAST_PORT_RANDOM_NUMBER=${R_UNICAST_PORT_RANDOM_NUMBER}" "MULTICAST_PORT_RANDOM_NUMBER=${MULTICAST_PORT_RANDOM_NUMBER}" - LABELS "NoMemoryCheck" ) endif() endif() diff --git a/test/blackbox/PubSubParticipant.hpp b/test/blackbox/PubSubParticipant.hpp new file mode 100644 index 00000000000..d00ffb97f4b --- /dev/null +++ b/test/blackbox/PubSubParticipant.hpp @@ -0,0 +1,490 @@ +// Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @file PubSubParticipant.hpp + * + */ + +#ifndef _TEST_BLACKBOX_PUBSUBPARTICIPANT_HPP_ +#define _TEST_BLACKBOX_PUBSUBPARTICIPANT_HPP_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace eprosima { +namespace fastrtps { + +/** + * @brief A class with one participant that can have multiple publishers and subscribers + */ +template +class PubSubParticipant +{ + class PubListener : public PublisherListener + { + friend class PubSubParticipant; + + public: + + PubListener(PubSubParticipant* participant) + : participant_(participant) + {} + + ~PubListener() + {} + + void onPublicationMatched( + Publisher* pub, + rtps::MatchingInfo &info) override + { + (void)pub; + (info.status == rtps::MATCHED_MATCHING)? participant_->pub_matched(): participant_->sub_unmatched(); + } + + void on_liveliness_lost( + Publisher* pub, + const LivelinessLostStatus& status) override + { + (void)pub; + (void)status; + participant_->pub_liveliness_lost(); + } + + private: + + PubListener& operator=(const PubListener&) = delete; + //! A pointer to the participant + PubSubParticipant* participant_; + }; + + class SubListener : public SubscriberListener + { + friend class PubSubParticipant; + + public: + + SubListener(PubSubParticipant* participant) + : participant_(participant) + {} + + ~SubListener() + {} + + void onSubscriptionMatched( + Subscriber* sub, + rtps::MatchingInfo& info) override + { + (void)sub; + (info.status == rtps::MATCHED_MATCHING) ? participant_->sub_matched() : participant_->sub_unmatched(); + } + + void on_liveliness_changed( + Subscriber* sub, + const LivelinessChangedStatus& status) override + { + (void)sub; + (status.alive_count_change == 1) ? participant_->sub_liveliness_recovered() : participant_->sub_liveliness_lost(); + + } + + private: + + SubListener& operator=(const SubListener&) = delete; + //! A pointer to the participant + PubSubParticipant* participant_; + }; + +public: + + typedef TypeSupport type_support; + typedef typename type_support::type type; + + PubSubParticipant( + unsigned int num_publishers, + unsigned int num_subscribers, + unsigned int num_expected_publishers, + unsigned int num_expected_subscribers) + : participant_(nullptr) + , participant_attr_() + , num_publishers_(num_publishers) + , num_subscribers_(num_subscribers) + , num_expected_subscribers_(num_expected_subscribers) + , num_expected_publishers_(num_expected_publishers) + , publishers_(num_publishers) + , subscribers_(num_subscribers) + , publisher_attr_() + , pub_listener_(this) + , sub_listener_(this) + , pub_matched_(0) + , sub_matched_(0) + , pub_times_liveliness_lost_(0) + , sub_times_liveliness_lost_(0) + , sub_times_liveliness_recovered_(0) + { + +#if defined(PREALLOCATED_WITH_REALLOC_MEMORY_MODE_TEST) + publisher_attr_.historyMemoryPolicy = rtps::PREALLOCATED_WITH_REALLOC_MEMORY_MODE; +#elif defined(DYNAMIC_RESERVE_MEMORY_MODE_TEST) + publisher_attr_.historyMemoryPolicy = rtps::DYNAMIC_RESERVE_MEMORY_MODE; +#else + publisher_attr_.historyMemoryPolicy = rtps::PREALLOCATED_MEMORY_MODE; +#endif + + // By default, heartbeat period and nack response delay are 100 milliseconds. + publisher_attr_.times.heartbeatPeriod.seconds = 0; + publisher_attr_.times.heartbeatPeriod.nanosec = 100000000; + publisher_attr_.times.nackResponseDelay.seconds = 0; + publisher_attr_.times.nackResponseDelay.nanosec = 100000000; + // By default, heartbeat period delay is 100 milliseconds. + subscriber_attr_.times.heartbeatResponseDelay = 0.1; + } + + ~PubSubParticipant() + { + if(participant_ != nullptr) + { + Domain::removeParticipant(participant_); + participant_ = nullptr; + } + } + + bool init_participant() + { + participant_attr_.rtps.builtin.domainId = (uint32_t)GET_PID() % 230; + participant_ = Domain::createParticipant(participant_attr_); + if (participant_ != nullptr) + { + Domain::registerType(participant_, &type_); + return true; + } + return false; + } + + bool init_publisher(unsigned int index) + { + if (participant_ == nullptr) + { + return false; + } + if (index >= num_publishers_) + { + return false; + } + + auto pub = Domain::createPublisher(participant_, publisher_attr_, &pub_listener_); + if (pub != nullptr) + { + publishers_[index] = pub; + return true; + } + return false; + } + + bool init_subscriber(unsigned int index) + { + if (index >= num_subscribers_) + { + return false; + } + auto subscriber = Domain::createSubscriber(participant_, subscriber_attr_, &sub_listener_); + if (subscriber != nullptr) + { + subscribers_[index] = subscriber; + return true; + } + return false; + } + + bool send_sample(type& msg, unsigned int index = 0) + { + return publishers_[index]->write((void*)&msg); + } + + void assert_liveliness_participant() + { + participant_->assert_liveliness(); + } + + void assert_liveliness(unsigned int index = 0) + { + publishers_[index]->assert_liveliness(); + } + + void pub_wait_discovery(std::chrono::seconds timeout = std::chrono::seconds::zero()) + { + std::unique_lock lock(pub_mutex_); + + std::cout << "Publisher is waiting discovery..." << std::endl; + + if(timeout == std::chrono::seconds::zero()) + { + pub_cv_.wait(lock, [&](){ return pub_matched_ == num_expected_publishers_; }); + } + else + { + pub_cv_.wait_for(lock, timeout, [&](){return pub_matched_ == num_expected_publishers_;}); + } + + std::cout << "Publisher discovery finished " << std::endl; + } + + void sub_wait_discovery(std::chrono::seconds timeout = std::chrono::seconds::zero()) + { + std::unique_lock lock(sub_mutex_); + + std::cout << "Subscriber is waiting discovery..." << std::endl; + + if(timeout == std::chrono::seconds::zero()) + { + sub_cv_.wait(lock, [&](){ return sub_matched_ == num_expected_subscribers_; }); + } + else + { + sub_cv_.wait_for(lock, timeout, [&](){return sub_matched_ == num_expected_subscribers_;}); + } + + std::cout << "Subscriber discovery finished " << std::endl; + } + + void sub_wait_liveliness_recovered(unsigned int num_recovered) + { + std::unique_lock lock(liveliness_mutex_); + liveliness_cv_.wait(lock, [&]() { return sub_times_liveliness_recovered_ == num_recovered; }); + } + + void sub_wait_liveliness_lost(unsigned int num_lost) + { + std::unique_lock lock(liveliness_mutex_); + liveliness_cv_.wait(lock, [&]() { return sub_times_liveliness_lost_ == num_lost; }); + } + + PubSubParticipant& pub_topic_name(std::string topicName) + { + publisher_attr_.topic.topicDataType = type_.getName(); + publisher_attr_.topic.topicName=topicName; + return *this; + } + + PubSubParticipant& sub_topic_name(std::string topicName) + { + subscriber_attr_.topic.topicDataType = type_.getName(); + subscriber_attr_.topic.topicName = topicName; + return *this; + } + + PubSubParticipant& reliability(const ReliabilityQosPolicyKind kind) + { + publisher_attr_.qos.m_reliability.kind = kind; + subscriber_attr_.qos.m_reliability.kind = kind; + return *this; + } + + PubSubParticipant& pub_liveliness_kind(const LivelinessQosPolicyKind kind) + { + publisher_attr_.qos.m_liveliness.kind = kind; + return *this; + } + + PubSubParticipant& pub_liveliness_lease_duration(const Duration_t lease_duration) + { + publisher_attr_.qos.m_liveliness.lease_duration = lease_duration; + return *this; + } + + PubSubParticipant& pub_liveliness_announcement_period(const Duration_t announcement_period) + { + publisher_attr_.qos.m_liveliness.announcement_period = announcement_period; + return *this; + } + + PubSubParticipant& sub_liveliness_kind(const LivelinessQosPolicyKind& kind) + { + subscriber_attr_.qos.m_liveliness.kind = kind; + return *this; + } + + PubSubParticipant& sub_liveliness_lease_duration(const Duration_t lease_duration) + { + subscriber_attr_.qos.m_liveliness.lease_duration = lease_duration; + return *this; + } + + PubSubParticipant& pub_deadline_period(const Duration_t& deadline_period) + { + publisher_attr_.qos.m_deadline.period = deadline_period; + return *this; + } + + PubSubParticipant& sub_deadline_period(const Duration_t& deadline_period) + { + subscriber_attr_.qos.m_deadline.period = deadline_period; + return *this; + } + + bool sub_update_deadline_period( + const Duration_t& deadline_period, + unsigned int index) + { + if (index >= num_subscribers_) + { + return false; + } + if (subscribers_[index] == nullptr) + { + return false; + } + + SubscriberAttributes attr; + attr = subscriber_attr_; + attr.qos.m_deadline.period = deadline_period; + + return subscribers_[index]->updateAttributes(attr); + } + + void pub_liveliness_lost() + { + std::unique_lock lock(liveliness_mutex_); + pub_times_liveliness_lost_++; + } + + void sub_liveliness_lost() + { + std::unique_lock lock(liveliness_mutex_); + sub_times_liveliness_lost_++; + liveliness_cv_.notify_one(); + } + + void sub_liveliness_recovered() + { + std::unique_lock lock(liveliness_mutex_); + sub_times_liveliness_recovered_++; + liveliness_cv_.notify_one(); + } + + unsigned int pub_times_liveliness_lost() + { + std::unique_lock lock(liveliness_mutex_); + return pub_times_liveliness_lost_; + } + + unsigned int sub_times_liveliness_lost() + { + std::unique_lock lock(liveliness_mutex_); + return sub_times_liveliness_lost_; + } + + unsigned int sub_times_liveliness_recovered() + { + std::unique_lock lock(liveliness_mutex_); + return sub_times_liveliness_recovered_; + } + +private: + + PubSubParticipant& operator=(const PubSubParticipant&)= delete; + + void pub_matched() + { + std::unique_lock lock(pub_mutex_); + ++pub_matched_; + pub_cv_.notify_one(); + } + + void pub_unmatched() + { + std::unique_lock lock(pub_mutex_); + --pub_matched_; + pub_cv_.notify_one(); + } + + void sub_matched() + { + std::unique_lock lock(sub_mutex_); + ++sub_matched_; + sub_cv_.notify_one(); + } + + void sub_unmatched() + { + std::unique_lock lock(sub_mutex_); + --sub_matched_; + sub_cv_.notify_one(); + } + + //! The participant + Participant* participant_; + //! Participant attributes + ParticipantAttributes participant_attr_; + //! Number of publishers in this participant + unsigned int num_publishers_; + //! Number of subscribers in this participant + unsigned int num_subscribers_; + //! Number of expected subscribers to match + unsigned int num_expected_subscribers_; + //! Number of expected subscribers to match + unsigned int num_expected_publishers_; + //! A vector of publishers + std::vector publishers_; + //! A vector of subscribers + std::vector subscribers_; + //! Publisher attributes + PublisherAttributes publisher_attr_; + //! Subscriber attributes + SubscriberAttributes subscriber_attr_; + //! A listener for publishers + PubListener pub_listener_; + //! A listener for subscribers + SubListener sub_listener_; + + std::mutex pub_mutex_; + std::mutex sub_mutex_; + std::condition_variable pub_cv_; + std::condition_variable sub_cv_; + std::atomic pub_matched_; + std::atomic sub_matched_; + + //! Number of times liveliness was lost on the publishing side + unsigned int pub_times_liveliness_lost_; + //! The number of times liveliness was lost on the subscribing side + unsigned int sub_times_liveliness_lost_; + //! The number of times liveliness was recovered on the subscribing side + unsigned int sub_times_liveliness_recovered_; + //! A mutex protecting liveliness data + std::mutex liveliness_mutex_; + //! A condition variable for liveliness data + std::condition_variable liveliness_cv_; + + type_support type_; +}; + +} +} + +#endif // _TEST_BLACKBOX_PUBSUBPARTICIPANT_HPP_ + diff --git a/test/blackbox/PubSubReader.hpp b/test/blackbox/PubSubReader.hpp index ae08a6998a1..5e64d4a4e71 100644 --- a/test/blackbox/PubSubReader.hpp +++ b/test/blackbox/PubSubReader.hpp @@ -155,6 +155,24 @@ class PubSubReader times_deadline_missed_ = status.total_count; } + void on_liveliness_changed( + eprosima::fastrtps::Subscriber* sub, + const eprosima::fastrtps::LivelinessChangedStatus& status) override + { + (void)sub; + + reader_.set_liveliness_changed_status(status); + + if (status.alive_count_change == 1) + { + reader_.liveliness_recovered(); + } + else if (status.not_alive_count_change == 1) + { + reader_.liveliness_lost(); + } + } + unsigned int missed_deadlines() const { return times_deadline_missed_; @@ -166,6 +184,7 @@ class PubSubReader PubSubReader& reader_; + //! Number of times deadline was missed unsigned int times_deadline_missed_; } listener_; @@ -192,6 +211,10 @@ class PubSubReader , authorized_(0) , unauthorized_(0) #endif + , liveliness_mutex_() + , liveliness_cv_() + , times_liveliness_lost_(0) + , times_liveliness_recovered_(0) { subscriber_attr_.topic.topicDataType = type_.getName(); // Generate topic name @@ -199,13 +222,8 @@ class PubSubReader t << topic_name_ << "_" << asio::ip::host_name() << "_" << GET_PID(); subscriber_attr_.topic.topicName = t.str(); -#if defined(PREALLOCATED_WITH_REALLOC_MEMORY_MODE_TEST) - subscriber_attr_.historyMemoryPolicy = eprosima::fastrtps::rtps::PREALLOCATED_WITH_REALLOC_MEMORY_MODE; -#elif defined(DYNAMIC_RESERVE_MEMORY_MODE_TEST) - subscriber_attr_.historyMemoryPolicy = eprosima::fastrtps::rtps::DYNAMIC_RESERVE_MEMORY_MODE; -#else + // By default, memory mode is preallocated (the most restritive) subscriber_attr_.historyMemoryPolicy = eprosima::fastrtps::rtps::PREALLOCATED_MEMORY_MODE; -#endif // By default, heartbeat period delay is 100 milliseconds. subscriber_attr_.times.heartbeatResponseDelay.seconds = 0; @@ -215,7 +233,9 @@ class PubSubReader ~PubSubReader() { if(participant_ != nullptr) + { eprosima::fastrtps::Domain::removeParticipant(participant_); + } } void init() @@ -354,6 +374,20 @@ class PubSubReader std::cout << "Reader removal finished..." << std::endl; } + void wait_liveliness_recovered() + { + std::unique_lock lock(liveliness_mutex_); + + liveliness_cv_.wait(lock, [&](){ return times_liveliness_recovered_ == 1; }); + } + + void wait_liveliness_lost() + { + std::unique_lock lock(liveliness_mutex_); + + liveliness_cv_.wait(lock, [&]() { return times_liveliness_lost_ == 1; }); + } + #if HAVE_SECURITY void waitAuthorized() { @@ -396,6 +430,27 @@ class PubSubReader return *this; } + bool update_deadline_period(const eprosima::fastrtps::Duration_t& deadline_period) + { + eprosima::fastrtps::SubscriberAttributes attr; + attr = subscriber_attr_; + attr.qos.m_deadline.period = deadline_period; + + return subscriber_->updateAttributes(attr); + } + + PubSubReader& liveliness_kind(const eprosima::fastrtps::LivelinessQosPolicyKind& kind) + { + subscriber_attr_.qos.m_liveliness.kind = kind; + return *this; + } + + PubSubReader& liveliness_lease_duration(const eprosima::fastrtps::Duration_t lease_duration) + { + subscriber_attr_.qos.m_liveliness.lease_duration = lease_duration; + return *this; + } + PubSubReader& key(bool keyed) { subscriber_attr_.topic.topicKind = keyed @@ -700,6 +755,48 @@ class PubSubReader return listener_.missed_deadlines(); } + void liveliness_lost() + { + std::unique_lock lock(liveliness_mutex_); + times_liveliness_lost_++; + liveliness_cv_.notify_one(); + } + + void liveliness_recovered() + { + std::unique_lock lock(liveliness_mutex_); + times_liveliness_recovered_++; + liveliness_cv_.notify_one(); + } + + void set_liveliness_changed_status(const eprosima::fastrtps::LivelinessChangedStatus& status) + { + std::unique_lock lock(liveliness_mutex_); + + liveliness_changed_status_ = status; + } + + unsigned int times_liveliness_lost() + { + std::unique_lock lock(liveliness_mutex_); + + return times_liveliness_lost_; + } + + unsigned int times_liveliness_recovered() + { + std::unique_lock lock(liveliness_mutex_); + + return times_liveliness_recovered_; + } + + const eprosima::fastrtps::LivelinessChangedStatus& liveliness_changed_status() + { + std::unique_lock lock(liveliness_mutex_); + + return liveliness_changed_status_; + } + bool is_matched() const { return matched_ > 0; @@ -819,6 +916,17 @@ class PubSubReader unsigned int authorized_; unsigned int unauthorized_; #endif + + //! A mutex for liveliness status + std::mutex liveliness_mutex_; + //! A condition variable to notify when liveliness was recovered + std::condition_variable liveliness_cv_; + //! Number of times liveliness was lost + unsigned int times_liveliness_lost_; + //! Number of times liveliness was recovered + unsigned int times_liveliness_recovered_; + //! The liveliness changed status + eprosima::fastrtps::LivelinessChangedStatus liveliness_changed_status_; }; #endif // _TEST_BLACKBOX_PUBSUBREADER_HPP_ diff --git a/test/blackbox/PubSubWriter.hpp b/test/blackbox/PubSubWriter.hpp index 2167da7ec26..78a7291174c 100644 --- a/test/blackbox/PubSubWriter.hpp +++ b/test/blackbox/PubSubWriter.hpp @@ -137,7 +137,8 @@ class PubSubWriter Listener(PubSubWriter &writer) : writer_(writer) , times_deadline_missed_(0) - {}; + , times_liveliness_lost_(0) + {} ~Listener(){}; @@ -165,18 +166,34 @@ class PubSubWriter times_deadline_missed_ = status.total_count; } + void on_liveliness_lost( + eprosima::fastrtps::Publisher* pub, + const eprosima::fastrtps::LivelinessLostStatus& status) override + { + (void)pub; + times_liveliness_lost_ = status.total_count; + } + unsigned int missed_deadlines() const { return times_deadline_missed_; } + unsigned int times_liveliness_lost() const + { + return times_liveliness_lost_; + } + private: Listener& operator=(const Listener&) = delete; PubSubWriter &writer_; + //! The number of times deadline was missed unsigned int times_deadline_missed_; + //! The number of times liveliness was lost + unsigned int times_liveliness_lost_; } listener_; @@ -206,13 +223,8 @@ class PubSubWriter publisher_attr_.topic.topicName = t.str(); topic_name_ = t.str(); -#if defined(PREALLOCATED_WITH_REALLOC_MEMORY_MODE_TEST) - publisher_attr_.historyMemoryPolicy = eprosima::fastrtps::rtps::PREALLOCATED_WITH_REALLOC_MEMORY_MODE; -#elif defined(DYNAMIC_RESERVE_MEMORY_MODE_TEST) - publisher_attr_.historyMemoryPolicy = eprosima::fastrtps::rtps::DYNAMIC_RESERVE_MEMORY_MODE; -#else + // By default, memory mode is preallocated (the most restritive) publisher_attr_.historyMemoryPolicy = eprosima::fastrtps::rtps::PREALLOCATED_MEMORY_MODE; -#endif // By default, heartbeat period and nack response delay are 100 milliseconds. publisher_attr_.times.heartbeatPeriod.seconds = 0; @@ -224,7 +236,9 @@ class PubSubWriter ~PubSubWriter() { if(participant_ != nullptr) + { eprosima::fastrtps::Domain::removeParticipant(participant_); + } } void init() @@ -294,6 +308,11 @@ class PubSubWriter return publisher_->write((void*)&msg); } + void assert_liveliness() + { + publisher_->assert_liveliness(); + } + void wait_discovery(std::chrono::seconds timeout = std::chrono::seconds::zero()) { std::unique_lock lock(mutexDiscovery_); @@ -401,6 +420,24 @@ class PubSubWriter return *this; } + PubSubWriter& liveliness_kind(const eprosima::fastrtps::LivelinessQosPolicyKind kind) + { + publisher_attr_.qos.m_liveliness.kind = kind; + return *this; + } + + PubSubWriter& liveliness_lease_duration(const eprosima::fastrtps::Duration_t lease_duration) + { + publisher_attr_.qos.m_liveliness.lease_duration = lease_duration; + return *this; + } + + PubSubWriter& liveliness_announcement_period(const eprosima::fastrtps::Duration_t announcement_period) + { + publisher_attr_.qos.m_liveliness.announcement_period = announcement_period; + return *this; + } + PubSubWriter& key(bool keyed) { publisher_attr_.topic.topicKind = @@ -730,6 +767,11 @@ class PubSubWriter return listener_.missed_deadlines(); } + unsigned int times_liveliness_lost() const + { + return listener_.times_liveliness_lost(); + } + private: void participant_matched() diff --git a/test/blackbox/PubSubWriterReader.hpp b/test/blackbox/PubSubWriterReader.hpp index ed2137f6948..1d6059f449c 100644 --- a/test/blackbox/PubSubWriterReader.hpp +++ b/test/blackbox/PubSubWriterReader.hpp @@ -32,6 +32,7 @@ #include #include #include + #include #include #include @@ -46,13 +47,19 @@ class PubSubWriterReader { public: - ParticipantListener(PubSubWriterReader &wreader) : wreader_(wreader) {} + ParticipantListener(PubSubWriterReader &wreader) + : wreader_(wreader) + { + } - ~ParticipantListener() {} + ~ParticipantListener() + { + } #if HAVE_SECURITY - void onParticipantAuthentication(eprosima::fastrtps::Participant*, - eprosima::fastrtps::rtps::ParticipantAuthenticationInfo&& info) override + void onParticipantAuthentication( + eprosima::fastrtps::Participant*, + eprosima::fastrtps::rtps::ParticipantAuthenticationInfo&& info) override { if(info.status == eprosima::fastrtps::rtps::ParticipantAuthenticationInfo::AUTHORIZED_PARTICIPANT) { @@ -64,28 +71,151 @@ class PubSubWriterReader } } #endif + void onParticipantDiscovery( + eprosima::fastrtps::Participant* participant, + eprosima::fastrtps::rtps::ParticipantDiscoveryInfo&& info) override + { + (void)participant; + + switch (info.status) + { + case eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT: + info_add(discovered_participants_, info.info.m_guid); + break; + + case eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::REMOVED_PARTICIPANT: + info_remove(discovered_participants_, info.info.m_guid); + break; + + case eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT: + std::cout << "Participant " << info.info.m_guid << " has been dropped"; + info_remove(discovered_participants_, info.info.m_guid); + break; + + default: + break; + } + } + + void onSubscriberDiscovery( + eprosima::fastrtps::Participant* participant, + eprosima::fastrtps::rtps::ReaderDiscoveryInfo&& info) override + { + (void)participant; + + switch (info.status) + { + case eprosima::fastrtps::rtps::ReaderDiscoveryInfo::DISCOVERED_READER: + info_add(discovered_subscribers_, info.info.guid()); + break; + + case eprosima::fastrtps::rtps::ReaderDiscoveryInfo::REMOVED_READER: + info_remove(discovered_subscribers_, info.info.guid()); + break; + + default: + break; + } + } + + void onPublisherDiscovery( + eprosima::fastrtps::Participant* participant, + eprosima::fastrtps::rtps::WriterDiscoveryInfo&& info) override + { + (void)participant; + + switch(info.status) + { + case eprosima::fastrtps::rtps::WriterDiscoveryInfo::DISCOVERED_WRITER: + info_add(discovered_publishers_, info.info.guid()); + break; + + case eprosima::fastrtps::rtps::WriterDiscoveryInfo::REMOVED_WRITER: + info_remove(discovered_publishers_, info.info.guid()); + break; + + default: + break; + } + } + + size_t get_num_discovered_participants() const + { + std::lock_guard guard(info_mutex_); + return discovered_participants_.size(); + } + + size_t get_num_discovered_publishers() const + { + std::lock_guard guard(info_mutex_); + return discovered_publishers_.size(); + } + + size_t get_num_discovered_subscribers() const + { + std::lock_guard guard(info_mutex_); + return discovered_subscribers_.size(); + } private: - ParticipantListener& operator=(const ParticipantListener&) = delete; + //! Mutex guarding all info collections + mutable std::mutex info_mutex_; + //! The discovered participants excluding the participant this listener is listening to + std::set discovered_participants_; + //! Number of subscribers discovered + std::set discovered_subscribers_; + //! Number of publishers discovered + std::set discovered_publishers_; + + void info_add( + std::set& collection, + const eprosima::fastrtps::rtps::GUID_t& item) + { + std::lock_guard guard(info_mutex_); + collection.insert(item); + } + void info_remove( + std::set& collection, + const eprosima::fastrtps::rtps::GUID_t& item) + { + std::lock_guard guard(info_mutex_); + collection.erase(item); + } + + //! Deleted assignment operator + ParticipantListener& operator=(const ParticipantListener&) = delete; + //! Pointer to the pub sub writer reader PubSubWriterReader& wreader_; + } participant_listener_; class PubListener : public eprosima::fastrtps::PublisherListener { public: - PubListener(PubSubWriterReader &wreader) : wreader_(wreader){}; + PubListener(PubSubWriterReader &wreader) + : wreader_(wreader) + { + } - ~PubListener(){}; + ~PubListener() + { + } - void onPublicationMatched(eprosima::fastrtps::Publisher* /*pub*/, eprosima::fastrtps::rtps::MatchingInfo &info) + void onPublicationMatched( + eprosima::fastrtps::Publisher* /*pub*/, + eprosima::fastrtps::rtps::MatchingInfo& info) { if (info.status == eprosima::fastrtps::rtps::MATCHED_MATCHING) - wreader_.matched(); + { + wreader_.publication_matched(info); + } else - wreader_.unmatched(); + { + wreader_.publication_unmatched(info); + } } private: @@ -99,9 +229,14 @@ class PubSubWriterReader class SubListener: public eprosima::fastrtps::SubscriberListener { public: - SubListener(PubSubWriterReader &wreader) : wreader_(wreader) {} + SubListener(PubSubWriterReader &wreader) + : wreader_(wreader) + { + } - ~SubListener(){} + ~SubListener() + { + } void onNewDataMessage(eprosima::fastrtps::Subscriber *sub) { @@ -117,12 +252,18 @@ class PubSubWriterReader } } - void onSubscriptionMatched(eprosima::fastrtps::Subscriber* /*sub*/, eprosima::fastrtps::rtps::MatchingInfo& info) + void onSubscriptionMatched( + eprosima::fastrtps::Subscriber* /*sub*/, + eprosima::fastrtps::rtps::MatchingInfo& info) { if (info.status == eprosima::fastrtps::rtps::MATCHED_MATCHING) - wreader_.matched(); + { + wreader_.subscription_matched(info); + } else - wreader_.unmatched(); + { + wreader_.subscription_unmatched(info); + } } private: @@ -140,11 +281,20 @@ class PubSubWriterReader typedef TypeSupport type_support; typedef typename type_support::type type; - PubSubWriterReader(const std::string &topic_name) : participant_listener_(*this), pub_listener_(*this), - sub_listener_(*this), participant_(nullptr), publisher_(nullptr), subscriber_(nullptr), initialized_(false), - matched_(0), receiving_(false), current_received_count_(0), number_samples_expected_(0) + PubSubWriterReader(const std::string &topic_name) + : participant_listener_(*this) + , pub_listener_(*this) + , sub_listener_(*this) + , participant_(nullptr) + , publisher_(nullptr) + , subscriber_(nullptr) + , initialized_(false) + , receiving_(false) + , current_received_count_(0) + , number_samples_expected_(0) #if HAVE_SECURITY - , authorized_(0), unauthorized_(0) + , authorized_(0) + , unauthorized_(0) #endif { publisher_attr_.topic.topicDataType = type_.getName(); @@ -152,20 +302,14 @@ class PubSubWriterReader // Generate topic name std::ostringstream t; t << topic_name << "_" << asio::ip::host_name() << "_" << GET_PID(); + publisher_attr_.topic.topicName = t.str(); subscriber_attr_.topic.topicName = t.str(); topic_name_ = t.str(); -#if defined(PREALLOCATED_WITH_REALLOC_MEMORY_MODE_TEST) - publisher_attr_.historyMemoryPolicy = eprosima::fastrtps::rtps::PREALLOCATED_WITH_REALLOC_MEMORY_MODE; - subscriber_attr_.historyMemoryPolicy = eprosima::fastrtps::rtps::PREALLOCATED_WITH_REALLOC_MEMORY_MODE; -#elif defined(DYNAMIC_RESERVE_MEMORY_MODE_TEST) - publisher_attr_.historyMemoryPolicy = eprosima::fastrtps::rtps::DYNAMIC_RESERVE_MEMORY_MODE; - subscriber_attr_.historyMemoryPolicy = eprosima::fastrtps::rtps::DYNAMIC_RESERVE_MEMORY_MODE; -#else + // By default, memory mode is preallocated (the most restritive) publisher_attr_.historyMemoryPolicy = eprosima::fastrtps::rtps::PREALLOCATED_MEMORY_MODE; subscriber_attr_.historyMemoryPolicy = eprosima::fastrtps::rtps::PREALLOCATED_MEMORY_MODE; -#endif // By default, heartbeat period and nack response delay are 100 milliseconds. publisher_attr_.times.heartbeatPeriod.seconds = 0; @@ -214,7 +358,39 @@ class PubSubWriterReader } } - bool isInitialized() const { return initialized_; } + bool create_additional_topics(int num_topics) + { + bool ret_val = initialized_; + if (ret_val) + { + std::string topic_name = publisher_attr_.topic.topicName.c_str(); + + for (int i = 0; ret_val && (i < num_topics); i++) + { + topic_name += "/"; + publisher_attr_.topic.topicName = topic_name; + ret_val &= + nullptr != eprosima::fastrtps::Domain::createPublisher(participant_, publisher_attr_, &pub_listener_); + } + + topic_name = subscriber_attr_.topic.topicName.c_str(); + + for (int i = 0; ret_val && (i < num_topics); i++) + { + topic_name += "/"; + subscriber_attr_.topic.topicName = topic_name; + ret_val &= + nullptr != eprosima::fastrtps::Domain::createSubscriber(participant_, subscriber_attr_, &sub_listener_); + } + } + + return ret_val; + } + + bool isInitialized() const + { + return initialized_; + } void destroy() { @@ -287,26 +463,30 @@ class PubSubWriterReader { std::unique_lock lock(mutexDiscovery_); - std::cout << "WReader is waiting discovery..." << std::endl; + std::cout << "Waiting discovery..." << std::endl; - if(matched_ < 2) + if(matched_readers_.size() < 1 || matched_writers_.size() < 1) + { cvDiscovery_.wait(lock); + } - ASSERT_GE(matched_, 2u); - std::cout << "WReader discovery finished..." << std::endl; + ASSERT_GE(matched_readers_.size() + matched_writers_.size(), 2u); + std::cout << "Discovery finished..." << std::endl; } void waitRemoval() { std::unique_lock lock(mutexDiscovery_); - std::cout << "WReader is waiting removal..." << std::endl; + std::cout << "Waiting removal..." << std::endl; - if(matched_ != 0) + if(matched_writers_.size() != 0 || matched_readers_.size() != 0) + { cvDiscovery_.wait(lock); + } - ASSERT_EQ(matched_, 0u); - std::cout << "WReader removal finished..." << std::endl; + ASSERT_EQ(matched_readers_.size() + matched_writers_.size(), 0u); + std::cout << "Removal finished..." << std::endl; } #if HAVE_SECURITY @@ -355,9 +535,38 @@ class PubSubWriterReader return *this; } + size_t get_num_discovered_participants() const + { + return participant_listener_.get_num_discovered_participants(); + } + + size_t get_num_discovered_publishers() const + { + return participant_listener_.get_num_discovered_publishers(); + } + + size_t get_num_discovered_subscribers() const + { + return participant_listener_.get_num_discovered_subscribers(); + } + + size_t get_publication_matched() + { + std::lock_guard guard(mutexDiscovery_); + return matched_writers_.size(); + } + + size_t get_subscription_matched() + { + std::lock_guard guard(mutexDiscovery_); + return matched_readers_.size(); + } + private: - void receive_one(eprosima::fastrtps::Subscriber* subscriber, bool& returnedValue) + void receive_one( + eprosima::fastrtps::Subscriber* subscriber, + bool& returnedValue) { returnedValue = false; type data; @@ -385,17 +594,31 @@ class PubSubWriterReader } } - void matched() + void publication_matched(eprosima::fastrtps::rtps::MatchingInfo& info) { - std::unique_lock lock(mutexDiscovery_); - ++matched_; + std::lock_guard guard(mutexDiscovery_); + matched_writers_.insert(info.remoteEndpointGuid); cvDiscovery_.notify_one(); } - void unmatched() + void publication_unmatched(eprosima::fastrtps::rtps::MatchingInfo& info) { - std::unique_lock lock(mutexDiscovery_); - --matched_; + std::lock_guard guard(mutexDiscovery_); + matched_writers_.erase(info.remoteEndpointGuid); + cvDiscovery_.notify_one(); + } + + void subscription_matched(eprosima::fastrtps::rtps::MatchingInfo& info) + { + std::lock_guard guard(mutexDiscovery_); + matched_readers_.insert(info.remoteEndpointGuid); + cvDiscovery_.notify_one(); + } + + void subscription_unmatched(eprosima::fastrtps::rtps::MatchingInfo& info) + { + std::lock_guard guard(mutexDiscovery_); + matched_readers_.erase(info.remoteEndpointGuid); cvDiscovery_.notify_one(); } @@ -421,10 +644,13 @@ class PubSubWriterReader eprosima::fastrtps::Participant *participant_; eprosima::fastrtps::ParticipantAttributes participant_attr_; + eprosima::fastrtps::Publisher *publisher_; eprosima::fastrtps::PublisherAttributes publisher_attr_; + eprosima::fastrtps::Subscriber *subscriber_; eprosima::fastrtps::SubscriberAttributes subscriber_attr_; + std::string topic_name_; bool initialized_; std::list total_msgs_; @@ -432,7 +658,8 @@ class PubSubWriterReader std::condition_variable cv_; std::mutex mutexDiscovery_; std::condition_variable cvDiscovery_; - unsigned int matched_; + std::set matched_writers_; + std::set matched_readers_; std::atomic receiving_; type_support type_; eprosima::fastrtps::rtps::SequenceNumber_t last_seq; diff --git a/test/blackbox/RTPSAsSocketReader.hpp b/test/blackbox/RTPSAsSocketReader.hpp index 86051d8b4ac..91e0165f71d 100644 --- a/test/blackbox/RTPSAsSocketReader.hpp +++ b/test/blackbox/RTPSAsSocketReader.hpp @@ -93,13 +93,8 @@ class RTPSAsSocketReader mw << magicword << "_" << asio::ip::host_name() << "_" << GET_PID(); magicword_ = mw.str(); -#if defined(PREALLOCATED_WITH_REALLOC_MEMORY_MODE_TEST) - hattr_.memoryPolicy = eprosima::fastrtps::rtps::PREALLOCATED_WITH_REALLOC_MEMORY_MODE; -#elif defined(DYNAMIC_RESERVE_MEMORY_MODE_TEST) - hattr_.memoryPolicy = eprosima::fastrtps::rtps::DYNAMIC_RESERVE_MEMORY_MODE; -#else + // By default, memory mode is preallocated (the most restritive) hattr_.memoryPolicy = eprosima::fastrtps::rtps::PREALLOCATED_MEMORY_MODE; -#endif // By default, heartbeat period delay is 100 milliseconds. reader_attr_.times.heartbeatResponseDelay.seconds = 0; diff --git a/test/blackbox/RTPSAsSocketWriter.hpp b/test/blackbox/RTPSAsSocketWriter.hpp index 1222a48fb0b..866057609da 100644 --- a/test/blackbox/RTPSAsSocketWriter.hpp +++ b/test/blackbox/RTPSAsSocketWriter.hpp @@ -56,13 +56,8 @@ class RTPSAsSocketWriter : public eprosima::fastrtps::rtps::WriterListener mw << magicword << "_" << asio::ip::host_name() << "_" << GET_PID(); magicword_ = mw.str(); -#if defined(PREALLOCATED_WITH_REALLOC_MEMORY_MODE_TEST) - hattr_.memoryPolicy = eprosima::fastrtps::rtps::PREALLOCATED_WITH_REALLOC_MEMORY_MODE; -#elif defined(DYNAMIC_RESERVE_MEMORY_MODE_TEST) - hattr_.memoryPolicy = eprosima::fastrtps::rtps::DYNAMIC_RESERVE_MEMORY_MODE; -#else + // By default, memory mode is preallocated (the most restritive) hattr_.memoryPolicy = eprosima::fastrtps::rtps::PREALLOCATED_MEMORY_MODE; -#endif // By default, heartbeat period and nack response delay are 100 milliseconds. writer_attr_.times.heartbeatPeriod.seconds = 0; diff --git a/test/blackbox/RTPSWithRegistrationReader.hpp b/test/blackbox/RTPSWithRegistrationReader.hpp index df76dee9690..c47c4b11d75 100644 --- a/test/blackbox/RTPSWithRegistrationReader.hpp +++ b/test/blackbox/RTPSWithRegistrationReader.hpp @@ -223,6 +223,10 @@ class RTPSWithRegistrationReader }); } + eprosima::fastrtps::rtps::SequenceNumber_t get_last_received_sequence_number() const + { + return last_seq_; + } void wait_discovery() { @@ -304,7 +308,7 @@ class RTPSWithRegistrationReader std::cout << "Initializing persistent READER " << reader_attr_.endpoint.persistence_guid << " with file " << filename << std::endl; - return durability(eprosima::fastrtps::rtps::DurabilityKind_t::PERSISTENT) + return durability(eprosima::fastrtps::rtps::DurabilityKind_t::TRANSIENT) .add_property("dds.persistence.plugin", "builtin.SQLITE3") .add_property("dds.persistence.sqlite3.filename", filename); } diff --git a/test/blackbox/ReqRepHelloWorldReplier.cpp b/test/blackbox/ReqRepHelloWorldReplier.cpp index cfde173bf1b..49f744868d0 100644 --- a/test/blackbox/ReqRepHelloWorldReplier.cpp +++ b/test/blackbox/ReqRepHelloWorldReplier.cpp @@ -37,16 +37,9 @@ ReqRepHelloWorldReplier::ReqRepHelloWorldReplier(): request_listener_(*this), re participant_(nullptr), request_subscriber_(nullptr), reply_publisher_(nullptr), initialized_(false), matched_(0) { -#if defined(PREALLOCATED_WITH_REALLOC_MEMORY_MODE_TEST) - sattr.historyMemoryPolicy = PREALLOCATED_WITH_REALLOC_MEMORY_MODE; - puattr.historyMemoryPolicy = PREALLOCATED_WITH_REALLOC_MEMORY_MODE; -#elif defined(DYNAMIC_RESERVE_MEMORY_MODE_TEST) - sattr.historyMemoryPolicy = DYNAMIC_RESERVE_MEMORY_MODE; - puattr.historyMemoryPolicy = DYNAMIC_RESERVE_MEMORY_MODE; -#else - sattr.historyMemoryPolicy = PREALLOCATED_MEMORY_MODE; - puattr.historyMemoryPolicy = PREALLOCATED_MEMORY_MODE; -#endif + // By default, memory mode is preallocated (the most restritive) + sattr.historyMemoryPolicy = PREALLOCATED_MEMORY_MODE; + puattr.historyMemoryPolicy = PREALLOCATED_MEMORY_MODE; } ReqRepHelloWorldReplier::~ReqRepHelloWorldReplier() diff --git a/test/blackbox/ReqRepHelloWorldRequester.cpp b/test/blackbox/ReqRepHelloWorldRequester.cpp index a8e259b4977..64286fd9b36 100644 --- a/test/blackbox/ReqRepHelloWorldRequester.cpp +++ b/test/blackbox/ReqRepHelloWorldRequester.cpp @@ -38,16 +38,9 @@ ReqRepHelloWorldRequester::ReqRepHelloWorldRequester(): reply_listener_(*this), participant_(nullptr), reply_subscriber_(nullptr), request_publisher_(nullptr), initialized_(false), matched_(0) { -#if defined(PREALLOCATED_WITH_REALLOC_MEMORY_MODE_TEST) - sattr.historyMemoryPolicy = PREALLOCATED_WITH_REALLOC_MEMORY_MODE; - puattr.historyMemoryPolicy = PREALLOCATED_WITH_REALLOC_MEMORY_MODE; -#elif defined(DYNAMIC_RESERVE_MEMORY_MODE_TEST) - sattr.historyMemoryPolicy = DYNAMIC_RESERVE_MEMORY_MODE; - puattr.historyMemoryPolicy = DYNAMIC_RESERVE_MEMORY_MODE; -#else - sattr.historyMemoryPolicy = PREALLOCATED_MEMORY_MODE; - puattr.historyMemoryPolicy = PREALLOCATED_MEMORY_MODE; -#endif + // By default, memory mode is preallocated (the most restritive) + sattr.historyMemoryPolicy = PREALLOCATED_MEMORY_MODE; + puattr.historyMemoryPolicy = PREALLOCATED_MEMORY_MODE; } ReqRepHelloWorldRequester::~ReqRepHelloWorldRequester() diff --git a/test/blackbox/TCPReqRepHelloWorldReplier.cpp b/test/blackbox/TCPReqRepHelloWorldReplier.cpp index 9e1cc41457b..8b8f1d80ffb 100644 --- a/test/blackbox/TCPReqRepHelloWorldReplier.cpp +++ b/test/blackbox/TCPReqRepHelloWorldReplier.cpp @@ -40,16 +40,9 @@ TCPReqRepHelloWorldReplier::TCPReqRepHelloWorldReplier(): request_listener_(*thi participant_(nullptr), request_subscriber_(nullptr), reply_publisher_(nullptr), initialized_(false), matched_(0) { -#if defined(PREALLOCATED_WITH_REALLOC_MEMORY_MODE_TEST) - sattr.historyMemoryPolicy = PREALLOCATED_WITH_REALLOC_MEMORY_MODE; - puattr.historyMemoryPolicy = PREALLOCATED_WITH_REALLOC_MEMORY_MODE; -#elif defined(DYNAMIC_RESERVE_MEMORY_MODE_TEST) - sattr.historyMemoryPolicy = DYNAMIC_RESERVE_MEMORY_MODE; - puattr.historyMemoryPolicy = DYNAMIC_RESERVE_MEMORY_MODE; -#else - sattr.historyMemoryPolicy = PREALLOCATED_MEMORY_MODE; - puattr.historyMemoryPolicy = PREALLOCATED_MEMORY_MODE; -#endif + // By default, memory mode is preallocated (the most restritive) + sattr.historyMemoryPolicy = PREALLOCATED_MEMORY_MODE; + puattr.historyMemoryPolicy = PREALLOCATED_MEMORY_MODE; } TCPReqRepHelloWorldReplier::~TCPReqRepHelloWorldReplier() diff --git a/test/blackbox/TCPReqRepHelloWorldRequester.cpp b/test/blackbox/TCPReqRepHelloWorldRequester.cpp index 7cf348528f3..4a34dc9258c 100644 --- a/test/blackbox/TCPReqRepHelloWorldRequester.cpp +++ b/test/blackbox/TCPReqRepHelloWorldRequester.cpp @@ -42,16 +42,9 @@ TCPReqRepHelloWorldRequester::TCPReqRepHelloWorldRequester(): reply_listener_(*t participant_(nullptr), reply_subscriber_(nullptr), request_publisher_(nullptr), initialized_(false), matched_(0) { -#if defined(PREALLOCATED_WITH_REALLOC_MEMORY_MODE_TEST) - sattr.historyMemoryPolicy = PREALLOCATED_WITH_REALLOC_MEMORY_MODE; - puattr.historyMemoryPolicy = PREALLOCATED_WITH_REALLOC_MEMORY_MODE; -#elif defined(DYNAMIC_RESERVE_MEMORY_MODE_TEST) - sattr.historyMemoryPolicy = DYNAMIC_RESERVE_MEMORY_MODE; - puattr.historyMemoryPolicy = DYNAMIC_RESERVE_MEMORY_MODE; -#else - sattr.historyMemoryPolicy = PREALLOCATED_MEMORY_MODE; - puattr.historyMemoryPolicy = PREALLOCATED_MEMORY_MODE; -#endif + // By default, memory mode is preallocated (the most restritive) + sattr.historyMemoryPolicy = PREALLOCATED_MEMORY_MODE; + puattr.historyMemoryPolicy = PREALLOCATED_MEMORY_MODE; } TCPReqRepHelloWorldRequester::~TCPReqRepHelloWorldRequester() diff --git a/test/certs/governance_disable_discovery_disable_access_encrypt.smime b/test/certs/governance_disable_discovery_disable_access_encrypt.smime index 9b14e175efb..cccbf361477 100644 --- a/test/certs/governance_disable_discovery_disable_access_encrypt.smime +++ b/test/certs/governance_disable_discovery_disable_access_encrypt.smime @@ -1,9 +1,9 @@ MIME-Version: 1.0 -Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----969B33CD475D3057BD7527843316CF0D" +Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----838EDE47D4AC92015E8E0A3733DE1C2B" This is an S/MIME signed message -------969B33CD475D3057BD7527843316CF0D +------838EDE47D4AC92015E8E0A3733DE1C2B Content-Type: text/plain @@ -24,7 +24,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_enable_access_encrypt_* true false true @@ -33,7 +33,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_enable_access_encrypt_* false false true @@ -42,7 +42,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_disable_access_encrypt_* false false false @@ -51,7 +51,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_disable_access_encrypt_* true false false @@ -60,7 +60,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_enable_access_none_* true false true @@ -69,7 +69,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_enable_access_none_* false false true @@ -78,7 +78,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_disable_access_none_* false false false @@ -87,7 +87,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_disable_access_none_* true false false @@ -100,12 +100,12 @@ Content-Type: text/plain -------969B33CD475D3057BD7527843316CF0D +------838EDE47D4AC92015E8E0A3733DE1C2B Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" -MIIEeAYJKoZIhvcNAQcCoIIEaTCCBGUCAQExDzANBglghkgBZQMEAgEFADALBgkq +MIIEeQYJKoZIhvcNAQcCoIIEajCCBGYCAQExDzANBglghkgBZQMEAgEFADALBgkq hkiG9w0BBwGgggJAMIICPDCCAeOgAwIBAgIJALZwpgo2sxthMAoGCCqGSM49BAMC MIGaMQswCQYDVQQGEwJFUzELMAkGA1UECAwCTUExFDASBgNVBAcMC1RyZXMgQ2Fu dG9zMREwDwYDVQQKDAhlUHJvc2ltYTERMA8GA1UECwwIZVByb3NpbWExHjAcBgNV @@ -118,17 +118,17 @@ cm9zaW1hLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABGLlhB3WQ8l1fpUE 3DfOoulA/de38Zfj7hmpKtOnxiH2q6RJbwhxvJeA7R7mkmAKaJKmzx695BjyiXVS 7bE7vgejEDAOMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDRwAwRAIgVTY1BEvT 4pw3GyBMzaUqmp69wi0kBkyOgq04OhyJ13UCICR125vvt0fUhXsXaxOAx28E4Ac9 -SVxpI+3UYs2kV5n0MYIB/DCCAfgCAQEwgagwgZoxCzAJBgNVBAYTAkVTMQswCQYD +SVxpI+3UYs2kV5n0MYIB/TCCAfkCAQEwgagwgZoxCzAJBgNVBAYTAkVTMQswCQYD VQQIDAJNQTEUMBIGA1UEBwwLVHJlcyBDYW50b3MxETAPBgNVBAoMCGVQcm9zaW1h MREwDwYDVQQLDAhlUHJvc2ltYTEeMBwGA1UEAwwVZVByb3NpbWEgTWFpbiBUZXN0 IENBMSIwIAYJKoZIhvcNAQkBFhNtYWluY2FAZXByb3NpbWEuY29tAgkAtnCmCjaz G2EwDQYJYIZIAWUDBAIBBQCggeQwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAc -BgkqhkiG9w0BCQUxDxcNMTgwNDIwMDgwNDIxWjAvBgkqhkiG9w0BCQQxIgQgfLDf -kl8aZ5vgPmgFxspAH/aP3ofPAA+ACSz48QTPHG8weQYJKoZIhvcNAQkPMWwwajAL +BgkqhkiG9w0BCQUxDxcNMTkwNjExMDYyMzE2WjAvBgkqhkiG9w0BCQQxIgQg/xCU +j0qm4Me2Cjt4x2KKZuPARuS6bEGQH6q6wF6byGEweQYJKoZIhvcNAQkPMWwwajAL BglghkgBZQMEASowCwYJYIZIAWUDBAEWMAsGCWCGSAFlAwQBAjAKBggqhkiG9w0D BzAOBggqhkiG9w0DAgICAIAwDQYIKoZIhvcNAwICAUAwBwYFKw4DAgcwDQYIKoZI -hvcNAwICASgwCgYIKoZIzj0EAwIERjBEAiBztd6pxaJJm5EFVxZ0HhlJqBamdkLQ -QzRaChnMuelyBgIgGwmR7hXMbc8Hv74aRVXTcdUibeGidXsbcwr+qtSSqR8= +hvcNAwICASgwCgYIKoZIzj0EAwIERzBFAiEAxCCZkJxvHk77KBjw6InUA4FAwItz +YzEZSPqwZB1dydECIDGFh9je7DFQJxff/dfK32Dazzzul9KxVWY8wtOBJyRv -------969B33CD475D3057BD7527843316CF0D-- +------838EDE47D4AC92015E8E0A3733DE1C2B-- diff --git a/test/certs/governance_disable_discovery_disable_access_encrypt.xml b/test/certs/governance_disable_discovery_disable_access_encrypt.xml index cd4b1bd1c8c..26c2f95e545 100644 --- a/test/certs/governance_disable_discovery_disable_access_encrypt.xml +++ b/test/certs/governance_disable_discovery_disable_access_encrypt.xml @@ -16,7 +16,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_enable_access_encrypt_* true false true @@ -25,7 +25,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_enable_access_encrypt_* false false true @@ -34,7 +34,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_disable_access_encrypt_* false false false @@ -43,7 +43,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_disable_access_encrypt_* true false false @@ -52,7 +52,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_enable_access_none_* true false true @@ -61,7 +61,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_enable_access_none_* false false true @@ -70,7 +70,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_disable_access_none_* false false false @@ -79,7 +79,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_disable_access_none_* true false false diff --git a/test/certs/governance_disable_discovery_disable_access_none.smime b/test/certs/governance_disable_discovery_disable_access_none.smime index caa5facc1c9..77477e40ed9 100644 --- a/test/certs/governance_disable_discovery_disable_access_none.smime +++ b/test/certs/governance_disable_discovery_disable_access_none.smime @@ -1,9 +1,9 @@ MIME-Version: 1.0 -Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----7755820831CA4CB5DED8EF066C4726FB" +Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----84165D3F2855ADAD2AA3BAEA1B3D573F" This is an S/MIME signed message -------7755820831CA4CB5DED8EF066C4726FB +------84165D3F2855ADAD2AA3BAEA1B3D573F Content-Type: text/plain @@ -24,7 +24,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_enable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_enable_discovery_enable_access_encrypt_* true false true @@ -33,7 +33,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_disable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_disable_discovery_enable_access_encrypt_* false false true @@ -42,7 +42,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_disable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_disable_discovery_disable_access_encrypt_* false false false @@ -51,7 +51,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_enable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_enable_discovery_disable_access_encrypt_* true false false @@ -60,7 +60,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_enable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_enable_discovery_enable_access_none_* true false true @@ -69,7 +69,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_disable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_disable_discovery_enable_access_none_* false false true @@ -78,7 +78,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_disable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_disable_discovery_disable_access_none_* false false false @@ -87,7 +87,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_enable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_enable_discovery_disable_access_none_* true false false @@ -100,12 +100,12 @@ Content-Type: text/plain -------7755820831CA4CB5DED8EF066C4726FB +------84165D3F2855ADAD2AA3BAEA1B3D573F Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" -MIIEeQYJKoZIhvcNAQcCoIIEajCCBGYCAQExDzANBglghkgBZQMEAgEFADALBgkq +MIIEeAYJKoZIhvcNAQcCoIIEaTCCBGUCAQExDzANBglghkgBZQMEAgEFADALBgkq hkiG9w0BBwGgggJAMIICPDCCAeOgAwIBAgIJALZwpgo2sxthMAoGCCqGSM49BAMC MIGaMQswCQYDVQQGEwJFUzELMAkGA1UECAwCTUExFDASBgNVBAcMC1RyZXMgQ2Fu dG9zMREwDwYDVQQKDAhlUHJvc2ltYTERMA8GA1UECwwIZVByb3NpbWExHjAcBgNV @@ -118,17 +118,17 @@ cm9zaW1hLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABGLlhB3WQ8l1fpUE 3DfOoulA/de38Zfj7hmpKtOnxiH2q6RJbwhxvJeA7R7mkmAKaJKmzx695BjyiXVS 7bE7vgejEDAOMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDRwAwRAIgVTY1BEvT 4pw3GyBMzaUqmp69wi0kBkyOgq04OhyJ13UCICR125vvt0fUhXsXaxOAx28E4Ac9 -SVxpI+3UYs2kV5n0MYIB/TCCAfkCAQEwgagwgZoxCzAJBgNVBAYTAkVTMQswCQYD +SVxpI+3UYs2kV5n0MYIB/DCCAfgCAQEwgagwgZoxCzAJBgNVBAYTAkVTMQswCQYD VQQIDAJNQTEUMBIGA1UEBwwLVHJlcyBDYW50b3MxETAPBgNVBAoMCGVQcm9zaW1h MREwDwYDVQQLDAhlUHJvc2ltYTEeMBwGA1UEAwwVZVByb3NpbWEgTWFpbiBUZXN0 IENBMSIwIAYJKoZIhvcNAQkBFhNtYWluY2FAZXByb3NpbWEuY29tAgkAtnCmCjaz G2EwDQYJYIZIAWUDBAIBBQCggeQwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAc -BgkqhkiG9w0BCQUxDxcNMTgwNDIwMDgwNDM0WjAvBgkqhkiG9w0BCQQxIgQgjM4t -GUBfrEYr90QCgshcCLRAYprPfNga63+xYzg1gYgweQYJKoZIhvcNAQkPMWwwajAL +BgkqhkiG9w0BCQUxDxcNMTkwNjExMDYyMzE2WjAvBgkqhkiG9w0BCQQxIgQglEKU +rB7oUAgXzjJWvD5HKjWxOfFj7j8xw0aa88lGQoUweQYJKoZIhvcNAQkPMWwwajAL BglghkgBZQMEASowCwYJYIZIAWUDBAEWMAsGCWCGSAFlAwQBAjAKBggqhkiG9w0D BzAOBggqhkiG9w0DAgICAIAwDQYIKoZIhvcNAwICAUAwBwYFKw4DAgcwDQYIKoZI -hvcNAwICASgwCgYIKoZIzj0EAwIERzBFAiAGgzxA7YLPYgxHpRvN1y13M5GKDkGm -W7cRqbqYqDHfRgIhAIeDyD1v8ZohVhjMD088ORd2BSRaNQBlN7Uny/UENG5d +hvcNAwICASgwCgYIKoZIzj0EAwIERjBEAiBjLCHEEJC5uOphYrw5De8Q8y8YrsYG +tUC5zX3ZxaCaKAIgJTykatMLN8112At9YowZWjXqBIxSfcO2N+fXgxvlppA= -------7755820831CA4CB5DED8EF066C4726FB-- +------84165D3F2855ADAD2AA3BAEA1B3D573F-- diff --git a/test/certs/governance_disable_discovery_disable_access_none.xml b/test/certs/governance_disable_discovery_disable_access_none.xml index b44f2cb7a90..cad564d6e9a 100644 --- a/test/certs/governance_disable_discovery_disable_access_none.xml +++ b/test/certs/governance_disable_discovery_disable_access_none.xml @@ -16,7 +16,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_enable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_enable_discovery_enable_access_encrypt_* true false true @@ -25,7 +25,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_disable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_disable_discovery_enable_access_encrypt_* false false true @@ -34,7 +34,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_disable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_disable_discovery_disable_access_encrypt_* false false false @@ -43,7 +43,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_enable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_enable_discovery_disable_access_encrypt_* true false false @@ -52,7 +52,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_enable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_enable_discovery_enable_access_none_* true false true @@ -61,7 +61,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_disable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_disable_discovery_enable_access_none_* false false true @@ -70,7 +70,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_disable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_disable_discovery_disable_access_none_* false false false @@ -79,7 +79,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_enable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryDisableAccessNone_validation_ok_enable_discovery_disable_access_none_* true false false diff --git a/test/certs/governance_disable_discovery_enable_access_encrypt.smime b/test/certs/governance_disable_discovery_enable_access_encrypt.smime index 428aa2a4f25..4c03f70f07c 100644 --- a/test/certs/governance_disable_discovery_enable_access_encrypt.smime +++ b/test/certs/governance_disable_discovery_enable_access_encrypt.smime @@ -1,9 +1,9 @@ MIME-Version: 1.0 -Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----62450D5BAC463C8B5BB1874BAC60AEC5" +Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----E70FECC1FE813F6114FD139452F875E3" This is an S/MIME signed message -------62450D5BAC463C8B5BB1874BAC60AEC5 +------E70FECC1FE813F6114FD139452F875E3 Content-Type: text/plain @@ -24,7 +24,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_enable_access_encrypt_* true false true @@ -33,7 +33,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_enable_access_encrypt_* false false true @@ -42,7 +42,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_disable_access_encrypt_* false false false @@ -51,7 +51,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_disable_access_encrypt_* true false false @@ -60,7 +60,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_enable_access_none_* true false true @@ -69,7 +69,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_enable_access_none_* false false true @@ -78,7 +78,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_disable_access_none_* false false false @@ -87,7 +87,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_disable_access_none_* true false false @@ -100,12 +100,12 @@ Content-Type: text/plain -------62450D5BAC463C8B5BB1874BAC60AEC5 +------E70FECC1FE813F6114FD139452F875E3 Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" -MIIEeQYJKoZIhvcNAQcCoIIEajCCBGYCAQExDzANBglghkgBZQMEAgEFADALBgkq +MIIEegYJKoZIhvcNAQcCoIIEazCCBGcCAQExDzANBglghkgBZQMEAgEFADALBgkq hkiG9w0BBwGgggJAMIICPDCCAeOgAwIBAgIJALZwpgo2sxthMAoGCCqGSM49BAMC MIGaMQswCQYDVQQGEwJFUzELMAkGA1UECAwCTUExFDASBgNVBAcMC1RyZXMgQ2Fu dG9zMREwDwYDVQQKDAhlUHJvc2ltYTERMA8GA1UECwwIZVByb3NpbWExHjAcBgNV @@ -118,17 +118,17 @@ cm9zaW1hLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABGLlhB3WQ8l1fpUE 3DfOoulA/de38Zfj7hmpKtOnxiH2q6RJbwhxvJeA7R7mkmAKaJKmzx695BjyiXVS 7bE7vgejEDAOMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDRwAwRAIgVTY1BEvT 4pw3GyBMzaUqmp69wi0kBkyOgq04OhyJ13UCICR125vvt0fUhXsXaxOAx28E4Ac9 -SVxpI+3UYs2kV5n0MYIB/TCCAfkCAQEwgagwgZoxCzAJBgNVBAYTAkVTMQswCQYD +SVxpI+3UYs2kV5n0MYIB/jCCAfoCAQEwgagwgZoxCzAJBgNVBAYTAkVTMQswCQYD VQQIDAJNQTEUMBIGA1UEBwwLVHJlcyBDYW50b3MxETAPBgNVBAoMCGVQcm9zaW1h MREwDwYDVQQLDAhlUHJvc2ltYTEeMBwGA1UEAwwVZVByb3NpbWEgTWFpbiBUZXN0 IENBMSIwIAYJKoZIhvcNAQkBFhNtYWluY2FAZXByb3NpbWEuY29tAgkAtnCmCjaz G2EwDQYJYIZIAWUDBAIBBQCggeQwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAc -BgkqhkiG9w0BCQUxDxcNMTgwNDIwMDgwNDUyWjAvBgkqhkiG9w0BCQQxIgQgm6PU -ynTDufycTnu00XhxAhwhVMgbEIlHm2C6iBr6X9cweQYJKoZIhvcNAQkPMWwwajAL +BgkqhkiG9w0BCQUxDxcNMTkwNjExMDYyMzE2WjAvBgkqhkiG9w0BCQQxIgQgWydC +Eb33klfrBVUzsgeTi0fNcxiwafFDdBk43JJaeVwweQYJKoZIhvcNAQkPMWwwajAL BglghkgBZQMEASowCwYJYIZIAWUDBAEWMAsGCWCGSAFlAwQBAjAKBggqhkiG9w0D BzAOBggqhkiG9w0DAgICAIAwDQYIKoZIhvcNAwICAUAwBwYFKw4DAgcwDQYIKoZI -hvcNAwICASgwCgYIKoZIzj0EAwIERzBFAiEA6grtAxfsYtbXBti4WmIVXFw+VYo/ -jUC3bgYGi8WOjOoCIF2uz2JFf68MoC/oM1Esu/mL785RKIFm3sqEMIu0mt/d +hvcNAwICASgwCgYIKoZIzj0EAwIESDBGAiEA7Mr4Wnzeswkvp4o92MWJOr6JJz4/ +ZREabTSD7ap6ZPQCIQCFP4eetRu/C4NBhAatRlxjufvs2R+CMwWO/dIiuLFOvg== -------62450D5BAC463C8B5BB1874BAC60AEC5-- +------E70FECC1FE813F6114FD139452F875E3-- diff --git a/test/certs/governance_disable_discovery_enable_access_encrypt.xml b/test/certs/governance_disable_discovery_enable_access_encrypt.xml index 55b2b288a9d..c68618f607c 100644 --- a/test/certs/governance_disable_discovery_enable_access_encrypt.xml +++ b/test/certs/governance_disable_discovery_enable_access_encrypt.xml @@ -16,7 +16,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_enable_access_encrypt_* true false true @@ -25,7 +25,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_enable_access_encrypt_* false false true @@ -34,7 +34,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_disable_access_encrypt_* false false false @@ -43,7 +43,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_disable_access_encrypt_* true false false @@ -52,7 +52,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_enable_access_none_* true false true @@ -61,7 +61,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_enable_access_none_* false false true @@ -70,7 +70,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_disable_access_none_* false false false @@ -79,7 +79,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_disable_access_none_* true false false diff --git a/test/certs/governance_disable_discovery_enable_access_none.smime b/test/certs/governance_disable_discovery_enable_access_none.smime index ef4c71eee49..e257f840f34 100644 --- a/test/certs/governance_disable_discovery_enable_access_none.smime +++ b/test/certs/governance_disable_discovery_enable_access_none.smime @@ -1,9 +1,9 @@ MIME-Version: 1.0 -Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----98CCD1AB87291C50EBFC1F9E189C3302" +Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----D3BEBE43919AF61A839C7808F01932AE" This is an S/MIME signed message -------98CCD1AB87291C50EBFC1F9E189C3302 +------D3BEBE43919AF61A839C7808F01932AE Content-Type: text/plain @@ -24,7 +24,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_enable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_enable_discovery_enable_access_encrypt_* true false true @@ -33,7 +33,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_disable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_disable_discovery_enable_access_encrypt_* false false true @@ -42,7 +42,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_disable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_disable_discovery_disable_access_encrypt_* false false false @@ -51,7 +51,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_enable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_enable_discovery_disable_access_encrypt_* true false false @@ -60,7 +60,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_enable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_enable_discovery_enable_access_none_* true false true @@ -69,7 +69,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_disable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_disable_discovery_enable_access_none_* false false true @@ -78,7 +78,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_disable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_disable_discovery_disable_access_none_* false false false @@ -87,7 +87,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_enable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_enable_discovery_disable_access_none_* true false false @@ -100,12 +100,12 @@ Content-Type: text/plain -------98CCD1AB87291C50EBFC1F9E189C3302 +------D3BEBE43919AF61A839C7808F01932AE Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" -MIIEegYJKoZIhvcNAQcCoIIEazCCBGcCAQExDzANBglghkgBZQMEAgEFADALBgkq +MIIEeQYJKoZIhvcNAQcCoIIEajCCBGYCAQExDzANBglghkgBZQMEAgEFADALBgkq hkiG9w0BBwGgggJAMIICPDCCAeOgAwIBAgIJALZwpgo2sxthMAoGCCqGSM49BAMC MIGaMQswCQYDVQQGEwJFUzELMAkGA1UECAwCTUExFDASBgNVBAcMC1RyZXMgQ2Fu dG9zMREwDwYDVQQKDAhlUHJvc2ltYTERMA8GA1UECwwIZVByb3NpbWExHjAcBgNV @@ -118,17 +118,17 @@ cm9zaW1hLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABGLlhB3WQ8l1fpUE 3DfOoulA/de38Zfj7hmpKtOnxiH2q6RJbwhxvJeA7R7mkmAKaJKmzx695BjyiXVS 7bE7vgejEDAOMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDRwAwRAIgVTY1BEvT 4pw3GyBMzaUqmp69wi0kBkyOgq04OhyJ13UCICR125vvt0fUhXsXaxOAx28E4Ac9 -SVxpI+3UYs2kV5n0MYIB/jCCAfoCAQEwgagwgZoxCzAJBgNVBAYTAkVTMQswCQYD +SVxpI+3UYs2kV5n0MYIB/TCCAfkCAQEwgagwgZoxCzAJBgNVBAYTAkVTMQswCQYD VQQIDAJNQTEUMBIGA1UEBwwLVHJlcyBDYW50b3MxETAPBgNVBAoMCGVQcm9zaW1h MREwDwYDVQQLDAhlUHJvc2ltYTEeMBwGA1UEAwwVZVByb3NpbWEgTWFpbiBUZXN0 IENBMSIwIAYJKoZIhvcNAQkBFhNtYWluY2FAZXByb3NpbWEuY29tAgkAtnCmCjaz G2EwDQYJYIZIAWUDBAIBBQCggeQwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAc -BgkqhkiG9w0BCQUxDxcNMTgwNDIwMDgwNTA1WjAvBgkqhkiG9w0BCQQxIgQgPNKd -q2hLy0F0KZqeey/N6zrCQi1QazYDtqi+x0zFGKYweQYJKoZIhvcNAQkPMWwwajAL +BgkqhkiG9w0BCQUxDxcNMTkwNjExMDYyMzE2WjAvBgkqhkiG9w0BCQQxIgQgEuD9 +dLQZ6DltnGtg99F29KuIXqorPFLTXfGPwZuNLi8weQYJKoZIhvcNAQkPMWwwajAL BglghkgBZQMEASowCwYJYIZIAWUDBAEWMAsGCWCGSAFlAwQBAjAKBggqhkiG9w0D BzAOBggqhkiG9w0DAgICAIAwDQYIKoZIhvcNAwICAUAwBwYFKw4DAgcwDQYIKoZI -hvcNAwICASgwCgYIKoZIzj0EAwIESDBGAiEAt/0YYyFUGoKWsFYdWGpSdFFgv3Sx -r/jgRg9R/cZgcxMCIQDRJ6Ft5GY4zVHUY9BR2TDsFBnc/5WzhQmHIMBARCum/w== +hvcNAwICASgwCgYIKoZIzj0EAwIERzBFAiBwwAoTgGFG8iuLWZvcE6DWQMygdBq+ +eQ0WR5ACA8qKhAIhAK2dAA2JlbzPkwWAOma0CNY38lRom5iDHNUkf8X44rQz -------98CCD1AB87291C50EBFC1F9E189C3302-- +------D3BEBE43919AF61A839C7808F01932AE-- diff --git a/test/certs/governance_disable_discovery_enable_access_none.xml b/test/certs/governance_disable_discovery_enable_access_none.xml index 6de2608e36b..fdfc642b72e 100644 --- a/test/certs/governance_disable_discovery_enable_access_none.xml +++ b/test/certs/governance_disable_discovery_enable_access_none.xml @@ -16,7 +16,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_enable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_enable_discovery_enable_access_encrypt_* true false true @@ -25,7 +25,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_disable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_disable_discovery_enable_access_encrypt_* false false true @@ -34,7 +34,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_disable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_disable_discovery_disable_access_encrypt_* false false false @@ -43,7 +43,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_enable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_enable_discovery_disable_access_encrypt_* true false false @@ -52,7 +52,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_enable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_enable_discovery_enable_access_none_* true false true @@ -61,7 +61,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_disable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_disable_discovery_enable_access_none_* false false true @@ -70,7 +70,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_disable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_disable_discovery_disable_access_none_* false false false @@ -79,7 +79,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_enable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsDisableDiscoveryEnableAccessNone_validation_ok_enable_discovery_disable_access_none_* true false false diff --git a/test/certs/governance_enable_discovery_disable_access_encrypt.smime b/test/certs/governance_enable_discovery_disable_access_encrypt.smime index 139ad99d52e..768feb2cedf 100644 --- a/test/certs/governance_enable_discovery_disable_access_encrypt.smime +++ b/test/certs/governance_enable_discovery_disable_access_encrypt.smime @@ -1,9 +1,9 @@ MIME-Version: 1.0 -Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----29911F839DDBA23B9F381C3A97C8197A" +Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----D1A1577F1358E16426FC987431E9FD6F" This is an S/MIME signed message -------29911F839DDBA23B9F381C3A97C8197A +------D1A1577F1358E16426FC987431E9FD6F Content-Type: text/plain @@ -24,7 +24,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_enable_access_encrypt_* true false true @@ -33,7 +33,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_enable_access_encrypt_* false false true @@ -42,7 +42,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_disable_access_encrypt_* false false false @@ -51,7 +51,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_disable_access_encrypt_* true false false @@ -60,7 +60,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_enable_access_none_* true false true @@ -69,7 +69,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_enable_access_none_* false false true @@ -78,7 +78,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_disable_access_none_* false false false @@ -87,7 +87,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_disable_access_none_* true false false @@ -100,12 +100,12 @@ Content-Type: text/plain -------29911F839DDBA23B9F381C3A97C8197A +------D1A1577F1358E16426FC987431E9FD6F Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" -MIIEeAYJKoZIhvcNAQcCoIIEaTCCBGUCAQExDzANBglghkgBZQMEAgEFADALBgkq +MIIEegYJKoZIhvcNAQcCoIIEazCCBGcCAQExDzANBglghkgBZQMEAgEFADALBgkq hkiG9w0BBwGgggJAMIICPDCCAeOgAwIBAgIJALZwpgo2sxthMAoGCCqGSM49BAMC MIGaMQswCQYDVQQGEwJFUzELMAkGA1UECAwCTUExFDASBgNVBAcMC1RyZXMgQ2Fu dG9zMREwDwYDVQQKDAhlUHJvc2ltYTERMA8GA1UECwwIZVByb3NpbWExHjAcBgNV @@ -118,17 +118,17 @@ cm9zaW1hLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABGLlhB3WQ8l1fpUE 3DfOoulA/de38Zfj7hmpKtOnxiH2q6RJbwhxvJeA7R7mkmAKaJKmzx695BjyiXVS 7bE7vgejEDAOMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDRwAwRAIgVTY1BEvT 4pw3GyBMzaUqmp69wi0kBkyOgq04OhyJ13UCICR125vvt0fUhXsXaxOAx28E4Ac9 -SVxpI+3UYs2kV5n0MYIB/DCCAfgCAQEwgagwgZoxCzAJBgNVBAYTAkVTMQswCQYD +SVxpI+3UYs2kV5n0MYIB/jCCAfoCAQEwgagwgZoxCzAJBgNVBAYTAkVTMQswCQYD VQQIDAJNQTEUMBIGA1UEBwwLVHJlcyBDYW50b3MxETAPBgNVBAoMCGVQcm9zaW1h MREwDwYDVQQLDAhlUHJvc2ltYTEeMBwGA1UEAwwVZVByb3NpbWEgTWFpbiBUZXN0 IENBMSIwIAYJKoZIhvcNAQkBFhNtYWluY2FAZXByb3NpbWEuY29tAgkAtnCmCjaz G2EwDQYJYIZIAWUDBAIBBQCggeQwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAc -BgkqhkiG9w0BCQUxDxcNMTgwNDIwMDgwNjE5WjAvBgkqhkiG9w0BCQQxIgQghRku -SMlWj7n1fJuEMyXtuj0ApuVT1pIgTKwARTgSJNIweQYJKoZIhvcNAQkPMWwwajAL +BgkqhkiG9w0BCQUxDxcNMTkwNjExMDYyMzE2WjAvBgkqhkiG9w0BCQQxIgQgh1Ju +3AR2my24N8YGKND/UC7EZH33b4OfY4K41qDYtdIweQYJKoZIhvcNAQkPMWwwajAL BglghkgBZQMEASowCwYJYIZIAWUDBAEWMAsGCWCGSAFlAwQBAjAKBggqhkiG9w0D BzAOBggqhkiG9w0DAgICAIAwDQYIKoZIhvcNAwICAUAwBwYFKw4DAgcwDQYIKoZI -hvcNAwICASgwCgYIKoZIzj0EAwIERjBEAiBYGHdoCHgDT2p1bhZzPKLl8cF6Gj8B -wpO/JmetwOGRMAIgJTpzALa+rp1C6DgHxyESDcMfrXbOxkoKFsbXk11EIUg= +hvcNAwICASgwCgYIKoZIzj0EAwIESDBGAiEAnxvOTmajftVgkTSiM816os6W+s/e +NbR0EXUfloBnZa8CIQCh/uFw4KvUjSS0C5QDvfyjw2KStKjcewhjsqMqiCf6RA== -------29911F839DDBA23B9F381C3A97C8197A-- +------D1A1577F1358E16426FC987431E9FD6F-- diff --git a/test/certs/governance_enable_discovery_disable_access_encrypt.xml b/test/certs/governance_enable_discovery_disable_access_encrypt.xml index d1deb0a1af1..637f8d19dec 100644 --- a/test/certs/governance_enable_discovery_disable_access_encrypt.xml +++ b/test/certs/governance_enable_discovery_disable_access_encrypt.xml @@ -16,7 +16,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_enable_access_encrypt_* true false true @@ -25,7 +25,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_enable_access_encrypt_* false false true @@ -34,7 +34,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_disable_access_encrypt_* false false false @@ -43,7 +43,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_disable_access_encrypt_* true false false @@ -52,7 +52,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_enable_access_none_* true false true @@ -61,7 +61,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_enable_access_none_* false false true @@ -70,7 +70,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_disable_discovery_disable_access_none_* false false false @@ -79,7 +79,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessEncrypt_validation_ok_enable_discovery_disable_access_none_* true false false diff --git a/test/certs/governance_enable_discovery_disable_access_none.smime b/test/certs/governance_enable_discovery_disable_access_none.smime index fedad709c7a..77ff5ee139a 100644 --- a/test/certs/governance_enable_discovery_disable_access_none.smime +++ b/test/certs/governance_enable_discovery_disable_access_none.smime @@ -1,9 +1,9 @@ MIME-Version: 1.0 -Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----63A6BB654F72E839148123B6BB460EAB" +Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----C3BD0AC4A5EC55F315BC805E27F6F8DC" This is an S/MIME signed message -------63A6BB654F72E839148123B6BB460EAB +------C3BD0AC4A5EC55F315BC805E27F6F8DC Content-Type: text/plain @@ -24,7 +24,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_enable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_enable_discovery_enable_access_encrypt_* true false true @@ -33,7 +33,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_disable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_disable_discovery_enable_access_encrypt_* false false true @@ -42,7 +42,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_disable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_disable_discovery_disable_access_encrypt_* false false false @@ -51,7 +51,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_enable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_enable_discovery_disable_access_encrypt_* true false false @@ -60,7 +60,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_enable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_enable_discovery_enable_access_none_* true false true @@ -69,7 +69,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_disable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_disable_discovery_enable_access_none_* false false true @@ -78,7 +78,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_disable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_disable_discovery_disable_access_none_* false false false @@ -87,7 +87,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_enable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_enable_discovery_disable_access_none_* true false false @@ -100,12 +100,12 @@ Content-Type: text/plain -------63A6BB654F72E839148123B6BB460EAB +------C3BD0AC4A5EC55F315BC805E27F6F8DC Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" -MIIEeQYJKoZIhvcNAQcCoIIEajCCBGYCAQExDzANBglghkgBZQMEAgEFADALBgkq +MIIEegYJKoZIhvcNAQcCoIIEazCCBGcCAQExDzANBglghkgBZQMEAgEFADALBgkq hkiG9w0BBwGgggJAMIICPDCCAeOgAwIBAgIJALZwpgo2sxthMAoGCCqGSM49BAMC MIGaMQswCQYDVQQGEwJFUzELMAkGA1UECAwCTUExFDASBgNVBAcMC1RyZXMgQ2Fu dG9zMREwDwYDVQQKDAhlUHJvc2ltYTERMA8GA1UECwwIZVByb3NpbWExHjAcBgNV @@ -118,17 +118,17 @@ cm9zaW1hLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABGLlhB3WQ8l1fpUE 3DfOoulA/de38Zfj7hmpKtOnxiH2q6RJbwhxvJeA7R7mkmAKaJKmzx695BjyiXVS 7bE7vgejEDAOMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDRwAwRAIgVTY1BEvT 4pw3GyBMzaUqmp69wi0kBkyOgq04OhyJ13UCICR125vvt0fUhXsXaxOAx28E4Ac9 -SVxpI+3UYs2kV5n0MYIB/TCCAfkCAQEwgagwgZoxCzAJBgNVBAYTAkVTMQswCQYD +SVxpI+3UYs2kV5n0MYIB/jCCAfoCAQEwgagwgZoxCzAJBgNVBAYTAkVTMQswCQYD VQQIDAJNQTEUMBIGA1UEBwwLVHJlcyBDYW50b3MxETAPBgNVBAoMCGVQcm9zaW1h MREwDwYDVQQLDAhlUHJvc2ltYTEeMBwGA1UEAwwVZVByb3NpbWEgTWFpbiBUZXN0 IENBMSIwIAYJKoZIhvcNAQkBFhNtYWluY2FAZXByb3NpbWEuY29tAgkAtnCmCjaz G2EwDQYJYIZIAWUDBAIBBQCggeQwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAc -BgkqhkiG9w0BCQUxDxcNMTgwNDIwMDgwNjMxWjAvBgkqhkiG9w0BCQQxIgQgu3Ui -fcDusv3fKDM9DSYY6cPthUXAVflB07oK0ZTGHSoweQYJKoZIhvcNAQkPMWwwajAL +BgkqhkiG9w0BCQUxDxcNMTkwNjExMDYyMzE2WjAvBgkqhkiG9w0BCQQxIgQgyp23 +mqOiYgxJBsR7oKM1eSDKk00eMPNUn/VQ2/VF75UweQYJKoZIhvcNAQkPMWwwajAL BglghkgBZQMEASowCwYJYIZIAWUDBAEWMAsGCWCGSAFlAwQBAjAKBggqhkiG9w0D BzAOBggqhkiG9w0DAgICAIAwDQYIKoZIhvcNAwICAUAwBwYFKw4DAgcwDQYIKoZI -hvcNAwICASgwCgYIKoZIzj0EAwIERzBFAiEAy/TsxfZOAlHepBfGPSi8OI7qy83h -bcLwFjOP+WuEThICIAkqtna+ib2g9A7gMPxdCSEKVQCe5w31y+TYjEQkzhkJ +hvcNAwICASgwCgYIKoZIzj0EAwIESDBGAiEA2sVV/Gz+SaaS9+F/UtFllH1ZX8aQ +W8kl20S3RZfhZNICIQC25QdrmV2G3v34tdZv7/7LOS6TsjFTx2y3NRars72KDQ== -------63A6BB654F72E839148123B6BB460EAB-- +------C3BD0AC4A5EC55F315BC805E27F6F8DC-- diff --git a/test/certs/governance_enable_discovery_disable_access_none.xml b/test/certs/governance_enable_discovery_disable_access_none.xml index 90fc4d56b10..726abc28d76 100644 --- a/test/certs/governance_enable_discovery_disable_access_none.xml +++ b/test/certs/governance_enable_discovery_disable_access_none.xml @@ -16,7 +16,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_enable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_enable_discovery_enable_access_encrypt_* true false true @@ -25,7 +25,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_disable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_disable_discovery_enable_access_encrypt_* false false true @@ -34,7 +34,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_disable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_disable_discovery_disable_access_encrypt_* false false false @@ -43,7 +43,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_enable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_enable_discovery_disable_access_encrypt_* true false false @@ -52,7 +52,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_enable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_enable_discovery_enable_access_none_* true false true @@ -61,7 +61,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_disable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_disable_discovery_enable_access_none_* false false true @@ -70,7 +70,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_disable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_disable_discovery_disable_access_none_* false false false @@ -79,7 +79,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_enable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryDisableAccessNone_validation_ok_enable_discovery_disable_access_none_* true false false diff --git a/test/certs/governance_enable_discovery_enable_access_encrypt.smime b/test/certs/governance_enable_discovery_enable_access_encrypt.smime index f19bee7b184..fb5345d221e 100644 --- a/test/certs/governance_enable_discovery_enable_access_encrypt.smime +++ b/test/certs/governance_enable_discovery_enable_access_encrypt.smime @@ -1,9 +1,9 @@ MIME-Version: 1.0 -Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----B605A9D03FF63F909A497AA43DAE6D6F" +Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----76FCC328AB3797479434F5CD73F79DDB" This is an S/MIME signed message -------B605A9D03FF63F909A497AA43DAE6D6F +------76FCC328AB3797479434F5CD73F79DDB Content-Type: text/plain @@ -24,7 +24,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_enable_access_encrypt_* true false true @@ -33,7 +33,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_enable_access_encrypt_* false false true @@ -42,7 +42,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_disable_access_encrypt_* false false false @@ -51,7 +51,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_disable_access_encrypt_* true false false @@ -60,7 +60,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_enable_access_none_* true false true @@ -69,7 +69,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_enable_access_none_* false false true @@ -78,7 +78,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_disable_access_none_* false false false @@ -87,7 +87,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_disable_access_none_* true false false @@ -100,7 +100,7 @@ Content-Type: text/plain -------B605A9D03FF63F909A497AA43DAE6D6F +------76FCC328AB3797479434F5CD73F79DDB Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" @@ -123,12 +123,12 @@ VQQIDAJNQTEUMBIGA1UEBwwLVHJlcyBDYW50b3MxETAPBgNVBAoMCGVQcm9zaW1h MREwDwYDVQQLDAhlUHJvc2ltYTEeMBwGA1UEAwwVZVByb3NpbWEgTWFpbiBUZXN0 IENBMSIwIAYJKoZIhvcNAQkBFhNtYWluY2FAZXByb3NpbWEuY29tAgkAtnCmCjaz G2EwDQYJYIZIAWUDBAIBBQCggeQwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAc -BgkqhkiG9w0BCQUxDxcNMTgwNDIwMDgwNTIwWjAvBgkqhkiG9w0BCQQxIgQgpxcm -qN6OaS1EuOpkwMSGpZJU6Saaa0khzmlHaaTMFeYweQYJKoZIhvcNAQkPMWwwajAL +BgkqhkiG9w0BCQUxDxcNMTkwNjExMDYyMzE2WjAvBgkqhkiG9w0BCQQxIgQgjIQG +xwYiMZ7h1N+/cV/BfmggAAzoWiTa9CaOWF44OoMweQYJKoZIhvcNAQkPMWwwajAL BglghkgBZQMEASowCwYJYIZIAWUDBAEWMAsGCWCGSAFlAwQBAjAKBggqhkiG9w0D BzAOBggqhkiG9w0DAgICAIAwDQYIKoZIhvcNAwICAUAwBwYFKw4DAgcwDQYIKoZI -hvcNAwICASgwCgYIKoZIzj0EAwIERzBFAiEApPxDmbvr09xFRF6EPGL1qsRmnQAc -CcDMpQDh3qr0aywCIEZPG34vXLDKN39gLby13d7lXIVHHwBjVnk6R2eMWDfQ +hvcNAwICASgwCgYIKoZIzj0EAwIERzBFAiEAq5t43jGfC6LVK1AlIJqvavxtzrMH +q6Qh6nAkx5HmZdICIBRee9Ho5iY6caluSLuxHiszch3TV/yR6vNacRfZ15tk -------B605A9D03FF63F909A497AA43DAE6D6F-- +------76FCC328AB3797479434F5CD73F79DDB-- diff --git a/test/certs/governance_enable_discovery_enable_access_encrypt.xml b/test/certs/governance_enable_discovery_enable_access_encrypt.xml index 263d3481aa7..272fcac118b 100644 --- a/test/certs/governance_enable_discovery_enable_access_encrypt.xml +++ b/test/certs/governance_enable_discovery_enable_access_encrypt.xml @@ -16,7 +16,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_enable_access_encrypt_* true false true @@ -25,7 +25,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_enable_access_encrypt_* false false true @@ -34,7 +34,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_disable_access_encrypt_* false false false @@ -43,7 +43,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_disable_access_encrypt_* true false false @@ -52,7 +52,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_enable_access_none_* true false true @@ -61,7 +61,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_enable_access_none_* false false true @@ -70,7 +70,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_disable_discovery_disable_access_none_* false false false @@ -79,7 +79,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessEncrypt_validation_ok_enable_discovery_disable_access_none_* true false false diff --git a/test/certs/governance_enable_discovery_enable_access_none.smime b/test/certs/governance_enable_discovery_enable_access_none.smime index 3aeb2b88f2b..bbb1c016013 100644 --- a/test/certs/governance_enable_discovery_enable_access_none.smime +++ b/test/certs/governance_enable_discovery_enable_access_none.smime @@ -1,9 +1,9 @@ MIME-Version: 1.0 -Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----20E6597A1AB3A115E3126AB188592885" +Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----F18A3B4BAFE728781067D0CA0E0DFF66" This is an S/MIME signed message -------20E6597A1AB3A115E3126AB188592885 +------F18A3B4BAFE728781067D0CA0E0DFF66 Content-Type: text/plain @@ -24,7 +24,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_enable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_enable_discovery_enable_access_encrypt_* true false true @@ -33,7 +33,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_disable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_disable_discovery_enable_access_encrypt_* false false true @@ -42,7 +42,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_disable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_disable_discovery_disable_access_encrypt_* false false false @@ -51,7 +51,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_enable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_enable_discovery_disable_access_encrypt_* true false false @@ -60,7 +60,7 @@ Content-Type: text/plain ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_enable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_enable_discovery_enable_access_none_* true false true @@ -69,7 +69,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_disable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_disable_discovery_enable_access_none_* false false true @@ -78,7 +78,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_disable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_disable_discovery_disable_access_none_* false false false @@ -87,7 +87,7 @@ Content-Type: text/plain NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_enable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_enable_discovery_disable_access_none_* true false false @@ -100,12 +100,12 @@ Content-Type: text/plain -------20E6597A1AB3A115E3126AB188592885 +------F18A3B4BAFE728781067D0CA0E0DFF66 Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" -MIIEeQYJKoZIhvcNAQcCoIIEajCCBGYCAQExDzANBglghkgBZQMEAgEFADALBgkq +MIIEeAYJKoZIhvcNAQcCoIIEaTCCBGUCAQExDzANBglghkgBZQMEAgEFADALBgkq hkiG9w0BBwGgggJAMIICPDCCAeOgAwIBAgIJALZwpgo2sxthMAoGCCqGSM49BAMC MIGaMQswCQYDVQQGEwJFUzELMAkGA1UECAwCTUExFDASBgNVBAcMC1RyZXMgQ2Fu dG9zMREwDwYDVQQKDAhlUHJvc2ltYTERMA8GA1UECwwIZVByb3NpbWExHjAcBgNV @@ -118,17 +118,17 @@ cm9zaW1hLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABGLlhB3WQ8l1fpUE 3DfOoulA/de38Zfj7hmpKtOnxiH2q6RJbwhxvJeA7R7mkmAKaJKmzx695BjyiXVS 7bE7vgejEDAOMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDRwAwRAIgVTY1BEvT 4pw3GyBMzaUqmp69wi0kBkyOgq04OhyJ13UCICR125vvt0fUhXsXaxOAx28E4Ac9 -SVxpI+3UYs2kV5n0MYIB/TCCAfkCAQEwgagwgZoxCzAJBgNVBAYTAkVTMQswCQYD +SVxpI+3UYs2kV5n0MYIB/DCCAfgCAQEwgagwgZoxCzAJBgNVBAYTAkVTMQswCQYD VQQIDAJNQTEUMBIGA1UEBwwLVHJlcyBDYW50b3MxETAPBgNVBAoMCGVQcm9zaW1h MREwDwYDVQQLDAhlUHJvc2ltYTEeMBwGA1UEAwwVZVByb3NpbWEgTWFpbiBUZXN0 IENBMSIwIAYJKoZIhvcNAQkBFhNtYWluY2FAZXByb3NpbWEuY29tAgkAtnCmCjaz G2EwDQYJYIZIAWUDBAIBBQCggeQwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAc -BgkqhkiG9w0BCQUxDxcNMTgwNDIwMDgwNTQyWjAvBgkqhkiG9w0BCQQxIgQgrpSr -cNgERZkzGzbroV1v9NTQIO7epN4R0ZEaFXfgqI4weQYJKoZIhvcNAQkPMWwwajAL +BgkqhkiG9w0BCQUxDxcNMTkwNjExMDYyMzE2WjAvBgkqhkiG9w0BCQQxIgQg71Br +HQ9kqp3aQaCdsX6gFMN9x6eGcNtaK77laQikTDoweQYJKoZIhvcNAQkPMWwwajAL BglghkgBZQMEASowCwYJYIZIAWUDBAEWMAsGCWCGSAFlAwQBAjAKBggqhkiG9w0D BzAOBggqhkiG9w0DAgICAIAwDQYIKoZIhvcNAwICAUAwBwYFKw4DAgcwDQYIKoZI -hvcNAwICASgwCgYIKoZIzj0EAwIERzBFAiBo/OWndB8SLoglFPTC9K18SInXpwTS -GkHotb5GBCBI/QIhAI0eFGgo9s2khlIHcQYuBneAmuxaRpTY8jrWYrf1W0jL +hvcNAwICASgwCgYIKoZIzj0EAwIERjBEAiBG0oidqasMopI0R5i6/8oZKvKZodIA +r32lQk9YwBJUwwIgRoiR9/Ql34XCfGwHB1TTaDcItkURpQljxfKqsH+Vwf8= -------20E6597A1AB3A115E3126AB188592885-- +------F18A3B4BAFE728781067D0CA0E0DFF66-- diff --git a/test/certs/governance_enable_discovery_enable_access_none.xml b/test/certs/governance_enable_discovery_enable_access_none.xml index 4397e4442f4..bd2e0d13b4b 100644 --- a/test/certs/governance_enable_discovery_enable_access_none.xml +++ b/test/certs/governance_enable_discovery_enable_access_none.xml @@ -16,7 +16,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_enable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_enable_discovery_enable_access_encrypt_* true false true @@ -25,7 +25,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_disable_discovery_enable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_disable_discovery_enable_access_encrypt_* false false true @@ -34,7 +34,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_disable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_disable_discovery_disable_access_encrypt_* false false false @@ -43,7 +43,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_enable_discovery_disable_access_encrypt_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_enable_discovery_disable_access_encrypt_* true false false @@ -52,7 +52,7 @@ ENCRYPT - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_enable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_enable_discovery_enable_access_none_* true false true @@ -61,7 +61,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_disable_discovery_enable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_disable_discovery_enable_access_none_* false false true @@ -70,7 +70,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_disable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_disable_discovery_disable_access_none_* false false false @@ -79,7 +79,7 @@ NONE - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_enable_discovery_disable_access_none_* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_PermissionsEnableDiscoveryEnableAccessNone_validation_ok_enable_discovery_disable_access_none_* true false false diff --git a/test/certs/governance_helloworld_all_enable.smime b/test/certs/governance_helloworld_all_enable.smime index efb07ff31c6..e4dabe03c62 100644 --- a/test/certs/governance_helloworld_all_enable.smime +++ b/test/certs/governance_helloworld_all_enable.smime @@ -1,9 +1,9 @@ MIME-Version: 1.0 -Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----164906A0CF14A77A8223B425D3824F71" +Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----5351E6C63E84CE3AB6B9853BD230D2A9" This is an S/MIME signed message -------164906A0CF14A77A8223B425D3824F71 +------5351E6C63E84CE3AB6B9853BD230D2A9 Content-Type: text/plain @@ -38,12 +38,12 @@ Content-Type: text/plain -------164906A0CF14A77A8223B425D3824F71 +------5351E6C63E84CE3AB6B9853BD230D2A9 Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" -MIIEegYJKoZIhvcNAQcCoIIEazCCBGcCAQExDzANBglghkgBZQMEAgEFADALBgkq +MIIEeQYJKoZIhvcNAQcCoIIEajCCBGYCAQExDzANBglghkgBZQMEAgEFADALBgkq hkiG9w0BBwGgggJAMIICPDCCAeOgAwIBAgIJALZwpgo2sxthMAoGCCqGSM49BAMC MIGaMQswCQYDVQQGEwJFUzELMAkGA1UECAwCTUExFDASBgNVBAcMC1RyZXMgQ2Fu dG9zMREwDwYDVQQKDAhlUHJvc2ltYTERMA8GA1UECwwIZVByb3NpbWExHjAcBgNV @@ -56,17 +56,17 @@ cm9zaW1hLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABGLlhB3WQ8l1fpUE 3DfOoulA/de38Zfj7hmpKtOnxiH2q6RJbwhxvJeA7R7mkmAKaJKmzx695BjyiXVS 7bE7vgejEDAOMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDRwAwRAIgVTY1BEvT 4pw3GyBMzaUqmp69wi0kBkyOgq04OhyJ13UCICR125vvt0fUhXsXaxOAx28E4Ac9 -SVxpI+3UYs2kV5n0MYIB/jCCAfoCAQEwgagwgZoxCzAJBgNVBAYTAkVTMQswCQYD +SVxpI+3UYs2kV5n0MYIB/TCCAfkCAQEwgagwgZoxCzAJBgNVBAYTAkVTMQswCQYD VQQIDAJNQTEUMBIGA1UEBwwLVHJlcyBDYW50b3MxETAPBgNVBAoMCGVQcm9zaW1h MREwDwYDVQQLDAhlUHJvc2ltYTEeMBwGA1UEAwwVZVByb3NpbWEgTWFpbiBUZXN0 IENBMSIwIAYJKoZIhvcNAQkBFhNtYWluY2FAZXByb3NpbWEuY29tAgkAtnCmCjaz G2EwDQYJYIZIAWUDBAIBBQCggeQwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAc -BgkqhkiG9w0BCQUxDxcNMTgxMTMwMTE1MzE3WjAvBgkqhkiG9w0BCQQxIgQgRfiH +BgkqhkiG9w0BCQUxDxcNMTkwNjExMDYyMzE2WjAvBgkqhkiG9w0BCQQxIgQgRfiH rgLPG4v5NHu+eyK3h7RsS0DXzTQPCjgjiwI6N+YweQYJKoZIhvcNAQkPMWwwajAL BglghkgBZQMEASowCwYJYIZIAWUDBAEWMAsGCWCGSAFlAwQBAjAKBggqhkiG9w0D BzAOBggqhkiG9w0DAgICAIAwDQYIKoZIhvcNAwICAUAwBwYFKw4DAgcwDQYIKoZI -hvcNAwICASgwCgYIKoZIzj0EAwIESDBGAiEAzh8X2N5oodm27sbFCmV79kbVEv3e -+uDsXpEUEzCmZaMCIQDDCIUmQ4Z0t+LVOOdzRCo72pmnKDZhT2HsX8Hnk3D7aw== +hvcNAwICASgwCgYIKoZIzj0EAwIERzBFAiEAyrwJ10LkhQxF+eCR8UQ+/d74BjAw +Hds3ZliXDu9oAGECIHU/FEUEDprVU2mnBWlbLWn41jyU9sAS5NhDqu77D1/f -------164906A0CF14A77A8223B425D3824F71-- +------5351E6C63E84CE3AB6B9853BD230D2A9-- diff --git a/test/certs/permissions.smime b/test/certs/permissions.smime index 310df808b2f..e19e98aa999 100644 --- a/test/certs/permissions.smime +++ b/test/certs/permissions.smime @@ -1,9 +1,9 @@ MIME-Version: 1.0 -Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----2A4989238D4F2D20B023D4A265986DF6" +Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="----5C3BC8C0095B87A8C04CF3224C2D9B42" This is an S/MIME signed message -------2A4989238D4F2D20B023D4A265986DF6 +------5C3BC8C0095B87A8C04CF3224C2D9B42 Content-Type: text/plain @@ -25,7 +25,7 @@ Content-Type: text/plain *clock* - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions*_validation_ok* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions*_validation_ok* @@ -47,7 +47,7 @@ Content-Type: text/plain *clock* - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions*_validation_ok* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions*_validation_ok* *temperature* @@ -57,7 +57,7 @@ Content-Type: text/plain -------2A4989238D4F2D20B023D4A265986DF6 +------5C3BC8C0095B87A8C04CF3224C2D9B42 Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" @@ -80,12 +80,12 @@ VQQIDAJNQTEUMBIGA1UEBwwLVHJlcyBDYW50b3MxETAPBgNVBAoMCGVQcm9zaW1h MREwDwYDVQQLDAhlUHJvc2ltYTEeMBwGA1UEAwwVZVByb3NpbWEgTWFpbiBUZXN0 IENBMSIwIAYJKoZIhvcNAQkBFhNtYWluY2FAZXByb3NpbWEuY29tAgkAtnCmCjaz G2EwDQYJYIZIAWUDBAIBBQCggeQwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAc -BgkqhkiG9w0BCQUxDxcNMTgwNDIwMDgyMzA2WjAvBgkqhkiG9w0BCQQxIgQg1lWm -2Ht4wIzo9Fa9RITX0LiWKpdICY76DAYaJoOOW1wweQYJKoZIhvcNAQkPMWwwajAL +BgkqhkiG9w0BCQUxDxcNMTkwNjExMDYxNjU0WjAvBgkqhkiG9w0BCQQxIgQgVPbA +JfGBEgG7yoraMvA/eifH1SktvG/K0mFUGrko4QAweQYJKoZIhvcNAQkPMWwwajAL BglghkgBZQMEASowCwYJYIZIAWUDBAEWMAsGCWCGSAFlAwQBAjAKBggqhkiG9w0D BzAOBggqhkiG9w0DAgICAIAwDQYIKoZIhvcNAwICAUAwBwYFKw4DAgcwDQYIKoZI -hvcNAwICASgwCgYIKoZIzj0EAwIERzBFAiEA5YSGIGrkJ0ycgqkIJuFIILYax79Z -wSCw1ujFBls8gbICIAJiEbqQB0VhI0YUojwdcQ5a61OhesdPalwA1qbAxVWP +hvcNAwICASgwCgYIKoZIzj0EAwIERzBFAiAFN/qe+n+AK4xkhAtwUY2sQxNG2ZJ8 +XfrHW3eYKUqFiQIhAINklpw757aN0VzKBV+NL/iHyJ88G75IQobDVuM9pXTM -------2A4989238D4F2D20B023D4A265986DF6-- +------5C3BC8C0095B87A8C04CF3224C2D9B42-- diff --git a/test/certs/permissions.xml b/test/certs/permissions.xml index 78c8c6c770c..8183f96e3d5 100644 --- a/test/certs/permissions.xml +++ b/test/certs/permissions.xml @@ -17,7 +17,7 @@ *clock* - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions*_validation_ok* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions*_validation_ok* @@ -39,7 +39,7 @@ *clock* - BlackBox_*_BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions*_validation_ok* + BlackBox_BuiltinAuthenticationAndAccessAndCryptoPlugin_Permissions*_validation_ok* *temperature* diff --git a/test/communication/CMakeLists.txt b/test/communication/CMakeLists.txt index 05ce758c83e..7935486f88b 100644 --- a/test/communication/CMakeLists.txt +++ b/test/communication/CMakeLists.txt @@ -50,6 +50,8 @@ if(NOT ((MSVC OR MSVC_IDE) AND EPROSIMA_INSTALLER) AND fastcdr_FOUND) ${CMAKE_CURRENT_BINARY_DIR}/simple_communication.py COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/liveliness_assertion.py ${CMAKE_CURRENT_BINARY_DIR}/liveliness_assertion.py COPYONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/automatic_liveliness_assertion.py + ${CMAKE_CURRENT_BINARY_DIR}/automatic_liveliness_assertion.py COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/simple_besteffort.xml ${CMAKE_CURRENT_BINARY_DIR}/simple_besteffort.xml COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/simple_reliable.xml @@ -177,5 +179,20 @@ if(NOT ((MSVC OR MSVC_IDE) AND EPROSIMA_INSTALLER) AND fastcdr_FOUND) set_property(TEST LivelinessAssertion APPEND PROPERTY ENVIRONMENT "PATH=$\\;$\\;${WIN_PATH}") endif() + add_test(NAME AutomaticLivelinessAssertion + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/automatic_liveliness_assertion.py) + + # Set test with label NoMemoryCheck + set_property(TEST AutomaticLivelinessAssertion PROPERTY LABELS "NoMemoryCheck") + + set_property(TEST AutomaticLivelinessAssertion PROPERTY ENVIRONMENT + "SIMPLE_COMMUNICATION_PUBLISHER_BIN=$") + set_property(TEST AutomaticLivelinessAssertion APPEND PROPERTY ENVIRONMENT + "SIMPLE_COMMUNICATION_SUBSCRIBER_BIN=$") + if(WIN32) + string(REPLACE ";" "\\;" WIN_PATH "$ENV{PATH}") + set_property(TEST AutomaticLivelinessAssertion APPEND PROPERTY ENVIRONMENT + "PATH=$\\;$\\;${WIN_PATH}") + endif() endif() endif() diff --git a/test/communication/Publisher.cpp b/test/communication/Publisher.cpp index b5a3fb0a93a..0fe49d1a8a6 100644 --- a/test/communication/Publisher.cpp +++ b/test/communication/Publisher.cpp @@ -209,6 +209,9 @@ int main(int argc, char** argv) publisher_attributes.topic.topicKind = NO_KEY; publisher_attributes.topic.topicDataType = type.getName(); publisher_attributes.topic.topicName = topic.str(); + publisher_attributes.qos.m_liveliness.lease_duration = 3; + publisher_attributes.qos.m_liveliness.announcement_period = 1; + publisher_attributes.qos.m_liveliness.kind = AUTOMATIC_LIVELINESS_QOS; Publisher* publisher = Domain::createPublisher(participant, publisher_attributes, &listener); if(publisher == nullptr) { diff --git a/test/communication/Subscriber.cpp b/test/communication/Subscriber.cpp index 84f75c3022c..b77b5205905 100644 --- a/test/communication/Subscriber.cpp +++ b/test/communication/Subscriber.cpp @@ -39,6 +39,8 @@ using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::rtps; +bool run = true; + class ParListener : public ParticipantListener { public: @@ -109,6 +111,22 @@ class SubListener : public SubscriberListener } } + void on_liveliness_changed( + Subscriber* sub, + const LivelinessChangedStatus& status) override + { + (void)sub; + if (status.alive_count_change == 1) + { + std::cout << "Publisher recovered liveliness" << std::endl; + } + else if (status.not_alive_count_change == 1) + { + std::cout << "Publisher lost liveliness" << std::endl; + run = false; + } + } + std::mutex mutex_; std::condition_variable cv_; unsigned int number_samples_; @@ -203,6 +221,8 @@ int main(int argc, char** argv) subscriber_attributes.topic.topicKind = NO_KEY; subscriber_attributes.topic.topicDataType = type.getName(); subscriber_attributes.topic.topicName = topic.str(); + subscriber_attributes.qos.m_liveliness.lease_duration = 3; + subscriber_attributes.qos.m_liveliness.kind = AUTOMATIC_LIVELINESS_QOS; Subscriber* subscriber = Domain::createSubscriber(participant, subscriber_attributes, &listener); if(subscriber == nullptr) @@ -211,11 +231,12 @@ int main(int argc, char** argv) return 1; } - while(notexit) + while(notexit && run) { eClock::my_sleep(250); } + if (run) { std::unique_lock lock(listener.mutex_); listener.cv_.wait(lock, [&]{ return listener.number_samples_ >= samples; }); diff --git a/test/communication/automatic_liveliness_assertion.py b/test/communication/automatic_liveliness_assertion.py new file mode 100644 index 00000000000..6d633d20347 --- /dev/null +++ b/test/communication/automatic_liveliness_assertion.py @@ -0,0 +1,55 @@ +# Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima). +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import sys, os, subprocess, glob + +script_dir = os.path.dirname(os.path.realpath(__file__)) + +publisher_command = os.environ.get("SIMPLE_COMMUNICATION_PUBLISHER_BIN") +if not publisher_command: + publisher_files = glob.glob(os.path.join(script_dir, "**/SimpleCommunicationPublisher*"), recursive=True) + publisher_command = next(iter(publisher_files), None) +assert publisher_command +subscriber_command = os.environ.get("SIMPLE_COMMUNICATION_SUBSCRIBER_BIN") +if not subscriber_command: + subscriber_files = glob.glob(os.path.join(script_dir, "**/SimpleCommunicationSubscriber*"), recursive=True) + subscriber_command = next(iter(subscriber_files), None) +assert subscriber_command +xml_file = os.environ.get("XML_FILE") +if xml_file: + real_xml_file = os.path.join(script_dir, xml_file) +else: + real_xml_file = os.path.join(script_dir, "liveliness_assertion.360.xml") + +subscriber_proc = subprocess.Popen([subscriber_command, "--seed", str(os.getpid()), "--notexit", + "--xmlfile", real_xml_file], stdout=subprocess.PIPE) +publisher_proc = subprocess.Popen([publisher_command, "--seed", str(os.getpid()), "--exit_on_lost_liveliness", + "--xmlfile", real_xml_file]) + +while True: + line = subscriber_proc.stdout.readline() + if line.strip().decode('utf-8') == 'Publisher recovered liveliness': + print("Publisher recovered liveliness") + break + +publisher_proc.kill() +subscriber_proc.communicate() +retvalue = subscriber_proc.returncode + +if retvalue != 0: + print("Test failed: " + str(retvalue)) +else: + print("Test successed") + +sys.exit(retvalue) diff --git a/test/mock/rtps/RTPSReader/fastrtps/rtps/reader/RTPSReader.h b/test/mock/rtps/RTPSReader/fastrtps/rtps/reader/RTPSReader.h index 7a99fe6abc3..969bd918fe9 100644 --- a/test/mock/rtps/RTPSReader/fastrtps/rtps/reader/RTPSReader.h +++ b/test/mock/rtps/RTPSReader/fastrtps/rtps/reader/RTPSReader.h @@ -35,12 +35,22 @@ class RTPSReader : public Endpoint { public: + RTPSReader() {} + + RTPSReader(ReaderHistory* history, std::recursive_timed_mutex* mutex) + { + history->mp_reader = this; + history->mp_mutex = mutex; + } + virtual ~RTPSReader() = default; virtual bool matched_writer_add(RemoteWriterAttributes& wdata) = 0; virtual bool matched_writer_remove(RemoteWriterAttributes& wdata) = 0; + MOCK_METHOD1(change_removed_by_history, bool(CacheChange_t* change)); + MOCK_METHOD0(getHistory_mock, ReaderHistory*()); MOCK_CONST_METHOD0(getGuid, const GUID_t&()); diff --git a/test/mock/rtps/ReaderHistory/fastrtps/rtps/history/ReaderHistory.h b/test/mock/rtps/ReaderHistory/fastrtps/rtps/history/ReaderHistory.h index c861e5b928c..ad00c01f905 100644 --- a/test/mock/rtps/ReaderHistory/fastrtps/rtps/history/ReaderHistory.h +++ b/test/mock/rtps/ReaderHistory/fastrtps/rtps/history/ReaderHistory.h @@ -27,8 +27,12 @@ namespace eprosima { namespace fastrtps { namespace rtps { +class RTPSReader; + class ReaderHistory { + friend class RTPSReader; + public: ReaderHistory(const HistoryAttributes& /*att*/){} @@ -41,6 +45,11 @@ class ReaderHistory delete change; return ret; } + + protected: + + RTPSReader* mp_reader; + std::recursive_timed_mutex* mp_mutex; }; } // namespace rtps diff --git a/test/mock/rtps/ReceiverResource/fastrtps/rtps/network/ReceiverResource.h b/test/mock/rtps/ReceiverResource/fastrtps/rtps/network/ReceiverResource.h index 6ef0e221b34..d5cd2b23132 100644 --- a/test/mock/rtps/ReceiverResource/fastrtps/rtps/network/ReceiverResource.h +++ b/test/mock/rtps/ReceiverResource/fastrtps/rtps/network/ReceiverResource.h @@ -49,7 +49,7 @@ class ReceiverResource : public TransportReceiverInterface } void Abort() {} ReceiverResource(ReceiverResource&&) {} - ~ReceiverResource() + virtual ~ReceiverResource() override { if (Cleanup) { diff --git a/test/mock/rtps/StatefulReader/fastrtps/rtps/reader/StatefulReader.h b/test/mock/rtps/StatefulReader/fastrtps/rtps/reader/StatefulReader.h index 4499e52b047..6ccb88df45a 100644 --- a/test/mock/rtps/StatefulReader/fastrtps/rtps/reader/StatefulReader.h +++ b/test/mock/rtps/StatefulReader/fastrtps/rtps/reader/StatefulReader.h @@ -27,6 +27,10 @@ class StatefulReader : public RTPSReader { public: + StatefulReader() {} + + StatefulReader(ReaderHistory* history, std::recursive_timed_mutex* mutex) : RTPSReader(history, mutex) {} + virtual ~StatefulReader() {} MOCK_METHOD1(matched_writer_add, bool(RemoteWriterAttributes&)); diff --git a/test/unittest/CMakeLists.txt b/test/unittest/CMakeLists.txt index 847b2340cbf..4d4a9d3024a 100644 --- a/test/unittest/CMakeLists.txt +++ b/test/unittest/CMakeLists.txt @@ -20,6 +20,7 @@ add_definitions( add_subdirectory(rtps/common) add_subdirectory(rtps/reader) add_subdirectory(rtps/writer) +add_subdirectory(rtps/history) add_subdirectory(rtps/resources/timedevent) add_subdirectory(rtps/network) add_subdirectory(rtps/flowcontrol) diff --git a/test/unittest/rtps/history/CMakeLists.txt b/test/unittest/rtps/history/CMakeLists.txt new file mode 100644 index 00000000000..db37ab53088 --- /dev/null +++ b/test/unittest/rtps/history/CMakeLists.txt @@ -0,0 +1,66 @@ +# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if(NOT ((MSVC OR MSVC_IDE) AND EPROSIMA_INSTALLER)) + include(${PROJECT_SOURCE_DIR}/cmake/common/gtest.cmake) + check_gtest() + check_gmock() + + if(GTEST_FOUND AND GMOCK_FOUND) + find_package(Threads REQUIRED) + + set(READERHISTORYTESTS_SOURCE ReaderHistoryTests.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/history/ReaderHistory.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/history/History.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/history/CacheChangePool.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/log/Log.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/log/StdoutConsumer.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/common/Time_t.cpp) + + set(CACHECHANGEPOOLTESTS_SOURCE CacheChangePoolTests.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/history/CacheChangePool.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/log/Log.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/log/StdoutConsumer.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/common/Time_t.cpp) + + if(WIN32) + add_definitions(-D_WIN32_WINNT=0x0601) + endif() + + add_executable(ReaderHistoryTests ${READERHISTORYTESTS_SOURCE}) + target_compile_definitions(ReaderHistoryTests PRIVATE FASTRTPS_NO_LIB) + target_include_directories(ReaderHistoryTests PRIVATE + ${GTEST_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS} + ${PROJECT_SOURCE_DIR}/test/mock/rtps/Endpoint + ${PROJECT_SOURCE_DIR}/test/mock/rtps/RTPSReader + ${PROJECT_SOURCE_DIR}/test/mock/rtps/StatefulReader + ${PROJECT_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/include) + target_link_libraries(ReaderHistoryTests + ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}) + add_gtest(ReaderHistoryTests SOURCES ${READERHISTORYTESTS_SOURCE}) + + add_executable(CacheChangePoolTests ${CACHECHANGEPOOLTESTS_SOURCE}) + target_compile_definitions(CacheChangePoolTests PRIVATE FASTRTPS_NO_LIB) + target_include_directories(CacheChangePoolTests PRIVATE + ${GTEST_INCLUDE_DIRS} + ${PROJECT_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/include) + target_link_libraries(CacheChangePoolTests + ${GTEST_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}) + add_gtest(CacheChangePoolTests SOURCES ${CACHECHANGEPOOLTESTS_SOURCE}) + + + endif() +endif() diff --git a/test/unittest/rtps/history/CacheChangePoolTests.cpp b/test/unittest/rtps/history/CacheChangePoolTests.cpp new file mode 100644 index 00000000000..dcc4089ac96 --- /dev/null +++ b/test/unittest/rtps/history/CacheChangePoolTests.cpp @@ -0,0 +1,254 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include + +#include + +using namespace eprosima::fastrtps::rtps; +using namespace ::testing; +using namespace std; + +class CacheChangePoolTests : public TestWithParam> +{ +protected: + CacheChangePoolTests() + : pool(nullptr) + , pool_size(10) + , max_pool_size(0) + , payload_size(128) + , memory_policy(MemoryManagementPolicy_t::PREALLOCATED_MEMORY_MODE) + { + } + + virtual ~CacheChangePoolTests() {} + + virtual void SetUp() + { + pool_size = get<0>(GetParam()); + max_pool_size = get<1>(GetParam()); + payload_size = get<2>(GetParam()); + memory_policy = get<3>(GetParam()); + + pool = new CacheChangePool( + pool_size, + payload_size, + max_pool_size, + memory_policy); + } + + virtual void TearDown() + { + delete pool; + } + + CacheChangePool* pool; + + int32_t pool_size; + int32_t max_pool_size; + uint32_t payload_size; + MemoryManagementPolicy_t memory_policy; +}; + +TEST_P(CacheChangePoolTests, init_pool) +{ + ASSERT_EQ(pool->getInitialPayloadSize(), payload_size); + + size_t expected_size; + if (memory_policy == MemoryManagementPolicy_t::DYNAMIC_RESERVE_MEMORY_MODE) + { + expected_size = 0; + } + else { + expected_size = static_cast(pool_size + 1U); + } + + ASSERT_EQ(pool->get_allCachesSize(), expected_size); + ASSERT_EQ(pool->get_freeCachesSize(), expected_size); +} + +TEST_P(CacheChangePoolTests, reserve_cache) +{ + CacheChange_t* ch = nullptr; + + uint32_t payload = payload_size; + uint32_t size = static_cast(pool_size); + uint32_t max_size = static_cast(max_pool_size); + + uint32_t num_inserts; + if (max_size == 0) + { + num_inserts = 1000U; + } + else if (max_size <= size) + { + max_size = size; + num_inserts = size + 1; + } + else // max_size > size + { + num_inserts = max_size + 1; + } + + for (uint32_t i=0; ireserve_Cache(&ch, [data_size]() -> uint32_t {return data_size;})); + ASSERT_EQ(pool->getInitialPayloadSize(), payload); + ASSERT_GE(pool->get_freeCachesSize(), 0U); + + switch (memory_policy) + { + case MemoryManagementPolicy_t::PREALLOCATED_MEMORY_MODE: + ASSERT_EQ(ch->serializedPayload.max_size, payload); + break; + case MemoryManagementPolicy_t::PREALLOCATED_WITH_REALLOC_MEMORY_MODE: + ASSERT_EQ(ch->serializedPayload.max_size, max(payload, data_size)); + break; + case MemoryManagementPolicy_t::DYNAMIC_RESERVE_MEMORY_MODE: + ASSERT_EQ(ch->serializedPayload.max_size, data_size); + break; + } + + if (max_size > 0) + { + ASSERT_LE(pool->get_allCachesSize(), max_size + 1U); + } + } + + if (max_size == 0) + { + ASSERT_TRUE(pool->reserve_Cache(&ch, payload)); + } + else + { + ASSERT_FALSE(pool->reserve_Cache(&ch, payload)); + } +} + +TEST_P(CacheChangePoolTests, release_cache) +{ + CacheChange_t* ch = nullptr; + + uint32_t num_inserts = 10; + for (uint32_t i=0; iget_allCachesSize(); + size_t free_caches_size = pool->get_freeCachesSize(); + uint32_t data_size = i*16; + + pool->reserve_Cache(&ch, [data_size]() -> uint32_t {return data_size;}); + + if (memory_policy == MemoryManagementPolicy_t::DYNAMIC_RESERVE_MEMORY_MODE) + { + ASSERT_EQ(pool->get_allCachesSize(), all_caches_size + 1U); + ASSERT_EQ(pool->get_freeCachesSize(), 0U); + } + else + { + ASSERT_EQ(pool->get_allCachesSize(), all_caches_size); + ASSERT_EQ(pool->get_freeCachesSize(), free_caches_size - 1U); + } + + pool->release_Cache(ch); + + if (memory_policy == MemoryManagementPolicy_t::DYNAMIC_RESERVE_MEMORY_MODE) + { + ASSERT_EQ(pool->get_allCachesSize(), all_caches_size); + ASSERT_EQ(pool->get_freeCachesSize(), 0U); + } + else + { + ASSERT_EQ(pool->get_allCachesSize(), all_caches_size); + ASSERT_EQ(pool->get_freeCachesSize(), free_caches_size); + } + } +} + +TEST_P(CacheChangePoolTests, chage_change) +{ + CacheChange_t* ch = nullptr; + + uint32_t data_size = 16; + + pool->reserve_Cache(&ch, [data_size]() -> uint32_t {return data_size;}); + + // Check that cache change is initilized + ASSERT_EQ(ch->kind, ALIVE); + ASSERT_EQ(ch->sequenceNumber.high, 0); + ASSERT_EQ(ch->sequenceNumber.low, 0U); + ASSERT_EQ(ch->writerGUID, c_Guid_Unknown); + ASSERT_EQ(ch->serializedPayload.length, 0U); + ASSERT_EQ(ch->serializedPayload.pos, 0U); + for(uint8_t i=0;i<16;++i) + { + ASSERT_EQ(ch->instanceHandle.value[i], 0U); + } + + ASSERT_FALSE(ch->isRead); + ASSERT_EQ(ch->sourceTimestamp.seconds(), 0); + ASSERT_EQ(ch->sourceTimestamp.fraction(), 0U); + + // Modify cache change + ch->kind = NOT_ALIVE_DISPOSED; + ch->sequenceNumber.high = 1; + ch->sequenceNumber.low = 1; + ch->writerGUID = GUID_t(GuidPrefix_t::unknown(), 1); + ch->serializedPayload.length = 1; + ch->serializedPayload.pos = 1; + for(uint8_t i=0;i<16;++i) + ch->instanceHandle.value[i] = 1; + ch->isRead = true; + ch->sourceTimestamp.seconds(1); + ch->sourceTimestamp.fraction(1); + + pool->release_Cache(ch); + + if (memory_policy != MemoryManagementPolicy_t::DYNAMIC_RESERVE_MEMORY_MODE) + { + // Check that cache change is initialized again + ASSERT_EQ(ch->kind, ALIVE); + ASSERT_EQ(ch->sequenceNumber.high, 0); + ASSERT_EQ(ch->sequenceNumber.low, 0U); + ASSERT_EQ(ch->writerGUID, c_Guid_Unknown); + ASSERT_EQ(ch->serializedPayload.length, 0U); + ASSERT_EQ(ch->serializedPayload.pos, 0U); + for(uint8_t i=0;i<16;++i) + { + ASSERT_EQ(ch->instanceHandle.value[i], 0U); + } + + ASSERT_FALSE(ch->isRead); + ASSERT_EQ(ch->sourceTimestamp.seconds(), 0); + ASSERT_EQ(ch->sourceTimestamp.fraction(), 0U); + } +} + +INSTANTIATE_TEST_CASE_P( + instance_1, + CacheChangePoolTests, + Combine(Values(0, 10, 20, 30), + Values(0, 10, 20, 30), + Values(128, 256, 512, 1024), + Values(MemoryManagementPolicy_t::PREALLOCATED_MEMORY_MODE, + MemoryManagementPolicy_t::PREALLOCATED_WITH_REALLOC_MEMORY_MODE, + MemoryManagementPolicy_t::DYNAMIC_RESERVE_MEMORY_MODE)), ); + +int main(int argc, char **argv) +{ + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/test/unittest/rtps/history/ReaderHistoryTests.cpp b/test/unittest/rtps/history/ReaderHistoryTests.cpp new file mode 100644 index 00000000000..202dcb07824 --- /dev/null +++ b/test/unittest/rtps/history/ReaderHistoryTests.cpp @@ -0,0 +1,214 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include + +#include +#include + +#include + +using namespace eprosima::fastrtps::rtps; +using namespace ::testing; +using namespace std; + +class ReaderHistoryTests : public Test +{ +protected: + HistoryAttributes history_attr; + ReaderHistory* history; + StatefulReader* readerMock; + std::recursive_timed_mutex mutex; + + uint32_t num_writers = 2; + uint32_t num_sequence_numbers = 2; + uint32_t num_changes = num_writers * num_sequence_numbers; + vector changes_list; + + ReaderHistoryTests() {} + + virtual ~ReaderHistoryTests() {} + + virtual void SetUp() + { + history_attr.memoryPolicy = MemoryManagementPolicy_t::PREALLOCATED_MEMORY_MODE; + history_attr.payloadMaxSize = 4; + history_attr.initialReservedCaches = 10; + history_attr.maximumReservedCaches = 20; + + history = new ReaderHistory(history_attr); + readerMock = new StatefulReader(history, &mutex); + + //Create changes list + uint32_t t=0; + for (uint32_t i=1; i<=num_writers; i++) + { + GUID_t writer_guid = GUID_t(GuidPrefix_t::unknown(), i); + + for (uint32_t j=1; j<=num_sequence_numbers; j++) + { + CacheChange_t* ch = new CacheChange_t(); + ch->writerGUID = writer_guid; + ch->sequenceNumber = SequenceNumber_t(0,j);; + ch->sourceTimestamp = Time_t(0,t); + + changes_list.push_back(ch); + + t++; + } + } + } + + virtual void TearDown() + { + for (uint32_t i=0; iadd_change(changes_list[i]); + ASSERT_EQ(history->getHistorySize(), i+1U); + } + + for (uint32_t i=0; iremove_change(changes_list[i]); + ASSERT_EQ(history->getHistorySize(), num_changes-i-1U); + } +} + +TEST_F(ReaderHistoryTests, remove_empty_history) +{ + EXPECT_CALL(*readerMock, change_removed_by_history(_)).Times(0); + + CacheChange_t* ch = new CacheChange_t(); + ch->writerGUID = GUID_t(GuidPrefix_t::unknown(), 1U); + + ASSERT_FALSE(history->remove_change(ch)); + + delete ch; +} + +TEST_F(ReaderHistoryTests, remove_null_cache_change) +{ + EXPECT_CALL(*readerMock, change_removed_by_history(_)).Times(0); + + CacheChange_t* ch = nullptr; + ASSERT_FALSE(history->remove_change(ch)); +} + +TEST_F(ReaderHistoryTests, cache_change_payload_max_size) +{ + uint32_t ch_payload_length = history_attr.payloadMaxSize + 1U; + CacheChange_t* ch = new CacheChange_t(); + + ch->serializedPayload.length = ch_payload_length; + ch->writerGUID = GUID_t(GuidPrefix_t::unknown(), 1U); + + ASSERT_FALSE(history->add_change(ch)); + ASSERT_EQ(history->getHistorySize(), 0U); + + delete ch; +} + +TEST_F(ReaderHistoryTests, get_change) +{ + for (uint32_t i=0; iadd_change(changes_list[i]); + } + + ASSERT_EQ(history->getHistorySize(), num_changes); + + for (uint32_t i=1; i<=num_writers; i++) + { + GUID_t writer_guid = GUID_t(GuidPrefix_t::unknown(), i); + + for (uint32_t j=1; j<=num_sequence_numbers; j++) + { + SequenceNumber_t seq_number = SequenceNumber_t(0,j); + + CacheChange_t* ch = nullptr; + ASSERT_TRUE(history->get_change(seq_number, writer_guid, &ch)); + ASSERT_EQ(ch->writerGUID, writer_guid); + ASSERT_EQ(ch->sequenceNumber, seq_number); + } + } +} + +TEST_F(ReaderHistoryTests, get_min_change_from_writer) +{ + for (uint32_t i=0; iadd_change(changes_list[i]); + } + + ASSERT_EQ(history->getHistorySize(), num_changes); + + CacheChange_t* ch = nullptr; + GUID_t w1 = GUID_t(GuidPrefix_t::unknown(), 1U); + ASSERT_TRUE(history->get_min_change_from(&ch, w1)); + ASSERT_EQ(ch->writerGUID, GUID_t(GuidPrefix_t::unknown(), 1U)); + ASSERT_EQ(ch->sequenceNumber, SequenceNumber_t(0,1U)); + + GUID_t w2 = GUID_t(GuidPrefix_t::unknown(), 2U); + ASSERT_TRUE(history->get_min_change_from(&ch, w2)); + ASSERT_EQ(ch->writerGUID, GUID_t(GuidPrefix_t::unknown(), 2U)); + ASSERT_EQ(ch->sequenceNumber, SequenceNumber_t(0,1U)); +} + +TEST_F(ReaderHistoryTests, get_min_change_from_writer_non_existent) +{ + GUID_t w1(GuidPrefix_t::unknown(), 1U); + + CacheChange_t* ch = nullptr; + ASSERT_FALSE(history->get_min_change_from(&ch, w1)); +} + +TEST_F(ReaderHistoryTests, remove_changes_with_guid) +{ + for (uint32_t i=0; iadd_change(changes_list[i]); + } + + EXPECT_CALL(*readerMock, change_removed_by_history(_)).Times(2). + WillRepeatedly(Return(true)); + + ASSERT_EQ(history->getHistorySize(), num_changes); + GUID_t w1 = GUID_t(GuidPrefix_t::unknown(), 1U); + ASSERT_TRUE(history->remove_changes_with_guid(w1)); + + ASSERT_EQ(history->getHistorySize(), num_changes - num_sequence_numbers); +} + +int main(int argc, char **argv) +{ + testing::InitGoogleMock(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/test/unittest/rtps/writer/CMakeLists.txt b/test/unittest/rtps/writer/CMakeLists.txt index d6ab4dd38fd..4c1027d694f 100644 --- a/test/unittest/rtps/writer/CMakeLists.txt +++ b/test/unittest/rtps/writer/CMakeLists.txt @@ -20,14 +20,16 @@ if(NOT ((MSVC OR MSVC_IDE) AND EPROSIMA_INSTALLER)) if(GTEST_FOUND AND GMOCK_FOUND) find_package(Threads REQUIRED) + # ReaderProxy + set(WRITERPROXYTESTS_SOURCE ReaderProxyTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/writer/ReaderProxy.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/resources/TimedEvent.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/resources/TimedEventImpl.cpp ${PROJECT_SOURCE_DIR}/src/cpp/log/Log.cpp - ${PROJECT_SOURCE_DIR}/src/cpp/log/StdoutConsumer.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/log/StdoutConsumer.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/common/Time_t.cpp - ) + ) if(WIN32) add_definitions(-D_WIN32_WINNT=0x0601) @@ -52,5 +54,27 @@ if(NOT ((MSVC OR MSVC_IDE) AND EPROSIMA_INSTALLER)) ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}) add_gtest(ReaderProxyTests SOURCES ${WRITERPROXYTESTS_SOURCE}) + + # LivelinessManager + + set(LIVELINESSMANAGERTESTS_SOURCE LivelinessManagerTests.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/log/Log.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/log/StdoutConsumer.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/writer/LivelinessManager.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/resources/TimedEvent.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/resources/TimedEventImpl.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/timedevent/TimedCallback.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/common/Time_t.cpp) + add_executable(LivelinessManagerTests ${LIVELINESSMANAGERTESTS_SOURCE}) + target_compile_definitions(LivelinessManagerTests PRIVATE FASTRTPS_NO_LIB) + target_include_directories(LivelinessManagerTests PRIVATE + ${GTEST_INCLUDE_DIRS} + ${GMOCK_INCLUDE_DIRS} + ${PROJECT_SOURCE_DIR}/include + ${PROJECT_BINARY_DIR}/include) + target_link_libraries(LivelinessManagerTests PRIVATE + ${GTEST_LIBRARIES} + ${GMOCK_LIBRARIES}) + add_gtest(LivelinessManagerTests SOURCES ${LIVELINESSMANAGERTESTS_SOURCE}) endif() endif() diff --git a/test/unittest/rtps/writer/LivelinessManagerTests.cpp b/test/unittest/rtps/writer/LivelinessManagerTests.cpp new file mode 100644 index 00000000000..a88a63c1cbf --- /dev/null +++ b/test/unittest/rtps/writer/LivelinessManagerTests.cpp @@ -0,0 +1,502 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include + +#include +#include +#include +#include +#include +#include + +class LivelinessManagerTests : public ::testing::Test +{ + public: + + LivelinessManagerTests() : work_(service_) {} + + void SetUp() + { + thread_ = new std::thread(&LivelinessManagerTests::run, this); + + writer_losing_liveliness = eprosima::fastrtps::rtps::GUID_t(); + writer_recovering_liveliness = eprosima::fastrtps::rtps::GUID_t(); + num_writers_lost = 0; + num_writers_recovered = 0; + } + + void TearDown() + { + service_.stop(); + thread_->join(); + delete thread_; + } + + void run() + { + service_.run(); + } + + asio::io_service service_; + asio::io_service::work work_; + std::thread* thread_; + + // Callback to test the liveliness manager + + void liveliness_changed(eprosima::fastrtps::rtps::GUID_t guid, + const eprosima::fastrtps::LivelinessQosPolicyKind&, + const eprosima::fastrtps::Duration_t&, + int alive_change, + int not_alive_change) + { + if (alive_change > 0) + { + std::unique_lock lock(liveliness_recovered_mutex_); + writer_recovering_liveliness = guid; + num_writers_recovered++; + liveliness_recovered_cv_.notify_one(); + } + else if (not_alive_change > 0) + { + std::unique_lock lock(liveliness_lost_mutex_); + writer_losing_liveliness = guid; + num_writers_lost++; + liveliness_lost_cv_.notify_one(); + } + } + + void wait_liveliness_lost(unsigned int num_lost) + { + std::unique_lock lock(liveliness_lost_mutex_); + liveliness_lost_cv_.wait(lock, [&](){ return num_writers_lost == num_lost; }); + } + + void wait_liveliness_recovered(unsigned int num_recovered) + { + std::unique_lock lock(liveliness_recovered_mutex_); + liveliness_recovered_cv_.wait(lock, [&](){ return num_writers_recovered == num_recovered;}); + } + + eprosima::fastrtps::rtps::GUID_t writer_losing_liveliness; + eprosima::fastrtps::rtps::GUID_t writer_recovering_liveliness; + unsigned int num_writers_lost; + unsigned int num_writers_recovered; + + std::mutex liveliness_lost_mutex_; + std::condition_variable liveliness_lost_cv_; + std::mutex liveliness_recovered_mutex_; + std::condition_variable liveliness_recovered_cv_; +}; + +namespace eprosima { +namespace fastrtps { + +using eprosima::fastrtps::rtps::LivelinessData; +using eprosima::fastrtps::rtps::LivelinessManager; +using eprosima::fastrtps::rtps::GuidPrefix_t; +using eprosima::fastrtps::rtps::GUID_t; + +TEST_F(LivelinessManagerTests, WriterCanAlwaysBeAdded) +{ + LivelinessManager liveliness_manager( + nullptr, + service_, + *thread_); + + GuidPrefix_t guidP; + guidP.value[0] = 1; + GUID_t guid(guidP, 0); + + // Writers with same Guid, liveliness kind and lease duration cannot be added + + EXPECT_EQ(liveliness_manager.add_writer(guid, AUTOMATIC_LIVELINESS_QOS, Duration_t(1)), true); + + // Same guid and different liveliness kind can be added + EXPECT_EQ(liveliness_manager.add_writer(guid, MANUAL_BY_PARTICIPANT_LIVELINESS_QOS, Duration_t(1)), true); + EXPECT_EQ(liveliness_manager.add_writer(guid, MANUAL_BY_TOPIC_LIVELINESS_QOS, Duration_t(1)), true); + + // Same guid and different lease duration can be added + EXPECT_EQ(liveliness_manager.add_writer(guid, AUTOMATIC_LIVELINESS_QOS, Duration_t(2)), true); + EXPECT_EQ(liveliness_manager.add_writer(guid, AUTOMATIC_LIVELINESS_QOS, Duration_t(3)), true); + EXPECT_EQ(liveliness_manager.add_writer(guid, AUTOMATIC_LIVELINESS_QOS, Duration_t(4)), true); + + // Same guid, same kind, and same lease duration can also be added + EXPECT_EQ(liveliness_manager.add_writer(guid, AUTOMATIC_LIVELINESS_QOS, Duration_t(1)), true); +} + +TEST_F(LivelinessManagerTests, WriterCannotBeRemovedTwice) +{ + LivelinessManager liveliness_manager( + nullptr, + service_, + *thread_); + + GuidPrefix_t guidP; + guidP.value[0] = 1; + GUID_t guid(guidP, 0); + + EXPECT_EQ(liveliness_manager.add_writer(guid, AUTOMATIC_LIVELINESS_QOS, Duration_t(1)), true); + EXPECT_EQ(liveliness_manager.remove_writer(guid, AUTOMATIC_LIVELINESS_QOS, Duration_t(1)), true); + EXPECT_EQ(liveliness_manager.remove_writer(guid, AUTOMATIC_LIVELINESS_QOS, Duration_t(1)), false); + + EXPECT_EQ(liveliness_manager.add_writer(guid, MANUAL_BY_PARTICIPANT_LIVELINESS_QOS, Duration_t(1)), true); + EXPECT_EQ(liveliness_manager.remove_writer(guid, MANUAL_BY_PARTICIPANT_LIVELINESS_QOS, Duration_t(1)), true); + EXPECT_EQ(liveliness_manager.remove_writer(guid, MANUAL_BY_PARTICIPANT_LIVELINESS_QOS, Duration_t(1)), false); + + EXPECT_EQ(liveliness_manager.add_writer(guid, MANUAL_BY_TOPIC_LIVELINESS_QOS, Duration_t(1)), true); + EXPECT_EQ(liveliness_manager.remove_writer(guid, MANUAL_BY_TOPIC_LIVELINESS_QOS, Duration_t(1)), true); + EXPECT_EQ(liveliness_manager.remove_writer(guid, MANUAL_BY_TOPIC_LIVELINESS_QOS, Duration_t(1)), false); +} + +//! Tests that the assert_liveliness() method that takes liveliness kind as argument sets the alive state and time +//! correctly +TEST_F(LivelinessManagerTests, AssertLivelinessByKind) +{ + LivelinessManager liveliness_manager( + nullptr, + service_, + *thread_); + + GuidPrefix_t guidP; + guidP.value[0] = 1; + + liveliness_manager.add_writer(GUID_t(guidP, 1), AUTOMATIC_LIVELINESS_QOS, Duration_t(10)); + liveliness_manager.add_writer(GUID_t(guidP, 2), AUTOMATIC_LIVELINESS_QOS, Duration_t(10)); + liveliness_manager.add_writer(GUID_t(guidP, 3), MANUAL_BY_PARTICIPANT_LIVELINESS_QOS, Duration_t(10)); + liveliness_manager.add_writer(GUID_t(guidP, 4), MANUAL_BY_PARTICIPANT_LIVELINESS_QOS, Duration_t(10)); + liveliness_manager.add_writer(GUID_t(guidP, 5), MANUAL_BY_TOPIC_LIVELINESS_QOS, Duration_t(10)); + liveliness_manager.add_writer(GUID_t(guidP, 6), MANUAL_BY_TOPIC_LIVELINESS_QOS, Duration_t(10)); + + // Assert liveliness of automatic writers (the rest should be unchanged) + EXPECT_TRUE(liveliness_manager.assert_liveliness(AUTOMATIC_LIVELINESS_QOS)); + auto liveliness_data = liveliness_manager.get_liveliness_data(); + EXPECT_EQ(liveliness_data[0].status, LivelinessData::WriterStatus::ALIVE); + EXPECT_EQ(liveliness_data[1].status, LivelinessData::WriterStatus::ALIVE); + EXPECT_EQ(liveliness_data[2].status, LivelinessData::WriterStatus::NOT_ASSERTED); + EXPECT_EQ(liveliness_data[3].status, LivelinessData::WriterStatus::NOT_ASSERTED); + EXPECT_EQ(liveliness_data[4].status, LivelinessData::WriterStatus::NOT_ASSERTED); + EXPECT_EQ(liveliness_data[5].status, LivelinessData::WriterStatus::NOT_ASSERTED); + + // Assert liveliness of manual by participant writers + EXPECT_TRUE(liveliness_manager.assert_liveliness(MANUAL_BY_PARTICIPANT_LIVELINESS_QOS)); + liveliness_data = liveliness_manager.get_liveliness_data(); + EXPECT_EQ(liveliness_data[0].status, LivelinessData::WriterStatus::ALIVE); + EXPECT_EQ(liveliness_data[1].status, LivelinessData::WriterStatus::ALIVE); + EXPECT_EQ(liveliness_data[2].status, LivelinessData::WriterStatus::ALIVE); + EXPECT_EQ(liveliness_data[3].status, LivelinessData::WriterStatus::ALIVE); + EXPECT_EQ(liveliness_data[4].status, LivelinessData::WriterStatus::NOT_ASSERTED); + EXPECT_EQ(liveliness_data[5].status, LivelinessData::WriterStatus::NOT_ASSERTED); + + // Assert liveliness of manual by topic writers + EXPECT_TRUE(liveliness_manager.assert_liveliness(MANUAL_BY_TOPIC_LIVELINESS_QOS)); + liveliness_data = liveliness_manager.get_liveliness_data(); + EXPECT_EQ(liveliness_data[0].status, LivelinessData::WriterStatus::ALIVE); + EXPECT_EQ(liveliness_data[1].status, LivelinessData::WriterStatus::ALIVE); + EXPECT_EQ(liveliness_data[2].status, LivelinessData::WriterStatus::ALIVE); + EXPECT_EQ(liveliness_data[3].status, LivelinessData::WriterStatus::ALIVE); + EXPECT_EQ(liveliness_data[4].status, LivelinessData::WriterStatus::ALIVE); + EXPECT_EQ(liveliness_data[5].status, LivelinessData::WriterStatus::ALIVE); + + // Finally check that times were also updated + EXPECT_GT(liveliness_data[0].time, std::chrono::steady_clock::now()); + EXPECT_GT(liveliness_data[1].time, std::chrono::steady_clock::now()); + EXPECT_GT(liveliness_data[2].time, std::chrono::steady_clock::now()); + EXPECT_GT(liveliness_data[3].time, std::chrono::steady_clock::now()); + EXPECT_GT(liveliness_data[4].time, std::chrono::steady_clock::now()); + EXPECT_GT(liveliness_data[5].time, std::chrono::steady_clock::now()); +} + +//! Tests that the assert_liveliness() method that takes a writer as an argument sets the alive state and time correctly +TEST_F(LivelinessManagerTests, AssertLivelinessByWriter) +{ + LivelinessManager liveliness_manager( + nullptr, + service_, + *thread_); + + GuidPrefix_t guidP; + guidP.value[0] = 1; + + liveliness_manager.add_writer(GUID_t(guidP, 1), AUTOMATIC_LIVELINESS_QOS, Duration_t(1)); + liveliness_manager.add_writer(GUID_t(guidP, 2), AUTOMATIC_LIVELINESS_QOS, Duration_t(1)); + liveliness_manager.add_writer(GUID_t(guidP, 3), MANUAL_BY_PARTICIPANT_LIVELINESS_QOS, Duration_t(1)); + liveliness_manager.add_writer(GUID_t(guidP, 4), MANUAL_BY_PARTICIPANT_LIVELINESS_QOS, Duration_t(1)); + liveliness_manager.add_writer(GUID_t(guidP, 5), MANUAL_BY_TOPIC_LIVELINESS_QOS, Duration_t(1)); + liveliness_manager.add_writer(GUID_t(guidP, 6), MANUAL_BY_TOPIC_LIVELINESS_QOS, Duration_t(1)); + + // If a manual by topic writer is asserted the other writers are unchanged + EXPECT_TRUE(liveliness_manager.assert_liveliness( + GUID_t(guidP, 6), + MANUAL_BY_TOPIC_LIVELINESS_QOS, + Duration_t(1))); + auto liveliness_data = liveliness_manager.get_liveliness_data(); + EXPECT_EQ(liveliness_data[0].status, LivelinessData::WriterStatus::NOT_ASSERTED); + EXPECT_EQ(liveliness_data[1].status, LivelinessData::WriterStatus::NOT_ASSERTED); + EXPECT_EQ(liveliness_data[2].status, LivelinessData::WriterStatus::NOT_ASSERTED); + EXPECT_EQ(liveliness_data[3].status, LivelinessData::WriterStatus::NOT_ASSERTED); + EXPECT_EQ(liveliness_data[4].status, LivelinessData::WriterStatus::NOT_ASSERTED); + EXPECT_EQ(liveliness_data[5].status, LivelinessData::WriterStatus::ALIVE); + + EXPECT_TRUE(liveliness_manager.assert_liveliness( + GUID_t(guidP, 5), + MANUAL_BY_TOPIC_LIVELINESS_QOS, + Duration_t(1))); + liveliness_data = liveliness_manager.get_liveliness_data(); + EXPECT_EQ(liveliness_data[0].status, LivelinessData::WriterStatus::NOT_ASSERTED); + EXPECT_EQ(liveliness_data[1].status, LivelinessData::WriterStatus::NOT_ASSERTED); + EXPECT_EQ(liveliness_data[2].status, LivelinessData::WriterStatus::NOT_ASSERTED); + EXPECT_EQ(liveliness_data[3].status, LivelinessData::WriterStatus::NOT_ASSERTED); + EXPECT_EQ(liveliness_data[4].status, LivelinessData::WriterStatus::ALIVE); + EXPECT_EQ(liveliness_data[5].status, LivelinessData::WriterStatus::ALIVE); + + // If an automatic writer is asserted all automatic writers are asserted as well + EXPECT_TRUE(liveliness_manager.assert_liveliness( + GUID_t(guidP, 1), + AUTOMATIC_LIVELINESS_QOS, + Duration_t(1))); + liveliness_data = liveliness_manager.get_liveliness_data(); + EXPECT_EQ(liveliness_data[0].status, LivelinessData::WriterStatus::ALIVE); + EXPECT_EQ(liveliness_data[1].status, LivelinessData::WriterStatus::ALIVE); + EXPECT_EQ(liveliness_data[2].status, LivelinessData::WriterStatus::NOT_ASSERTED); + EXPECT_EQ(liveliness_data[3].status, LivelinessData::WriterStatus::NOT_ASSERTED); + EXPECT_EQ(liveliness_data[4].status, LivelinessData::WriterStatus::ALIVE); + EXPECT_EQ(liveliness_data[5].status, LivelinessData::WriterStatus::ALIVE); + + // If a manual by participant writer is asserted all manual by participant writers are asserted as well + EXPECT_TRUE(liveliness_manager.assert_liveliness( + GUID_t(guidP, 4), + MANUAL_BY_PARTICIPANT_LIVELINESS_QOS, + Duration_t(1))); + liveliness_data = liveliness_manager.get_liveliness_data(); + EXPECT_EQ(liveliness_data[0].status, LivelinessData::WriterStatus::ALIVE); + EXPECT_EQ(liveliness_data[1].status, LivelinessData::WriterStatus::ALIVE); + EXPECT_EQ(liveliness_data[2].status, LivelinessData::WriterStatus::ALIVE); + EXPECT_EQ(liveliness_data[3].status, LivelinessData::WriterStatus::ALIVE); + EXPECT_EQ(liveliness_data[4].status, LivelinessData::WriterStatus::ALIVE); + EXPECT_EQ(liveliness_data[5].status, LivelinessData::WriterStatus::ALIVE); + + // Finally check that times were also updated + EXPECT_GT(liveliness_data[0].time, std::chrono::steady_clock::now()); + EXPECT_GT(liveliness_data[1].time, std::chrono::steady_clock::now()); + EXPECT_GT(liveliness_data[2].time, std::chrono::steady_clock::now()); + EXPECT_GT(liveliness_data[3].time, std::chrono::steady_clock::now()); + EXPECT_GT(liveliness_data[4].time, std::chrono::steady_clock::now()); + EXPECT_GT(liveliness_data[5].time, std::chrono::steady_clock::now());} + +//! Tests the case when the timer expires and liveliness manager is managing two automatic writers with different +//! lease durations +TEST_F(LivelinessManagerTests, TimerExpired_Automatic) +{ + LivelinessManager liveliness_manager( + std::bind(&LivelinessManagerTests::liveliness_changed, + this, + std::placeholders::_1, + std::placeholders::_2, + std::placeholders::_3, + std::placeholders::_4, + std::placeholders::_5), + service_, + *thread_); + + GuidPrefix_t guidP; + guidP.value[0] = 1; + + liveliness_manager.add_writer(GUID_t(guidP, 1), AUTOMATIC_LIVELINESS_QOS, Duration_t(0.1)); + liveliness_manager.add_writer(GUID_t(guidP, 2), AUTOMATIC_LIVELINESS_QOS, Duration_t(0.5)); + + // Assert liveliness + liveliness_manager.assert_liveliness(GUID_t(guidP, 2), AUTOMATIC_LIVELINESS_QOS, Duration_t(0.5)); + num_writers_recovered = 0u; + + // Wait so that first writer loses liveliness + wait_liveliness_lost(1u); + EXPECT_EQ(writer_losing_liveliness, GUID_t(guidP, 1)); + + // Wait a bit longer so that second writer loses liveliness + wait_liveliness_lost(2u); + EXPECT_EQ(writer_losing_liveliness, GUID_t(guidP, 2)); + + // Assert first writer + liveliness_manager.assert_liveliness(GUID_t(guidP, 1), AUTOMATIC_LIVELINESS_QOS, Duration_t(0.1)); + wait_liveliness_recovered(2u); + EXPECT_EQ(num_writers_recovered, 2u); +} + +//! Tests the case when the timer expires and liveliness manager is managing two manual by participant writers +//! with different lease durations +TEST_F(LivelinessManagerTests, TimerExpired_ManualByParticipant) +{ + LivelinessManager liveliness_manager( + std::bind(&LivelinessManagerTests::liveliness_changed, + this, + std::placeholders::_1, + std::placeholders::_2, + std::placeholders::_3, + std::placeholders::_4, + std::placeholders::_5), + service_, + *thread_); + + + GuidPrefix_t guidP; + guidP.value[0] = 1; + + liveliness_manager.add_writer(GUID_t(guidP, 1), MANUAL_BY_PARTICIPANT_LIVELINESS_QOS, Duration_t(0.1)); + liveliness_manager.add_writer(GUID_t(guidP, 2), MANUAL_BY_PARTICIPANT_LIVELINESS_QOS, Duration_t(0.5)); + + // Assert liveliness + liveliness_manager.assert_liveliness(GUID_t(guidP, 2), MANUAL_BY_PARTICIPANT_LIVELINESS_QOS, Duration_t(0.5)); + num_writers_recovered = 0u; + + // Wait so that first writer loses liveliness + wait_liveliness_lost(1u); + EXPECT_EQ(writer_losing_liveliness, GUID_t(guidP, 1)); + EXPECT_EQ(num_writers_lost, 1u); + + // Wait a bit longer so that second writer loses liveliness + wait_liveliness_lost(2u); + EXPECT_EQ(writer_losing_liveliness, GUID_t(guidP, 2)); + EXPECT_EQ(num_writers_lost, 2u); + + // Assert first writer + liveliness_manager.assert_liveliness(GUID_t(guidP, 1), MANUAL_BY_PARTICIPANT_LIVELINESS_QOS, Duration_t(0.1)); + wait_liveliness_recovered(2u); + EXPECT_EQ(num_writers_recovered, 2u); +} + +//! Tests the case when the timer expires and liveliness manager is managing two manual by topic writers +//! with different lease durations +TEST_F(LivelinessManagerTests, TimerExpired_ManualByTopic) +{ + LivelinessManager liveliness_manager( + std::bind(&LivelinessManagerTests::liveliness_changed, + this, + std::placeholders::_1, + std::placeholders::_2, + std::placeholders::_3, + std::placeholders::_4, + std::placeholders::_5), + service_, + *thread_); + + + GuidPrefix_t guidP; + guidP.value[0] = 1; + + liveliness_manager.add_writer(GUID_t(guidP, 1), MANUAL_BY_TOPIC_LIVELINESS_QOS, Duration_t(0.1)); + liveliness_manager.add_writer(GUID_t(guidP, 2), MANUAL_BY_TOPIC_LIVELINESS_QOS, Duration_t(0.2)); + + // Assert first writer + liveliness_manager.assert_liveliness(GUID_t(guidP, 1), MANUAL_BY_TOPIC_LIVELINESS_QOS, Duration_t(0.1)); + wait_liveliness_recovered(1u); + + // Wait so that first writer loses liveliness + wait_liveliness_lost(1u); + EXPECT_EQ(writer_losing_liveliness, GUID_t(guidP, 1)); + EXPECT_EQ(num_writers_lost, 1u); + + // Wait a bit longer and check that the second writer does not recover its liveliness + std::this_thread::sleep_for(std::chrono::milliseconds(200)); + EXPECT_EQ(writer_losing_liveliness, GUID_t(guidP, 1)); + EXPECT_EQ(num_writers_lost, 1u); + + // Assert second writer + liveliness_manager.assert_liveliness(GUID_t(guidP, 2), MANUAL_BY_TOPIC_LIVELINESS_QOS, Duration_t(0.2)); + wait_liveliness_recovered(2u); + num_writers_lost = 0u; + + // Wait so that it loses liveliness + wait_liveliness_lost(1u); + EXPECT_EQ(writer_losing_liveliness, GUID_t(guidP, 2)); + EXPECT_EQ(num_writers_lost, 1u); +} + +//! Tests that the timer owner is calculated correctly +//! This is tested indirectly by checking which writer lost liveliness last +TEST_F(LivelinessManagerTests, TimerOwnerCalculation) +{ + LivelinessManager liveliness_manager( + std::bind(&LivelinessManagerTests::liveliness_changed, + this, + std::placeholders::_1, + std::placeholders::_2, + std::placeholders::_3, + std::placeholders::_4, + std::placeholders::_5), + service_, + *thread_); + + + GuidPrefix_t guidP; + guidP.value[0] = 1; + + liveliness_manager.add_writer(GUID_t(guidP, 1), AUTOMATIC_LIVELINESS_QOS, Duration_t(100 * 1e-3)); + liveliness_manager.add_writer(GUID_t(guidP, 2), AUTOMATIC_LIVELINESS_QOS, Duration_t(1000 * 1e-3)); + liveliness_manager.add_writer(GUID_t(guidP, 3), AUTOMATIC_LIVELINESS_QOS, Duration_t(500 * 1e-3)); + + liveliness_manager.assert_liveliness(AUTOMATIC_LIVELINESS_QOS); + + wait_liveliness_lost(1u); + EXPECT_EQ(writer_losing_liveliness, GUID_t(guidP, 1)); + EXPECT_EQ(num_writers_lost, 1u); + + wait_liveliness_lost(2u); + EXPECT_EQ(writer_losing_liveliness, GUID_t(guidP, 3)); + EXPECT_EQ(num_writers_lost, 2u); + + wait_liveliness_lost(3u); + EXPECT_EQ(writer_losing_liveliness, GUID_t(guidP, 2)); + EXPECT_EQ(num_writers_lost, 3u); +} + +//! Tests that the writer that is the current timer owner can be removed, and that the timer is restarted +//! for the next writer +TEST_F(LivelinessManagerTests, TimerOwnerRemoved) +{ + LivelinessManager liveliness_manager( + std::bind(&LivelinessManagerTests::liveliness_changed, + this, + std::placeholders::_1, + std::placeholders::_2, + std::placeholders::_3, + std::placeholders::_4, + std::placeholders::_5), + service_, + *thread_); + + + GuidPrefix_t guidP; + guidP.value[0] = 1; + + liveliness_manager.add_writer(GUID_t(guidP, 1), AUTOMATIC_LIVELINESS_QOS, Duration_t(0.5)); + liveliness_manager.add_writer(GUID_t(guidP, 2), AUTOMATIC_LIVELINESS_QOS, Duration_t(1)); + + liveliness_manager.assert_liveliness(GUID_t(guidP, 1), AUTOMATIC_LIVELINESS_QOS, Duration_t(0.5)); + liveliness_manager.remove_writer(GUID_t(guidP, 1), AUTOMATIC_LIVELINESS_QOS, Duration_t(0.5)); + + wait_liveliness_lost(1u); + EXPECT_EQ(writer_losing_liveliness, GUID_t(guidP, 2)); + EXPECT_EQ(num_writers_lost, 1u); +} + +} +} + +int main(int argc, char **argv) +{ + testing::InitGoogleMock(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/test/unittest/transport/UDPv4Tests.cpp b/test/unittest/transport/UDPv4Tests.cpp index 6d1b42965f8..d9c91a7200e 100644 --- a/test/unittest/transport/UDPv4Tests.cpp +++ b/test/unittest/transport/UDPv4Tests.cpp @@ -332,7 +332,6 @@ TEST_F(UDPv4Tests, send_to_allowed_interface) if (IsAddressDefined(locator)) { - descriptor.interfaceWhiteList.emplace_back("127.0.0.1"); descriptor.interfaceWhiteList.emplace_back(IPLocator::toIPv4string(locator)); UDPv4Transport transportUnderTest(descriptor); transportUnderTest.init(); @@ -351,7 +350,6 @@ TEST_F(UDPv4Tests, send_to_allowed_interface) IPLocator::setIPv4(remoteMulticastLocator, 239, 255, 1, 4); // Loopback // Sending through a ALLOWED IP will work - IPLocator::setIPv4(outputChannelLocator, 127, 0, 0, 1); std::vector message = { 'H','e','l','l','o' }; ASSERT_TRUE(send_resource_list.at(0)->send(message.data(), (uint32_t)message.size(), remoteMulticastLocator)); @@ -521,6 +519,35 @@ TEST_F(UDPv4Tests, send_and_receive_between_allowed_sockets_using_unicast_to_mul senderThread->join(); sem.wait(); } + +TEST_F(UDPv4Tests, open_and_close_two_multicast_transports_with_whitelist) +{ + std::vector interfaces; + GetIP4s(interfaces); + + if (interfaces.size() > 0) + { + descriptor.interfaceWhiteList.push_back(interfaces.at(0).name); + + UDPv4Transport transport1(descriptor); + UDPv4Transport transport2(descriptor); + transport1.init(); + transport2.init(); + + Locator_t multicastLocator; + multicastLocator.port = g_default_port; + multicastLocator.kind = LOCATOR_KIND_UDPv4; + IPLocator::setIPv4(multicastLocator, "239.255.1.4"); + + std::cout << "Opening input channels" << std::endl; + ASSERT_TRUE(transport1.OpenInputChannel(multicastLocator, nullptr, 65500)); + ASSERT_TRUE(transport2.OpenInputChannel(multicastLocator, nullptr, 65500)); + std::cout << "Closing input channel on transport 1" << std::endl; + ASSERT_TRUE(transport1.CloseInputChannel(multicastLocator)); + std::cout << "Closing input channel on transport 2" << std::endl; + ASSERT_TRUE(transport2.CloseInputChannel(multicastLocator)); + } +} #endif TEST_F(UDPv4Tests, open_a_blocked_socket) diff --git a/test/unittest/xmlparser/XMLParserTests.cpp b/test/unittest/xmlparser/XMLParserTests.cpp index 07e993afdf3..7e51746f83c 100644 --- a/test/unittest/xmlparser/XMLParserTests.cpp +++ b/test/unittest/xmlparser/XMLParserTests.cpp @@ -166,6 +166,14 @@ TEST_F(XMLParserTests, NoFIle) ASSERT_EQ(XMLParser::loadXML("missing_file.xml", root), XMLP_ret::XML_ERROR); } +TEST_F(XMLParserTests, EmptyDefaultFile) +{ + std::ifstream inFile; + inFile.open("DEFAULT_FASTRTPS_PROFILES.xml"); + std::unique_ptr root; + ASSERT_EQ(XMLParser::loadDefaultXMLFile(root), XMLP_ret::XML_ERROR); +} + TEST_F(XMLParserTests, EmptyString) { std::ifstream inFile; diff --git a/thirdparty/fastcdr b/thirdparty/fastcdr index 4f61be9eb9d..649b9a0e763 160000 --- a/thirdparty/fastcdr +++ b/thirdparty/fastcdr @@ -1 +1 @@ -Subproject commit 4f61be9eb9df2e1102f6d8518097569695b60a97 +Subproject commit 649b9a0e763f8a4cfdd41238b1495c58b7ea6660 diff --git a/thirdparty/idl b/thirdparty/idl index b94c00bcb1d..9204f1f552c 160000 --- a/thirdparty/idl +++ b/thirdparty/idl @@ -1 +1 @@ -Subproject commit b94c00bcb1d83db0ac7cd069aba593dbe5906358 +Subproject commit 9204f1f552c259df7f82311514aee93a0d07528d