3#include <boost/algorithm/string.hpp>
4#include <boost/test/included/unit_test.hpp>
6using namespace boost::unit_test_framework;
17 std::cout <<
"Enter XMLFileHandlerTest - readDocFile" << std::endl;
23 BOOST_CHECK_THROW(
xml_file_handler(
"uamapping_test_notwellformed.xml"), std::logic_error);
28 BOOST_CHECK(xmlHandlerTwo.
getNodeSet(
"//process_variable") != NULL);
32 std::cout <<
"Enter XMLFileHandlerTest - getContent" << std::endl;
35 xmlXPathObjectPtr result = xmlHandler.
getNodeSet(
37 "//process_variable[@sourceName='int8Array__s15']");
38 BOOST_CHECK(result != NULL);
39 xmlNodeSetPtr nodeset = NULL;
42 nodeset = result->nodesetval;
46 BOOST_CHECK(sourceVariableName !=
"");
52 vector<xmlNodePtr> nodeList = xmlHandler.
getNodesByName(nodeset->nodeTab[0]->children,
"destination");
53 BOOST_CHECK(nodeList.size() == 1);
57 BOOST_CHECK(unrollPath ==
"TestCaseForXMLFileHandlerTest::getContent/NorthSideLINAC/partB");
61 BOOST_CHECK(emptyContent ==
"");
65 BOOST_CHECK(path.size() == 1);
72 BOOST_CHECK(xmlHandler.
getNodeSet(
"//test") == NULL);
This class support any file interaction with a xml file.
static std::vector< xmlNodePtr > getNodesByName(xmlNodePtr startNode, const std::string &nodeName)
This methode return a list of all nodes with the given name nodeName starting by the given startNode.
xmlXPathObjectPtr getNodeSet(const std::string &xPathString)
This methode return a pointer of a xPath element depending of the given xPathString.
static std::string getContentFromNode(xmlNode *node)
This methode returns the value between a xml tag.
static std::vector< std::string > parseVariablePath(const std::string &variablePath, const std::string &seperator="/")
This methode splitt a given string bey the given seperators.
static std::string getAttributeValueFromNode(xmlNode *node, const std::string &attributeName)
This methode returns a value of the given attribute from the given node you want to know.
bool isDocSetted()
This Methode check if a document is currently setted.
static void readDocFile()
XMLFileHandlerTestSuite()
test_suite * init_unit_test_suite(int, char **)