1 /* This file is part of Metaproxy.
2 Copyright (C) 2005-2009 Index Data
4 Metaproxy is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
9 Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 #include "filter_record_transform.hpp"
22 //#include "sru_util.hpp"
23 #include "router_chain.hpp"
24 #include "session.hpp"
25 #include "package.hpp"
28 //#include <stdexcept>
30 #define BOOST_AUTO_TEST_MAIN
31 #define BOOST_TEST_DYN_LINK
32 #include <boost/test/auto_unit_test.hpp>
37 using namespace boost::unit_test;
39 namespace mp = metaproxy_1;
40 //using namespace mp::util;
44 BOOST_AUTO_TEST_CASE( test_filter_record_transform_1 )
48 mp::filter::RecordTransform f_rec_trans;
55 BOOST_AUTO_TEST_CASE( test_filter_record_transform_2 )
59 mp::RouterChain router;
61 mp::filter::RecordTransform f_rec_trans;
63 router.append(f_rec_trans);
65 //check_sru_to_z3950_init(router);
66 //check_sru_to_z3950_search(router,
67 // "@attrset Bib-1 @attr 1=4 the",
68 // "@attrset Bib-1 @attr 1=4 the");
77 BOOST_AUTO_TEST_CASE( test_filter_record_transform_3 )
83 mp::RouterChain router;
87 "<?xml version='1.0'?>\n"
88 "<filter xmlns='http://indexdata.com/metaproxy'\n"
89 " id='rec_trans_1' type='record_transform'>\n"
94 "<backend syntax=\"usmarc\""
102 //std::cout << xmlconf << std::endl;
104 // reading and parsing XML conf
105 xmlDocPtr doc = xmlParseMemory(xmlconf.c_str(), xmlconf.size());
107 xmlNode *root_element = xmlDocGetRootElement(doc);
109 // creating and configuring filter
110 mp::filter::RecordTransform f_rec_trans;
111 f_rec_trans.configure(root_element, true);
113 // remeber to free XML DOM
116 // add only filter to router
117 router.append(f_rec_trans);
120 //check_sru_to_z3950_init(router);
121 //check_sru_to_z3950_search(router,
122 // "@attrset Bib-1 @attr 1=4 the",
123 // "@attrset Bib-1 @attr 1=4 the");
127 catch (std::exception &e) {
128 std::cout << e.what() << "\n";
140 * c-file-style: "Stroustrup"
141 * indent-tabs-mode: nil
143 * vim: shiftwidth=4 tabstop=8 expandtab