X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=src%2Ftest_filter_query_rewrite.cpp;h=80bc0788c8412a2327fd5be0418ca8f7ec1d6a19;hb=637a685d61a9ff0e3f398a59da426979815c4d68;hp=92d43438078cffec2bdc0488de0af7abb7721eaa;hpb=ca1782e883072344999a077249b9adeb8f3f55a1;p=metaproxy-moved-to-github.git diff --git a/src/test_filter_query_rewrite.cpp b/src/test_filter_query_rewrite.cpp index 92d4343..80bc078 100644 --- a/src/test_filter_query_rewrite.cpp +++ b/src/test_filter_query_rewrite.cpp @@ -1,7 +1,22 @@ -/* $Id: test_filter_query_rewrite.cpp,v 1.4 2006-01-23 08:12:24 mike Exp $ - Copyright (c) 2005, Index Data. +/* $Id: test_filter_query_rewrite.cpp,v 1.13 2007-05-09 21:23:09 adam Exp $ + Copyright (c) 2005-2007, Index Data. -%LICENSE% +This file is part of Metaproxy. + +Metaproxy is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Metaproxy; see the file LICENSE. If not, write to the +Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ #include "config.hpp" @@ -18,11 +33,13 @@ #include using namespace boost::unit_test; -using namespace yp2::util; -class FilterBounceZ3950: public yp2::filter::Base { +namespace mp = metaproxy_1; +using namespace mp::util; + +class FilterBounceZ3950: public mp::filter::Base { public: - void process(yp2::Package & package) const { + void process(mp::Package & package) const { if (package.session().is_closed()) { @@ -61,14 +78,14 @@ public: }; }; -void check_query_rewrite_init(yp2::RouterChain &router) +void check_query_rewrite_init(mp::RouterChain &router) { //std::cout << "QUERY REWRITE INIT\n"; // Create package with Z39.50 init request in it - yp2::Package pack; + mp::Package pack; - yp2::odr odr; + mp::odr odr; Z_APDU *apdu = zget_APDU(odr, Z_APDU_initRequest); pack.request() = apdu; @@ -91,7 +108,7 @@ void check_query_rewrite_init(yp2::RouterChain &router) } } -void check_query_rewrite_search(yp2::RouterChain &router, +void check_query_rewrite_search(mp::RouterChain &router, std::string query_in, std::string query_expect) { @@ -99,13 +116,13 @@ void check_query_rewrite_search(yp2::RouterChain &router, // << query_in << " " << query_expect << "\n"; // Create package with Z39.50 search request in it - yp2::Package pack; + mp::Package pack; - yp2::odr odr; + mp::odr odr; Z_APDU *apdu = zget_APDU(odr, Z_APDU_searchRequest); // create package PQF query here - yp2::util::pqf(odr, apdu, query_in); + mp::util::pqf(odr, apdu, query_in); // create package PDF database info (needed!) apdu->u.searchRequest->num_databaseNames = 1; @@ -143,7 +160,7 @@ BOOST_AUTO_UNIT_TEST( test_filter_query_rewrite_1 ) { try { - yp2::filter::QueryRewrite f_query_rewrite; + mp::filter::QueryRewrite f_query_rewrite; } catch ( ... ) { BOOST_CHECK (false); @@ -154,9 +171,9 @@ BOOST_AUTO_UNIT_TEST( test_filter_query_rewrite2 ) { try { - yp2::RouterChain router; + mp::RouterChain router; - yp2::filter::QueryRewrite f_query_rewrite; + mp::filter::QueryRewrite f_query_rewrite; //FilterBounceZ3950 f_bounce_z3950; router.append(f_query_rewrite); @@ -180,37 +197,13 @@ BOOST_AUTO_UNIT_TEST( test_filter_query_rewrite3 ) try { - yp2::RouterChain router; + mp::RouterChain router; std::string xmlconf = "\n" - "\n" - " \n" - " @attrset XYZ\n" - " @attrset Bib-1\n" - " \n" - " \n" - " @attr 1=4\n" - " @attr 1=4 @attr 4=2\n" - " \n" - " \n" - " fish\n" - " cat\n" - " \n" - " \n" - " @attr 1=4\n" - " @attr 1=5 @attr 4=1\n" - " \n" - " \n" - " fish\n" - " mouse\n" - " \n" - " \n" - " ^\n" - " @and @attr1=9999 vdb\n" - " \n" "\n" ; @@ -222,7 +215,7 @@ BOOST_AUTO_UNIT_TEST( test_filter_query_rewrite3 ) xmlNode *root_element = xmlDocGetRootElement(doc); // creating and configuring filter - yp2::filter::QueryRewrite f_query_rewrite; + mp::filter::QueryRewrite f_query_rewrite; f_query_rewrite.configure(root_element); // remeber to free XML DOM