diff --git a/fastdds_python/src/swig/fastdds/dds/domain/DomainParticipantFactory.i b/fastdds_python/src/swig/fastdds/dds/domain/DomainParticipantFactory.i index 950579bc..a4d10f4d 100644 --- a/fastdds_python/src/swig/fastdds/dds/domain/DomainParticipantFactory.i +++ b/fastdds_python/src/swig/fastdds/dds/domain/DomainParticipantFactory.i @@ -16,124 +16,22 @@ #include "fastdds/dds/domain/DomainParticipantFactory.hpp" %} -%extend eprosima::fastdds::dds::DomainParticipantFactory -{ - /** - * Create a Participant. - * - * @param domain_id Domain Id. - * @param qos DomainParticipantQos Reference. - * @param listener DomainParticipantListener Pointer (default: nullptr) - * @param mask StatusMask Reference (default: all) - * @return DomainParticipant pointer. (nullptr if not created.) - */ - DomainParticipant* create_participant( - DomainId_t domain_id, - const DomainParticipantQos& qos, - DomainParticipantListener* listener = nullptr, - const StatusMask& mask = eprosima::fastdds::dds::StatusMask::all()) - { - if (nullptr != listener) - { - Swig::Director* director = SWIG_DIRECTOR_CAST(listener); - - if (nullptr != director) - { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - Py_INCREF(director->swig_get_self()); - SWIG_PYTHON_THREAD_END_BLOCK; - } - } - - return self->create_participant(domain_id, qos, listener, mask); - } - - /** - * Create a Participant. - * - * @param extended_qos DomainParticipantExtendedQos Reference. - * @param listener DomainParticipantListener Pointer (default: nullptr) - * @param mask StatusMask Reference (default: all) - * @return DomainParticipant pointer. (nullptr if not created.) - */ - DomainParticipant* create_participant( - const DomainParticipantExtendedQos& extended_qos, - DomainParticipantListener* listener = nullptr, - const StatusMask& mask = eprosima::fastdds::dds::StatusMask::all()) - { - if (nullptr != listener) - { - Swig::Director* director = SWIG_DIRECTOR_CAST(listener); - - if (nullptr != director) - { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - Py_INCREF(director->swig_get_self()); - SWIG_PYTHON_THREAD_END_BLOCK; - } - } - - return self->create_participant(extended_qos.domainId(), extended_qos, listener, mask); - } - - /** - * Create a Participant. - * - * @param domain_id Domain Id. - * @param profile_name Participant profile name. - * @param listener DomainParticipantListener Pointer (default: nullptr) - * @param mask StatusMask Reference (default: all) - * @return DomainParticipant pointer. (nullptr if not created.) - */ - DomainParticipant* create_participant_with_profile( - DomainId_t domain_id, - const std::string& profile_name, - DomainParticipantListener* listener = nullptr, - const StatusMask& mask = eprosima::fastdds::dds::StatusMask::all()) +%typemap(in) (eprosima::fastdds::dds::DomainParticipantListener* listener) %{ + $typemap(in, eprosima::fastdds::dds::DomainParticipantListener* DISOWN) { - if (nullptr != listener) - { - Swig::Director* director = SWIG_DIRECTOR_CAST(listener); + Swig::Director* director = SWIG_DIRECTOR_CAST($1); - if (nullptr != director) - { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - Py_INCREF(director->swig_get_self()); - SWIG_PYTHON_THREAD_END_BLOCK; - } - } - - return self->create_participant_with_profile(domain_id, profile_name, listener, mask); - } - - /** - * Create a Participant. - * - * @param profile_name Participant profile name. - * @param listener DomainParticipantListener Pointer (default: nullptr) - * @param mask StatusMask Reference (default: all) - * @return DomainParticipant pointer. (nullptr if not created.) - */ - DomainParticipant* create_participant_with_profile( - const std::string& profile_name, - DomainParticipantListener* listener = nullptr, - const StatusMask& mask = eprosima::fastdds::dds::StatusMask::all()) - { - if (nullptr != listener) + if (nullptr != director) { - Swig::Director* director = SWIG_DIRECTOR_CAST(listener); - - if (nullptr != director) - { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - Py_INCREF(director->swig_get_self()); - SWIG_PYTHON_THREAD_END_BLOCK; - } + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + director->swig_incref(); + SWIG_PYTHON_THREAD_END_BLOCK; } - - return self->create_participant_with_profile(profile_name, listener, mask); } + %} +%extend eprosima::fastdds::dds::DomainParticipantFactory +{ /** * Remove a Participant and all associated publishers and subscribers. * @@ -164,8 +62,6 @@ } } -%ignore eprosima::fastdds::dds::DomainParticipantFactory::create_participant; -%ignore eprosima::fastdds::dds::DomainParticipantFactory::create_participant_with_profile; %ignore eprosima::fastdds::dds::DomainParticipantFactory::delete_participant; %ignore eprosima::fastdds::dds::DomainParticipantFactory::get_dynamic_type_builder_from_xml_by_name; diff --git a/fastdds_python/test/api/test_datareader.py b/fastdds_python/test/api/test_datareader.py index da3faef5..c63fb204 100644 --- a/fastdds_python/test/api/test_datareader.py +++ b/fastdds_python/test/api/test_datareader.py @@ -743,67 +743,33 @@ def test_get_set_listener(datareader): assert(fastdds.StatusMask.all() == datareader.get_status_mask()) - def test(status_mask_1, status_mask_2): + def test(status_mask): """ - Test the entity creation using the two types of StatusMasks. + Test the entity creation using the type of StatusMask. """ listener = DataReaderListener() assert(listener is not None) assert(fastdds.RETCODE_OK == - datareader.set_listener(listener, status_mask_1)) + datareader.set_listener(listener, status_mask)) assert(datareader.get_listener() == listener) - assert(status_mask_1 == datareader.get_status_mask()) - listener = DataReaderListener() - assert(listener is not None) - assert(fastdds.RETCODE_OK == - datareader.set_listener(listener, status_mask_2)) - assert(datareader.get_listener() == listener) - assert(status_mask_2 == datareader.get_status_mask()) + assert(status_mask == datareader.get_status_mask()) # Overload 2: Different status masks - test(fastdds.StatusMask.all(), fastdds.StatusMask_all()) - test(fastdds.StatusMask.all(), fastdds.StatusMask_all()) - test(fastdds.StatusMask.none(), fastdds.StatusMask_none()) - test(fastdds.StatusMask.data_available(), - fastdds.StatusMask_data_available()) - test(fastdds.StatusMask.data_on_readers(), - fastdds.StatusMask_data_on_readers()) - test(fastdds.StatusMask.inconsistent_topic(), - fastdds.StatusMask_inconsistent_topic()) - test(fastdds.StatusMask.liveliness_changed(), - fastdds.StatusMask_liveliness_changed()) - test(fastdds.StatusMask.liveliness_lost(), - fastdds.StatusMask_liveliness_lost()) - test(fastdds.StatusMask.offered_deadline_missed(), - fastdds.StatusMask_offered_deadline_missed()) - test(fastdds.StatusMask.offered_incompatible_qos(), - fastdds.StatusMask_offered_incompatible_qos()) - test(fastdds.StatusMask.publication_matched(), - fastdds.StatusMask_publication_matched()) - test(fastdds.StatusMask.requested_deadline_missed(), - fastdds.StatusMask_requested_deadline_missed()) - test(fastdds.StatusMask.requested_incompatible_qos(), - fastdds.StatusMask_requested_incompatible_qos()) - test(fastdds.StatusMask.sample_lost(), - fastdds.StatusMask_sample_lost()) - test(fastdds.StatusMask.sample_rejected(), - fastdds.StatusMask_sample_rejected()) - test(fastdds.StatusMask.subscription_matched(), - fastdds.StatusMask_subscription_matched()) - - m = fastdds.StatusMask_data_available() << \ - fastdds.StatusMask_data_on_readers() << \ - fastdds.StatusMask_inconsistent_topic() << \ - fastdds.StatusMask_liveliness_changed() << \ - fastdds.StatusMask_liveliness_lost() << \ - fastdds.StatusMask_offered_deadline_missed() << \ - fastdds.StatusMask_offered_incompatible_qos() << \ - fastdds.StatusMask_publication_matched() << \ - fastdds.StatusMask_requested_deadline_missed() << \ - fastdds.StatusMask_requested_incompatible_qos() << \ - fastdds.StatusMask_sample_lost() << \ - fastdds.StatusMask_sample_rejected() << \ - fastdds.StatusMask_subscription_matched() + test(fastdds.StatusMask.all()) + test(fastdds.StatusMask.none()) + test(fastdds.StatusMask.data_available()) + test(fastdds.StatusMask.data_on_readers()) + test(fastdds.StatusMask.inconsistent_topic()) + test(fastdds.StatusMask.liveliness_changed()) + test(fastdds.StatusMask.liveliness_lost()) + test(fastdds.StatusMask.offered_deadline_missed()) + test(fastdds.StatusMask.offered_incompatible_qos()) + test(fastdds.StatusMask.publication_matched()) + test(fastdds.StatusMask.requested_deadline_missed()) + test(fastdds.StatusMask.requested_incompatible_qos()) + test(fastdds.StatusMask.sample_lost()) + test(fastdds.StatusMask.sample_rejected()) + test(fastdds.StatusMask.subscription_matched()) test(fastdds.StatusMask.data_available() << fastdds.StatusMask.data_on_readers() << @@ -817,8 +783,7 @@ def test(status_mask_1, status_mask_2): fastdds.StatusMask.requested_incompatible_qos() << fastdds.StatusMask.sample_lost() << fastdds.StatusMask.sample_rejected() << - fastdds.StatusMask.subscription_matched(), - m) + fastdds.StatusMask.subscription_matched()) def test_get_listening_locators(datareader): diff --git a/fastdds_python/test/api/test_datawriter.py b/fastdds_python/test/api/test_datawriter.py index 73a7e3b8..71c93e7b 100644 --- a/fastdds_python/test/api/test_datawriter.py +++ b/fastdds_python/test/api/test_datawriter.py @@ -253,67 +253,33 @@ def test_get_set_listener(datawriter): assert(datawriter.get_listener() == listener) assert(fastdds.StatusMask.all() == datawriter.get_status_mask()) - def test(status_mask_1, status_mask_2): + def test(status_mask): """ - Test the entity creation using the two types of StatusMasks. + Test the entity creation using the type of StatusMask. """ listener = DataWriterListener() assert(listener is not None) assert(fastdds.RETCODE_OK == - datawriter.set_listener(listener, status_mask_1)) + datawriter.set_listener(listener, status_mask)) assert(datawriter.get_listener() == listener) - assert(status_mask_1 == datawriter.get_status_mask()) - listener = DataWriterListener() - assert(listener is not None) - assert(fastdds.RETCODE_OK == - datawriter.set_listener(listener, status_mask_2)) - assert(datawriter.get_listener() == listener) - assert(status_mask_2 == datawriter.get_status_mask()) + assert(status_mask == datawriter.get_status_mask()) # Overload 2: Different status masks - test(fastdds.StatusMask.all(), fastdds.StatusMask_all()) - test(fastdds.StatusMask.all(), fastdds.StatusMask_all()) - test(fastdds.StatusMask.none(), fastdds.StatusMask_none()) - test(fastdds.StatusMask.data_available(), - fastdds.StatusMask_data_available()) - test(fastdds.StatusMask.data_on_readers(), - fastdds.StatusMask_data_on_readers()) - test(fastdds.StatusMask.inconsistent_topic(), - fastdds.StatusMask_inconsistent_topic()) - test(fastdds.StatusMask.liveliness_changed(), - fastdds.StatusMask_liveliness_changed()) - test(fastdds.StatusMask.liveliness_lost(), - fastdds.StatusMask_liveliness_lost()) - test(fastdds.StatusMask.offered_deadline_missed(), - fastdds.StatusMask_offered_deadline_missed()) - test(fastdds.StatusMask.offered_incompatible_qos(), - fastdds.StatusMask_offered_incompatible_qos()) - test(fastdds.StatusMask.publication_matched(), - fastdds.StatusMask_publication_matched()) - test(fastdds.StatusMask.requested_deadline_missed(), - fastdds.StatusMask_requested_deadline_missed()) - test(fastdds.StatusMask.requested_incompatible_qos(), - fastdds.StatusMask_requested_incompatible_qos()) - test(fastdds.StatusMask.sample_lost(), - fastdds.StatusMask_sample_lost()) - test(fastdds.StatusMask.sample_rejected(), - fastdds.StatusMask_sample_rejected()) - test(fastdds.StatusMask.subscription_matched(), - fastdds.StatusMask_subscription_matched()) - - m = fastdds.StatusMask_data_available() << \ - fastdds.StatusMask_data_on_readers() << \ - fastdds.StatusMask_inconsistent_topic() << \ - fastdds.StatusMask_liveliness_changed() << \ - fastdds.StatusMask_liveliness_lost() << \ - fastdds.StatusMask_offered_deadline_missed() << \ - fastdds.StatusMask_offered_incompatible_qos() << \ - fastdds.StatusMask_publication_matched() << \ - fastdds.StatusMask_requested_deadline_missed() << \ - fastdds.StatusMask_requested_incompatible_qos() << \ - fastdds.StatusMask_sample_lost() << \ - fastdds.StatusMask_sample_rejected() << \ - fastdds.StatusMask_subscription_matched() + test(fastdds.StatusMask.all()) + test(fastdds.StatusMask.none()) + test(fastdds.StatusMask.data_available()) + test(fastdds.StatusMask.data_on_readers()) + test(fastdds.StatusMask.inconsistent_topic()) + test(fastdds.StatusMask.liveliness_changed()) + test(fastdds.StatusMask.liveliness_lost()) + test(fastdds.StatusMask.offered_deadline_missed()) + test(fastdds.StatusMask.offered_incompatible_qos()) + test(fastdds.StatusMask.publication_matched()) + test(fastdds.StatusMask.requested_deadline_missed()) + test(fastdds.StatusMask.requested_incompatible_qos()) + test(fastdds.StatusMask.sample_lost()) + test(fastdds.StatusMask.sample_rejected()) + test(fastdds.StatusMask.subscription_matched()) test(fastdds.StatusMask.data_available() << fastdds.StatusMask.data_on_readers() << @@ -327,8 +293,7 @@ def test(status_mask_1, status_mask_2): fastdds.StatusMask.requested_incompatible_qos() << fastdds.StatusMask.sample_lost() << fastdds.StatusMask.sample_rejected() << - fastdds.StatusMask.subscription_matched(), - m) + fastdds.StatusMask.subscription_matched()) def test_get_liveliness_lost_status(datawriter): diff --git a/fastdds_python/test/api/test_domainparticipant.py b/fastdds_python/test/api/test_domainparticipant.py index 41da4a5a..ef4056a2 100644 --- a/fastdds_python/test/api/test_domainparticipant.py +++ b/fastdds_python/test/api/test_domainparticipant.py @@ -107,69 +107,35 @@ def test_create_publisher(participant): assert(fastdds.RETCODE_OK == participant.delete_publisher(publisher)) - def test(status_mask_1, status_mask_2, listnr=None): + def test(status_mask, listnr=None): """ - Test the entity creation using the two types of StatusMasks. + Test the entity creation using the type of StatusMask. """ publisher = participant.create_publisher( - fastdds.PUBLISHER_QOS_DEFAULT, listnr, status_mask_1) + fastdds.PUBLISHER_QOS_DEFAULT, listnr, status_mask) assert(publisher is not None) assert(publisher.is_enabled()) - assert(status_mask_1 == publisher.get_status_mask()) - assert(fastdds.RETCODE_OK == - participant.delete_publisher(publisher)) - publisher = participant.create_publisher( - fastdds.PUBLISHER_QOS_DEFAULT, listnr, status_mask_2) - assert(publisher is not None) - assert(publisher.is_enabled()) - assert(status_mask_2 == publisher.get_status_mask()) + assert(status_mask == publisher.get_status_mask()) assert(fastdds.RETCODE_OK == participant.delete_publisher(publisher)) # Overload 3: Different status masks - test(fastdds.StatusMask.all(), fastdds.StatusMask_all(), None) - test(fastdds.StatusMask.all(), fastdds.StatusMask_all(), listener) - test(fastdds.StatusMask.none(), fastdds.StatusMask_none(), listener) - test(fastdds.StatusMask.data_available(), - fastdds.StatusMask_data_available(), listener) - test(fastdds.StatusMask.data_on_readers(), - fastdds.StatusMask_data_on_readers(), listener) - test(fastdds.StatusMask.inconsistent_topic(), - fastdds.StatusMask_inconsistent_topic(), listener) - test(fastdds.StatusMask.liveliness_changed(), - fastdds.StatusMask_liveliness_changed(), listener) - test(fastdds.StatusMask.liveliness_lost(), - fastdds.StatusMask_liveliness_lost(), listener) - test(fastdds.StatusMask.offered_deadline_missed(), - fastdds.StatusMask_offered_deadline_missed(), listener) - test(fastdds.StatusMask.offered_incompatible_qos(), - fastdds.StatusMask_offered_incompatible_qos(), listener) - test(fastdds.StatusMask.publication_matched(), - fastdds.StatusMask_publication_matched(), listener) - test(fastdds.StatusMask.requested_deadline_missed(), - fastdds.StatusMask_requested_deadline_missed(), listener) - test(fastdds.StatusMask.requested_incompatible_qos(), - fastdds.StatusMask_requested_incompatible_qos(), listener) - test(fastdds.StatusMask.sample_lost(), - fastdds.StatusMask_sample_lost(), listener) - test(fastdds.StatusMask.sample_rejected(), - fastdds.StatusMask_sample_rejected(), listener) - test(fastdds.StatusMask.subscription_matched(), - fastdds.StatusMask_subscription_matched(), listener) - - m = fastdds.StatusMask_data_available() << \ - fastdds.StatusMask_data_on_readers() << \ - fastdds.StatusMask_inconsistent_topic() << \ - fastdds.StatusMask_liveliness_changed() << \ - fastdds.StatusMask_liveliness_lost() << \ - fastdds.StatusMask_offered_deadline_missed() << \ - fastdds.StatusMask_offered_incompatible_qos() << \ - fastdds.StatusMask_publication_matched() << \ - fastdds.StatusMask_requested_deadline_missed() << \ - fastdds.StatusMask_requested_incompatible_qos() << \ - fastdds.StatusMask_sample_lost() << \ - fastdds.StatusMask_sample_rejected() << \ - fastdds.StatusMask_subscription_matched() + test(fastdds.StatusMask.all(), None) + test(fastdds.StatusMask.all(), listener) + test(fastdds.StatusMask.none(), listener) + test(fastdds.StatusMask.data_available(), listener) + test(fastdds.StatusMask.data_on_readers(), listener) + test(fastdds.StatusMask.inconsistent_topic(), listener) + test(fastdds.StatusMask.liveliness_changed(), listener) + test(fastdds.StatusMask.liveliness_lost(), listener) + test(fastdds.StatusMask.offered_deadline_missed(), listener) + test(fastdds.StatusMask.offered_incompatible_qos(), listener) + test(fastdds.StatusMask.publication_matched(), listener) + test(fastdds.StatusMask.requested_deadline_missed(), listener) + test(fastdds.StatusMask.requested_incompatible_qos(), listener) + test(fastdds.StatusMask.sample_lost(), listener) + test(fastdds.StatusMask.sample_rejected(), listener) + test(fastdds.StatusMask.subscription_matched(), listener) test(fastdds.StatusMask.data_available() << fastdds.StatusMask.data_on_readers() << @@ -184,7 +150,6 @@ def test(status_mask_1, status_mask_2, listnr=None): fastdds.StatusMask.sample_lost() << fastdds.StatusMask.sample_rejected() << fastdds.StatusMask.subscription_matched(), - m, listener) @@ -227,73 +192,37 @@ def test_create_publisher_with_profile(participant): assert(fastdds.RETCODE_OK == participant.delete_publisher(publisher)) - def test(status_mask_1, status_mask_2, listnr=None): + def test(status_mask, listnr=None): """ - Test the entity creation using the two types of StatusMasks. + Test the entity creation using the type of StatusMask. """ publisher = participant.create_publisher_with_profile( - 'test_publisher_profile', listnr, status_mask_1) + 'test_publisher_profile', listnr, status_mask) assert(publisher is not None) assert(publisher.is_enabled()) qos = publisher.get_qos() assert('partition_name_c' == qos.partition()[0]) - assert(status_mask_1 == publisher.get_status_mask()) - assert(fastdds.RETCODE_OK == - participant.delete_publisher(publisher)) - publisher = participant.create_publisher_with_profile( - 'test_publisher_profile', listnr, status_mask_2) - assert(publisher is not None) - assert(publisher.is_enabled()) - qos = publisher.get_qos() - assert('partition_name_c' == qos.partition()[0]) - assert(status_mask_2 == publisher.get_status_mask()) + assert(status_mask == publisher.get_status_mask()) assert(fastdds.RETCODE_OK == participant.delete_publisher(publisher)) # Overload 3: Different status masks - test(fastdds.StatusMask.all(), fastdds.StatusMask_all(), None) - test(fastdds.StatusMask.all(), fastdds.StatusMask_all(), listener) - test(fastdds.StatusMask.none(), fastdds.StatusMask_none(), listener) - test(fastdds.StatusMask.data_available(), - fastdds.StatusMask_data_available(), listener) - test(fastdds.StatusMask.data_on_readers(), - fastdds.StatusMask_data_on_readers(), listener) - test(fastdds.StatusMask.inconsistent_topic(), - fastdds.StatusMask_inconsistent_topic(), listener) - test(fastdds.StatusMask.liveliness_changed(), - fastdds.StatusMask_liveliness_changed(), listener) - test(fastdds.StatusMask.liveliness_lost(), - fastdds.StatusMask_liveliness_lost(), listener) - test(fastdds.StatusMask.offered_deadline_missed(), - fastdds.StatusMask_offered_deadline_missed(), listener) - test(fastdds.StatusMask.offered_incompatible_qos(), - fastdds.StatusMask_offered_incompatible_qos(), listener) - test(fastdds.StatusMask.publication_matched(), - fastdds.StatusMask_publication_matched(), listener) - test(fastdds.StatusMask.requested_deadline_missed(), - fastdds.StatusMask_requested_deadline_missed(), listener) - test(fastdds.StatusMask.requested_incompatible_qos(), - fastdds.StatusMask_requested_incompatible_qos(), listener) - test(fastdds.StatusMask.sample_lost(), - fastdds.StatusMask_sample_lost(), listener) - test(fastdds.StatusMask.sample_rejected(), - fastdds.StatusMask_sample_rejected(), listener) - test(fastdds.StatusMask.subscription_matched(), - fastdds.StatusMask_subscription_matched(), listener) - - m = fastdds.StatusMask_data_available() << \ - fastdds.StatusMask_data_on_readers() << \ - fastdds.StatusMask_inconsistent_topic() << \ - fastdds.StatusMask_liveliness_changed() << \ - fastdds.StatusMask_liveliness_lost() << \ - fastdds.StatusMask_offered_deadline_missed() << \ - fastdds.StatusMask_offered_incompatible_qos() << \ - fastdds.StatusMask_publication_matched() << \ - fastdds.StatusMask_requested_deadline_missed() << \ - fastdds.StatusMask_requested_incompatible_qos() << \ - fastdds.StatusMask_sample_lost() << \ - fastdds.StatusMask_sample_rejected() << \ - fastdds.StatusMask_subscription_matched() + test(fastdds.StatusMask.all(), None) + test(fastdds.StatusMask.all(), listener) + test(fastdds.StatusMask.none(), listener) + test(fastdds.StatusMask.data_available(), listener) + test(fastdds.StatusMask.data_on_readers(), listener) + test(fastdds.StatusMask.inconsistent_topic(), listener) + test(fastdds.StatusMask.liveliness_changed(), listener) + test(fastdds.StatusMask.liveliness_lost(), listener) + test(fastdds.StatusMask.offered_deadline_missed(), listener) + test(fastdds.StatusMask.offered_incompatible_qos(), listener) + test(fastdds.StatusMask.publication_matched(), listener) + test(fastdds.StatusMask.requested_deadline_missed(), listener) + test(fastdds.StatusMask.requested_incompatible_qos(), listener) + test(fastdds.StatusMask.sample_lost(), listener) + test(fastdds.StatusMask.sample_rejected(), listener) + test(fastdds.StatusMask.subscription_matched(), listener) test(fastdds.StatusMask.data_available() << fastdds.StatusMask.data_on_readers() << @@ -308,7 +237,6 @@ def test(status_mask_1, status_mask_2, listnr=None): fastdds.StatusMask.sample_lost() << fastdds.StatusMask.sample_rejected() << fastdds.StatusMask.subscription_matched(), - m, listener) @@ -341,69 +269,35 @@ def test_create_subscriber(participant): assert(fastdds.RETCODE_OK == participant.delete_subscriber(subscriber)) - def test(status_mask_1, status_mask_2, listnr=None): + def test(status_mask, listnr=None): """ - Test the entity creation using the two types of StatusMasks. + Test the entity creation using the type of StatusMask. """ subscriber = participant.create_subscriber( - fastdds.SUBSCRIBER_QOS_DEFAULT, listnr, status_mask_1) + fastdds.SUBSCRIBER_QOS_DEFAULT, listnr, status_mask) assert(subscriber is not None) assert(subscriber.is_enabled()) - assert(status_mask_1 == subscriber.get_status_mask()) - assert(fastdds.RETCODE_OK == - participant.delete_subscriber(subscriber)) - subscriber = participant.create_subscriber( - fastdds.SUBSCRIBER_QOS_DEFAULT, listnr, status_mask_2) - assert(subscriber is not None) - assert(subscriber.is_enabled()) - assert(status_mask_2 == subscriber.get_status_mask()) + assert(status_mask == subscriber.get_status_mask()) assert(fastdds.RETCODE_OK == participant.delete_subscriber(subscriber)) # Overload 3: Different status masks - test(fastdds.StatusMask.all(), fastdds.StatusMask_all(), None) - test(fastdds.StatusMask.all(), fastdds.StatusMask_all(), listener) - test(fastdds.StatusMask.none(), fastdds.StatusMask_none(), listener) - test(fastdds.StatusMask.data_available(), - fastdds.StatusMask_data_available(), listener) - test(fastdds.StatusMask.data_on_readers(), - fastdds.StatusMask_data_on_readers(), listener) - test(fastdds.StatusMask.inconsistent_topic(), - fastdds.StatusMask_inconsistent_topic(), listener) - test(fastdds.StatusMask.liveliness_changed(), - fastdds.StatusMask_liveliness_changed(), listener) - test(fastdds.StatusMask.liveliness_lost(), - fastdds.StatusMask_liveliness_lost(), listener) - test(fastdds.StatusMask.offered_deadline_missed(), - fastdds.StatusMask_offered_deadline_missed(), listener) - test(fastdds.StatusMask.offered_incompatible_qos(), - fastdds.StatusMask_offered_incompatible_qos(), listener) - test(fastdds.StatusMask.publication_matched(), - fastdds.StatusMask_publication_matched(), listener) - test(fastdds.StatusMask.requested_deadline_missed(), - fastdds.StatusMask_requested_deadline_missed(), listener) - test(fastdds.StatusMask.requested_incompatible_qos(), - fastdds.StatusMask_requested_incompatible_qos(), listener) - test(fastdds.StatusMask.sample_lost(), - fastdds.StatusMask_sample_lost(), listener) - test(fastdds.StatusMask.sample_rejected(), - fastdds.StatusMask_sample_rejected(), listener) - test(fastdds.StatusMask.subscription_matched(), - fastdds.StatusMask_subscription_matched(), listener) - - m = fastdds.StatusMask_data_available() << \ - fastdds.StatusMask_data_on_readers() << \ - fastdds.StatusMask_inconsistent_topic() << \ - fastdds.StatusMask_liveliness_changed() << \ - fastdds.StatusMask_liveliness_lost() << \ - fastdds.StatusMask_offered_deadline_missed() << \ - fastdds.StatusMask_offered_incompatible_qos() << \ - fastdds.StatusMask_publication_matched() << \ - fastdds.StatusMask_requested_deadline_missed() << \ - fastdds.StatusMask_requested_incompatible_qos() << \ - fastdds.StatusMask_sample_lost() << \ - fastdds.StatusMask_sample_rejected() << \ - fastdds.StatusMask_subscription_matched() + test(fastdds.StatusMask.all(), None) + test(fastdds.StatusMask.all(), listener) + test(fastdds.StatusMask.none(), listener) + test(fastdds.StatusMask.data_available(), listener) + test(fastdds.StatusMask.data_on_readers(), listener) + test(fastdds.StatusMask.inconsistent_topic(), listener) + test(fastdds.StatusMask.liveliness_changed(), listener) + test(fastdds.StatusMask.liveliness_lost(), listener) + test(fastdds.StatusMask.offered_deadline_missed(), listener) + test(fastdds.StatusMask.offered_incompatible_qos(), listener) + test(fastdds.StatusMask.publication_matched(), listener) + test(fastdds.StatusMask.requested_deadline_missed(), listener) + test(fastdds.StatusMask.requested_incompatible_qos(), listener) + test(fastdds.StatusMask.sample_lost(), listener) + test(fastdds.StatusMask.sample_rejected(), listener) + test(fastdds.StatusMask.subscription_matched(), listener) test(fastdds.StatusMask.data_available() << fastdds.StatusMask.data_on_readers() << @@ -418,7 +312,6 @@ def test(status_mask_1, status_mask_2, listnr=None): fastdds.StatusMask.sample_lost() << fastdds.StatusMask.sample_rejected() << fastdds.StatusMask.subscription_matched(), - m, listener) @@ -461,73 +354,37 @@ def test_create_subscriber_with_profile(participant): assert(fastdds.RETCODE_OK == participant.delete_subscriber(subscriber)) - def test(status_mask_1, status_mask_2, listnr=None): + def test(status_mask, listnr=None): """ - Test the entity creation using the two types of StatusMasks. + Test the entity creation using the type of StatusMask. """ subscriber = participant.create_subscriber_with_profile( - 'test_subscriber_profile', listnr, status_mask_1) + 'test_subscriber_profile', listnr, status_mask) assert(subscriber is not None) assert(subscriber.is_enabled()) qos = subscriber.get_qos() assert('partition_name_b' == qos.partition()[0]) - assert(status_mask_1 == subscriber.get_status_mask()) - assert(fastdds.RETCODE_OK == - participant.delete_subscriber(subscriber)) - subscriber = participant.create_subscriber_with_profile( - 'test_subscriber_profile', listnr, status_mask_2) - assert(subscriber is not None) - assert(subscriber.is_enabled()) - qos = subscriber.get_qos() - assert('partition_name_b' == qos.partition()[0]) - assert(status_mask_2 == subscriber.get_status_mask()) + assert(status_mask == subscriber.get_status_mask()) assert(fastdds.RETCODE_OK == participant.delete_subscriber(subscriber)) # Overload 3: Different status masks - test(fastdds.StatusMask.all(), fastdds.StatusMask_all(), None) - test(fastdds.StatusMask.all(), fastdds.StatusMask_all(), listener) - test(fastdds.StatusMask.none(), fastdds.StatusMask_none(), listener) - test(fastdds.StatusMask.data_available(), - fastdds.StatusMask_data_available(), listener) - test(fastdds.StatusMask.data_on_readers(), - fastdds.StatusMask_data_on_readers(), listener) - test(fastdds.StatusMask.inconsistent_topic(), - fastdds.StatusMask_inconsistent_topic(), listener) - test(fastdds.StatusMask.liveliness_changed(), - fastdds.StatusMask_liveliness_changed(), listener) - test(fastdds.StatusMask.liveliness_lost(), - fastdds.StatusMask_liveliness_lost(), listener) - test(fastdds.StatusMask.offered_deadline_missed(), - fastdds.StatusMask_offered_deadline_missed(), listener) - test(fastdds.StatusMask.offered_incompatible_qos(), - fastdds.StatusMask_offered_incompatible_qos(), listener) - test(fastdds.StatusMask.publication_matched(), - fastdds.StatusMask_publication_matched(), listener) - test(fastdds.StatusMask.requested_deadline_missed(), - fastdds.StatusMask_requested_deadline_missed(), listener) - test(fastdds.StatusMask.requested_incompatible_qos(), - fastdds.StatusMask_requested_incompatible_qos(), listener) - test(fastdds.StatusMask.sample_lost(), - fastdds.StatusMask_sample_lost(), listener) - test(fastdds.StatusMask.sample_rejected(), - fastdds.StatusMask_sample_rejected(), listener) - test(fastdds.StatusMask.subscription_matched(), - fastdds.StatusMask_subscription_matched(), listener) - - m = fastdds.StatusMask_data_available() << \ - fastdds.StatusMask_data_on_readers() << \ - fastdds.StatusMask_inconsistent_topic() << \ - fastdds.StatusMask_liveliness_changed() << \ - fastdds.StatusMask_liveliness_lost() << \ - fastdds.StatusMask_offered_deadline_missed() << \ - fastdds.StatusMask_offered_incompatible_qos() << \ - fastdds.StatusMask_publication_matched() << \ - fastdds.StatusMask_requested_deadline_missed() << \ - fastdds.StatusMask_requested_incompatible_qos() << \ - fastdds.StatusMask_sample_lost() << \ - fastdds.StatusMask_sample_rejected() << \ - fastdds.StatusMask_subscription_matched() + test(fastdds.StatusMask.all(), None) + test(fastdds.StatusMask.all(), listener) + test(fastdds.StatusMask.none(), listener) + test(fastdds.StatusMask.data_available(), listener) + test(fastdds.StatusMask.data_on_readers(), listener) + test(fastdds.StatusMask.inconsistent_topic(), listener) + test(fastdds.StatusMask.liveliness_changed(), listener) + test(fastdds.StatusMask.liveliness_lost(), listener) + test(fastdds.StatusMask.offered_deadline_missed(), listener) + test(fastdds.StatusMask.offered_incompatible_qos(), listener) + test(fastdds.StatusMask.publication_matched(), listener) + test(fastdds.StatusMask.requested_deadline_missed(), listener) + test(fastdds.StatusMask.requested_incompatible_qos(), listener) + test(fastdds.StatusMask.sample_lost(), listener) + test(fastdds.StatusMask.sample_rejected(), listener) + test(fastdds.StatusMask.subscription_matched(), listener) test(fastdds.StatusMask.data_available() << fastdds.StatusMask.data_on_readers() << @@ -542,7 +399,6 @@ def test(status_mask_1, status_mask_2, listnr=None): fastdds.StatusMask.sample_lost() << fastdds.StatusMask.sample_rejected() << fastdds.StatusMask.subscription_matched(), - m, listener) @@ -589,71 +445,36 @@ def test_create_and_delete_topic(participant): assert(fastdds.RETCODE_OK == participant.delete_topic(topic)) - def test(status_mask_1, status_mask_2, listnr=None): + def test(status_mask, listnr=None): """ - Test the entity creation using the two types of StatusMasks. + Test the entity creation using the type of StatusMask. """ topic = participant.create_topic( "Complete", test_type.get_type_name(), - fastdds.TOPIC_QOS_DEFAULT, listnr, status_mask_1) - assert(topic is not None) - assert(topic.is_enabled()) - assert(status_mask_1 == topic.get_status_mask()) - assert(fastdds.RETCODE_OK == - participant.delete_topic(topic)) - topic = participant.create_topic( - "Complete", test_type.get_type_name(), - fastdds.TOPIC_QOS_DEFAULT, listnr, status_mask_2) + fastdds.TOPIC_QOS_DEFAULT, listnr, status_mask) assert(topic is not None) assert(topic.is_enabled()) - assert(status_mask_2 == topic.get_status_mask()) + assert(status_mask == topic.get_status_mask()) assert(fastdds.RETCODE_OK == participant.delete_topic(topic)) # Overload 3: Different status masks - test(fastdds.StatusMask.all(), fastdds.StatusMask_all(), None) - test(fastdds.StatusMask.all(), fastdds.StatusMask_all(), listener) - test(fastdds.StatusMask.none(), fastdds.StatusMask_none(), listener) - test(fastdds.StatusMask.data_available(), - fastdds.StatusMask_data_available(), listener) - test(fastdds.StatusMask.data_on_readers(), - fastdds.StatusMask_data_on_readers(), listener) - test(fastdds.StatusMask.inconsistent_topic(), - fastdds.StatusMask_inconsistent_topic(), listener) - test(fastdds.StatusMask.liveliness_changed(), - fastdds.StatusMask_liveliness_changed(), listener) - test(fastdds.StatusMask.liveliness_lost(), - fastdds.StatusMask_liveliness_lost(), listener) - test(fastdds.StatusMask.offered_deadline_missed(), - fastdds.StatusMask_offered_deadline_missed(), listener) - test(fastdds.StatusMask.offered_incompatible_qos(), - fastdds.StatusMask_offered_incompatible_qos(), listener) - test(fastdds.StatusMask.publication_matched(), - fastdds.StatusMask_publication_matched(), listener) - test(fastdds.StatusMask.requested_deadline_missed(), - fastdds.StatusMask_requested_deadline_missed(), listener) - test(fastdds.StatusMask.requested_incompatible_qos(), - fastdds.StatusMask_requested_incompatible_qos(), listener) - test(fastdds.StatusMask.sample_lost(), - fastdds.StatusMask_sample_lost(), listener) - test(fastdds.StatusMask.sample_rejected(), - fastdds.StatusMask_sample_rejected(), listener) - test(fastdds.StatusMask.subscription_matched(), - fastdds.StatusMask_subscription_matched(), listener) - - m = fastdds.StatusMask_data_available() << \ - fastdds.StatusMask_data_on_readers() << \ - fastdds.StatusMask_inconsistent_topic() << \ - fastdds.StatusMask_liveliness_changed() << \ - fastdds.StatusMask_liveliness_lost() << \ - fastdds.StatusMask_offered_deadline_missed() << \ - fastdds.StatusMask_offered_incompatible_qos() << \ - fastdds.StatusMask_publication_matched() << \ - fastdds.StatusMask_requested_deadline_missed() << \ - fastdds.StatusMask_requested_incompatible_qos() << \ - fastdds.StatusMask_sample_lost() << \ - fastdds.StatusMask_sample_rejected() << \ - fastdds.StatusMask_subscription_matched() + test(fastdds.StatusMask.all(), None) + test(fastdds.StatusMask.all(), listener) + test(fastdds.StatusMask.none(), listener) + test(fastdds.StatusMask.data_available(), listener) + test(fastdds.StatusMask.data_on_readers(), listener) + test(fastdds.StatusMask.inconsistent_topic(), listener) + test(fastdds.StatusMask.liveliness_changed(), listener) + test(fastdds.StatusMask.liveliness_lost(), listener) + test(fastdds.StatusMask.offered_deadline_missed(), listener) + test(fastdds.StatusMask.offered_incompatible_qos(), listener) + test(fastdds.StatusMask.publication_matched(), listener) + test(fastdds.StatusMask.requested_deadline_missed(), listener) + test(fastdds.StatusMask.requested_incompatible_qos(), listener) + test(fastdds.StatusMask.sample_lost(), listener) + test(fastdds.StatusMask.sample_rejected(), listener) + test(fastdds.StatusMask.subscription_matched(), listener) test(fastdds.StatusMask.data_available() << fastdds.StatusMask.data_on_readers() << @@ -668,7 +489,6 @@ def test(status_mask_1, status_mask_2, listnr=None): fastdds.StatusMask.sample_lost() << fastdds.StatusMask.sample_rejected() << fastdds.StatusMask.subscription_matched(), - m, listener) @@ -821,67 +641,33 @@ def test_get_set_listener(participant): assert(participant.get_listener() == listener) assert(fastdds.StatusMask.all() == participant.get_status_mask()) - def test(status_mask_1, status_mask_2): + def test(status_mask): """ - Test the entity creation using the two types of StatusMasks. + Test the entity creation using the type of StatusMask. """ listener = DomainParticipantListener() assert(listener is not None) assert(fastdds.RETCODE_OK == - participant.set_listener(listener, status_mask_1)) + participant.set_listener(listener, status_mask)) assert(participant.get_listener() == listener) - assert(status_mask_1 == participant.get_status_mask()) - listener = DomainParticipantListener() - assert(listener is not None) - assert(fastdds.RETCODE_OK == - participant.set_listener(listener, status_mask_2)) - assert(participant.get_listener() == listener) - assert(status_mask_2 == participant.get_status_mask()) + assert(status_mask == participant.get_status_mask()) # Overload 3: Different status masks - test(fastdds.StatusMask.all(), fastdds.StatusMask_all()) - test(fastdds.StatusMask.all(), fastdds.StatusMask_all()) - test(fastdds.StatusMask.none(), fastdds.StatusMask_none()) - test(fastdds.StatusMask.data_available(), - fastdds.StatusMask_data_available()) - test(fastdds.StatusMask.data_on_readers(), - fastdds.StatusMask_data_on_readers()) - test(fastdds.StatusMask.inconsistent_topic(), - fastdds.StatusMask_inconsistent_topic()) - test(fastdds.StatusMask.liveliness_changed(), - fastdds.StatusMask_liveliness_changed()) - test(fastdds.StatusMask.liveliness_lost(), - fastdds.StatusMask_liveliness_lost()) - test(fastdds.StatusMask.offered_deadline_missed(), - fastdds.StatusMask_offered_deadline_missed()) - test(fastdds.StatusMask.offered_incompatible_qos(), - fastdds.StatusMask_offered_incompatible_qos()) - test(fastdds.StatusMask.publication_matched(), - fastdds.StatusMask_publication_matched()) - test(fastdds.StatusMask.requested_deadline_missed(), - fastdds.StatusMask_requested_deadline_missed()) - test(fastdds.StatusMask.requested_incompatible_qos(), - fastdds.StatusMask_requested_incompatible_qos()) - test(fastdds.StatusMask.sample_lost(), - fastdds.StatusMask_sample_lost()) - test(fastdds.StatusMask.sample_rejected(), - fastdds.StatusMask_sample_rejected()) - test(fastdds.StatusMask.subscription_matched(), - fastdds.StatusMask_subscription_matched()) - - m = fastdds.StatusMask_data_available() << \ - fastdds.StatusMask_data_on_readers() << \ - fastdds.StatusMask_inconsistent_topic() << \ - fastdds.StatusMask_liveliness_changed() << \ - fastdds.StatusMask_liveliness_lost() << \ - fastdds.StatusMask_offered_deadline_missed() << \ - fastdds.StatusMask_offered_incompatible_qos() << \ - fastdds.StatusMask_publication_matched() << \ - fastdds.StatusMask_requested_deadline_missed() << \ - fastdds.StatusMask_requested_incompatible_qos() << \ - fastdds.StatusMask_sample_lost() << \ - fastdds.StatusMask_sample_rejected() << \ - fastdds.StatusMask_subscription_matched() + test(fastdds.StatusMask.all()) + test(fastdds.StatusMask.none()) + test(fastdds.StatusMask.data_available()) + test(fastdds.StatusMask.data_on_readers()) + test(fastdds.StatusMask.inconsistent_topic()) + test(fastdds.StatusMask.liveliness_changed()) + test(fastdds.StatusMask.liveliness_lost()) + test(fastdds.StatusMask.offered_deadline_missed()) + test(fastdds.StatusMask.offered_incompatible_qos()) + test(fastdds.StatusMask.publication_matched()) + test(fastdds.StatusMask.requested_deadline_missed()) + test(fastdds.StatusMask.requested_incompatible_qos()) + test(fastdds.StatusMask.sample_lost()) + test(fastdds.StatusMask.sample_rejected()) + test(fastdds.StatusMask.subscription_matched()) test(fastdds.StatusMask.data_available() << fastdds.StatusMask.data_on_readers() << @@ -895,9 +681,7 @@ def test(status_mask_1, status_mask_2): fastdds.StatusMask.requested_incompatible_qos() << fastdds.StatusMask.sample_lost() << fastdds.StatusMask.sample_rejected() << - fastdds.StatusMask.subscription_matched(), - m) - + fastdds.StatusMask.subscription_matched()) def test_get_partitipant_names(testname_participant_qos, participant): """ @@ -1000,7 +784,7 @@ def test_listener_ownership(): factory = fastdds.DomainParticipantFactory.get_instance() def second_participant(): - listener = DomainParticipantListener() + listener = fastdds.DomainParticipantListener() return factory.create_participant(0, fastdds.PARTICIPANT_QOS_DEFAULT, listener, fastdds.StatusMask.all()) diff --git a/fastdds_python/test/api/test_domainparticipantfactory.py b/fastdds_python/test/api/test_domainparticipantfactory.py index d992be31..ad67b9b0 100644 --- a/fastdds_python/test/api/test_domainparticipantfactory.py +++ b/fastdds_python/test/api/test_domainparticipantfactory.py @@ -31,69 +31,35 @@ def test_create_participant(): assert(fastdds.RETCODE_OK == factory.delete_participant(participant)) - def test(status_mask_1, status_mask_2, listnr=None): + def test(status_mask, listnr=None): """ - Test the entity creation using the two types of StatusMasks. + Test the entity creation using the type of StatusMask. """ participant = factory.create_participant( - 0, fastdds.PARTICIPANT_QOS_DEFAULT, listnr, status_mask_1) + 0, fastdds.PARTICIPANT_QOS_DEFAULT, listnr, status_mask) assert(participant is not None) assert(participant.is_enabled()) - assert(status_mask_1 == participant.get_status_mask()) - assert(fastdds.RETCODE_OK == - factory.delete_participant(participant)) - participant = factory.create_participant( - 0, fastdds.PARTICIPANT_QOS_DEFAULT, listnr, status_mask_2) - assert(participant is not None) - assert(participant.is_enabled()) - assert(status_mask_1 == participant.get_status_mask()) + assert(status_mask == participant.get_status_mask()) assert(fastdds.RETCODE_OK == factory.delete_participant(participant)) # Overload 3: Different status masks - test(fastdds.StatusMask.all(), fastdds.StatusMask_all(), None) - test(fastdds.StatusMask.all(), fastdds.StatusMask_all(), listener) - test(fastdds.StatusMask.none(), fastdds.StatusMask_none(), listener) - test(fastdds.StatusMask.data_available(), - fastdds.StatusMask_data_available(), listener) - test(fastdds.StatusMask.data_on_readers(), - fastdds.StatusMask_data_on_readers(), listener) - test(fastdds.StatusMask.inconsistent_topic(), - fastdds.StatusMask_inconsistent_topic(), listener) - test(fastdds.StatusMask.liveliness_changed(), - fastdds.StatusMask_liveliness_changed(), listener) - test(fastdds.StatusMask.liveliness_lost(), - fastdds.StatusMask_liveliness_lost(), listener) - test(fastdds.StatusMask.offered_deadline_missed(), - fastdds.StatusMask_offered_deadline_missed(), listener) - test(fastdds.StatusMask.offered_incompatible_qos(), - fastdds.StatusMask_offered_incompatible_qos(), listener) - test(fastdds.StatusMask.publication_matched(), - fastdds.StatusMask_publication_matched(), listener) - test(fastdds.StatusMask.requested_deadline_missed(), - fastdds.StatusMask_requested_deadline_missed(), listener) - test(fastdds.StatusMask.requested_incompatible_qos(), - fastdds.StatusMask_requested_incompatible_qos(), listener) - test(fastdds.StatusMask.sample_lost(), - fastdds.StatusMask_sample_lost(), listener) - test(fastdds.StatusMask.sample_rejected(), - fastdds.StatusMask_sample_rejected(), listener) - test(fastdds.StatusMask.subscription_matched(), - fastdds.StatusMask_subscription_matched(), listener) - - m = fastdds.StatusMask_data_available() << \ - fastdds.StatusMask_data_on_readers() << \ - fastdds.StatusMask_inconsistent_topic() << \ - fastdds.StatusMask_liveliness_changed() << \ - fastdds.StatusMask_liveliness_lost() << \ - fastdds.StatusMask_offered_deadline_missed() << \ - fastdds.StatusMask_offered_incompatible_qos() << \ - fastdds.StatusMask_publication_matched() << \ - fastdds.StatusMask_requested_deadline_missed() << \ - fastdds.StatusMask_requested_incompatible_qos() << \ - fastdds.StatusMask_sample_lost() << \ - fastdds.StatusMask_sample_rejected() << \ - fastdds.StatusMask_subscription_matched() + test(fastdds.StatusMask.all(), None) + test(fastdds.StatusMask.all(), listener) + test(fastdds.StatusMask.none(), listener) + test(fastdds.StatusMask.data_available(), listener) + test(fastdds.StatusMask.data_on_readers(), listener) + test(fastdds.StatusMask.inconsistent_topic(), listener) + test(fastdds.StatusMask.liveliness_changed(), listener) + test(fastdds.StatusMask.liveliness_lost(), listener) + test(fastdds.StatusMask.offered_deadline_missed(), listener) + test(fastdds.StatusMask.offered_incompatible_qos(), listener) + test(fastdds.StatusMask.publication_matched(), listener) + test(fastdds.StatusMask.requested_deadline_missed(), listener) + test(fastdds.StatusMask.requested_incompatible_qos(), listener) + test(fastdds.StatusMask.sample_lost(), listener) + test(fastdds.StatusMask.sample_rejected(), listener) + test(fastdds.StatusMask.subscription_matched(), listener) test(fastdds.StatusMask.data_available() << fastdds.StatusMask.data_on_readers() << @@ -108,7 +74,6 @@ def test(status_mask_1, status_mask_2, listnr=None): fastdds.StatusMask.sample_lost() << fastdds.StatusMask.sample_rejected() << fastdds.StatusMask.subscription_matched(), - m, listener) # Overload 4 @@ -186,95 +151,48 @@ def test_create_participant_with_profile(): assert(fastdds.RETCODE_OK == factory.delete_participant(participant)) - def test(status_mask_1, status_mask_2, listnr=None): + def test(status_mask, listnr=None): """ - Test the entity creation using the two types of StatusMasks. + Test the entity creation using the type of StatusMask. """ participant = factory.create_participant_with_profile( - 'test_participant_profile', listnr, status_mask_1) + 'test_participant_profile', listnr, status_mask) assert(participant is not None) assert(participant.is_enabled()) assert(3 == participant.get_domain_id()) qos = participant.get_qos() assert('test_name' == qos.name()) - assert(status_mask_1 == participant.get_status_mask()) + assert(status_mask == participant.get_status_mask()) assert(fastdds.RETCODE_OK == factory.delete_participant(participant)) participant = factory.create_participant_with_profile( - 0, 'test_participant_profile', listnr, status_mask_1) + 0, 'test_participant_profile', listnr, status_mask) assert(participant is not None) assert(participant.is_enabled()) assert(0 == participant.get_domain_id()) qos = participant.get_qos() assert('test_name' == qos.name()) - assert(status_mask_1 == participant.get_status_mask()) - assert(fastdds.RETCODE_OK == - factory.delete_participant(participant)) - participant = factory.create_participant_with_profile( - 'test_participant_profile', listnr, status_mask_2) - assert(participant is not None) - assert(participant.is_enabled()) - assert(3 == participant.get_domain_id()) - qos = participant.get_qos() - assert('test_name' == qos.name()) - assert(status_mask_1 == participant.get_status_mask()) - assert(fastdds.RETCODE_OK == - factory.delete_participant(participant)) - participant = factory.create_participant_with_profile( - 0, 'test_participant_profile', listnr, status_mask_2) - assert(participant is not None) - assert(participant.is_enabled()) - assert(0 == participant.get_domain_id()) - qos = participant.get_qos() - assert('test_name' == qos.name()) - assert(status_mask_1 == participant.get_status_mask()) + assert(status_mask == participant.get_status_mask()) assert(fastdds.RETCODE_OK == factory.delete_participant(participant)) # Overload 3: Different status masks - test(fastdds.StatusMask.all(), fastdds.StatusMask_all(), None) - test(fastdds.StatusMask.all(), fastdds.StatusMask_all(), listener) - test(fastdds.StatusMask.none(), fastdds.StatusMask_none(), listener) - test(fastdds.StatusMask.data_available(), - fastdds.StatusMask_data_available(), listener) - test(fastdds.StatusMask.data_on_readers(), - fastdds.StatusMask_data_on_readers(), listener) - test(fastdds.StatusMask.inconsistent_topic(), - fastdds.StatusMask_inconsistent_topic(), listener) - test(fastdds.StatusMask.liveliness_changed(), - fastdds.StatusMask_liveliness_changed(), listener) - test(fastdds.StatusMask.liveliness_lost(), - fastdds.StatusMask_liveliness_lost(), listener) - test(fastdds.StatusMask.offered_deadline_missed(), - fastdds.StatusMask_offered_deadline_missed(), listener) - test(fastdds.StatusMask.offered_incompatible_qos(), - fastdds.StatusMask_offered_incompatible_qos(), listener) - test(fastdds.StatusMask.publication_matched(), - fastdds.StatusMask_publication_matched(), listener) - test(fastdds.StatusMask.requested_deadline_missed(), - fastdds.StatusMask_requested_deadline_missed(), listener) - test(fastdds.StatusMask.requested_incompatible_qos(), - fastdds.StatusMask_requested_incompatible_qos(), listener) - test(fastdds.StatusMask.sample_lost(), - fastdds.StatusMask_sample_lost(), listener) - test(fastdds.StatusMask.sample_rejected(), - fastdds.StatusMask_sample_rejected(), listener) - test(fastdds.StatusMask.subscription_matched(), - fastdds.StatusMask_subscription_matched(), listener) - - m = fastdds.StatusMask_data_available() << \ - fastdds.StatusMask_data_on_readers() << \ - fastdds.StatusMask_inconsistent_topic() << \ - fastdds.StatusMask_liveliness_changed() << \ - fastdds.StatusMask_liveliness_lost() << \ - fastdds.StatusMask_offered_deadline_missed() << \ - fastdds.StatusMask_offered_incompatible_qos() << \ - fastdds.StatusMask_publication_matched() << \ - fastdds.StatusMask_requested_deadline_missed() << \ - fastdds.StatusMask_requested_incompatible_qos() << \ - fastdds.StatusMask_sample_lost() << \ - fastdds.StatusMask_sample_rejected() << \ - fastdds.StatusMask_subscription_matched() + test(fastdds.StatusMask.all(), None) + test(fastdds.StatusMask.all(), listener) + test(fastdds.StatusMask.none(), listener) + test(fastdds.StatusMask.data_available(), listener) + test(fastdds.StatusMask.data_on_readers(), listener) + test(fastdds.StatusMask.inconsistent_topic(), listener) + test(fastdds.StatusMask.liveliness_changed(), listener) + test(fastdds.StatusMask.liveliness_lost(), listener) + test(fastdds.StatusMask.offered_deadline_missed(), listener) + test(fastdds.StatusMask.offered_incompatible_qos(), listener) + test(fastdds.StatusMask.publication_matched(), listener) + test(fastdds.StatusMask.requested_deadline_missed(), listener) + test(fastdds.StatusMask.requested_incompatible_qos(), listener) + test(fastdds.StatusMask.sample_lost(), listener) + test(fastdds.StatusMask.sample_rejected(), listener) + test(fastdds.StatusMask.subscription_matched(), listener) test(fastdds.StatusMask.data_available() << fastdds.StatusMask.data_on_readers() << @@ -289,5 +207,4 @@ def test(status_mask_1, status_mask_2, listnr=None): fastdds.StatusMask.sample_lost() << fastdds.StatusMask.sample_rejected() << fastdds.StatusMask.subscription_matched(), - m, listener) diff --git a/fastdds_python/test/api/test_publisher.py b/fastdds_python/test/api/test_publisher.py index 032de12d..6f83237a 100644 --- a/fastdds_python/test/api/test_publisher.py +++ b/fastdds_python/test/api/test_publisher.py @@ -124,69 +124,35 @@ def test_create_datawriter(topic, publisher): assert(fastdds.RETCODE_OK == publisher.delete_datawriter(datawriter)) - def test(status_mask_1, status_mask_2, listnr=None): + def test(status_mask, listnr=None): """ - Test the entity creation using the two types of StatusMasks. + Test the entity creation using the type of StatusMask. """ datawriter = publisher.create_datawriter( - topic, fastdds.DATAWRITER_QOS_DEFAULT, listnr, status_mask_1) - assert(datawriter is not None) - assert(datawriter.is_enabled()) - assert(status_mask_1 == datawriter.get_status_mask()) - assert(fastdds.RETCODE_OK == - publisher.delete_datawriter(datawriter)) - datawriter = publisher.create_datawriter( - topic, fastdds.DATAWRITER_QOS_DEFAULT, listnr, status_mask_2) + topic, fastdds.DATAWRITER_QOS_DEFAULT, listnr, status_mask) assert(datawriter is not None) assert(datawriter.is_enabled()) - assert(status_mask_2 == datawriter.get_status_mask()) + assert(status_mask == datawriter.get_status_mask()) assert(fastdds.RETCODE_OK == publisher.delete_datawriter(datawriter)) # Overload 3: Different status masks - test(fastdds.StatusMask.all(), fastdds.StatusMask_all(), None) - test(fastdds.StatusMask.all(), fastdds.StatusMask_all(), listener) - test(fastdds.StatusMask.none(), fastdds.StatusMask_none(), listener) - test(fastdds.StatusMask.data_available(), - fastdds.StatusMask_data_available(), listener) - test(fastdds.StatusMask.data_on_readers(), - fastdds.StatusMask_data_on_readers(), listener) - test(fastdds.StatusMask.inconsistent_topic(), - fastdds.StatusMask_inconsistent_topic(), listener) - test(fastdds.StatusMask.liveliness_changed(), - fastdds.StatusMask_liveliness_changed(), listener) - test(fastdds.StatusMask.liveliness_lost(), - fastdds.StatusMask_liveliness_lost(), listener) - test(fastdds.StatusMask.offered_deadline_missed(), - fastdds.StatusMask_offered_deadline_missed(), listener) - test(fastdds.StatusMask.offered_incompatible_qos(), - fastdds.StatusMask_offered_incompatible_qos(), listener) - test(fastdds.StatusMask.publication_matched(), - fastdds.StatusMask_publication_matched(), listener) - test(fastdds.StatusMask.requested_deadline_missed(), - fastdds.StatusMask_requested_deadline_missed(), listener) - test(fastdds.StatusMask.requested_incompatible_qos(), - fastdds.StatusMask_requested_incompatible_qos(), listener) - test(fastdds.StatusMask.sample_lost(), - fastdds.StatusMask_sample_lost(), listener) - test(fastdds.StatusMask.sample_rejected(), - fastdds.StatusMask_sample_rejected(), listener) - test(fastdds.StatusMask.subscription_matched(), - fastdds.StatusMask_subscription_matched(), listener) - - m = fastdds.StatusMask_data_available() << \ - fastdds.StatusMask_data_on_readers() << \ - fastdds.StatusMask_inconsistent_topic() << \ - fastdds.StatusMask_liveliness_changed() << \ - fastdds.StatusMask_liveliness_lost() << \ - fastdds.StatusMask_offered_deadline_missed() << \ - fastdds.StatusMask_offered_incompatible_qos() << \ - fastdds.StatusMask_publication_matched() << \ - fastdds.StatusMask_requested_deadline_missed() << \ - fastdds.StatusMask_requested_incompatible_qos() << \ - fastdds.StatusMask_sample_lost() << \ - fastdds.StatusMask_sample_rejected() << \ - fastdds.StatusMask_subscription_matched() + test(fastdds.StatusMask.all(), None) + test(fastdds.StatusMask.all(), listener) + test(fastdds.StatusMask.none(), listener) + test(fastdds.StatusMask.data_available(), listener) + test(fastdds.StatusMask.data_on_readers(), listener) + test(fastdds.StatusMask.inconsistent_topic(), listener) + test(fastdds.StatusMask.liveliness_changed(), listener) + test(fastdds.StatusMask.liveliness_lost(), listener) + test(fastdds.StatusMask.offered_deadline_missed(), listener) + test(fastdds.StatusMask.offered_incompatible_qos(), listener) + test(fastdds.StatusMask.publication_matched(), listener) + test(fastdds.StatusMask.requested_deadline_missed(), listener) + test(fastdds.StatusMask.requested_incompatible_qos(), listener) + test(fastdds.StatusMask.sample_lost(), listener) + test(fastdds.StatusMask.sample_rejected(), listener) + test(fastdds.StatusMask.subscription_matched(), listener) test(fastdds.StatusMask.data_available() << fastdds.StatusMask.data_on_readers() << @@ -201,7 +167,6 @@ def test(status_mask_1, status_mask_2, listnr=None): fastdds.StatusMask.sample_lost() << fastdds.StatusMask.sample_rejected() << fastdds.StatusMask.subscription_matched(), - m, listener) @@ -246,75 +211,38 @@ def test_create_datawriter_with_profile(topic, publisher): assert(fastdds.RETCODE_OK == publisher.delete_datawriter(datawriter)) - def test(status_mask_1, status_mask_2, listnr=None): + def test(status_mask, listnr=None): """ Test the entity creation using the two types of StatusMasks. """ datawriter = publisher.create_datawriter_with_profile( - topic, 'test_datawriter_profile', listnr, status_mask_1) - assert(datawriter is not None) - assert(datawriter.is_enabled()) - qos = datawriter.get_qos() - assert(fastdds.VOLATILE_DURABILITY_QOS == - qos.durability().kind) - assert(status_mask_1 == datawriter.get_status_mask()) - assert(fastdds.RETCODE_OK == - publisher.delete_datawriter(datawriter)) - datawriter = publisher.create_datawriter_with_profile( - topic, 'test_datawriter_profile', listnr, status_mask_2) + topic, 'test_datawriter_profile', listnr, status_mask) assert(datawriter is not None) assert(datawriter.is_enabled()) qos = datawriter.get_qos() assert(fastdds.VOLATILE_DURABILITY_QOS == qos.durability().kind) - assert(status_mask_2 == datawriter.get_status_mask()) + assert(status_mask == datawriter.get_status_mask()) assert(fastdds.RETCODE_OK == publisher.delete_datawriter(datawriter)) # Overload 3: Different status masks - test(fastdds.StatusMask.all(), fastdds.StatusMask_all(), None) - test(fastdds.StatusMask.all(), fastdds.StatusMask_all(), listener) - test(fastdds.StatusMask.none(), fastdds.StatusMask_none(), listener) - test(fastdds.StatusMask.data_available(), - fastdds.StatusMask_data_available(), listener) - test(fastdds.StatusMask.data_on_readers(), - fastdds.StatusMask_data_on_readers(), listener) - test(fastdds.StatusMask.inconsistent_topic(), - fastdds.StatusMask_inconsistent_topic(), listener) - test(fastdds.StatusMask.liveliness_changed(), - fastdds.StatusMask_liveliness_changed(), listener) - test(fastdds.StatusMask.liveliness_lost(), - fastdds.StatusMask_liveliness_lost(), listener) - test(fastdds.StatusMask.offered_deadline_missed(), - fastdds.StatusMask_offered_deadline_missed(), listener) - test(fastdds.StatusMask.offered_incompatible_qos(), - fastdds.StatusMask_offered_incompatible_qos(), listener) - test(fastdds.StatusMask.publication_matched(), - fastdds.StatusMask_publication_matched(), listener) - test(fastdds.StatusMask.requested_deadline_missed(), - fastdds.StatusMask_requested_deadline_missed(), listener) - test(fastdds.StatusMask.requested_incompatible_qos(), - fastdds.StatusMask_requested_incompatible_qos(), listener) - test(fastdds.StatusMask.sample_lost(), - fastdds.StatusMask_sample_lost(), listener) - test(fastdds.StatusMask.sample_rejected(), - fastdds.StatusMask_sample_rejected(), listener) - test(fastdds.StatusMask.subscription_matched(), - fastdds.StatusMask_subscription_matched(), listener) - - m = fastdds.StatusMask_data_available() << \ - fastdds.StatusMask_data_on_readers() << \ - fastdds.StatusMask_inconsistent_topic() << \ - fastdds.StatusMask_liveliness_changed() << \ - fastdds.StatusMask_liveliness_lost() << \ - fastdds.StatusMask_offered_deadline_missed() << \ - fastdds.StatusMask_offered_incompatible_qos() << \ - fastdds.StatusMask_publication_matched() << \ - fastdds.StatusMask_requested_deadline_missed() << \ - fastdds.StatusMask_requested_incompatible_qos() << \ - fastdds.StatusMask_sample_lost() << \ - fastdds.StatusMask_sample_rejected() << \ - fastdds.StatusMask_subscription_matched() + test(fastdds.StatusMask.all(), None) + test(fastdds.StatusMask.all(), listener) + test(fastdds.StatusMask.none(), listener) + test(fastdds.StatusMask.data_available(), listener) + test(fastdds.StatusMask.data_on_readers(), listener) + test(fastdds.StatusMask.inconsistent_topic(), listener) + test(fastdds.StatusMask.liveliness_changed(), listener) + test(fastdds.StatusMask.liveliness_lost(), listener) + test(fastdds.StatusMask.offered_deadline_missed(), listener) + test(fastdds.StatusMask.offered_incompatible_qos(), listener) + test(fastdds.StatusMask.publication_matched(), listener) + test(fastdds.StatusMask.requested_deadline_missed(), listener) + test(fastdds.StatusMask.requested_incompatible_qos(), listener) + test(fastdds.StatusMask.sample_lost(), listener) + test(fastdds.StatusMask.sample_rejected(), listener) + test(fastdds.StatusMask.subscription_matched(), listener) test(fastdds.StatusMask.data_available() << fastdds.StatusMask.data_on_readers() << @@ -329,7 +257,6 @@ def test(status_mask_1, status_mask_2, listnr=None): fastdds.StatusMask.sample_lost() << fastdds.StatusMask.sample_rejected() << fastdds.StatusMask.subscription_matched(), - m, listener) @@ -451,67 +378,33 @@ def test_get_set_listener(publisher): assert(publisher.get_listener() == listener) assert(fastdds.StatusMask.all() == publisher.get_status_mask()) - def test(status_mask_1, status_mask_2): + def test(status_mask): """ - Test the entity creation using the two types of StatusMasks. + Test the entity creation using the type of StatusMask. """ listener = PublisherListener() assert(listener is not None) assert(fastdds.RETCODE_OK == - publisher.set_listener(listener, status_mask_1)) + publisher.set_listener(listener, status_mask)) assert(publisher.get_listener() == listener) - assert(status_mask_1 == publisher.get_status_mask()) - listener = PublisherListener() - assert(listener is not None) - assert(fastdds.RETCODE_OK == - publisher.set_listener(listener, status_mask_2)) - assert(publisher.get_listener() == listener) - assert(status_mask_2 == publisher.get_status_mask()) + assert(status_mask == publisher.get_status_mask()) # Overload 2: Different status masks - test(fastdds.StatusMask.all(), fastdds.StatusMask_all()) - test(fastdds.StatusMask.all(), fastdds.StatusMask_all()) - test(fastdds.StatusMask.none(), fastdds.StatusMask_none()) - test(fastdds.StatusMask.data_available(), - fastdds.StatusMask_data_available()) - test(fastdds.StatusMask.data_on_readers(), - fastdds.StatusMask_data_on_readers()) - test(fastdds.StatusMask.inconsistent_topic(), - fastdds.StatusMask_inconsistent_topic()) - test(fastdds.StatusMask.liveliness_changed(), - fastdds.StatusMask_liveliness_changed()) - test(fastdds.StatusMask.liveliness_lost(), - fastdds.StatusMask_liveliness_lost()) - test(fastdds.StatusMask.offered_deadline_missed(), - fastdds.StatusMask_offered_deadline_missed()) - test(fastdds.StatusMask.offered_incompatible_qos(), - fastdds.StatusMask_offered_incompatible_qos()) - test(fastdds.StatusMask.publication_matched(), - fastdds.StatusMask_publication_matched()) - test(fastdds.StatusMask.requested_deadline_missed(), - fastdds.StatusMask_requested_deadline_missed()) - test(fastdds.StatusMask.requested_incompatible_qos(), - fastdds.StatusMask_requested_incompatible_qos()) - test(fastdds.StatusMask.sample_lost(), - fastdds.StatusMask_sample_lost()) - test(fastdds.StatusMask.sample_rejected(), - fastdds.StatusMask_sample_rejected()) - test(fastdds.StatusMask.subscription_matched(), - fastdds.StatusMask_subscription_matched()) - - m = fastdds.StatusMask_data_available() << \ - fastdds.StatusMask_data_on_readers() << \ - fastdds.StatusMask_inconsistent_topic() << \ - fastdds.StatusMask_liveliness_changed() << \ - fastdds.StatusMask_liveliness_lost() << \ - fastdds.StatusMask_offered_deadline_missed() << \ - fastdds.StatusMask_offered_incompatible_qos() << \ - fastdds.StatusMask_publication_matched() << \ - fastdds.StatusMask_requested_deadline_missed() << \ - fastdds.StatusMask_requested_incompatible_qos() << \ - fastdds.StatusMask_sample_lost() << \ - fastdds.StatusMask_sample_rejected() << \ - fastdds.StatusMask_subscription_matched() + test(fastdds.StatusMask.all()) + test(fastdds.StatusMask.none()) + test(fastdds.StatusMask.data_available()) + test(fastdds.StatusMask.data_on_readers()) + test(fastdds.StatusMask.inconsistent_topic()) + test(fastdds.StatusMask.liveliness_changed()) + test(fastdds.StatusMask.liveliness_lost()) + test(fastdds.StatusMask.offered_deadline_missed()) + test(fastdds.StatusMask.offered_incompatible_qos()) + test(fastdds.StatusMask.publication_matched()) + test(fastdds.StatusMask.requested_deadline_missed()) + test(fastdds.StatusMask.requested_incompatible_qos()) + test(fastdds.StatusMask.sample_lost()) + test(fastdds.StatusMask.sample_rejected()) + test(fastdds.StatusMask.subscription_matched()) test(fastdds.StatusMask.data_available() << fastdds.StatusMask.data_on_readers() << @@ -525,8 +418,7 @@ def test(status_mask_1, status_mask_2): fastdds.StatusMask.requested_incompatible_qos() << fastdds.StatusMask.sample_lost() << fastdds.StatusMask.sample_rejected() << - fastdds.StatusMask.subscription_matched(), - m) + fastdds.StatusMask.subscription_matched()) def test_lookup_datawriter(topic, publisher): diff --git a/fastdds_python/test/api/test_subscriber.py b/fastdds_python/test/api/test_subscriber.py index b8f443a0..ca096e7c 100644 --- a/fastdds_python/test/api/test_subscriber.py +++ b/fastdds_python/test/api/test_subscriber.py @@ -127,69 +127,35 @@ def test_create_datareader(topic, subscriber): assert(fastdds.RETCODE_OK == subscriber.delete_datareader(datareader)) - def test(status_mask_1, status_mask_2, listnr=None): + def test(status_mask, listnr=None): """ - Test the entity creation using the two types of StatusMasks. + Test the entity creation using the type of StatusMask. """ datareader = subscriber.create_datareader( - topic, fastdds.DATAREADER_QOS_DEFAULT, listnr, status_mask_1) + topic, fastdds.DATAREADER_QOS_DEFAULT, listnr, status_mask) assert(datareader is not None) assert(datareader.is_enabled()) - assert(status_mask_1 == datareader.get_status_mask()) - assert(fastdds.RETCODE_OK == - subscriber.delete_datareader(datareader)) - datareader = subscriber.create_datareader( - topic, fastdds.DATAREADER_QOS_DEFAULT, listnr, status_mask_2) - assert(datareader is not None) - assert(datareader.is_enabled()) - assert(status_mask_2 == datareader.get_status_mask()) + assert(status_mask == datareader.get_status_mask()) assert(fastdds.RETCODE_OK == subscriber.delete_datareader(datareader)) # Overload 3: Different status masks - test(fastdds.StatusMask.all(), fastdds.StatusMask_all(), None) - test(fastdds.StatusMask.all(), fastdds.StatusMask_all(), listener) - test(fastdds.StatusMask.none(), fastdds.StatusMask_none(), listener) - test(fastdds.StatusMask.data_available(), - fastdds.StatusMask_data_available(), listener) - test(fastdds.StatusMask.data_on_readers(), - fastdds.StatusMask_data_on_readers(), listener) - test(fastdds.StatusMask.inconsistent_topic(), - fastdds.StatusMask_inconsistent_topic(), listener) - test(fastdds.StatusMask.liveliness_changed(), - fastdds.StatusMask_liveliness_changed(), listener) - test(fastdds.StatusMask.liveliness_lost(), - fastdds.StatusMask_liveliness_lost(), listener) - test(fastdds.StatusMask.offered_deadline_missed(), - fastdds.StatusMask_offered_deadline_missed(), listener) - test(fastdds.StatusMask.offered_incompatible_qos(), - fastdds.StatusMask_offered_incompatible_qos(), listener) - test(fastdds.StatusMask.publication_matched(), - fastdds.StatusMask_publication_matched(), listener) - test(fastdds.StatusMask.requested_deadline_missed(), - fastdds.StatusMask_requested_deadline_missed(), listener) - test(fastdds.StatusMask.requested_incompatible_qos(), - fastdds.StatusMask_requested_incompatible_qos(), listener) - test(fastdds.StatusMask.sample_lost(), - fastdds.StatusMask_sample_lost(), listener) - test(fastdds.StatusMask.sample_rejected(), - fastdds.StatusMask_sample_rejected(), listener) - test(fastdds.StatusMask.subscription_matched(), - fastdds.StatusMask_subscription_matched(), listener) - - m = fastdds.StatusMask_data_available() << \ - fastdds.StatusMask_data_on_readers() << \ - fastdds.StatusMask_inconsistent_topic() << \ - fastdds.StatusMask_liveliness_changed() << \ - fastdds.StatusMask_liveliness_lost() << \ - fastdds.StatusMask_offered_deadline_missed() << \ - fastdds.StatusMask_offered_incompatible_qos() << \ - fastdds.StatusMask_publication_matched() << \ - fastdds.StatusMask_requested_deadline_missed() << \ - fastdds.StatusMask_requested_incompatible_qos() << \ - fastdds.StatusMask_sample_lost() << \ - fastdds.StatusMask_sample_rejected() << \ - fastdds.StatusMask_subscription_matched() + test(fastdds.StatusMask.all(), None) + test(fastdds.StatusMask.all(), listener) + test(fastdds.StatusMask.none(), listener) + test(fastdds.StatusMask.data_available(), listener) + test(fastdds.StatusMask.data_on_readers(), listener) + test(fastdds.StatusMask.inconsistent_topic(), listener) + test(fastdds.StatusMask.liveliness_changed(), listener) + test(fastdds.StatusMask.liveliness_lost(), listener) + test(fastdds.StatusMask.offered_deadline_missed(), listener) + test(fastdds.StatusMask.offered_incompatible_qos(), listener) + test(fastdds.StatusMask.publication_matched(), listener) + test(fastdds.StatusMask.requested_deadline_missed(), listener) + test(fastdds.StatusMask.requested_incompatible_qos(), listener) + test(fastdds.StatusMask.sample_lost(), listener) + test(fastdds.StatusMask.sample_rejected(), listener) + test(fastdds.StatusMask.subscription_matched(), listener) test(fastdds.StatusMask.data_available() << fastdds.StatusMask.data_on_readers() << @@ -204,7 +170,6 @@ def test(status_mask_1, status_mask_2, listnr=None): fastdds.StatusMask.sample_lost() << fastdds.StatusMask.sample_rejected() << fastdds.StatusMask.subscription_matched(), - m, listener) @@ -249,75 +214,38 @@ def test_create_datareader_with_profile(topic, subscriber): assert(fastdds.RETCODE_OK == subscriber.delete_datareader(datareader)) - def test(status_mask_1, status_mask_2, listnr=None): + def test(status_mask, listnr=None): """ - Test the entity creation using the two types of StatusMasks. + Test the entity creation using the type of StatusMask. """ datareader = subscriber.create_datareader_with_profile( - topic, 'test_datareader_profile', listnr, status_mask_1) - assert(datareader is not None) - assert(datareader.is_enabled()) - qos = datareader.get_qos() - assert(fastdds.RELIABLE_RELIABILITY_QOS == - qos.reliability().kind) - assert(status_mask_1 == datareader.get_status_mask()) - assert(fastdds.RETCODE_OK == - subscriber.delete_datareader(datareader)) - datareader = subscriber.create_datareader_with_profile( - topic, 'test_datareader_profile', listnr, status_mask_2) + topic, 'test_datareader_profile', listnr, status_mask) assert(datareader is not None) assert(datareader.is_enabled()) qos = datareader.get_qos() assert(fastdds.RELIABLE_RELIABILITY_QOS == qos.reliability().kind) - assert(status_mask_2 == datareader.get_status_mask()) + assert(status_mask == datareader.get_status_mask()) assert(fastdds.RETCODE_OK == subscriber.delete_datareader(datareader)) # Overload 3: Different status masks - test(fastdds.StatusMask.all(), fastdds.StatusMask_all(), None) - test(fastdds.StatusMask.all(), fastdds.StatusMask_all(), listener) - test(fastdds.StatusMask.none(), fastdds.StatusMask_none(), listener) - test(fastdds.StatusMask.data_available(), - fastdds.StatusMask_data_available(), listener) - test(fastdds.StatusMask.data_on_readers(), - fastdds.StatusMask_data_on_readers(), listener) - test(fastdds.StatusMask.inconsistent_topic(), - fastdds.StatusMask_inconsistent_topic(), listener) - test(fastdds.StatusMask.liveliness_changed(), - fastdds.StatusMask_liveliness_changed(), listener) - test(fastdds.StatusMask.liveliness_lost(), - fastdds.StatusMask_liveliness_lost(), listener) - test(fastdds.StatusMask.offered_deadline_missed(), - fastdds.StatusMask_offered_deadline_missed(), listener) - test(fastdds.StatusMask.offered_incompatible_qos(), - fastdds.StatusMask_offered_incompatible_qos(), listener) - test(fastdds.StatusMask.publication_matched(), - fastdds.StatusMask_publication_matched(), listener) - test(fastdds.StatusMask.requested_deadline_missed(), - fastdds.StatusMask_requested_deadline_missed(), listener) - test(fastdds.StatusMask.requested_incompatible_qos(), - fastdds.StatusMask_requested_incompatible_qos(), listener) - test(fastdds.StatusMask.sample_lost(), - fastdds.StatusMask_sample_lost(), listener) - test(fastdds.StatusMask.sample_rejected(), - fastdds.StatusMask_sample_rejected(), listener) - test(fastdds.StatusMask.subscription_matched(), - fastdds.StatusMask_subscription_matched(), listener) - - m = fastdds.StatusMask_data_available() << \ - fastdds.StatusMask_data_on_readers() << \ - fastdds.StatusMask_inconsistent_topic() << \ - fastdds.StatusMask_liveliness_changed() << \ - fastdds.StatusMask_liveliness_lost() << \ - fastdds.StatusMask_offered_deadline_missed() << \ - fastdds.StatusMask_offered_incompatible_qos() << \ - fastdds.StatusMask_publication_matched() << \ - fastdds.StatusMask_requested_deadline_missed() << \ - fastdds.StatusMask_requested_incompatible_qos() << \ - fastdds.StatusMask_sample_lost() << \ - fastdds.StatusMask_sample_rejected() << \ - fastdds.StatusMask_subscription_matched() + test(fastdds.StatusMask.all(), None) + test(fastdds.StatusMask.all(), listener) + test(fastdds.StatusMask.none(), listener) + test(fastdds.StatusMask.data_available(), listener) + test(fastdds.StatusMask.data_on_readers(), listener) + test(fastdds.StatusMask.inconsistent_topic(), listener) + test(fastdds.StatusMask.liveliness_changed(), listener) + test(fastdds.StatusMask.liveliness_lost(), listener) + test(fastdds.StatusMask.offered_deadline_missed(), listener) + test(fastdds.StatusMask.offered_incompatible_qos(), listener) + test(fastdds.StatusMask.publication_matched(), listener) + test(fastdds.StatusMask.requested_deadline_missed(), listener) + test(fastdds.StatusMask.requested_incompatible_qos(), listener) + test(fastdds.StatusMask.sample_lost(), listener) + test(fastdds.StatusMask.sample_rejected(), listener) + test(fastdds.StatusMask.subscription_matched(), listener) test(fastdds.StatusMask.data_available() << fastdds.StatusMask.data_on_readers() << @@ -332,7 +260,6 @@ def test(status_mask_1, status_mask_2, listnr=None): fastdds.StatusMask.sample_lost() << fastdds.StatusMask.sample_rejected() << fastdds.StatusMask.subscription_matched(), - m, listener) @@ -450,67 +377,33 @@ def test_get_set_listener(subscriber): assert(subscriber.get_listener() == listener) assert(fastdds.StatusMask.all() == subscriber.get_status_mask()) - def test(status_mask_1, status_mask_2): + def test(status_mask): """ - Test the entity creation using the two types of StatusMasks. + Test the entity creation using the type of StatusMask. """ listener = SubscriberListener() assert(listener is not None) assert(fastdds.RETCODE_OK == - subscriber.set_listener(listener, status_mask_1)) + subscriber.set_listener(listener, status_mask)) assert(subscriber.get_listener() == listener) - assert(status_mask_1 == subscriber.get_status_mask()) - listener = SubscriberListener() - assert(listener is not None) - assert(fastdds.RETCODE_OK == - subscriber.set_listener(listener, status_mask_2)) - assert(subscriber.get_listener() == listener) - assert(status_mask_2 == subscriber.get_status_mask()) + assert(status_mask == subscriber.get_status_mask()) # Overload 2: Different status masks - test(fastdds.StatusMask.all(), fastdds.StatusMask_all()) - test(fastdds.StatusMask.all(), fastdds.StatusMask_all()) - test(fastdds.StatusMask.none(), fastdds.StatusMask_none()) - test(fastdds.StatusMask.data_available(), - fastdds.StatusMask_data_available()) - test(fastdds.StatusMask.data_on_readers(), - fastdds.StatusMask_data_on_readers()) - test(fastdds.StatusMask.inconsistent_topic(), - fastdds.StatusMask_inconsistent_topic()) - test(fastdds.StatusMask.liveliness_changed(), - fastdds.StatusMask_liveliness_changed()) - test(fastdds.StatusMask.liveliness_lost(), - fastdds.StatusMask_liveliness_lost()) - test(fastdds.StatusMask.offered_deadline_missed(), - fastdds.StatusMask_offered_deadline_missed()) - test(fastdds.StatusMask.offered_incompatible_qos(), - fastdds.StatusMask_offered_incompatible_qos()) - test(fastdds.StatusMask.publication_matched(), - fastdds.StatusMask_publication_matched()) - test(fastdds.StatusMask.requested_deadline_missed(), - fastdds.StatusMask_requested_deadline_missed()) - test(fastdds.StatusMask.requested_incompatible_qos(), - fastdds.StatusMask_requested_incompatible_qos()) - test(fastdds.StatusMask.sample_lost(), - fastdds.StatusMask_sample_lost()) - test(fastdds.StatusMask.sample_rejected(), - fastdds.StatusMask_sample_rejected()) - test(fastdds.StatusMask.subscription_matched(), - fastdds.StatusMask_subscription_matched()) - - m = fastdds.StatusMask_data_available() << \ - fastdds.StatusMask_data_on_readers() << \ - fastdds.StatusMask_inconsistent_topic() << \ - fastdds.StatusMask_liveliness_changed() << \ - fastdds.StatusMask_liveliness_lost() << \ - fastdds.StatusMask_offered_deadline_missed() << \ - fastdds.StatusMask_offered_incompatible_qos() << \ - fastdds.StatusMask_publication_matched() << \ - fastdds.StatusMask_requested_deadline_missed() << \ - fastdds.StatusMask_requested_incompatible_qos() << \ - fastdds.StatusMask_sample_lost() << \ - fastdds.StatusMask_sample_rejected() << \ - fastdds.StatusMask_subscription_matched() + test(fastdds.StatusMask.all()) + test(fastdds.StatusMask.none()) + test(fastdds.StatusMask.data_available()) + test(fastdds.StatusMask.data_on_readers()) + test(fastdds.StatusMask.inconsistent_topic()) + test(fastdds.StatusMask.liveliness_changed()) + test(fastdds.StatusMask.liveliness_lost()) + test(fastdds.StatusMask.offered_deadline_missed()) + test(fastdds.StatusMask.offered_incompatible_qos()) + test(fastdds.StatusMask.publication_matched()) + test(fastdds.StatusMask.requested_deadline_missed()) + test(fastdds.StatusMask.requested_incompatible_qos()) + test(fastdds.StatusMask.sample_lost()) + test(fastdds.StatusMask.sample_rejected()) + test(fastdds.StatusMask.subscription_matched()) test(fastdds.StatusMask.data_available() << fastdds.StatusMask.data_on_readers() << @@ -524,8 +417,7 @@ def test(status_mask_1, status_mask_2): fastdds.StatusMask.requested_incompatible_qos() << fastdds.StatusMask.sample_lost() << fastdds.StatusMask.sample_rejected() << - fastdds.StatusMask.subscription_matched(), - m) + fastdds.StatusMask.subscription_matched()) def test_lookup_datareader(topic, subscriber):