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