ConnPoolTest.cpp 1.33 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
 * The CERN Tape Archive (CTA) project
 * Copyright (C) 2015  CERN
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "common/exception/Exception.hpp"
20
#include "rdbms/ConnPool.hpp"
21
22
23
24
25
26

#include <gtest/gtest.h>
#include <sstream>

namespace unitTests {

27
class cta_rdbms_ConnPoolTest : public ::testing::Test {
28
29
30
31
32
33
34
35
36
protected:

  virtual void SetUp() {
  }

  virtual void TearDown() {
  }
};

37
TEST_F(cta_rdbms_ConnPoolTest, getPooledConn) {
38
39
  using namespace cta::rdbms;

40
  const Login login(Login::DBTYPE_SQLITE, "", "", "file::memory:?cache=shared");
41
  const uint64_t nbConns = 2;
42
  ConnPool pool(login, nbConns);
43

44
  PooledConn conn = pool.getPooledConn();
45

46
  PooledConn conn2(nullptr, nullptr);
47

48
  conn2 = pool.getPooledConn();
49
50
51
}

} // namespace unitTests