GPL v2.
[metaproxy-moved-to-github.git] / src / test_filter_sru_to_z3950.cpp
1 /* $Id: test_filter_sru_to_z3950.cpp,v 1.5 2007-05-09 21:23:09 adam Exp $
2    Copyright (c) 2005-2007, Index Data.
3
4 This file is part of Metaproxy.
5
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
9 version.
10
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
14 for more details.
15
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
19 02111-1307, USA.
20  */
21
22 #include "config.hpp"
23 #include "filter_sru_to_z3950.hpp"
24 #include "util.hpp"
25 #include "sru_util.hpp"
26 #include "router_chain.hpp"
27 #include "session.hpp"
28 #include "package.hpp"
29
30 #include <iostream>
31 #include <stdexcept>
32
33 #define BOOST_AUTO_TEST_MAIN
34 #include <boost/test/auto_unit_test.hpp>
35
36 using namespace boost::unit_test;
37
38 namespace mp = metaproxy_1;
39 using namespace mp::util;
40
41
42
43 BOOST_AUTO_UNIT_TEST( test_filter_sru_to_z3950_1 )
44 {
45     try 
46     {
47         mp::filter::SRUtoZ3950 f_sru_to_z3950;
48     }
49     catch ( ... ) {
50         BOOST_CHECK (false);
51     }
52 }
53
54 BOOST_AUTO_UNIT_TEST( test_filter_sru_to_z3950_2 )
55 {
56     try 
57     {
58         mp::RouterChain router;
59         
60         mp::filter::SRUtoZ3950 f_sru_to_z3950;
61         
62         router.append(f_sru_to_z3950);
63
64         //check_sru_to_z3950_init(router);
65         //check_sru_to_z3950_search(router, 
66         //                           "@attrset Bib-1 @attr 1=4 the", 
67         //                           "@attrset Bib-1 @attr 1=4 the");
68
69     }
70     catch ( ... ) {
71         BOOST_CHECK (false);
72     }
73 }
74
75
76 // BOOST_AUTO_UNIT_TEST( test_filter_sru_to_z3950_3 )
77 // {
78     
79
80 //     try 
81 //     {
82 //         mp::RouterChain router;
83         
84
85 //         std::string xmlconf = 
86 //             "<?xml version='1.0'?>\n"
87 //             "<filter xmlns='http://indexdata.com/metaproxy'\n"
88 //             "        id='qrw1' type='sru_to_z3950'>\n"
89 //             "</filter>\n"
90 //             ;
91          
92 //         //std::cout << xmlconf  << std::endl;
93
94 //         // reading and parsing XML conf
95 //         xmlDocPtr doc = xmlParseMemory(xmlconf.c_str(), xmlconf.size());
96 //         BOOST_CHECK(doc);
97 //         xmlNode *root_element = xmlDocGetRootElement(doc);
98
99 //         // creating and configuring filter
100 //         mp::filter::SRUtoZ3950 f_sru_to_z3950;
101 //         f_sru_to_z3950.configure(root_element);
102         
103 //         // remeber to free XML DOM
104 //         xmlFreeDoc(doc);
105         
106 //         // add only filter to router
107 //         router.append(f_sru_to_z3950);
108
109 //         // start testing
110 //         check_sru_to_z3950_init(router);
111 //         check_sru_to_z3950_search(router, 
112 //                                    "@attrset Bib-1 @attr 1=4 the", 
113 //                                    "@attrset Bib-1 @attr 1=4 the");
114
115 //     }
116
117 //     catch (std::exception &e) {
118 //         std::cout << e.what() << "\n";
119 //         BOOST_CHECK (false);
120 //     }
121
122 //     catch ( ... ) {
123 //         BOOST_CHECK (false);
124 //     }
125 // }
126
127 /*
128  * Local variables:
129  * c-basic-offset: 4
130  * indent-tabs-mode: nil
131  * c-file-style: "stroustrup"
132  * End:
133  * vim: shiftwidth=4 tabstop=8 expandtab
134  */