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