tizen 2.3 release
[framework/web/wearable/wrt-security.git] / tests / ace / ace_tests.cpp
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 /*
17  * @file        main.cpp
18  * @author      Bartlomiej Grzelewski <b.grzelewski@samsung.com>
19  * @version     1.0
20  * @brief       This file is the implementation file of main
21  */
22 #include <string>
23
24 #include <dpl/test/test_runner.h>
25 #include <dpl/log/log.h>
26
27 #include <loop_control.h>
28
29 #include <ace-dao-rw/AceDAO.h>
30
31 #include "Interfaces.h"
32 #include "PEPSingleton.h"
33
34 using namespace LoopControl;
35
36 class UnitTestThread
37 {
38 public:
39     UnitTestThread()
40     {
41         // Attach databases
42         AceDB::AceDAO::attachToThreadRW();
43     }
44
45     ~UnitTestThread()
46     {
47         // Detach databases
48         AceDB::AceDAO::detachFromThread();
49     }
50 };
51
52 int main (int argc, char *argv[])
53 {
54     init_loop(argc, argv);
55
56     LogInfo("Initializing PEPSingleton.");
57
58     UnitTestThread attacher;
59
60     PEPSingleton::Instance().initialize(
61         new WebRuntimeImp(),
62         new ResourceInformationImp(),
63         new OperationSystemImp());
64
65     LogInfo("Starting tests.");
66
67     int status = DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv);
68
69     PEPSingleton::Instance().terminate();
70
71     quit_loop();
72     return status;
73 }
74