1 /* $Id: test_router_flexml.cpp,v 1.6 2005-12-08 15:34:08 adam Exp $
2 Copyright (c) 2005, Index Data.
12 #include "router_flexml.hpp"
14 #define BOOST_AUTO_TEST_MAIN
15 #include <boost/test/auto_unit_test.hpp>
17 using namespace boost::unit_test;
19 class TFilter: public yp2::filter::Base {
21 void process(yp2::Package & package) const {};
25 BOOST_AUTO_UNIT_TEST( test_router_flexml_1 )
29 std::string xmlconf = "<?xml version=\"1.0\"?>\n"
30 "<yp2 xmlns=\"http://indexdata.dk/yp2/config/1\">\n"
31 "<start route=\"start\"/>\n"
33 "<filter id=\"front_default\" type=\"frontend-net\">\n"
36 "<filter id=\"log_cout\" type=\"log\">\n"
37 "<logfile>mylog.log</logfile>\n"
41 "<route id=\"start\">\n"
42 "<filter refid=\"front_default\"/>\n"
43 "<filter refid=\"log_cout\"/>\n"
48 yp2::RouterFleXML rflexml(xmlconf);
55 BOOST_AUTO_UNIT_TEST( test_router_flexml_2 )
57 bool got_xml_error = false;
60 std::string xmlconf_invalid = "<?xml version=\"1.0\"?>\n"
61 "<yp2 xmlns=\"http://indexdata.dk/yp2/config/1\">\n"
62 "<start route=\"start\"/>\n"
65 yp2::RouterFleXML rflexml(xmlconf_invalid);
67 catch ( yp2::RouterFleXML::XMLError &e) {
73 BOOST_CHECK(got_xml_error);
76 BOOST_AUTO_UNIT_TEST( test_router_flexml_3 )
80 std::string xmlconf = "<?xml version=\"1.0\"?>\n"
81 "<y:yp2 xmlns:y=\"http://indexdata.dk/yp2/config/1\">\n"
82 " <start route=\"start\"/>\n"
84 " <filter id=\"front_default\" type=\"frontend-net\">\n"
87 " <filter id=\"log_cout\" type=\"log\">\n"
88 " <logfile>mylog.log</logfile>\n"
92 " <route id=\"start\">\n"
93 " <filter refid=\"front_default\"/>\n"
94 " <filter refid=\"log_cout\"/>\n"
99 yp2::RouterFleXML rflexml(xmlconf);
111 * indent-tabs-mode: nil
112 * c-file-style: "stroustrup"
114 * vim: shiftwidth=4 tabstop=8 expandtab