From 18b59afe6cda90607ad0b193088000d4f9749a97 Mon Sep 17 00:00:00 2001 From: Christian Mueller Date: Sun, 18 Dec 2011 16:33:52 +0100 Subject: - added comments in XML description - fixed bug in Dbus signal sending - corrected namespace usage --- AudioManagerDaemon/test/CommandInterfaceBackdoor.h | 4 ++- AudioManagerDaemon/test/CommonFunctions.cpp | 10 +++++-- AudioManagerDaemon/test/CommonFunctions.h | 7 ++--- AudioManagerDaemon/test/ControlInterfaceBackdoor.h | 6 ++-- AudioManagerDaemon/test/RoutingInterfaceBackdoor.h | 4 ++- .../test/controlInterface/CMakeLists.txt | 3 +- .../test/controlInterface/controlInterfaceTest.cpp | 14 ++++++--- .../test/controlInterface/controlInterfaceTest.h | 35 ++++------------------ AudioManagerDaemon/test/database/CMakeLists.txt | 3 +- AudioManagerDaemon/test/database/databaseTest.cpp | 9 ++++-- AudioManagerDaemon/test/database/databaseTest.h | 8 ++--- .../test/routingInterface/CMakeLists.txt | 3 +- .../test/routingInterface/routingInterfaceTest.cpp | 23 +++++--------- .../test/routingInterface/routingInterfaceTest.h | 8 ++--- 14 files changed, 60 insertions(+), 77 deletions(-) (limited to 'AudioManagerDaemon/test') diff --git a/AudioManagerDaemon/test/CommandInterfaceBackdoor.h b/AudioManagerDaemon/test/CommandInterfaceBackdoor.h index 3c94337..ab57a62 100644 --- a/AudioManagerDaemon/test/CommandInterfaceBackdoor.h +++ b/AudioManagerDaemon/test/CommandInterfaceBackdoor.h @@ -29,7 +29,7 @@ #include #include "CommandSender.h" -using namespace am; +namespace am { class CommandSender; @@ -41,6 +41,8 @@ public: bool injectInterface(CommandSender* CommandSender, CommandSendInterface* CommandSendInterface); }; +} + //definitions are in CommonFunctions.cpp! #endif /* COMMANDINTERFACEBACKDOOR_H_ */ diff --git a/AudioManagerDaemon/test/CommonFunctions.cpp b/AudioManagerDaemon/test/CommonFunctions.cpp index 1504412..b62169e 100644 --- a/AudioManagerDaemon/test/CommonFunctions.cpp +++ b/AudioManagerDaemon/test/CommonFunctions.cpp @@ -27,6 +27,10 @@ #include "CommandInterfaceBackdoor.h" #include "RoutingInterfaceBackdoor.h" #include "ControlInterfaceBackdoor.h" +#include +#include + +using namespace am; CommandInterfaceBackdoor::CommandInterfaceBackdoor() { } @@ -87,9 +91,9 @@ bool ControlInterfaceBackdoor::replaceController(ControlSender *controlSender, C } -int GetRandomNumber(int nLow, int nHigh) { - return (rand() % (nHigh - nLow + 1)) + nLow; -} +//int GetRandomNumber(int nLow, int nHigh) { +// return (rand() % (nHigh - nLow + 1)) + nLow; +//} bool equalSoundProperty(const am_SoundProperty_s a, const am_SoundProperty_s b) { diff --git a/AudioManagerDaemon/test/CommonFunctions.h b/AudioManagerDaemon/test/CommonFunctions.h index 871c131..af6d43b 100644 --- a/AudioManagerDaemon/test/CommonFunctions.h +++ b/AudioManagerDaemon/test/CommonFunctions.h @@ -26,10 +26,9 @@ #ifndef COMMONHEADERS_H_ #define COMMONHEADERS_H_ -#include -#include "DatabaseHandler.h" +#include "audiomanagertypes.h" -using namespace am; +namespace am { class CommonFunctions { @@ -86,7 +85,7 @@ public: }; }; - +} #endif /* COMMONHEADERS_H_ */ diff --git a/AudioManagerDaemon/test/ControlInterfaceBackdoor.h b/AudioManagerDaemon/test/ControlInterfaceBackdoor.h index 37c63b2..b07f3ad 100644 --- a/AudioManagerDaemon/test/ControlInterfaceBackdoor.h +++ b/AudioManagerDaemon/test/ControlInterfaceBackdoor.h @@ -29,9 +29,9 @@ #include "control/ControlSendInterface.h" #include "ControlSender.h" -class ControlSender; +namespace am { -using namespace am; +class ControlSender; class ControlInterfaceBackdoor { public: @@ -40,4 +40,6 @@ public: bool replaceController(ControlSender *controlSender, ControlSendInterface *newController); }; +} + #endif /* CONTROLINTERFACEBACKDOOR_H_ */ diff --git a/AudioManagerDaemon/test/RoutingInterfaceBackdoor.h b/AudioManagerDaemon/test/RoutingInterfaceBackdoor.h index 4ade08f..b7e7624 100644 --- a/AudioManagerDaemon/test/RoutingInterfaceBackdoor.h +++ b/AudioManagerDaemon/test/RoutingInterfaceBackdoor.h @@ -28,7 +28,7 @@ #include "RoutingSender.h" -using namespace am; +namespace am { class RoutingSender; @@ -40,6 +40,8 @@ public: bool injectInterface(RoutingSender *RoutingSender, RoutingSendInterface *newInterface, const std::string& busname); }; +} + //definitions are in CommonFunctions.cpp! #endif /* ROUTINGINTERFACEBACKDOOR_H_ */ diff --git a/AudioManagerDaemon/test/controlInterface/CMakeLists.txt b/AudioManagerDaemon/test/controlInterface/CMakeLists.txt index a96cfe8..8ac7cd1 100644 --- a/AudioManagerDaemon/test/controlInterface/CMakeLists.txt +++ b/AudioManagerDaemon/test/controlInterface/CMakeLists.txt @@ -25,9 +25,8 @@ cmake_minimum_required(VERSION 2.6) PROJECT(controlInterfacetest) -set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic") #set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic") -set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DUNIT_TEST=1") +set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DUNIT_TEST=1 -DDLT_CONTEXT=AudioManager") set(STD_INCLUDE_DIRS "/usr/include") set(DBUS_FOLDER ${CMAKE_SOURCE_DIR}/../../../dbusInterfaces) diff --git a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp b/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp index dbddf47..c59ac06 100644 --- a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp +++ b/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp @@ -23,8 +23,15 @@ */ #include "controlInterfaceTest.h" +#include +#include +#include +#include +using namespace am; +using namespace testing; +DLT_DECLARE_CONTEXT(DLT_CONTEXT) controlInterfaceTest::controlInterfaceTest() :plistCommandPluginDirs(), @@ -55,14 +62,14 @@ controlInterfaceTest::~controlInterfaceTest() void controlInterfaceTest::SetUp() { DLT_REGISTER_APP("Rtest","RoutingInterfacetest"); - DLT_REGISTER_CONTEXT(AudioManager,"Main","Main Context"); - DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("RoutingSendInterface Test started ")); + DLT_REGISTER_CONTEXT(DLT_CONTEXT,"Main","Main Context"); + DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("RoutingSendInterface Test started ")); } void controlInterfaceTest::TearDown() { - DLT_UNREGISTER_CONTEXT(AudioManager); + DLT_UNREGISTER_CONTEXT(DLT_CONTEXT); } TEST_F(controlInterfaceTest,registerDomain) @@ -467,7 +474,6 @@ TEST_F(controlInterfaceTest,ackSetSourceSoundProperty) am_sourceID_t sourceID; am_Domain_s domain; am_domainID_t domainID; - am_volume_t volume; std::vector handlesList; am_Handle_s handle; am_SoundProperty_s soundProperty; diff --git a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h b/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h index 4d83b8f..a3a2a50 100644 --- a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h +++ b/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h @@ -28,10 +28,6 @@ #include #include #include -#include -#include -#include -#include #include "MockInterfaces.h" #include "DatabaseHandler.h" #include "ControlReceiver.h" @@ -44,41 +40,20 @@ #include "../ControlInterfaceBackdoor.h" #include "../CommonFunctions.h" -DLT_DECLARE_CONTEXT(AudioManager) -using namespace testing; -using namespace am; +namespace am { -using ::testing::Field; -using ::testing::Property; -using ::testing::Matcher; -using ::testing::Pointee; -using ::testing::AllOf; -using ::testing::SafeMatcherCast; -using ::testing::MatcherCast; -using ::testing::DefaultValue; -using ::testing::Eq; -using ::testing::An; -using ::testing::ElementsAreArray; -using ::testing::ElementsAre; -using ::testing::NotNull; -using ::testing::Assign; -using ::testing::SetArgReferee; -using ::testing::DoAll; -using ::testing::MatcherInterface; -using ::testing::MatchResultListener; - -class controlInterfaceTest : public Test{ +class controlInterfaceTest : public ::testing::Test{ public: controlInterfaceTest(); ~controlInterfaceTest(); - std::vector plistRoutingPluginDirs; std::vector plistCommandPluginDirs; + std::vector plistRoutingPluginDirs; DatabaseHandler pDatabaseHandler; RoutingSender pRoutingSender; CommandSender pCommandSender; - MockRoutingSendInterface pMockRoutingInterface; MockControlSendInterface pMockControlInterface; + MockRoutingSendInterface pMockRoutingInterface; ControlSender pControlSender; RoutingInterfaceBackdoor pRoutingInterfaceBackdoor; CommandInterfaceBackdoor pCommandInterfaceBackdoor; @@ -91,4 +66,6 @@ public: void TearDown(); }; +} + #endif /* ROUTINGINTERFACETEST_H_ */ diff --git a/AudioManagerDaemon/test/database/CMakeLists.txt b/AudioManagerDaemon/test/database/CMakeLists.txt index 4d01d41..59c40e8 100644 --- a/AudioManagerDaemon/test/database/CMakeLists.txt +++ b/AudioManagerDaemon/test/database/CMakeLists.txt @@ -25,9 +25,8 @@ cmake_minimum_required(VERSION 2.6) PROJECT(datbaseTest) -set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic") #set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic") -set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DUNIT_TEST=1") +set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DUNIT_TEST=1 -DDLT_CONTEXT=AudioManager") set(STD_INCLUDE_DIRS "/usr/include") set(DBUS_FOLDER ${CMAKE_SOURCE_DIR}/../../../dbusInterfaces) diff --git a/AudioManagerDaemon/test/database/databaseTest.cpp b/AudioManagerDaemon/test/database/databaseTest.cpp index f8d69fe..fc74f89 100644 --- a/AudioManagerDaemon/test/database/databaseTest.cpp +++ b/AudioManagerDaemon/test/database/databaseTest.cpp @@ -26,6 +26,9 @@ #include "databaseTest.h" using namespace am; +using namespace testing; + +DLT_DECLARE_CONTEXT(DLT_CONTEXT) //extern int GetRandomNumber(int nLow, int nHigh); //extern bool equalSoundProperty (const am_SoundProperty_s a, const am_SoundProperty_s b); @@ -134,13 +137,13 @@ void databaseTest::createMainConnectionSetup() void databaseTest::SetUp() { DLT_REGISTER_APP("Dtest","AudioManagerDeamon"); - DLT_REGISTER_CONTEXT(AudioManager,"Main","Main Context"); - DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Database Test started ")); + DLT_REGISTER_CONTEXT(DLT_CONTEXT,"Main","Main Context"); + DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("Database Test started ")); } void databaseTest::TearDown() { - DLT_UNREGISTER_CONTEXT(AudioManager); + DLT_UNREGISTER_CONTEXT(DLT_CONTEXT); } TEST_F(databaseTest,crossfaders) diff --git a/AudioManagerDaemon/test/database/databaseTest.h b/AudioManagerDaemon/test/database/databaseTest.h index 67ac0a6..fd91487 100644 --- a/AudioManagerDaemon/test/database/databaseTest.h +++ b/AudioManagerDaemon/test/database/databaseTest.h @@ -44,11 +44,9 @@ #include "../CommandInterfaceBackdoor.h" #include "../CommonFunctions.h" -DLT_DECLARE_CONTEXT(AudioManager) +namespace am { -using namespace testing; - -class databaseTest : public Test { +class databaseTest : public ::testing::Test { public: databaseTest(); ~databaseTest(); @@ -69,4 +67,6 @@ public: void createMainConnectionSetup(); }; +} + #endif /* DATABASETEST_H_ */ diff --git a/AudioManagerDaemon/test/routingInterface/CMakeLists.txt b/AudioManagerDaemon/test/routingInterface/CMakeLists.txt index 0376683..654c726 100644 --- a/AudioManagerDaemon/test/routingInterface/CMakeLists.txt +++ b/AudioManagerDaemon/test/routingInterface/CMakeLists.txt @@ -25,9 +25,8 @@ cmake_minimum_required(VERSION 2.6) PROJECT(routingInterfaceTest) -set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic") #set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic") -set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUNIT_TEST=1") +set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUNIT_TEST=1 -DDLT_CONTEXT=AudioManager") set(STD_INCLUDE_DIRS "/usr/include") set(DBUS_FOLDER ${CMAKE_SOURCE_DIR}/../../../dbusInterfaces) diff --git a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp index 86f5959..ff67912 100644 --- a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp +++ b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp @@ -25,19 +25,10 @@ #include "routingInterfaceTest.h" -using ::testing::Field; -using ::testing::Property; -using ::testing::Matcher; -using ::testing::Pointee; -using ::testing::AllOf; -using ::testing::SafeMatcherCast; -using ::testing::MatcherCast; -using ::testing::DefaultValue; -using ::testing::Eq; -using ::testing::An; -using ::testing::ElementsAreArray; -using ::testing::ElementsAre; -using ::testing::NotNull; +using namespace am; +using namespace testing; + +DLT_DECLARE_CONTEXT(DLT_CONTEXT) routingInterfaceTest::routingInterfaceTest() :plistRoutingPluginDirs(), @@ -64,14 +55,14 @@ routingInterfaceTest::~routingInterfaceTest() void routingInterfaceTest::SetUp() { DLT_REGISTER_APP("Rtest","RoutingInterfacetest"); - DLT_REGISTER_CONTEXT(AudioManager,"Main","Main Context"); - DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("RoutingSendInterface Test started ")); + DLT_REGISTER_CONTEXT(DLT_CONTEXT,"Main","Main Context"); + DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("RoutingSendInterface Test started ")); } void routingInterfaceTest::TearDown() { - DLT_UNREGISTER_CONTEXT(AudioManager); + DLT_UNREGISTER_CONTEXT(DLT_CONTEXT); } TEST_F(routingInterfaceTest,abort) diff --git a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h index 1d5baaa..acd1264 100644 --- a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h +++ b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h @@ -42,12 +42,10 @@ #include "../CommandInterfaceBackdoor.h" #include "../CommonFunctions.h" -DLT_DECLARE_CONTEXT(AudioManager) -using namespace testing; -using namespace am; +namespace am { -class routingInterfaceTest : public Test{ +class routingInterfaceTest : public ::testing::Test{ public: routingInterfaceTest(); ~routingInterfaceTest(); @@ -66,4 +64,6 @@ public: void TearDown(); }; +} + #endif /* ROUTINGINTERFACETEST_H_ */ -- cgit v1.2.1