2 * Copyright (C) 2011, BMW AG
4 * GeniviAudioMananger AudioManagerDaemon
6 * \file databasetest.cpp
8 * \date 20-Oct-2011 3:42:04 PM
9 * \author Christian Mueller (christian.ei.mueller@bmw.de)
12 * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
13 * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
15 * 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.
16 * 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.
17 * 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>.
18 * 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.
19 * 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.
20 * 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.
21 * 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.
23 * THIS CODE HAS BEEN GENERATED BY ENTERPRISE ARCHITECT GENIVI MODEL. PLEASE CHANGE ONLY IN ENTERPRISE ARCHITECT AND GENERATE AGAIN
26 #include "databaseTest.h"
27 #include "MockInterfaces.h"
28 #include "DatabaseHandler.h"
29 #include "ControlReceiver.h"
30 #include "ControlSender.h"
31 #include "DatabaseObserver.h"
32 #include "../ControlInterfaceBackdoor.h"
33 #include "../CommandInterfaceBackdoor.h"
34 #include "../CommonFunctions.h"
35 #include "DLTWrapper.h"
38 using namespace testing;
40 //extern int GetRandomNumber(int nLow, int nHigh);
41 //extern bool equalSoundProperty (const am_SoundProperty_s a, const am_SoundProperty_s b);
42 extern bool equalMainSoundProperty(const am_MainSoundProperty_s a, const am_MainSoundProperty_s b);
43 extern bool equalRoutingElement(const am_RoutingElement_s a, const am_RoutingElement_s b);
44 extern bool equalClassProperties(const am_ClassProperty_s a, const am_ClassProperty_s b);
45 extern std::string int2string(int i);
47 routingTest::routingTest() :
48 plistRoutingPluginDirs(), //
49 plistCommandPluginDirs(), //
50 pDatabaseHandler(std::string(":memory:")), //
51 pRoutingSender(plistRoutingPluginDirs), //
52 pCommandSender(plistCommandPluginDirs), //
54 pRoutingInterfaceBackdoor(), //
55 pCommandInterfaceBackdoor(), //
56 pControlSender(""), //
57 pRouter(&pDatabaseHandler, &pControlSender), //
58 pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender, &pRouter), //
59 pObserver(&pCommandSender, &pRoutingSender)
61 pDatabaseHandler.registerObserver(&pObserver);
62 pCommandInterfaceBackdoor.injectInterface(&pCommandSender, &pMockInterface);
65 routingTest::~routingTest()
69 void routingTest::createMainConnectionSetup()
71 //fill the connection database
72 am_Connection_s connection;
75 std::vector<am_Connection_s> connectionList;
77 //we create 9 sources and sinks:
78 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(9);
79 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(9);
81 for (uint16_t i = 1; i < 10; i++)
83 am_sinkID_t forgetSink;
84 am_sourceID_t forgetSource;
85 am_connectionID_t forgetConnection;
87 pCF.createConnection(connection);
88 connection.sinkID = i;
89 connection.sourceID = i;
90 connectionList.push_back(connection);
94 sink.name = "sink" + int2string(i);
96 pCF.createSource(source);
98 source.name = "source" + int2string(i);
101 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,forgetSink))
102 << "ERROR: database error";
103 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,forgetSource))
104 << "ERROR: database error";
105 ASSERT_EQ(E_OK,pDatabaseHandler.enterConnectionDB(connection,forgetConnection))
106 << "ERROR: database error";
107 ASSERT_EQ(E_OK, pDatabaseHandler.changeConnectionFinal(forgetConnection));
111 std::vector<am_RoutingElement_s> routingList;
112 pCF.connectionList2RoutingList(routingList, connectionList);
116 route.route = routingList;
120 //create a mainConnection
121 am_MainConnection_s mainConnection;
122 am_mainConnectionID_t mainConnectionID;
123 std::vector<am_MainConnection_s> mainConnectionList;
124 pCF.createMainConnection(mainConnection, route);
126 //enter mainconnection in database
127 EXPECT_CALL(pMockInterface,cbNumberOfMainConnectionsChanged()).Times(1);
128 EXPECT_CALL(pMockInterface,cbMainConnectionStateChanged(_,_)).Times(1);
129 ASSERT_EQ(E_OK,pDatabaseHandler.enterMainConnectionDB(mainConnection,mainConnectionID))
130 << "ERROR: database error";
131 ASSERT_NE(0,mainConnectionID)
132 << "ERROR: connectionID zero";
134 //read out the mainconnections and check if they are equal to the data written.
135 ASSERT_EQ(E_OK, pDatabaseHandler.getListMainConnections(mainConnectionList));
137 std::vector<am_MainConnection_s>::iterator listIterator = mainConnectionList.begin();
138 for (; listIterator < mainConnectionList.end(); ++listIterator)
140 if (listIterator->connectionID == mainConnectionID)
142 equal = equal && (listIterator->connectionState == mainConnection.connectionState) && (listIterator->route.sinkID == mainConnection.route.sinkID) && (listIterator->route.sourceID == mainConnection.route.sourceID) && (listIterator->delay == mainConnection.delay) && (std::equal(listIterator->route.route.begin(), listIterator->route.route.end(), routingList.begin(), equalRoutingElement));
145 ASSERT_EQ(true, equal);
148 void routingTest::SetUp()
150 logInfo("Database Test started ");
153 void routingTest::TearDown()
157 TEST_F(routingTest,crossfaders)
159 //todo:implement crossfader tests
162 TEST_F(routingTest,sourceState)
165 am_sourceID_t sourceID;
166 std::vector<am_Source_s> listSources;
167 pCF.createSource(source);
168 source.sourceState = SS_OFF;
171 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
172 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
174 //change the source state
175 ASSERT_EQ(E_OK, pDatabaseHandler.changeSourceState(sourceID,SS_ON));
177 //read out the changed values
178 ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
179 ASSERT_EQ(listSources[0].sourceState, SS_ON);
182 TEST_F(routingTest,sinkVolumeChange)
186 std::vector<am_Sink_s> listSinks;
187 pCF.createSink(sink);
191 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
192 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
194 //change the volume and check the read out
195 ASSERT_EQ(E_OK, pDatabaseHandler.changeSinkVolume(sinkID,34));
196 ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
197 ASSERT_EQ(listSinks[0].volume, 34);
200 TEST_F(routingTest,sourceVolumeChange)
203 am_sourceID_t sourceID;
204 std::vector<am_Source_s> listSources;
205 pCF.createSource(source);
209 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
210 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
212 //change the volume and check the read out
213 ASSERT_EQ(E_OK, pDatabaseHandler.changeSourceVolume(sourceID,34));
214 ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
215 ASSERT_EQ(listSources[0].volume, 34);
218 TEST_F(routingTest, peekSource)
220 std::vector<am_Source_s> listSources;
221 am_sourceID_t sourceID, source2ID, source3ID;
223 pCF.createSource(source);
225 //peek a source that does not exits
226 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(0);
227 ASSERT_EQ(E_OK, pDatabaseHandler.peekSource(std::string("newsource"),sourceID));
229 //make sure it is not in the list
230 ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
231 ASSERT_TRUE(listSources.empty());
232 ASSERT_EQ(sourceID, 100);
234 //now enter the source with the same name and make sure it does not get a new ID
235 source.name = "newsource";
236 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
237 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,source2ID));
238 ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
239 ASSERT_EQ(sourceID, source2ID);
240 ASSERT_TRUE(listSources[0].sourceID==sourceID);
242 //now we peek again. This time, the source exists
243 ASSERT_EQ(E_OK, pDatabaseHandler.peekSource(source.name,source3ID));
244 ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
245 ASSERT_TRUE(listSources.size()==1);
246 ASSERT_EQ(source3ID, source2ID);
249 TEST_F(routingTest, peekSourceDouble)
251 std::vector<am_Source_s> listSources;
252 am_sourceID_t sourceID;
253 am_sourceID_t source2ID;
254 am_sourceID_t source3ID;
256 pCF.createSource(source);
258 //peek a source that does not exits
259 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(0);
260 ASSERT_EQ(E_OK, pDatabaseHandler.peekSource(std::string("newsource"),sourceID));
262 //peek a second source that does not exits
263 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(0);
264 ASSERT_EQ(E_OK, pDatabaseHandler.peekSource(std::string("newsource2"),source2ID));
266 //make sure they are is not in the list
267 ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
268 ASSERT_TRUE(listSources.empty());
269 ASSERT_EQ(sourceID, 100);
270 source.name = "newsource";
272 //now enter the source with the same name than the first peek and make sure it does not get a new ID
273 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
274 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,source3ID));
275 ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
276 ASSERT_EQ(sourceID, source3ID);
277 ASSERT_TRUE(listSources[0].sourceID==sourceID);
280 TEST_F(routingTest, peekSink)
282 std::vector<am_Sink_s> listSinks;
283 am_sinkID_t sinkID, sink2ID, sink3ID;
285 pCF.createSink(sink);
287 //peek a sink that does not exits
288 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(0);
289 ASSERT_EQ(E_OK, pDatabaseHandler.peekSink(std::string("newsink"),sinkID));
291 //make sure it is not in the list
292 ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
293 ASSERT_TRUE(listSinks.empty());
294 ASSERT_EQ(sinkID, 100);
295 sink.name = "newsink";
297 //now enter the source with the same name and make sure it does not get a new ID
298 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
299 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sink2ID));
300 ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
301 ASSERT_EQ(sinkID, sink2ID);
302 ASSERT_TRUE(listSinks[0].sinkID==sinkID);
304 //now we peek again, this time, the sink exists
305 ASSERT_EQ(E_OK, pDatabaseHandler.peekSink(sink.name,sink3ID));
306 ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
307 ASSERT_TRUE(listSinks.size()==1);
308 ASSERT_EQ(sink3ID, sink2ID);
311 TEST_F(routingTest, peekSinkDouble)
313 std::vector<am_Sink_s> listSinks;
318 pCF.createSink(sink);
320 //peek a sink that does not exits
321 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(0);
322 ASSERT_EQ(E_OK, pDatabaseHandler.peekSink(std::string("newsink"),sinkID));
325 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(0);
326 ASSERT_EQ(E_OK, pDatabaseHandler.peekSink(std::string("nextsink"),sink2ID));
328 //make sure they are is not in the list
329 ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
330 ASSERT_TRUE(listSinks.empty());
331 ASSERT_EQ(sinkID, 100);
332 sink.name = "newsink";
334 //now enter the sink with the same name than the first peek and make sure it does not get a new ID
335 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
336 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sink3ID));
337 ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
338 ASSERT_EQ(sinkID, sink3ID);
339 ASSERT_TRUE(listSinks[0].sinkID==sinkID);
342 TEST_F(routingTest,changeConnectionTimingInformationCheckMainConnection)
344 am_Connection_s connection;
345 std::vector<am_Connection_s> connectionList;
346 std::vector<am_MainConnectionType_s> mainList;
347 pCF.createConnection(connection);
349 //prepare the test, it is one mainconnection, so we expect one callback
350 createMainConnectionSetup();
351 EXPECT_CALL(pMockInterface,cbTimingInformationChanged(1,216)).Times(1);
353 //first get all visible mainconnections and make sure, the delay is set to -1 for the first entry
354 ASSERT_EQ(E_OK, pDatabaseHandler.getListVisibleMainConnections(mainList));
355 ASSERT_EQ(mainList[0].delay, -1);
357 //no go through all connections and set the delay time to 24 for each connection
358 ASSERT_EQ(E_OK, pDatabaseHandler.getListConnections(connectionList));
359 std::vector<am_Connection_s>::iterator iteratorConnectionList = connectionList.begin();
360 for (; iteratorConnectionList < connectionList.end(); ++iteratorConnectionList)
362 ASSERT_EQ(E_OK, pDatabaseHandler.changeConnectionTimingInformation(iteratorConnectionList->sinkID,24));
365 //we read the result again and expect that the value is now different from -1
366 ASSERT_EQ(E_OK, pDatabaseHandler.getListVisibleMainConnections(mainList));
367 ASSERT_EQ(mainList[0].delay, 216);
370 TEST_F(routingTest,changeConnectionTimingInformation)
372 am_Connection_s connection;
373 am_connectionID_t connectionID;
374 std::vector<am_Connection_s> connectionList;
375 pCF.createConnection(connection);
378 ASSERT_EQ(E_OK, pDatabaseHandler.enterConnectionDB(connection,connectionID));
379 ASSERT_EQ(E_OK, pDatabaseHandler.changeConnectionFinal(connectionID));
381 //change the timing and check it
382 ASSERT_EQ(E_OK, pDatabaseHandler.changeConnectionTimingInformation(connectionID,24));
383 ASSERT_EQ(E_OK, pDatabaseHandler.getListConnections(connectionList));
384 ASSERT_TRUE(connectionList[0].delay==24);
387 TEST_F(routingTest,getSinkClassOfSink)
389 std::vector<am_SinkClass_s> sinkClassList;
390 std::vector<am_ClassProperty_s> classPropertyList;
391 am_SinkClass_s sinkClass, returnClass;
392 am_ClassProperty_s classProperty;
393 am_sinkClass_t sinkClassID;
396 classProperty.classProperty = CP_SINK_TYPE;
397 classProperty.value = 1;
398 classPropertyList.push_back(classProperty);
399 classProperty.classProperty = CP_SOURCE_TYPE;
400 classProperty.value = 4;
401 classPropertyList.push_back(classProperty);
402 sinkClass.name = "test";
403 sinkClass.sinkClassID = 4;
404 sinkClass.listClassProperties = classPropertyList;
405 pCF.createSink(sink);
406 sink.sinkClassID = 4;
409 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
410 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
412 //enter a new sinkclass, read out again and check
413 EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(1);
414 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
415 ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
416 ASSERT_EQ(sinkClassList[0].name, sinkClass.name);
417 ASSERT_EQ(sinkClassList[0].sinkClassID, 4);
418 ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
419 ASSERT_EQ(E_OK, pDatabaseHandler.getSinkClassInfoDB(sinkID,returnClass));
420 ASSERT_EQ(sinkClassList[0].name, returnClass.name);
421 ASSERT_EQ(sinkClassList[0].sinkClassID, returnClass.sinkClassID);
422 ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),returnClass.listClassProperties.begin(),equalClassProperties));
425 TEST_F(routingTest,getSourceClassOfSource)
427 std::vector<am_SourceClass_s> sourceClassList;
428 std::vector<am_ClassProperty_s> classPropertyList;
429 am_SourceClass_s sourceClass, sinkSourceClass;
430 am_ClassProperty_s classProperty;
431 am_sourceClass_t sourceClassID;
433 am_sourceID_t sourceID;
434 classProperty.classProperty = CP_SINK_TYPE;
435 classProperty.value = 1;
436 classPropertyList.push_back(classProperty);
437 classProperty.classProperty = CP_SOURCE_TYPE;
438 classProperty.value = 4;
439 classPropertyList.push_back(classProperty);
440 sourceClass.name = "test";
441 sourceClass.sourceClassID = 1;
442 sourceClass.listClassProperties = classPropertyList;
443 pCF.createSource(source);
445 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
446 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
447 EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1);
448 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
449 ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
450 ASSERT_EQ(sourceClassList[0].name, sourceClass.name);
451 ASSERT_EQ(sourceClassList[0].sourceClassID, 1);
452 ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
453 ASSERT_EQ(E_OK, pDatabaseHandler.getSourceClassInfoDB(sourceID,sinkSourceClass));
454 ASSERT_EQ(sourceClassList[0].name, sinkSourceClass.name);
455 ASSERT_EQ(sourceClassList[0].sourceClassID, sinkSourceClass.sourceClassID);
456 ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),sinkSourceClass.listClassProperties.begin(),equalClassProperties));
459 TEST_F(routingTest,removeSourceClass)
461 std::vector<am_SourceClass_s> sourceClassList;
462 std::vector<am_ClassProperty_s> classPropertyList;
463 am_SourceClass_s sourceClass;
464 am_ClassProperty_s classProperty;
465 am_sourceClass_t sourceClassID;
466 classProperty.classProperty = CP_SINK_TYPE;
467 classProperty.value = 1;
468 classPropertyList.push_back(classProperty);
469 classProperty.classProperty = CP_SOURCE_TYPE;
470 classProperty.value = 4;
471 classPropertyList.push_back(classProperty);
472 sourceClass.name = "test";
473 sourceClass.sourceClassID = 3;
474 sourceClass.listClassProperties = classPropertyList;
476 EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(2);
477 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
478 ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
479 ASSERT_EQ(sourceClassList[0].name, sourceClass.name);
480 ASSERT_EQ(sourceClassList[0].sourceClassID, 3);
481 ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
482 ASSERT_EQ(E_OK, pDatabaseHandler.removeSourceClassDB(3));
483 ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
484 ASSERT_TRUE(sourceClassList.empty());
487 TEST_F(routingTest,updateSourceClass)
489 std::vector<am_SourceClass_s> sourceClassList;
490 std::vector<am_ClassProperty_s> classPropertyList, changedPropertyList;
491 am_SourceClass_s sourceClass, changedClass;
492 am_ClassProperty_s classProperty;
493 am_sourceClass_t sourceClassID;
494 classProperty.classProperty = CP_SINK_TYPE;
495 classProperty.value = 1;
496 classPropertyList.push_back(classProperty);
497 classProperty.classProperty = CP_SOURCE_TYPE;
498 classProperty.value = 4;
499 classPropertyList.push_back(classProperty);
500 sourceClass.name = "test";
501 sourceClass.sourceClassID = 0;
502 sourceClass.listClassProperties = classPropertyList;
503 changedClass = sourceClass;
504 changedClass.listClassProperties[1].value = 6;
505 changedPropertyList = changedClass.listClassProperties;
506 EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1);
507 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
508 changedClass.sourceClassID = sourceClassID;
509 ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
510 ASSERT_EQ(sourceClassList[0].name, sourceClass.name);
511 ASSERT_EQ(sourceClassList[0].sourceClassID, 100);
512 ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
513 ASSERT_EQ(E_OK, pDatabaseHandler.changeSourceClassInfoDB(changedClass));
514 ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
515 ASSERT_EQ(sourceClassList[0].name, sourceClass.name);
516 ASSERT_EQ(sourceClassList[0].sourceClassID, 100);
517 ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),changedPropertyList.begin(),equalClassProperties));
520 TEST_F(routingTest,enterSourceClass)
522 std::vector<am_SourceClass_s> sourceClassList;
523 std::vector<am_ClassProperty_s> classPropertyList;
524 am_SourceClass_s sourceClass;
525 am_ClassProperty_s classProperty;
526 am_sourceClass_t sourceClassID;
527 classProperty.classProperty = CP_SINK_TYPE;
528 classProperty.value = 1;
529 classPropertyList.push_back(classProperty);
530 classProperty.classProperty = CP_SOURCE_TYPE;
531 classProperty.value = 4;
532 classPropertyList.push_back(classProperty);
533 sourceClass.name = "test";
534 sourceClass.sourceClassID = 0;
535 sourceClass.listClassProperties = classPropertyList;
537 EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1);
538 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
539 ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
540 ASSERT_EQ(sourceClassList[0].name, sourceClass.name);
541 ASSERT_EQ(sourceClassList[0].sourceClassID, 100);
542 ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
545 TEST_F(routingTest,enterSourceClassStatic)
547 std::vector<am_SourceClass_s> sourceClassList;
548 std::vector<am_ClassProperty_s> classPropertyList;
549 am_SourceClass_s sourceClass;
550 am_ClassProperty_s classProperty;
551 am_sourceClass_t sourceClassID;
552 classProperty.classProperty = CP_SINK_TYPE;
553 classProperty.value = 1;
554 classPropertyList.push_back(classProperty);
555 classProperty.classProperty = CP_SOURCE_TYPE;
556 classProperty.value = 4;
557 classPropertyList.push_back(classProperty);
558 sourceClass.name = "test";
559 sourceClass.sourceClassID = 3;
560 sourceClass.listClassProperties = classPropertyList;
562 EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1);
563 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
564 ASSERT_EQ(E_OK, pDatabaseHandler.getListSourceClasses(sourceClassList));
565 ASSERT_EQ(sourceClassList[0].name, sourceClass.name);
566 ASSERT_EQ(sourceClassList[0].sourceClassID, 3);
567 ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
570 TEST_F(routingTest,removeSinkClass)
572 std::vector<am_SinkClass_s> sinkClassList;
573 std::vector<am_ClassProperty_s> classPropertyList;
574 am_SinkClass_s sinkClass;
575 am_ClassProperty_s classProperty;
576 am_sinkClass_t sinkClassID;
577 classProperty.classProperty = CP_SINK_TYPE;
578 classProperty.value = 1;
579 classPropertyList.push_back(classProperty);
580 classProperty.classProperty = CP_SOURCE_TYPE;
581 classProperty.value = 4;
582 classPropertyList.push_back(classProperty);
583 sinkClass.name = "test";
584 sinkClass.sinkClassID = 0;
585 sinkClass.listClassProperties = classPropertyList;
587 EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(2);
588 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
589 ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
590 ASSERT_EQ(sinkClassList[0].name, sinkClass.name);
591 ASSERT_EQ(sinkClassList[0].sinkClassID, 100);
592 ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
593 ASSERT_EQ(E_OK, pDatabaseHandler.removeSinkClassDB(sinkClassID));
594 ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
595 ASSERT_TRUE(sinkClassList.empty());
598 TEST_F(routingTest,updateSinkClass)
600 std::vector<am_SinkClass_s> sinkClassList;
601 std::vector<am_ClassProperty_s> classPropertyList, changedPropertyList;
602 am_SinkClass_s sinkClass, changedClass;
603 am_ClassProperty_s classProperty;
604 am_sinkClass_t sinkClassID;
605 classProperty.classProperty = CP_SINK_TYPE;
606 classProperty.value = 1;
607 classPropertyList.push_back(classProperty);
608 classProperty.classProperty = CP_SOURCE_TYPE;
609 classProperty.value = 4;
610 classPropertyList.push_back(classProperty);
611 sinkClass.name = "test";
612 sinkClass.sinkClassID = 0;
613 sinkClass.listClassProperties = classPropertyList;
614 changedClass = sinkClass;
615 changedClass.listClassProperties[1].value = 6;
616 changedPropertyList = changedClass.listClassProperties;
617 EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(1);
618 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
619 changedClass.sinkClassID = sinkClassID;
620 ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
621 ASSERT_EQ(sinkClassList[0].name, sinkClass.name);
622 ASSERT_EQ(sinkClassList[0].sinkClassID, 100);
623 ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
624 ASSERT_EQ(E_OK, pDatabaseHandler.changeSinkClassInfoDB(changedClass));
625 ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
626 ASSERT_EQ(sinkClassList[0].name, sinkClass.name);
627 ASSERT_EQ(sinkClassList[0].sinkClassID, 100);
628 ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),changedPropertyList.begin(),equalClassProperties));
631 TEST_F(routingTest,enterSinkClass)
633 std::vector<am_SinkClass_s> sinkClassList;
634 std::vector<am_ClassProperty_s> classPropertyList;
635 am_SinkClass_s sinkClass;
636 am_ClassProperty_s classProperty;
637 am_sinkClass_t sinkClassID;
638 classProperty.classProperty = CP_SINK_TYPE;
639 classProperty.value = 1;
640 classPropertyList.push_back(classProperty);
641 classProperty.classProperty = CP_SOURCE_TYPE;
642 classProperty.value = 4;
643 classPropertyList.push_back(classProperty);
644 sinkClass.name = "test";
645 sinkClass.sinkClassID = 0;
646 sinkClass.listClassProperties = classPropertyList;
648 EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(1);
649 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
650 ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
651 ASSERT_EQ(sinkClassList[0].name, sinkClass.name);
652 ASSERT_EQ(sinkClassList[0].sinkClassID, 100);
653 ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
656 TEST_F(routingTest,enterSinkClassStatic)
658 std::vector<am_SinkClass_s> sinkClassList;
659 std::vector<am_ClassProperty_s> classPropertyList;
660 am_SinkClass_s sinkClass;
661 am_ClassProperty_s classProperty;
662 am_sinkClass_t sinkClassID;
663 classProperty.classProperty = CP_SINK_TYPE;
664 classProperty.value = 1;
665 classPropertyList.push_back(classProperty);
666 classProperty.classProperty = CP_SOURCE_TYPE;
667 classProperty.value = 4;
668 classPropertyList.push_back(classProperty);
669 sinkClass.name = "test";
670 sinkClass.sinkClassID = 4;
671 sinkClass.listClassProperties = classPropertyList;
673 EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(1);
674 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
675 ASSERT_EQ(E_OK, pDatabaseHandler.getListSinkClasses(sinkClassList));
676 ASSERT_EQ(sinkClassList[0].name, sinkClass.name);
677 ASSERT_EQ(sinkClassList[0].sinkClassID, 4);
678 ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
681 TEST_F(routingTest, changeSystemProperty)
683 std::vector<am_SystemProperty_s> listSystemProperties, listReturn;
684 am_SystemProperty_s systemProperty;
686 systemProperty.type = SYP_TEST;
687 systemProperty.value = 33;
688 listSystemProperties.push_back(systemProperty);
689 EXPECT_CALL(pMockInterface,cbSystemPropertyChanged(_)).Times(1); //todo: check the exact value here
690 ASSERT_EQ(E_OK, pDatabaseHandler.enterSystemProperties(listSystemProperties));
691 systemProperty.value = 444;
692 ASSERT_EQ(E_OK, pDatabaseHandler.changeSystemPropertyDB(systemProperty));
693 ASSERT_EQ(E_OK, pDatabaseHandler.getListSystemProperties(listReturn));
694 ASSERT_EQ(listReturn[0].type, systemProperty.type);
695 ASSERT_EQ(listReturn[0].value, systemProperty.value);
698 TEST_F(routingTest, systemProperties)
700 std::vector<am_SystemProperty_s> listSystemProperties, listReturn;
701 am_SystemProperty_s systemProperty;
703 systemProperty.type = SYP_TEST;
704 systemProperty.value = 33;
705 listSystemProperties.push_back(systemProperty);
707 ASSERT_EQ(E_OK, pDatabaseHandler.enterSystemProperties(listSystemProperties));
708 ASSERT_EQ(E_OK, pDatabaseHandler.getListSystemProperties(listReturn));
709 ASSERT_EQ(listReturn[0].type, systemProperty.type);
710 ASSERT_EQ(listReturn[0].value, systemProperty.value);
713 TEST_F(routingTest,enterSourcesCorrect)
715 //fill the connection database
716 am_Source_s staticSource, firstDynamicSource, secondDynamicSource;
717 am_sourceID_t staticSourceID, firstDynamicSourceID, secondDynamicSourceID;
718 std::vector<am_Source_s> sourceList;
720 pCF.createSource(staticSource);
721 staticSource.sourceID = 4;
722 staticSource.name = "Static";
724 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(3);
725 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(staticSource,staticSourceID))
726 << "ERROR: database error";
727 ASSERT_EQ(staticSource.sourceID,staticSourceID)
728 << "ERROR: ID not the one given in staticSource";
730 pCF.createSource(firstDynamicSource);
731 firstDynamicSource.name = "firstDynamicSource";
733 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(firstDynamicSource,firstDynamicSourceID))
734 << "ERROR: database error";
735 ASSERT_EQ(firstDynamicSourceID,DYNAMIC_ID_BOUNDARY)
736 << "ERROR: ID not the one given in firstDynamicSink";
738 pCF.createSource(secondDynamicSource);
739 secondDynamicSource.name = "secondDynamicSource";
741 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(secondDynamicSource,secondDynamicSourceID))
742 << "ERROR: database error";
743 ASSERT_NEAR(secondDynamicSourceID,DYNAMIC_ID_BOUNDARY,10)
744 << "ERROR: ID not the one given in secondDynamicSink";
746 //now read back and check the returns agains the given values
747 ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(sourceList))
748 << "ERROR: database error";
751 std::vector<am_Source_s>::iterator listIterator = sourceList.begin();
752 for (; listIterator < sourceList.end(); ++listIterator)
754 if (listIterator->sourceID == staticSourceID)
756 equal = equal && pCF.compareSource(listIterator, staticSource);
759 if (listIterator->sourceID == firstDynamicSourceID)
761 equal = equal && pCF.compareSource(listIterator, firstDynamicSource);
764 if (listIterator->sourceID == secondDynamicSourceID)
766 equal = equal && pCF.compareSource(listIterator, secondDynamicSource);
770 ASSERT_EQ(true, equal);
773 TEST_F(routingTest, changeSourceMainSoundProperty)
775 std::vector<am_Source_s> listSources;
777 am_sourceID_t sourceID;
778 pCF.createSource(source);
779 am_MainSoundProperty_s property;
780 property.type = MSP_NAVIGATION_OFFSET;
782 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
783 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
785 EXPECT_CALL(pMockInterface,cbMainSourceSoundPropertyChanged(sourceID,_)).Times(1); //todo: check in detail
786 ASSERT_EQ(E_OK, pDatabaseHandler.changeMainSourceSoundPropertyDB(property,sourceID));
787 ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
788 std::vector<am_MainSoundProperty_s>::iterator listIterator = listSources[0].listMainSoundProperties.begin();
789 for (; listIterator < listSources[0].listMainSoundProperties.end(); ++listIterator)
791 if (listIterator->type == property.type)
793 ASSERT_EQ(listIterator->value, property.value);
798 TEST_F(routingTest, changeSinkMuteState)
800 std::vector<am_Sink_s> listSinks;
803 pCF.createSink(sink);
804 am_MuteState_e muteState = MS_MUTED;
805 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
806 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
808 EXPECT_CALL(pMockInterface,cbSinkMuteStateChanged(sinkID,muteState)).Times(1);
809 ASSERT_EQ(E_OK, pDatabaseHandler.changeSinkMuteStateDB(muteState,sinkID));
810 ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
811 ASSERT_EQ(muteState, listSinks[0].muteState);
814 TEST_F(routingTest, changeSinkMainSoundProperty)
816 std::vector<am_Sink_s> listSinks;
819 pCF.createSink(sink);
820 am_MainSoundProperty_s property;
821 property.type = MSP_NAVIGATION_OFFSET;
824 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
825 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
827 EXPECT_CALL(pMockInterface,cbMainSinkSoundPropertyChanged(sinkID,_)).Times(1);
828 ASSERT_EQ(E_OK, pDatabaseHandler.changeMainSinkSoundPropertyDB(property,sinkID));
829 ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
830 std::vector<am_MainSoundProperty_s>::iterator listIterator = listSinks[0].listMainSoundProperties.begin();
831 for (; listIterator < listSinks[0].listMainSoundProperties.end(); ++listIterator)
833 if (listIterator->type == property.type)
835 ASSERT_EQ(listIterator->value, property.value);
840 TEST_F(routingTest, peekDomain)
842 std::vector<am_Domain_s> listDomains;
844 am_domainID_t domainID;
845 am_domainID_t domain2ID;
846 pCF.createDomain(domain);
847 ASSERT_EQ(E_OK, pDatabaseHandler.peekDomain(std::string("newdomain"),domainID));
848 ASSERT_EQ(E_OK, pDatabaseHandler.getListDomains(listDomains));
849 ASSERT_TRUE(listDomains.empty());
850 ASSERT_EQ(domainID, 1);
851 domain.name = "newdomain";
852 ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domain2ID));
853 ASSERT_EQ(E_OK, pDatabaseHandler.getListDomains(listDomains));
854 ASSERT_EQ(domainID, domain2ID);
855 ASSERT_TRUE(listDomains[0].domainID==domainID);
858 TEST_F(routingTest, peekDomainFirstEntered)
860 std::vector<am_Domain_s> listDomains;
862 am_domainID_t domainID;
863 am_domainID_t domain2ID;
864 pCF.createDomain(domain);
865 domain.name = "newdomain";
866 ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
867 ASSERT_EQ(E_OK, pDatabaseHandler.peekDomain(std::string("newdomain"),domain2ID));
868 ASSERT_EQ(domainID, domain2ID);
869 ASSERT_EQ(E_OK, pDatabaseHandler.getListDomains(listDomains));
870 ASSERT_TRUE(listDomains.size()==1);
873 TEST_F(routingTest, changeDomainState)
875 std::vector<am_Domain_s> listDomains;
877 am_domainID_t domainID;
878 pCF.createDomain(domain);
879 am_DomainState_e newState = DS_INDEPENDENT_STARTUP;
880 ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
881 ASSERT_EQ(E_OK, pDatabaseHandler.changDomainStateDB(newState,domainID));
882 ASSERT_EQ(E_OK, pDatabaseHandler.getListDomains(listDomains));
883 ASSERT_EQ(newState, listDomains[0].state);
886 TEST_F(routingTest, changeMainConnectionState)
888 std::vector<am_MainConnection_s> listMainConnections;
889 createMainConnectionSetup();
890 EXPECT_CALL(pMockInterface,cbMainConnectionStateChanged(_,_)).Times(1);
891 ASSERT_EQ(E_OK,pDatabaseHandler.changeMainConnectionStateDB(1,CS_DISCONNECTING))
892 << "ERROR: database error";ASSERT_EQ(E_OK, pDatabaseHandler.getListMainConnections(listMainConnections));
893 ASSERT_EQ(CS_DISCONNECTING, listMainConnections[0].connectionState);
896 TEST_F(routingTest, changeSinkAvailability)
898 std::vector<am_Sink_s> listSinks;
901 pCF.createSink(sink);
902 am_Availability_s availability;
903 availability.availability = A_UNKNOWN;
904 availability.availabilityReason = AR_TEMPERATURE;
906 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
907 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
908 ASSERT_EQ(E_OK, pDatabaseHandler.changeSinkAvailabilityDB(availability,sinkID));
909 ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
910 ASSERT_EQ(availability.availability, listSinks[0].available.availability);
911 ASSERT_EQ(availability.availabilityReason, listSinks[0].available.availabilityReason);
914 TEST_F(routingTest, changeSourceAvailability)
916 std::vector<am_Source_s> listSources;
918 am_sourceID_t sourceID;
919 pCF.createSource(source);
920 am_Availability_s availability;
921 availability.availability = A_UNKNOWN;
922 availability.availabilityReason = AR_TEMPERATURE;
923 source.visible = true;
925 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
926 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
927 ASSERT_EQ(E_OK, pDatabaseHandler.changeSourceAvailabilityDB(availability,sourceID));
928 ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
929 ASSERT_EQ(availability.availability, listSources[0].available.availability);
930 ASSERT_EQ(availability.availabilityReason, listSources[0].available.availabilityReason);
933 TEST_F(routingTest,changeMainConnectionRoute)
935 std::vector<am_MainConnection_s> originalList;
936 std::vector<am_MainConnection_s> newList;
937 createMainConnectionSetup();
938 //fill the connection database
939 am_Connection_s connection;
942 std::vector<am_Connection_s> connectionList;
944 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(9);
945 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(9);
946 for (uint16_t i = 1; i < 10; i++)
948 am_sinkID_t forgetSink;
949 am_sourceID_t forgetSource;
950 am_connectionID_t forgetConnection;
952 pCF.createConnection(connection);
953 connection.sinkID = i + 20;
954 connection.sourceID = i + 20;
955 connection.delay = -1;
956 connectionList.push_back(connection);
958 pCF.createSink(sink);
959 sink.sinkID = i + 20;
960 sink.name = "sink" + int2string(i + 20);
962 pCF.createSource(source);
963 source.sourceID = i + 20;
964 source.name = "source" + int2string(i + 30);
967 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,forgetSink))
968 << "ERROR: database error";
969 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,forgetSource))
970 << "ERROR: database error";
971 ASSERT_EQ(E_OK,pDatabaseHandler.enterConnectionDB(connection,forgetConnection))
972 << "ERROR: database error";
973 ASSERT_EQ(E_OK,pDatabaseHandler.getListMainConnections(originalList))
974 << "ERROR: database error";
979 std::vector<am_RoutingElement_s> routingList;
980 pCF.connectionList2RoutingList(routingList, connectionList);
984 route.route = routingList;
988 ASSERT_EQ(E_OK, pDatabaseHandler.changeMainConnectionRouteDB(1,route));
989 ASSERT_EQ(E_OK,pDatabaseHandler.getListMainConnections(newList))
990 << "ERROR: database error";ASSERT_TRUE(std::equal(newList[0].route.route.begin(),newList[0].route.route.end(),routingList.begin(),equalRoutingElement));
991 ASSERT_FALSE(std::equal(newList[0].route.route.begin(),newList[0].route.route.end(),originalList[0].route.route.begin(),equalRoutingElement));
994 TEST_F(routingTest,changeMainSinkVolume)
998 am_mainVolume_t newVol = 20;
999 std::vector<am_Sink_s> listSinks;
1000 pCF.createSink(sink);
1002 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
1003 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
1005 EXPECT_CALL(pMockInterface,cbVolumeChanged(sinkID,newVol)).Times(1);
1006 ASSERT_EQ(E_OK, pDatabaseHandler.changeSinkMainVolumeDB(newVol,sinkID));
1007 ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
1008 ASSERT_EQ(listSinks[0].mainVolume, newVol);
1011 TEST_F(routingTest,getMainSourceSoundProperties)
1014 am_sourceID_t sourceID;
1015 pCF.createSource(source);
1016 std::vector<am_MainSoundProperty_s> mainSoundProperties = source.listMainSoundProperties;
1017 std::vector<am_MainSoundProperty_s> listMainSoundProperties;
1019 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
1020 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
1021 ASSERT_EQ(E_OK, pDatabaseHandler.getListMainSourceSoundProperties(sourceID,listMainSoundProperties));
1022 ASSERT_TRUE(std::equal(mainSoundProperties.begin(),mainSoundProperties.end(),listMainSoundProperties.begin(),equalMainSoundProperty));
1025 TEST_F(routingTest,getMainSinkSoundProperties)
1029 pCF.createSink(sink);
1030 std::vector<am_MainSoundProperty_s> mainSoundProperties = sink.listMainSoundProperties;
1031 std::vector<am_MainSoundProperty_s> listMainSoundProperties;
1033 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
1034 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
1035 ASSERT_EQ(E_OK, pDatabaseHandler.getListMainSinkSoundProperties(sinkID,listMainSoundProperties));
1036 ASSERT_TRUE(std::equal(mainSoundProperties.begin(),mainSoundProperties.end(),listMainSoundProperties.begin(),equalMainSoundProperty));
1039 TEST_F(routingTest,getMainSources)
1041 am_Source_s source, source1, source2;
1042 am_sourceID_t sourceID;
1043 pCF.createSource(source);
1044 pCF.createSource(source1);
1045 pCF.createSource(source2);
1046 source1.name = "source1";
1047 source2.name = "source2";
1049 source1.visible = false;
1050 std::vector<am_SourceType_s> listMainSources;
1051 std::vector<am_Source_s> listSources;
1053 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(3);
1055 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
1056 source.sourceID = sourceID;
1057 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source1,sourceID));
1058 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source2,sourceID));
1059 source2.sourceID = sourceID;
1060 ASSERT_EQ(E_OK, pDatabaseHandler.getListMainSources(listMainSources));
1061 listSources.push_back(source);
1062 listSources.push_back(source2);
1063 std::vector<am_SourceType_s>::iterator listIterator = listMainSources.begin();
1064 for (; listIterator < listMainSources.end(); ++listIterator)
1066 equal = equal && pCF.compareSinkMainSource(listIterator, listSources);
1071 TEST_F(routingTest,getMainSinks)
1073 am_Sink_s sink, sink1, sink2;
1075 pCF.createSink(sink);
1076 pCF.createSink(sink1);
1077 pCF.createSink(sink2);
1078 sink1.name = "sink1";
1079 sink2.name = "sink2";
1081 sink1.visible = false;
1082 std::vector<am_SinkType_s> listMainSinks;
1083 std::vector<am_Sink_s> listSinks;
1085 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(3);
1086 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
1087 sink.sinkID = sinkID;
1088 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink1,sinkID));
1089 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink2,sinkID));
1090 sink2.sinkID = sinkID;
1091 ASSERT_EQ(E_OK, pDatabaseHandler.getListMainSinks(listMainSinks));
1092 listSinks.push_back(sink);
1093 listSinks.push_back(sink2);
1094 std::vector<am_SinkType_s>::iterator listIterator = listMainSinks.begin();
1095 for (; listIterator < listMainSinks.end(); ++listIterator)
1097 equal = equal && pCF.compareSinkMainSink(listIterator, listSinks);
1102 TEST_F(routingTest,getVisibleMainConnections)
1104 createMainConnectionSetup();
1105 am_MainConnection_s mainConnection;
1107 pCF.createMainConnection(mainConnection, route);
1108 std::vector<am_MainConnectionType_s> visibleMainConnection;
1109 ASSERT_EQ(E_OK, pDatabaseHandler.getListVisibleMainConnections(visibleMainConnection));
1110 ASSERT_TRUE(1==visibleMainConnection[0].mainConnectionID);
1111 ASSERT_TRUE(mainConnection.connectionState==visibleMainConnection[0].connectionState);
1112 ASSERT_TRUE(mainConnection.delay==visibleMainConnection[0].delay);
1113 ASSERT_TRUE(1==visibleMainConnection[0].sinkID);
1114 ASSERT_TRUE(1==visibleMainConnection[0].sourceID);
1117 TEST_F(routingTest,getListSourcesOfDomain)
1119 am_Source_s source, source2;
1121 am_domainID_t domainID;
1122 am_sourceID_t sourceID;
1123 std::vector<am_sourceID_t> sourceList, sourceCheckList;
1124 pCF.createSource(source);
1125 source.sourceID = 1;
1126 source.name = "testSource";
1127 source.domainID = 1;
1128 pCF.createSource(source2);
1129 source2.sourceID = 0;
1130 source2.name = "testSource2";
1131 source2.domainID = 5;
1132 pCF.createDomain(domain);
1133 sourceCheckList.push_back(1); //sink.sinkID);
1135 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(2);
1136 ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
1137 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID))
1138 << "ERROR: database error";
1139 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source2,sourceID))
1140 << "ERROR: database error";
1141 ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.getListSourcesOfDomain(2,sourceList))
1142 << "ERROR: database error";ASSERT_TRUE(sourceList.empty());
1143 ASSERT_EQ(E_OK,pDatabaseHandler.getListSourcesOfDomain(1,sourceList))
1144 << "ERROR: database error";
1145 ASSERT_TRUE(std::equal(sourceList.begin(),sourceList.end(),sourceCheckList.begin()) && !sourceList.empty());
1148 TEST_F(routingTest,getListSinksOfDomain)
1150 am_Sink_s sink, sink2;
1152 am_domainID_t domainID;
1154 std::vector<am_sinkID_t> sinkList, sinkCheckList;
1155 pCF.createSink(sink);
1158 pCF.createSink(sink2);
1160 sink2.name = "sink2";
1161 pCF.createDomain(domain);
1162 sinkCheckList.push_back(1); //sink.sinkID);
1164 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(2);
1165 ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
1166 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID))
1167 << "ERROR: database error";
1168 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink2,sinkID))
1169 << "ERROR: database error";
1170 ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.getListSinksOfDomain(2,sinkList))
1171 << "ERROR: database error";ASSERT_TRUE(sinkList.empty());
1172 ASSERT_EQ(E_OK,pDatabaseHandler.getListSinksOfDomain(1,sinkList))
1173 << "ERROR: database error";
1174 ASSERT_TRUE(std::equal(sinkList.begin(),sinkList.end(),sinkCheckList.begin()) && !sinkList.empty());
1177 TEST_F(routingTest,getListGatewaysOfDomain)
1179 am_Gateway_s gateway, gateway2;
1180 am_gatewayID_t gatewayID;
1181 am_domainID_t domainID;
1183 std::vector<am_gatewayID_t> gatewayList, gatewayCheckList;
1184 pCF.createGateway(gateway);
1185 gateway.gatewayID = 1;
1186 gateway.name = "testGateway";
1187 gateway.controlDomainID = 1;
1188 gateway.sourceID = 1;
1190 gateway.domainSinkID = 1;
1191 gateway.domainSourceID = 1;
1192 pCF.createGateway(gateway2);
1193 gateway2.gatewayID = 2;
1194 gateway2.name = "testGateway2";
1195 gateway2.controlDomainID = 4;
1196 gateway2.sourceID = 1;
1197 gateway2.sinkID = 1;
1198 gateway2.domainSinkID = 1;
1199 gateway2.domainSourceID = 1;
1200 pCF.createDomain(domain);
1201 gatewayCheckList.push_back(gateway.gatewayID);
1202 ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
1203 ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway,gatewayID))
1204 << "ERROR: database error";
1205 ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway2,gatewayID))
1206 << "ERROR: database error";
1207 ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.getListGatewaysOfDomain(2,gatewayList))
1208 << "ERROR: database error";ASSERT_TRUE(gatewayList.empty());
1209 ASSERT_EQ(E_OK,pDatabaseHandler.getListGatewaysOfDomain(1,gatewayList))
1210 << "ERROR: database error";
1211 ASSERT_TRUE(std::equal(gatewayList.begin(),gatewayList.end(),gatewayCheckList.begin()) && !gatewayList.empty());
1214 TEST_F(routingTest,removeDomain)
1217 am_domainID_t domainID;
1218 std::vector<am_Domain_s> listDomains;
1219 pCF.createDomain(domain);
1220 ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID))
1221 << "ERROR: database error";
1222 ASSERT_EQ(E_OK,pDatabaseHandler.removeDomainDB(domainID))
1223 << "ERROR: database error";
1224 ASSERT_EQ(E_OK,pDatabaseHandler.getListDomains(listDomains))
1225 << "ERROR: database error";
1226 ASSERT_TRUE(listDomains.empty());
1229 TEST_F(routingTest,removeGateway)
1231 am_Gateway_s gateway;
1232 am_gatewayID_t gatewayID;
1233 std::vector<am_Gateway_s> listGateways;
1234 pCF.createGateway(gateway);
1235 ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway,gatewayID))
1236 << "ERROR: database error";
1237 ASSERT_EQ(E_OK,pDatabaseHandler.removeGatewayDB(gatewayID))
1238 << "ERROR: database error";
1239 ASSERT_EQ(E_OK,pDatabaseHandler.getListGateways(listGateways))
1240 << "ERROR: database error";
1241 ASSERT_TRUE(listGateways.empty());
1244 TEST_F(routingTest,removeSink)
1248 std::vector<am_Sink_s> listSinks;
1249 pCF.createSink(sink);
1250 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(2);
1251 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID))
1252 << "ERROR: database error";
1253 ASSERT_EQ(E_OK,pDatabaseHandler.removeSinkDB(sinkID))
1254 << "ERROR: database error";
1255 ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks))
1256 << "ERROR: database error";
1257 ASSERT_TRUE(listSinks.empty());
1260 TEST_F(routingTest,removeSource)
1262 //fill the connection database
1264 am_sourceID_t sourceID;
1265 std::vector<am_Source_s> listSources;
1266 pCF.createSource(source);
1268 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(2);
1269 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID))
1270 << "ERROR: database error";
1271 ASSERT_EQ(E_OK,pDatabaseHandler.removeSourceDB(sourceID))
1272 << "ERROR: database error";
1273 ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources))
1274 << "ERROR: database error";
1275 ASSERT_TRUE(listSources.empty());
1278 TEST_F(routingTest, removeMainConnection)
1280 createMainConnectionSetup();
1281 EXPECT_CALL(pMockInterface,cbNumberOfMainConnectionsChanged()).Times(1);
1282 EXPECT_CALL(pMockInterface,cbMainConnectionStateChanged(_,_)).Times(1);
1283 ASSERT_EQ(E_OK,pDatabaseHandler.removeMainConnectionDB(1))
1284 << "ERROR: database error";
1287 TEST_F(routingTest,removeNonexistentMainConnectionFail)
1289 ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeMainConnectionDB(34))
1290 << "ERROR: database error";
1293 TEST_F(routingTest,removeNonexistentSource)
1295 ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeSourceDB(3))
1296 << "ERROR: database error";
1299 TEST_F(routingTest,removeNonexistentSink)
1301 ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeSinkDB(2))
1302 << "ERROR: database error";
1305 TEST_F(routingTest,removeNonexistentGateway)
1307 ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeGatewayDB(12))
1308 << "ERROR: database error";
1311 TEST_F(routingTest,registerGatewayCorrect)
1313 //initialize gateway
1314 std::vector<am_Gateway_s> returnList;
1315 am_Gateway_s gateway, gateway1, gateway2;
1316 am_gatewayID_t gatewayID = 0, gatewayID1 = 0, gatewayID2 = 0;
1318 pCF.createGateway(gateway);
1319 pCF.createGateway(gateway1);
1320 gateway1.gatewayID = 20;
1321 pCF.createGateway(gateway2);
1323 ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway,gatewayID))
1324 << "ERROR: database error";
1325 ASSERT_EQ(100,gatewayID)
1326 << "ERROR: domainID zero";
1328 ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway1,gatewayID1))
1329 << "ERROR: database error";
1330 ASSERT_EQ(gateway1.gatewayID,gatewayID1)
1331 << "ERROR: domainID zero";
1333 ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway2,gatewayID2))
1334 << "ERROR: database error";
1335 ASSERT_EQ(101,gatewayID2)
1336 << "ERROR: domainID zero";
1338 //now check if we read out the correct values
1339 ASSERT_EQ(E_OK, pDatabaseHandler.getListGateways(returnList));
1341 std::vector<am_Gateway_s>::iterator listIterator = returnList.begin();
1343 for (; listIterator < returnList.end(); ++listIterator)
1345 if (listIterator->gatewayID == gatewayID)
1347 equal = equal && pCF.compareGateway(listIterator, gateway);
1350 if (listIterator->gatewayID == gatewayID1)
1352 equal = equal && pCF.compareGateway(listIterator, gateway1);
1355 if (listIterator->gatewayID == gatewayID2)
1357 equal = equal && pCF.compareGateway(listIterator, gateway2);
1361 ASSERT_EQ(true, equal);
1364 TEST_F(routingTest,getGatewayInfo)
1366 //initialize gateway
1367 std::vector<am_Gateway_s> returnList;
1368 am_Gateway_s gateway, gateway1, gateway2;
1369 am_gatewayID_t gatewayID = 0, gatewayID1 = 0, gatewayID2 = 0;
1371 pCF.createGateway(gateway);
1372 pCF.createGateway(gateway1);
1373 gateway1.gatewayID = 20;
1374 pCF.createGateway(gateway2);
1376 ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway,gatewayID))
1377 << "ERROR: database error";
1378 ASSERT_EQ(100,gatewayID)
1379 << "ERROR: domainID zero";
1381 ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway1,gatewayID1))
1382 << "ERROR: database error";
1383 ASSERT_EQ(gateway1.gatewayID,gatewayID1)
1384 << "ERROR: domainID zero";
1386 ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway2,gatewayID2))
1387 << "ERROR: database error";
1388 ASSERT_EQ(101,gatewayID2)
1389 << "ERROR: domainID zero";
1391 //now check if we read out the correct values
1392 ASSERT_EQ(E_OK, pDatabaseHandler.getListGateways(returnList));
1394 std::vector<am_Gateway_s>::iterator listIterator = returnList.begin();
1396 for (; listIterator < returnList.end(); ++listIterator)
1398 if (listIterator->gatewayID == gatewayID)
1400 equal = equal && pCF.compareGateway(listIterator, gateway);
1403 if (listIterator->gatewayID == gatewayID1)
1405 equal = equal && pCF.compareGateway(listIterator, gateway1);
1408 if (listIterator->gatewayID == gatewayID2)
1410 equal = equal && pCF.compareGateway(listIterator, gateway2);
1414 ASSERT_EQ(true, equal);
1416 am_Gateway_s gatewayInfo;
1417 ASSERT_EQ(E_OK, pDatabaseHandler.getGatewayInfoDB(20,gatewayInfo));
1418 ASSERT_TRUE(pCF.compareGateway1(gateway1,gatewayInfo));
1422 TEST_F(routingTest,enterSinkThatAlreadyExistFail)
1424 //fill the connection database
1425 am_Sink_s staticSink, SecondSink;
1426 am_sinkID_t staticSinkID, SecondSinkID;
1428 pCF.createSink(staticSink);
1429 staticSink.sinkID = 43;
1430 staticSink.name = "Static";
1432 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
1433 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(staticSink,staticSinkID))
1434 << "ERROR: database error";
1435 ASSERT_EQ(staticSink.sinkID,staticSinkID)
1436 << "ERROR: ID not the one given in staticSink";
1438 pCF.createSink(SecondSink);
1439 SecondSink.sinkID = 43;
1440 SecondSink.name = "SecondSink";
1442 ASSERT_EQ(E_ALREADY_EXISTS,pDatabaseHandler.enterSinkDB(SecondSink,SecondSinkID))
1443 << "ERROR: database error";
1446 TEST_F(routingTest,enterSourcesThatAlreadyExistFail)
1448 //fill the connection database
1449 am_Source_s staticSource, SecondSource;
1450 am_sourceID_t staticSourceID, SecondSourceID;
1451 pCF.createSource(staticSource);
1452 staticSource.sourceID = 4;
1454 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
1455 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(staticSource,staticSourceID))
1456 << "ERROR: database error";
1457 ASSERT_EQ(staticSource.sourceID,staticSourceID)
1458 << "ERROR: ID not the one given in staticSource";
1460 pCF.createSource(SecondSource);
1461 SecondSource.sourceID = 4;
1463 ASSERT_EQ(E_ALREADY_EXISTS,pDatabaseHandler.enterSourceDB(SecondSource,SecondSourceID))
1464 << "ERROR: database error";
1467 TEST_F(routingTest,registerDomainCorrect)
1470 std::vector<am_Domain_s> returnList;
1472 am_domainID_t domainID = 0;
1473 pCF.createDomain(domain);
1475 ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID))
1476 << "ERROR: database error";
1477 ASSERT_NE(0,domainID)
1478 << "ERROR: domainID zero";
1480 //now check if we read out the correct values
1481 ASSERT_EQ(E_OK, pDatabaseHandler.getListDomains(returnList));
1483 std::vector<am_Domain_s>::iterator listIterator = returnList.begin();
1484 for (; listIterator < returnList.end(); ++listIterator)
1486 if (listIterator->domainID == domainID)
1488 equal = equal && (listIterator->name.compare(domain.name) == 0) && (listIterator->busname.compare(domain.busname) == 0) && (listIterator->complete == domain.complete) && (listIterator->early == domain.early) && (listIterator->state == domain.state);
1491 ASSERT_EQ(true, equal);
1494 TEST_F(routingTest,registerConnectionCorrect)
1496 am_Connection_s connection;
1497 am_connectionID_t connectionID;
1498 std::vector<am_Connection_s> returnList;
1499 pCF.createConnection(connection);
1501 ASSERT_EQ(E_OK,pDatabaseHandler.enterConnectionDB(connection,connectionID))
1502 << "ERROR: database error";;
1503 ASSERT_NE(0,connectionID)
1504 << "ERROR: connectionID zero";
1506 //now check if we read out the correct values
1507 ASSERT_EQ(E_OK, pDatabaseHandler.changeConnectionFinal(connectionID));
1508 ASSERT_EQ(E_OK, pDatabaseHandler.getListConnections(returnList));
1510 std::vector<am_Connection_s>::iterator listIterator = returnList.begin();
1511 for (; listIterator < returnList.end(); ++listIterator)
1513 if (listIterator->connectionID == connectionID)
1515 equal = (listIterator->sourceID == connection.sourceID) && (listIterator->sinkID == connection.sinkID) && (listIterator->delay == connection.delay) && (listIterator->connectionFormat = connection.connectionFormat);
1518 ASSERT_EQ(true, equal);
1521 TEST_F(routingTest,enterMainConnectionCorrect)
1523 createMainConnectionSetup();
1526 TEST_F(routingTest,enterSinksCorrect)
1528 //fill the connection database
1529 am_Sink_s staticSink, firstDynamicSink, secondDynamicSink;
1530 am_sinkID_t staticSinkID, firstDynamicSinkID, secondDynamicSinkID;
1531 std::vector<am_Sink_s> sinkList;
1533 pCF.createSink(staticSink);
1534 staticSink.sinkID = 4;
1536 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(3);
1537 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(staticSink,staticSinkID))
1538 << "ERROR: database error";
1539 ASSERT_EQ(staticSink.sinkID,staticSinkID)
1540 << "ERROR: ID not the one given in staticSink";
1542 pCF.createSink(firstDynamicSink);
1543 firstDynamicSink.name = "firstdynamic";
1544 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(firstDynamicSink,firstDynamicSinkID))
1545 << "ERROR: database error";
1546 ASSERT_EQ(firstDynamicSinkID,DYNAMIC_ID_BOUNDARY)
1547 << "ERROR: ID not the one given in firstDynamicSink";
1549 pCF.createSink(secondDynamicSink);
1550 secondDynamicSink.name = "seconddynamic";
1552 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(secondDynamicSink,secondDynamicSinkID))
1553 << "ERROR: database error";
1554 ASSERT_NEAR(secondDynamicSinkID,DYNAMIC_ID_BOUNDARY,10)
1555 << "ERROR: ID not the one given in secondDynamicSink";
1557 //now read back and check the returns agains the given values
1558 ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(sinkList))
1559 << "ERROR: database error";
1562 std::vector<am_Sink_s>::iterator listIterator = sinkList.begin();
1563 for (; listIterator < sinkList.end(); ++listIterator)
1565 if (listIterator->sinkID == staticSinkID)
1567 equal = equal && pCF.compareSink(listIterator, staticSink);
1570 if (listIterator->sinkID == firstDynamicSinkID)
1572 equal = equal && pCF.compareSink(listIterator, firstDynamicSink);
1575 if (listIterator->sinkID == secondDynamicSinkID)
1577 equal = equal && pCF.compareSink(listIterator, secondDynamicSink);
1580 ASSERT_EQ(true, equal);
1583 //Commented out - gives always a warning..
1584 //TEST_F(databaseTest,registerDomainFailonID0)
1586 // am_Domain_s domain;
1587 // am_domainID_t domainID=5;
1588 // pCF.createDomain(domain);
1589 // domain.domainID=1;
1590 // ASSERT_DEATH(pDatabaseHandler.enterDomainDB(domain,domainID),"Assertion `domainData.domainID==0'");
1593 int main(int argc, char **argv)
1595 ::testing::InitGoogleTest(&argc, argv);
1596 return RUN_ALL_TESTS();