Fix Metaproxy stops logging after check config failed MP-590
[metaproxy-moved-to-github.git] / src / test_filter_bounce.cpp
index 51d3d18..7eaafed 100644 (file)
@@ -1,22 +1,33 @@
-/* $Id: test_filter_bounce.cpp,v 1.1 2006-09-28 10:33:04 marc Exp $
-   Copyright (c) 2005-2006, Index Data.
+/* This file is part of Metaproxy.
+   Copyright (C) Index Data
 
-   See the LICENSE file for details
- */
+Metaproxy is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
 
 #include "config.hpp"
 #include "filter_bounce.hpp"
-#include "util.hpp"
+#include <metaproxy/util.hpp>
 #include "gduutil.hpp"
-//#include "sru_util.hpp"
-#include "router_chain.hpp"
-#include "session.hpp"
-#include "package.hpp"
+#include <metaproxy/router_chain.hpp>
+#include <metaproxy/package.hpp>
 
 #include <iostream>
 #include <stdexcept>
 
 #define BOOST_AUTO_TEST_MAIN
+#define BOOST_TEST_DYN_LINK
 #include <boost/test/auto_unit_test.hpp>
 
 
@@ -36,19 +47,19 @@ void check_bounce_z3950(mp::RouterChain &router, int request, int response)
 
     // Create package with Z39.50 init request in it
     mp::Package pack;
-        
+
     mp::odr odr;
     Z_APDU *apdu = zget_APDU(odr, request);
 
     pack.request() = apdu;
 
     // Put it in router
-    pack.router(router).move(); 
-    
+    pack.router(router).move();
+
     // Inspect bounced back request
     yazpp_1::GDU *gdu_req = &pack.request();
     yazpp_1::GDU *gdu_res = &pack.response();
-    
+
     Z_GDU *z_gdu_req = gdu_req->get();
     Z_GDU *z_gdu_res = gdu_res->get();
 
@@ -78,19 +89,19 @@ void check_bounce_http(mp::RouterChain &router)
 
     // Create package with Z39.50 init request in it
     mp::Package pack;
-        
+
     mp::odr odr;
     Z_GDU *gdu = z_get_HTTP_Request(odr);
     //z_get_HTTP_Request_host_path(odr, host, path);
     pack.request() = gdu;
 
     // Put it in router
-    pack.router(router).move(); 
-    
+    pack.router(router).move();
+
     // Inspect bounced back request
     yazpp_1::GDU *gdu_req = &pack.request();
     yazpp_1::GDU *gdu_res = &pack.response();
-    
+
     Z_GDU *z_gdu_req = gdu_req->get();
     Z_GDU *z_gdu_res = gdu_res->get();
 
@@ -109,9 +120,9 @@ void check_bounce_http(mp::RouterChain &router)
     }
 }
 
-BOOST_AUTO_UNIT_TEST( test_filter_bounce_1 )
+BOOST_AUTO_TEST_CASE( test_filter_bounce_1 )
 {
-    try 
+    try
     {
         mp::filter::Bounce f_bounce;
     }
@@ -120,41 +131,41 @@ BOOST_AUTO_UNIT_TEST( test_filter_bounce_1 )
     }
 }
 
-BOOST_AUTO_UNIT_TEST( test_filter_bounce_2 )
+BOOST_AUTO_TEST_CASE( test_filter_bounce_2 )
 {
-    try 
+    try
     {
-        mp::RouterChain router;        
+        mp::RouterChain router;
         mp::filter::Bounce f_bounce;
         router.append(f_bounce);
 
-        check_bounce_z3950(router, 
+        check_bounce_z3950(router,
                            Z_APDU_initRequest, Z_APDU_close);
-        //check_bounce_z3950(router, 
+        //check_bounce_z3950(router,
         //                   Z_APDU_searchRequest, Z_APDU_close);
-        check_bounce_z3950(router, 
+        check_bounce_z3950(router,
                            Z_APDU_presentRequest, Z_APDU_close);
-        check_bounce_z3950(router, 
+        check_bounce_z3950(router,
                            Z_APDU_deleteResultSetRequest, Z_APDU_close);
-        //check_bounce_z3950(router, 
+        //check_bounce_z3950(router,
         //                   Z_APDU_accessControlRequest, Z_APDU_close);
-        check_bounce_z3950(router, 
+        check_bounce_z3950(router,
                            Z_APDU_resourceControlRequest, Z_APDU_close);
-        check_bounce_z3950(router, 
+        check_bounce_z3950(router,
                            Z_APDU_triggerResourceControlRequest, Z_APDU_close);
-        check_bounce_z3950(router, 
+        check_bounce_z3950(router,
                            Z_APDU_resourceReportRequest, Z_APDU_close);
-        //check_bounce_z3950(router, 
+        //check_bounce_z3950(router,
         //                   Z_APDU_scanRequest, Z_APDU_close);
-        //check_bounce_z3950(router, 
+        //check_bounce_z3950(router,
         //                   Z_APDU_sortRequest, Z_APDU_close);
-        check_bounce_z3950(router, 
+        check_bounce_z3950(router,
                            Z_APDU_segmentRequest, Z_APDU_close);
-        //check_bounce_z3950(router, 
+        //check_bounce_z3950(router,
         //                   Z_APDU_extendedServicesRequest, Z_APDU_close);
-        check_bounce_z3950(router, 
+        check_bounce_z3950(router,
                            Z_APDU_close , Z_APDU_close);
-        //check_bounce_z3950(router, 
+        //check_bounce_z3950(router,
         //                   Z_APDU_duplicateDetectionRequest, Z_APDU_close);
 
 
@@ -164,11 +175,11 @@ BOOST_AUTO_UNIT_TEST( test_filter_bounce_2 )
     }
 }
 
-BOOST_AUTO_UNIT_TEST( test_filter_bounce_3 )
+BOOST_AUTO_TEST_CASE( test_filter_bounce_3 )
 {
-    try 
+    try
     {
-        mp::RouterChain router;        
+        mp::RouterChain router;
         mp::filter::Bounce f_bounce;
         router.append(f_bounce);
 
@@ -183,8 +194,9 @@ BOOST_AUTO_UNIT_TEST( test_filter_bounce_3 )
 /*
  * Local variables:
  * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
  * indent-tabs-mode: nil
- * c-file-style: "stroustrup"
  * End:
  * vim: shiftwidth=4 tabstop=8 expandtab
  */
+