|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @SYMTestSuiteName SYSLIB-CENTRALREPOSITORY-TE_CENTREP_BURSUITE |
|
19 @SYMScriptTestEnvironment this script requires Techview ROM for BURTestserver dependency. BURTestserver must be built for this test to run. |
|
20 */ |
|
21 #include "initialiseStep.h" |
|
22 #include "Te_centrep_BURSuiteDefs.h" |
|
23 |
|
24 CinitialiseStep::~CinitialiseStep() |
|
25 /** |
|
26 * Destructor |
|
27 */ |
|
28 { |
|
29 } |
|
30 |
|
31 CinitialiseStep::CinitialiseStep() |
|
32 /** |
|
33 * Constructor |
|
34 */ |
|
35 { |
|
36 // **MUST** call SetTestStepName in the constructor as the controlling |
|
37 // framework uses the test step name immediately following construction to set |
|
38 // up the step's unique logging ID. |
|
39 SetTestStepName(KinitialiseStep); |
|
40 } |
|
41 |
|
42 /* |
|
43 @SYMTestCaseID SYSLIB-CENTRALREPOSITORY-CIT-0131 |
|
44 @SYMTestCaseDesc Test Backup & Restore functionality, when repository unchanged |
|
45 @SYMTestPriority High |
|
46 @SYMTestActions Create repository, backup, restore, check values |
|
47 @SYMTestExpectedResults The test must not fail |
|
48 @SYMPREQ 752 Uniform settings access for remote provision and settings sharing |
|
49 @SYMPREQ 908 System file corruption recoverability |
|
50 */ |
|
51 |
|
52 /* |
|
53 @SYMTestCaseID SYSLIB-CENTRALREPOSITORY-CIT-0132 |
|
54 @SYMTestCaseDesc Test Backup & Restore functionality, when repository corrupt |
|
55 @SYMTestPriority High |
|
56 @SYMTestActions Create repository, backup, corrupt, restore, check values |
|
57 @SYMTestExpectedResults The test must not fail |
|
58 @SYMPREQ 752 Uniform settings access for remote provision and settings sharing |
|
59 @SYMPREQ 908 System file corruption recoverability |
|
60 */ |
|
61 |
|
62 /* |
|
63 @SYMTestCaseID SYSLIB-CENTRALREPOSITORY-CIT-0133 |
|
64 @SYMTestCaseDesc Test Backup & Restore functionality, when repository modified |
|
65 @SYMTestPriority High |
|
66 @SYMTestActions Create repository, backup, modify, restore, check values |
|
67 @SYMTestExpectedResults The test must not fail |
|
68 @SYMPREQ 752 Uniform settings access for remote provision and settings sharing |
|
69 @SYMPREQ 908 System file corruption recoverability |
|
70 */ |
|
71 |
|
72 /* |
|
73 @SYMTestCaseID SYSLIB-CENTRALREPOSITORY-CIT-0134 |
|
74 @SYMTestCaseDesc Test Backup & Restore functionality, when repository deleted |
|
75 @SYMTestPriority High |
|
76 @SYMTestActions Create repository, backup, delete, restore, check values |
|
77 @SYMTestExpectedResults The test must not fail |
|
78 @SYMPREQ 752 Uniform settings access for remote provision and settings sharing |
|
79 @SYMPREQ 908 System file corruption recoverability |
|
80 */ |
|
81 |
|
82 /* |
|
83 @SYMTestCaseID SYSLIB-CENTRALREPOSITORY-CIT-3415 |
|
84 @SYMTestCaseDesc Restoration Notification Test |
|
85 @SYMTestPriority High |
|
86 @SYMTestActions This test checks that the restoration sends notifications about |
|
87 the changed repositories and keys. The test process is: |
|
88 1. Create repositories. |
|
89 2. Backup repositories. |
|
90 3. Modify repositories. |
|
91 4. Request notifications |
|
92 5. Restore repositories. |
|
93 6. Wait for the notifications and check the result of the restore. |
|
94 Step 4 and step 6 must be run in the same thread for the receiving of notifications. |
|
95 @SYMTestExpectedResults The notification requesting test step should be notified about |
|
96 the changes by the restoration and get the new values of changed keys successfully. |
|
97 @SYMDEF INC101923 cenrep notifier does not fire when restoring from backup |
|
98 */ |
|
99 |
|
100 TVerdict CinitialiseStep::doTestStepL() |
|
101 /** |
|
102 * @return - TVerdict code |
|
103 * Override of base class pure virtual |
|
104 * Our implementation only gets called if the base class doTestStepPreambleL() did |
|
105 * not leave. That being the case, the current test result value will be EPass. |
|
106 */ |
|
107 { |
|
108 SetTestStepResult(EFail); |
|
109 |
|
110 // Existance of caching functionality makes all test steps fail because file delete operations |
|
111 // outside of CenRep's knowledge assumes non-caching behaviour. |
|
112 // We wait until the cache is empty here to correct the behaviour. |
|
113 User::After(KDefaultEvictionTimeout+950000); |
|
114 |
|
115 CRepository* repository; |
|
116 User::LeaveIfNull(repository = CRepository::NewLC(KUidBURTestRepository)); |
|
117 |
|
118 TInt r; |
|
119 |
|
120 // Create values to be backed up |
|
121 |
|
122 r = repository->Create(KNewBackupInt1, KIntBackupValue1); |
|
123 TESTL(r==KErrNone); |
|
124 r = repository->Create(KNewBackupInt2, KIntBackupValue2); |
|
125 TESTL(r==KErrNone); |
|
126 r = repository->Create(KNewBackupInt3, KIntBackupValue3); |
|
127 TESTL(r==KErrNone); |
|
128 r = repository->Create(KNewBackupInt4, KIntBackupValue4); |
|
129 TESTL(r==KErrNone); |
|
130 r = repository->Create(KNewBackupReal1, KRealBackupValue1); |
|
131 TESTL(r==KErrNone); |
|
132 r = repository->Create(KNewBackupReal2, KRealBackupValue2); |
|
133 TESTL(r==KErrNone); |
|
134 r = repository->Create(KNewBackupReal3, KRealBackupValue3); |
|
135 TESTL(r==KErrNone); |
|
136 r = repository->Create(KNewBackupReal4, KRealBackupValue4); |
|
137 TESTL(r==KErrNone); |
|
138 r = repository->Create(KNewBackupString81, KString8BackupValue1); |
|
139 TESTL(r==KErrNone); |
|
140 r = repository->Create(KNewBackupString82, KString8BackupValue2); |
|
141 TESTL(r==KErrNone); |
|
142 r = repository->Create(KNewBackupString83, KString8BackupValue3); |
|
143 TESTL(r==KErrNone); |
|
144 r = repository->Create(KNewBackupString84, KString8BackupValue4); |
|
145 TESTL(r==KErrNone); |
|
146 r = repository->Create(KNewBackupString161, KString16BackupValue1); |
|
147 TESTL(r==KErrNone); |
|
148 r = repository->Create(KNewBackupString162, KString16BackupValue2); |
|
149 TESTL(r==KErrNone); |
|
150 r = repository->Create(KNewBackupString163, KString16BackupValue3); |
|
151 TESTL(r==KErrNone); |
|
152 r = repository->Create(KNewBackupString164, KString16BackupValue4); |
|
153 TESTL(r==KErrNone); |
|
154 |
|
155 // Create values not to be backed up |
|
156 |
|
157 r = repository->Create(KNewInt1, KIntValue1); |
|
158 TESTL(r==KErrNone); |
|
159 r = repository->Create(KNewInt2, KIntValue2); |
|
160 TESTL(r==KErrNone); |
|
161 r = repository->Create(KNewInt3, KIntValue3); |
|
162 TESTL(r==KErrNone); |
|
163 r = repository->Create(KNewInt4, KIntValue4); |
|
164 TESTL(r==KErrNone); |
|
165 r = repository->Create(KNewReal1, KRealValue1); |
|
166 TESTL(r==KErrNone); |
|
167 r = repository->Create(KNewReal2, KRealValue2); |
|
168 TESTL(r==KErrNone); |
|
169 r = repository->Create(KNewReal3, KRealValue3); |
|
170 TESTL(r==KErrNone); |
|
171 r = repository->Create(KNewReal4, KRealValue4); |
|
172 TESTL(r==KErrNone); |
|
173 r = repository->Create(KNewString81, KString8Value1); |
|
174 TESTL(r==KErrNone); |
|
175 r = repository->Create(KNewString82, KString8Value2); |
|
176 TESTL(r==KErrNone); |
|
177 r = repository->Create(KNewString83, KString8Value3); |
|
178 TESTL(r==KErrNone); |
|
179 r = repository->Create(KNewString84, KString8Value4); |
|
180 TESTL(r==KErrNone); |
|
181 r = repository->Create(KNewString161, KString16Value1); |
|
182 TESTL(r==KErrNone); |
|
183 r = repository->Create(KNewString162, KString16Value2); |
|
184 TESTL(r==KErrNone); |
|
185 r = repository->Create(KNewString163, KString16Value3); |
|
186 TESTL(r==KErrNone); |
|
187 r = repository->Create(KNewString164, KString16Value4); |
|
188 TESTL(r==KErrNone); |
|
189 |
|
190 // Delete key not marked for backup |
|
191 r = repository->Delete(KNoBackupDeleteTestInt); |
|
192 TESTL(r==KErrNone); |
|
193 |
|
194 // Delete key marked for backup |
|
195 r = repository->Delete(KBackupDeleteTestInt) ; |
|
196 TESTL(r==KErrNone); |
|
197 |
|
198 // Check that keys deleted in initialise step have really gone. |
|
199 TInt value ; |
|
200 r=repository->Get(KNoBackupDeleteTestInt, value); |
|
201 TESTL(r==KErrNotFound) ; |
|
202 |
|
203 r=repository->Get(KBackupDeleteTestInt, value); |
|
204 TESTL(r==KErrNotFound) ; |
|
205 |
|
206 CleanupStack::PopAndDestroy(repository); |
|
207 |
|
208 SetTestStepResult(EPass); |
|
209 |
|
210 return TestStepResult(); |
|
211 } |
|
212 |