GPL v2.
[metaproxy-moved-to-github.git] / src / test_ses_map.cpp
1 /* $Id: test_ses_map.cpp,v 1.6 2007-05-09 21:23:09 adam Exp $
2    Copyright (c) 2005-2007, Index Data.
3
4 This file is part of Metaproxy.
5
6 Metaproxy is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
9 version.
10
11 Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with Metaproxy; see the file LICENSE.  If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19 02111-1307, USA.
20  */
21
22 #include "config.hpp"
23 #include <iostream>
24 #include <stdexcept>
25
26 #include "router.hpp"
27 #include "session.hpp"
28 #include "package.hpp"
29
30 #include <map>
31
32 #include <boost/thread.hpp>
33 #include <boost/shared_ptr.hpp>
34 #define BOOST_AUTO_TEST_MAIN
35 #include <boost/test/auto_unit_test.hpp>
36
37 #include <yaz/zgdu.h>
38 #include <yaz/pquery.h>
39 #include <yaz/otherinfo.h>
40 using namespace boost::unit_test;
41
42 namespace mp = metaproxy_1;
43
44 namespace metaproxy_1 {
45     class SesMap;
46     
47
48     class SesMap {
49         class Wrap {
50         public:
51             Wrap(const double &t) : m_t(t) { };
52             double m_t;
53             boost::mutex m_mutex;
54         };
55     private:
56         boost::mutex m_map_mutex;
57     public:
58         void create(SesMap &sm, const mp::Session &s, double &t) {
59             boost::mutex::scoped_lock lock(m_map_mutex);
60             
61             boost::shared_ptr<Wrap> w_ptr(new Wrap(t));
62             m_map_ptr[s] = w_ptr;
63         }
64         std::map<mp::Session,boost::shared_ptr<Wrap> >m_map_ptr;
65     };
66 }
67
68
69 BOOST_AUTO_UNIT_TEST( test_ses_map_1 )
70 {
71     try 
72     {
73         mp::SesMap ses_map;
74     }
75     catch ( ... ) {
76         BOOST_CHECK (false);
77     }
78 }
79
80
81 /*
82  * Local variables:
83  * c-basic-offset: 4
84  * indent-tabs-mode: nil
85  * c-file-style: "stroustrup"
86  * End:
87  * vim: shiftwidth=4 tabstop=8 expandtab
88  */