Commit 10d1cb40 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] - updated connector unit test

parent a2119ad3
......@@ -92,9 +92,10 @@ bool WModuleConnector::isConnectedTo( boost::shared_ptr<WModuleConnector> con )
void WModuleConnector::connect( boost::shared_ptr<WModuleConnector> con )
{
boost::shared_ptr< WModuleContainer > container = m_module->getAssociatedContainer();
std::string containerName = container.get() ? container->getName() : "Unknown";
WLogger::getLogger()->addLogMessage( "Connecting " + con->getCanonicalName() + " with " + getCanonicalName()
, "ModuleContainer (" + m_module->getAssociatedContainer()->getName() + ")", LL_INFO );
, "ModuleContainer (" + containerName + ")", LL_INFO );
// are both partners compatible to each other?
if ( !( con->connectable( shared_from_this() ) && connectable( con ) ) )
......
......@@ -41,6 +41,7 @@
#include "../../common/WSegmentationFault.h"
#include "../../common/WTransferable.h"
#include "../../common/WPrototyped.h"
#include "../../common/WLogger.h"
#include "../exceptions/WModuleConnectorInitFailed.h"
#include "../exceptions/WModuleConnectionFailed.h"
#include "../exceptions/WModuleConnectorsIncompatible.h"
......@@ -345,6 +346,15 @@ private:
boost::shared_ptr< WModuleOutputData< WTestTransferableDerived > > m_outputDerived;
};
/**
* The logger instance used by some tests
*/
static WLogger logger;
/**
* True if the logger has been initialized in the past.
*/
static bool loggerInitialized = false;
/**
* Tests the WModuleConnector class. We use WModuleConnector's direct derived classes WModuleInputConnector and
......@@ -355,6 +365,23 @@ class WModuleConnectorTest : public CxxTest::TestSuite
{
public:
/**
* Setup method called before every test case. This initialized the logger if needed.
*/
void setUp()
{
if ( !loggerInitialized )
{
std::cout << "Initialize logger." << std::endl;
logger.setColored( false );
// NOTE: the logger does not need to be run, since the logger main thread just prints the messages. If compiled in
// debug mode, the messages will be printed directly, without the logger thread.
//logger.run();
loggerInitialized = true;
}
}
/**
* Simple module to test with.
*/
......
Markdown is supported
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