26820afbba1f4f53a63a6d80198bb17d0488c045
[metaproxy-moved-to-github.git] / src / test_ses_map.cpp
1 /* $Id: test_ses_map.cpp,v 1.4 2006-06-10 14:29:13 adam Exp $
2    Copyright (c) 2005-2006, Index Data.
3
4    See the LICENSE file for details
5  */
6
7 #include "config.hpp"
8 #include <iostream>
9 #include <stdexcept>
10
11 #include "router.hpp"
12 #include "session.hpp"
13 #include "package.hpp"
14
15 #include <map>
16
17 #include <boost/thread.hpp>
18 #include <boost/shared_ptr.hpp>
19 #define BOOST_AUTO_TEST_MAIN
20 #include <boost/test/auto_unit_test.hpp>
21
22 #include <yaz/zgdu.h>
23 #include <yaz/pquery.h>
24 #include <yaz/otherinfo.h>
25 using namespace boost::unit_test;
26
27 namespace mp = metaproxy_1;
28
29 namespace metaproxy_1 {
30     class SesMap;
31     
32
33     class SesMap {
34         class Wrap {
35         public:
36             Wrap(const double &t) : m_t(t) { };
37             double m_t;
38             boost::mutex m_mutex;
39         };
40     private:
41         boost::mutex m_map_mutex;
42     public:
43         void create(SesMap &sm, const mp::Session &s, double &t) {
44             boost::mutex::scoped_lock lock(m_map_mutex);
45             
46             boost::shared_ptr<Wrap> w_ptr(new Wrap(t));
47             m_map_ptr[s] = w_ptr;
48         }
49         std::map<mp::Session,boost::shared_ptr<Wrap> >m_map_ptr;
50     };
51 }
52
53
54 BOOST_AUTO_UNIT_TEST( test_ses_map_1 )
55 {
56     try 
57     {
58         mp::SesMap ses_map;
59     }
60     catch ( ... ) {
61         BOOST_CHECK (false);
62     }
63 }
64
65
66 /*
67  * Local variables:
68  * c-basic-offset: 4
69  * indent-tabs-mode: nil
70  * c-file-style: "stroustrup"
71  * End:
72  * vim: shiftwidth=4 tabstop=8 expandtab
73  */