Commit a19bfdf4 authored by Matthieu Kermagoret's avatar Matthieu Kermagoret
Browse files

Connector SSH: added multiplexer unit test.

parent 9f4d2ce7
......@@ -162,4 +162,12 @@ if (WITH_TESTING)
# Enable testing.
enable_testing()
# multiplexer tests.
# Check singleton.
set(TEST_NAME "multiplexer_singleton")
add_executable("${TEST_NAME}"
"${TEST_DIR}/multiplexer/singleton.cc")
target_link_libraries("${TEST_NAME}" "${CONNECTORLIB}")
add_test("${TEST_NAME}" "${TEST_NAME}")
endif ()
......@@ -74,7 +74,8 @@ void multiplexer::unload() {
* Default constructor.
*/
multiplexer::multiplexer()
: com::centreon::task_manager(0),
// XXX : use thread_pool's ideal thread count when available
: com::centreon::task_manager(),
com::centreon::handle_manager(this) {}
/**
......
/*
** Copyright 2011 Merethis
**
** This file is part of Centreon Connector SSH.
**
** Centreon Connector SSH is free software: you can redistribute it
** and/or modify it under the terms of the GNU Affero General Public
** License as published by the Free Software Foundation, either version
** 3 of the License, or (at your option) any later version.
**
** Centreon Connector SSH 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
** Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public
** License along with Centreon Connector SSH. If not, see
** <http://www.gnu.org/licenses/>.
*/
#include "com/centreon/connector/ssh/multiplexer.hh"
using namespace com::centreon::connector::ssh;
/**
* Check that the multiplexer singleton works properly.
*
* @return 0 on success.
*/
int main() {
// Return value.
int retval(0);
// By default, multiplexer is not loaded.
retval |= (&multiplexer::instance() != NULL);
// Load multiplexer.
multiplexer::load();
retval |= (&multiplexer::instance() == NULL);
// Unload multiplexer.
multiplexer::unload();
retval |= (&multiplexer::instance() != NULL);
// Return check result.
return (retval);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment