Skip to content

Commit

Permalink
GH-452: Fix CTopoCreator ignores assets
Browse files Browse the repository at this point in the history
dds-topology: Fixed: A bug which caused dds::topology_api::CTopoCreator to ignore task assets. (GH-452)
  • Loading branch information
AnarManafov committed Jun 20, 2022
1 parent eb6b165 commit f1037ef
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
1 change: 1 addition & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Added: The command learned a new argument --inline-config. Content of this strin

### dds-topology
Fixed: Stability improvements.
Fixed: A bug which caused dds::topology_api::CTopoCreator to ignore task assets. (GH-452)
Added: A new groupName requirement. It can be used on task and collection. (GH-407)
Added: Open API to read/update/add topology variable. The CTopoVars class.
Added: Support for Task Assets. (GH-406)
Expand Down
13 changes: 10 additions & 3 deletions dds-topology-lib/src/TopoCreatorCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ void CTopoCreatorCore::save(boost::property_tree::ptree& _pt)
addDeclElements(element, declElements);
}

vector<CTopoBase::EType> declOrder{ CTopoBase::EType::TOPO_VARS, CTopoBase::EType::TOPO_PROPERTY,
CTopoBase::EType::REQUIREMENT, CTopoBase::EType::TRIGGER,
CTopoBase::EType::TASK, CTopoBase::EType::COLLECTION };
vector<CTopoBase::EType> declOrder{ CTopoBase::EType::TOPO_VARS, CTopoBase::EType::TOPO_PROPERTY,
CTopoBase::EType::ASSET, CTopoBase::EType::REQUIREMENT,
CTopoBase::EType::TRIGGER, CTopoBase::EType::TASK,
CTopoBase::EType::COLLECTION };

for (const auto& declType : declOrder)
{
Expand Down Expand Up @@ -134,6 +135,12 @@ void CTopoCreatorCore::addDeclElements(CTopoTask::Ptr_t _task, objectMap_t& _dec
_declElements[CTopoBase::EType::TOPO_PROPERTY][property.first] =
static_pointer_cast<CTopoBase>(property.second);
}

const auto& assets = _task->getAssets();
for (const auto& asset : assets)
{
_declElements[CTopoBase::EType::ASSET][asset->getName()] = static_pointer_cast<CTopoBase>(asset);
}

const auto& triggers = _task->getTriggers();
for (const auto& trigger : triggers)
Expand Down
2 changes: 1 addition & 1 deletion dds-topology-lib/src/TopoVars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void CTopoVars::initFromXML(const string& _filepath)
if (stream.is_open())
{
m_pPropTreePtr = make_unique<propTreePtr_t::element_type>();
read_xml(stream, *m_pPropTreePtr, xml_parser::no_comments|xml_parser::trim_whitespace);
read_xml(stream, *m_pPropTreePtr, xml_parser::no_comments | xml_parser::trim_whitespace);
stream.seekg(0);

initFromPropertyTree(*m_pPropTreePtr);
Expand Down
6 changes: 6 additions & 0 deletions dds-topology-lib/tests/topology_test_creator_1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<property name="property2" scope="global"/>
<property name="property3" scope="global"/>
<property name="property4" scope="global"/>
<asset name="asset1" type="inline" visibility="task" value="abc def ghi jkl mno"/>
<asset name="asset2" type="inline" visibility="global" value="# DDS user defaults"/>
<declrequirement name="requirement1" value=".+.gsi.de" type="hostname"/>
<declrequirement name="requirement2" value="server1.gsi.de" type="hostname"/>
<declrequirement name="requirement3" value="node2" type="wnname"/>
Expand Down Expand Up @@ -37,6 +39,10 @@
<name access="read">property1</name>
<name access="read">property2</name>
</properties>
<assets>
<name>asset1</name>
<name>asset2</name>
</assets>
</decltask>
<decltask name="task3">
<exe reachable="true">app3</exe>
Expand Down
6 changes: 6 additions & 0 deletions dds-topology-lib/tests/topology_test_creator_3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<property name="property2" scope="global"/>
<property name="property3" scope="global"/>
<property name="property4" scope="global"/>
<asset name="asset1" type="inline" visibility="task" value="abc def ghi jkl mno"/>
<asset name="asset2" type="inline" visibility="global" value="# DDS user defaults"/>
<declrequirement name="requirement1" value=".+.gsi.de" type="hostname"/>
<declrequirement name="requirement10" value=".+.gsi.de" type="hostname"/>
<declrequirement name="requirement2" value="server1.gsi.de" type="hostname"/>
Expand Down Expand Up @@ -62,6 +64,10 @@
<name access="read">property1</name>
<name access="read">property2</name>
</properties>
<assets>
<name>asset1</name>
<name>asset2</name>
</assets>
</decltask>
<decltask name="task3">
<exe reachable="true">app3</exe>
Expand Down

0 comments on commit f1037ef

Please sign in to comment.