X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=src%2Ftest_router_flexml.cpp;h=8cfbf87ead04f7eabfbd2e60f70c52a2d0263e81;hb=ad428707d2a52bbe4db21e47c5ebb26e13598484;hp=e9eec52f081822eb836eae464731488db4294c54;hpb=c859210e9c315c0f15c93fc6f65477a6c3e65d14;p=metaproxy-moved-to-github.git diff --git a/src/test_router_flexml.cpp b/src/test_router_flexml.cpp index e9eec52..8cfbf87 100644 --- a/src/test_router_flexml.cpp +++ b/src/test_router_flexml.cpp @@ -1,4 +1,4 @@ -/* $Id: test_router_flexml.cpp,v 1.1 2005-10-26 14:12:00 marc Exp $ +/* $Id: test_router_flexml.cpp,v 1.9 2006-01-04 11:55:32 adam Exp $ Copyright (c) 2005, Index Data. %LICENSE% @@ -10,6 +10,7 @@ #include "filter.hpp" #include "router_flexml.hpp" +#include "filter_factory.hpp" #define BOOST_AUTO_TEST_MAIN #include @@ -22,43 +23,100 @@ public: }; -BOOST_AUTO_TEST_CASE( test_router_flexml_1 ) +BOOST_AUTO_UNIT_TEST( test_router_flexml_1 ) { - try{ - TFilter filter; - - std::string xmlconf = "" - "" - "" - "" - "" - "210" - "" - "" - "mylog.log" - "" - "" - "" - "" - "" - "" - "" - "" - ""; - + try + { + std::string xmlconf = "\n" + "\n" + " \n" + " \n" + " \n" + " 210\n" + " \n" + " \n" + " mylog1.log\n" + " \n" + " \n" + " mylog2.log\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "\n"; yp2::RouterFleXML rflexml(xmlconf); - - - BOOST_CHECK (true); + } + catch ( yp2::RouterFleXML::XMLError &e) { + std::cout << "XMLError: " << e.what() << "\n"; + BOOST_CHECK (false); + } + catch ( yp2::FilterFactoryException &e) { + std::cout << "FilterFactoryException: " << e.what() << "\n"; + BOOST_CHECK (false); + } + catch ( ... ) { + BOOST_CHECK (false); + } +} - //BOOST_CHECK_EQUAL(filter.name(), std::string("filter1")); +BOOST_AUTO_UNIT_TEST( test_router_flexml_2 ) +{ + bool got_xml_error = false; + try + { + std::string xmlconf_invalid = "\n" + "\n" + " \n" + " \n" + " \n" + " 210\n"; + yp2::RouterFleXML rflexml(xmlconf_invalid); + } + catch ( yp2::RouterFleXML::XMLError &e) { + got_xml_error = true; + } + catch ( ... ) { + ; + } + BOOST_CHECK(got_xml_error); +} + +BOOST_AUTO_UNIT_TEST( test_router_flexml_3 ) +{ + try + { + std::string xmlconf = "\n" + "\n" + " \n" + " \n" + " \n" + " 210\n" + " \n" + " \n" + " mylog.log\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "\n"; + + yp2::RouterFleXML rflexml(xmlconf); } catch ( ... ) { BOOST_CHECK (false); } } + /* * Local variables: * c-basic-offset: 4