X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Ftest_filter_virt_db.cpp;h=f0953736c3299c4ae0570965e86fea41c40b228f;hb=f47e8cf4cde2ba5465106e219c803e6424a4f177;hp=56e82ed4853cf5c8000e68ea47c1cc5e69f6ac3d;hpb=d7b1186d1f020678b617e2368415485bffef93f9;p=metaproxy-moved-to-github.git diff --git a/src/test_filter_virt_db.cpp b/src/test_filter_virt_db.cpp index 56e82ed..f095373 100644 --- a/src/test_filter_virt_db.cpp +++ b/src/test_filter_virt_db.cpp @@ -1,4 +1,4 @@ -/* $Id: test_filter_virt_db.cpp,v 1.5 2005-10-26 10:21:03 marc Exp $ +/* $Id: test_filter_virt_db.cpp,v 1.11 2006-01-16 17:02:55 adam Exp $ Copyright (c) 2005, Index Data. %LICENSE% @@ -8,7 +8,7 @@ #include #include -#include "test_util.hpp" +#include "util.hpp" #include "filter_virt_db.hpp" #include "filter_backend_test.hpp" #include "filter_log.hpp" @@ -26,7 +26,7 @@ using namespace boost::unit_test; -BOOST_AUTO_TEST_CASE( test_filter_virt_db_1 ) +BOOST_AUTO_UNIT_TEST( test_filter_virt_db_1 ) { try { @@ -37,7 +37,7 @@ BOOST_AUTO_TEST_CASE( test_filter_virt_db_1 ) } } -BOOST_AUTO_TEST_CASE( test_filter_virt_db_2 ) +BOOST_AUTO_UNIT_TEST( test_filter_virt_db_2 ) { try { @@ -45,20 +45,19 @@ BOOST_AUTO_TEST_CASE( test_filter_virt_db_2 ) yp2::filter::Virt_db vdb; - router.rule(vdb); + router.append(vdb); // Create package with Z39.50 init request in it // Since there is not vhost given, the virt will make its // own init response (regardless of backend) yp2::Package pack; - ODR odr = odr_createmem(ODR_ENCODE); + yp2::odr odr; Z_APDU *apdu = zget_APDU(odr, Z_APDU_initRequest); BOOST_CHECK(apdu); pack.request() = apdu; - odr_destroy(odr); // Put it in router pack.router(router).move(); @@ -84,7 +83,7 @@ BOOST_AUTO_TEST_CASE( test_filter_virt_db_2 ) static void init(yp2::Package &pack, yp2::Router &router) { // Create package with Z39.50 init request in it - ODR odr = odr_createmem(ODR_ENCODE); + yp2::odr odr; Z_APDU *apdu = zget_APDU(odr, Z_APDU_initRequest); BOOST_CHECK(apdu); @@ -92,7 +91,6 @@ static void init(yp2::Package &pack, yp2::Router &router) return; pack.request() = apdu; - odr_destroy(odr); // Put it in router pack.router(router).move(); @@ -116,7 +114,7 @@ static void search(yp2::Package &pack, yp2::Router &router, { // Create package with Z39.50 search request in it - ODR odr = odr_createmem(ODR_ENCODE); + yp2::odr odr; Z_APDU *apdu = zget_APDU(odr, Z_APDU_searchRequest); yp2::util::pqf(odr, apdu, query); @@ -134,8 +132,6 @@ static void search(yp2::Package &pack, yp2::Router &router, pack.request() = apdu; - odr_destroy(odr); - Z_GDU *gdu_test = pack.request().get(); BOOST_CHECK(gdu_test); @@ -161,7 +157,7 @@ static void present(yp2::Package &pack, yp2::Router &router, { // Create package with Z39.50 present request in it - ODR odr = odr_createmem(ODR_ENCODE); + yp2::odr odr; Z_APDU *apdu = zget_APDU(odr, Z_APDU_presentRequest); apdu->u.presentRequest->resultSetId = odr_strdup(odr, setname); @@ -174,8 +170,6 @@ static void present(yp2::Package &pack, yp2::Router &router, pack.request() = apdu; - odr_destroy(odr); - Z_GDU *gdu_test = pack.request().get(); BOOST_CHECK(gdu_test); @@ -195,7 +189,7 @@ static void present(yp2::Package &pack, yp2::Router &router, BOOST_CHECK_EQUAL(z_gdu->u.z3950->which, Z_APDU_presentResponse); } -BOOST_AUTO_TEST_CASE( test_filter_virt_db_3 ) +BOOST_AUTO_UNIT_TEST( test_filter_virt_db_3 ) { try { @@ -203,18 +197,18 @@ BOOST_AUTO_TEST_CASE( test_filter_virt_db_3 ) yp2::filter::Log filter_log1("FRONT"); #if 0 - router.rule(filter_log1); + router.append(filter_log1); #endif yp2::filter::Virt_db vdb; - router.rule(vdb); - vdb.add_map_db2vhost("Default", "localhost:210"); + router.append(vdb); + vdb.add_map_db2target("Default", "localhost:210", ""); yp2::filter::Log filter_log2("BACK"); #if 0 - router.rule(filter_log2); + router.append(filter_log2); #endif yp2::filter::Backend_test btest; - router.rule(btest); + router.append(btest); yp2::Session session1; yp2::Origin origin1;