1 /* $Id: test_filter_record_transform.cpp,v 1.6 2007-05-09 21:23:09 adam Exp $
2 Copyright (c) 2005-2007, Index Data.
4 This file is part of Metaproxy.
6 Metaproxy is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
11 Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with Metaproxy; see the file LICENSE. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 #include "filter_record_transform.hpp"
25 //#include "sru_util.hpp"
26 #include "router_chain.hpp"
27 #include "session.hpp"
28 #include "package.hpp"
31 //#include <stdexcept>
33 #define BOOST_AUTO_TEST_MAIN
34 #include <boost/test/auto_unit_test.hpp>
39 using namespace boost::unit_test;
41 namespace mp = metaproxy_1;
42 //using namespace mp::util;
46 BOOST_AUTO_UNIT_TEST( test_filter_record_transform_1 )
50 mp::filter::RecordTransform f_rec_trans;
57 BOOST_AUTO_UNIT_TEST( test_filter_record_transform_2 )
61 mp::RouterChain router;
63 mp::filter::RecordTransform f_rec_trans;
65 router.append(f_rec_trans);
67 //check_sru_to_z3950_init(router);
68 //check_sru_to_z3950_search(router,
69 // "@attrset Bib-1 @attr 1=4 the",
70 // "@attrset Bib-1 @attr 1=4 the");
79 BOOST_AUTO_UNIT_TEST( test_filter_record_transform_3 )
85 mp::RouterChain router;
89 "<?xml version='1.0'?>\n"
90 "<filter xmlns='http://indexdata.com/metaproxy'\n"
91 " id='rec_trans_1' type='record_transform'>\n"
96 "<backend syntax=\"usmarc\""
104 //std::cout << xmlconf << std::endl;
106 // reading and parsing XML conf
107 xmlDocPtr doc = xmlParseMemory(xmlconf.c_str(), xmlconf.size());
109 xmlNode *root_element = xmlDocGetRootElement(doc);
111 // creating and configuring filter
112 mp::filter::RecordTransform f_rec_trans;
113 f_rec_trans.configure(root_element);
115 // remeber to free XML DOM
118 // add only filter to router
119 router.append(f_rec_trans);
122 //check_sru_to_z3950_init(router);
123 //check_sru_to_z3950_search(router,
124 // "@attrset Bib-1 @attr 1=4 the",
125 // "@attrset Bib-1 @attr 1=4 the");
129 catch (std::exception &e) {
130 std::cout << e.what() << "\n";
142 * indent-tabs-mode: nil
143 * c-file-style: "stroustrup"
145 * vim: shiftwidth=4 tabstop=8 expandtab