X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Ftest_filter_bounce.cpp;h=7eaafed285e1ceae29fd6f267f488b171baf66b4;hb=ed1d79c860c13fb92e5b7eea8de2cd608a6caa0e;hp=651a9825a5416cc0be5d7bbc68afd80ff0bfda66;hpb=b70b9ec78f0ab1c3ed3b432de986159129a0e4ed;p=metaproxy-moved-to-github.git diff --git a/src/test_filter_bounce.cpp b/src/test_filter_bounce.cpp index 651a982..7eaafed 100644 --- a/src/test_filter_bounce.cpp +++ b/src/test_filter_bounce.cpp @@ -1,22 +1,33 @@ -/* $Id: test_filter_bounce.cpp,v 1.2 2007-01-25 14:05:54 adam Exp $ - Copyright (c) 2005-2007, 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 #include "gduutil.hpp" -//#include "sru_util.hpp" -#include "router_chain.hpp" -#include "session.hpp" -#include "package.hpp" +#include +#include #include #include #define BOOST_AUTO_TEST_MAIN +#define BOOST_TEST_DYN_LINK #include @@ -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 */ +