@@ -796,3 +796,248 @@ def second_participant():
796796 factory .delete_participant (participant ))
797797 assert (fastdds .RETCODE_OK ==
798798 factory .delete_participant (participant2 ))
799+
800+ def test_get_publisher_qos_from_xml ():
801+
802+ with open ("test_xml_profile.xml" , "r" , encoding = "utf-8" ) as file :
803+ xml_content = file .read ()
804+
805+ factory = fastdds .DomainParticipantFactory .get_instance ()
806+ participant = factory .create_participant (
807+ 0 , fastdds .PARTICIPANT_QOS_DEFAULT )
808+
809+ qos = fastdds .PublisherQos ()
810+ ret = participant .get_publisher_qos_from_xml (
811+ xml_content , qos , 'test_publisher_profile' )
812+ assert (fastdds .RETCODE_OK == ret )
813+
814+ qos_no_name = fastdds .PublisherQos ()
815+ ret = participant .get_publisher_qos_from_xml (
816+ xml_content , qos_no_name )
817+ assert (fastdds .RETCODE_OK == ret )
818+
819+ # Non matching name takes the first publisher found (the only one)
820+ assert (qos == qos_no_name )
821+
822+ assert (fastdds .RETCODE_OK ==
823+ factory .delete_participant (participant ))
824+
825+ def test_get_default_publisher_qos_from_xml ():
826+
827+ with open ("test_xml_profile.xml" , "r" , encoding = "utf-8" ) as file :
828+ xml_content = file .read ()
829+
830+ factory = fastdds .DomainParticipantFactory .get_instance ()
831+ participant = factory .create_participant (
832+ 0 , fastdds .PARTICIPANT_QOS_DEFAULT )
833+
834+ default_qos = fastdds .PublisherQos ()
835+ ret = participant .get_default_publisher_qos_from_xml (
836+ xml_content , default_qos )
837+ assert (fastdds .RETCODE_OK == ret )
838+
839+ qos = fastdds .PublisherQos ()
840+ ret = participant .get_publisher_qos_from_xml (
841+ xml_content , qos , 'test_publisher_profile' )
842+ assert (fastdds .RETCODE_OK == ret )
843+
844+ assert (default_qos == qos )
845+
846+ assert (fastdds .RETCODE_OK ==
847+ factory .delete_participant (participant ))
848+
849+ def test_get_subscriber_qos_from_xml ():
850+
851+ with open ("test_xml_profile.xml" , "r" , encoding = "utf-8" ) as file :
852+ xml_content = file .read ()
853+
854+ factory = fastdds .DomainParticipantFactory .get_instance ()
855+ participant = factory .create_participant (
856+ 0 , fastdds .PARTICIPANT_QOS_DEFAULT )
857+
858+ qos = fastdds .SubscriberQos ()
859+ ret = participant .get_subscriber_qos_from_xml (
860+ xml_content , qos , 'test_subscriber_profile' )
861+ assert (fastdds .RETCODE_OK == ret )
862+
863+ qos_no_name = fastdds .SubscriberQos ()
864+ ret = participant .get_subscriber_qos_from_xml (
865+ xml_content , qos_no_name )
866+ assert (fastdds .RETCODE_OK == ret )
867+
868+ # Non matching name takes the first subscriber found (the only one)
869+ assert (qos == qos_no_name )
870+
871+ assert (fastdds .RETCODE_OK ==
872+ factory .delete_participant (participant ))
873+
874+ def test_get_default_subscriber_qos_from_xml ():
875+
876+ with open ("test_xml_profile.xml" , "r" , encoding = "utf-8" ) as file :
877+ xml_content = file .read ()
878+
879+ factory = fastdds .DomainParticipantFactory .get_instance ()
880+ participant = factory .create_participant (
881+ 0 , fastdds .PARTICIPANT_QOS_DEFAULT )
882+
883+ default_qos = fastdds .SubscriberQos ()
884+ ret = participant .get_default_subscriber_qos_from_xml (
885+ xml_content , default_qos )
886+ assert (fastdds .RETCODE_OK == ret )
887+
888+ qos = fastdds .SubscriberQos ()
889+ ret = participant .get_subscriber_qos_from_xml (
890+ xml_content , qos , 'test_subscriber_profile' )
891+ assert (fastdds .RETCODE_OK == ret )
892+
893+ assert (default_qos == qos )
894+
895+ assert (fastdds .RETCODE_OK ==
896+ factory .delete_participant (participant ))
897+
898+ def test_get_topic_qos_from_xml ():
899+
900+ with open ("test_xml_profile.xml" , "r" , encoding = "utf-8" ) as file :
901+ xml_content = file .read ()
902+
903+ factory = fastdds .DomainParticipantFactory .get_instance ()
904+ participant = factory .create_participant (
905+ 0 , fastdds .PARTICIPANT_QOS_DEFAULT )
906+
907+ qos = fastdds .TopicQos ()
908+ ret = participant .get_topic_qos_from_xml (
909+ xml_content , qos , 'test_topic_profile' )
910+ assert (fastdds .RETCODE_OK == ret )
911+
912+ qos_no_name = fastdds .TopicQos ()
913+ ret = participant .get_topic_qos_from_xml (
914+ xml_content , qos_no_name )
915+ assert (fastdds .RETCODE_OK == ret )
916+
917+ # Non matching name takes the first topic found (the only one)
918+ assert (qos == qos_no_name )
919+
920+ assert (fastdds .RETCODE_OK ==
921+ factory .delete_participant (participant ))
922+
923+ def test_get_default_topic_qos_from_xml ():
924+
925+ with open ("test_xml_profile.xml" , "r" , encoding = "utf-8" ) as file :
926+ xml_content = file .read ()
927+
928+ factory = fastdds .DomainParticipantFactory .get_instance ()
929+ participant = factory .create_participant (
930+ 0 , fastdds .PARTICIPANT_QOS_DEFAULT )
931+
932+ default_qos = fastdds .TopicQos ()
933+ ret = participant .get_default_topic_qos_from_xml (
934+ xml_content , default_qos )
935+ assert (fastdds .RETCODE_OK == ret )
936+
937+ qos = fastdds .TopicQos ()
938+ ret = participant .get_topic_qos_from_xml (
939+ xml_content , qos , 'test_topic_profile' )
940+ assert (fastdds .RETCODE_OK == ret )
941+
942+ assert (default_qos == qos )
943+
944+ assert (fastdds .RETCODE_OK ==
945+ factory .delete_participant (participant ))
946+
947+ def test_get_requester_qos_from_xml ():
948+
949+ with open ("test_xml_profile.xml" , "r" , encoding = "utf-8" ) as file :
950+ xml_content = file .read ()
951+
952+ factory = fastdds .DomainParticipantFactory .get_instance ()
953+ participant = factory .create_participant (
954+ 0 , fastdds .PARTICIPANT_QOS_DEFAULT )
955+
956+ qos = fastdds .RequesterQos ()
957+ ret = participant .get_requester_qos_from_xml (
958+ xml_content , qos , 'test_requester_profile' )
959+ assert (fastdds .RETCODE_OK == ret )
960+
961+ qos_no_name = fastdds .RequesterQos ()
962+ ret = participant .get_requester_qos_from_xml (
963+ xml_content , qos_no_name )
964+ assert (fastdds .RETCODE_OK == ret )
965+
966+ # Non matching name takes the first requester found (the only one)
967+ assert (qos == qos_no_name )
968+
969+ assert (fastdds .RETCODE_OK ==
970+ factory .delete_participant (participant ))
971+
972+ def test_get_default_requester_qos_from_xml ():
973+
974+ with open ("test_xml_profile.xml" , "r" , encoding = "utf-8" ) as file :
975+ xml_content = file .read ()
976+
977+ factory = fastdds .DomainParticipantFactory .get_instance ()
978+ participant = factory .create_participant (
979+ 0 , fastdds .PARTICIPANT_QOS_DEFAULT )
980+
981+ default_qos = fastdds .RequesterQos ()
982+ ret = participant .get_default_requester_qos_from_xml (
983+ xml_content , default_qos )
984+ assert (fastdds .RETCODE_OK == ret )
985+
986+ qos = fastdds .RequesterQos ()
987+ ret = participant .get_requester_qos_from_xml (
988+ xml_content , qos , 'test_requester_profile' )
989+ assert (fastdds .RETCODE_OK == ret )
990+
991+ assert (default_qos == qos )
992+
993+ assert (fastdds .RETCODE_OK ==
994+ factory .delete_participant (participant ))
995+
996+ def test_get_replier_qos_from_xml ():
997+
998+ with open ("test_xml_profile.xml" , "r" , encoding = "utf-8" ) as file :
999+ xml_content = file .read ()
1000+
1001+ factory = fastdds .DomainParticipantFactory .get_instance ()
1002+ participant = factory .create_participant (
1003+ 0 , fastdds .PARTICIPANT_QOS_DEFAULT )
1004+
1005+ qos = fastdds .ReplierQos ()
1006+ ret = participant .get_replier_qos_from_xml (
1007+ xml_content , qos , 'test_replier_profile' )
1008+ assert (fastdds .RETCODE_OK == ret )
1009+
1010+ qos_no_name = fastdds .ReplierQos ()
1011+ ret = participant .get_replier_qos_from_xml (
1012+ xml_content , qos_no_name )
1013+ assert (fastdds .RETCODE_OK == ret )
1014+
1015+ # Non matching name takes the first replier found (the only one)
1016+ assert (qos == qos_no_name )
1017+
1018+ assert (fastdds .RETCODE_OK ==
1019+ factory .delete_participant (participant ))
1020+
1021+ def test_get_default_replier_qos_from_xml ():
1022+
1023+ with open ("test_xml_profile.xml" , "r" , encoding = "utf-8" ) as file :
1024+ xml_content = file .read ()
1025+
1026+ factory = fastdds .DomainParticipantFactory .get_instance ()
1027+ participant = factory .create_participant (
1028+ 0 , fastdds .PARTICIPANT_QOS_DEFAULT )
1029+
1030+ default_qos = fastdds .ReplierQos ()
1031+ ret = participant .get_default_replier_qos_from_xml (
1032+ xml_content , default_qos )
1033+ assert (fastdds .RETCODE_OK == ret )
1034+
1035+ qos = fastdds .ReplierQos ()
1036+ ret = participant .get_replier_qos_from_xml (
1037+ xml_content , qos , 'test_replier_profile' )
1038+ assert (fastdds .RETCODE_OK == ret )
1039+
1040+ assert (default_qos == qos )
1041+
1042+ assert (fastdds .RETCODE_OK ==
1043+ factory .delete_participant (participant ))
0 commit comments