From 90df00349752a905495593dbe5fd5515a5739c29 Mon Sep 17 00:00:00 2001 From: Eduardo Ponz Segrelles Date: Tue, 30 Apr 2024 07:52:33 +0200 Subject: [PATCH] Fix support for `@key` annotation in Dynamic types (#4694) * Refs #20733: Fix support for key annotation in XML types Signed-off-by: eduponz * Refs #20733: Add test Signed-off-by: eduponz * Refs #20733: Move implementations to cpp Signed-off-by: eduponz * Refs #20733: Properly fix key annotation handling Signed-off-by: eduponz * Refs #20733: Apply Miguel's suggestions Signed-off-by: eduponz --------- Signed-off-by: eduponz (cherry picked from commit eaa23dbdea6ff2fa8259452be368ac8bcb273cc5) # Conflicts: # resources/xsd/fastRTPS_profiles.xsd # test/system/tools/xmlvalidation/XMLTesterExample_profile.xml # test/system/tools/xmlvalidation/all_profile.xml # test/system/tools/xmlvalidation/types_profile.xml --- include/fastrtps/types/MemberDescriptor.h | 91 +- .../fastrtps/xmlparser/XMLProfileManager.h | 14 +- resources/xsd/fastRTPS_profiles.xsd | 1112 ++++++++++++++++ .../dynamic-types/AnnotationDescriptor.cpp | 24 +- src/cpp/dynamic-types/DynamicType.cpp | 11 +- src/cpp/dynamic-types/MemberDescriptor.cpp | 47 +- src/cpp/rtps/xmlparser/XMLDynamicParser.cpp | 4 - src/cpp/rtps/xmlparser/XMLProfileManager.cpp | 16 + .../XMLTesterExample_profile.xml | 881 +++++++++++++ .../tools/xmlvalidation/all_profile.xml | 1158 +++++++++++++++++ .../tools/xmlvalidation/types_profile.xml | 134 ++ .../dynamic_types/DynamicTypesTests.cpp | 23 + test/unittest/dynamic_types/types.xml | 7 + 13 files changed, 3449 insertions(+), 73 deletions(-) create mode 100644 test/system/tools/xmlvalidation/XMLTesterExample_profile.xml create mode 100644 test/system/tools/xmlvalidation/all_profile.xml create mode 100644 test/system/tools/xmlvalidation/types_profile.xml diff --git a/include/fastrtps/types/MemberDescriptor.h b/include/fastrtps/types/MemberDescriptor.h index f7cdfcb4a1f..5a52948a4c7 100644 --- a/include/fastrtps/types/MemberDescriptor.h +++ b/include/fastrtps/types/MemberDescriptor.h @@ -18,9 +18,9 @@ #include #include -namespace eprosima{ -namespace fastrtps{ -namespace types{ +namespace eprosima { +namespace fastrtps { +namespace types { class DynamicType; class AnnotationDescriptor; @@ -28,6 +28,7 @@ class AnnotationDescriptor; class MemberDescriptor { protected: + std::string name_; // Name of the member MemberId id_; // MemberId, it should be filled automatically when the member is added. DynamicType_ptr type_; // Member's Type. @@ -43,11 +44,17 @@ class MemberDescriptor friend class DynamicTypeMember; friend class TypeObjectFactory; - bool is_default_value_consistent(const std::string& sDefaultValue) const; + bool is_default_value_consistent( + const std::string& sDefaultValue) const; + + bool is_type_name_consistent( + const std::string& sName) const; - bool is_type_name_consistent(const std::string& sName) const; + void copy_annotations_from_type( + const DynamicType_ptr& type); public: + RTPS_DllAPI MemberDescriptor(); RTPS_DllAPI MemberDescriptor( @@ -57,37 +64,41 @@ class MemberDescriptor RTPS_DllAPI MemberDescriptor( MemberId id, const std::string& name, - DynamicType_ptr type_); + DynamicType_ptr type); RTPS_DllAPI MemberDescriptor( MemberId id, const std::string& name, - DynamicType_ptr type_, + DynamicType_ptr type, const std::string& defaultValue); RTPS_DllAPI MemberDescriptor( MemberId id, const std::string& name, - DynamicType_ptr type_, + DynamicType_ptr type, const std::string& defaultValue, const std::vector& unionLabels, bool isDefaultLabel); - RTPS_DllAPI MemberDescriptor(const MemberDescriptor* descriptor); + RTPS_DllAPI MemberDescriptor( + const MemberDescriptor* descriptor); RTPS_DllAPI ~MemberDescriptor(); - bool check_union_labels(const std::vector& labels) const; + bool check_union_labels( + const std::vector& labels) const; - RTPS_DllAPI ReturnCode_t copy_from(const MemberDescriptor* other); + RTPS_DllAPI ReturnCode_t copy_from( + const MemberDescriptor* other); - RTPS_DllAPI bool equals(const MemberDescriptor* other) const; + RTPS_DllAPI bool equals( + const MemberDescriptor* other) const; RTPS_DllAPI TypeKind get_kind() const; RTPS_DllAPI MemberId get_id() const; - RTPS_DllAPI uint32_t get_index() const; + RTPS_DllAPI uint32_t get_index() const; RTPS_DllAPI std::string get_name() const; @@ -105,39 +116,49 @@ class MemberDescriptor RTPS_DllAPI bool is_default_union_value() const; - RTPS_DllAPI bool is_consistent(TypeKind parentKind) const; + RTPS_DllAPI bool is_consistent( + TypeKind parentKind) const; - RTPS_DllAPI void add_union_case_index(uint64_t value); + RTPS_DllAPI void add_union_case_index( + uint64_t value); - RTPS_DllAPI void set_id(MemberId id); + RTPS_DllAPI void set_id( + MemberId id); - RTPS_DllAPI void set_index(uint32_t index); + RTPS_DllAPI void set_index( + uint32_t index); - RTPS_DllAPI void set_name(const std::string& name); + RTPS_DllAPI void set_name( + const std::string& name); - RTPS_DllAPI void set_type(DynamicType_ptr type); + RTPS_DllAPI void set_type( + DynamicType_ptr type); RTPS_DllAPI DynamicType_ptr get_type() const { return type_; } - RTPS_DllAPI void set_default_union_value(bool bDefault); + RTPS_DllAPI void set_default_union_value( + bool bDefault); - RTPS_DllAPI void set_default_value(const std::string& value) + RTPS_DllAPI void set_default_value( + const std::string& value) { default_value_ = value; } // Annotations - ReturnCode_t apply_annotation(AnnotationDescriptor& descriptor); + ReturnCode_t apply_annotation( + AnnotationDescriptor& descriptor); ReturnCode_t apply_annotation( const std::string& annotation_name, const std::string& key, const std::string& value); - AnnotationDescriptor* get_annotation(const std::string& name) const; + AnnotationDescriptor* get_annotation( + const std::string& name) const; // Annotations application RTPS_DllAPI bool annotation_is_optional() const; @@ -168,23 +189,31 @@ class MemberDescriptor RTPS_DllAPI uint16_t annotation_get_bit_bound() const; // Annotations setters - RTPS_DllAPI void annotation_set_optional(bool optional); + RTPS_DllAPI void annotation_set_optional( + bool optional); - RTPS_DllAPI void annotation_set_key(bool key); + RTPS_DllAPI void annotation_set_key( + bool key); - RTPS_DllAPI void annotation_set_must_understand(bool must_understand); + RTPS_DllAPI void annotation_set_must_understand( + bool must_understand); - RTPS_DllAPI void annotation_set_non_serialized(bool non_serialized); + RTPS_DllAPI void annotation_set_non_serialized( + bool non_serialized); - RTPS_DllAPI void annotation_set_value(const std::string& value); + RTPS_DllAPI void annotation_set_value( + const std::string& value); - RTPS_DllAPI void annotation_set_default(const std::string& default_value); + RTPS_DllAPI void annotation_set_default( + const std::string& default_value); RTPS_DllAPI void annotation_set_default_literal(); - RTPS_DllAPI void annotation_set_position(uint16_t position); + RTPS_DllAPI void annotation_set_position( + uint16_t position); - RTPS_DllAPI void annotation_set_bit_bound(uint16_t bit_bound); + RTPS_DllAPI void annotation_set_bit_bound( + uint16_t bit_bound); }; } // namespace types diff --git a/include/fastrtps/xmlparser/XMLProfileManager.h b/include/fastrtps/xmlparser/XMLProfileManager.h index 49d07832b79..b133e16fdbe 100644 --- a/include/fastrtps/xmlparser/XMLProfileManager.h +++ b/include/fastrtps/xmlparser/XMLProfileManager.h @@ -244,24 +244,14 @@ class XMLProfileManager * XMLProfileManager::DeleteDynamicPubSubType method. */ RTPS_DllAPI static types::DynamicPubSubType* CreateDynamicPubSubType( - const std::string& type_name) - { - if (dynamic_types_.find(type_name) != dynamic_types_.end()) - { - return new types::DynamicPubSubType(dynamic_types_[type_name]->build()); - } - return nullptr; - } + const std::string& type_name); /** * Deletes the given DynamicPubSubType previously created by calling * XMLProfileManager::CreateDynamicPubSubType method. */ RTPS_DllAPI static void DeleteDynamicPubSubType( - types::DynamicPubSubType* type) - { - delete type; - } + types::DynamicPubSubType* type); private: diff --git a/resources/xsd/fastRTPS_profiles.xsd b/resources/xsd/fastRTPS_profiles.xsd index dc36d33a52c..b8e797c5bdb 100644 --- a/resources/xsd/fastRTPS_profiles.xsd +++ b/resources/xsd/fastRTPS_profiles.xsd @@ -45,6 +45,1118 @@ +<<<<<<< HEAD +======= + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>>>>>>> eaa23dbde (Fix support for `@key` annotation in Dynamic types (#4694)) diff --git a/src/cpp/dynamic-types/AnnotationDescriptor.cpp b/src/cpp/dynamic-types/AnnotationDescriptor.cpp index a615c34a951..73415c249ae 100644 --- a/src/cpp/dynamic-types/AnnotationDescriptor.cpp +++ b/src/cpp/dynamic-types/AnnotationDescriptor.cpp @@ -12,10 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include #include -#include +#include namespace eprosima { namespace fastrtps { @@ -86,17 +87,28 @@ bool AnnotationDescriptor::equals(const AnnotationDescriptor* other) const bool AnnotationDescriptor::key_annotation() const { - auto it = value_.find(ANNOTATION_KEY_ID); - if (it == value_.end()) + bool ret = false; + + // Annotations @key and @Key have names "key" and "Key" respectively. + if (type_ && (type_->get_name() == ANNOTATION_KEY_ID || type_->get_name() == ANNOTATION_EPKEY_ID)) { - it = value_.find(ANNOTATION_EPKEY_ID); // Legacy "@Key" + // When an annotation is a key annotation, there is only one entry in value_. + // Its map key is ANNOTATION_VALUE_ID and its value is either "true" of "false". + // We cannot call get_value() directly because it is not const-qualified + auto it = value_.find(ANNOTATION_VALUE_ID); + + if (it != value_.end()) + { + ret = it->second == CONST_TRUE; + } } - return (it != value_.end() && it->second == CONST_TRUE); + + return ret; } ReturnCode_t AnnotationDescriptor::get_value(std::string& value) { - return get_value(value, "value"); + return get_value(value, ANNOTATION_VALUE_ID); } ReturnCode_t AnnotationDescriptor::get_value( diff --git a/src/cpp/dynamic-types/DynamicType.cpp b/src/cpp/dynamic-types/DynamicType.cpp index ea8a13d7faa..7ea1581d3db 100644 --- a/src/cpp/dynamic-types/DynamicType.cpp +++ b/src/cpp/dynamic-types/DynamicType.cpp @@ -191,7 +191,7 @@ ReturnCode_t DynamicType::copy_from_builder( { DynamicTypeMember* newMember = new DynamicTypeMember(it->second); newMember->set_parent(this); - is_key_defined_ = newMember->key_annotation(); + is_key_defined_ |= newMember->key_annotation(); member_by_id_.insert(std::make_pair(newMember->get_id(), newMember)); member_by_name_.insert(std::make_pair(newMember->get_name(), newMember)); } @@ -245,14 +245,7 @@ TypeDescriptor* DynamicType::get_descriptor() bool DynamicType::key_annotation() const { - for (auto anIt = descriptor_->annotation_.begin(); anIt != descriptor_->annotation_.end(); ++anIt) - { - if ((*anIt)->key_annotation()) - { - return true; - } - } - return false; + return descriptor_->annotation_get_key(); } bool DynamicType::equals( diff --git a/src/cpp/dynamic-types/MemberDescriptor.cpp b/src/cpp/dynamic-types/MemberDescriptor.cpp index 3a906433f2c..5339a7539a9 100644 --- a/src/cpp/dynamic-types/MemberDescriptor.cpp +++ b/src/cpp/dynamic-types/MemberDescriptor.cpp @@ -12,12 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include -#include +#include #include +#include #include -#include +#include +#include +#include namespace eprosima { namespace fastrtps { @@ -31,6 +32,7 @@ MemberDescriptor::MemberDescriptor() , index_(INDEX_INVALID) , default_label_(false) { + copy_annotations_from_type(type_); } MemberDescriptor::MemberDescriptor( @@ -43,6 +45,7 @@ MemberDescriptor::MemberDescriptor( , index_(index) , default_label_(false) { + copy_annotations_from_type(type_); } MemberDescriptor::MemberDescriptor( @@ -55,51 +58,54 @@ MemberDescriptor::MemberDescriptor( , default_label_(false) { copy_from(descriptor); + copy_annotations_from_type(type_); } MemberDescriptor::MemberDescriptor( MemberId id, const std::string& name, - DynamicType_ptr type_) + DynamicType_ptr type) : name_(name) , id_(id) - , type_(type_) + , type_(type) , default_value_("") , index_(INDEX_INVALID) , default_label_(false) { - + copy_annotations_from_type(type_); } MemberDescriptor::MemberDescriptor( MemberId id, const std::string& name, - DynamicType_ptr type_, + DynamicType_ptr type, const std::string& defaultValue) : name_(name) , id_(id) - , type_(type_) + , type_(type) , default_value_(defaultValue) , index_(INDEX_INVALID) , default_label_(false) { + copy_annotations_from_type(type_); } MemberDescriptor::MemberDescriptor( MemberId id, const std::string& name, - DynamicType_ptr type_, + DynamicType_ptr type, const std::string& defaultValue, const std::vector& unionLabels, bool isDefaultLabel) : name_(name) , id_(id) - , type_(type_) + , type_(type) , default_value_(defaultValue) , index_(INDEX_INVALID) , default_label_(isDefaultLabel) { labels_ = unionLabels; + copy_annotations_from_type(type_); } MemberDescriptor::~MemberDescriptor() @@ -411,6 +417,25 @@ bool MemberDescriptor::is_type_name_consistent( return TypeDescriptor::is_type_name_consistent(sName); } +void MemberDescriptor::copy_annotations_from_type( + const DynamicType_ptr& type) +{ + if (type) + { + // Copy annotations from type + uint32_t num_annotations = type->get_annotation_count(); + for (uint32_t i = 0; i < num_annotations; ++i) + { + AnnotationDescriptor ann; + type->get_annotation(ann, i); + AnnotationDescriptor* pNewDescriptor = new AnnotationDescriptor(); + pNewDescriptor->copy_from(&ann); + annotation_.push_back(pNewDescriptor); + } + } + +} + void MemberDescriptor::set_id( MemberId id) { diff --git a/src/cpp/rtps/xmlparser/XMLDynamicParser.cpp b/src/cpp/rtps/xmlparser/XMLDynamicParser.cpp index d59bef2244e..42bbbaa746e 100644 --- a/src/cpp/rtps/xmlparser/XMLDynamicParser.cpp +++ b/src/cpp/rtps/xmlparser/XMLDynamicParser.cpp @@ -1398,10 +1398,6 @@ p_dynamictypebuilder_t XMLParser::parseXMLMemberDynamicType( if (strncmp(memberTopicKey, "true", 5) == 0) { memberBuilder->apply_annotation(types::ANNOTATION_KEY_ID, "value", "true"); - if (p_dynamictype != nullptr) - { - p_dynamictype->apply_annotation(types::ANNOTATION_KEY_ID, "value", "true"); - } } } diff --git a/src/cpp/rtps/xmlparser/XMLProfileManager.cpp b/src/cpp/rtps/xmlparser/XMLProfileManager.cpp index 8433ee09e63..06cd221ad00 100644 --- a/src/cpp/rtps/xmlparser/XMLProfileManager.cpp +++ b/src/cpp/rtps/xmlparser/XMLProfileManager.cpp @@ -357,6 +357,22 @@ XMLP_ret XMLProfileManager::loadXMLString( return loaded_ret; } +types::DynamicPubSubType* XMLProfileManager::CreateDynamicPubSubType( + const std::string& type_name) +{ + if (dynamic_types_.find(type_name) != dynamic_types_.end()) + { + return new types::DynamicPubSubType(dynamic_types_[type_name]->build()); + } + return nullptr; +} + +void XMLProfileManager::DeleteDynamicPubSubType( + types::DynamicPubSubType* type) +{ + delete type; +} + XMLP_ret XMLProfileManager::extractProfiles( up_base_node_t profiles, const std::string& filename) diff --git a/test/system/tools/xmlvalidation/XMLTesterExample_profile.xml b/test/system/tools/xmlvalidation/XMLTesterExample_profile.xml new file mode 100644 index 00000000000..3e164f6c851 --- /dev/null +++ b/test/system/tools/xmlvalidation/XMLTesterExample_profile.xml @@ -0,0 +1,881 @@ + + + + + + + ExampleTransportId1 + TCPv4 + 8192 + 8192 + 16384 + 100 + +
192.168.1.41
+
127.0.0.1
+
+ 80.80.55.44 + 5000 + 25000 + 200 + 20 + 2 + + 5100 + 5200 + + + Password + Key_file.pem + RSA_file.pem + Chain.pem + DH.pem + verify.pem + + VERIFY_PEER + + + + + + + Path1 + Path2 + Path3 + + 55 + true + SERVER + my_server.com + + false + false + false + false + 100 +
+ + + ExampleTransportId2 + UDPv6 + 250 + false + 5101 + + + + SHM_SAMPLE_DESCRIPTOR + SHM + 524288 + 1048576 + 1024 + 250 + test_file.dump + +
+ + + 1 + + Participant Name + + + + + + 7400 +
localhost
+
+
+ + + + 5100 + 7400 + 192.168.1.1.1.1.2.55 + 80.80.99.45 +
192.168.1.55
+
+
+ + + 8844 +
::1
+
+
+
+ + + + + + 7400 +
192.168.1.41
+
+
+ + + + 5100 + 7400 + 192.168.1.1.1.1.2.55 + 80.80.99.45 +
192.168.1.55
+
+
+ + + 8844 +
::1
+
+
+
+ + + + +
100.100.100.10
+ 23456 +
+ +
::1
+ 1234 +
+
+ + true + 8192 + 8192 + + + + NONE + FILTER_DIFFERENT_PROCESS|FILTER_SAME_PROCESS + SIMPLE + + true + true + + + DURATION_INFINITY + + + 1 + 856000 + + + 10 + + 50 + + + filename.xml + + + true + false + + + + + + 7400 +
192.168.1.41
+
+
+ + + + 5100 + 7400 + 192.168.1.1.1.1.2.55 + 80.80.99.45 +
192.168.1.55
+
+
+ + + 8844 +
::1
+
+
+
+ + + + + + 7400 +
192.168.1.41
+
+
+ + + + 5100 + 7400 + 192.168.1.1.1.1.2.55 + 80.80.99.45 +
192.168.1.55
+
+
+ + + 8844 +
::1
+
+
+
+ + + + + + 7400 +
192.168.1.41
+
+
+ + + + 5100 + 7400 + 192.168.1.1.1.1.2.55 + 80.80.99.45 +
192.168.1.55
+
+
+ + + 8844 +
::1
+
+
+
+ + + +
100.100.100.10
+ 34567 +
+
+ + PREALLOCATED_WITH_REALLOC + PREALLOCATED + 512 + 512 + 55 +
+ + + 7400 + 200 + 10 + 0 + 1 + 2 + 3 + + + 99 + + + ExampleTransportId1 + ExampleTransportId2 + + + false + + + + + Property1Name + Property1Value + false + + + Property2Name + Property2Value + false + + + + + binary_prop_a + false + + + binary_prop_b + true + + + + + + + 4 + 1 + + + 0 + 0 + 1 + + + 0 + 0 + 1 + + + 0 + 0 + 1 + + 256 + 256 + 512 + + 113 + true + + +
+
+ + + + + KEEP_LAST + 20 + + + 5 + 2 + 1 + 20 + 10 + + + + + AUTOMATIC + /home + 10 + + 0 + 11 + + + + + 1 + + + true + + true + + 1 + + + + VOLATILE + + + + + 1 + + + + + 5 + + + + AUTOMATIC + + 1 + 856000 + + + 1 + 856000 + + + + EXCLUSIVE + + + 50 + + + + part1 + part2 + + + + ASYNCHRONOUS + + + BEST_EFFORT + + 1 + 856000 + + + + + + + 1 + 856000 + + + 1 + 856000 + + + 1 + 856000 + + + 1 + 856000 + + + + + + + + 7400 +
192.168.1.41
+
+
+ + + + 5100 + 7400 + 192.168.1.1.1.1.2.55 + 80.80.99.45 +
192.168.1.55
+
+
+ + + 8844 +
::1
+
+
+
+ + + + + + 7400 +
192.168.1.41
+
+
+ + + + 5100 + 7400 + 192.168.1.1.1.1.2.55 + 80.80.99.45 +
192.168.1.55
+
+
+ + + 8844 +
::1
+
+
+
+ + + +
100.100.100.10
+ 12345 +
+
+ + true + DYNAMIC + + + + + Property1Name + Property1Value + false + + + Property2Name + Property2Value + false + + + + + 45 + 76 + + + 3 + 3 + 0 + +
+ + + + + KEEP_LAST + 20 + + + 5 + 2 + 1 + 20 + 10 + + + + + AUTOMATIC + /home + 10 + + 0 + 11 + + + + + 1 + + + + true + + 1 + + + + PERSISTENT + + + + + 1 + + + + + 5 + + + + MANUAL_BY_PARTICIPANT + + 1 + 856000 + + + 1 + 856000 + + + + EXCLUSIVE + + + + part1 + part2 + + + + BEST_EFFORT + + 1 + 856000 + + + + + + + 1 + 856000 + + + 1 + 856000 + + + + + + + + 7400 +
192.168.1.41
+
+
+ + + + 5100 + 7400 + 192.168.1.1.1.1.2.55 + 80.80.99.45 +
192.168.1.55
+
+
+ + + 8844 +
::1
+
+
+
+ + + + + + 7400 +
192.168.1.41
+
+
+ + + + 5100 + 7400 + 192.168.1.1.1.1.2.55 + 80.80.99.45 +
192.168.1.55
+
+
+ + + 8844 +
::1
+
+
+
+ + + +
100.100.100.10
+ 12345 +
+
+ + true + true + DYNAMIC + + + + + Property1Name + Property1Value + false + + + Property2Name + Property2Value + false + + + + + 55 + 66 + + + 1 + 1 + 0 + +
+ + + + KEEP_LAST + 20 + + + 5 + 2 + 1 + 20 + 5 + + +
+ + + false + + + StdoutConsumer + + + + StdoutErrConsumer + + stderr_threshold + Log::Kind::Warning + + + + + FileConsumer + + filename + execution.log + + + append + TRUE + + + + + 12 + 12 + 12 + 12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OFF + +
diff --git a/test/system/tools/xmlvalidation/all_profile.xml b/test/system/tools/xmlvalidation/all_profile.xml new file mode 100644 index 00000000000..eb99327767f --- /dev/null +++ b/test/system/tools/xmlvalidation/all_profile.xml @@ -0,0 +1,1158 @@ + + + + + 1 + + DomainParticipant Name + + + + + 7400 +
192.168.1.41
+
+
+ + + 7401 +
192.168.1.41
+
+
+ + + 7402 +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+
+
+ + + 7403 + 8403 +
192.168.1.41
+ 192.168.1.1.1.1.1.41 + 192.168.2.41 +
+
+ + + 7404 + 8404 +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+
+
+
+ + + + + 7400 +
192.168.2.41
+
+
+ + + 7401 +
192.168.2.41
+
+
+ + + 7402 +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+
+
+ + + 7403 + 8403 +
192.168.2.41
+ 192.168.1.1.1.1.2.41 + 192.168.3.41 +
+
+ + + 7404 + 8404 +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+
+
+
+ + + +
100.100.100.10
+ 23456 +
+ +
100.100.100.11
+ 23456 +
+ +
100.100.100.12
+ 23456 +
+ +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+ 34567 +
+
+ + true + + 8192 + + 8192 + + + + CLIENT + + + + + + +
192.168.10.57
+ 56542 +
+
+
+
+
+ + FILTER_DIFFERENT_HOST + + SIMPLE + + + true + true + + + + 20 + + + + 3 + + + + 5 + + 10000 + + + + file://filename.xml +
+ + true + + false + + + + + 7400 +
192.168.1.41
+
+
+ + + 7401 +
192.168.1.41
+
+
+ + + 7402 +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+
+
+ + + 7403 + 8403 +
192.168.1.41
+ 192.168.1.1.1.1.1.41 + 192.168.2.41 +
+
+ + + 7404 + 8404 +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+
+
+
+ + + + + 7400 +
192.168.2.41
+
+
+ + + 7401 +
192.168.2.41
+
+
+ + + 7402 +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+
+
+ + + 7403 + 8403 +
192.168.2.41
+ 192.168.1.1.1.1.2.41 + 192.168.3.41 +
+
+ + + 7404 + 8404 +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+
+
+
+ + + + + 7400 +
192.168.3.41
+
+
+ + + 7401 +
192.168.3.41
+
+
+ + + 7402 +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+
+
+ + + 7403 + 8403 +
192.168.3.41
+ 192.168.1.1.1.1.2.41 + 192.168.4.41 +
+
+ + + 7404 + 8404 +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+
+
+
+ + + +
100.100.100.10
+ 23456 +
+ +
100.100.100.11
+ 23456 +
+ +
100.100.100.12
+ 23456 +
+ +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+ 34567 +
+
+ + PREALLOCATED_WITH_REALLOC + + 512 + + PREALLOCATED_WITH_REALLOC + + 512 + + 55 + + + true + true + +
+ + + 7400 + 200 + 10 + 0 + 1 + 2 + 3 + + + 99 + + + TransportId1 + TransportId2 + + + false + + + + + Property1Name + Property1Value + false + + + Property2Name + Property2Value + true + + + + + binary_prop_a + false + + + binary_prop_b + true + + + + + + + 4 + 1 + + + + 0 + 0 + 1 + + + + 0 + 0 + 1 + + + + 0 + 0 + 1 + + + 256 + + 256 + + 512 + + + 113 + false + + +
+
+ + + + + VOLATILE + + + AUTOMATIC + + 1 + 856000 + + + 1 + 856000 + + + + BEST_EFFORT + + 1 + 856000 + + + + + 5 + + + + + part1 + part2 + part3 + + + + + 5 + + + + + EXCLUSIVE + + + + 50 + + + + + 1 + + + + true + + + ASYNCHRONOUS + + + + true + + 1 + + + + + AUTOMATIC + /home + 10 + + 0 + 11 + + + + + + + 12 + + + + 3 + + + + 5 + + + + 0 + + + + + + + 7400 +
192.168.1.41
+
+
+ + + 7401 +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+
+
+ + + 7402 +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+
+
+ + + 7403 + 8403 +
192.168.1.41
+ 192.168.1.1.1.1.1.41 + 192.168.2.41 +
+
+ + + 7404 + 8404 +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+
+
+
+ + + + + 7400 +
192.168.2.41
+
+
+ + + 7401 +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+
+
+ + + 7402 + 8402 +
192.168.2.41
+ 192.168.1.1.1.1.2.41 + 192.168.3.41 +
+
+ + + 7403 + 8403 +
192.168.2.41
+ 192.168.1.1.1.1.2.41 + 192.168.3.41 +
+
+ + + 7404 + 8404 +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+
+
+
+ + + +
100.100.100.10
+ 23456 +
+ +
100.100.100.11
+ 23456 +
+ +
100.100.100.12
+ 23456 +
+ +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+ 34567 +
+
+ + true + + DYNAMIC + + + 3 + 3 + 0 + + + + + + Property1Name + Property1Value + false + + + Property2Name + Property2Value + true + + + + + 45 + + 76 +
+ + + + + VOLATILE + + + AUTOMATIC + + 1 + 856000 + + + 1 + 856000 + + + + BEST_EFFORT + + 1 + 856000 + + + + + 5 + + + + + part1 + part2 + part3 + + + + + 5 + + + + + EXCLUSIVE + + + + + 1 + + + + + true + + 1 + + + + + AUTOMATIC + /home + 10 + + 0 + 11 + + + + + + + 12 + + + + 3 + + + + + + + 7400 +
192.168.1.41
+
+
+ + + 7401 +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+
+
+ + + 7402 +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+
+
+ + + 7403 + 8403 +
192.168.1.41
+ 192.168.1.1.1.1.1.41 + 192.168.2.41 +
+
+ + + 7404 + 8404 +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+
+
+
+ + + + + 7400 +
192.168.2.41
+
+
+ + + 7401 +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+
+
+ + + 7402 + 8402 +
192.168.2.41
+ 192.168.1.1.1.1.2.41 + 192.168.3.41 +
+
+ + + 7403 + 8403 +
192.168.2.41
+ 192.168.1.1.1.1.2.41 + 192.168.3.41 +
+
+ + + 7404 + 8404 +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+
+
+
+ + + +
100.100.100.10
+ 23456 +
+ +
100.100.100.11
+ 23456 +
+ +
100.100.100.12
+ 23456 +
+ +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+ 34567 +
+
+ + true + + false + + DYNAMIC + + + 3 + 3 + 0 + + + + + + Property1Name + Property1Value + false + + + Property2Name + Property2Value + true + + + + + 45 + + 76 +
+ + + + udp4TransportDescriptor + UDPv4 + 8192 + 8192 + 16384 + 100 + +
192.168.1.41
+
127.0.0.1
+
+ 250 + false + 5101 +
+ + + udp6TransportDescriptor + UDPv6 + 8192 + 8192 + 16384 + 100 + +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+
8a2e:0370:7334:0000:0000:2001:0db8:85a3
+
+ 250 + false + 5101 +
+ + + tcp4TransportDescriptor + TCPv4 + 8192 + 8192 + 16384 + 100 + +
192.168.1.41
+
127.0.0.1
+
+ 80.80.55.44 + 5000 + 25000 + 200 + 20 + 2 + + 5100 + 5200 + + + Password + Key_file.pem + RSA_file.pem + Chain.pem + DH.pem + verify.pem + + VERIFY_PEER + VERIFY_FAIL_IF_NO_PEER_CERT + + + Path1 + Path2 + Path3 + + 55 + true + + + + + SERVER + my_server.com + + false + false + false + false + 100 +
+ + + tcp6TransportDescriptor + TCPv6 + 8192 + 8192 + 16384 + 100 + +
2001:0db8:85a3:0000:0000:8a2e:0370:7334
+
8a2e:0370:7334:0000:0000:2001:0db8:85a3
+
+ 5000 + 25000 + 200 + 20 + 2 + + 5100 + 5200 + + + Password + Key_file.pem + RSA_file.pem + Chain.pem + DH.pem + verify.pem + + VERIFY_PEER + VERIFY_FAIL_IF_NO_PEER_CERT + + + Path1 + Path2 + Path3 + + 55 + true + + + + + SERVER + my_server.com + + false + false + false + 100 +
+ + + shmTransportDescriptor + SHM + 8192 + 8192 + 16384 + 100 + 1048576 + 1024 + 250 + test_file.dump + +
+ + + + KEEP_LAST + 20 + + + 5 + 2 + 1 + 20 + 5 + + +
+ + + false + + + StdoutConsumer + + + + StdoutErrConsumer + + stderr_threshold + Log::Kind::Error + + + + + StdoutErrConsumer + + stderr_threshold + Log::Kind::Warning + + + + + FileConsumer + + filename + execution.log + + + append + true + + + + + -1 + 0 + 0 + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OFF + +
diff --git a/test/system/tools/xmlvalidation/types_profile.xml b/test/system/tools/xmlvalidation/types_profile.xml new file mode 100644 index 00000000000..71efc643154 --- /dev/null +++ b/test/system/tools/xmlvalidation/types_profile.xml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/unittest/dynamic_types/DynamicTypesTests.cpp b/test/unittest/dynamic_types/DynamicTypesTests.cpp index 44e1584c432..bb56424c10c 100644 --- a/test/unittest/dynamic_types/DynamicTypesTests.cpp +++ b/test/unittest/dynamic_types/DynamicTypesTests.cpp @@ -4942,6 +4942,29 @@ TEST_F(DynamicTypesTests, DynamicType_XML_Bitmask_test) } } +TEST_F(DynamicTypesTests, DynamicType_XML_key_annotation) +{ + using namespace xmlparser; + using namespace types; + + XMLP_ret ret = XMLProfileManager::loadXMLFile(DynamicTypesTests::config_file()); + ASSERT_EQ(ret, XMLP_ret::XML_OK); + + { + DynamicPubSubType* pbType = XMLProfileManager::CreateDynamicPubSubType("BoolStruct"); + ASSERT_FALSE(pbType->m_isGetKeyDefined); + XMLProfileManager::DeleteDynamicPubSubType(pbType); + } + + { + DynamicPubSubType* pbType = XMLProfileManager::CreateDynamicPubSubType("my_keyed_struct"); + ASSERT_TRUE(pbType->m_isGetKeyDefined); + XMLProfileManager::DeleteDynamicPubSubType(pbType); + } + + XMLProfileManager::DeleteInstance(); +} + TEST(TypeIdentifierTests, MinimalTypeIdentifierComparision) { TypeIdentifier enum1 = *GetMyEnumIdentifier(false); diff --git a/test/unittest/dynamic_types/types.xml b/test/unittest/dynamic_types/types.xml index 21a7ddddabe..9be040a2d95 100644 --- a/test/unittest/dynamic_types/types.xml +++ b/test/unittest/dynamic_types/types.xml @@ -268,4 +268,11 @@ + + + + + + +