summaryrefslogtreecommitdiff
path: root/AudioManagerDaemon/test
diff options
context:
space:
mode:
authorchristian mueller <christian.ei.mueller@bmw.de>2012-01-25 16:34:37 +0100
committerchristian mueller <christian.ei.mueller@bmw.de>2012-01-25 16:34:37 +0100
commit93c6b1973d59ce225e9cb5d2bcaea7d01c5fda52 (patch)
tree534c61f088fbfcdbf53e55cd53c922d2670ea97a /AudioManagerDaemon/test
parentaf0ba5b505b361679c07899187b7043d867742c3 (diff)
downloadaudiomanager-93c6b1973d59ce225e9cb5d2bcaea7d01c5fda52.tar.gz
* routing algorithm improvements
* routing algorithms first tests
Diffstat (limited to 'AudioManagerDaemon/test')
-rw-r--r--AudioManagerDaemon/test/CMakeLists.txt1
-rw-r--r--AudioManagerDaemon/test/controlInterface/MockInterfaces.h2
-rw-r--r--AudioManagerDaemon/test/database/CMakeLists.txt1
-rw-r--r--AudioManagerDaemon/test/database/databaseTest.cpp2
-rw-r--r--AudioManagerDaemon/test/routing/CMakeLists.txt77
-rw-r--r--AudioManagerDaemon/test/routing/MockInterfaces.h174
-rw-r--r--AudioManagerDaemon/test/routing/routingTest.cpp606
-rw-r--r--AudioManagerDaemon/test/routing/routingTest.h80
-rw-r--r--AudioManagerDaemon/test/routingInterface/CMakeLists.txt1
9 files changed, 943 insertions, 1 deletions
diff --git a/AudioManagerDaemon/test/CMakeLists.txt b/AudioManagerDaemon/test/CMakeLists.txt
index f00ec41..7450c99 100644
--- a/AudioManagerDaemon/test/CMakeLists.txt
+++ b/AudioManagerDaemon/test/CMakeLists.txt
@@ -16,6 +16,7 @@ set(EXECUTABLE_OUTPUT_PATH ${TEST_EXECUTABLE_OUTPUT_PATH})
FIND_PACKAGE(GTest REQUIRED)
add_subdirectory (database)
+add_subdirectory (routing)
add_subdirectory (routingInterface)
add_subdirectory (controlInterface)
add_subdirectory (sockethandler)
diff --git a/AudioManagerDaemon/test/controlInterface/MockInterfaces.h b/AudioManagerDaemon/test/controlInterface/MockInterfaces.h
index b4a4eec..9ac325f 100644
--- a/AudioManagerDaemon/test/controlInterface/MockInterfaces.h
+++ b/AudioManagerDaemon/test/controlInterface/MockInterfaces.h
@@ -155,6 +155,8 @@ class MockControlSendInterface : public ControlSendInterface {
void(const am_Handle_s handle, const am_Error_e error));
MOCK_METHOD2(cbAckSetSinkSoundProperty,
void(const am_Handle_s handle, const am_Error_e error));
+ MOCK_METHOD4(getConnectionFormatChoice,
+ am_Error_e(const am_sourceID_t sourceID, const am_sinkID_t sinkID, const std::vector<am_ConnectionFormat_e> listPossibleConnectionFormats, std::vector<am_ConnectionFormat_e>& listPrioConnectionFormats));
MOCK_CONST_METHOD0(getInterfaceVersion,
uint16_t());
};
diff --git a/AudioManagerDaemon/test/database/CMakeLists.txt b/AudioManagerDaemon/test/database/CMakeLists.txt
index 9e870d7..79aff0e 100644
--- a/AudioManagerDaemon/test/database/CMakeLists.txt
+++ b/AudioManagerDaemon/test/database/CMakeLists.txt
@@ -49,6 +49,7 @@ file(GLOB DATABASE_SRCS_CXX
"../../src/CommandSender.cpp"
"../../src/RoutingSender.cpp"
"../../src/ControlReceiver.cpp"
+ "../../src/ControlSender.cpp"
"../../src/Router.cpp"
"../CommonFunctions.cpp"
"*.cpp"
diff --git a/AudioManagerDaemon/test/database/databaseTest.cpp b/AudioManagerDaemon/test/database/databaseTest.cpp
index 5d53610..9913011 100644
--- a/AudioManagerDaemon/test/database/databaseTest.cpp
+++ b/AudioManagerDaemon/test/database/databaseTest.cpp
@@ -52,7 +52,7 @@ routingTest::routingTest() :
pRoutingSender(plistRoutingPluginDirs), //
pCommandSender(plistCommandPluginDirs), //
pMockInterface(), //
- pRoutingInterfaceBackdoor(),//
+ pRoutingInterfaceBackdoor(), //
pCommandInterfaceBackdoor(), //
pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender), //
pObserver(&pCommandSender, &pRoutingSender)
diff --git a/AudioManagerDaemon/test/routing/CMakeLists.txt b/AudioManagerDaemon/test/routing/CMakeLists.txt
new file mode 100644
index 0000000..07d9b04
--- /dev/null
+++ b/AudioManagerDaemon/test/routing/CMakeLists.txt
@@ -0,0 +1,77 @@
+#
+# Copyright (C) 2011, BMW AG
+#
+# GeniviAudioMananger DatbaseTest
+#
+# \file CMakeLists.txt
+#
+# \date 20-Oct-2011 3:42:04 PM
+# \author Christian Mueller (christian.ei.mueller@bmw.de)
+#
+# \section License
+# GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+# Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+#
+# This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+# 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 Lesser General Public License, version 2.1, for more details.
+# You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+# Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+# Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+# As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+# Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+#
+
+cmake_minimum_required(VERSION 2.6)
+
+PROJECT(routingTest)
+
+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DUNIT_TEST=1 -DDLT_CONTEXT=AudioManager")
+
+FIND_PACKAGE(PkgConfig)
+pkg_check_modules(SQLITE REQUIRED sqlite3)
+pkg_check_modules(DLT REQUIRED automotive-dlt)
+
+INCLUDE_DIRECTORIES(
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${AUDIO_INCLUDES_FOLDER}
+ ${DBUS_ARCH_INCLUDE_DIR}
+ ${DBUS_INCLUDES_FOLDER}
+ ${CMAKE_SOURCE_DIR}
+ ${STD_INCLUDE_DIRS}
+ ${DLT_INCLUDE_DIRS}
+ ${DBUS_INCLUDE_DIR}
+ ${INCLUDES_FOLDER}
+)
+
+file(GLOB ROUTING_SRCS_CXX
+ "../../src/DatabaseHandler.cpp"
+ "../../src/DatabaseObserver.cpp"
+ "../../src/CommandSender.cpp"
+ "../../src/RoutingSender.cpp"
+ "../../src/ControlReceiver.cpp"
+ "../../src/ControlSender.cpp"
+ "../../src/Router.cpp"
+ "../CommonFunctions.cpp"
+ "*.cpp"
+ )
+
+ADD_EXECUTABLE( routingtest ${ROUTING_SRCS_CXX})
+
+TARGET_LINK_LIBRARIES( routingtest
+ ${SQLITE_LIBRARIES}
+ ${DLT_LIBRARIES}
+ ${DBUS_LIBRARY}
+ ${CMAKE_THREAD_LIBS_INIT}
+ ${GTEST_LIBRARIES}
+ gmock
+)
+
+INSTALL(TARGETS routingtest
+ DESTINATION "~/AudioManagerTest/"
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
+ COMPONENT tests
+)
+
+SET(ADD_DEPEND "audiomanager-bin" "sqlite3(>=3.6.22)" "dlt" "libdbus-1-3(>=1.2.16)" "libgtest-dev(>=1.6.0-1)" "google-mock" "libpthread-stubs0")
+set_property(GLOBAL APPEND PROPERTY tests_prop "${ADD_DEPEND}")
+
diff --git a/AudioManagerDaemon/test/routing/MockInterfaces.h b/AudioManagerDaemon/test/routing/MockInterfaces.h
new file mode 100644
index 0000000..9ece31c
--- /dev/null
+++ b/AudioManagerDaemon/test/routing/MockInterfaces.h
@@ -0,0 +1,174 @@
+/**
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file MockInterfaces.h
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * 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 Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
+
+#ifndef MOCKROUTINGINTERFACE_H_
+#define MOCKROUTINGINTERFACE_H_
+
+#include <control/ControlSendInterface.h>
+#include <command/CommandSendInterface.h>
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+namespace am
+{
+
+class MockCommandSendInterface : public CommandSendInterface {
+ public:
+ MOCK_METHOD1(startupInterface,
+ am_Error_e(CommandReceiveInterface* commandreceiveinterface));
+ MOCK_METHOD0(stopInterface,
+ am_Error_e());
+ MOCK_METHOD0(cbCommunicationReady,
+ am_Error_e());
+ MOCK_METHOD0(cbCommunicationRundown,
+ am_Error_e());
+ MOCK_METHOD0(cbNumberOfMainConnectionsChanged,
+ void());
+ MOCK_METHOD0(cbNumberOfSinksChanged,
+ void());
+ MOCK_METHOD0(cbNumberOfSourcesChanged,
+ void());
+ MOCK_METHOD0(cbNumberOfSinkClassesChanged,
+ void());
+ MOCK_METHOD0(cbNumberOfSourceClassesChanged,
+ void());
+ MOCK_METHOD2(cbMainConnectionStateChanged,
+ void(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState));
+ MOCK_METHOD2(cbMainSinkSoundPropertyChanged,
+ void(const am_sinkID_t sinkID, const am_MainSoundProperty_s soundProperty));
+ MOCK_METHOD2(cbMainSourceSoundPropertyChanged,
+ void(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty));
+ MOCK_METHOD2(cbSinkAvailabilityChanged,
+ void(const am_sinkID_t sinkID, const am_Availability_s& availability));
+ MOCK_METHOD2(cbSourceAvailabilityChanged,
+ void(const am_sourceID_t sourceID, const am_Availability_s& availability));
+ MOCK_METHOD2(cbVolumeChanged,
+ void(const am_sinkID_t sinkID, const am_mainVolume_t volume));
+ MOCK_METHOD2(cbSinkMuteStateChanged,
+ void(const am_sinkID_t sinkID, const am_MuteState_e muteState));
+ MOCK_METHOD1(cbSystemPropertyChanged,
+ void(const am_SystemProperty_s& systemProperty));
+ MOCK_METHOD2(cbTimingInformationChanged,
+ void(const am_timeSync_t time, const am_mainConnectionID_t mainConnectionID));
+ MOCK_CONST_METHOD0(getInterfaceVersion,
+ uint16_t());
+};
+
+
+class MockControlSendInterface: public ControlSendInterface
+{
+public:
+ MOCK_METHOD1(startupController,
+ am_Error_e(ControlReceiveInterface* controlreceiveinterface));
+ MOCK_METHOD0(stopController,
+ am_Error_e());
+ MOCK_METHOD0(hookAllPluginsLoaded,
+ void());
+ MOCK_METHOD3(hookUserConnectionRequest,
+ am_Error_e(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID));
+ MOCK_METHOD1(hookUserDisconnectionRequest,
+ am_Error_e(const am_mainConnectionID_t connectionID));
+ MOCK_METHOD2(hookUserSetMainSinkSoundProperty,
+ am_Error_e(const am_sinkID_t sinkID, const am_MainSoundProperty_s& soundProperty));
+ MOCK_METHOD2(hookUserSetMainSourceSoundProperty,
+ am_Error_e(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty));
+ MOCK_METHOD1(hookUserSetSystemProperty,
+ am_Error_e(const am_SystemProperty_s& property));
+ MOCK_METHOD2(hookUserVolumeChange,
+ am_Error_e(const am_sinkID_t SinkID, const am_mainVolume_t newVolume));
+ MOCK_METHOD2(hookUserVolumeStep,
+ am_Error_e(const am_sinkID_t SinkID, const int16_t increment));
+ MOCK_METHOD2(hookUserSetSinkMuteState,
+ am_Error_e(const am_sinkID_t sinkID, const am_MuteState_e muteState));
+ MOCK_METHOD2(hookSystemRegisterDomain,
+ am_Error_e(const am_Domain_s& domainData, am_domainID_t& domainID));
+ MOCK_METHOD1(hookSystemDeregisterDomain,
+ am_Error_e(const am_domainID_t domainID));
+ MOCK_METHOD1(hookSystemDomainRegistrationComplete,
+ void(const am_domainID_t domainID));
+ MOCK_METHOD2(hookSystemRegisterSink,
+ am_Error_e(const am_Sink_s& sinkData, am_sinkID_t& sinkID));
+ MOCK_METHOD1(hookSystemDeregisterSink,
+ am_Error_e(const am_sinkID_t sinkID));
+ MOCK_METHOD2(hookSystemRegisterSource,
+ am_Error_e(const am_Source_s& sourceData, am_sourceID_t& sourceID));
+ MOCK_METHOD1(hookSystemDeregisterSource,
+ am_Error_e(const am_sourceID_t sourceID));
+ MOCK_METHOD2(hookSystemRegisterGateway,
+ am_Error_e(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID));
+ MOCK_METHOD1(hookSystemDeregisterGateway,
+ am_Error_e(const am_gatewayID_t gatewayID));
+ MOCK_METHOD2(hookSystemRegisterCrossfader,
+ am_Error_e(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID));
+ MOCK_METHOD1(hookSystemDeregisterCrossfader,
+ am_Error_e(const am_crossfaderID_t crossfaderID));
+ MOCK_METHOD3(hookSystemSinkVolumeTick,
+ void(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume));
+ MOCK_METHOD3(hookSystemSourceVolumeTick,
+ void(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume));
+ MOCK_METHOD2(hookSystemInterruptStateChange,
+ void(const am_sourceID_t sourceID, const am_InterruptState_e interruptState));
+ MOCK_METHOD2(hookSystemSinkAvailablityStateChange,
+ void(const am_sinkID_t sinkID, const am_Availability_s& availability));
+ MOCK_METHOD2(hookSystemSourceAvailablityStateChange,
+ void(const am_sourceID_t sourceID, const am_Availability_s& availability));
+ MOCK_METHOD2(hookSystemDomainStateChange,
+ void(const am_domainID_t domainID, const am_DomainState_e state));
+ MOCK_METHOD1(hookSystemReceiveEarlyData,
+ void(const std::vector<am_EarlyData_s>& data));
+ MOCK_METHOD1(hookSystemSpeedChange,
+ void(const am_speed_t speed));
+ MOCK_METHOD2(hookSystemTimingInformationChanged,
+ void(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time));
+ MOCK_METHOD2(cbAckConnect,
+ void(const am_Handle_s handle, const am_Error_e errorID));
+ MOCK_METHOD2(cbAckDisconnect,
+ void(const am_Handle_s handle, const am_Error_e errorID));
+ MOCK_METHOD3(cbAckCrossFade,
+ void(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error));
+ MOCK_METHOD3(cbAckSetSinkVolumeChange,
+ void(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error));
+ MOCK_METHOD3(cbAckSetSourceVolumeChange,
+ void(const am_Handle_s handle, const am_volume_t voulme, const am_Error_e error));
+ MOCK_METHOD2(cbAckSetSourceState,
+ void(const am_Handle_s handle, const am_Error_e error));
+ MOCK_METHOD2(cbAckSetSourceSoundProperties,
+ void(const am_Handle_s handle, const am_Error_e error));
+ MOCK_METHOD2(cbAckSetSourceSoundProperty,
+ void(const am_Handle_s handle, const am_Error_e error));
+ MOCK_METHOD2(cbAckSetSinkSoundProperties,
+ void(const am_Handle_s handle, const am_Error_e error));
+ MOCK_METHOD2(cbAckSetSinkSoundProperty,
+ void(const am_Handle_s handle, const am_Error_e error));
+ MOCK_METHOD4(getConnectionFormatChoice,
+ am_Error_e(const am_sourceID_t sourceID, const am_sinkID_t sinkID, const std::vector<am_ConnectionFormat_e> listPossibleConnectionFormats, std::vector<am_ConnectionFormat_e>& listPrioConnectionFormats));
+ MOCK_CONST_METHOD0(getInterfaceVersion,
+ uint16_t());
+
+};
+
+} // namespace am
+
+#endif /* MOCKROUTINGINTERFACE_H_ */
diff --git a/AudioManagerDaemon/test/routing/routingTest.cpp b/AudioManagerDaemon/test/routing/routingTest.cpp
new file mode 100644
index 0000000..2950255
--- /dev/null
+++ b/AudioManagerDaemon/test/routing/routingTest.cpp
@@ -0,0 +1,606 @@
+/**
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file databasetest.cpp
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * 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 Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
+
+#include "routingTest.h"
+#include "MockInterfaces.h"
+#include "DatabaseHandler.h"
+#include "ControlReceiver.h"
+#include "ControlSender.h"
+#include "DatabaseObserver.h"
+#include "../ControlInterfaceBackdoor.h"
+#include "../CommandInterfaceBackdoor.h"
+#include "../CommonFunctions.h"
+#include <string.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);
+extern bool equalMainSoundProperty(const am_MainSoundProperty_s a, const am_MainSoundProperty_s b);
+extern bool equalRoutingElement(const am_RoutingElement_s a, const am_RoutingElement_s b);
+extern bool equalClassProperties(const am_ClassProperty_s a, const am_ClassProperty_s b);
+extern std::string int2string(int i);
+
+routingTest::routingTest() :
+ plistRoutingPluginDirs(), //
+ plistCommandPluginDirs(), //
+ pDatabaseHandler(std::string(":memory:")), //
+ pControlSender(std::string("")), //
+ pRouter(&pDatabaseHandler,&pControlSender), //
+ pRoutingSender(plistRoutingPluginDirs), //
+ pCommandSender(plistCommandPluginDirs), //
+ pMockInterface(), //
+ pMockControlInterface(), //
+ pRoutingInterfaceBackdoor(), //
+ pCommandInterfaceBackdoor(), //
+ pControlInterfaceBackdoor(), //
+ pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender), //
+ pObserver(&pCommandSender, &pRoutingSender)
+{
+ pDatabaseHandler.registerObserver(&pObserver);
+ pCommandInterfaceBackdoor.injectInterface(&pCommandSender, &pMockInterface);
+ pControlInterfaceBackdoor.replaceController(&pControlSender, &pMockControlInterface);
+}
+
+routingTest::~routingTest()
+{
+}
+
+void routingTest::SetUp()
+{
+ DLT_REGISTER_APP("Dtest", "AudioManagerDeamon");
+ DLT_REGISTER_CONTEXT(DLT_CONTEXT, "Main", "Main Context");
+ DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("Database Test started "));
+}
+
+void routingTest::TearDown()
+{
+ DLT_UNREGISTER_CONTEXT(DLT_CONTEXT);
+}
+
+ACTION(returnConnectionFormat)
+{
+ arg3=arg2;
+}
+
+
+
+//test that checks just 2 domains, one sink one source with only one connection format each
+TEST_F(routingTest,simpleRoute2Domains)
+{
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(2);
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(2);
+ EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(),Return(E_OK)));
+
+ //initialize 2 domains
+ am_Domain_s domain1, domain2;
+ am_domainID_t domainID1, domainID2;
+
+ domain1.domainID = 0;
+ domain1.name = "domain1";
+ domain1.busname = "domain1bus";
+ domain1.state = DS_CONTROLLED;
+ domain2.domainID = 0;
+ domain2.name = "domain2";
+ domain2.busname = "domain2bus";
+ domain2.state = DS_CONTROLLED;
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain1,domainID1));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain2,domainID2));
+
+ am_Source_s source, gwSource;
+ am_sourceID_t sourceID, gwSourceID;
+
+ source.domainID = domainID1;
+ source.name = "source1";
+ source.sourceState = SS_ON;
+ source.sourceID = 0;
+ source.sourceClassID = 5;
+ source.listConnectionFormats.push_back(CF_ANALOG);
+
+ gwSource.domainID = domainID2;
+ gwSource.name = "gwsource1";
+ gwSource.sourceState = SS_ON;
+ gwSource.sourceID = 0;
+ gwSource.sourceClassID = 5;
+ gwSource.listConnectionFormats.push_back(CF_MONO);
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(gwSource,gwSourceID));
+
+ am_Sink_s sink, gwSink;
+ am_sinkID_t sinkID, gwSinkID;
+
+ sink.domainID = domainID2;
+ sink.name = "sink1";
+ sink.sinkID = 0;
+ sink.sinkClassID = 5;
+ sink.muteState = MS_MUTED;
+ sink.listConnectionFormats.push_back(CF_MONO);
+
+ gwSink.domainID = domainID1;
+ gwSink.name = "gwSink";
+ gwSink.sinkID = 0;
+ gwSink.sinkClassID = 5;
+ gwSink.muteState = MS_MUTED;
+ gwSink.listConnectionFormats.push_back(CF_ANALOG);
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(gwSink,gwSinkID));
+
+ am_Gateway_s gateway;
+ am_gatewayID_t gatewayID;
+
+ gateway.controlDomainID = domainID1;
+ gateway.gatewayID = 0;
+ gateway.sinkID = gwSinkID;
+ gateway.sourceID = gwSourceID;
+ gateway.domainSourceID = domainID2;
+ gateway.domainSinkID = domainID1;
+ gateway.listSinkFormats = gwSink.listConnectionFormats;
+ gateway.listSourceFormats = gwSource.listConnectionFormats;
+ gateway.convertionMatrix.push_back(true);
+ gateway.name = "gateway";
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterGatewayDB(gateway,gatewayID));
+
+ std::vector<am_Route_s> listRoutes;
+ std::vector<am_RoutingElement_s> listRoutingElements;
+ am_RoutingElement_s hopp1;
+ am_RoutingElement_s hopp2;
+
+ hopp1.sinkID = gwSinkID;
+ hopp1.sourceID = sourceID;
+ hopp1.domainID = domainID1;
+ hopp1.connectionFormat = source.listConnectionFormats[0];
+
+ hopp2.sinkID = sinkID;
+ hopp2.sourceID = gwSourceID;
+ hopp2.domainID = domainID2;
+ hopp2.connectionFormat = sink.listConnectionFormats[0];
+
+ listRoutingElements.push_back(hopp1);
+ listRoutingElements.push_back(hopp2);
+
+ am_Route_s compareRoute;
+ compareRoute.route = listRoutingElements;
+ compareRoute.sinkID = sinkID;
+ compareRoute.sourceID = sourceID;
+
+ ASSERT_EQ(E_OK, pRouter.getRoute(false,sourceID,sinkID,listRoutes));
+ ASSERT_EQ(1, listRoutes.size());
+ ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
+
+}
+
+//test that checks just 2 domains, one sink one source but the connectionformat of source
+TEST_F(routingTest,simpleRoute2DomainsNoMatchConnectionFormats)
+{
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(2);
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(2);
+ EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(),Return(E_OK)));
+
+ //initialize 2 domains
+ am_Domain_s domain1, domain2;
+ am_domainID_t domainID1, domainID2;
+
+ domain1.domainID = 0;
+ domain1.name = "domain1";
+ domain1.busname = "domain1bus";
+ domain1.state = DS_CONTROLLED;
+ domain2.domainID = 0;
+ domain2.name = "domain2";
+ domain2.busname = "domain2bus";
+ domain2.state = DS_CONTROLLED;
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain1,domainID1));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain2,domainID2));
+
+ am_Source_s source, gwSource;
+ am_sourceID_t sourceID, gwSourceID;
+
+ source.domainID = domainID1;
+ source.name = "source1";
+ source.sourceState = SS_ON;
+ source.sourceID = 0;
+ source.sourceClassID = 5;
+ source.listConnectionFormats.push_back(CF_STEREO);
+
+ gwSource.domainID = domainID2;
+ gwSource.name = "gwsource1";
+ gwSource.sourceState = SS_ON;
+ gwSource.sourceID = 0;
+ gwSource.sourceClassID = 5;
+ gwSource.listConnectionFormats.push_back(CF_MONO);
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(gwSource,gwSourceID));
+
+ am_Sink_s sink, gwSink;
+ am_sinkID_t sinkID, gwSinkID;
+
+ sink.domainID = domainID2;
+ sink.name = "sink1";
+ sink.sinkID = 0;
+ sink.sinkClassID = 5;
+ sink.muteState = MS_MUTED;
+ sink.listConnectionFormats.push_back(CF_MONO);
+
+ gwSink.domainID = domainID1;
+ gwSink.name = "gwSink";
+ gwSink.sinkID = 0;
+ gwSink.sinkClassID = 5;
+ gwSink.muteState = MS_MUTED;
+ gwSink.listConnectionFormats.push_back(CF_ANALOG);
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(gwSink,gwSinkID));
+
+ am_Gateway_s gateway;
+ am_gatewayID_t gatewayID;
+
+ gateway.controlDomainID = domainID1;
+ gateway.gatewayID = 0;
+ gateway.sinkID = gwSinkID;
+ gateway.sourceID = gwSourceID;
+ gateway.domainSourceID = domainID2;
+ gateway.domainSinkID = domainID1;
+ gateway.listSinkFormats = gwSink.listConnectionFormats;
+ gateway.listSourceFormats = gwSource.listConnectionFormats;
+ gateway.convertionMatrix.push_back(true);
+ gateway.name = "gateway";
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterGatewayDB(gateway,gatewayID));
+
+ std::vector<am_Route_s> listRoutes;
+ std::vector<am_RoutingElement_s> listRoutingElements;
+ am_RoutingElement_s hopp1;
+ am_RoutingElement_s hopp2;
+
+ hopp1.sinkID = gwSinkID;
+ hopp1.sourceID = sourceID;
+ hopp1.domainID = domainID1;
+ hopp1.connectionFormat = source.listConnectionFormats[0];
+
+ hopp2.sinkID = sinkID;
+ hopp2.sourceID = gwSourceID;
+ hopp2.domainID = domainID2;
+ hopp2.connectionFormat = sink.listConnectionFormats[0];
+
+ listRoutingElements.push_back(hopp1);
+ listRoutingElements.push_back(hopp2);
+
+ am_Route_s compareRoute;
+ compareRoute.route = listRoutingElements;
+ compareRoute.sinkID = sinkID;
+ compareRoute.sourceID = sourceID;
+
+ ASSERT_EQ(E_OK, pRouter.getRoute(false,sourceID,sinkID,listRoutes));
+ ASSERT_EQ(0, listRoutes.size());
+}
+
+//test that checks 3 domains, one sink one source.
+TEST_F(routingTest,simpleRoute3Domains)
+{
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(3);
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(3);
+ EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(),Return(E_OK)));
+
+ //initialize 2 domains
+ am_Domain_s domain1, domain2, domain3;
+ am_domainID_t domainID1, domainID2, domainID3;
+
+ domain1.domainID = 0;
+ domain1.name = "domain1";
+ domain1.busname = "domain1bus";
+ domain1.state = DS_CONTROLLED;
+ domain2.domainID = 0;
+ domain2.name = "domain2";
+ domain2.busname = "domain2bus";
+ domain2.state = DS_CONTROLLED;
+ domain3.domainID = 0;
+ domain3.name = "domain3";
+ domain3.busname = "domain3bus";
+ domain3.state = DS_CONTROLLED;
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain1,domainID1));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain2,domainID2));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain3,domainID3));
+
+ am_Source_s source, gwSource, gwSource1;
+ am_sourceID_t sourceID, gwSourceID, gwSourceID1;
+
+ source.domainID = domainID1;
+ source.name = "source1";
+ source.sourceState = SS_ON;
+ source.sourceID = 0;
+ source.sourceClassID = 5;
+ source.listConnectionFormats.push_back(CF_MONO);
+
+ gwSource.domainID = domainID2;
+ gwSource.name = "gwsource1";
+ gwSource.sourceState = SS_ON;
+ gwSource.sourceID = 0;
+ gwSource.sourceClassID = 5;
+ gwSource.listConnectionFormats.push_back(CF_ANALOG);
+
+ gwSource1.domainID = domainID3;
+ gwSource1.name = "gwsource2";
+ gwSource1.sourceState = SS_ON;
+ gwSource1.sourceID = 0;
+ gwSource1.sourceClassID = 5;
+ gwSource1.listConnectionFormats.push_back(CF_MONO);
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(gwSource,gwSourceID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(gwSource1,gwSourceID1));
+
+ am_Sink_s sink, gwSink, gwSink1;
+ am_sinkID_t sinkID, gwSinkID, gwSinkID1;
+
+ sink.domainID = domainID3;
+ sink.name = "sink1";
+ sink.sinkID = 0;
+ sink.sinkClassID = 5;
+ sink.muteState = MS_MUTED;
+ sink.listConnectionFormats.push_back(CF_MONO);
+
+ gwSink.domainID = domainID1;
+ gwSink.name = "gwSink";
+ gwSink.sinkID = 0;
+ gwSink.sinkClassID = 5;
+ gwSink.muteState = MS_MUTED;
+ gwSink.listConnectionFormats.push_back(CF_MONO);
+
+ gwSink1.domainID = domainID2;
+ gwSink1.name = "gwSink1";
+ gwSink1.sinkID = 0;
+ gwSink1.sinkClassID = 5;
+ gwSink1.muteState = MS_MUTED;
+ gwSink1.listConnectionFormats.push_back(CF_ANALOG);
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(gwSink,gwSinkID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(gwSink1,gwSinkID1));
+
+ am_Gateway_s gateway, gateway1;
+ am_gatewayID_t gatewayID, gatewayID1;
+
+ gateway.controlDomainID = domainID1;
+ gateway.gatewayID = 0;
+ gateway.sinkID = gwSinkID;
+ gateway.sourceID = gwSourceID;
+ gateway.domainSourceID = domainID2;
+ gateway.domainSinkID = domainID1;
+ gateway.listSinkFormats = gwSink.listConnectionFormats;
+ gateway.listSourceFormats = gwSource.listConnectionFormats;
+ gateway.convertionMatrix.push_back(true);
+ gateway.name = "gateway";
+
+ gateway1.controlDomainID = domainID2;
+ gateway1.gatewayID = 0;
+ gateway1.sinkID = gwSinkID1;
+ gateway1.sourceID = gwSourceID1;
+ gateway1.domainSourceID = domainID3;
+ gateway1.domainSinkID = domainID2;
+ gateway1.listSinkFormats = gwSink1.listConnectionFormats;
+ gateway1.listSourceFormats = gwSource1.listConnectionFormats;
+ gateway1.convertionMatrix.push_back(true);
+ gateway1.name = "gateway";
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterGatewayDB(gateway,gatewayID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterGatewayDB(gateway1,gatewayID1));
+
+ std::vector<am_Route_s> listRoutes;
+ std::vector<am_RoutingElement_s> listRoutingElements;
+ am_RoutingElement_s hopp1;
+ am_RoutingElement_s hopp2;
+ am_RoutingElement_s hopp3;
+
+ hopp1.sourceID = sourceID;
+ hopp1.sinkID = gwSinkID;
+ hopp1.domainID = domainID1;
+ hopp1.connectionFormat = source.listConnectionFormats[0];
+
+ hopp2.sourceID = gwSourceID;
+ hopp2.sinkID = gwSinkID1;
+ hopp2.domainID = domainID2;
+ hopp2.connectionFormat = gwSink1.listConnectionFormats[0];
+
+ hopp3.sourceID = gwSourceID1;
+ hopp3.sinkID = sinkID;
+ hopp3.domainID = domainID3;
+ hopp3.connectionFormat = sink.listConnectionFormats[0];
+
+ listRoutingElements.push_back(hopp1);
+ listRoutingElements.push_back(hopp2);
+ listRoutingElements.push_back(hopp3);
+
+ am_Route_s compareRoute;
+ compareRoute.route = listRoutingElements;
+ compareRoute.sinkID = sinkID;
+ compareRoute.sourceID = sourceID;
+
+ ASSERT_EQ(E_OK, pRouter.getRoute(false,sourceID,sinkID,listRoutes));
+ ASSERT_EQ(1, listRoutes.size());
+ ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
+}
+
+//test that checks 3 domains, one sink one source but the connectionformat of third domains do not fit.
+TEST_F(routingTest,simpleRoute3DomainsNoConnection)
+{
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(3);
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(3);
+ EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(),Return(E_OK)));
+
+ //initialize 2 domains
+ am_Domain_s domain1, domain2, domain3;
+ am_domainID_t domainID1, domainID2, domainID3;
+
+ domain1.domainID = 0;
+ domain1.name = "domain1";
+ domain1.busname = "domain1bus";
+ domain1.state = DS_CONTROLLED;
+ domain2.domainID = 0;
+ domain2.name = "domain2";
+ domain2.busname = "domain2bus";
+ domain2.state = DS_CONTROLLED;
+ domain3.domainID = 0;
+ domain3.name = "domain3";
+ domain3.busname = "domain3bus";
+ domain3.state = DS_CONTROLLED;
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain1,domainID1));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain2,domainID2));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain3,domainID3));
+
+ am_Source_s source, gwSource, gwSource1;
+ am_sourceID_t sourceID, gwSourceID, gwSourceID1;
+
+ source.domainID = domainID1;
+ source.name = "source1";
+ source.sourceState = SS_ON;
+ source.sourceID = 0;
+ source.sourceClassID = 5;
+ source.listConnectionFormats.push_back(CF_MONO);
+
+ gwSource.domainID = domainID2;
+ gwSource.name = "gwsource1";
+ gwSource.sourceState = SS_ON;
+ gwSource.sourceID = 0;
+ gwSource.sourceClassID = 5;
+ gwSource.listConnectionFormats.push_back(CF_ANALOG);
+
+ gwSource1.domainID = domainID3;
+ gwSource1.name = "gwsource2";
+ gwSource1.sourceState = SS_ON;
+ gwSource1.sourceID = 0;
+ gwSource1.sourceClassID = 5;
+ gwSource1.listConnectionFormats.push_back(CF_MONO);
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(gwSource,gwSourceID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(gwSource1,gwSourceID1));
+
+ am_Sink_s sink, gwSink, gwSink1;
+ am_sinkID_t sinkID, gwSinkID, gwSinkID1;
+
+ sink.domainID = domainID3;
+ sink.name = "sink1";
+ sink.sinkID = 0;
+ sink.sinkClassID = 5;
+ sink.muteState = MS_MUTED;
+ sink.listConnectionFormats.push_back(CF_STEREO);
+
+ gwSink.domainID = domainID1;
+ gwSink.name = "gwSink";
+ gwSink.sinkID = 0;
+ gwSink.sinkClassID = 5;
+ gwSink.muteState = MS_MUTED;
+ gwSink.listConnectionFormats.push_back(CF_MONO);
+
+ gwSink1.domainID = domainID2;
+ gwSink1.name = "gwSink1";
+ gwSink1.sinkID = 0;
+ gwSink1.sinkClassID = 5;
+ gwSink1.muteState = MS_MUTED;
+ gwSink1.listConnectionFormats.push_back(CF_ANALOG);
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(gwSink,gwSinkID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(gwSink1,gwSinkID1));
+
+ am_Gateway_s gateway, gateway1;
+ am_gatewayID_t gatewayID, gatewayID1;
+
+ gateway.controlDomainID = domainID1;
+ gateway.gatewayID = 0;
+ gateway.sinkID = gwSinkID;
+ gateway.sourceID = gwSourceID;
+ gateway.domainSourceID = domainID2;
+ gateway.domainSinkID = domainID1;
+ gateway.listSinkFormats = gwSink.listConnectionFormats;
+ gateway.listSourceFormats = gwSource.listConnectionFormats;
+ gateway.convertionMatrix.push_back(true);
+ gateway.name = "gateway";
+
+ gateway1.controlDomainID = domainID2;
+ gateway1.gatewayID = 0;
+ gateway1.sinkID = gwSinkID1;
+ gateway1.sourceID = gwSourceID1;
+ gateway1.domainSourceID = domainID3;
+ gateway1.domainSinkID = domainID2;
+ gateway1.listSinkFormats = gwSink1.listConnectionFormats;
+ gateway1.listSourceFormats = gwSource1.listConnectionFormats;
+ gateway1.convertionMatrix.push_back(true);
+ gateway1.name = "gateway";
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterGatewayDB(gateway,gatewayID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterGatewayDB(gateway1,gatewayID1));
+
+ std::vector<am_Route_s> listRoutes;
+ std::vector<am_RoutingElement_s> listRoutingElements;
+ am_RoutingElement_s hopp1;
+ am_RoutingElement_s hopp2;
+ am_RoutingElement_s hopp3;
+
+ hopp1.sourceID = sourceID;
+ hopp1.sinkID = gwSinkID;
+ hopp1.domainID = domainID1;
+ hopp1.connectionFormat = source.listConnectionFormats[0];
+
+ hopp2.sourceID = gwSourceID;
+ hopp2.sinkID = gwSinkID1;
+ hopp2.domainID = domainID2;
+ hopp2.connectionFormat = gwSink1.listConnectionFormats[0];
+
+ hopp3.sourceID = gwSourceID1;
+ hopp3.sinkID = sinkID;
+ hopp3.domainID = domainID3;
+ hopp3.connectionFormat = sink.listConnectionFormats[0];
+
+ listRoutingElements.push_back(hopp1);
+ listRoutingElements.push_back(hopp2);
+ listRoutingElements.push_back(hopp3);
+
+ am_Route_s compareRoute;
+ compareRoute.route = listRoutingElements;
+ compareRoute.sinkID = sinkID;
+ compareRoute.sourceID = sourceID;
+
+ ASSERT_EQ(E_OK, pRouter.getRoute(false,sourceID,sinkID,listRoutes));
+ ASSERT_EQ(0, listRoutes.size());
+ ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
+}
+
+int main(int argc, char **argv)
+{
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
+
diff --git a/AudioManagerDaemon/test/routing/routingTest.h b/AudioManagerDaemon/test/routing/routingTest.h
new file mode 100644
index 0000000..4b6b16b
--- /dev/null
+++ b/AudioManagerDaemon/test/routing/routingTest.h
@@ -0,0 +1,80 @@
+/**
+ * Copyright (C) 2011, BMW AG
+ *
+ * GeniviAudioMananger AudioManagerDaemon
+ *
+ * \file databasetest.h
+ *
+ * \date 20-Oct-2011 3:42:04 PM
+ * \author Christian Mueller (christian.ei.mueller@bmw.de)
+ *
+ * \section License
+ * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+ * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+ * 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 Lesser General Public License, version 2.1, for more details.
+ * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+ * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+ * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+ * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+ * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+ *
+ * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+ */
+
+#ifndef DATABASETEST_H_
+#define DATABASETEST_H_
+
+#define UNIT_TEST 1
+
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+#include <dlt/dlt.h>
+#include <algorithm>
+#include <string>
+#include <vector>
+#include <set>
+#include "MockInterfaces.h"
+#include "DatabaseHandler.h"
+#include "ControlReceiver.h"
+#include "ControlSender.h"
+#include "DatabaseObserver.h"
+#include "RoutingSender.h"
+#include "Router.h"
+#include "../ControlInterfaceBackdoor.h"
+#include "../CommandInterfaceBackdoor.h"
+#include "../CommonFunctions.h"
+
+namespace am
+{
+
+class routingTest: public ::testing::Test
+{
+public:
+ routingTest();
+ ~routingTest();
+ std::vector<std::string> plistRoutingPluginDirs;
+ std::vector<std::string> plistCommandPluginDirs;
+ DatabaseHandler pDatabaseHandler;
+ ControlSender pControlSender;
+ Router pRouter;
+ RoutingSender pRoutingSender;
+ CommandSender pCommandSender;
+ MockCommandSendInterface pMockInterface;
+ MockControlSendInterface pMockControlInterface;
+ RoutingInterfaceBackdoor pRoutingInterfaceBackdoor;
+ CommandInterfaceBackdoor pCommandInterfaceBackdoor;
+ ControlInterfaceBackdoor pControlInterfaceBackdoor;
+ ControlReceiver pControlReceiver;
+ DatabaseObserver pObserver;
+ CommonFunctions pCF;
+ void SetUp();
+ void TearDown();
+
+ void createMainConnectionSetup();
+};
+
+}
+
+#endif /* DATABASETEST_H_ */
diff --git a/AudioManagerDaemon/test/routingInterface/CMakeLists.txt b/AudioManagerDaemon/test/routingInterface/CMakeLists.txt
index c29084e..8d232f6 100644
--- a/AudioManagerDaemon/test/routingInterface/CMakeLists.txt
+++ b/AudioManagerDaemon/test/routingInterface/CMakeLists.txt
@@ -51,6 +51,7 @@ file(GLOB ROUTING_INTERFACE_SRCS_CXX
"../../src/CommandSender.cpp"
"../../src/RoutingSender.cpp"
"../../src/Router.cpp"
+ "../../src/ControlSender.cpp"
"../CommonFunctions.cpp"
"*.cpp"
)