summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchristian mueller <christian.ei.mueller@bmw.de>2012-01-31 17:50:54 +0100
committerchristian mueller <christian.ei.mueller@bmw.de>2012-01-31 17:50:54 +0100
commit1b659632bc7fa0c1daa021a2d52da390cedec9a7 (patch)
tree43c12b6c6fdb0c5466762910b18891bfe9383eaa
parentad0c452e9890a35a1b7a6c2e2421e092c5cf2c2d (diff)
downloadaudiomanager-1b659632bc7fa0c1daa021a2d52da390cedec9a7.tar.gz
* weired git error .. anyway should be ok now
-rw-r--r--AudioManagerDaemon/test/routing/routingTest.cpp572
-rw-r--r--includes/config.h1
2 files changed, 572 insertions, 1 deletions
diff --git a/AudioManagerDaemon/test/routing/routingTest.cpp b/AudioManagerDaemon/test/routing/routingTest.cpp
index fdfbcf8..b21e9ab 100644
--- a/AudioManagerDaemon/test/routing/routingTest.cpp
+++ b/AudioManagerDaemon/test/routing/routingTest.cpp
@@ -596,6 +596,577 @@ TEST_F(routingTest,simpleRoute4Domains2Routes)
gwSource.sourceClassID = 5;
gwSource.listConnectionFormats.push_back(CF_ANALOG);
+<<<<<<< HEAD
+ gwSource1.domainID = domainID3;
+ gwSource1.name = "gwsource2";
+ gwSource1.sourceState = SS_ON;
+ gwSource1.sourceID = 0;
+ gwSource1.sourceClassID = 5;
+ gwSource1.listConnectionFormats.push_back(CF_MONO);
+=======
+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, &pRouter), //
+ pObserver(&pCommandSender, &pRoutingSender)
+{
+ pDatabaseHandler.registerObserver(&pObserver);
+ pCommandInterfaceBackdoor.injectInterface(&pCommandSender, &pMockInterface);
+ pControlInterfaceBackdoor.replaceController(&pControlSender, &pMockControlInterface);
+}
+ 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));
+
+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)
+{
+ 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;
@@ -623,6 +1194,7 @@ TEST_F(routingTest,simpleRoute4Domains2Routes)
ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(gwSource2,gwSourceID2));
ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(gwSource3,gwSourceID3));
+>>>>>>> bef6b6f38de4f6b201a1b6ce24855c8894031602
am_Sink_s sink, gwSink, gwSink1, gwSink2, gwSink3;
am_sinkID_t sinkID, gwSinkID, gwSinkID1, gwSinkID2, gwSinkID3;
diff --git a/includes/config.h b/includes/config.h
index a7267c1..f23263c 100644
--- a/includes/config.h
+++ b/includes/config.h
@@ -2,7 +2,6 @@
#define _CONFIG_H
#define DAEMONVERSION "ver-0.0.1-17-gbef6b6f"
-
#define WITH_DBUS_WRAPPER
#define WITH_SOCKETHANDLER_LOOP
/* #undef WITH_SIMPLEDBUS_LOOP */