af8ac96e7af2d63a45f7c4fa3fdda0b3d5986229
[platform/core/test/security-tests.git] / src / cynara-tests / common / cynara_test_commons.h
1 /*
2  * Copyright (c) 2014-2015 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 /*
18  * @file        cynara_test_commons.h
19  * @author      Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
20  * @version     1.0
21  * @brief       Definition of environment wrap for test cases
22  */
23
24 #ifndef CYNARA_TEST_COMMONS_H_
25 #define CYNARA_TEST_COMMONS_H_
26
27 #include <functional>
28 #include <string>
29 #include <vector>
30
31 namespace CynaraTestConsts
32 {
33
34 extern const std::string DB_DIR;
35 extern const std::string USER;
36 extern const std::string LABEL;
37 extern const std::string SERVICE;
38 extern const std::string SERVICE_PLUGINS_DIR;
39 extern const std::string SOCKET_CLIENT;
40 extern const std::string SOCKET_ADMIN;
41 extern const std::string SOCKET_AGENT;
42
43 }
44
45 struct CheckKey
46 {
47     const char *m_client;
48     const char *m_user;
49     const char *m_privilege;
50 };
51
52 void environmentWrap(const char *testName, const std::function<void(void)> &func);
53
54 #define RUN_CYNARA_TEST(Proc)                \
55     RUNNER_TEST(Proc)                        \
56     {                                        \
57         environmentWrap(#Proc, Proc##_func); \
58     }
59
60 typedef std::vector<std::string> DirectoryPaths;
61 void loadServicePlugins(const DirectoryPaths &pluginDirectories);
62
63 void restartCynaraService();
64 void restartCynaraServiceAndSockets();
65
66 #endif /* CYNARA_TEST_COMMONS_H_ */