+
+BOOST_AUTO_UNIT_TEST( test_filter_query_rewrite3 )
+{
+
+
+ try
+ {
+ yp2::RouterChain router;
+
+
+ std::string xmlconf =
+ "<?xml version='1.0'?>\n"
+ "<filter xmlns='http://indexdata.dk/yp2/config/1'\n"
+ " id='qrw1' type='query_rewrite'>\n"
+ " <regex action='all'>\n"
+ " <expression>@attrset XYZ</expression>\n"
+ " <format>@attrset Bib-1</format>\n"
+ " </regex>\n"
+ " <regex action='search'>\n"
+ " <expression>@attr 1=4</expression>\n"
+ " <format>@attr 1=4 @attr 4=2</format>\n"
+ " </regex>\n"
+ " <regex action='search'>\n"
+ " <expression>fish</expression>\n"
+ " <format>cat</format>\n"
+ " </regex>\n"
+ " <regex action='scan'>\n"
+ " <expression>@attr 1=4</expression>\n"
+ " <format>@attr 1=5 @attr 4=1</format>\n"
+ " </regex>\n"
+ " <regex action='scan'>\n"
+ " <expression>fish</expression>\n"
+ " <format>mouse</format>\n"
+ " </regex>\n"
+ "</filter>\n"
+ ;
+
+ //std::cout << xmlconf << std::endl;
+
+ // reading and parsing XML conf
+ xmlDocPtr doc = xmlParseMemory(xmlconf.c_str(), xmlconf.size());
+ BOOST_CHECK(doc);
+ xmlNode *root_element = xmlDocGetRootElement(doc);
+
+ // creating and configuring filter
+ yp2::filter::QueryRewrite f_query_rewrite;
+ f_query_rewrite.configure(root_element);
+
+ // remeber to free XML DOM
+ xmlFreeDoc(doc);
+
+ // add only filter to router
+ router.append(f_query_rewrite);
+
+ // start testing
+ check_query_rewrite_init(router);
+ check_query_rewrite_search(router,
+ "@attrset Bib-1 @attr 1=4 the",
+ "@attrset Bib-1 @attr 1=4 the");
+
+ }
+
+ catch (std::exception &e) {
+ std::cout << e.what() << "\n";
+ BOOST_CHECK (false);
+ }
+
+ catch ( ... ) {
+ BOOST_CHECK (false);
+ }
+}
+