1 /* $Id: test_filter_record_transform.cpp,v 1.7 2007-11-02 17:47:41 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 #define BOOST_TEST_DYN_LINK
35 #include <boost/test/auto_unit_test.hpp>
40 using namespace boost::unit_test;
42 namespace mp = metaproxy_1;
43 //using namespace mp::util;
47 BOOST_AUTO_TEST_CASE( test_filter_record_transform_1 )
51 mp::filter::RecordTransform f_rec_trans;
58 BOOST_AUTO_TEST_CASE( test_filter_record_transform_2 )
62 mp::RouterChain router;
64 mp::filter::RecordTransform f_rec_trans;
66 router.append(f_rec_trans);
68 //check_sru_to_z3950_init(router);
69 //check_sru_to_z3950_search(router,
70 // "@attrset Bib-1 @attr 1=4 the",
71 // "@attrset Bib-1 @attr 1=4 the");
80 BOOST_AUTO_TEST_CASE( test_filter_record_transform_3 )
86 mp::RouterChain router;
90 "<?xml version='1.0'?>\n"
91 "<filter xmlns='http://indexdata.com/metaproxy'\n"
92 " id='rec_trans_1' type='record_transform'>\n"
97 "<backend syntax=\"usmarc\""
105 //std::cout << xmlconf << std::endl;
107 // reading and parsing XML conf
108 xmlDocPtr doc = xmlParseMemory(xmlconf.c_str(), xmlconf.size());
110 xmlNode *root_element = xmlDocGetRootElement(doc);
112 // creating and configuring filter
113 mp::filter::RecordTransform f_rec_trans;
114 f_rec_trans.configure(root_element);
116 // remeber to free XML DOM
119 // add only filter to router
120 router.append(f_rec_trans);
123 //check_sru_to_z3950_init(router);
124 //check_sru_to_z3950_search(router,
125 // "@attrset Bib-1 @attr 1=4 the",
126 // "@attrset Bib-1 @attr 1=4 the");
130 catch (std::exception &e) {
131 std::cout << e.what() << "\n";
143 * indent-tabs-mode: nil
144 * c-file-style: "stroustrup"
146 * vim: shiftwidth=4 tabstop=8 expandtab