OpenSDN source code
test_xml_validate.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
3  * Copyright Contributors to the OpenSDN project
4  */
5 
6 #ifndef vnsw_agent_test_xml_test_xml_validate_h
7 #define vnsw_agent_test_xml_test_xml_validate_h
8 
9 #include <iostream>
10 #include <vector>
11 #include <pugixml/pugixml.hpp>
12 #include <boost/uuid/uuid.hpp>
13 
14 #include <base/util.h>
15 
16 class AgentUtXmlTestCase;
17 class AgentUtXmlNode;
18 
20 // Validate nodes
23 
25 private:
26  typedef std::vector<AgentUtXmlValidationNode *> AgentUtXmlValidationList;
27 public:
28  AgentUtXmlValidate(const std::string &name, const pugi::xml_node &node,
31 
32  virtual bool ReadXml();
33  virtual bool ToXml(pugi::xml_node *parent);
34  virtual std::string NodeType();
35  virtual void ToString(std::string *str);
36  virtual bool Run();
37 private:
39 };
40 
42 public:
43  AgentUtXmlValidationNode(const std::string &name,
44  const pugi::xml_node &node);
45  virtual ~AgentUtXmlValidationNode();
46 
47  virtual bool ReadXml() = 0;
48  virtual bool Validate() = 0;
49  virtual const std::string ToString() = 0;
50 
51  bool ReadCmnXml();
52  const std::string &name() const { return name_; }
53  uint16_t id() const { return id_; }
54  bool delete_marked() const { return delete_marked_; }
55  bool present() const { return present_; }
56  const pugi::xml_node &node() const { return node_; }
57  virtual uint32_t wait_count() const { return 500; }
58  virtual uint32_t sleep_time() const { return 500; }
59 
60 private:
61  std::string name_;
62  pugi::xml_node node_;
63  bool present_;
65  uint16_t id_;
66 };
67 
68 #endif //vnsw_agent_test_xml_test_xml_validate_h
const pugi::xml_node & node() const
Definition: test_xml.h:132
AgentUtXmlTestCase * test_case()
Definition: test_xml.h:133
const std::string & name() const
Definition: test_xml.h:131
virtual std::string NodeType()
virtual bool ToXml(pugi::xml_node *parent)
std::vector< AgentUtXmlValidationNode * > AgentUtXmlValidationList
AgentUtXmlValidationList node_list_
virtual void ToString(std::string *str)
virtual bool ReadXml()
AgentUtXmlValidate(const std::string &name, const pugi::xml_node &node, AgentUtXmlTestCase *test_case)
virtual uint32_t sleep_time() const
const pugi::xml_node & node() const
virtual uint32_t wait_count() const
const std::string & name() const
virtual const std::string ToString()=0
AgentUtXmlValidationNode(const std::string &name, const pugi::xml_node &node)