summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AudioManagerDaemon/include/DatabaseHandler.h3
-rw-r--r--AudioManagerDaemon/src/ControlReceiver.cpp1
-rw-r--r--AudioManagerDaemon/src/ControlSender.cpp18
-rw-r--r--AudioManagerDaemon/src/DatabaseHandler.cpp85
-rw-r--r--AudioManagerDaemon/src/RoutingReceiver.cpp1
-rw-r--r--AudioManagerDaemon/src/RoutingSender.cpp3
-rw-r--r--AudioManagerDaemon/src/main.cpp7
-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
-rw-r--r--PluginCommandInterfaceDbus/CMakeLists.txt1
-rw-r--r--PluginCommandInterfaceDbus/src/DBusMessageHandler.cpp25
-rw-r--r--PluginControlInterface/CMakeLists.txt1
-rw-r--r--PluginControlInterface/include/ControlSender.h31
-rw-r--r--PluginControlInterface/src/ControlSender.cpp30
-rw-r--r--PluginRoutingInterfaceDbus/CMakeLists.txt1
-rw-r--r--PluginRoutingInterfaceDbus/include/RoutingSender.h30
-rw-r--r--PluginRoutingInterfaceDbus/src/RoutingSender.cpp30
30 files changed, 1126 insertions, 200 deletions
diff --git a/AudioManagerDaemon/include/DatabaseHandler.h b/AudioManagerDaemon/include/DatabaseHandler.h
index 798cd27..ed17d91 100644
--- a/AudioManagerDaemon/include/DatabaseHandler.h
+++ b/AudioManagerDaemon/include/DatabaseHandler.h
@@ -132,7 +132,7 @@ public:
/**
* checks if a CrossFader exists
- * @param crossFaderID the ID of the crossfader to be checked
+ * @param crossfaderID the ID of the crossfader to be checked
* @return true if exists
*/
bool existcrossFader(const am_crossfaderID_t crossfaderID) const;
@@ -244,7 +244,6 @@ public:
private:
am_timeSync_t calculateMainConnectionDelay(const am_mainConnectionID_t mainConnectionID) const;
- bool connectionPartofMainConnection(const am_connectionID_t connectionID,const am_mainConnectionID_t mainConnectionID) const;
bool sqQuery(const std::string& query);
bool openDatabase(); //!< opens the database
void createTables(); //!< creates all tables from the static table
diff --git a/AudioManagerDaemon/src/ControlReceiver.cpp b/AudioManagerDaemon/src/ControlReceiver.cpp
index efa24e1..18b85c7 100644
--- a/AudioManagerDaemon/src/ControlReceiver.cpp
+++ b/AudioManagerDaemon/src/ControlReceiver.cpp
@@ -59,6 +59,7 @@ am_Error_e ControlReceiver::connect(am_Handle_s & handle, am_connectionID_t & co
tempConnection.connectionFormat=format;
tempConnection.connectionID=0;
+ //todo: enter function to find out what happends if the same connection is in the course of being build up.
if (mDatabaseHandler->existConnection(tempConnection)) return E_ALREADY_EXISTS; //todo:enter the correct connectionID here?
mDatabaseHandler->enterConnectionDB(tempConnection,connectionID);
diff --git a/AudioManagerDaemon/src/ControlSender.cpp b/AudioManagerDaemon/src/ControlSender.cpp
index 57b5974..232c8e7 100644
--- a/AudioManagerDaemon/src/ControlSender.cpp
+++ b/AudioManagerDaemon/src/ControlSender.cpp
@@ -7,6 +7,7 @@
#include "ControlSender.h"
#include "PluginTemplate.h"
+#include <dlt/dlt.h>
#include <assert.h>
@@ -14,15 +15,22 @@ ControlSender::ControlSender(std::string controlPluginFile)
:mlibHandle(NULL),
mController(NULL)
{
- ControlSendInterface* (*createFunc)();
- createFunc = getCreateFunction<ControlSendInterface*()>(controlPluginFile,mlibHandle);
- assert(createFunc!=NULL);
- mController = createFunc();
+ if (!controlPluginFile.empty())
+ {
+ ControlSendInterface* (*createFunc)();
+ createFunc = getCreateFunction<ControlSendInterface*()>(controlPluginFile,mlibHandle);
+ assert(createFunc!=NULL);
+ mController = createFunc();
+ }
+ else
+ {
+ DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("No controller loaded !"));
+ }
}
ControlSender::~ControlSender()
{
- dlclose(mlibHandle);
+ if (mlibHandle) dlclose(mlibHandle);
}
void ControlSender::hookAllPluginsLoaded()
diff --git a/AudioManagerDaemon/src/DatabaseHandler.cpp b/AudioManagerDaemon/src/DatabaseHandler.cpp
index e9884ca..030c41e 100644
--- a/AudioManagerDaemon/src/DatabaseHandler.cpp
+++ b/AudioManagerDaemon/src/DatabaseHandler.cpp
@@ -28,6 +28,7 @@
#include <vector>
#include <fstream>
#include <sstream>
+#include <string>
#define DOMAIN_TABLE "Domains"
#define SOURCE_CLASS_TABLE "SourceClasses"
@@ -193,7 +194,7 @@ am_Error_e DatabaseHandler::enterMainConnectionDB(const am_MainConnection_s & ma
sqlite3_stmt* query=NULL;
int eCode=0;
- std::string command= "INSERT INTO " + std::string(MAINCONNECTION_TABLE) + "(sourceID, sinkID, connectionState) VALUES (?,?,?)";
+ std::string command= "INSERT INTO " + std::string(MAINCONNECTION_TABLE) + "(sourceID, sinkID, connectionState, delay) VALUES (?,?,?,-1)";
sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
sqlite3_bind_int(query,1, mainConnectionData.route.sourceID);
sqlite3_bind_int(query,2, mainConnectionData.route.sinkID);
@@ -214,7 +215,7 @@ am_Error_e DatabaseHandler::enterMainConnectionDB(const am_MainConnection_s & ma
connectionID=sqlite3_last_insert_rowid(mDatabase);
- //now check the connectionTabel for all connections in the route. IF a particular route is not found, we return with error
+ //now check the connectionTable for all connections in the route. IF a particular route is not found, we return with error
std::vector<uint16_t> listOfConnections;
int16_t delay=0;
command="SELECT connectionID, delay FROM "+std::string(CONNECTION_TABLE)+(" WHERE sourceID=? AND sinkID=? AND connectionFormat=?");
@@ -1179,7 +1180,10 @@ am_Error_e DatabaseHandler::removeMainConnectionDB(const am_mainConnectionID_t m
if(!sqQuery(command)) return E_DATABASE_ERROR;
if(!sqQuery(command1)) return E_DATABASE_ERROR;
DLT_LOG(AudioManager, DLT_LOG_INFO, DLT_STRING("DatabaseHandler::removeMainConnectionDB removed:"),DLT_INT(mainConnectionID));
- if (mDatabaseObserver) mDatabaseObserver->numberOfMainConnectionsChanged();
+ if (mDatabaseObserver) {
+ mDatabaseObserver->mainConnectionStateChanged(mainConnectionID,CS_DISCONNECTED);
+ mDatabaseObserver->numberOfMainConnectionsChanged();
+ }
return E_OK;
}
@@ -2587,7 +2591,16 @@ am_Error_e DatabaseHandler::changeDelayMainConnection(const am_timeSync_t & dela
sqlite3_stmt* query=NULL;
int eCode=0;
- std::string command="UPDATE " + std::string(MAINCONNECTION_TABLE) + " SET delay=? WHERE mainConnectionID=?;";
+ std::string command ="SELECT mainConnectionID FROM "+ std::string(MAINCONNECTION_TABLE) +" WHERE delay=? AND mainConnectionID=?";
+ sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
+ sqlite3_bind_int(query,1, delay);
+ sqlite3_bind_int(query,2, connectionID);
+ if((eCode=sqlite3_step(query))!=SQLITE_DONE)
+ {
+ sqlite3_finalize(query);
+ return E_OK;
+ }
+ command="UPDATE " + std::string(MAINCONNECTION_TABLE) + " SET delay=? WHERE mainConnectionID=?;";
sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
sqlite3_bind_int(query,1, delay);
sqlite3_bind_int(query,2, connectionID);
@@ -3072,7 +3085,7 @@ am_Error_e DatabaseHandler::changeConnectionTimingInformation(const am_connectio
{
assert(connectionID!=0);
- sqlite3_stmt *query=NULL, *queryMainConnections;
+ sqlite3_stmt *query=NULL, *queryMainConnections, *queryMainConnectionSubIDs;
int eCode=0;
std::string command= "UPDATE " + std::string(CONNECTION_TABLE) + " set delay=? WHERE connectionID=?";
@@ -3093,22 +3106,27 @@ am_Error_e DatabaseHandler::changeConnectionTimingInformation(const am_connectio
}
//now we need to find all mainConnections that use the changed connection and update their timing
- am_mainConnectionID_t mainConnectionID;
am_timeSync_t tempDelay=0;
am_Error_e error;
- command= "SELECT mainConnectionID FROM " + std::string(MAINCONNECTION_TABLE);
+
+ std::string command2;
+ int tempMainConnectionID;
+ bool firstrow=true;
+ //first get all route tables for all mainconnections
+ command= "SELECT name FROM sqlite_master WHERE type ='table' and name LIKE 'MainConnectionRoute%'";
sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&queryMainConnections,NULL);
while((eCode=sqlite3_step(queryMainConnections))==SQLITE_ROW)
{
- mainConnectionID=sqlite3_column_int(queryMainConnections,0);
- if(connectionPartofMainConnection(connectionID,mainConnectionID))
+ //now check if the connection ID is in this table
+ std::string tablename=std::string((const char*)sqlite3_column_text(queryMainConnections,0));
+ command2="(SELECT connectionID FROM " + tablename + " WHERE connectionID="+i2s(connectionID)+")";
+ sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&queryMainConnectionSubIDs,NULL);
+ if((eCode=sqlite3_step(queryMainConnectionSubIDs))==SQLITE_ROW)
{
- tempDelay=calculateMainConnectionDelay(mainConnectionID);
- if ((error=changeDelayMainConnection(tempDelay,mainConnectionID))!= E_OK)
- {
- return error;
- }
+ //if the connection ID is in, recalculate the mainconnection delay
+ std::stringstream(tablename.substr(tablename.find_first_not_of("MainConnectionRoute"))) >> tempMainConnectionID;
+ changeDelayMainConnection(calculateMainConnectionDelay(tempMainConnectionID),tempMainConnectionID);
}
}
@@ -3124,6 +3142,12 @@ am_Error_e DatabaseHandler::changeConnectionTimingInformation(const am_connectio
return E_DATABASE_ERROR;
}
+ sqlite3_prepare_v2(mDatabase,command2.c_str(),-1,&queryMainConnectionSubIDs,NULL);
+ while((eCode=sqlite3_step(queryMainConnectionSubIDs))==SQLITE_ROW)
+ {
+ std::string temp=std::string((const char*)sqlite3_column_text(queryMainConnections,0));
+ }
+
return E_OK;
}
@@ -3152,36 +3176,19 @@ am_Error_e DatabaseHandler::changeConnectionFinal(const am_connectionID_t connec
return E_OK;
}
-bool DatabaseHandler::connectionPartofMainConnection(const am_connectionID_t connectionID, const am_mainConnectionID_t mainConnectionID) const
-{
- sqlite3_stmt* query=NULL;
- std::string command = "SELECT connectionID FROM MainConnectionRoute"+ i2s(mainConnectionID)+ " WHERE connectionID=" + i2s(connectionID);
- int eCode=0;
- bool returnVal=true;
- sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- if ((eCode=sqlite3_step(query))==SQLITE_DONE) returnVal=false;
- else if (eCode!=SQLITE_ROW)
- {
- returnVal=false;
- DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::connectionPartofMainConnection database error!:"), DLT_INT(eCode))
- }
- sqlite3_finalize(query);
- return returnVal;
-}
-
am_timeSync_t DatabaseHandler::calculateMainConnectionDelay(const am_mainConnectionID_t mainConnectionID) const
{
assert (mainConnectionID!=0);
sqlite3_stmt* query=NULL;
- std::string command = "SELECT delay FROM MainConnectionRoute"+ i2s(mainConnectionID);
+ std::string command = "SELECT sum(Connections.delay),min(Connections.delay) FROM "+ std::string(CONNECTION_TABLE)+",MainConnectionRoute"+ i2s(mainConnectionID)+" WHERE MainConnectionRoute"+ i2s(mainConnectionID)+".connectionID = Connections.connectionID" ;
int eCode=0;
am_timeSync_t delay=0;
+ am_timeSync_t min=0;
sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
- while((eCode=sqlite3_step(query))==SQLITE_ROW)
+ if((eCode=sqlite3_step(query))==SQLITE_ROW)
{
- int16_t temp_delay=sqlite3_column_int(query,0);
- if (temp_delay!=-1 && delay!=-1) delay+=temp_delay;
- else delay=-1;
+ delay=sqlite3_column_int(query,0);
+ min=sqlite3_column_int(query,1);
}
if((eCode=sqlite3_step(query))!=SQLITE_DONE)
{
@@ -3194,9 +3201,9 @@ am_timeSync_t DatabaseHandler::calculateMainConnectionDelay(const am_mainConnect
DLT_LOG(AudioManager, DLT_LOG_ERROR, DLT_STRING("DatabaseHandler::calculateMainConnectionDelay SQLITE Finalize error code:"),DLT_INT(eCode));
return E_DATABASE_ERROR;
}
-
- if (delay==0) delay=-1;
+ if (min<0) delay=-1;
return delay;
+
}
void DatabaseHandler::registerObserver(DatabaseObserver *iObserver)
@@ -3215,7 +3222,7 @@ bool DatabaseHandler::sourceVisible(const am_sourceID_t sourceID) const
sqlite3_prepare_v2(mDatabase,command.c_str(),-1,&query,NULL);
if ((eCode=sqlite3_step(query))==SQLITE_DONE)
{
- returnVal=sqlite3_column_int(query,0);
+ returnVal=(bool)sqlite3_column_int(query,0);
}
else if (eCode!=SQLITE_ROW)
{
diff --git a/AudioManagerDaemon/src/RoutingReceiver.cpp b/AudioManagerDaemon/src/RoutingReceiver.cpp
index a01164b..bbf4c78 100644
--- a/AudioManagerDaemon/src/RoutingReceiver.cpp
+++ b/AudioManagerDaemon/src/RoutingReceiver.cpp
@@ -276,7 +276,6 @@ void RoutingReceiver::hookDomainRegistrationComplete(const am_domainID_t domainI
-
void RoutingReceiver::hookSinkAvailablityStatusChange(const am_sinkID_t sinkID, const am_Availability_s & availability)
{
mControlSender->hookSystemSinkAvailablityStateChange(sinkID,availability);
diff --git a/AudioManagerDaemon/src/RoutingSender.cpp b/AudioManagerDaemon/src/RoutingSender.cpp
index 735f260..cdef1ad 100644
--- a/AudioManagerDaemon/src/RoutingSender.cpp
+++ b/AudioManagerDaemon/src/RoutingSender.cpp
@@ -118,10 +118,13 @@ RoutingSender::RoutingSender(const std::vector<std::string>& listOfPluginDirecto
InterfaceNamePairs routerInterface;
routerInterface.routingInterface = router;
+
+ //here, the busname is saved together with the interface. Later The domains will register with the name and sinks, sources etc with the domain....
router->returnBusName(routerInterface.busName);
mListInterfaces.push_back(routerInterface);
mListLibraryHandles.push_back(tempLibHandle);
}
+ //now all plugins are loaded, so the interface is ready
}
RoutingSender::~RoutingSender()
diff --git a/AudioManagerDaemon/src/main.cpp b/AudioManagerDaemon/src/main.cpp
index 93bfc8a..2e79696 100644
--- a/AudioManagerDaemon/src/main.cpp
+++ b/AudioManagerDaemon/src/main.cpp
@@ -31,6 +31,8 @@
//todo: versioning of PluginInterfaces on linux level (.symver stuff)
//todo: all communication like all plugins loaded etc...
//todo: seperate documentation of test from normal project
+//todo: check the startup sequence. Dbus shall be activated last...
+//todo: there is a bug in the visible flags of sinks and sources. fix it.
#include <dbus/dbus.h>
#include <dlt/dlt.h>
@@ -75,7 +77,10 @@ int main(int argc, char *argv[])
RoutingReceiver iRoutingReceiver(&iDatabaseHandler,&iRoutingSender,&iControlSender);
ControlReceiver iControlReceiver(&iDatabaseHandler,&iRoutingSender,&iCommandSender);
- iCommandSender.startupInterface(&iCommandReceiver);
+ //since the plugins have been loaded by the *Senders before, we can tell the Controller this:
+ iControlSender.hookAllPluginsLoaded();
+
+
iDBusWrapper.dbusMainLoop();
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_
diff --git a/PluginCommandInterfaceDbus/CMakeLists.txt b/PluginCommandInterfaceDbus/CMakeLists.txt
index 690c3a2..5a2877d 100644
--- a/PluginCommandInterfaceDbus/CMakeLists.txt
+++ b/PluginCommandInterfaceDbus/CMakeLists.txt
@@ -6,7 +6,6 @@ PROJECT(PluginCommandInterfaceDbus)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -pipe -g -Wall -W -D_REENTRANT")
-
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}")
set(STD_INCLUDE_DIRS "/usr/include")
diff --git a/PluginCommandInterfaceDbus/src/DBusMessageHandler.cpp b/PluginCommandInterfaceDbus/src/DBusMessageHandler.cpp
index 21c1350..e6ee3f6 100644
--- a/PluginCommandInterfaceDbus/src/DBusMessageHandler.cpp
+++ b/PluginCommandInterfaceDbus/src/DBusMessageHandler.cpp
@@ -1,4 +1,27 @@
-
+/**
+* Copyright (C) 2011, BMW AG
+*
+* GeniviAudioMananger DbusPlugin
+*
+* \file DBusMessageHandler.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 "DBusMessageHandler.h"
#include "CommandSender.h"
#include "DBusConfiguration.h"
diff --git a/PluginControlInterface/CMakeLists.txt b/PluginControlInterface/CMakeLists.txt
index 20f6622..c00e485 100644
--- a/PluginControlInterface/CMakeLists.txt
+++ b/PluginControlInterface/CMakeLists.txt
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 2.6)
PROJECT(PluginControlInterface)
-#set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xlinker -export-dynamic")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -pipe -g -Wall -W -D_REENTRANT")
diff --git a/PluginControlInterface/include/ControlSender.h b/PluginControlInterface/include/ControlSender.h
index df41662..8945d39 100644
--- a/PluginControlInterface/include/ControlSender.h
+++ b/PluginControlInterface/include/ControlSender.h
@@ -1,9 +1,28 @@
-/*
- * ControlSender.h
- *
- * Created on: Oct 25, 2011
- * Author: christian
- */
+/**
+* Copyright (C) 2011, BMW AG
+*
+* GeniviAudioMananger DbusPlugin
+*
+* \file ControlSender.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 CONTROLSENDER_H_
#define CONTROLSENDER_H_
diff --git a/PluginControlInterface/src/ControlSender.cpp b/PluginControlInterface/src/ControlSender.cpp
index cb3d0fa..5043667 100644
--- a/PluginControlInterface/src/ControlSender.cpp
+++ b/PluginControlInterface/src/ControlSender.cpp
@@ -1,9 +1,27 @@
-/*
- * ControlSender.cpp
- *
- * Created on: Oct 25, 2011
- * Author: christian
- */
+/**
+* Copyright (C) 2011, BMW AG
+*
+* GeniviAudioMananger DbusPlugin
+*
+* \file ControlSender.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 "ControlSender.h"
diff --git a/PluginRoutingInterfaceDbus/CMakeLists.txt b/PluginRoutingInterfaceDbus/CMakeLists.txt
index 9f094eb..a507320 100644
--- a/PluginRoutingInterfaceDbus/CMakeLists.txt
+++ b/PluginRoutingInterfaceDbus/CMakeLists.txt
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 2.6)
PROJECT(PluginRoutingInterfaceDbus)
-#set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xlinker -export-dynamic")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -pipe -g -Wall -W -D_REENTRANT")
diff --git a/PluginRoutingInterfaceDbus/include/RoutingSender.h b/PluginRoutingInterfaceDbus/include/RoutingSender.h
index 3fad945..f394644 100644
--- a/PluginRoutingInterfaceDbus/include/RoutingSender.h
+++ b/PluginRoutingInterfaceDbus/include/RoutingSender.h
@@ -1,9 +1,27 @@
-/*
- * RoutingSender.h
- *
- * Created on: Oct 25, 2011
- * Author: christian
- */
+/**
+* Copyright (C) 2011, BMW AG
+*
+* GeniviAudioMananger DbusPlugin
+*
+* \file RoutingSender.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 ROUTINGSENDER_H_
#define ROUTINGSENDER_H_
diff --git a/PluginRoutingInterfaceDbus/src/RoutingSender.cpp b/PluginRoutingInterfaceDbus/src/RoutingSender.cpp
index 01b4fd9..475f85f 100644
--- a/PluginRoutingInterfaceDbus/src/RoutingSender.cpp
+++ b/PluginRoutingInterfaceDbus/src/RoutingSender.cpp
@@ -1,9 +1,27 @@
-/*
- * RoutingSender.cpp
- *
- * Created on: Oct 25, 2011
- * Author: christian
- */
+/**
+* Copyright (C) 2011, BMW AG
+*
+* GeniviAudioMananger DbusPlugin
+*
+* \file RoutingSender.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 "RoutingSender.h"