summaryrefslogtreecommitdiff
path: root/AudioManagerDaemon/test
diff options
context:
space:
mode:
authorChristian Mueller <christian@lmuc329619u.(none)>2011-12-14 19:52:07 +0100
committerChristian Mueller <christian@lmuc329619u.(none)>2011-12-14 19:52:07 +0100
commitcad108114630deebde684267d67a5b648479679e (patch)
tree00761a3787a6ef7c821eb615a8a53971c41a29b6 /AudioManagerDaemon/test
parent68678bed2dc3d4a5849d283bec84a01e2836603f (diff)
downloadaudiomanager-cad108114630deebde684267d67a5b648479679e.tar.gz
first release !
Diffstat (limited to 'AudioManagerDaemon/test')
-rw-r--r--AudioManagerDaemon/test/CommandInterfaceBackdoor.h30
-rw-r--r--AudioManagerDaemon/test/CommonFunctions.cpp30
-rw-r--r--AudioManagerDaemon/test/CommonFunctions.h30
-rw-r--r--AudioManagerDaemon/test/ControlInterfaceBackdoor.h30
-rw-r--r--AudioManagerDaemon/test/RoutingInterfaceBackdoor.h30
-rw-r--r--AudioManagerDaemon/test/controlInterface/MockInterfaces.h29
-rw-r--r--AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp325
-rw-r--r--AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h29
-rw-r--r--AudioManagerDaemon/test/database/CMakeLists.txt1
-rw-r--r--AudioManagerDaemon/test/database/MockInterfaces.h164
-rw-r--r--AudioManagerDaemon/test/database/databaseTest.cpp203
-rw-r--r--AudioManagerDaemon/test/database/databaseTest.h49
-rw-r--r--AudioManagerDaemon/test/routingInterface/MockRoutingInterface.h30
-rw-r--r--AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp49
-rw-r--r--AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h30
15 files changed, 935 insertions, 124 deletions
diff --git a/AudioManagerDaemon/test/CommandInterfaceBackdoor.h b/AudioManagerDaemon/test/CommandInterfaceBackdoor.h
index c5cfc8a..3c94337 100644
--- a/AudioManagerDaemon/test/CommandInterfaceBackdoor.h
+++ b/AudioManagerDaemon/test/CommandInterfaceBackdoor.h
@@ -1,9 +1,27 @@
-/*
- * CommandInterfaceBackdoor.h
- *
- * Created on: Dec 10, 2011
- * Author: christian
- */
+/**
+* Copyright (C) 2011, BMW AG
+*
+* GeniviAudioMananger AudioManagerDaemon
+*
+* \file CommandInterfaceBackdoor.h
+*
+* \date 20-Oct-2011 3:42:04 PM
+* \author Christian Mueller (christian.ei.mueller@bmw.de)
+*
+* \section License
+* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+*
+* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+*
+* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+*/
#ifndef COMMANDINTERFACEBACKDOOR_H_
#define COMMANDINTERFACEBACKDOOR_H_
diff --git a/AudioManagerDaemon/test/CommonFunctions.cpp b/AudioManagerDaemon/test/CommonFunctions.cpp
index 734bbbc..1504412 100644
--- a/AudioManagerDaemon/test/CommonFunctions.cpp
+++ b/AudioManagerDaemon/test/CommonFunctions.cpp
@@ -1,9 +1,27 @@
-/*
- * CommonFunctions.cpp
- *
- * Created on: Dec 10, 2011
- * Author: christian
- */
+/**
+* Copyright (C) 2011, BMW AG
+*
+* GeniviAudioMananger AudioManagerDaemon
+*
+* \file CommonFunctions.cpp
+*
+* \date 20-Oct-2011 3:42:04 PM
+* \author Christian Mueller (christian.ei.mueller@bmw.de)
+*
+* \section License
+* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+*
+* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+*
+* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+*/
#include "CommonFunctions.h"
#include "CommandInterfaceBackdoor.h"
diff --git a/AudioManagerDaemon/test/CommonFunctions.h b/AudioManagerDaemon/test/CommonFunctions.h
index b7c3a40..871c131 100644
--- a/AudioManagerDaemon/test/CommonFunctions.h
+++ b/AudioManagerDaemon/test/CommonFunctions.h
@@ -1,9 +1,27 @@
-/*
- * CommonHeaders.h
- *
- * Created on: Dec 10, 2011
- * Author: christian
- */
+/**
+* Copyright (C) 2011, BMW AG
+*
+* GeniviAudioMananger AudioManagerDaemon
+*
+* \file CommonFunctions.h
+*
+* \date 20-Oct-2011 3:42:04 PM
+* \author Christian Mueller (christian.ei.mueller@bmw.de)
+*
+* \section License
+* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+*
+* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+*
+* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+*/
#ifndef COMMONHEADERS_H_
#define COMMONHEADERS_H_
diff --git a/AudioManagerDaemon/test/ControlInterfaceBackdoor.h b/AudioManagerDaemon/test/ControlInterfaceBackdoor.h
index b6a5337..37c63b2 100644
--- a/AudioManagerDaemon/test/ControlInterfaceBackdoor.h
+++ b/AudioManagerDaemon/test/ControlInterfaceBackdoor.h
@@ -1,9 +1,27 @@
-/*
- * ControlInterfaceBackdoor.h
- *
- * Created on: Dec 11, 2011
- * Author: christian
- */
+/**
+* Copyright (C) 2011, BMW AG
+*
+* GeniviAudioMananger AudioManagerDaemon
+*
+* \file ControlInterfaceBackdoor.h
+*
+* \date 20-Oct-2011 3:42:04 PM
+* \author Christian Mueller (christian.ei.mueller@bmw.de)
+*
+* \section License
+* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+*
+* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+*
+* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+*/
#ifndef CONTROLINTERFACEBACKDOOR_H_
#define CONTROLINTERFACEBACKDOOR_H_
diff --git a/AudioManagerDaemon/test/RoutingInterfaceBackdoor.h b/AudioManagerDaemon/test/RoutingInterfaceBackdoor.h
index bd4a5ca..4ade08f 100644
--- a/AudioManagerDaemon/test/RoutingInterfaceBackdoor.h
+++ b/AudioManagerDaemon/test/RoutingInterfaceBackdoor.h
@@ -1,9 +1,27 @@
-/*
- * RoutingInterfaceBackdoor.h
- *
- * Created on: Dec 10, 2011
- * Author: christian
- */
+/**
+* Copyright (C) 2011, BMW AG
+*
+* GeniviAudioMananger AudioManagerDaemon
+*
+* \file RoutingInterfaceBackdoor.h
+*
+* \date 20-Oct-2011 3:42:04 PM
+* \author Christian Mueller (christian.ei.mueller@bmw.de)
+*
+* \section License
+* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+*
+* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+*
+* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+*/
#ifndef ROUTINGINTERFACEBACKDOOR_H_
#define ROUTINGINTERFACEBACKDOOR_H_
diff --git a/AudioManagerDaemon/test/controlInterface/MockInterfaces.h b/AudioManagerDaemon/test/controlInterface/MockInterfaces.h
index 5b1cf2c..2e6122b 100644
--- a/AudioManagerDaemon/test/controlInterface/MockInterfaces.h
+++ b/AudioManagerDaemon/test/controlInterface/MockInterfaces.h
@@ -1,9 +1,26 @@
-/*
- * MockRoutingInterface.h
- *
- * Created on: Dec 10, 2011
- * Author: christian
- */
+/**
+* Copyright (C) 2011, BMW AG
+*
+* GeniviAudioMananger AudioManagerDaemon
+*
+* \file MockInterfaces.h
+*
+* \date 20-Oct-2011 3:42:04 PM
+* \author Christian Mueller (christian.ei.mueller@bmw.de)
+*
+* \section License
+* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+*
+* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+*
+*/
#ifndef MOCKROUTINGINTERFACE_H_
#define MOCKROUTINGINTERFACE_H_
diff --git a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp b/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp
index 9bfc5f6..dbddf47 100644
--- a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp
+++ b/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.cpp
@@ -1,9 +1,26 @@
-/*
- * routingInterfaceTest.cpp
- *
- * Created on: Dec 10, 2011
- * Author: christian
- */
+/**
+* Copyright (C) 2011, BMW AG
+*
+* GeniviAudioMananger AudioManagerDaemon
+*
+* \file controlInterfaceTest.cpp
+*
+* \date 20-Oct-2011 3:42:04 PM
+* \author Christian Mueller (christian.ei.mueller@bmw.de)
+*
+* \section License
+* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+*
+* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+*
+*/
#include "controlInterfaceTest.h"
@@ -26,8 +43,6 @@ controlInterfaceTest::controlInterfaceTest()
pRoutingReceiver(&pDatabaseHandler,&pRoutingSender,&pControlSender)
{
pDatabaseHandler.registerObserver(&pDatabaseObserver);
- pRoutingInterfaceBackdoor.unloadPlugins(&pRoutingSender);
- pCommandInterfaceBackdoor.unloadPlugins(&pCommandSender);
pControlInterfaceBackdoor.replaceController(&pControlSender,&pMockControlInterface);
pRoutingInterfaceBackdoor.injectInterface(&pRoutingSender,&pMockRoutingInterface,"mock");
@@ -56,6 +71,8 @@ TEST_F(controlInterfaceTest,registerDomain)
am_Domain_s domain;
am_domainID_t domainID;
pCF.createDomain(domain);
+
+ //When we run this test, we expect the call on the control interface
EXPECT_CALL(pMockControlInterface,hookSystemRegisterDomain(_,_)).WillRepeatedly(DoAll(SetArgReferee<1>(2),Return(E_OK)));
ASSERT_EQ(E_OK,pRoutingReceiver.registerDomain(domain,domainID));
ASSERT_EQ(domainID,2);
@@ -64,6 +81,8 @@ TEST_F(controlInterfaceTest,registerDomain)
TEST_F(controlInterfaceTest,deregisterDomain)
{
am_domainID_t domainID=34;
+
+ //When we run this test, we expect the call on the control interface
EXPECT_CALL(pMockControlInterface,hookSystemDeregisterDomain(34)).WillRepeatedly(Return(E_OK));
ASSERT_EQ(E_OK,pRoutingReceiver.deregisterDomain(domainID));
}
@@ -73,6 +92,8 @@ TEST_F(controlInterfaceTest,registerSink)
am_Sink_s sink;
am_sinkID_t sinkID;
pCF.createSink(sink);
+
+ //When we run this test, we expect the call on the control interface
EXPECT_CALL(pMockControlInterface,hookSystemRegisterSink(_,_)).WillRepeatedly(DoAll(SetArgReferee<1>(2),Return(E_OK)));
ASSERT_EQ(E_OK,pRoutingReceiver.registerSink(sink,sinkID));
ASSERT_EQ(sinkID,2);
@@ -81,6 +102,8 @@ TEST_F(controlInterfaceTest,registerSink)
TEST_F(controlInterfaceTest,deregisterSink)
{
am_sinkID_t sinkID=12;
+
+ //When we run this test, we expect the call on the control interface
EXPECT_CALL(pMockControlInterface,hookSystemDeregisterSink(12)).WillRepeatedly(Return(E_OK));
ASSERT_EQ(E_OK,pRoutingReceiver.deregisterSink(sinkID));
}
@@ -90,6 +113,8 @@ TEST_F(controlInterfaceTest,registerSource)
am_Source_s source;
am_sourceID_t sourceID;
pCF.createSource(source);
+
+ //When we run this test, we expect the call on the control interface
EXPECT_CALL(pMockControlInterface,hookSystemRegisterSource(_,_)).WillRepeatedly(DoAll(SetArgReferee<1>(2),Return(E_OK)));
ASSERT_EQ(E_OK,pRoutingReceiver.registerSource(source,sourceID));
ASSERT_EQ(sourceID,2);
@@ -98,6 +123,8 @@ TEST_F(controlInterfaceTest,registerSource)
TEST_F(controlInterfaceTest,deregisterSource)
{
am_sourceID_t sourceID=12;
+
+ //When we run this test, we expect the call on the control interface
EXPECT_CALL(pMockControlInterface,hookSystemDeregisterSource(12)).WillRepeatedly(Return(E_OK));
ASSERT_EQ(E_OK,pRoutingReceiver.deregisterSource(sourceID));
}
@@ -107,6 +134,8 @@ TEST_F(controlInterfaceTest,registerGateway)
am_Gateway_s gateway;
am_gatewayID_t gatewayID;
pCF.createGateway(gateway);
+
+ //When we run this test, we expect the call on the control interface
EXPECT_CALL(pMockControlInterface,hookSystemRegisterGateway(_,_)).WillRepeatedly(DoAll(SetArgReferee<1>(2),Return(E_OK)));
ASSERT_EQ(E_OK,pRoutingReceiver.registerGateway(gateway,gatewayID));
ASSERT_EQ(gatewayID,2);
@@ -115,6 +144,8 @@ TEST_F(controlInterfaceTest,registerGateway)
TEST_F(controlInterfaceTest,deregisterGateway)
{
am_gatewayID_t gatewayID=12;
+
+ //When we run this test, we expect the call on the control interface
EXPECT_CALL(pMockControlInterface,hookSystemDeregisterGateway(12)).WillRepeatedly(Return(E_OK));
ASSERT_EQ(E_OK,pRoutingReceiver.deregisterGateway(gatewayID));
}
@@ -122,7 +153,6 @@ TEST_F(controlInterfaceTest,deregisterGateway)
TEST_F(controlInterfaceTest,ackConnect)
{
- am_Connection_s connection;
am_connectionID_t connectionID;
am_Sink_s sink;
am_sinkID_t sinkID;
@@ -137,30 +167,47 @@ TEST_F(controlInterfaceTest,ackConnect)
domain.busname="mock";
sink.sinkID=2;
sink.domainID=1;
+
+ //prepare the stage
ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
+
+ //when asyncConnect is called, we expect a call on the routingInterface
EXPECT_CALL(pMockRoutingInterface,asyncConnect(_,1,2,2,CF_STEREO)).WillOnce(Return(E_OK));
ASSERT_EQ(E_OK,pControlReceiver.connect(handle,connectionID,CF_STEREO,2,2));
+
+ //The handle should have the correct type
ASSERT_EQ(handle.handleType,H_CONNECT);
ASSERT_EQ(handle.handle,1);
ASSERT_EQ(connectionID,1);
+
+ //The list of handles shall have the handle inside
ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
ASSERT_EQ(handlesList[0].handle,handle.handle);
ASSERT_EQ(handlesList[0].handleType,handle.handleType);
+
+ //we check the list of connections - but it must be empty because the ack did not arrive yet
ASSERT_EQ(E_OK,pDatabaseHandler.getListConnections(connectionList));
- ASSERT_TRUE(connectionList.empty()); //ok, because Ack did not come
+ ASSERT_TRUE(connectionList.empty());
+
+ //finally we answer via the RoutingInterface and expect a call on the controlInterface
EXPECT_CALL(pMockControlInterface,cbAckConnect(_,E_OK)).Times(1);
pRoutingReceiver.ackConnect(handle,connectionID,E_OK);
+
+ //the list of handles must be empty now
ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
ASSERT_TRUE(handlesList.empty());
+
+ //but the connection must be in the connectionlist
ASSERT_EQ(E_OK,pDatabaseHandler.getListConnections(connectionList));
- ASSERT_TRUE(!connectionList.empty()); //ok, because Ack did not come
+ ASSERT_TRUE(!connectionList.empty());
+ //no we try the same, but do expect a no_change answer directly and no call because connection already exists
+ ASSERT_EQ(E_ALREADY_EXISTS,pControlReceiver.connect(handle,connectionID,CF_STEREO,2,2));
}
TEST_F(controlInterfaceTest,ackDisconnect)
{
- am_Connection_s connection;
am_connectionID_t connectionID;
am_Sink_s sink;
am_sinkID_t sinkID;
@@ -175,20 +222,41 @@ TEST_F(controlInterfaceTest,ackDisconnect)
domain.busname="mock";
sink.sinkID=2;
sink.domainID=1;
+
+ //prepare the stage
ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
+
+ //now we first need to connect, we expect a call on the routing interface
EXPECT_CALL(pMockRoutingInterface,asyncConnect(_,1,2,2,CF_STEREO)).WillOnce(Return(E_OK));
ASSERT_EQ(E_OK,pControlReceiver.connect(handle,connectionID,CF_STEREO,2,2));
+
+ //answer with an ack to insert the connection in the database
EXPECT_CALL(pMockControlInterface,cbAckConnect(_,E_OK)).Times(1);
pRoutingReceiver.ackConnect(handle,connectionID,E_OK);
+
+ //now we can start to disconnect and expect a call on the routing interface
EXPECT_CALL(pMockRoutingInterface,asyncDisconnect(_,1)).WillOnce(Return(E_OK));
ASSERT_EQ(E_OK,pControlReceiver.disconnect(handle,1));
+
+ //during the disconnection, the connection is still in the list!
+ ASSERT_EQ(E_OK,pDatabaseHandler.getListConnections(connectionList));
+ ASSERT_TRUE(!connectionList.empty());
+
+ //then we fire the ack and expect a call on the controlInterface
EXPECT_CALL(pMockControlInterface,cbAckDisconnect(_,E_OK)).Times(1);
pRoutingReceiver.ackDisconnect(handle,connectionID,E_OK);
+
+ //make sure the handle is gone
ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
ASSERT_TRUE(handlesList.empty());
+
+ //make sure the connection is gone
ASSERT_EQ(E_OK,pDatabaseHandler.getListConnections(connectionList));
- ASSERT_TRUE(connectionList.empty()); //ok, because Ack did not come
+ ASSERT_TRUE(connectionList.empty());
+
+ //Now let's try to disconnect what is not existing...
+ ASSERT_EQ(E_NON_EXISTENT,pControlReceiver.disconnect(handle,2));
}
TEST_F(controlInterfaceTest,setSourceState)
@@ -207,22 +275,249 @@ TEST_F(controlInterfaceTest,setSourceState)
domain.busname="mock";
source.sourceID=2;
source.domainID=1;
+
+ //prepare the stage
ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
+
+ //we set the sourcestate and expect a call on the routingInterface
EXPECT_CALL(pMockRoutingInterface,asyncSetSourceState(_,2,SS_PAUSED)).WillOnce(Return(E_OK));
ASSERT_EQ(E_OK,pControlReceiver.setSourceState(handle,source.sourceID,SS_PAUSED));
+
+ //we want our handle in the list and let the type be the right one
ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
ASSERT_EQ(handlesList[0].handle,handle.handle);
- ASSERT_EQ(handlesList[0].handleType,handle.handleType);
+ ASSERT_EQ(handlesList[0].handleType,H_SETSOURCESTATE);
+
+ //the state must be unchanged because did not get the ack
ASSERT_EQ(E_OK,pDatabaseHandler.getSoureState(source.sourceID,state));
- ASSERT_EQ(state,SS_ON); //ok, since value will be added after the ack!
+ ASSERT_EQ(state,SS_ON);
+
+ //now we sent out the ack and expect a call on the controlInterface
EXPECT_CALL(pMockControlInterface,cbAckSetSourceState(_,E_OK)).Times(1);
pRoutingReceiver.ackSetSourceState(handle,E_OK);
+
+ //finally we need the sourcestate to be changed
ASSERT_EQ(E_OK,pDatabaseHandler.getSoureState(source.sourceID,state));
ASSERT_EQ(state,SS_PAUSED);
+ //make sure the handle is gone
+ ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
+ ASSERT_TRUE(handlesList.empty());
+
+ //we try again but expect a no change error
+ ASSERT_EQ(E_NO_CHANGE,pControlReceiver.setSourceState(handle,source.sourceID,SS_PAUSED));
+}
+
+TEST_F(controlInterfaceTest,SetSinkVolumeChange)
+{
+ am_Sink_s sink;
+ am_sinkID_t sinkID;
+ am_Domain_s domain;
+ am_domainID_t domainID;
+ am_volume_t volume;
+ std::vector<am_Handle_s> handlesList;
+ am_Handle_s handle;
+ pCF.createSink(sink);
+ pCF.createDomain(domain);
+ domain.name="mock";
+ domain.busname="mock";
+ sink.sinkID=2;
+ sink.domainID=1;
+ sink.volume=10;
+
+ //setup environment, we need a domain and a sink
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
+
+ //set the volume and expect a call on the routing interface
+ EXPECT_CALL(pMockRoutingInterface,asyncSetSinkVolume(_,2,11,RAMP_DIRECT,23)).WillOnce(Return(E_OK));
+ ASSERT_EQ(E_OK,pControlReceiver.setSinkVolume(handle,sinkID,11,RAMP_DIRECT,23));
+
+ //check the list of handles. The handle must be in there and have the right type
+ ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
+ ASSERT_EQ(handlesList[0].handle,handle.handle);
+ ASSERT_EQ(handlesList[0].handleType,H_SETSINKVOLUME);
+
+ //now we read out the volume, but we expect no change because the ack did not arrive yet
+ ASSERT_EQ(E_OK,pDatabaseHandler.getSinkVolume(sinkID,volume));
+ ASSERT_EQ(sink.volume,volume);
+
+ //lets send the answer and expect a call on the controlInterface
+ EXPECT_CALL(pMockControlInterface,cbAckSetSinkVolumeChange(_,11,E_OK)).Times(1);
+ pRoutingReceiver.ackSetSinkVolumeChange(handle,11,E_OK);
+
+ //finally, the new value must be in the database
+ ASSERT_EQ(E_OK,pDatabaseHandler.getSinkVolume(sinkID,volume));
+ ASSERT_EQ(11,volume);
+
+ //and the handle must be destroyed
+ ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
+ ASSERT_TRUE(handlesList.empty());
+
+ //Now we try again, but the value is unchanged
+ ASSERT_EQ(E_NO_CHANGE,pControlReceiver.setSinkVolume(handle,sinkID,11,RAMP_DIRECT,23));
+}
+
+TEST_F(controlInterfaceTest,ackSetSourceVolumeChange)
+{
+ am_Source_s source;
+ am_sourceID_t sourceID;
+ am_Domain_s domain;
+ am_domainID_t domainID;
+ am_volume_t volume;
+ std::vector<am_Handle_s> handlesList;
+ am_Handle_s handle;
+ pCF.createSource(source);
+ pCF.createDomain(domain);
+ domain.name="mock";
+ domain.busname="mock";
+ source.sourceID=2;
+ source.domainID=1;
+ source.volume=12;
+
+ //prepare the scene
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
+
+ //change the sinkVolume, expect a call on the routingInterface
+ EXPECT_CALL(pMockRoutingInterface,asyncSetSourceVolume(_,2,11,RAMP_DIRECT,23)).WillOnce(Return(E_OK));
+ ASSERT_EQ(E_OK,pControlReceiver.setSourceVolume(handle,source.sourceID,11,RAMP_DIRECT,23));
+
+ //check the list of handles. The handle must be in there and have the right type
+ ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
+ ASSERT_EQ(handlesList[0].handle,handle.handle);
+ ASSERT_EQ(handlesList[0].handleType,H_SETSOURCEVOLUME);
+
+ //now we read out the volume, but we expect no change because the ack did not arrive yet
+ ASSERT_EQ(E_OK,pDatabaseHandler.getSourceVolume(sourceID,volume));
+ ASSERT_EQ(source.volume,volume);
+
+ //lets send the answer and expect a call on the controlInterface
+ EXPECT_CALL(pMockControlInterface,cbAckSetSourceVolumeChange(_,11,E_OK)).Times(1);
+ pRoutingReceiver.ackSetSourceVolumeChange(handle,11,E_OK);
+
+ //finally, the new value must be in the database
+ ASSERT_EQ(E_OK,pDatabaseHandler.getSourceVolume(sourceID,volume));
+ ASSERT_EQ(11,volume);
+
+ //and the handle must be destroyed
+ ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
+ ASSERT_TRUE(handlesList.empty());
+
+ //Now we try again, but the value is unchanged
+ ASSERT_EQ(E_NO_CHANGE,pControlReceiver.setSourceVolume(handle,source.sourceID,11,RAMP_DIRECT,23));
}
+TEST_F(controlInterfaceTest,ackSetSinkSoundProperty)
+{
+ am_Sink_s sink;
+ am_sinkID_t sinkID;
+ am_Domain_s domain;
+ am_domainID_t domainID;
+ std::vector<am_Handle_s> handlesList;
+ am_Handle_s handle;
+ am_SoundProperty_s soundProperty;
+ uint16_t oldvalue;
+ pCF.createSink(sink);
+ pCF.createDomain(domain);
+ domain.name="mock";
+ domain.busname="mock";
+ sink.sinkID=2;
+ sink.domainID=1;
+ soundProperty.type=SP_BASS;
+ soundProperty.value=244;
+
+ //setup environment, we need a domain and a sink
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
+
+ //change the soundproperty, expect a call on the routinginterface
+ EXPECT_CALL(pMockRoutingInterface,asyncSetSinkSoundProperty(_,_,2)).WillOnce(Return(E_OK));
+ ASSERT_EQ(E_OK,pControlReceiver.setSinkSoundProperty(handle,sink.sinkID,soundProperty));
+
+ //check the list of handles. The handle must be in there and have the right type
+ ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
+ ASSERT_EQ(handlesList[0].handle,handle.handle);
+ ASSERT_EQ(handlesList[0].handleType,H_SETSINKSOUNDPROPERTY);
+
+ //read out this property. There is no change, because the ack did not arrive yet.
+ ASSERT_EQ(E_OK,pDatabaseHandler.getSinkSoundPropertyValue(2,SP_BASS,oldvalue));
+ ASSERT_EQ(sink.listSoundProperties[0].value,oldvalue);
+
+ //lets send the answer and expect a call on the controlInterface
+ EXPECT_CALL(pMockControlInterface,cbAckSetSinkSoundProperty(_,E_OK)).Times(1);
+ pRoutingReceiver.ackSetSinkSoundProperty(handle,E_OK);
+
+ //finally, the new value must be in the database
+ ASSERT_EQ(E_OK,pDatabaseHandler.getSinkSoundPropertyValue(sinkID,SP_BASS,oldvalue));
+ ASSERT_EQ(soundProperty.value,oldvalue);
+
+ //and the handle must be destroyed
+ ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
+ ASSERT_TRUE(handlesList.empty());
+
+ //Now we try again, but the value is unchanged
+ ASSERT_EQ(E_NO_CHANGE,pControlReceiver.setSinkSoundProperty(handle,sink.sinkID,soundProperty));
+}
+
+TEST_F(controlInterfaceTest,ackSetSourceSoundProperty)
+{
+ am_Source_s source;
+ am_sourceID_t sourceID;
+ am_Domain_s domain;
+ am_domainID_t domainID;
+ am_volume_t volume;
+ std::vector<am_Handle_s> handlesList;
+ am_Handle_s handle;
+ am_SoundProperty_s soundProperty;
+ uint16_t oldvalue;
+ pCF.createSource(source);
+ pCF.createDomain(domain);
+ domain.name="mock";
+ domain.busname="mock";
+ source.sourceID=2;
+ source.domainID=1;
+ soundProperty.type=SP_BASS;
+ soundProperty.value=244;
+
+ //prepare the scene
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
+ ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
+
+ //we trigger the change and wait for a call on the routinginterface
+ EXPECT_CALL(pMockRoutingInterface,asyncSetSourceSoundProperty(_,_,2)).WillOnce(Return(E_OK));
+ ASSERT_EQ(E_OK,pControlReceiver.setSourceSoundProperty(handle,source.sourceID,soundProperty));
+
+ //check the list of handles. The handle must be in there and have the right type
+ ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
+ ASSERT_EQ(handlesList[0].handle,handle.handle);
+ ASSERT_EQ(handlesList[0].handleType,H_SETSOURCESOUNDPROPERTY);
+
+ //read out this property. There is no change, because the ack did not arrive yet.
+ ASSERT_EQ(E_OK,pDatabaseHandler.getSourceSoundPropertyValue(2,SP_BASS,oldvalue));
+ ASSERT_EQ(source.listSoundProperties[0].value,oldvalue);
+
+ //lets send the answer and expect a call on the controlInterface
+ EXPECT_CALL(pMockControlInterface,cbAckSetSourceSoundProperty(_,E_OK)).Times(1);
+ pRoutingReceiver.ackSetSourceSoundProperty(handle,E_OK);
+
+ //finally, the new value must be in the database
+ ASSERT_EQ(E_OK,pDatabaseHandler.getSourceSoundPropertyValue(sourceID,SP_BASS,oldvalue));
+ ASSERT_EQ(soundProperty.value,oldvalue);
+
+ //and the handle must be destroyed
+ ASSERT_EQ(E_OK,pControlReceiver.getListHandles(handlesList));
+ ASSERT_TRUE(handlesList.empty());
+
+ //Now we try again, but the value is unchanged
+ ASSERT_EQ(E_NO_CHANGE,pControlReceiver.setSourceSoundProperty(handle,source.sourceID,soundProperty));
+}
+
+TEST_F(controlInterfaceTest,crossFading)
+{
+ //todo: implement crossfading test
+}
int main(int argc, char **argv)
{
diff --git a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h b/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h
index daac707..4d83b8f 100644
--- a/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h
+++ b/AudioManagerDaemon/test/controlInterface/controlInterfaceTest.h
@@ -1,9 +1,26 @@
-/*
- * routingInterfaceTest.h
- *
- * Created on: Dec 10, 2011
- * Author: christian
- */
+/**
+* Copyright (C) 2011, BMW AG
+*
+* GeniviAudioMananger AudioManagerDaemon
+*
+* \file controlInterfaceTest.h
+*
+* \date 20-Oct-2011 3:42:04 PM
+* \author Christian Mueller (christian.ei.mueller@bmw.de)
+*
+* \section License
+* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+*
+* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+*
+*/
#ifndef ROUTINGINTERFACETEST_H_
#define ROUTINGINTERFACETEST_H_
diff --git a/AudioManagerDaemon/test/database/CMakeLists.txt b/AudioManagerDaemon/test/database/CMakeLists.txt
index 33a1b40..4d01d41 100644
--- a/AudioManagerDaemon/test/database/CMakeLists.txt
+++ b/AudioManagerDaemon/test/database/CMakeLists.txt
@@ -57,6 +57,7 @@ file(GLOB DATABASE_SRCS_CXX
"../../src/DatabaseObserver.cpp"
"../../src/CommandSender.cpp"
"../../src/RoutingSender.cpp"
+ "../../src/ControlReceiver.cpp"
"../CommonFunctions.cpp"
"*.cpp"
)
diff --git a/AudioManagerDaemon/test/database/MockInterfaces.h b/AudioManagerDaemon/test/database/MockInterfaces.h
new file mode 100644
index 0000000..e774c32
--- /dev/null
+++ b/AudioManagerDaemon/test/database/MockInterfaces.h
@@ -0,0 +1,164 @@
+/**
+* Copyright (C) 2011, BMW AG
+*
+* GeniviAudioMananger AudioManagerDaemon
+*
+* \file MockInterfaces.h
+*
+* \date 20-Oct-2011 3:42:04 PM
+* \author Christian Mueller (christian.ei.mueller@bmw.de)
+*
+* \section License
+* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+*
+* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+*
+* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+*/
+
+#ifndef MOCKROUTINGINTERFACE_H_
+#define MOCKROUTINGINTERFACE_H_
+
+#include <control/ControlSendInterface.h>
+#include <command/CommandSendInterface.h>
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+namespace am {
+
+class MockCommandSendInterface : public CommandSendInterface {
+ public:
+ MOCK_METHOD1(startupInterface,
+ am_Error_e(CommandReceiveInterface* commandreceiveinterface));
+ MOCK_METHOD0(stopInterface,
+ am_Error_e());
+ MOCK_METHOD0(cbCommunicationReady,
+ am_Error_e());
+ MOCK_METHOD0(cbCommunicationRundown,
+ am_Error_e());
+ MOCK_METHOD0(cbNumberOfMainConnectionsChanged,
+ void());
+ MOCK_METHOD0(cbNumberOfSinksChanged,
+ void());
+ MOCK_METHOD0(cbNumberOfSourcesChanged,
+ void());
+ MOCK_METHOD0(cbNumberOfSinkClassesChanged,
+ void());
+ MOCK_METHOD0(cbNumberOfSourceClassesChanged,
+ void());
+ MOCK_METHOD2(cbMainConnectionStateChanged,
+ void(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState));
+ MOCK_METHOD2(cbMainSinkSoundPropertyChanged,
+ void(const am_sinkID_t sinkID, const am_MainSoundProperty_s soundProperty));
+ MOCK_METHOD2(cbMainSourceSoundPropertyChanged,
+ void(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty));
+ MOCK_METHOD2(cbSinkAvailabilityChanged,
+ void(const am_sinkID_t sinkID, const am_Availability_s& availability));
+ MOCK_METHOD2(cbSourceAvailabilityChanged,
+ void(const am_sourceID_t sourceID, const am_Availability_s& availability));
+ MOCK_METHOD2(cbVolumeChanged,
+ void(const am_sinkID_t sinkID, const am_mainVolume_t volume));
+ MOCK_METHOD2(cbSinkMuteStateChanged,
+ void(const am_sinkID_t sinkID, const am_MuteState_e muteState));
+ MOCK_METHOD1(cbSystemPropertyChanged,
+ void(const am_SystemProperty_s& systemProperty));
+ MOCK_METHOD2(cbTimingInformationChanged,
+ void(const am_mainConnectionID_t mainConnection, const am_timeSync_t time));
+};
+
+
+
+class MockControlSendInterface : public ControlSendInterface {
+ public:
+ MOCK_METHOD1(startupController,
+ am_Error_e(ControlReceiveInterface* controlreceiveinterface));
+ MOCK_METHOD0(stopController,
+ am_Error_e());
+ MOCK_METHOD0(hookAllPluginsLoaded,
+ void());
+ MOCK_METHOD3(hookUserConnectionRequest,
+ am_Error_e(const am_sourceID_t sourceID, const am_sinkID_t sinkID, am_mainConnectionID_t& mainConnectionID));
+ MOCK_METHOD1(hookUserDisconnectionRequest,
+ am_Error_e(const am_mainConnectionID_t connectionID));
+ MOCK_METHOD2(hookUserSetMainSinkSoundProperty,
+ am_Error_e(const am_sinkID_t sinkID, const am_MainSoundProperty_s& soundProperty));
+ MOCK_METHOD2(hookUserSetMainSourceSoundProperty,
+ am_Error_e(const am_sourceID_t sourceID, const am_MainSoundProperty_s& soundProperty));
+ MOCK_METHOD1(hookUserSetSystemProperty,
+ am_Error_e(const am_SystemProperty_s& property));
+ MOCK_METHOD2(hookUserVolumeChange,
+ am_Error_e(const am_sinkID_t SinkID, const am_mainVolume_t newVolume));
+ MOCK_METHOD2(hookUserVolumeStep,
+ am_Error_e(const am_sinkID_t SinkID, const int16_t increment));
+ MOCK_METHOD2(hookUserSetSinkMuteState,
+ am_Error_e(const am_sinkID_t sinkID, const am_MuteState_e muteState));
+ MOCK_METHOD2(hookSystemRegisterDomain,
+ am_Error_e(const am_Domain_s& domainData, am_domainID_t& domainID));
+ MOCK_METHOD1(hookSystemDeregisterDomain,
+ am_Error_e(const am_domainID_t domainID));
+ MOCK_METHOD1(hookSystemDomainRegistrationComplete,
+ void(const am_domainID_t domainID));
+ MOCK_METHOD2(hookSystemRegisterSink,
+ am_Error_e(const am_Sink_s& sinkData, am_sinkID_t& sinkID));
+ MOCK_METHOD1(hookSystemDeregisterSink,
+ am_Error_e(const am_sinkID_t sinkID));
+ MOCK_METHOD2(hookSystemRegisterSource,
+ am_Error_e(const am_Source_s& sourceData, am_sourceID_t& sourceID));
+ MOCK_METHOD1(hookSystemDeregisterSource,
+ am_Error_e(const am_sourceID_t sourceID));
+ MOCK_METHOD2(hookSystemRegisterGateway,
+ am_Error_e(const am_Gateway_s& gatewayData, am_gatewayID_t& gatewayID));
+ MOCK_METHOD1(hookSystemDeregisterGateway,
+ am_Error_e(const am_gatewayID_t gatewayID));
+ MOCK_METHOD2(hookSystemRegisterCrossfader,
+ am_Error_e(const am_Crossfader_s& crossfaderData, am_crossfaderID_t& crossfaderID));
+ MOCK_METHOD1(hookSystemDeregisterCrossfader,
+ am_Error_e(const am_crossfaderID_t crossfaderID));
+ MOCK_METHOD3(hookSystemSinkVolumeTick,
+ void(const am_Handle_s handle, const am_sinkID_t sinkID, const am_volume_t volume));
+ MOCK_METHOD3(hookSystemSourceVolumeTick,
+ void(const am_Handle_s handle, const am_sourceID_t sourceID, const am_volume_t volume));
+ MOCK_METHOD2(hookSystemInterruptStateChange,
+ void(const am_sourceID_t sourceID, const am_InterruptState_e interruptState));
+ MOCK_METHOD2(hookSystemSinkAvailablityStateChange,
+ void(const am_sinkID_t sinkID, const am_Availability_s& availability));
+ MOCK_METHOD2(hookSystemSourceAvailablityStateChange,
+ void(const am_sourceID_t sourceID, const am_Availability_s& availability));
+ MOCK_METHOD2(hookSystemDomainStateChange,
+ void(const am_domainID_t domainID, const am_DomainState_e state));
+ MOCK_METHOD1(hookSystemReceiveEarlyData,
+ void(const std::vector<am_EarlyData_s>& data));
+ MOCK_METHOD1(hookSystemSpeedChange,
+ void(const am_speed_t speed));
+ MOCK_METHOD2(hookSystemTimingInformationChanged,
+ void(const am_mainConnectionID_t mainConnectionID, const am_timeSync_t time));
+ MOCK_METHOD2(cbAckConnect,
+ void(const am_Handle_s handle, const am_Error_e errorID));
+ MOCK_METHOD2(cbAckDisconnect,
+ void(const am_Handle_s handle, const am_Error_e errorID));
+ MOCK_METHOD3(cbAckCrossFade,
+ void(const am_Handle_s handle, const am_HotSink_e hostsink, const am_Error_e error));
+ MOCK_METHOD3(cbAckSetSinkVolumeChange,
+ void(const am_Handle_s handle, const am_volume_t volume, const am_Error_e error));
+ MOCK_METHOD3(cbAckSetSourceVolumeChange,
+ void(const am_Handle_s handle, const am_volume_t voulme, const am_Error_e error));
+ MOCK_METHOD2(cbAckSetSourceState,
+ void(const am_Handle_s handle, const am_Error_e error));
+ MOCK_METHOD2(cbAckSetSourceSoundProperty,
+ void(const am_Handle_s handle, const am_Error_e error));
+ MOCK_METHOD2(cbAckSetSinkSoundProperty,
+ void(const am_Handle_s handle, const am_Error_e error));
+};
+
+} // namespace am
+
+
+
+#endif /* MOCKROUTINGINTERFACE_H_ */
diff --git a/AudioManagerDaemon/test/database/databaseTest.cpp b/AudioManagerDaemon/test/database/databaseTest.cpp
index a1580fe..f8d69fe 100644
--- a/AudioManagerDaemon/test/database/databaseTest.cpp
+++ b/AudioManagerDaemon/test/database/databaseTest.cpp
@@ -24,7 +24,6 @@
*/
#include "databaseTest.h"
-#include "DatabaseObserver.h"
using namespace am;
@@ -36,8 +35,19 @@ extern bool equalClassProperties (const am_ClassProperty_s a,const am_ClassPrope
extern std::string int2string(int i);
databaseTest::databaseTest()
- :pDatabaseHandler(std::string(":memory:"))
+ :plistRoutingPluginDirs(),
+ plistCommandPluginDirs(),
+ pDatabaseHandler(std::string(":memory:")),
+ pRoutingSender(plistRoutingPluginDirs),
+ pCommandSender(plistCommandPluginDirs),
+ pMockInterface(),
+ pRoutingInterfaceBackdoor(),
+ pCommandInterfaceBackdoor(),
+ pControlReceiver(&pDatabaseHandler,&pRoutingSender,&pCommandSender),
+ pObserver(&pCommandSender,&pRoutingSender)
{
+ pDatabaseHandler.registerObserver(&pObserver);
+ pCommandInterfaceBackdoor.injectInterface(&pCommandSender,&pMockInterface);
}
databaseTest::~databaseTest()
@@ -52,6 +62,10 @@ void databaseTest::createMainConnectionSetup()
am_Sink_s sink;
std::vector<am_Connection_s> connectionList;
+ //we create 9 sources and sinks:
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(9);
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(9);
+
for (uint16_t i=1;i<10;i++)
{
am_sinkID_t forgetSink;
@@ -95,6 +109,8 @@ void databaseTest::createMainConnectionSetup()
pCF.createMainConnection(mainConnection,route);
//enter mainconnection in database
+ EXPECT_CALL(pMockInterface,cbNumberOfMainConnectionsChanged()).Times(1);
+ EXPECT_CALL(pMockInterface,cbMainConnectionStateChanged(_,_)).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterMainConnectionDB(mainConnection,mainConnectionID))<< "ERROR: database error";
ASSERT_NE(0,mainConnectionID)<< "ERROR: connectionID zero";
@@ -120,8 +136,6 @@ void databaseTest::SetUp()
DLT_REGISTER_APP("Dtest","AudioManagerDeamon");
DLT_REGISTER_CONTEXT(AudioManager,"Main","Main Context");
DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Database Test started "));
- DatabaseObserver *observer=NULL;
- pDatabaseHandler.registerObserver(observer);
}
void databaseTest::TearDown()
@@ -141,8 +155,15 @@ TEST_F(databaseTest,sourceState)
std::vector<am_Source_s> listSources;
pCF.createSource(source);
source.sourceState=SS_OFF;
+
+ //prepare the test
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
+
+ //change the source state
ASSERT_EQ(E_OK,pDatabaseHandler.changeSourceState(sourceID,SS_ON));
+
+ //read out the changed values
ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources));
ASSERT_EQ(listSources[0].sourceState,SS_ON);
}
@@ -154,7 +175,12 @@ TEST_F(databaseTest,sinkVolumeChange)
std::vector<am_Sink_s> listSinks;
pCF.createSink(sink);
sink.volume=23;
+
+ //prepare the test
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
+
+ //change the volume and check the read out
ASSERT_EQ(E_OK,pDatabaseHandler.changeSinkVolume(sinkID,34));
ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks));
ASSERT_EQ(listSinks[0].volume,34);
@@ -167,7 +193,12 @@ TEST_F(databaseTest,sourceVolumeChange)
std::vector<am_Source_s> listSources;
pCF.createSource(source);
source.volume=23;
+
+ //prepare test
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
+
+ //change the volume and check the read out
ASSERT_EQ(E_OK,pDatabaseHandler.changeSourceVolume(sourceID,34));
ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources));
ASSERT_EQ(listSources[0].volume,34);
@@ -176,19 +207,32 @@ TEST_F(databaseTest,sourceVolumeChange)
TEST_F(databaseTest, peekSource)
{
std::vector<am_Source_s> listSources;
- am_sourceID_t sourceID;
- am_sourceID_t source2ID;
+ am_sourceID_t sourceID, source2ID, source3ID;
am_Source_s source;
pCF.createSource(source);
+
+ //peek a source that does not exits
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(0);
ASSERT_EQ(E_OK,pDatabaseHandler.peekSource(std::string("newsource"),sourceID));
+
+ //make sure it is not in the list
ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources));
ASSERT_TRUE(listSources.empty());
ASSERT_EQ(sourceID,100);
+
+ //now enter the source with the same name and make sure it does not get a new ID
source.name="newsource";
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,source2ID));
ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources));
ASSERT_EQ(sourceID,source2ID);
ASSERT_TRUE(listSources[0].sourceID==sourceID);
+
+ //now we peek again. This time, the source exists
+ ASSERT_EQ(E_OK,pDatabaseHandler.peekSource(source.name,source3ID));
+ ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources));
+ ASSERT_TRUE(listSources.size()==1);
+ ASSERT_EQ(source3ID,source2ID);
}
TEST_F(databaseTest, peekSourceDouble)
@@ -199,48 +243,58 @@ TEST_F(databaseTest, peekSourceDouble)
am_sourceID_t source3ID;
am_Source_s source;
pCF.createSource(source);
+
+ //peek a source that does not exits
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(0);
ASSERT_EQ(E_OK,pDatabaseHandler.peekSource(std::string("newsource"),sourceID));
+
+ //peek a second source that does not exits
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(0);
ASSERT_EQ(E_OK,pDatabaseHandler.peekSource(std::string("newsource2"),source2ID));
+
+ //make sure they are is not in the list
ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources));
ASSERT_TRUE(listSources.empty());
ASSERT_EQ(sourceID,100);
source.name="newsource";
+
+ //now enter the source with the same name than the first peek and make sure it does not get a new ID
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,source3ID));
ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources));
ASSERT_EQ(sourceID,source3ID);
ASSERT_TRUE(listSources[0].sourceID==sourceID);
}
-TEST_F(databaseTest, peekSourceExists)
-{
- std::vector<am_Source_s> listSources;
- am_sourceID_t sourceID;
- am_sourceID_t source2ID;
- am_Source_s source;
- pCF.createSource(source);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
- ASSERT_EQ(E_OK,pDatabaseHandler.peekSource(source.name,source2ID));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources));
- ASSERT_TRUE(listSources.size()==1);
- ASSERT_EQ(sourceID,source2ID);
-}
-
TEST_F(databaseTest, peekSink)
{
std::vector<am_Sink_s> listSinks;
- am_sinkID_t sinkID;
- am_sinkID_t sink2ID;
+ am_sinkID_t sinkID,sink2ID, sink3ID;
am_Sink_s sink;
pCF.createSink(sink);
+
+ //peek a sink that does not exits
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(0);
ASSERT_EQ(E_OK,pDatabaseHandler.peekSink(std::string("newsink"),sinkID));
+
+ //make sure it is not in the list
ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks));
ASSERT_TRUE(listSinks.empty());
ASSERT_EQ(sinkID,100);
sink.name="newsink";
+
+ //now enter the source with the same name and make sure it does not get a new ID
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sink2ID));
ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks));
ASSERT_EQ(sinkID,sink2ID);
ASSERT_TRUE(listSinks[0].sinkID==sinkID);
+
+ //now we peek again, this time, the sink exists
+ ASSERT_EQ(E_OK,pDatabaseHandler.peekSink(sink.name,sink3ID));
+ ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks));
+ ASSERT_TRUE(listSinks.size()==1);
+ ASSERT_EQ(sink3ID,sink2ID);
}
TEST_F(databaseTest, peekSinkDouble)
@@ -251,50 +305,55 @@ TEST_F(databaseTest, peekSinkDouble)
am_sinkID_t sink3ID;
am_Sink_s sink;
pCF.createSink(sink);
+
+ //peek a sink that does not exits
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(0);
ASSERT_EQ(E_OK,pDatabaseHandler.peekSink(std::string("newsink"),sinkID));
+
+ //peek again
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(0);
ASSERT_EQ(E_OK,pDatabaseHandler.peekSink(std::string("nextsink"),sink2ID));
+
+ //make sure they are is not in the list
ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks));
ASSERT_TRUE(listSinks.empty());
ASSERT_EQ(sinkID,100);
sink.name="newsink";
+
+ //now enter the sink with the same name than the first peek and make sure it does not get a new ID
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sink3ID));
ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks));
ASSERT_EQ(sinkID,sink3ID);
ASSERT_TRUE(listSinks[0].sinkID==sinkID);
}
-TEST_F(databaseTest, peekSinkExists)
-{
- std::vector<am_Sink_s> listSinks;
- am_sinkID_t sinkID;
- am_sinkID_t sink2ID;
- am_Sink_s sink;
- pCF.createSink(sink);
- ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
- ASSERT_EQ(E_OK,pDatabaseHandler.peekSink(sink.name,sink2ID));
- ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks));
- ASSERT_TRUE(listSinks.size()==1);
- ASSERT_EQ(sinkID,sink2ID);
-}
-
-
TEST_F(databaseTest,changeConnectionTimingInformationCheckMainConnection)
{
am_Connection_s connection;
std::vector<am_Connection_s> connectionList;
std::vector<am_MainConnectionType_s> mainList;
pCF.createConnection(connection);
+
+ //prepare the test, it is one mainconnection, so we expect one callback
createMainConnectionSetup();
- ASSERT_EQ(-E_OK,pDatabaseHandler.getListVisibleMainConnections(mainList));
+ EXPECT_CALL(pMockInterface,cbTimingInformationChanged(1,216)).Times(1);
+
+ //first get all visible mainconnections and make sure, the delay is set to -1 for the first entry
+ ASSERT_EQ(E_OK,pDatabaseHandler.getListVisibleMainConnections(mainList));
ASSERT_EQ(mainList[0].delay,-1);
+
+ //no go through all connections and set the delay time to 24 for each connection
ASSERT_EQ(E_OK,pDatabaseHandler.getListConnections(connectionList));
std::vector<am_Connection_s>::iterator iteratorConnectionList=connectionList.begin();
for(;iteratorConnectionList<connectionList.end();++iteratorConnectionList)
{
ASSERT_EQ(E_OK,pDatabaseHandler.changeConnectionTimingInformation(iteratorConnectionList->sinkID,24));
}
+
+ //we read the result again and expect that the value is now different from -1
ASSERT_EQ(E_OK,pDatabaseHandler.getListVisibleMainConnections(mainList));
- ASSERT_NE(mainList[0].delay,-1);
+ ASSERT_EQ(mainList[0].delay,216);
}
TEST_F(databaseTest,changeConnectionTimingInformation)
@@ -304,9 +363,12 @@ TEST_F(databaseTest,changeConnectionTimingInformation)
std::vector<am_Connection_s> connectionList;
pCF.createConnection(connection);
+ //enter a connection
ASSERT_EQ(E_OK,pDatabaseHandler.enterConnectionDB(connection,connectionID));
- ASSERT_EQ(E_OK,pDatabaseHandler.changeConnectionTimingInformation(connectionID,24));
ASSERT_EQ(E_OK,pDatabaseHandler.changeConnectionFinal(connectionID));
+
+ //change the timing and check it
+ ASSERT_EQ(E_OK,pDatabaseHandler.changeConnectionTimingInformation(connectionID,24));
ASSERT_EQ(E_OK,pDatabaseHandler.getListConnections(connectionList));
ASSERT_TRUE(connectionList[0].delay==24);
}
@@ -332,7 +394,12 @@ TEST_F(databaseTest,getSinkClassOfSink)
pCF.createSink(sink);
sink.sinkClassID=4;
+ //prepare test
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
+
+ //enter a new sinkclass, read out again and check
+ EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
ASSERT_EQ(E_OK,pDatabaseHandler.getListSinkClasses(sinkClassList));
ASSERT_EQ(sinkClassList[0].name,sinkClass.name);
@@ -365,7 +432,9 @@ TEST_F(databaseTest,getSourceClassOfSource)
sourceClass.listClassProperties=classPropertyList;
pCF.createSource(source);
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
+ EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
ASSERT_EQ(E_OK,pDatabaseHandler.getListSourceClasses(sourceClassList));
ASSERT_EQ(sourceClassList[0].name,sourceClass.name);
@@ -395,6 +464,7 @@ TEST_F(databaseTest,removeSourceClass)
sourceClass.sourceClassID=3;
sourceClass.listClassProperties=classPropertyList;
+ EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(2);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
ASSERT_EQ(E_OK,pDatabaseHandler.getListSourceClasses(sourceClassList));
ASSERT_EQ(sourceClassList[0].name,sourceClass.name);
@@ -424,6 +494,7 @@ TEST_F(databaseTest,updateSourceClass)
changedClass=sourceClass;
changedClass.listClassProperties[1].value=6;
changedPropertyList=changedClass.listClassProperties;
+ EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
changedClass.sourceClassID=sourceClassID;
ASSERT_EQ(E_OK,pDatabaseHandler.getListSourceClasses(sourceClassList));
@@ -454,6 +525,7 @@ TEST_F(databaseTest,enterSourceClass)
sourceClass.sourceClassID=0;
sourceClass.listClassProperties=classPropertyList;
+ EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
ASSERT_EQ(E_OK,pDatabaseHandler.getListSourceClasses(sourceClassList));
ASSERT_EQ(sourceClassList[0].name,sourceClass.name);
@@ -478,6 +550,7 @@ TEST_F(databaseTest,enterSourceClassStatic)
sourceClass.sourceClassID=3;
sourceClass.listClassProperties=classPropertyList;
+ EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
ASSERT_EQ(E_OK,pDatabaseHandler.getListSourceClasses(sourceClassList));
ASSERT_EQ(sourceClassList[0].name,sourceClass.name);
@@ -503,6 +576,7 @@ TEST_F(databaseTest,removeSinkClass)
sinkClass.sinkClassID=0;
sinkClass.listClassProperties=classPropertyList;
+ EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(2);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
ASSERT_EQ(E_OK,pDatabaseHandler.getListSinkClasses(sinkClassList));
ASSERT_EQ(sinkClassList[0].name,sinkClass.name);
@@ -532,6 +606,7 @@ TEST_F(databaseTest,updateSinkClass)
changedClass=sinkClass;
changedClass.listClassProperties[1].value=6;
changedPropertyList=changedClass.listClassProperties;
+ EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
changedClass.sinkClassID=sinkClassID;
ASSERT_EQ(E_OK,pDatabaseHandler.getListSinkClasses(sinkClassList));
@@ -562,6 +637,7 @@ TEST_F(databaseTest,enterSinkClass)
sinkClass.sinkClassID=0;
sinkClass.listClassProperties=classPropertyList;
+ EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
ASSERT_EQ(E_OK,pDatabaseHandler.getListSinkClasses(sinkClassList));
ASSERT_EQ(sinkClassList[0].name,sinkClass.name);
@@ -586,6 +662,7 @@ TEST_F(databaseTest,enterSinkClassStatic)
sinkClass.sinkClassID=4;
sinkClass.listClassProperties=classPropertyList;
+ EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
ASSERT_EQ(E_OK,pDatabaseHandler.getListSinkClasses(sinkClassList));
ASSERT_EQ(sinkClassList[0].name,sinkClass.name);
@@ -602,6 +679,7 @@ TEST_F(databaseTest, changeSystemProperty)
systemProperty.type=SYP_TEST;
systemProperty.value=33;
listSystemProperties.push_back(systemProperty);
+ EXPECT_CALL(pMockInterface,cbSystemPropertyChanged(_)).Times(1); //todo: check the exact value here
ASSERT_EQ(E_OK,pDatabaseHandler.enterSystemProperties(listSystemProperties));
systemProperty.value=444;
ASSERT_EQ(E_OK,pDatabaseHandler.changeSystemPropertyDB(systemProperty));
@@ -637,6 +715,7 @@ TEST_F(databaseTest,enterSourcesCorrect)
staticSource.sourceID=4;
staticSource.name="Static";
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(3);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(staticSource,staticSourceID))<< "ERROR: database error";
ASSERT_EQ(staticSource.sourceID,staticSourceID)<< "ERROR: ID not the one given in staticSource";
@@ -688,7 +767,10 @@ TEST_F(databaseTest, changeSourceMainSoundProperty)
am_MainSoundProperty_s property;
property.type=MSP_NAVIGATION_OFFSET;
property.value=33;
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
+
+ EXPECT_CALL(pMockInterface,cbMainSourceSoundPropertyChanged(sourceID,_)).Times(1); //todo: check in detail
ASSERT_EQ(E_OK,pDatabaseHandler.changeMainSourceSoundPropertyDB(property,sourceID));
ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources));
std::vector<am_MainSoundProperty_s>::iterator listIterator=listSources[0].listMainSoundProperties.begin();
@@ -708,7 +790,10 @@ TEST_F(databaseTest, changeSinkMuteState)
am_sinkID_t sinkID;
pCF.createSink(sink);
am_MuteState_e muteState=MS_MUTED;
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
+
+ EXPECT_CALL(pMockInterface,cbSinkMuteStateChanged(sinkID,muteState)).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.changeSinkMuteStateDB(muteState,sinkID));
ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks));
ASSERT_EQ(muteState,listSinks[0].muteState);
@@ -723,7 +808,11 @@ TEST_F(databaseTest, changeSinkMainSoundProperty)
am_MainSoundProperty_s property;
property.type=MSP_NAVIGATION_OFFSET;
property.value=33;
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
+
+ EXPECT_CALL(pMockInterface,cbMainSinkSoundPropertyChanged(sinkID,_)).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.changeMainSinkSoundPropertyDB(property,sinkID));
ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks));
std::vector<am_MainSoundProperty_s>::iterator listIterator=listSinks[0].listMainSoundProperties.begin();
@@ -787,6 +876,7 @@ TEST_F(databaseTest, changeMainConnectionState)
{
std::vector<am_MainConnection_s> listMainConnections;
createMainConnectionSetup();
+ EXPECT_CALL(pMockInterface,cbMainConnectionStateChanged(_,_)).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.changeMainConnectionStateDB(1,CS_DISCONNECTING))<< "ERROR: database error";
ASSERT_EQ(E_OK,pDatabaseHandler.getListMainConnections(listMainConnections));
ASSERT_EQ(CS_DISCONNECTING,listMainConnections[0].connectionState);
@@ -801,6 +891,8 @@ TEST_F(databaseTest, changeSinkAvailability)
am_Availability_s availability;
availability.availability=A_UNKNOWN;
availability.availabilityReason=AR_TEMPERATURE;
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
ASSERT_EQ(E_OK,pDatabaseHandler.changeSinkAvailabilityDB(availability,sinkID));
ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks));
@@ -817,6 +909,9 @@ TEST_F(databaseTest, changeSourceAvailability)
am_Availability_s availability;
availability.availability=A_UNKNOWN;
availability.availabilityReason=AR_TEMPERATURE;
+ source.visible=true;
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
ASSERT_EQ(E_OK,pDatabaseHandler.changeSourceAvailabilityDB(availability,sourceID));
ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources));
@@ -836,6 +931,8 @@ TEST_F(databaseTest,changeMainConnectionRoute)
am_Sink_s sink;
std::vector<am_Connection_s> connectionList;
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(9);
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(9);
for (uint16_t i=1;i<10;i++)
{
am_sinkID_t forgetSink;
@@ -887,7 +984,12 @@ TEST_F(databaseTest,changeMainSinkVolume)
am_mainVolume_t newVol=20;
std::vector<am_Sink_s> listSinks;
pCF.createSink(sink);
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
+
+
+ EXPECT_CALL(pMockInterface,cbVolumeChanged(sinkID,newVol)).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.changeSinkMainVolumeDB(newVol,sinkID));
ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks));
ASSERT_EQ(listSinks[0].mainVolume,newVol);
@@ -900,6 +1002,8 @@ TEST_F(databaseTest,getMainSourceSoundProperties)
pCF.createSource(source);
std::vector<am_MainSoundProperty_s> mainSoundProperties=source.listMainSoundProperties;
std::vector<am_MainSoundProperty_s> listMainSoundProperties;
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
ASSERT_EQ(E_OK,pDatabaseHandler.getListMainSourceSoundProperties(sourceID,listMainSoundProperties));
ASSERT_TRUE(std::equal(mainSoundProperties.begin(),mainSoundProperties.end(),listMainSoundProperties.begin(),equalMainSoundProperty));
@@ -912,6 +1016,8 @@ TEST_F(databaseTest,getMainSinkSoundProperties)
pCF.createSink(sink);
std::vector<am_MainSoundProperty_s> mainSoundProperties=sink.listMainSoundProperties;
std::vector<am_MainSoundProperty_s> listMainSoundProperties;
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
ASSERT_EQ(E_OK,pDatabaseHandler.getListMainSinkSoundProperties(sinkID,listMainSoundProperties));
ASSERT_TRUE(std::equal(mainSoundProperties.begin(),mainSoundProperties.end(),listMainSoundProperties.begin(),equalMainSoundProperty));
@@ -930,6 +1036,9 @@ TEST_F(databaseTest,getMainSources)
source1.visible=false;
std::vector<am_SourceType_s> listMainSources;
std::vector<am_Source_s> listSources;
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(3);
+
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
source.sourceID=sourceID;
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source1,sourceID));
@@ -959,6 +1068,8 @@ TEST_F(databaseTest,getMainSinks)
sink1.visible=false;
std::vector<am_SinkType_s> listMainSinks;
std::vector<am_Sink_s> listSinks;
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(3);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
sink.sinkID=sinkID;
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink1,sinkID));
@@ -1007,6 +1118,9 @@ TEST_F(databaseTest,getListSourcesOfDomain)
source2.domainID=5;
pCF.createDomain(domain);
sourceCheckList.push_back(1);//sink.sinkID);
+
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(2);
ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID))<< "ERROR: database error";
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source2,sourceID))<< "ERROR: database error";
@@ -1031,6 +1145,8 @@ TEST_F(databaseTest,getListSinksOfDomain)
sink2.name="sink2";
pCF.createDomain(domain);
sinkCheckList.push_back(1);//sink.sinkID);
+
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(2);
ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID))<< "ERROR: database error";
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink2,sinkID))<< "ERROR: database error";
@@ -1104,6 +1220,7 @@ TEST_F(databaseTest,removeSink)
am_sinkID_t sinkID;
std::vector<am_Sink_s> listSinks;
pCF.createSink(sink);
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(2);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID))<< "ERROR: database error";
ASSERT_EQ(E_OK,pDatabaseHandler.removeSinkDB(sinkID))<< "ERROR: database error";
ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks))<< "ERROR: database error";
@@ -1118,6 +1235,7 @@ TEST_F(databaseTest,removeSource)
std::vector<am_Source_s> listSources;
pCF.createSource(source);
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(2);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID))<< "ERROR: database error";
ASSERT_EQ(E_OK,pDatabaseHandler.removeSourceDB(sourceID))<< "ERROR: database error";
ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources))<< "ERROR: database error";
@@ -1127,6 +1245,8 @@ TEST_F(databaseTest,removeSource)
TEST_F(databaseTest, removeMainConnection)
{
createMainConnectionSetup();
+ EXPECT_CALL(pMockInterface,cbNumberOfMainConnectionsChanged()).Times(1);
+ EXPECT_CALL(pMockInterface,cbMainConnectionStateChanged(_,_)).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.removeMainConnectionDB(1))<< "ERROR: database error";
}
@@ -1259,6 +1379,7 @@ TEST_F(databaseTest,enterSinkThatAlreadyExistFail)
staticSink.sinkID=43;
staticSink.name="Static";
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(staticSink,staticSinkID))<< "ERROR: database error";
ASSERT_EQ(staticSink.sinkID,staticSinkID)<< "ERROR: ID not the one given in staticSink";
@@ -1277,6 +1398,7 @@ TEST_F(databaseTest,enterSourcesThatAlreadyExistFail)
pCF.createSource(staticSource);
staticSource.sourceID=4;
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(staticSource,staticSourceID))<< "ERROR: database error";
ASSERT_EQ(staticSource.sourceID,staticSourceID)<< "ERROR: ID not the one given in staticSource";
@@ -1356,6 +1478,7 @@ TEST_F(databaseTest,enterSinksCorrect)
pCF.createSink(staticSink);
staticSink.sinkID=4;
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(3);
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(staticSink,staticSinkID))<< "ERROR: database error";
ASSERT_EQ(staticSink.sinkID,staticSinkID)<< "ERROR: ID not the one given in staticSink";
diff --git a/AudioManagerDaemon/test/database/databaseTest.h b/AudioManagerDaemon/test/database/databaseTest.h
index d7fb36f..67ac0a6 100644
--- a/AudioManagerDaemon/test/database/databaseTest.h
+++ b/AudioManagerDaemon/test/database/databaseTest.h
@@ -1,13 +1,33 @@
-/*
- * databasetest.h
- *
- * Created on: Dec 6, 2011
- * Author: christian
- */
+/**
+* Copyright (C) 2011, BMW AG
+*
+* GeniviAudioMananger AudioManagerDaemon
+*
+* \file databasetest.h
+*
+* \date 20-Oct-2011 3:42:04 PM
+* \author Christian Mueller (christian.ei.mueller@bmw.de)
+*
+* \section License
+* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+*
+* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+*
+* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+*/
#ifndef DATABASETEST_H_
#define DATABASETEST_H_
+#define UNIT_TEST 1
+
#include <gtest/gtest.h>
#include <gmock/gmock.h>
#include <dlt/dlt.h>
@@ -15,7 +35,13 @@
#include <string>
#include <vector>
#include <set>
+#include "MockInterfaces.h"
#include "DatabaseHandler.h"
+#include "ControlReceiver.h"
+#include "ControlSender.h"
+#include "DatabaseObserver.h"
+#include "../ControlInterfaceBackdoor.h"
+#include "../CommandInterfaceBackdoor.h"
#include "../CommonFunctions.h"
DLT_DECLARE_CONTEXT(AudioManager)
@@ -26,10 +52,17 @@ class databaseTest : public Test {
public:
databaseTest();
~databaseTest();
-
+ std::vector<std::string> plistRoutingPluginDirs;
+ std::vector<std::string> plistCommandPluginDirs;
DatabaseHandler pDatabaseHandler;
+ RoutingSender pRoutingSender;
+ CommandSender pCommandSender;
+ MockCommandSendInterface pMockInterface;
+ RoutingInterfaceBackdoor pRoutingInterfaceBackdoor;
+ CommandInterfaceBackdoor pCommandInterfaceBackdoor;
+ ControlReceiver pControlReceiver;
+ DatabaseObserver pObserver;
CommonFunctions pCF;
-
void SetUp();
void TearDown();
diff --git a/AudioManagerDaemon/test/routingInterface/MockRoutingInterface.h b/AudioManagerDaemon/test/routingInterface/MockRoutingInterface.h
index 0f29a5a..c0eada7 100644
--- a/AudioManagerDaemon/test/routingInterface/MockRoutingInterface.h
+++ b/AudioManagerDaemon/test/routingInterface/MockRoutingInterface.h
@@ -1,9 +1,27 @@
-/*
- * MockRoutingInterface.h
- *
- * Created on: Dec 10, 2011
- * Author: christian
- */
+/**
+* Copyright (C) 2011, BMW AG
+*
+* GeniviAudioMananger AudioManagerDaemon
+*
+* \file MockInterfaces.h
+*
+* \date 20-Oct-2011 3:42:04 PM
+* \author Christian Mueller (christian.ei.mueller@bmw.de)
+*
+* \section License
+* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+*
+* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+*
+* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+*/
#ifndef MOCKROUTINGINTERFACE_H_
#define MOCKROUTINGINTERFACE_H_
diff --git a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp
index 1e89d7a..86f5959 100644
--- a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp
+++ b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.cpp
@@ -1,9 +1,27 @@
-/*
- * routingInterfaceTest.cpp
- *
- * Created on: Dec 10, 2011
- * Author: christian
- */
+/**
+* Copyright (C) 2011, BMW AG
+*
+* GeniviAudioMananger AudioManagerDaemon
+*
+* \file routingInterfaces.cpp
+*
+* \date 20-Oct-2011 3:42:04 PM
+* \author Christian Mueller (christian.ei.mueller@bmw.de)
+*
+* \section License
+* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+*
+* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+*
+* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+*/
#include "routingInterfaceTest.h"
@@ -22,7 +40,8 @@ using ::testing::ElementsAre;
using ::testing::NotNull;
routingInterfaceTest::routingInterfaceTest()
- :plistCommandPluginDirs(),
+ :plistRoutingPluginDirs(),
+ plistCommandPluginDirs(),
pDatabaseHandler(std::string(":memory:")),
pRoutingSender(plistRoutingPluginDirs),
pCommandSender(plistCommandPluginDirs),
@@ -70,17 +89,33 @@ TEST_F(routingInterfaceTest,abort)
domain.busname="mock";
sink.sinkID=2;
sink.domainID=1;
+
+ //prepare the stage
ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
+
+ //start a connect, expect a call on the routingInterface
EXPECT_CALL(pMockInterface,asyncConnect(_,_,1,sinkID,CF_ANALOG)).WillOnce(Return(E_OK));
ASSERT_EQ(E_OK,pControlReceiver.connect(handle,connectionID,CF_ANALOG,1,2));
+
+ //check the correctness of the handle
ASSERT_NE(handle.handle,0);
ASSERT_EQ(handle.handleType,H_CONNECT);
+
+ //the handle must be inside the handlelist
ASSERT_EQ(E_OK,pControlReceiver.getListHandles(listHandles));
ASSERT_TRUE(listHandles[0].handle==handle.handle);
ASSERT_TRUE(listHandles[0].handleType==handle.handleType);
+
+ //send an abort expect a call on the routing interface
EXPECT_CALL(pMockInterface,asyncAbort(_)).WillOnce(Return(E_OK));
ASSERT_EQ(E_OK,pControlReceiver.abortAction(handle));
+
+ //the reaction on the abort is specific for every function
+
+ //now we try to abort a handle that does not exist
+ handle.handle=24;
+ ASSERT_EQ(E_NON_EXISTENT,pControlReceiver.abortAction(handle));
}
TEST_F(routingInterfaceTest,abortNonExistent)
diff --git a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h
index 3b27701..1d5baaa 100644
--- a/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h
+++ b/AudioManagerDaemon/test/routingInterface/routingInterfaceTest.h
@@ -1,9 +1,27 @@
-/*
- * routingInterfaceTest.h
- *
- * Created on: Dec 10, 2011
- * Author: christian
- */
+/**
+* Copyright (C) 2011, BMW AG
+*
+* GeniviAudioMananger AudioManagerDaemon
+*
+* \file routingInterfaces.h
+*
+* \date 20-Oct-2011 3:42:04 PM
+* \author Christian Mueller (christian.ei.mueller@bmw.de)
+*
+* \section License
+* GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
+* Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
+*
+* This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
+* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
+* You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
+* Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
+* Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
+* As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
+* Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
+*
+* THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
+*/
#ifndef ROUTINGINTERFACETEST_H_
#define ROUTINGINTERFACETEST_H_