1 /* $Id: test_filter_record_transform.cpp,v 1.2 2006-10-04 11:21:47 marc Exp $
2 Copyright (c) 2005-2006, Index Data.
4 See the LICENSE file for details
8 #include "filter_record_transform.hpp"
10 //#include "sru_util.hpp"
11 #include "router_chain.hpp"
12 #include "session.hpp"
13 #include "package.hpp"
16 //#include <stdexcept>
18 #define BOOST_AUTO_TEST_MAIN
19 #include <boost/test/auto_unit_test.hpp>
24 using namespace boost::unit_test;
26 namespace mp = metaproxy_1;
27 //using namespace mp::util;
31 BOOST_AUTO_UNIT_TEST( test_filter_record_transform_1 )
35 mp::filter::RecordTransform f_rec_trans;
42 BOOST_AUTO_UNIT_TEST( test_filter_record_transform_2 )
46 mp::RouterChain router;
48 mp::filter::RecordTransform f_rec_trans;
50 router.append(f_rec_trans);
52 //check_sru_to_z3950_init(router);
53 //check_sru_to_z3950_search(router,
54 // "@attrset Bib-1 @attr 1=4 the",
55 // "@attrset Bib-1 @attr 1=4 the");
64 BOOST_AUTO_UNIT_TEST( test_filter_record_transform_3 )
70 mp::RouterChain router;
74 "<?xml version='1.0'?>\n"
75 "<filter xmlns='http://indexdata.dk/yp2/config/1'\n"
76 " id='rec_trans_1' type='record_transform'>\n"
81 " backendsyntax=\"usmarc\""
82 " backendname=\"marcxml\""
83 " identifier=\"info:srw/schema/1/marcxml-v1.1\""
91 //std::cout << xmlconf << std::endl;
93 // reading and parsing XML conf
94 xmlDocPtr doc = xmlParseMemory(xmlconf.c_str(), xmlconf.size());
96 xmlNode *root_element = xmlDocGetRootElement(doc);
98 // creating and configuring filter
99 mp::filter::RecordTransform f_rec_trans;
100 f_rec_trans.configure(root_element);
102 // remeber to free XML DOM
105 // add only filter to router
106 router.append(f_rec_trans);
109 //check_sru_to_z3950_init(router);
110 //check_sru_to_z3950_search(router,
111 // "@attrset Bib-1 @attr 1=4 the",
112 // "@attrset Bib-1 @attr 1=4 the");
116 catch (std::exception &e) {
117 std::cout << e.what() << "\n";
129 * indent-tabs-mode: nil
130 * c-file-style: "stroustrup"
132 * vim: shiftwidth=4 tabstop=8 expandtab