Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[19505] Process environment variables on XML #3841

Merged
merged 25 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5b74a9f
Refs #19429. Added declaration of new proxy method.
MiguelCompany Sep 4, 2023
58433bc
Refs #19429. Added basic implementation of proxy method.
MiguelCompany Sep 4, 2023
c09f179
Refs #19429. Code refactor on XMLElementParser.
MiguelCompany Sep 5, 2023
95a607b
Refs #19429. Code refactor on XMLParser.
MiguelCompany Sep 5, 2023
9367326
Refs #19429. Code refactor on XMLEndpointParser.
MiguelCompany Sep 5, 2023
810e212
Refs #19429. Process environment variables.
MiguelCompany Sep 5, 2023
b411fcb
Refs #19429. Fix unit tests build.
MiguelCompany Sep 5, 2023
9912153
Refs #19429. Process environment vars on non-text values.
MiguelCompany Sep 6, 2023
2be15da
Refs #19429. Added log message when environment variable is not found.
MiguelCompany Sep 6, 2023
5a3fd0d
Refs #19429. Support reading values for binary properties.
MiguelCompany Sep 6, 2023
47a0f9c
Refs #19429. Include order.
MiguelCompany Sep 7, 2023
176126c
Refs #19429. Unit tests for internal method.
MiguelCompany Sep 11, 2023
ff28780
Refs #19429. Unit tests for profile load.
MiguelCompany Sep 11, 2023
52c951d
Refs #19429. Uncrustify.
MiguelCompany Sep 12, 2023
29a2484
Refs #19429. Fix linux build.
MiguelCompany Sep 12, 2023
fac01bb
Refs #19505 .Fix build on Mac.
MiguelCompany Sep 12, 2023
9856506
Refs #19505. Call base setup method on profile parser tests.
MiguelCompany Sep 12, 2023
b1dc0ee
Refs #19505. Rename xml file to avoid validation on tests.
MiguelCompany Sep 13, 2023
b1f3c32
Refs #19505. Add missing include.
MiguelCompany Sep 19, 2023
712affe
Refs #19505. Fix and document regular expression.
MiguelCompany Sep 19, 2023
ce92c32
Refs #19505. Add support for `AUTO` on data sharing.
MiguelCompany Sep 19, 2023
9507762
Refs #19505. Apply suggestions on tests.
MiguelCompany Sep 19, 2023
50438db
Refs #19505. Apply suggestion.
MiguelCompany Sep 19, 2023
154fdea
Refs #19505. Fix string literal to avoid uncrustify issues.
MiguelCompany Sep 19, 2023
f063f9c
Refs #19505. Update versions.md.
MiguelCompany Sep 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
533 changes: 280 additions & 253 deletions src/cpp/rtps/xmlparser/XMLElementParser.cpp

Large diffs are not rendered by default.

64 changes: 35 additions & 29 deletions src/cpp/rtps/xmlparser/XMLEndpointParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,34 @@
*
*/

#include <string>
#include <fastrtps/xmlparser/XMLEndpointParser.h>

#include <cstdlib>
#include <string>

#include <fastrtps/xmlparser/XMLEndpointParser.h>
#include <tinyxml2.h>

#include <fastdds/dds/log/Log.hpp>
#include <fastrtps/utils/TimeConversion.h>
#include <fastrtps/utils/IPLocator.h>
#include <fastdds/rtps/builtin/data/WriterProxyData.h>
#include <fastdds/rtps/builtin/data/ReaderProxyData.h>
#include <fastdds/rtps/builtin/data/WriterProxyData.h>
#include <fastrtps/utils/IPLocator.h>
#include <fastrtps/utils/TimeConversion.h>

#include <tinyxml2.h>
#include <rtps/xmlparser/XMLParserUtils.hpp>

namespace eprosima {
namespace fastrtps {
namespace xmlparser {

using namespace eprosima::fastrtps;
using namespace eprosima::fastrtps::rtps;
using namespace eprosima::fastrtps::xmlparser;
using namespace eprosima::fastdds::xml::detail;

XMLEndpointParser::XMLEndpointParser()
{
// TODO Auto-generated constructor stub

}

XMLEndpointParser::~XMLEndpointParser()
{
// TODO Auto-generated destructor stub
for (std::vector<StaticRTPSParticipantInfo*>::iterator pit = m_RTPSParticipants.begin();
pit != m_RTPSParticipants.end(); ++pit)
{
Expand Down Expand Up @@ -158,7 +160,7 @@ void XMLEndpointParser::loadXMLParticipantEndpoint(

if (key == NAME)
{
pdata->m_RTPSParticipantName = element->GetText();
pdata->m_RTPSParticipantName = get_element_text(element);
}
else if (key == READER)
{
Expand Down Expand Up @@ -236,7 +238,7 @@ XMLP_ret XMLEndpointParser::loadXMLReaderEndpoint(
std::string key(element->Name());
if (key == USER_ID)
{
int16_t id = static_cast<int16_t>(std::strtol(element->GetText(), nullptr, 10));
int16_t id = static_cast<int16_t>(std::strtol(get_element_text(element).c_str(), nullptr, 10));
if (id <= 0 || m_endpointIds.insert(id).second == false)
{
EPROSIMA_LOG_ERROR(RTPS_EDP, "Repeated or negative ID in XML file");
Expand All @@ -247,7 +249,7 @@ XMLP_ret XMLEndpointParser::loadXMLReaderEndpoint(
}
else if (key == ENTITY_ID)
{
int32_t id = std::strtol(element->GetText(), nullptr, 10);
int32_t id = std::strtol(get_element_text(element).c_str(), nullptr, 10);
if (id <= 0 || m_entityIds.insert(id).second == false)
{
EPROSIMA_LOG_ERROR(RTPS_EDP, "Repeated or negative entityId in XML file");
Expand All @@ -261,7 +263,7 @@ XMLP_ret XMLEndpointParser::loadXMLReaderEndpoint(
}
else if (key == EXPECT_INLINE_QOS)
{
std::string auxString(element->GetText());
std::string auxString(get_element_text(element));
if (auxString == "true")
{
rdata->m_expectsInlineQos = true;
Expand Down Expand Up @@ -314,15 +316,15 @@ XMLP_ret XMLEndpointParser::loadXMLReaderEndpoint(
}
else if (key == TOPIC_NAME)
{
rdata->topicName() = element->GetText();
rdata->topicName() = get_element_text(element);
}
else if (key == TOPIC_DATA_TYPE)
{
rdata->typeName() = element->GetText();
rdata->typeName() = get_element_text(element);
}
else if (key == TOPIC_KIND)
{
std::string auxString(element->GetText());
std::string auxString(get_element_text(element));
if (auxString == _NO_KEY)
{
rdata->topicKind() = NO_KEY;
Expand All @@ -342,7 +344,7 @@ XMLP_ret XMLEndpointParser::loadXMLReaderEndpoint(
}
else if (key == RELIABILITY_QOS)
{
std::string auxString(element->GetText());
std::string auxString(get_element_text(element));
if (auxString == _RELIABLE_RELIABILITY_QOS)
{
rdata->m_qos.m_reliability.kind = RELIABLE_RELIABILITY_QOS;
Expand All @@ -368,7 +370,7 @@ XMLP_ret XMLEndpointParser::loadXMLReaderEndpoint(
}
else if (key == DURABILITY_QOS)
{
std::string auxstring(element->GetText());
std::string auxstring(get_element_text(element));
if (auxstring == _PERSISTENT_DURABILITY_QOS)
{
rdata->m_qos.m_durability.kind = PERSISTENT_DURABILITY_QOS;
Expand Down Expand Up @@ -413,7 +415,7 @@ XMLP_ret XMLEndpointParser::loadXMLReaderEndpoint(
}
else if (key == PARTITION_QOS)
{
rdata->m_qos.m_partition.push_back(element->GetText());
rdata->m_qos.m_partition.push_back(get_element_text(element).c_str());
}
else if (key == LIVELINESS_QOS)
{
Expand Down Expand Up @@ -541,7 +543,7 @@ XMLP_ret XMLEndpointParser::loadXMLWriterEndpoint(
std::string key(element->Name());
if (key == USER_ID)
{
int16_t id = static_cast<int16_t>(std::strtol(element->GetText(), nullptr, 10));
int16_t id = static_cast<int16_t>(std::strtol(get_element_text(element).c_str(), nullptr, 10));
if (id <= 0 || m_endpointIds.insert(id).second == false)
{
EPROSIMA_LOG_ERROR(RTPS_EDP, "Repeated or negative ID in XML file");
Expand All @@ -552,7 +554,7 @@ XMLP_ret XMLEndpointParser::loadXMLWriterEndpoint(
}
else if (key == ENTITY_ID)
{
int32_t id = std::strtol(element->GetText(), nullptr, 10);
int32_t id = std::strtol(get_element_text(element).c_str(), nullptr, 10);
if (id <= 0 || m_entityIds.insert(id).second == false)
{
EPROSIMA_LOG_ERROR(RTPS_EDP, "Repeated or negative entityId in XML file");
Expand Down Expand Up @@ -603,15 +605,15 @@ XMLP_ret XMLEndpointParser::loadXMLWriterEndpoint(
}
else if (key == TOPIC_NAME)
{
wdata->topicName(std::string(element->GetText()));
wdata->topicName(std::string(get_element_text(element)));
}
else if (key == TOPIC_DATA_TYPE)
{
wdata->typeName(std::string(element->GetText()));
wdata->typeName(std::string(get_element_text(element)));
}
else if (key == TOPIC_KIND)
{
std::string auxString = std::string(element->GetText());
std::string auxString = std::string(get_element_text(element));
if (auxString == _NO_KEY)
{
wdata->topicKind(NO_KEY);
Expand All @@ -631,7 +633,7 @@ XMLP_ret XMLEndpointParser::loadXMLWriterEndpoint(
}
else if (key == RELIABILITY_QOS)
{
std::string auxString = std::string(element->GetText());
std::string auxString = std::string(get_element_text(element));
if (auxString == _RELIABLE_RELIABILITY_QOS)
{
wdata->m_qos.m_reliability.kind = RELIABLE_RELIABILITY_QOS;
Expand All @@ -657,7 +659,7 @@ XMLP_ret XMLEndpointParser::loadXMLWriterEndpoint(
}
else if (key == DURABILITY_QOS)
{
std::string auxstring = std::string(element->GetText());
std::string auxstring = std::string(get_element_text(element));
if (auxstring == _PERSISTENT_DURABILITY_QOS)
{
wdata->m_qos.m_durability.kind = PERSISTENT_DURABILITY_QOS;
Expand Down Expand Up @@ -705,7 +707,7 @@ XMLP_ret XMLEndpointParser::loadXMLWriterEndpoint(
}
else if (key == PARTITION_QOS)
{
wdata->m_qos.m_partition.push_back(element->GetText());
wdata->m_qos.m_partition.push_back(get_element_text(element).c_str());
}
else if (key == LIVELINESS_QOS)
{
Expand Down Expand Up @@ -831,3 +833,7 @@ XMLP_ret XMLEndpointParser::lookforWriter(
}
return XMLP_ret::XML_ERROR;
}

} // namespace xmlparser
} // namespace fastrtps
} // namespace eprosima
Loading
Loading