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 "routingTest.h"
27 #include "MockInterfaces.h"
28 #include "DatabaseHandler.h"
29 #include "ControlReceiver.h"
30 #include "ControlSender.h"
31 #include "DatabaseObserver.h"
33 #include "../ControlInterfaceBackdoor.h"
34 #include "../CommandInterfaceBackdoor.h"
35 #include "../CommonFunctions.h"
39 using namespace testing;
41 DLT_DECLARE_CONTEXT(DLT_CONTEXT)
43 routingTest::routingTest() :
44 plistRoutingPluginDirs(), //
45 plistCommandPluginDirs(), //
46 pDatabaseHandler(std::string(":memory:")), //
47 pControlSender(std::string("")), //
48 pRouter(&pDatabaseHandler,&pControlSender), //
49 pRoutingSender(plistRoutingPluginDirs), //
50 pCommandSender(plistCommandPluginDirs), //
52 pMockControlInterface(), //
53 pRoutingInterfaceBackdoor(), //
54 pCommandInterfaceBackdoor(), //
55 pControlInterfaceBackdoor(), //
56 pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender, &pRouter), //
57 pObserver(&pCommandSender, &pRoutingSender)
59 pDatabaseHandler.registerObserver(&pObserver);
60 pCommandInterfaceBackdoor.injectInterface(&pCommandSender, &pMockInterface);
61 pControlInterfaceBackdoor.replaceController(&pControlSender, &pMockControlInterface);
64 routingTest::~routingTest()
68 void routingTest::SetUp()
70 DLT_REGISTER_APP("Dtest", "AudioManagerDeamon");
71 DLT_REGISTER_CONTEXT(DLT_CONTEXT, "Main", "Main Context");
72 DLT_LOG(DLT_CONTEXT, DLT_LOG_INFO, DLT_STRING("Database Test started "));
75 void routingTest::TearDown()
77 DLT_UNREGISTER_CONTEXT(DLT_CONTEXT);
80 ACTION(returnConnectionFormat)
85 //test that checks 3 domains, one sink one source but the connectionformat of third domains do not fit.
86 TEST_F(routingTest,simpleRoute3DomainsNoConnection)
88 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(3);
89 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(3);
90 EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(),Return(E_OK)));
92 //initialize 2 domains
93 am_Domain_s domain1, domain2, domain3;
94 am_domainID_t domainID1, domainID2, domainID3;
97 domain1.name = "domain1";
98 domain1.busname = "domain1bus";
99 domain1.state = DS_CONTROLLED;
100 domain2.domainID = 0;
101 domain2.name = "domain2";
102 domain2.busname = "domain2bus";
103 domain2.state = DS_CONTROLLED;
104 domain3.domainID = 0;
105 domain3.name = "domain3";
106 domain3.busname = "domain3bus";
107 domain3.state = DS_CONTROLLED;
109 ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain1,domainID1));
110 ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain2,domainID2));
111 ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain3,domainID3));
113 am_Source_s source, gwSource, gwSource1;
114 am_sourceID_t sourceID, gwSourceID, gwSourceID1;
116 source.domainID = domainID1;
117 source.name = "source1";
118 source.sourceState = SS_ON;
120 source.sourceClassID = 5;
121 source.listConnectionFormats.push_back(CF_MONO);
123 gwSource.domainID = domainID2;
124 gwSource.name = "gwsource1";
125 gwSource.sourceState = SS_ON;
126 gwSource.sourceID = 0;
127 gwSource.sourceClassID = 5;
128 gwSource.listConnectionFormats.push_back(CF_ANALOG);
130 gwSource1.domainID = domainID3;
131 gwSource1.name = "gwsource2";
132 gwSource1.sourceState = SS_ON;
133 gwSource1.sourceID = 0;
134 gwSource1.sourceClassID = 5;
135 gwSource1.listConnectionFormats.push_back(CF_MONO);
137 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
138 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(gwSource,gwSourceID));
139 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(gwSource1,gwSourceID1));
141 am_Sink_s sink, gwSink, gwSink1;
142 am_sinkID_t sinkID, gwSinkID, gwSinkID1;
144 sink.domainID = domainID3;
147 sink.sinkClassID = 5;
148 sink.muteState = MS_MUTED;
149 sink.listConnectionFormats.push_back(CF_STEREO);
151 gwSink.domainID = domainID1;
152 gwSink.name = "gwSink";
154 gwSink.sinkClassID = 5;
155 gwSink.muteState = MS_MUTED;
156 gwSink.listConnectionFormats.push_back(CF_MONO);
158 gwSink1.domainID = domainID2;
159 gwSink1.name = "gwSink1";
161 gwSink1.sinkClassID = 5;
162 gwSink1.muteState = MS_MUTED;
163 gwSink1.listConnectionFormats.push_back(CF_ANALOG);
165 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
166 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(gwSink,gwSinkID));
167 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(gwSink1,gwSinkID1));
169 am_Gateway_s gateway, gateway1;
170 am_gatewayID_t gatewayID, gatewayID1;
172 gateway.controlDomainID = domainID1;
173 gateway.gatewayID = 0;
174 gateway.sinkID = gwSinkID;
175 gateway.sourceID = gwSourceID;
176 gateway.domainSourceID = domainID2;
177 gateway.domainSinkID = domainID1;
178 gateway.listSinkFormats = gwSink.listConnectionFormats;
179 gateway.listSourceFormats = gwSource.listConnectionFormats;
180 gateway.convertionMatrix.push_back(true);
181 gateway.name = "gateway";
183 gateway1.controlDomainID = domainID2;
184 gateway1.gatewayID = 0;
185 gateway1.sinkID = gwSinkID1;
186 gateway1.sourceID = gwSourceID1;
187 gateway1.domainSourceID = domainID3;
188 gateway1.domainSinkID = domainID2;
189 gateway1.listSinkFormats = gwSink1.listConnectionFormats;
190 gateway1.listSourceFormats = gwSource1.listConnectionFormats;
191 gateway1.convertionMatrix.push_back(true);
192 gateway1.name = "gateway";
194 ASSERT_EQ(E_OK, pDatabaseHandler.enterGatewayDB(gateway,gatewayID));
195 ASSERT_EQ(E_OK, pDatabaseHandler.enterGatewayDB(gateway1,gatewayID1));
197 std::vector<am_Route_s> listRoutes;
198 std::vector<am_RoutingElement_s> listRoutingElements;
199 am_RoutingElement_s hopp1;
200 am_RoutingElement_s hopp2;
201 am_RoutingElement_s hopp3;
203 hopp1.sourceID = sourceID;
204 hopp1.sinkID = gwSinkID;
205 hopp1.domainID = domainID1;
206 hopp1.connectionFormat = source.listConnectionFormats[0];
208 hopp2.sourceID = gwSourceID;
209 hopp2.sinkID = gwSinkID1;
210 hopp2.domainID = domainID2;
211 hopp2.connectionFormat = gwSink1.listConnectionFormats[0];
213 hopp3.sourceID = gwSourceID1;
214 hopp3.sinkID = sinkID;
215 hopp3.domainID = domainID3;
216 hopp3.connectionFormat = sink.listConnectionFormats[0];
218 listRoutingElements.push_back(hopp1);
219 listRoutingElements.push_back(hopp2);
220 listRoutingElements.push_back(hopp3);
222 am_Route_s compareRoute;
223 compareRoute.route = listRoutingElements;
224 compareRoute.sinkID = sinkID;
225 compareRoute.sourceID = sourceID;
227 ASSERT_EQ(E_OK, pRouter.getRoute(false,sourceID,sinkID,listRoutes));
228 ASSERT_EQ(0, listRoutes.size());
230 //test that checks just 2 domains, one sink one source with only one connection format each
231 TEST_F(routingTest,simpleRoute2Domains)
233 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(2);
234 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(2);
235 EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(),Return(E_OK)));
237 //initialize 2 domains
238 am_Domain_s domain1, domain2;
239 am_domainID_t domainID1, domainID2;
241 domain1.domainID = 0;
242 domain1.name = "domain1";
243 domain1.busname = "domain1bus";
244 domain1.state = DS_CONTROLLED;
245 domain2.domainID = 0;
246 domain2.name = "domain2";
247 domain2.busname = "domain2bus";
248 domain2.state = DS_CONTROLLED;
250 ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain1,domainID1));
251 ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain2,domainID2));
253 am_Source_s source, gwSource;
254 am_sourceID_t sourceID, gwSourceID;
256 source.domainID = domainID1;
257 source.name = "source1";
258 source.sourceState = SS_ON;
260 source.sourceClassID = 5;
261 source.listConnectionFormats.push_back(CF_ANALOG);
263 gwSource.domainID = domainID2;
264 gwSource.name = "gwsource1";
265 gwSource.sourceState = SS_ON;
266 gwSource.sourceID = 0;
267 gwSource.sourceClassID = 5;
268 gwSource.listConnectionFormats.push_back(CF_MONO);
270 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
271 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(gwSource,gwSourceID));
273 am_Sink_s sink, gwSink;
274 am_sinkID_t sinkID, gwSinkID;
276 sink.domainID = domainID2;
279 sink.sinkClassID = 5;
280 sink.muteState = MS_MUTED;
281 sink.listConnectionFormats.push_back(CF_MONO);
283 gwSink.domainID = domainID1;
284 gwSink.name = "gwSink";
286 gwSink.sinkClassID = 5;
287 gwSink.muteState = MS_MUTED;
288 gwSink.listConnectionFormats.push_back(CF_ANALOG);
290 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
291 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(gwSink,gwSinkID));
293 am_Gateway_s gateway;
294 am_gatewayID_t gatewayID;
296 gateway.controlDomainID = domainID1;
297 gateway.gatewayID = 0;
298 gateway.sinkID = gwSinkID;
299 gateway.sourceID = gwSourceID;
300 gateway.domainSourceID = domainID2;
301 gateway.domainSinkID = domainID1;
302 gateway.listSinkFormats = gwSink.listConnectionFormats;
303 gateway.listSourceFormats = gwSource.listConnectionFormats;
304 gateway.convertionMatrix.push_back(true);
305 gateway.name = "gateway";
307 ASSERT_EQ(E_OK, pDatabaseHandler.enterGatewayDB(gateway,gatewayID));
309 std::vector<am_Route_s> listRoutes;
310 std::vector<am_RoutingElement_s> listRoutingElements;
311 am_RoutingElement_s hopp1;
312 am_RoutingElement_s hopp2;
314 hopp1.sinkID = gwSinkID;
315 hopp1.sourceID = sourceID;
316 hopp1.domainID = domainID1;
317 hopp1.connectionFormat = source.listConnectionFormats[0];
319 hopp2.sinkID = sinkID;
320 hopp2.sourceID = gwSourceID;
321 hopp2.domainID = domainID2;
322 hopp2.connectionFormat = sink.listConnectionFormats[0];
324 listRoutingElements.push_back(hopp1);
325 listRoutingElements.push_back(hopp2);
327 am_Route_s compareRoute;
328 compareRoute.route = listRoutingElements;
329 compareRoute.sinkID = sinkID;
330 compareRoute.sourceID = sourceID;
332 ASSERT_EQ(E_OK, pRouter.getRoute(false,sourceID,sinkID,listRoutes));
333 ASSERT_EQ(1, listRoutes.size());
334 ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
338 //test that checks just 2 domains, one sink one source but the connectionformat of source
339 TEST_F(routingTest,simpleRoute2DomainsNoMatchConnectionFormats)
341 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(2);
342 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(2);
343 EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(),Return(E_OK)));
345 //initialize 2 domains
346 am_Domain_s domain1, domain2;
347 am_domainID_t domainID1, domainID2;
349 domain1.domainID = 0;
350 domain1.name = "domain1";
351 domain1.busname = "domain1bus";
352 domain1.state = DS_CONTROLLED;
353 domain2.domainID = 0;
354 domain2.name = "domain2";
355 domain2.busname = "domain2bus";
356 domain2.state = DS_CONTROLLED;
358 ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain1,domainID1));
359 ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain2,domainID2));
361 am_Source_s source, gwSource;
362 am_sourceID_t sourceID, gwSourceID;
364 source.domainID = domainID1;
365 source.name = "source1";
366 source.sourceState = SS_ON;
368 source.sourceClassID = 5;
369 source.listConnectionFormats.push_back(CF_STEREO);
371 gwSource.domainID = domainID2;
372 gwSource.name = "gwsource1";
373 gwSource.sourceState = SS_ON;
374 gwSource.sourceID = 0;
375 gwSource.sourceClassID = 5;
376 gwSource.listConnectionFormats.push_back(CF_MONO);
378 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
379 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(gwSource,gwSourceID));
381 am_Sink_s sink, gwSink;
382 am_sinkID_t sinkID, gwSinkID;
384 sink.domainID = domainID2;
387 sink.sinkClassID = 5;
388 sink.muteState = MS_MUTED;
389 sink.listConnectionFormats.push_back(CF_MONO);
391 gwSink.domainID = domainID1;
392 gwSink.name = "gwSink";
394 gwSink.sinkClassID = 5;
395 gwSink.muteState = MS_MUTED;
396 gwSink.listConnectionFormats.push_back(CF_ANALOG);
398 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
399 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(gwSink,gwSinkID));
401 am_Gateway_s gateway;
402 am_gatewayID_t gatewayID;
404 gateway.controlDomainID = domainID1;
405 gateway.gatewayID = 0;
406 gateway.sinkID = gwSinkID;
407 gateway.sourceID = gwSourceID;
408 gateway.domainSourceID = domainID2;
409 gateway.domainSinkID = domainID1;
410 gateway.listSinkFormats = gwSink.listConnectionFormats;
411 gateway.listSourceFormats = gwSource.listConnectionFormats;
412 gateway.convertionMatrix.push_back(true);
413 gateway.name = "gateway";
415 ASSERT_EQ(E_OK, pDatabaseHandler.enterGatewayDB(gateway,gatewayID));
417 std::vector<am_Route_s> listRoutes;
418 std::vector<am_RoutingElement_s> listRoutingElements;
419 am_RoutingElement_s hopp1;
420 am_RoutingElement_s hopp2;
422 hopp1.sinkID = gwSinkID;
423 hopp1.sourceID = sourceID;
424 hopp1.domainID = domainID1;
425 hopp1.connectionFormat = source.listConnectionFormats[0];
427 hopp2.sinkID = sinkID;
428 hopp2.sourceID = gwSourceID;
429 hopp2.domainID = domainID2;
430 hopp2.connectionFormat = sink.listConnectionFormats[0];
432 listRoutingElements.push_back(hopp1);
433 listRoutingElements.push_back(hopp2);
435 am_Route_s compareRoute;
436 compareRoute.route = listRoutingElements;
437 compareRoute.sinkID = sinkID;
438 compareRoute.sourceID = sourceID;
440 ASSERT_EQ(E_OK, pRouter.getRoute(false,sourceID,sinkID,listRoutes));
441 ASSERT_EQ(0, listRoutes.size());
444 //test that checks 3 domains, one sink one source.
445 TEST_F(routingTest,simpleRoute3Domains)
447 EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(3);
448 EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(3);
449 EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(),Return(E_OK)));
451 //initialize 2 domains
452 am_Domain_s domain1, domain2, domain3;
453 am_domainID_t domainID1, domainID2, domainID3;
455 domain1.domainID = 0;
456 domain1.name = "domain1";
457 domain1.busname = "domain1bus";
458 domain1.state = DS_CONTROLLED;
459 domain2.domainID = 0;
460 domain2.name = "domain2";
461 domain2.busname = "domain2bus";
462 domain2.state = DS_CONTROLLED;
463 domain3.domainID = 0;
464 domain3.name = "domain3";
465 domain3.busname = "domain3bus";
466 domain3.state = DS_CONTROLLED;
468 ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain1,domainID1));
469 ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain2,domainID2));
470 ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain3,domainID3));
472 am_Source_s source, gwSource, gwSource1;
473 am_sourceID_t sourceID, gwSourceID, gwSourceID1;
475 source.domainID = domainID1;
476 source.name = "source1";
477 source.sourceState = SS_ON;
479 source.sourceClassID = 5;
480 source.listConnectionFormats.push_back(CF_MONO);
482 gwSource.domainID = domainID2;
483 gwSource.name = "gwsource1";
484 gwSource.sourceState = SS_ON;
485 gwSource.sourceID = 0;
486 gwSource.sourceClassID = 5;
487 gwSource.listConnectionFormats.push_back(CF_ANALOG);
489 gwSource1.domainID = domainID3;
490 gwSource1.name = "gwsource2";
491 gwSource1.sourceState = SS_ON;
492 gwSource1.sourceID = 0;
493 gwSource1.sourceClassID = 5;
494 gwSource1.listConnectionFormats.push_back(CF_MONO);
496 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
497 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(gwSource,gwSourceID));
498 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(gwSource1,gwSourceID1));
500 am_Sink_s sink, gwSink, gwSink1;
501 am_sinkID_t sinkID, gwSinkID, gwSinkID1;
503 sink.domainID = domainID3;
506 sink.sinkClassID = 5;
507 sink.muteState = MS_MUTED;
508 sink.listConnectionFormats.push_back(CF_MONO);
510 gwSink.domainID = domainID1;
511 gwSink.name = "gwSink";
513 gwSink.sinkClassID = 5;
514 gwSink.muteState = MS_MUTED;
515 gwSink.listConnectionFormats.push_back(CF_MONO);
517 gwSink1.domainID = domainID2;
518 gwSink1.name = "gwSink1";
520 gwSink1.sinkClassID = 5;
521 gwSink1.muteState = MS_MUTED;
522 gwSink1.listConnectionFormats.push_back(CF_ANALOG);
524 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
525 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(gwSink,gwSinkID));
526 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(gwSink1,gwSinkID1));
528 am_Gateway_s gateway, gateway1;
529 am_gatewayID_t gatewayID, gatewayID1;
531 gateway.controlDomainID = domainID1;
532 gateway.gatewayID = 0;
533 gateway.sinkID = gwSinkID;
534 gateway.sourceID = gwSourceID;
535 gateway.domainSourceID = domainID2;
536 gateway.domainSinkID = domainID1;
537 gateway.listSinkFormats = gwSink.listConnectionFormats;
538 gateway.listSourceFormats = gwSource.listConnectionFormats;
539 gateway.convertionMatrix.push_back(true);
540 gateway.name = "gateway";
542 gateway1.controlDomainID = domainID2;
543 gateway1.gatewayID = 0;
544 gateway1.sinkID = gwSinkID1;
545 gateway1.sourceID = gwSourceID1;
546 gateway1.domainSourceID = domainID3;
547 gateway1.domainSinkID = domainID2;
548 gateway1.listSinkFormats = gwSink1.listConnectionFormats;
549 gateway1.listSourceFormats = gwSource1.listConnectionFormats;
550 gateway1.convertionMatrix.push_back(true);
551 gateway1.name = "gateway";
553 ASSERT_EQ(E_OK, pDatabaseHandler.enterGatewayDB(gateway,gatewayID));
554 ASSERT_EQ(E_OK, pDatabaseHandler.enterGatewayDB(gateway1,gatewayID1));
556 std::vector<am_Route_s> listRoutes;
557 std::vector<am_RoutingElement_s> listRoutingElements;
558 am_RoutingElement_s hopp1;
559 am_RoutingElement_s hopp2;
560 am_RoutingElement_s hopp3;
562 hopp1.sourceID = sourceID;
563 hopp1.sinkID = gwSinkID;
564 hopp1.domainID = domainID1;
565 hopp1.connectionFormat = source.listConnectionFormats[0];
567 hopp2.sourceID = gwSourceID;
568 hopp2.sinkID = gwSinkID1;
569 hopp2.domainID = domainID2;
570 hopp2.connectionFormat = gwSink1.listConnectionFormats[0];
572 hopp3.sourceID = gwSourceID1;
573 hopp3.sinkID = sinkID;
574 hopp3.domainID = domainID3;
575 hopp3.connectionFormat = sink.listConnectionFormats[0];
577 listRoutingElements.push_back(hopp1);
578 listRoutingElements.push_back(hopp2);
579 listRoutingElements.push_back(hopp3);
581 am_Route_s compareRoute;
582 compareRoute.route = listRoutingElements;
583 compareRoute.sinkID = sinkID;
584 compareRoute.sourceID = sourceID;
586 ASSERT_EQ(E_OK, pRouter.getRoute(false,sourceID,sinkID,listRoutes));
587 ASSERT_EQ(1, listRoutes.size());
588 ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
591 int main(int argc, char **argv)
593 ::testing::InitGoogleTest(&argc, argv);
594 return RUN_ALL_TESTS();