summaryrefslogtreecommitdiff
path: root/test/pers_svc_test/inc/test_PAS.h
blob: 8b50cca017e2bbc6980e8c0367788f4ba46720fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/*********************************************************************************************************************
*
* Copyright (C) 2012 Continental Automotive Systems, Inc.
*
* Author: Ionut.Ieremie@continental-corporation.com
*
* Implementation of backup process
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Date       Author             Reason
* 2013.04.15 uidu0250 			CSP_WZ#3424:  Add IF extension for "restore to default"
* 2012.11.29 uidv2833           CSP_WZ#1280:  Adapted implementation for the new test framework
* 2012.11.28 uidl9757           CSP_WZ#1280:  Initial version
*
**********************************************************************************************************************/

#ifndef SSW_TEST_PAS_H
#define SSW_TEST_PAS_H


#ifdef __cplusplus
extern "C"
{
#endif  /* #ifdef __cplusplus */

#include "persComTypes.h"
#include "persComRct.h"
#include "persComDataOrg.h"

/* needed because of change in PCL (should be removed later) */
#define TST_DEFAULT_CONTEXT {0xFF, 0xFF, 0xFF}
#define PERSISTENCE_ADMIN_TF_BUS_TYPE						1 	//G_BUS_TYPE_SYSTEM (see gioenums.h)
#define PERSISTENCE_ADMIN_TF_BUS_NAME						"org.genivi.persistence.admintestframework"
#define PERSISTENCE_ADMIN_TF_OBJ_PATH						"/org/genivi/persistence/admintestframework"
#define PERSISTENCE_ADMIN_TF_IFACE							"org.genivi.persistence.admintestframework"

#define MAX_PATH_SIZE                   ( 256 )
#define MAX_APPLICATION_NAME_SIZE       (  64 )

/* backup */
#define NO_BACKUP                       ""
#define BACKUP_NAME                     "/tmp/backup"

#define	BACKUP_FOLDER					"/tmp/backups"
#define BACKUP_FOLDER_					BACKUP_FOLDER "/"
#define BACKUP_CONTENT_FOLDER			BACKUP_FOLDER PERS_ORG_ROOT_PATH
#define BACKUP_FORMAT      				(".arch.tar.gz")

/* application */
#define NO_APPLICATION                  ""
#define APPLICATION_NAME                "App1"

/* user */
//#define USER_DONT_CARE                  0xFF
//#define SEAT_DONT_CARE                  0xFF

typedef struct
{
    pstr_t resourceID ;
    bool_t bIsKey ; 
    PersistenceConfigurationKey_s sRctEntry ;
}entryRctInit_s ;

typedef struct
{
    str_t LDBID;
    pstr_t resourceID ;
    PersistencePolicy_e policy ;
    str_t userID ;
    str_t seatID ;
    pstr_t data ;
}entryDataInit_s ;

typedef struct
{
    pstr_t  pResourceID ;
    pstr_t  data ;
}defaultDataInit_s ;

typedef enum
{
    dbType_local = 0,
    dbType_RCT
}dbType_e ;

typedef struct
{
    pstr_t                  installFolderPath ;
    pstr_t                  RCT_pathname ;
    dbType_e                RctDBtype ;
    pstr_t                  wtDBpathname ;
    dbType_e                wtDBtype ;
    pstr_t                  wcDBpathname ;
    dbType_e                wcDBtype ;
    entryRctInit_s*         RctInitTab ;
    sint_t                  noEntriesRctInitTab ;
    entryDataInit_s*        dataKeysInitTab ;
    sint_t                  noEntriesDataKeysInitTab ;
    entryDataInit_s*        dataFilesInitTab ;
    sint_t                  noEntriesDataFilesInitTab ;

    pstr_t                  factoryDefaultDBpathname ;
    defaultDataInit_s*      factoryDefaultInitTab ;
    sint_t                  noEntriesFactoryDefaultInitTab ;
    pstr_t                  configurableDefaultDBpathname ;
    defaultDataInit_s*      configurableDefaultInitTab ;
    sint_t                  noEntriesConfigurableDefaultInitTab ;
}dataInit_s ;

/**********************************************************************************************************************************************
 ***************************************** Structures used for test cases ********************************************************************
 *********************************************************************************************************************************************/
typedef struct
{
    pstr_t              key ;               /* contains the complete name (with node, user,... prefix) */
    pstr_t              dbPath ;            /* abs path to DB */  
    bool_t              bExpectedToExist;   /* if true, the key is expected to be found in the indicated DB */
    pstr_t              expectedData ;
    sint_t              expectedDataSize ;
}expected_key_data_localDB_s ;

typedef struct
{
    pstr_t                          key ;               /* contains the complete name (with node, user,... prefix) */
    pstr_t                          dbPath ;            /* abs path to DB */  
    bool_t                          bExpectedToExist;   /* if true, the key is expected to be found in the indicated DB */
    PersistenceConfigurationKey_s   sExpectedConfig ;
}expected_key_data_RCT_s ;

typedef struct
{
    pstr_t              filename ;          /* contains the complete name (with node, user,... prefix) */
    bool_t              bExpectedToExist;   /* if true, the key is expected to be found in the indicated DB */
    pstr_t              expectedData ;
    sint_t              expectedDataSize ;
}expected_file_data_s ;

/* test case prototype */
typedef bool_t (*pfTestCase) (sint_t, void*) ;

typedef struct
{
    pfTestCase                      TestCaseFunction ;
    sint_t                          iParam ;
    void*                           pvoidParam ;
    pstr_t                          testCaseDescription ;
    expected_key_data_RCT_s*        pExpectedKeyDataRCT ;
    sint_t                          noItemsInExpectedKeyDataRCT ;
    expected_key_data_localDB_s*    pExpectedKeyDataLocalDB ;
    sint_t                          noItemsInExpectedKeyDataLocalDB ;
    expected_file_data_s*           pExpectedFileData ;
    sint_t                          noItemsInExpectedFileData ;
    bool_t                          bSkipDataReset ;
}testcase_s ;

bool_t InitDataFolder(dataInit_s* psDataInit) ;
sint_t DeleteFolderContent(pstr_t folderPath);
sint_t DeleteFolder(pstr_t folderPath);
sint_t CheckIfFileExists(pstr_t pathname, bool_t bIsFolder);
bool_t ExecuteTestCases(sint_t		*pNoOfTestCases,
						sint_t		*pNoOfTestCasesSuccessful,
						sint_t		*pNoOfTestCasesFailed );

#ifdef __cplusplus
}
#endif /* extern "C" { */

#endif /*SSW_TEST_PAS_H */