1 /* $Id: test_filter_log.cpp,v 1.2 2005-10-25 11:48:30 adam Exp $
2 Copyright (c) 2005, Index Data.
11 #include "filter_log.hpp"
14 #include "session.hpp"
15 #include "package.hpp"
17 #define BOOST_AUTO_TEST_MAIN
18 #include <boost/test/auto_unit_test.hpp>
20 using namespace boost::unit_test;
22 class FilterBounceInit: public yp2::filter::Base {
24 void process(yp2::Package & package) const {
26 if (package.session().is_closed())
28 // std::cout << "Got Close.\n";
31 Z_GDU *gdu = package.request().get();
34 // std::cout << "Got PDU. Sending init response\n";
35 ODR odr = odr_createmem(ODR_ENCODE);
36 Z_APDU *apdu = zget_APDU(odr, Z_APDU_initResponse);
38 apdu->u.initResponse->implementationName = "YP2/YAZ";
40 package.response() = apdu;
43 return package.move();
48 BOOST_AUTO_TEST_CASE( test_filter_log_1 )
59 BOOST_AUTO_TEST_CASE( test_filter_log_2 )
63 yp2::RouterChain router;
71 // Create package with Z39.50 init request in it
74 ODR odr = odr_createmem(ODR_ENCODE);
75 Z_APDU *apdu = zget_APDU(odr, Z_APDU_initRequest);
77 pack.request() = apdu;
79 // Done creating query.
82 pack.router(router).move();
84 // Inspect that we got Z39.50 init response
85 yazpp_1::GDU *gdu = &pack.response();
87 Z_GDU *z_gdu = gdu->get();
90 BOOST_CHECK_EQUAL(z_gdu->which, Z_GDU_Z3950);
91 BOOST_CHECK_EQUAL(z_gdu->u.z3950->which, Z_APDU_initResponse);
102 * indent-tabs-mode: nil
103 * c-file-style: "stroustrup"
105 * vim: shiftwidth=4 tabstop=8 expandtab