-/* $Id: test_router_flexml.cpp,v 1.4 2005-10-31 11:59:08 marc Exp $
+/* $Id: test_router_flexml.cpp,v 1.7 2005-12-08 22:32:58 adam Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
};
-BOOST_AUTO_TEST_CASE( test_router_flexml_1 )
+BOOST_AUTO_UNIT_TEST( test_router_flexml_1 )
{
- try{
-
+ try
+ {
std::string xmlconf = "<?xml version=\"1.0\"?>\n"
"<yp2 xmlns=\"http://indexdata.dk/yp2/config/1\">\n"
- "<start route=\"start\"/>\n"
- "<filters>\n"
- "<filter id=\"front_default\" type=\"frontend-net\">\n"
- "<port>210</port>\n"
- "</filter>\n"
- "<filter id=\"log_cout\" type=\"log\">\n"
- "<logfile>mylog.log</logfile>\n"
- "</filter>\n"
- "</filters>\n"
- "<routes>\n"
- "<route id=\"start\">\n"
- "<filter refid=\"front_default\"/>\n"
- "<filter refid=\"log_cout\"/>\n"
- "</route>\n"
- "</routes>\n"
+ " <start route=\"start\"/>\n"
+ " <filters>\n"
+ " <filter id=\"front_default\" type=\"frontend-net\">\n"
+ " <port>210</port>\n"
+ " </filter>\n"
+ " <filter id=\"log_cout\" type=\"log\">\n"
+ " <logfile>mylog.log</logfile>\n"
+ " </filter>\n"
+ " </filters>\n"
+ " <routes>\n"
+ " <route id=\"start\">\n"
+ " <filter refid=\"front_default\"/>\n"
+ " <filter refid=\"log_cout\"/>\n"
+ " </route>\n"
+ " </routes>\n"
"</yp2>\n";
-
yp2::RouterFleXML rflexml(xmlconf);
+ }
+ catch ( ... ) {
+ BOOST_CHECK (false);
+ }
+}
+
+BOOST_AUTO_UNIT_TEST( test_router_flexml_2 )
+{
+ bool got_xml_error = false;
+ try
+ {
+ std::string xmlconf_invalid = "<?xml version=\"1.0\"?>\n"
+ "<y:yp2 xmlns:y=\"http://indexdata.dk/yp2/config/1\">\n"
+ " <start route=\"start\"/>\n"
+ " <filters>\n"
+ " <filter id=\"front_default\" type=\"frontend-net\">\n"
+ " <port>210</port>\n";
-
- BOOST_CHECK (true);
-
- //BOOST_CHECK_EQUAL(filter.name(), std::string("filter1"));
-
+ 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 = "<?xml version=\"1.0\"?>\n"
+ "<y:yp2 xmlns:y=\"http://indexdata.dk/yp2/config/1\">\n"
+ " <y:start route=\"start\"/>\n"
+ " <y:filters>\n"
+ " <y:filter id=\"front_default\" type=\"frontend-net\">\n"
+ " <port>210</port>\n"
+ " </y:filter>\n"
+ " <y:filter id=\"log_cout\" type=\"log\">\n"
+ " <logfile>mylog.log</logfile>\n"
+ " </y:filter>\n"
+ " </y:filters>\n"
+ " <y:routes>\n"
+ " <y:route id=\"start\">\n"
+ " <y:filter refid=\"front_default\"/>\n"
+ " <y:filter refid=\"log_cout\"/>\n"
+ " </y:route>\n"
+ " </y:routes>\n"
+ "</y:yp2>\n";
+
+ yp2::RouterFleXML rflexml(xmlconf);
}
catch ( ... ) {
BOOST_CHECK (false);
}
}
+
/*
* Local variables:
* c-basic-offset: 4