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"
37 using namespace testing;
39 DLT_DECLARE_CONTEXT(DLT_CONTEXT)
41 //extern int GetRandomNumber(int nLow, int nHigh);
42 //extern bool equalSoundProperty (const am_SoundProperty_s a, const am_SoundProperty_s b);
43 extern bool equalMainSoundProperty (const am_MainSoundProperty_s a, const am_MainSoundProperty_s b);
44 extern bool equalRoutingElement (const am_RoutingElement_s a,const am_RoutingElement_s b);
45 extern bool equalClassProperties (const am_ClassProperty_s a,const am_ClassProperty_s b);
46 extern std::string int2string(int i);
48 databaseTest::databaseTest()
49 :plistRoutingPluginDirs(),
50 plistCommandPluginDirs(),
51 pDatabaseHandler(std::string(":memory:")),
52 pRoutingSender(plistRoutingPluginDirs),
53 pCommandSender(plistCommandPluginDirs),
55 pRoutingInterfaceBackdoor(),
56 pCommandInterfaceBackdoor(),
57 pControlReceiver(&pDatabaseHandler,&pRoutingSender,&pCommandSender),
58 pObserver(&pCommandSender,&pRoutingSender)
60 pDatabaseHandler.registerObserver(&pObserver);
61 pCommandInterfaceBackdoor.injectInterface(&pCommandSender,&pMockInterface);
64 databaseTest::~databaseTest()
68 void databaseTest::createMainConnectionSetup()
70 //fill the connection database
71 am_Connection_s connection;
74 std::vector<am_Connection_s> connectionList;
76 //we create 9 sources and sinks:
77 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(9);
78 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(9);
80 for (uint16_t i=1;i<10;i++)
82 am_sinkID_t forgetSink;
83 am_sourceID_t forgetSource;
84 am_connectionID_t forgetConnection;
86 pCF.createConnection(connection);
88 connection.sourceID=i;
89 connectionList.push_back(connection);
93 sink.name="sink" + int2string(i);
95 pCF.createSource(source);
97 source.name="source" + int2string(i);
100 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,forgetSink))<< "ERROR: database error";
101 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,forgetSource))<< "ERROR: database error";
102 ASSERT_EQ(E_OK,pDatabaseHandler.enterConnectionDB(connection,forgetConnection))<< "ERROR: database error";
103 ASSERT_EQ(E_OK,pDatabaseHandler.changeConnectionFinal(forgetConnection));
107 std::vector<am_RoutingElement_s> routingList;
108 pCF.connectionList2RoutingList(routingList,connectionList);
112 route.route=routingList;
116 //create a mainConnection
117 am_MainConnection_s mainConnection;
118 am_mainConnectionID_t mainConnectionID;
119 std::vector<am_MainConnection_s> mainConnectionList;
120 pCF.createMainConnection(mainConnection,route);
122 //enter mainconnection in database
123 EXPECT_CALL(pMockInterface,cbNumberOfMainConnectionsChanged()).Times(1);
124 EXPECT_CALL(pMockInterface,cbMainConnectionStateChanged(_,_)).Times(1);
125 ASSERT_EQ(E_OK,pDatabaseHandler.enterMainConnectionDB(mainConnection,mainConnectionID))<< "ERROR: database error";
126 ASSERT_NE(0,mainConnectionID)<< "ERROR: connectionID zero";
128 //read out the mainconnections and check if they are equal to the data written.
129 ASSERT_EQ(E_OK,pDatabaseHandler.getListMainConnections(mainConnectionList));
131 std::vector<am_MainConnection_s>::iterator listIterator=mainConnectionList.begin();
132 for(;listIterator<mainConnectionList.end();++listIterator)
134 if(listIterator->connectionID==mainConnectionID) {
135 equal= equal && (listIterator->connectionState == mainConnection.connectionState)
136 && (listIterator->route.sinkID == mainConnection.route.sinkID)
137 && (listIterator->route.sourceID == mainConnection.route.sourceID)
138 && (listIterator->delay == mainConnection.delay)
139 && (std::equal(listIterator->route.route.begin(),listIterator->route.route.end(),routingList.begin(),equalRoutingElement));
142 ASSERT_EQ(true,equal);
145 void databaseTest::SetUp()
147 DLT_REGISTER_APP("Dtest","AudioManagerDeamon");
148 DLT_REGISTER_CONTEXT(DLT_CONTEXT,"Main","Main Context");
149 DLT_LOG(DLT_CONTEXT,DLT_LOG_INFO, DLT_STRING("Database Test started "));
152 void databaseTest::TearDown()
154 DLT_UNREGISTER_CONTEXT(DLT_CONTEXT);
157 TEST_F(databaseTest,crossfaders)
159 //todo:implement crossfader tests
162 TEST_F(databaseTest,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(databaseTest,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(databaseTest,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(databaseTest, 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(databaseTest, 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(databaseTest, 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);
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(databaseTest, 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);
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(databaseTest,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(databaseTest,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(databaseTest,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);
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));
426 TEST_F(databaseTest,getSourceClassOfSource)
428 std::vector<am_SourceClass_s> sourceClassList;
429 std::vector<am_ClassProperty_s> classPropertyList;
430 am_SourceClass_s sourceClass, sinkSourceClass;
431 am_ClassProperty_s classProperty;
432 am_sourceClass_t sourceClassID;
434 am_sourceID_t sourceID;
435 classProperty.classProperty=CP_SINK_TYPE;
436 classProperty.value=1;
437 classPropertyList.push_back(classProperty);
438 classProperty.classProperty=CP_SOURCE_TYPE;
439 classProperty.value=4;
440 classPropertyList.push_back(classProperty);
441 sourceClass.name="test";
442 sourceClass.sourceClassID=1;
443 sourceClass.listClassProperties=classPropertyList;
444 pCF.createSource(source);
446 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
447 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
448 EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1);
449 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
450 ASSERT_EQ(E_OK,pDatabaseHandler.getListSourceClasses(sourceClassList));
451 ASSERT_EQ(sourceClassList[0].name,sourceClass.name);
452 ASSERT_EQ(sourceClassList[0].sourceClassID,1);
453 ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
454 ASSERT_EQ(E_OK,pDatabaseHandler.getSourceClassInfoDB(sourceID,sinkSourceClass));
455 ASSERT_EQ(sourceClassList[0].name,sinkSourceClass.name);
456 ASSERT_EQ(sourceClassList[0].sourceClassID,sinkSourceClass.sourceClassID);
457 ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),sinkSourceClass.listClassProperties.begin(),equalClassProperties));
461 TEST_F(databaseTest,removeSourceClass)
463 std::vector<am_SourceClass_s> sourceClassList;
464 std::vector<am_ClassProperty_s> classPropertyList;
465 am_SourceClass_s sourceClass;
466 am_ClassProperty_s classProperty;
467 am_sourceClass_t sourceClassID;
468 classProperty.classProperty=CP_SINK_TYPE;
469 classProperty.value=1;
470 classPropertyList.push_back(classProperty);
471 classProperty.classProperty=CP_SOURCE_TYPE;
472 classProperty.value=4;
473 classPropertyList.push_back(classProperty);
474 sourceClass.name="test";
475 sourceClass.sourceClassID=3;
476 sourceClass.listClassProperties=classPropertyList;
478 EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(2);
479 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
480 ASSERT_EQ(E_OK,pDatabaseHandler.getListSourceClasses(sourceClassList));
481 ASSERT_EQ(sourceClassList[0].name,sourceClass.name);
482 ASSERT_EQ(sourceClassList[0].sourceClassID,3);
483 ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
484 ASSERT_EQ(E_OK,pDatabaseHandler.removeSourceClassDB(3));
485 ASSERT_EQ(E_OK,pDatabaseHandler.getListSourceClasses(sourceClassList));
486 ASSERT_TRUE(sourceClassList.empty());
489 TEST_F(databaseTest,updateSourceClass)
491 std::vector<am_SourceClass_s> sourceClassList;
492 std::vector<am_ClassProperty_s> classPropertyList,changedPropertyList;
493 am_SourceClass_s sourceClass, changedClass;
494 am_ClassProperty_s classProperty;
495 am_sourceClass_t sourceClassID;
496 classProperty.classProperty=CP_SINK_TYPE;
497 classProperty.value=1;
498 classPropertyList.push_back(classProperty);
499 classProperty.classProperty=CP_SOURCE_TYPE;
500 classProperty.value=4;
501 classPropertyList.push_back(classProperty);
502 sourceClass.name="test";
503 sourceClass.sourceClassID=0;
504 sourceClass.listClassProperties=classPropertyList;
505 changedClass=sourceClass;
506 changedClass.listClassProperties[1].value=6;
507 changedPropertyList=changedClass.listClassProperties;
508 EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1);
509 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
510 changedClass.sourceClassID=sourceClassID;
511 ASSERT_EQ(E_OK,pDatabaseHandler.getListSourceClasses(sourceClassList));
512 ASSERT_EQ(sourceClassList[0].name,sourceClass.name);
513 ASSERT_EQ(sourceClassList[0].sourceClassID,100);
514 ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
515 ASSERT_EQ(E_OK,pDatabaseHandler.changeSourceClassInfoDB(changedClass));
516 ASSERT_EQ(E_OK,pDatabaseHandler.getListSourceClasses(sourceClassList));
517 ASSERT_EQ(sourceClassList[0].name,sourceClass.name);
518 ASSERT_EQ(sourceClassList[0].sourceClassID,100);
519 ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),changedPropertyList.begin(),equalClassProperties));
522 TEST_F(databaseTest,enterSourceClass)
524 std::vector<am_SourceClass_s> sourceClassList;
525 std::vector<am_ClassProperty_s> classPropertyList;
526 am_SourceClass_s sourceClass;
527 am_ClassProperty_s classProperty;
528 am_sourceClass_t sourceClassID;
529 classProperty.classProperty=CP_SINK_TYPE;
530 classProperty.value=1;
531 classPropertyList.push_back(classProperty);
532 classProperty.classProperty=CP_SOURCE_TYPE;
533 classProperty.value=4;
534 classPropertyList.push_back(classProperty);
535 sourceClass.name="test";
536 sourceClass.sourceClassID=0;
537 sourceClass.listClassProperties=classPropertyList;
539 EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1);
540 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
541 ASSERT_EQ(E_OK,pDatabaseHandler.getListSourceClasses(sourceClassList));
542 ASSERT_EQ(sourceClassList[0].name,sourceClass.name);
543 ASSERT_EQ(sourceClassList[0].sourceClassID,100);
544 ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
547 TEST_F(databaseTest,enterSourceClassStatic)
549 std::vector<am_SourceClass_s> sourceClassList;
550 std::vector<am_ClassProperty_s> classPropertyList;
551 am_SourceClass_s sourceClass;
552 am_ClassProperty_s classProperty;
553 am_sourceClass_t sourceClassID;
554 classProperty.classProperty=CP_SINK_TYPE;
555 classProperty.value=1;
556 classPropertyList.push_back(classProperty);
557 classProperty.classProperty=CP_SOURCE_TYPE;
558 classProperty.value=4;
559 classPropertyList.push_back(classProperty);
560 sourceClass.name="test";
561 sourceClass.sourceClassID=3;
562 sourceClass.listClassProperties=classPropertyList;
564 EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1);
565 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass));
566 ASSERT_EQ(E_OK,pDatabaseHandler.getListSourceClasses(sourceClassList));
567 ASSERT_EQ(sourceClassList[0].name,sourceClass.name);
568 ASSERT_EQ(sourceClassList[0].sourceClassID,3);
569 ASSERT_TRUE(std::equal(sourceClassList[0].listClassProperties.begin(),sourceClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
573 TEST_F(databaseTest,removeSinkClass)
575 std::vector<am_SinkClass_s> sinkClassList;
576 std::vector<am_ClassProperty_s> classPropertyList;
577 am_SinkClass_s sinkClass;
578 am_ClassProperty_s classProperty;
579 am_sinkClass_t sinkClassID;
580 classProperty.classProperty=CP_SINK_TYPE;
581 classProperty.value=1;
582 classPropertyList.push_back(classProperty);
583 classProperty.classProperty=CP_SOURCE_TYPE;
584 classProperty.value=4;
585 classPropertyList.push_back(classProperty);
586 sinkClass.name="test";
587 sinkClass.sinkClassID=0;
588 sinkClass.listClassProperties=classPropertyList;
590 EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(2);
591 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
592 ASSERT_EQ(E_OK,pDatabaseHandler.getListSinkClasses(sinkClassList));
593 ASSERT_EQ(sinkClassList[0].name,sinkClass.name);
594 ASSERT_EQ(sinkClassList[0].sinkClassID,100);
595 ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
596 ASSERT_EQ(E_OK,pDatabaseHandler.removeSinkClassDB(sinkClassID));
597 ASSERT_EQ(E_OK,pDatabaseHandler.getListSinkClasses(sinkClassList));
598 ASSERT_TRUE(sinkClassList.empty());
601 TEST_F(databaseTest,updateSinkClass)
603 std::vector<am_SinkClass_s> sinkClassList;
604 std::vector<am_ClassProperty_s> classPropertyList, changedPropertyList;
605 am_SinkClass_s sinkClass, changedClass;
606 am_ClassProperty_s classProperty;
607 am_sinkClass_t sinkClassID;
608 classProperty.classProperty=CP_SINK_TYPE;
609 classProperty.value=1;
610 classPropertyList.push_back(classProperty);
611 classProperty.classProperty=CP_SOURCE_TYPE;
612 classProperty.value=4;
613 classPropertyList.push_back(classProperty);
614 sinkClass.name="test";
615 sinkClass.sinkClassID=0;
616 sinkClass.listClassProperties=classPropertyList;
617 changedClass=sinkClass;
618 changedClass.listClassProperties[1].value=6;
619 changedPropertyList=changedClass.listClassProperties;
620 EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(1);
621 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
622 changedClass.sinkClassID=sinkClassID;
623 ASSERT_EQ(E_OK,pDatabaseHandler.getListSinkClasses(sinkClassList));
624 ASSERT_EQ(sinkClassList[0].name,sinkClass.name);
625 ASSERT_EQ(sinkClassList[0].sinkClassID,100);
626 ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
627 ASSERT_EQ(E_OK,pDatabaseHandler.changeSinkClassInfoDB(changedClass));
628 ASSERT_EQ(E_OK,pDatabaseHandler.getListSinkClasses(sinkClassList));
629 ASSERT_EQ(sinkClassList[0].name,sinkClass.name);
630 ASSERT_EQ(sinkClassList[0].sinkClassID,100);
631 ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),changedPropertyList.begin(),equalClassProperties));
634 TEST_F(databaseTest,enterSinkClass)
636 std::vector<am_SinkClass_s> sinkClassList;
637 std::vector<am_ClassProperty_s> classPropertyList;
638 am_SinkClass_s sinkClass;
639 am_ClassProperty_s classProperty;
640 am_sinkClass_t sinkClassID;
641 classProperty.classProperty=CP_SINK_TYPE;
642 classProperty.value=1;
643 classPropertyList.push_back(classProperty);
644 classProperty.classProperty=CP_SOURCE_TYPE;
645 classProperty.value=4;
646 classPropertyList.push_back(classProperty);
647 sinkClass.name="test";
648 sinkClass.sinkClassID=0;
649 sinkClass.listClassProperties=classPropertyList;
651 EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(1);
652 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
653 ASSERT_EQ(E_OK,pDatabaseHandler.getListSinkClasses(sinkClassList));
654 ASSERT_EQ(sinkClassList[0].name,sinkClass.name);
655 ASSERT_EQ(sinkClassList[0].sinkClassID,100);
656 ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
659 TEST_F(databaseTest,enterSinkClassStatic)
661 std::vector<am_SinkClass_s> sinkClassList;
662 std::vector<am_ClassProperty_s> classPropertyList;
663 am_SinkClass_s sinkClass;
664 am_ClassProperty_s classProperty;
665 am_sinkClass_t sinkClassID;
666 classProperty.classProperty=CP_SINK_TYPE;
667 classProperty.value=1;
668 classPropertyList.push_back(classProperty);
669 classProperty.classProperty=CP_SOURCE_TYPE;
670 classProperty.value=4;
671 classPropertyList.push_back(classProperty);
672 sinkClass.name="test";
673 sinkClass.sinkClassID=4;
674 sinkClass.listClassProperties=classPropertyList;
676 EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(1);
677 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID));
678 ASSERT_EQ(E_OK,pDatabaseHandler.getListSinkClasses(sinkClassList));
679 ASSERT_EQ(sinkClassList[0].name,sinkClass.name);
680 ASSERT_EQ(sinkClassList[0].sinkClassID,4);
681 ASSERT_TRUE(std::equal(sinkClassList[0].listClassProperties.begin(),sinkClassList[0].listClassProperties.end(),classPropertyList.begin(),equalClassProperties));
685 TEST_F(databaseTest, changeSystemProperty)
687 std::vector<am_SystemProperty_s> listSystemProperties,listReturn;
688 am_SystemProperty_s systemProperty;
690 systemProperty.type=SYP_TEST;
691 systemProperty.value=33;
692 listSystemProperties.push_back(systemProperty);
693 EXPECT_CALL(pMockInterface,cbSystemPropertyChanged(_)).Times(1); //todo: check the exact value here
694 ASSERT_EQ(E_OK,pDatabaseHandler.enterSystemProperties(listSystemProperties));
695 systemProperty.value=444;
696 ASSERT_EQ(E_OK,pDatabaseHandler.changeSystemPropertyDB(systemProperty));
697 ASSERT_EQ(E_OK,pDatabaseHandler.getListSystemProperties(listReturn));
698 ASSERT_EQ(listReturn[0].type,systemProperty.type);
699 ASSERT_EQ(listReturn[0].value,systemProperty.value);
702 TEST_F(databaseTest, systemProperties)
704 std::vector<am_SystemProperty_s> listSystemProperties,listReturn;
705 am_SystemProperty_s systemProperty;
707 systemProperty.type=SYP_TEST;
708 systemProperty.value=33;
709 listSystemProperties.push_back(systemProperty);
711 ASSERT_EQ(E_OK,pDatabaseHandler.enterSystemProperties(listSystemProperties));
712 ASSERT_EQ(E_OK,pDatabaseHandler.getListSystemProperties(listReturn));
713 ASSERT_EQ(listReturn[0].type,systemProperty.type);
714 ASSERT_EQ(listReturn[0].value,systemProperty.value);
718 TEST_F(databaseTest,enterSourcesCorrect)
720 //fill the connection database
721 am_Source_s staticSource,firstDynamicSource,secondDynamicSource;
722 am_sourceID_t staticSourceID,firstDynamicSourceID,secondDynamicSourceID;
723 std::vector<am_Source_s> sourceList;
725 pCF.createSource(staticSource);
726 staticSource.sourceID=4;
727 staticSource.name="Static";
729 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(3);
730 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(staticSource,staticSourceID))<< "ERROR: database error";
731 ASSERT_EQ(staticSource.sourceID,staticSourceID)<< "ERROR: ID not the one given in staticSource";
733 pCF.createSource(firstDynamicSource);
734 firstDynamicSource.name="firstDynamicSource";
736 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(firstDynamicSource,firstDynamicSourceID))<< "ERROR: database error";
737 ASSERT_EQ(firstDynamicSourceID,DYNAMIC_ID_BOUNDARY)<< "ERROR: ID not the one given in firstDynamicSink";
739 pCF.createSource(secondDynamicSource);
740 secondDynamicSource.name="secondDynamicSource";
742 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(secondDynamicSource,secondDynamicSourceID))<< "ERROR: database error";
743 ASSERT_NEAR(secondDynamicSourceID,DYNAMIC_ID_BOUNDARY,10)<< "ERROR: ID not the one given in secondDynamicSink";
745 //now read back and check the returns agains the given values
746 ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(sourceList))<< "ERROR: database error";
749 std::vector<am_Source_s>::iterator listIterator=sourceList.begin();
750 for(;listIterator<sourceList.end();++listIterator)
752 if(listIterator->sourceID==staticSourceID)
754 equal = equal && pCF.compareSource(listIterator,staticSource);
757 if(listIterator->sourceID==firstDynamicSourceID)
759 equal = equal && pCF.compareSource(listIterator,firstDynamicSource);
762 if(listIterator->sourceID==secondDynamicSourceID)
764 equal = equal && pCF.compareSource(listIterator,secondDynamicSource);
768 ASSERT_EQ(true,equal);
772 TEST_F(databaseTest, changeSourceMainSoundProperty)
774 std::vector<am_Source_s> listSources;
776 am_sourceID_t sourceID;
777 pCF.createSource(source);
778 am_MainSoundProperty_s property;
779 property.type=MSP_NAVIGATION_OFFSET;
781 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
782 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
784 EXPECT_CALL(pMockInterface,cbMainSourceSoundPropertyChanged(sourceID,_)).Times(1); //todo: check in detail
785 ASSERT_EQ(E_OK,pDatabaseHandler.changeMainSourceSoundPropertyDB(property,sourceID));
786 ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources));
787 std::vector<am_MainSoundProperty_s>::iterator listIterator=listSources[0].listMainSoundProperties.begin();
788 for(;listIterator<listSources[0].listMainSoundProperties.end();++listIterator)
790 if(listIterator->type==property.type)
792 ASSERT_EQ(listIterator->value,property.value);
797 TEST_F(databaseTest, changeSinkMuteState)
799 std::vector<am_Sink_s> listSinks;
802 pCF.createSink(sink);
803 am_MuteState_e muteState=MS_MUTED;
804 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
805 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
807 EXPECT_CALL(pMockInterface,cbSinkMuteStateChanged(sinkID,muteState)).Times(1);
808 ASSERT_EQ(E_OK,pDatabaseHandler.changeSinkMuteStateDB(muteState,sinkID));
809 ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks));
810 ASSERT_EQ(muteState,listSinks[0].muteState);
813 TEST_F(databaseTest, changeSinkMainSoundProperty)
815 std::vector<am_Sink_s> listSinks;
818 pCF.createSink(sink);
819 am_MainSoundProperty_s property;
820 property.type=MSP_NAVIGATION_OFFSET;
823 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
824 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
826 EXPECT_CALL(pMockInterface,cbMainSinkSoundPropertyChanged(sinkID,_)).Times(1);
827 ASSERT_EQ(E_OK,pDatabaseHandler.changeMainSinkSoundPropertyDB(property,sinkID));
828 ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks));
829 std::vector<am_MainSoundProperty_s>::iterator listIterator=listSinks[0].listMainSoundProperties.begin();
830 for(;listIterator<listSinks[0].listMainSoundProperties.end();++listIterator)
832 if(listIterator->type==property.type)
834 ASSERT_EQ(listIterator->value,property.value);
839 TEST_F(databaseTest, peekDomain)
841 std::vector<am_Domain_s> listDomains;
843 am_domainID_t domainID;
844 am_domainID_t domain2ID;
845 pCF.createDomain(domain);
846 ASSERT_EQ(E_OK,pDatabaseHandler.peekDomain(std::string("newdomain"),domainID));
847 ASSERT_EQ(E_OK,pDatabaseHandler.getListDomains(listDomains));
848 ASSERT_TRUE(listDomains.empty());
849 ASSERT_EQ(domainID,1);
850 domain.name="newdomain";
851 ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domain2ID));
852 ASSERT_EQ(E_OK,pDatabaseHandler.getListDomains(listDomains));
853 ASSERT_EQ(domainID,domain2ID);
854 ASSERT_TRUE(listDomains[0].domainID==domainID);
857 TEST_F(databaseTest, peekDomainFirstEntered)
859 std::vector<am_Domain_s> listDomains;
861 am_domainID_t domainID;
862 am_domainID_t domain2ID;
863 pCF.createDomain(domain);
864 domain.name="newdomain";
865 ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
866 ASSERT_EQ(E_OK,pDatabaseHandler.peekDomain(std::string("newdomain"),domain2ID));
867 ASSERT_EQ(domainID,domain2ID);
868 ASSERT_EQ(E_OK,pDatabaseHandler.getListDomains(listDomains));
869 ASSERT_TRUE(listDomains.size()==1);
872 TEST_F(databaseTest, changeDomainState)
874 std::vector<am_Domain_s> listDomains;
876 am_domainID_t domainID;
877 pCF.createDomain(domain);
878 am_DomainState_e newState=DS_INDEPENDENT_STARTUP;
879 ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
880 ASSERT_EQ(E_OK,pDatabaseHandler.changDomainStateDB(newState,domainID));
881 ASSERT_EQ(E_OK,pDatabaseHandler.getListDomains(listDomains));
882 ASSERT_EQ(newState,listDomains[0].state);
886 TEST_F(databaseTest, 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))<< "ERROR: database error";
892 ASSERT_EQ(E_OK,pDatabaseHandler.getListMainConnections(listMainConnections));
893 ASSERT_EQ(CS_DISCONNECTING,listMainConnections[0].connectionState);
896 TEST_F(databaseTest, 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(databaseTest, 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;
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);
934 TEST_F(databaseTest,changeMainConnectionRoute)
936 std::vector<am_MainConnection_s> originalList;
937 std::vector<am_MainConnection_s> newList;
938 createMainConnectionSetup();
939 //fill the connection database
940 am_Connection_s connection;
943 std::vector<am_Connection_s> connectionList;
945 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(9);
946 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(9);
947 for (uint16_t i=1;i<10;i++)
949 am_sinkID_t forgetSink;
950 am_sourceID_t forgetSource;
951 am_connectionID_t forgetConnection;
953 pCF.createConnection(connection);
954 connection.sinkID=i+20;
955 connection.sourceID=i+20;
957 connectionList.push_back(connection);
959 pCF.createSink(sink);
961 sink.name="sink" + int2string(i+20);
963 pCF.createSource(source);
964 source.sourceID=i+20;
965 source.name="source" + int2string(i+30);
968 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,forgetSink))<< "ERROR: database error";
969 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,forgetSource))<< "ERROR: database error";
970 ASSERT_EQ(E_OK,pDatabaseHandler.enterConnectionDB(connection,forgetConnection))<< "ERROR: database error";
971 ASSERT_EQ(E_OK,pDatabaseHandler.getListMainConnections(originalList))<< "ERROR: database error";
976 std::vector<am_RoutingElement_s> routingList;
977 pCF.connectionList2RoutingList(routingList,connectionList);
981 route.route=routingList;
985 ASSERT_EQ(E_OK,pDatabaseHandler.changeMainConnectionRouteDB(1,route));
986 ASSERT_EQ(E_OK,pDatabaseHandler.getListMainConnections(newList))<< "ERROR: database error";
987 ASSERT_TRUE(std::equal(newList[0].route.route.begin(),newList[0].route.route.end(),routingList.begin(),equalRoutingElement));
988 ASSERT_FALSE(std::equal(newList[0].route.route.begin(),newList[0].route.route.end(),originalList[0].route.route.begin(),equalRoutingElement));
991 TEST_F(databaseTest,changeMainSinkVolume)
995 am_mainVolume_t newVol=20;
996 std::vector<am_Sink_s> listSinks;
997 pCF.createSink(sink);
999 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
1000 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
1003 EXPECT_CALL(pMockInterface,cbVolumeChanged(sinkID,newVol)).Times(1);
1004 ASSERT_EQ(E_OK,pDatabaseHandler.changeSinkMainVolumeDB(newVol,sinkID));
1005 ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks));
1006 ASSERT_EQ(listSinks[0].mainVolume,newVol);
1009 TEST_F(databaseTest,getMainSourceSoundProperties)
1012 am_sourceID_t sourceID;
1013 pCF.createSource(source);
1014 std::vector<am_MainSoundProperty_s> mainSoundProperties=source.listMainSoundProperties;
1015 std::vector<am_MainSoundProperty_s> listMainSoundProperties;
1017 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
1018 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
1019 ASSERT_EQ(E_OK,pDatabaseHandler.getListMainSourceSoundProperties(sourceID,listMainSoundProperties));
1020 ASSERT_TRUE(std::equal(mainSoundProperties.begin(),mainSoundProperties.end(),listMainSoundProperties.begin(),equalMainSoundProperty));
1023 TEST_F(databaseTest,getMainSinkSoundProperties)
1027 pCF.createSink(sink);
1028 std::vector<am_MainSoundProperty_s> mainSoundProperties=sink.listMainSoundProperties;
1029 std::vector<am_MainSoundProperty_s> listMainSoundProperties;
1031 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
1032 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
1033 ASSERT_EQ(E_OK,pDatabaseHandler.getListMainSinkSoundProperties(sinkID,listMainSoundProperties));
1034 ASSERT_TRUE(std::equal(mainSoundProperties.begin(),mainSoundProperties.end(),listMainSoundProperties.begin(),equalMainSoundProperty));
1037 TEST_F(databaseTest,getMainSources)
1039 am_Source_s source, source1,source2;
1040 am_sourceID_t sourceID;
1041 pCF.createSource(source);
1042 pCF.createSource(source1);
1043 pCF.createSource(source2);
1044 source1.name="source1";
1045 source2.name="source2";
1047 source1.visible=false;
1048 std::vector<am_SourceType_s> listMainSources;
1049 std::vector<am_Source_s> listSources;
1051 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(3);
1053 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID));
1054 source.sourceID=sourceID;
1055 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source1,sourceID));
1056 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source2,sourceID));
1057 source2.sourceID=sourceID;
1058 ASSERT_EQ(E_OK,pDatabaseHandler.getListMainSources(listMainSources));
1059 listSources.push_back(source);
1060 listSources.push_back(source2);
1061 std::vector<am_SourceType_s>::iterator listIterator=listMainSources.begin();
1062 for(;listIterator<listMainSources.end();++listIterator)
1064 equal = equal && pCF.compareSinkMainSource(listIterator,listSources);
1069 TEST_F(databaseTest,getMainSinks)
1071 am_Sink_s sink, sink1,sink2;
1073 pCF.createSink(sink);
1074 pCF.createSink(sink1);
1075 pCF.createSink(sink2);
1079 sink1.visible=false;
1080 std::vector<am_SinkType_s> listMainSinks;
1081 std::vector<am_Sink_s> listSinks;
1083 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(3);
1084 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID));
1086 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink1,sinkID));
1087 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink2,sinkID));
1088 sink2.sinkID=sinkID;
1089 ASSERT_EQ(E_OK,pDatabaseHandler.getListMainSinks(listMainSinks));
1090 listSinks.push_back(sink);
1091 listSinks.push_back(sink2);
1092 std::vector<am_SinkType_s>::iterator listIterator=listMainSinks.begin();
1093 for(;listIterator<listMainSinks.end();++listIterator)
1095 equal = equal && pCF.compareSinkMainSink(listIterator,listSinks);
1100 TEST_F(databaseTest,getVisibleMainConnections)
1102 createMainConnectionSetup();
1103 am_MainConnection_s mainConnection;
1105 pCF.createMainConnection(mainConnection,route);
1106 std::vector<am_MainConnectionType_s> visibleMainConnection;
1107 ASSERT_EQ(E_OK,pDatabaseHandler.getListVisibleMainConnections(visibleMainConnection));
1108 ASSERT_TRUE(1==visibleMainConnection[0].mainConnectionID);
1109 ASSERT_TRUE(mainConnection.connectionState==visibleMainConnection[0].connectionState);
1110 ASSERT_TRUE(mainConnection.delay==visibleMainConnection[0].delay);
1111 ASSERT_TRUE(1==visibleMainConnection[0].sinkID);
1112 ASSERT_TRUE(1==visibleMainConnection[0].sourceID);
1115 TEST_F(databaseTest,getListSourcesOfDomain)
1117 am_Source_s source, source2;
1119 am_domainID_t domainID;
1120 am_sourceID_t sourceID;
1121 std::vector<am_sourceID_t> sourceList,sourceCheckList;
1122 pCF.createSource(source);
1124 source.name="testSource";
1126 pCF.createSource(source2);
1128 source2.name="testSource2";
1130 pCF.createDomain(domain);
1131 sourceCheckList.push_back(1);//sink.sinkID);
1134 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(2);
1135 ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
1136 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID))<< "ERROR: database error";
1137 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source2,sourceID))<< "ERROR: database error";
1138 ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.getListSourcesOfDomain(2,sourceList))<< "ERROR: database error";
1139 ASSERT_TRUE(sourceList.empty());
1140 ASSERT_EQ(E_OK,pDatabaseHandler.getListSourcesOfDomain(1,sourceList))<< "ERROR: database error";
1141 ASSERT_TRUE(std::equal(sourceList.begin(),sourceList.end(),sourceCheckList.begin()) && !sourceList.empty());
1144 TEST_F(databaseTest,getListSinksOfDomain)
1146 am_Sink_s sink, sink2;
1148 am_domainID_t domainID;
1150 std::vector<am_sinkID_t> sinkList,sinkCheckList;
1151 pCF.createSink(sink);
1154 pCF.createSink(sink2);
1157 pCF.createDomain(domain);
1158 sinkCheckList.push_back(1);//sink.sinkID);
1160 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(2);
1161 ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
1162 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID))<< "ERROR: database error";
1163 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink2,sinkID))<< "ERROR: database error";
1164 ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.getListSinksOfDomain(2,sinkList))<< "ERROR: database error";
1165 ASSERT_TRUE(sinkList.empty());
1166 ASSERT_EQ(E_OK,pDatabaseHandler.getListSinksOfDomain(1,sinkList))<< "ERROR: database error";
1167 ASSERT_TRUE(std::equal(sinkList.begin(),sinkList.end(),sinkCheckList.begin()) && !sinkList.empty());
1170 TEST_F(databaseTest,getListGatewaysOfDomain)
1172 am_Gateway_s gateway, gateway2;
1173 am_gatewayID_t gatewayID;
1174 am_domainID_t domainID;
1176 std::vector<am_gatewayID_t> gatewayList,gatewayCheckList;
1177 pCF.createGateway(gateway);
1178 gateway.gatewayID=1;
1179 gateway.name="testGateway";
1180 gateway.controlDomainID=1;
1183 gateway.domainSinkID=1;
1184 gateway.domainSourceID=1;
1185 pCF.createGateway(gateway2);
1186 gateway2.gatewayID=2;
1187 gateway2.name="testGateway2";
1188 gateway2.controlDomainID=4;
1189 gateway2.sourceID=1;
1191 gateway2.domainSinkID=1;
1192 gateway2.domainSourceID=1;
1193 pCF.createDomain(domain);
1194 gatewayCheckList.push_back(gateway.gatewayID);
1195 ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID));
1196 ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway,gatewayID))<< "ERROR: database error";
1197 ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway2,gatewayID))<< "ERROR: database error";
1198 ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.getListGatewaysOfDomain(2,gatewayList))<< "ERROR: database error";
1199 ASSERT_TRUE(gatewayList.empty());
1200 ASSERT_EQ(E_OK,pDatabaseHandler.getListGatewaysOfDomain(1,gatewayList))<< "ERROR: database error";
1201 ASSERT_TRUE(std::equal(gatewayList.begin(),gatewayList.end(),gatewayCheckList.begin()) && !gatewayList.empty());
1204 TEST_F(databaseTest,removeDomain)
1207 am_domainID_t domainID;
1208 std::vector<am_Domain_s> listDomains;
1209 pCF.createDomain(domain);
1210 ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID))<< "ERROR: database error";
1211 ASSERT_EQ(E_OK,pDatabaseHandler.removeDomainDB(domainID))<< "ERROR: database error";
1212 ASSERT_EQ(E_OK,pDatabaseHandler.getListDomains(listDomains))<< "ERROR: database error";
1213 ASSERT_TRUE(listDomains.empty());
1216 TEST_F(databaseTest,removeGateway)
1218 am_Gateway_s gateway;
1219 am_gatewayID_t gatewayID;
1220 std::vector<am_Gateway_s> listGateways;
1221 pCF.createGateway(gateway);
1222 ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway,gatewayID))<< "ERROR: database error";
1223 ASSERT_EQ(E_OK,pDatabaseHandler.removeGatewayDB(gatewayID))<< "ERROR: database error";
1224 ASSERT_EQ(E_OK,pDatabaseHandler.getListGateways(listGateways))<< "ERROR: database error";
1225 ASSERT_TRUE(listGateways.empty());
1228 TEST_F(databaseTest,removeSink)
1232 std::vector<am_Sink_s> listSinks;
1233 pCF.createSink(sink);
1234 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(2);
1235 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(sink,sinkID))<< "ERROR: database error";
1236 ASSERT_EQ(E_OK,pDatabaseHandler.removeSinkDB(sinkID))<< "ERROR: database error";
1237 ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(listSinks))<< "ERROR: database error";
1238 ASSERT_TRUE(listSinks.empty());
1241 TEST_F(databaseTest,removeSource)
1243 //fill the connection database
1245 am_sourceID_t sourceID;
1246 std::vector<am_Source_s> listSources;
1247 pCF.createSource(source);
1249 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(2);
1250 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(source,sourceID))<< "ERROR: database error";
1251 ASSERT_EQ(E_OK,pDatabaseHandler.removeSourceDB(sourceID))<< "ERROR: database error";
1252 ASSERT_EQ(E_OK,pDatabaseHandler.getListSources(listSources))<< "ERROR: database error";
1253 ASSERT_TRUE(listSources.empty());
1256 TEST_F(databaseTest, removeMainConnection)
1258 createMainConnectionSetup();
1259 EXPECT_CALL(pMockInterface,cbNumberOfMainConnectionsChanged()).Times(1);
1260 EXPECT_CALL(pMockInterface,cbMainConnectionStateChanged(_,_)).Times(1);
1261 ASSERT_EQ(E_OK,pDatabaseHandler.removeMainConnectionDB(1))<< "ERROR: database error";
1264 TEST_F(databaseTest,removeNonexistentMainConnectionFail)
1266 ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeMainConnectionDB(34))<< "ERROR: database error";
1269 TEST_F(databaseTest,removeNonexistentSource)
1271 ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeSourceDB(3))<< "ERROR: database error";
1274 TEST_F(databaseTest,removeNonexistentSink)
1276 ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeSinkDB(2))<< "ERROR: database error";
1279 TEST_F(databaseTest,removeNonexistentGateway)
1281 ASSERT_EQ(E_NON_EXISTENT,pDatabaseHandler.removeGatewayDB(12))<< "ERROR: database error";
1284 TEST_F(databaseTest,registerGatewayCorrect)
1286 //initialize gateway
1287 std::vector<am_Gateway_s> returnList;
1288 am_Gateway_s gateway, gateway1, gateway2;
1289 am_gatewayID_t gatewayID=0,gatewayID1=0,gatewayID2=0;
1291 pCF.createGateway(gateway);
1292 pCF.createGateway(gateway1);
1293 gateway1.gatewayID=20;
1294 pCF.createGateway(gateway2);
1296 ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway,gatewayID))<< "ERROR: database error";
1297 ASSERT_EQ(100,gatewayID)<< "ERROR: domainID zero";
1299 ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway1,gatewayID1))<< "ERROR: database error";
1300 ASSERT_EQ(gateway1.gatewayID,gatewayID1)<< "ERROR: domainID zero";
1302 ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway2,gatewayID2))<< "ERROR: database error";
1303 ASSERT_EQ(101,gatewayID2)<< "ERROR: domainID zero";
1305 //now check if we read out the correct values
1306 ASSERT_EQ(E_OK,pDatabaseHandler.getListGateways(returnList));
1308 std::vector<am_Gateway_s>::iterator listIterator=returnList.begin();
1310 for(;listIterator<returnList.end();++listIterator)
1312 if(listIterator->gatewayID==gatewayID)
1314 equal= equal && pCF.compareGateway(listIterator,gateway);
1317 if(listIterator->gatewayID==gatewayID1)
1319 equal= equal && pCF.compareGateway(listIterator,gateway1);
1322 if(listIterator->gatewayID==gatewayID2)
1324 equal= equal && pCF.compareGateway(listIterator,gateway2);
1328 ASSERT_EQ(true,equal);
1331 TEST_F(databaseTest,getGatewayInfo)
1333 //initialize gateway
1334 std::vector<am_Gateway_s> returnList;
1335 am_Gateway_s gateway, gateway1, gateway2;
1336 am_gatewayID_t gatewayID=0,gatewayID1=0,gatewayID2=0;
1338 pCF.createGateway(gateway);
1339 pCF.createGateway(gateway1);
1340 gateway1.gatewayID=20;
1341 pCF.createGateway(gateway2);
1343 ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway,gatewayID))<< "ERROR: database error";
1344 ASSERT_EQ(100,gatewayID)<< "ERROR: domainID zero";
1346 ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway1,gatewayID1))<< "ERROR: database error";
1347 ASSERT_EQ(gateway1.gatewayID,gatewayID1)<< "ERROR: domainID zero";
1349 ASSERT_EQ(E_OK,pDatabaseHandler.enterGatewayDB(gateway2,gatewayID2))<< "ERROR: database error";
1350 ASSERT_EQ(101,gatewayID2)<< "ERROR: domainID zero";
1352 //now check if we read out the correct values
1353 ASSERT_EQ(E_OK,pDatabaseHandler.getListGateways(returnList));
1355 std::vector<am_Gateway_s>::iterator listIterator=returnList.begin();
1357 for(;listIterator<returnList.end();++listIterator)
1359 if(listIterator->gatewayID==gatewayID)
1361 equal= equal && pCF.compareGateway(listIterator,gateway);
1364 if(listIterator->gatewayID==gatewayID1)
1366 equal= equal && pCF.compareGateway(listIterator,gateway1);
1369 if(listIterator->gatewayID==gatewayID2)
1371 equal= equal && pCF.compareGateway(listIterator,gateway2);
1375 ASSERT_EQ(true,equal);
1377 am_Gateway_s gatewayInfo;
1378 ASSERT_EQ(E_OK,pDatabaseHandler.getGatewayInfoDB(20,gatewayInfo));
1379 ASSERT_TRUE(pCF.compareGateway1(gateway1,gatewayInfo));
1383 TEST_F(databaseTest,enterSinkThatAlreadyExistFail)
1385 //fill the connection database
1386 am_Sink_s staticSink,SecondSink;
1387 am_sinkID_t staticSinkID,SecondSinkID;
1389 pCF.createSink(staticSink);
1390 staticSink.sinkID=43;
1391 staticSink.name="Static";
1393 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
1394 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(staticSink,staticSinkID))<< "ERROR: database error";
1395 ASSERT_EQ(staticSink.sinkID,staticSinkID)<< "ERROR: ID not the one given in staticSink";
1397 pCF.createSink(SecondSink);
1398 SecondSink.sinkID=43;
1399 SecondSink.name="SecondSink";
1401 ASSERT_EQ(E_ALREADY_EXISTS,pDatabaseHandler.enterSinkDB(SecondSink,SecondSinkID))<< "ERROR: database error";
1404 TEST_F(databaseTest,enterSourcesThatAlreadyExistFail)
1406 //fill the connection database
1407 am_Source_s staticSource,SecondSource;
1408 am_sourceID_t staticSourceID,SecondSourceID;
1409 pCF.createSource(staticSource);
1410 staticSource.sourceID=4;
1412 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
1413 ASSERT_EQ(E_OK,pDatabaseHandler.enterSourceDB(staticSource,staticSourceID))<< "ERROR: database error";
1414 ASSERT_EQ(staticSource.sourceID,staticSourceID)<< "ERROR: ID not the one given in staticSource";
1416 pCF.createSource(SecondSource);
1417 SecondSource.sourceID=4;
1419 ASSERT_EQ(E_ALREADY_EXISTS,pDatabaseHandler.enterSourceDB(SecondSource,SecondSourceID))<< "ERROR: database error";
1422 TEST_F(databaseTest,registerDomainCorrect)
1425 std::vector<am_Domain_s> returnList;
1427 am_domainID_t domainID=0;
1428 pCF.createDomain(domain);
1430 ASSERT_EQ(E_OK,pDatabaseHandler.enterDomainDB(domain,domainID))<< "ERROR: database error";
1431 ASSERT_NE(0,domainID)<< "ERROR: domainID zero";
1433 //now check if we read out the correct values
1434 ASSERT_EQ(E_OK,pDatabaseHandler.getListDomains(returnList));
1436 std::vector<am_Domain_s>::iterator listIterator=returnList.begin();
1437 for(;listIterator<returnList.end();++listIterator)
1439 if(listIterator->domainID==domainID) {
1440 equal= equal && (listIterator->name.compare(domain.name)==0)
1441 && (listIterator->busname.compare(domain.busname)==0)
1442 && (listIterator->complete == domain.complete)
1443 && (listIterator->early == domain.early)
1444 && (listIterator->state == domain.state);
1447 ASSERT_EQ(true,equal);
1450 TEST_F(databaseTest,registerConnectionCorrect)
1452 am_Connection_s connection;
1453 am_connectionID_t connectionID;
1454 std::vector<am_Connection_s> returnList;
1455 pCF.createConnection(connection);
1457 ASSERT_EQ(E_OK,pDatabaseHandler.enterConnectionDB(connection,connectionID))<< "ERROR: database error";;
1458 ASSERT_NE(0,connectionID)<< "ERROR: connectionID zero";
1460 //now check if we read out the correct values
1461 ASSERT_EQ(E_OK,pDatabaseHandler.changeConnectionFinal(connectionID));
1462 ASSERT_EQ(E_OK,pDatabaseHandler.getListConnections(returnList));
1464 std::vector<am_Connection_s>::iterator listIterator=returnList.begin();
1465 for(;listIterator<returnList.end();++listIterator)
1467 if(listIterator->connectionID==connectionID) {
1468 equal= (listIterator->sourceID == connection.sourceID)
1469 && (listIterator->sinkID == connection.sinkID)
1470 && (listIterator->delay == connection.delay)
1471 && (listIterator->connectionFormat = connection.connectionFormat);
1474 ASSERT_EQ(true,equal);
1477 TEST_F(databaseTest,enterMainConnectionCorrect)
1479 createMainConnectionSetup();
1482 TEST_F(databaseTest,enterSinksCorrect)
1484 //fill the connection database
1485 am_Sink_s staticSink,firstDynamicSink,secondDynamicSink;
1486 am_sinkID_t staticSinkID,firstDynamicSinkID,secondDynamicSinkID;
1487 std::vector<am_Sink_s> sinkList;
1489 pCF.createSink(staticSink);
1490 staticSink.sinkID=4;
1492 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(3);
1493 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(staticSink,staticSinkID))<< "ERROR: database error";
1494 ASSERT_EQ(staticSink.sinkID,staticSinkID)<< "ERROR: ID not the one given in staticSink";
1496 pCF.createSink(firstDynamicSink);
1497 firstDynamicSink.name="firstdynamic";
1498 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(firstDynamicSink,firstDynamicSinkID))<< "ERROR: database error";
1499 ASSERT_EQ(firstDynamicSinkID,DYNAMIC_ID_BOUNDARY)<< "ERROR: ID not the one given in firstDynamicSink";
1501 pCF.createSink(secondDynamicSink);
1502 secondDynamicSink.name="seconddynamic";
1504 ASSERT_EQ(E_OK,pDatabaseHandler.enterSinkDB(secondDynamicSink,secondDynamicSinkID))<< "ERROR: database error";
1505 ASSERT_NEAR(secondDynamicSinkID,DYNAMIC_ID_BOUNDARY,10)<< "ERROR: ID not the one given in secondDynamicSink";
1507 //now read back and check the returns agains the given values
1508 ASSERT_EQ(E_OK,pDatabaseHandler.getListSinks(sinkList))<< "ERROR: database error";
1511 std::vector<am_Sink_s>::iterator listIterator=sinkList.begin();
1512 for(;listIterator<sinkList.end();++listIterator)
1514 if(listIterator->sinkID==staticSinkID)
1516 equal = equal && pCF.compareSink(listIterator,staticSink);
1519 if(listIterator->sinkID==firstDynamicSinkID)
1521 equal = equal && pCF.compareSink(listIterator,firstDynamicSink);
1524 if(listIterator->sinkID==secondDynamicSinkID)
1526 equal = equal && pCF.compareSink(listIterator,secondDynamicSink);
1529 ASSERT_EQ(true,equal);
1532 //Commented out - gives always a warning..
1533 //TEST_F(databaseTest,registerDomainFailonID0)
1535 // am_Domain_s domain;
1536 // am_domainID_t domainID=5;
1537 // pCF.createDomain(domain);
1538 // domain.domainID=1;
1539 // ASSERT_DEATH(pDatabaseHandler.enterDomainDB(domain,domainID),"Assertion `domainData.domainID==0'");
1543 int main(int argc, char **argv)
1545 ::testing::InitGoogleTest(&argc, argv);
1546 return RUN_ALL_TESTS();