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