1 /* This file is part of Metaproxy.
2 Copyright (C) 2005-2013 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 <metaproxy/router_chain.hpp>
23 #include <metaproxy/package.hpp>
25 #define BOOST_AUTO_TEST_MAIN
26 #define BOOST_TEST_DYN_LINK
27 #include <boost/test/auto_unit_test.hpp>
32 using namespace boost::unit_test;
34 namespace mp = metaproxy_1;
35 //using namespace mp::util;
39 BOOST_AUTO_TEST_CASE( test_filter_record_transform_1 )
43 mp::filter::RecordTransform f_rec_trans;
50 BOOST_AUTO_TEST_CASE( test_filter_record_transform_2 )
54 mp::RouterChain router;
56 mp::filter::RecordTransform f_rec_trans;
58 router.append(f_rec_trans);
60 //check_sru_to_z3950_init(router);
61 //check_sru_to_z3950_search(router,
62 // "@attrset Bib-1 @attr 1=4 the",
63 // "@attrset Bib-1 @attr 1=4 the");
72 BOOST_AUTO_TEST_CASE( test_filter_record_transform_3 )
78 mp::RouterChain router;
82 "<?xml version='1.0'?>\n"
83 "<filter xmlns='http://indexdata.com/metaproxy'\n"
84 " id='rec_trans_1' type='record_transform'>\n"
89 "<backend syntax=\"usmarc\""
97 //std::cout << xmlconf << std::endl;
99 // reading and parsing XML conf
100 xmlDocPtr doc = xmlParseMemory(xmlconf.c_str(), xmlconf.size());
102 xmlNode *root_element = xmlDocGetRootElement(doc);
104 // creating and configuring filter
105 mp::filter::RecordTransform f_rec_trans;
106 f_rec_trans.configure(root_element, true, 0);
108 // remeber to free XML DOM
111 // add only filter to router
112 router.append(f_rec_trans);
115 //check_sru_to_z3950_init(router);
116 //check_sru_to_z3950_search(router,
117 // "@attrset Bib-1 @attr 1=4 the",
118 // "@attrset Bib-1 @attr 1=4 the");
122 catch (std::exception &e) {
123 std::cout << e.what() << "\n";
135 * c-file-style: "Stroustrup"
136 * indent-tabs-mode: nil
138 * vim: shiftwidth=4 tabstop=8 expandtab