summaryrefslogtreecommitdiff
path: root/AudioManagerDaemon/test
diff options
context:
space:
mode:
authorchristian mueller <christian.ei.mueller@bmw.de>2012-01-30 18:38:07 +0100
committerchristian mueller <christian.ei.mueller@bmw.de>2012-01-31 17:40:32 +0100
commitad0c452e9890a35a1b7a6c2e2421e092c5cf2c2d (patch)
tree48cc38fa0a4ada0ece0f8571260c5438b64a675c /AudioManagerDaemon/test
parent58d62c4af578c10375bf9baa946e33f340c42a1f (diff)
downloadaudiomanager-ad0c452e9890a35a1b7a6c2e2421e092c5cf2c2d.tar.gz
* wrapping DLT calls in a new Class because of performance, codesize and lazyness reasons
* the whole project now compiles without a warning with -pedantic
Diffstat (limited to 'AudioManagerDaemon/test')
-rw-r--r--AudioManagerDaemon/test/controlInterface/CMakeLists.txt1
-rw-r--r--AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp9
-rw-r--r--AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h1
-rw-r--r--AudioManagerDaemon/test/database/CMakeLists.txt1
-rw-r--r--AudioManagerDaemon/test/database/databaseTest.cpp12
-rw-r--r--AudioManagerDaemon/test/database/databaseTest.h1
-rw-r--r--AudioManagerDaemon/test/routing/CMakeLists.txt1
-rw-r--r--AudioManagerDaemon/test/routing/routingTest.cpp913
-rw-r--r--AudioManagerDaemon/test/routing/routingTest.h1
-rw-r--r--AudioManagerDaemon/test/routingInterface/CMakeLists.txt1
-rw-r--r--AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp8
-rw-r--r--AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h1
-rw-r--r--AudioManagerDaemon/test/sockethandler/CMakeLists.txt1
-rw-r--r--AudioManagerDaemon/test/sockethandler/sockethandlerTest.cpp3
14 files changed, 913 insertions, 41 deletions
diff --git a/AudioManagerDaemon/test/controlInterface/CMakeLists.txt b/AudioManagerDaemon/test/controlInterface/CMakeLists.txt
index 0e4f1ee..5071326 100644
--- a/AudioManagerDaemon/test/controlInterface/CMakeLists.txt
+++ b/AudioManagerDaemon/test/controlInterface/CMakeLists.txt
@@ -53,6 +53,7 @@ file(GLOB CONTROL_INTERFACE_SRCS_CXX
"../../src/ControlReceiver.cpp"
"../../src/ControlSender.cpp"
"../../src/Router.cpp"
+ "../../src/DLTWrapper.cpp"
"../CommonFunctions.cpp"
"*.cpp"
)
diff --git a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp b/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp
index c22f175..599d15f 100644
--- a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp
+++ b/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp
@@ -27,12 +27,11 @@
#include <string>
#include <vector>
#include <set>
+#include "DLTWrapper.h"
using namespace am;
using namespace testing;
-DLT_DECLARE_CONTEXT(DLT_CONTEXT)
-
controlInterfaceTest::controlInterfaceTest() :
pDBusWrapper((DBusWrapper*) 1), //
plistCommandPluginDirs(), //
@@ -63,15 +62,11 @@ controlInterfaceTest::~controlInterfaceTest()
void controlInterfaceTest::SetUp()
{
- DLT_REGISTER_APP("Rtest", "RoutingInterfacetest");
- DLT_REGISTER_CONTEXT(DLT_CONTEXT, "Main", "Main Context");
- DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("RoutingSendInterface Test started "));
-
+ logInfo("RoutingSendInterface Test started");
}
void controlInterfaceTest::TearDown()
{
- DLT_UNREGISTER_CONTEXT(DLT_CONTEXT);
}
TEST_F(controlInterfaceTest,registerDomain)
diff --git a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h b/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h
index 0029d73..7eb182d 100644
--- a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h
+++ b/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h
@@ -28,7 +28,6 @@
#include <gtest/gtest.h>
#include <gmock/gmock.h>
#include <dbus/DBusWrapper.h>
-#include <dlt/dlt.h>
#include "MockInterfaces.h"
#include "DatabaseHandler.h"
#include "ControlReceiver.h"
diff --git a/AudioManagerDaemon/test/database/CMakeLists.txt b/AudioManagerDaemon/test/database/CMakeLists.txt
index 79aff0e..4f8ac3a 100644
--- a/AudioManagerDaemon/test/database/CMakeLists.txt
+++ b/AudioManagerDaemon/test/database/CMakeLists.txt
@@ -51,6 +51,7 @@ file(GLOB DATABASE_SRCS_CXX
"../../src/ControlReceiver.cpp"
"../../src/ControlSender.cpp"
"../../src/Router.cpp"
+ "../../src/DLTWrapper.cpp"
"../CommonFunctions.cpp"
"*.cpp"
)
diff --git a/AudioManagerDaemon/test/database/databaseTest.cpp b/AudioManagerDaemon/test/database/databaseTest.cpp
index 064cc05..6122505 100644
--- a/AudioManagerDaemon/test/database/databaseTest.cpp
+++ b/AudioManagerDaemon/test/database/databaseTest.cpp
@@ -32,12 +32,11 @@
#include "../ControlInterfaceBackdoor.h"
#include "../CommandInterfaceBackdoor.h"
#include "../CommonFunctions.h"
+#include "DLTWrapper.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);
@@ -54,8 +53,8 @@ routingTest::routingTest() :
pMockInterface(), //
pRoutingInterfaceBackdoor(), //
pCommandInterfaceBackdoor(), //
- pControlSender(""),//
- pRouter(&pDatabaseHandler,&pControlSender), //
+ pControlSender(""), //
+ pRouter(&pDatabaseHandler, &pControlSender), //
pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender, &pRouter), //
pObserver(&pCommandSender, &pRoutingSender)
{
@@ -148,14 +147,11 @@ void routingTest::createMainConnectionSetup()
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 "));
+ logInfo("Database Test started ");
}
void routingTest::TearDown()
{
- DLT_UNREGISTER_CONTEXT(DLT_CONTEXT);
}
TEST_F(routingTest,crossfaders)
diff --git a/AudioManagerDaemon/test/database/databaseTest.h b/AudioManagerDaemon/test/database/databaseTest.h
index 466567b..dd260b1 100644
--- a/AudioManagerDaemon/test/database/databaseTest.h
+++ b/AudioManagerDaemon/test/database/databaseTest.h
@@ -30,7 +30,6 @@
#include <gtest/gtest.h>
#include <gmock/gmock.h>
-#include <dlt/dlt.h>
#include <algorithm>
#include <string>
#include <vector>
diff --git a/AudioManagerDaemon/test/routing/CMakeLists.txt b/AudioManagerDaemon/test/routing/CMakeLists.txt
index 07d9b04..8f45741 100644
--- a/AudioManagerDaemon/test/routing/CMakeLists.txt
+++ b/AudioManagerDaemon/test/routing/CMakeLists.txt
@@ -51,6 +51,7 @@ file(GLOB ROUTING_SRCS_CXX
"../../src/ControlReceiver.cpp"
"../../src/ControlSender.cpp"
"../../src/Router.cpp"
+ "../../src/DLTWrapper.cpp"
"../CommonFunctions.cpp"
"*.cpp"
)
diff --git a/AudioManagerDaemon/test/routing/routingTest.cpp b/AudioManagerDaemon/test/routing/routingTest.cpp
index 2ed2c9b..fdfbcf8 100644
--- a/AudioManagerDaemon/test/routing/routingTest.cpp
+++ b/AudioManagerDaemon/test/routing/routingTest.cpp
@@ -33,19 +33,18 @@
#include "../ControlInterfaceBackdoor.h"
#include "../CommandInterfaceBackdoor.h"
#include "../CommonFunctions.h"
+#include "DLTWrapper.h"
#include <string.h>
using namespace am;
using namespace testing;
-DLT_DECLARE_CONTEXT(DLT_CONTEXT)
-
routingTest::routingTest() :
plistRoutingPluginDirs(), //
plistCommandPluginDirs(), //
pDatabaseHandler(std::string(":memory:")), //
pControlSender(std::string("")), //
- pRouter(&pDatabaseHandler,&pControlSender), //
+ pRouter(&pDatabaseHandler, &pControlSender), //
pRoutingSender(plistRoutingPluginDirs), //
pCommandSender(plistCommandPluginDirs), //
pMockInterface(), //
@@ -67,19 +66,720 @@ 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 "));
+ logInfo("Routing Test started ");
}
void routingTest::TearDown()
{
- DLT_UNREGISTER_CONTEXT(DLT_CONTEXT);
}
-ACTION(returnConnectionFormat)
+ACTION(returnConnectionFormat){
+arg3=arg2;
+}
+
+//test that checks 3 domains, one sink one source, longer lists of connectionformats.
+TEST_F(routingTest,simpleRoute3DomainsListConnectionFormats_2)
+{
+ 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_STEREO);
+ 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_MONO);
+ gwSource.listConnectionFormats.push_back(CF_STEREO);
+ 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_STEREO);
+ 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_STEREO);
+ 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);
+ gwSink1.listConnectionFormats.push_back(CF_STEREO);
+
+ 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(false);
+ gateway.convertionMatrix.push_back(false);
+ gateway.convertionMatrix.push_back(false);
+ gateway.convertionMatrix.push_back(true);
+ gateway.convertionMatrix.push_back(true);
+ gateway.convertionMatrix.push_back(false);
+ 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(false);
+ gateway1.convertionMatrix.push_back(false);
+ gateway1.convertionMatrix.push_back(false);
+ gateway1.convertionMatrix.push_back(true);
+ gateway1.name = "gateway1";
+
+ 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[1];
+
+ hopp2.sourceID = gwSourceID;
+ hopp2.sinkID = gwSinkID1;
+ hopp2.domainID = domainID2;
+ hopp2.connectionFormat = gwSink1.listConnectionFormats[1];
+
+ 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, longer lists of connectionformats.
+TEST_F(routingTest,simpleRoute3DomainsListConnectionFormats_1)
+{
+ 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_STEREO);
+ 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_STEREO);
+ gwSource.listConnectionFormats.push_back(CF_MONO);
+ 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_STEREO);
+ 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(false);
+ gateway.convertionMatrix.push_back(false);
+ gateway.convertionMatrix.push_back(false);
+ gateway.convertionMatrix.push_back(false);
+ gateway.convertionMatrix.push_back(true);
+ gateway.convertionMatrix.push_back(false);
+ 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, longer lists of connectionformats.
+TEST_F(routingTest,simpleRoute3DomainsListConnectionFormats)
+{
+ 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_STEREO);
+ 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_STEREO);
+ 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(false);
+ 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[1];
+
+ 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 4 domains, one sink and one source but there are 2 routes because there are 2 gateways
+TEST_F(routingTest,simpleRoute4Domains2Routes)
{
- arg3=arg2;
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(5);
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(5);
+ EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
+
+ //initialize 2 domains
+ am_Domain_s domain1, domain2, domain3, domain4;
+ am_domainID_t domainID1, domainID2, domainID3, domainID4;
+
+ 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;
+ domain4.domainID = 0;
+ domain4.name = "domain4";
+ domain4.busname = "domain4bus";
+ domain4.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));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain4,domainID4));
+
+ am_Source_s source, gwSource, gwSource1, gwSource2, gwSource3;
+ am_sourceID_t sourceID, gwSourceID, gwSourceID1, gwSourceID2, gwSourceID3;
+
+ 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);
+
+ gwSource2.domainID = domainID4;
+ gwSource2.name = "gwsource3";
+ gwSource2.sourceState = SS_OFF;
+ gwSource2.sourceID = 0;
+ gwSource2.sourceClassID = 5;
+ gwSource2.listConnectionFormats.push_back(CF_STEREO);
+
+ gwSource3.domainID = domainID3;
+ gwSource3.name = "gwsource4";
+ gwSource3.sourceState = SS_OFF;
+ gwSource3.sourceID = 0;
+ gwSource3.sourceClassID = 5;
+ gwSource3.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));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(gwSource2,gwSourceID2));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(gwSource3,gwSourceID3));
+
+ am_Sink_s sink, gwSink, gwSink1, gwSink2, gwSink3;
+ am_sinkID_t sinkID, gwSinkID, gwSinkID1, gwSinkID2, gwSinkID3;
+
+ 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);
+
+ gwSink2.domainID = domainID3;
+ gwSink2.name = "gwSink2";
+ gwSink2.sinkID = 0;
+ gwSink2.sinkClassID = 5;
+ gwSink2.muteState = MS_MUTED;
+ gwSink2.listConnectionFormats.push_back(CF_MONO);
+
+ gwSink3.domainID = domainID2;
+ gwSink3.name = "gwSink3";
+ gwSink3.sinkID = 0;
+ gwSink3.sinkClassID = 5;
+ gwSink3.muteState = MS_MUTED;
+ gwSink3.listConnectionFormats.push_back(CF_ANALOG);
+
+ sink.domainID = domainID4;
+ sink.name = "sink1";
+ sink.sinkID = 0;
+ sink.sinkClassID = 5;
+ sink.muteState = MS_MUTED;
+ sink.listConnectionFormats.push_back(CF_STEREO);
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(gwSink,gwSinkID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(gwSink1,gwSinkID1));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(gwSink2,gwSinkID2));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(gwSink3,gwSinkID3));
+
+ am_Gateway_s gateway, gateway1, gateway2, gateway3;
+ am_gatewayID_t gatewayID, gatewayID1, gatewayID2, gatewayID3;
+
+ 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 = "gateway1";
+
+ gateway2.controlDomainID = domainID3;
+ gateway2.gatewayID = 0;
+ gateway2.sinkID = gwSinkID2;
+ gateway2.sourceID = gwSourceID2;
+ gateway2.domainSourceID = domainID4;
+ gateway2.domainSinkID = domainID3;
+ gateway2.listSinkFormats = gwSink2.listConnectionFormats;
+ gateway2.listSourceFormats = gwSource2.listConnectionFormats;
+ gateway2.convertionMatrix.push_back(true);
+ gateway2.name = "gateway2";
+
+ gateway3.controlDomainID = domainID2;
+ gateway3.gatewayID = 0;
+ gateway3.sinkID = gwSinkID3;
+ gateway3.sourceID = gwSourceID3;
+ gateway3.domainSourceID = domainID3;
+ gateway3.domainSinkID = domainID2;
+ gateway3.listSinkFormats = gwSink3.listConnectionFormats;
+ gateway3.listSourceFormats = gwSource3.listConnectionFormats;
+ gateway3.convertionMatrix.push_back(true);
+ gateway3.name = "gateway3";
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterGatewayDB(gateway,gatewayID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterGatewayDB(gateway1,gatewayID1));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterGatewayDB(gateway2,gatewayID2));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterGatewayDB(gateway3,gatewayID3));
+
+ std::vector<am_Route_s> listRoutes;
+ std::vector<am_RoutingElement_s> listRoutingElements, listRoutingElements1;
+ am_RoutingElement_s hopp1;
+ am_RoutingElement_s hopp2;
+ am_RoutingElement_s hopp3;
+ am_RoutingElement_s hopp4;
+ am_RoutingElement_s hopp2alt;
+ am_RoutingElement_s hopp3alt;
+
+ 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 = gwSinkID2;
+ hopp3.domainID = domainID3;
+ hopp3.connectionFormat = gwSink2.listConnectionFormats[0];
+
+ hopp4.sourceID = gwSourceID2;
+ hopp4.sinkID = sinkID;
+ hopp4.domainID = domainID4;
+ hopp4.connectionFormat = sink.listConnectionFormats[0];
+
+ hopp2alt.sourceID = gwSourceID;
+ hopp2alt.sinkID = gwSinkID3;
+ hopp2alt.domainID = domainID2;
+ hopp2alt.connectionFormat = gwSink3.listConnectionFormats[0];
+
+ hopp3alt.sourceID = gwSourceID3;
+ hopp3alt.sinkID = gwSinkID2;
+ hopp3alt.domainID = domainID3;
+ hopp3alt.connectionFormat = gwSink2.listConnectionFormats[0];
+
+ listRoutingElements.push_back(hopp1);
+ listRoutingElements.push_back(hopp2);
+ listRoutingElements.push_back(hopp3);
+ listRoutingElements.push_back(hopp4);
+ listRoutingElements1.push_back(hopp1);
+ listRoutingElements1.push_back(hopp2alt);
+ listRoutingElements1.push_back(hopp3alt);
+ listRoutingElements1.push_back(hopp4);
+
+ am_Route_s compareRoute, compareRoute1;
+ compareRoute.route = listRoutingElements;
+ compareRoute.sinkID = sinkID;
+ compareRoute.sourceID = sourceID;
+
+ compareRoute1.route = listRoutingElements1;
+ compareRoute1.sinkID = sinkID;
+ compareRoute1.sourceID = sourceID;
+
+ ASSERT_EQ(E_OK, pRouter.getRoute(false,sourceID,sinkID,listRoutes));
+ ASSERT_EQ(2, listRoutes.size());
+ ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
+ ASSERT_TRUE(pCF.compareRoute(compareRoute1,listRoutes[1]));
}
//test that checks 3 domains, one sink one source but the connectionformat of third domains do not fit.
@@ -87,7 +787,7 @@ 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)));
+ EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
//initialize 2 domains
am_Domain_s domain1, domain2, domain3;
@@ -232,7 +932,7 @@ 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)));
+ EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
//initialize 2 domains
am_Domain_s domain1, domain2;
@@ -340,7 +1040,7 @@ 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)));
+ EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
//initialize 2 domains
am_Domain_s domain1, domain2;
@@ -446,7 +1146,7 @@ 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)));
+ EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
//initialize 2 domains
am_Domain_s domain1, domain2, domain3;
@@ -588,6 +1288,193 @@ TEST_F(routingTest,simpleRoute3Domains)
ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
}
+//test that checks 4 domains, one sink and one source.
+TEST_F(routingTest,simpleRoute4Domains)
+{
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(4);
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(4);
+ EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
+
+ //initialize 2 domains
+ am_Domain_s domain1, domain2, domain3, domain4;
+ am_domainID_t domainID1, domainID2, domainID3, domainID4;
+
+ 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;
+ domain4.domainID = 0;
+ domain4.name = "domain4";
+ domain4.busname = "domain4bus";
+ domain4.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));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain4,domainID4));
+
+ am_Source_s source, gwSource, gwSource1, gwSource2;
+ am_sourceID_t sourceID, gwSourceID, gwSourceID1, gwSourceID2;
+
+ 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);
+
+ gwSource2.domainID = domainID4;
+ gwSource2.name = "gwsource3";
+ gwSource2.sourceState = SS_OFF;
+ gwSource2.sourceID = 0;
+ gwSource2.sourceClassID = 5;
+ gwSource2.listConnectionFormats.push_back(CF_STEREO);
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(gwSource,gwSourceID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(gwSource1,gwSourceID1));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(gwSource2,gwSourceID2));
+
+ am_Sink_s sink, gwSink, gwSink1, gwSink2;
+ am_sinkID_t sinkID, gwSinkID, gwSinkID1, gwSinkID2;
+
+ 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);
+
+ gwSink2.domainID = domainID3;
+ gwSink2.name = "gwSink2";
+ gwSink2.sinkID = 0;
+ gwSink2.sinkClassID = 5;
+ gwSink2.muteState = MS_MUTED;
+ gwSink2.listConnectionFormats.push_back(CF_MONO);
+
+ sink.domainID = domainID4;
+ sink.name = "sink1";
+ sink.sinkID = 0;
+ sink.sinkClassID = 5;
+ sink.muteState = MS_MUTED;
+ sink.listConnectionFormats.push_back(CF_STEREO);
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(gwSink,gwSinkID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(gwSink1,gwSinkID1));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(gwSink2,gwSinkID2));
+
+ am_Gateway_s gateway, gateway1, gateway2;
+ am_gatewayID_t gatewayID, gatewayID1, gatewayID2;
+
+ 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 = "gateway1";
+
+ gateway2.controlDomainID = domainID3;
+ gateway2.gatewayID = 0;
+ gateway2.sinkID = gwSinkID2;
+ gateway2.sourceID = gwSourceID2;
+ gateway2.domainSourceID = domainID4;
+ gateway2.domainSinkID = domainID3;
+ gateway2.listSinkFormats = gwSink2.listConnectionFormats;
+ gateway2.listSourceFormats = gwSource2.listConnectionFormats;
+ gateway2.convertionMatrix.push_back(true);
+ gateway2.name = "gateway2";
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterGatewayDB(gateway,gatewayID));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterGatewayDB(gateway1,gatewayID1));
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterGatewayDB(gateway2,gatewayID2));
+
+ std::vector<am_Route_s> listRoutes;
+ std::vector<am_RoutingElement_s> listRoutingElements;
+ am_RoutingElement_s hopp1;
+ am_RoutingElement_s hopp2;
+ am_RoutingElement_s hopp3;
+ am_RoutingElement_s hopp4;
+
+ 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 = gwSinkID2;
+ hopp3.domainID = domainID3;
+ hopp3.connectionFormat = gwSink2.listConnectionFormats[0];
+
+ hopp4.sourceID = gwSourceID2;
+ hopp4.sinkID = sinkID;
+ hopp4.domainID = domainID4;
+ hopp4.connectionFormat = sink.listConnectionFormats[0];
+
+ listRoutingElements.push_back(hopp1);
+ listRoutingElements.push_back(hopp2);
+ listRoutingElements.push_back(hopp3);
+ listRoutingElements.push_back(hopp4);
+
+ 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]));
+}
+
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
diff --git a/AudioManagerDaemon/test/routing/routingTest.h b/AudioManagerDaemon/test/routing/routingTest.h
index 4b6b16b..915c239 100644
--- a/AudioManagerDaemon/test/routing/routingTest.h
+++ b/AudioManagerDaemon/test/routing/routingTest.h
@@ -30,7 +30,6 @@
#include <gtest/gtest.h>
#include <gmock/gmock.h>
-#include <dlt/dlt.h>
#include <algorithm>
#include <string>
#include <vector>
diff --git a/AudioManagerDaemon/test/routingInterface/CMakeLists.txt b/AudioManagerDaemon/test/routingInterface/CMakeLists.txt
index 8d232f6..5b5da3c 100644
--- a/AudioManagerDaemon/test/routingInterface/CMakeLists.txt
+++ b/AudioManagerDaemon/test/routingInterface/CMakeLists.txt
@@ -53,6 +53,7 @@ file(GLOB ROUTING_INTERFACE_SRCS_CXX
"../../src/Router.cpp"
"../../src/ControlSender.cpp"
"../CommonFunctions.cpp"
+ "../../src/DLTWrapper.cpp"
"*.cpp"
)
diff --git a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp
index 5adb863..61ca296 100644
--- a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp
+++ b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp
@@ -24,12 +24,11 @@
*/
#include "routingInterfaceTest.h"
+#include "DLTWrapper.h"
using namespace am;
using namespace testing;
-DLT_DECLARE_CONTEXT(DLT_CONTEXT)
-
routingInterfaceTest::routingInterfaceTest() :
plistRoutingPluginDirs(), //
plistCommandPluginDirs(), //
@@ -56,15 +55,12 @@ routingInterfaceTest::~routingInterfaceTest()
void routingInterfaceTest::SetUp()
{
- DLT_REGISTER_APP("Rtest", "RoutingInterfacetest");
- DLT_REGISTER_CONTEXT(DLT_CONTEXT, "Main", "Main Context");
- DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("RoutingSendInterface Test started "));
+ logInfo("RoutingSendInterface Test started ");
}
void routingInterfaceTest::TearDown()
{
- DLT_UNREGISTER_CONTEXT(DLT_CONTEXT);
}
TEST_F(routingInterfaceTest,abort)
diff --git a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h
index 8ad77eb..0608eb4 100644
--- a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h
+++ b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h
@@ -28,7 +28,6 @@
#include <gtest/gtest.h>
#include <gmock/gmock.h>
-#include <dlt/dlt.h>
#include <algorithm>
#include <string>
#include <vector>
diff --git a/AudioManagerDaemon/test/sockethandler/CMakeLists.txt b/AudioManagerDaemon/test/sockethandler/CMakeLists.txt
index ba1eb80..8858e5a 100644
--- a/AudioManagerDaemon/test/sockethandler/CMakeLists.txt
+++ b/AudioManagerDaemon/test/sockethandler/CMakeLists.txt
@@ -52,6 +52,7 @@ INCLUDE_DIRECTORIES(
file(GLOB Socket_SRCS_CXX
"../../src/SocketHandler.cpp"
+ "../../src/DLTWrapper.cpp"
"*.cpp"
)
diff --git a/AudioManagerDaemon/test/sockethandler/sockethandlerTest.cpp b/AudioManagerDaemon/test/sockethandler/sockethandlerTest.cpp
index 0ac36fa..9165fa2 100644
--- a/AudioManagerDaemon/test/sockethandler/sockethandlerTest.cpp
+++ b/AudioManagerDaemon/test/sockethandler/sockethandlerTest.cpp
@@ -14,15 +14,12 @@
#include <netdb.h>
#include <fcntl.h>
#include <sys/un.h>
-#include <dlt/dlt.h>
#define SOCK_PATH "/tmp/mysock"
using namespace testing;
using namespace am;
-DLT_DECLARE_CONTEXT(AudioManager)
-
sockethandlerTest::sockethandlerTest()
{
}