From: christian mueller Date: Mon, 30 Jan 2012 17:38:07 +0000 (+0100) Subject: * fixed non reference in routing interface peeksourceclassID and peeksinkclassID X-Git-Tag: build/2012-06-15.125948~86^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bef6b6f38de4f6b201a1b6ce24855c8894031602;p=profile%2Fivi%2Faudiomanager.git * fixed non reference in routing interface peeksourceclassID and peeksinkclassID * fixed bug in complexer usage of routing algorithm * added more router tests --- diff --git a/AudioManagerDaemon/include/RoutingReceiver.h b/AudioManagerDaemon/include/RoutingReceiver.h index 7c59978..90885ca 100644 --- a/AudioManagerDaemon/include/RoutingReceiver.h +++ b/AudioManagerDaemon/include/RoutingReceiver.h @@ -72,8 +72,8 @@ public: am_Error_e deregisterSource(const am_sourceID_t sourceID); am_Error_e registerCrossfader(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID); am_Error_e deregisterCrossfader(const am_crossfaderID_t crossfaderID); - am_Error_e peekSinkClassID(const std::string name, const am_sinkClass_t& sinkClassID); - am_Error_e peekSourceClassID(const std::string name, const am_sourceClass_t& sourceClassID); + am_Error_e peekSinkClassID(const std::string& name, const am_sinkClass_t& sinkClassID); + am_Error_e peekSourceClassID(const std::string& name, const am_sourceClass_t& sourceClassID); void hookInterruptStatusChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState); void hookDomainRegistrationComplete(const am_domainID_t domainID); void hookSinkAvailablityStatusChange(const am_sinkID_t sinkID, const am_Availability_s& availability); diff --git a/AudioManagerDaemon/src/Router.cpp b/AudioManagerDaemon/src/Router.cpp index 30d7f5f..afb6aa1 100644 --- a/AudioManagerDaemon/src/Router.cpp +++ b/AudioManagerDaemon/src/Router.cpp @@ -55,7 +55,6 @@ am_Error_e Router::getRoute(const bool onlyfree, const am_sourceID_t sourceID, c std::vector matchtree; std::vector listGatewayID; //holds all gateway ids of the route am_RoutingElement_s routingElement; - std::vector actualRoutingElement; //intermediate list of current routing pairs am_Route_s actualRoute; //holds the actual Route am_sourceID_t lastSource = 0; @@ -76,6 +75,7 @@ am_Error_e Router::getRoute(const bool onlyfree, const am_sourceID_t sourceID, c iterator = matchtree.begin(); for (; iterator != matchtree.end(); ++iterator) { + std::vector actualRoutingElement; //intermediate list of current routing pairs //getting the route for the actual item routingtree.getRoute(*iterator, listGatewayID); //This gives only the Gateway IDs we need more @@ -133,9 +133,10 @@ void Router::listPossibleConnectionFormats(const am_sourceID_t sourceID, const a std::vector listSinkFormats; mDatabaseHandler->getListSinkConnectionFormats(sinkID, listSinkFormats); mDatabaseHandler->getListSourceConnectionFormats(sourceID, listSourceFormats); + std::sort(listSinkFormats.begin(),listSinkFormats.end()); //todo: this might be not needed if we use strictly sorted input + std::sort(listSourceFormats.begin(),listSourceFormats.end()); //todo: this might be not needed if we use strictly sorted input std::insert_iterator > inserter(listFormats, listFormats.begin()); set_intersection(listSourceFormats.begin(), listSourceFormats.end(), listSinkFormats.begin(), listSinkFormats.end(), inserter); - std::vector::iterator it = listSourceFormats.begin(); } am_Error_e Router::findBestWay(std::vector & listRoute, std::vector::iterator routeIterator, std::vector::iterator gatewayIterator) @@ -157,6 +158,7 @@ am_Error_e Router::findBestWay(std::vector & listRoute, std std::vector::iterator tempIterator(routeIterator); tempIterator--; listRestrictedOutputFormatsGateways(*gatewayIterator, (tempIterator)->connectionFormat, listRestrictedConnectionFormats); + std::sort(listRestrictedConnectionFormats.begin(),listRestrictedConnectionFormats.end()); //todo: this might be not needed if we use strictly sorted input set_intersection(listConnectionFormats.begin(), listConnectionFormats.end(), listRestrictedConnectionFormats.begin(), listRestrictedConnectionFormats.end(), inserter); gatewayIterator++; } @@ -208,17 +210,17 @@ void Router::listRestrictedOutputFormatsGateways(const am_gatewayID_t gatewayID, int rowNumberSink = rowSinkIterator - gatewayData.listSinkFormats.begin(); //go through the convertionMatrix and find out if the conversion is possible, if yes, add connectionFormat ... - matrixIterator + rowNumberSink; + std::advance(matrixIterator, rowNumberSink); //iterate line-wise through the matrix and add more formats do { if (*matrixIterator) { - listFormats.push_back(gatewayData.listSourceFormats.at(matrixIterator - gatewayData.convertionMatrix.begin())); + listFormats.push_back(gatewayData.listSourceFormats.at((matrixIterator - gatewayData.convertionMatrix.begin()) / gatewayData.listSinkFormats.size())); } - matrixIterator += gatewayData.listSinkFormats.size(); - } while (matrixIterator - gatewayData.convertionMatrix.begin() < (int) gatewayData.listSourceFormats.size()); + std::advance(matrixIterator, gatewayData.listSinkFormats.size()); + } while (gatewayData.convertionMatrix.end() - matrixIterator > 0); } Router::~Router() diff --git a/AudioManagerDaemon/src/RoutingReceiver.cpp b/AudioManagerDaemon/src/RoutingReceiver.cpp index a6f35e7..00575fe 100644 --- a/AudioManagerDaemon/src/RoutingReceiver.cpp +++ b/AudioManagerDaemon/src/RoutingReceiver.cpp @@ -317,7 +317,7 @@ am_Error_e RoutingReceiver::sendChangedData(const std::vector & //todo: change return type to void in EA model } -am_Error_e RoutingReceiver::peekSinkClassID(const std::string name, const am_sinkClass_t& sinkClassID) +am_Error_e RoutingReceiver::peekSinkClassID(const std::string& name, const am_sinkClass_t& sinkClassID) { (void) name; (void) sinkClassID; @@ -325,7 +325,7 @@ am_Error_e RoutingReceiver::peekSinkClassID(const std::string name, const am_sin return E_NOT_USED; } -am_Error_e RoutingReceiver::peekSourceClassID(const std::string name, const am_sourceClass_t& sourceClassID) +am_Error_e RoutingReceiver::peekSourceClassID(const std::string& name, const am_sourceClass_t& sourceClassID) { (void) name; (void) sourceClassID; diff --git a/AudioManagerDaemon/test/routing/routingTest.cpp b/AudioManagerDaemon/test/routing/routingTest.cpp index 2ed2c9b..0037275 100644 --- a/AudioManagerDaemon/test/routing/routingTest.cpp +++ b/AudioManagerDaemon/test/routing/routingTest.cpp @@ -45,7 +45,7 @@ routingTest::routingTest() : plistCommandPluginDirs(), // pDatabaseHandler(std::string(":memory:")), // pControlSender(std::string("")), // - pRouter(&pDatabaseHandler,&pControlSender), // + pRouter(&pDatabaseHandler, &pControlSender), // pRoutingSender(plistRoutingPluginDirs), // pCommandSender(plistCommandPluginDirs), // pMockInterface(), // @@ -77,9 +77,713 @@ 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) { - arg3=arg2; + 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 listRoutes; + std::vector 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 listRoutes; + std::vector 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 listRoutes; + std::vector 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; + 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 listRoutes; + std::vector 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 +791,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 +936,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 +1044,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 +1150,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 +1292,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 listRoutes; + std::vector 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/CHANGELOG b/CHANGELOG index 5631de8..c2e3d31 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,9 +1,11 @@ -commit 002295bee9b1a4b4b97060458be4ab8d4cb43eda +commit 58d62c4af578c10375bf9baa946e33f340c42a1f Author: christian mueller * regenerated EA code based on Conti Feedback. * changed paths of audiomanagertypes include in generated files * changed order of parameters in asyncSetSinkSoundProperty / asyncSetSourceSoundProperty / cbTimingInformationChanged to have common style over all interfaces. + * changed default include paths for Controller etc... + * cleanup of warnings commit 93c6b1973d59ce225e9cb5d2bcaea7d01c5fda52 Author: christian mueller diff --git a/PluginRoutingInterfaceAsync/test/mocklnterfaces.h b/PluginRoutingInterfaceAsync/test/mocklnterfaces.h index 9241dc0..c3caa46 100644 --- a/PluginRoutingInterfaceAsync/test/mocklnterfaces.h +++ b/PluginRoutingInterfaceAsync/test/mocklnterfaces.h @@ -82,9 +82,9 @@ class MockRoutingReceiveInterface : public RoutingReceiveInterface { MOCK_METHOD1(deregisterCrossfader, am_Error_e(const am_crossfaderID_t crossfaderID)); MOCK_METHOD2(peekSourceClassID, - am_Error_e(const std::string name, const am_sourceClass_t& sourceClassID)); + am_Error_e(const std::string& name, const am_sourceClass_t& sourceClassID)); MOCK_METHOD2(peekSinkClassID, - am_Error_e(const std::string name, const am_sinkClass_t& sinkClassID)); + am_Error_e(const std::string& name, const am_sinkClass_t& sinkClassID)); MOCK_METHOD2(hookInterruptStatusChange, void(const am_sourceID_t sourceID, const am_InterruptState_e interruptState)); MOCK_METHOD1(hookDomainRegistrationComplete, diff --git a/includes/config.h b/includes/config.h index 920b050..483cd9e 100644 --- a/includes/config.h +++ b/includes/config.h @@ -1,7 +1,7 @@ #ifndef _CONFIG_H #define _CONFIG_H -#define DAEMONVERSION "ver-0.0.1-16-g002295b" +#define DAEMONVERSION "ver-0.0.1-16-g58d62c4" #define WITH_DBUS_WRAPPER #define WITH_SOCKETHANDLER_LOOP diff --git a/includes/routing/RoutingReceiveInterface.h b/includes/routing/RoutingReceiveInterface.h index ff33d61..e610f92 100644 --- a/includes/routing/RoutingReceiveInterface.h +++ b/includes/routing/RoutingReceiveInterface.h @@ -22,8 +22,8 @@ * * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN */ -#if !defined(EA_6B4A81F5_2BD8_4604_859D_4539E7E95638__INCLUDED_) -#define EA_6B4A81F5_2BD8_4604_859D_4539E7E95638__INCLUDED_ +#if !defined(EA_6B5234F4_E3F3_46f3_9B2A_892FD2A0236E__INCLUDED_) +#define EA_6B5234F4_E3F3_46f3_9B2A_892FD2A0236E__INCLUDED_ #include #include @@ -41,7 +41,7 @@ namespace am { * Routing Receive sendInterface description. This class implements everything from RoutingAdapter -> Audiomanager * @author christian * @version 1.0 - * @created 26-Jan-2012 6:00:53 PM + * @created 30-Jan-2012 6:29:29 PM */ class RoutingReceiveInterface { @@ -253,7 +253,7 @@ namespace am { * @param name * @param sourceClassID */ - virtual am_Error_e peekSourceClassID(const std::string name, const am_sourceClass_t& sourceClassID) =0; + virtual am_Error_e peekSourceClassID(const std::string& name, const am_sourceClass_t& sourceClassID) =0; /** * this function peeks a sourceclassID. It is used by the RoutingPlugins to determine the SinkClassIDs of a sinkClass. * @return E_OK on succes, E_DATABASE_ERROR on error @@ -261,7 +261,7 @@ namespace am { * @param name * @param sinkClassID */ - virtual am_Error_e peekSinkClassID(const std::string name, const am_sinkClass_t& sinkClassID) =0; + virtual am_Error_e peekSinkClassID(const std::string& name, const am_sinkClass_t& sinkClassID) =0; /** * is called when a low level interrupt changes it status. * @@ -332,4 +332,4 @@ namespace am { }; } -#endif // !defined(EA_6B4A81F5_2BD8_4604_859D_4539E7E95638__INCLUDED_) +#endif // !defined(EA_6B5234F4_E3F3_46f3_9B2A_892FD2A0236E__INCLUDED_)