|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 // This contains CTestCaseCommDb which is the base class for all |
|
18 // the CommDb suite test cases |
|
19 |
|
20 #if (!defined __COMMDBTESTSTEP_H__) |
|
21 #define __COMMDBTESTSTEP_H__ |
|
22 |
|
23 #include "TE_commdbServer.h" |
|
24 |
|
25 _LIT(KCommDbName, "C:\\private\\100012a5\\DBS_10004e1d_CDBV3.DAT"); |
|
26 |
|
27 |
|
28 class CTestSuite; |
|
29 class CTestSuiteCommDb; |
|
30 class CCommsDatabase; |
|
31 class CCommsDbTableView; |
|
32 class CCommsDbProtectTableView; |
|
33 class CCommsDbProtectConnectPrefTableView; |
|
34 |
|
35 NONSHARABLE_CLASS(CTestStepCommDb) : public CTestStep |
|
36 { |
|
37 public: |
|
38 CTestStepCommDb(); |
|
39 ~CTestStepCommDb(); |
|
40 |
|
41 // pointer to suite which owns this test |
|
42 CTestSuiteCommDb * iCommDbSuite; |
|
43 |
|
44 //Functions to set and clear the database objects that will |
|
45 //be used by test steps derived from this class. |
|
46 //This prevents the test steps from creating their own database objects |
|
47 void setRemoteDatabaseObjects( CCommsDatabase* aDb, CCommsDbTableView* aDbView ); |
|
48 void clearRemoteDatabaseObjects(); |
|
49 |
|
50 TInt executeStep( CTestStepCommDb& aTestStep ); |
|
51 TInt executeStep( ); |
|
52 virtual TInt executeStepL(); |
|
53 TVerdict doTestStepPostambleL(); |
|
54 TInt doTestStepWithHeapFailureL( CTestStepCommDb& aTestStep, TInt aReturnValue ); |
|
55 TInt doTestStepWithHeapFailureDb( CTestStepCommDb& aTestStep, TInt aReturnValue ); |
|
56 |
|
57 enum TDatabaseNumber |
|
58 { |
|
59 EDatabase_1, //Records in ISP tables only |
|
60 EDatabase_7 //No records |
|
61 }; |
|
62 TInt copyTestDatabase( TDatabaseNumber aDbNumber ); |
|
63 TInt copyDatabaseToDefault( TDatabaseNumber aDbNumber ); |
|
64 void copyFileL (const TDesC& anOld,const TDesC& aNew); |
|
65 void deleteFileL (const TDesC& aFileName); |
|
66 |
|
67 void DeleteCurrentDatabaseL(); |
|
68 void CopyDatabaseL(const TDesC& aSource); |
|
69 |
|
70 |
|
71 //Pointers to the current database objects |
|
72 CCommsDatabase* iTheDb; |
|
73 CCommsDbTableView* iTheView; |
|
74 |
|
75 |
|
76 protected: |
|
77 //Set by derived steps when local database objects have been allocated |
|
78 TBool iLocalObjects; |
|
79 |
|
80 //Opens a database object and assigns it to iTheDb |
|
81 TBool openDbL(); |
|
82 //Opens a database and a table view, assigns them to iTheDb and iTheView |
|
83 TBool openDbAndViewL( const TDesC16& aTable ); |
|
84 //Releases any objects assigned to iTheDb and iTheView |
|
85 void popAndDestroyDatabaseObjects(); |
|
86 |
|
87 TInt ChangeCPRankingL(CCommsDbProtectConnectPrefTableView* aTable, TUint32& Ranking); |
|
88 //Functions needed for Protection tests |
|
89 void CheckTableIsProtectedL(CCommsDbProtectTableView* aTable); |
|
90 void CheckTableIsNotProtectedL(CCommsDbProtectTableView* aTable); |
|
91 void GoToPositionL(CCommsDbProtectTableView* aTable,TInt aPos); |
|
92 |
|
93 void UpdateRecordL (CCommsDbProtectTableView* aTable,TInt aResult); |
|
94 void DeleteRecordL (CCommsDbProtectTableView* aTable,TInt aResult); |
|
95 void InsertRecordL (CCommsDbProtectTableView* aTable,TInt aResult); |
|
96 void ModifyRecordL (CCommsDbProtectTableView* aTable); |
|
97 void PopulateInsertedRecordL(CCommsDbProtectTableView* aTable); |
|
98 |
|
99 void CheckTableIsProtectedL(CCommsDbProtectConnectPrefTableView* aTable); |
|
100 void CheckTableIsNotProtectedL(CCommsDbProtectConnectPrefTableView* aTable); |
|
101 void GoToPositionL(CCommsDbProtectConnectPrefTableView* aTable,TInt aPos); |
|
102 |
|
103 void UpdateRecordL (CCommsDbProtectConnectPrefTableView* aTable,TInt aResult); |
|
104 void DeleteRecordL (CCommsDbProtectConnectPrefTableView* aTable,TInt aResult); |
|
105 void InsertRecordL (CCommsDbProtectConnectPrefTableView* aTable,TInt aResult); |
|
106 void ModifyRecordL (CCommsDbProtectConnectPrefTableView* aTable); |
|
107 void PopulateInsertedRecordL(CCommsDbProtectConnectPrefTableView* aTable); |
|
108 |
|
109 void CheckRecordAccessL(CCommsDbProtectConnectPrefTableView* aTable, TInt aExpectedAccess); |
|
110 |
|
111 void ProtectRecordL (CCommsDbProtectTableView* aTable,TInt aResult); |
|
112 void UnprotectRecordL(CCommsDbProtectTableView* aTable,TInt aResult); |
|
113 |
|
114 void ProtectRecordL(CCommsDbProtectConnectPrefTableView* aTable, TInt aResult); |
|
115 void UnprotectRecordL(CCommsDbProtectConnectPrefTableView* aTable,TInt aResult); |
|
116 |
|
117 |
|
118 private: |
|
119 //Set when remote database object are in use |
|
120 TBool iRemoteObjects; |
|
121 |
|
122 }; |
|
123 |
|
124 #define CDBLEAVE( exp1, exp2 ) { \ |
|
125 TInt _r; \ |
|
126 _r = (exp1); \ |
|
127 if ( _r!=exp2 ) User::Leave(_r);\ |
|
128 } |
|
129 |
|
130 _LIT(KInvalidColumnName, "InvalidColumn"); |
|
131 |
|
132 #endif /* __COMMDBTESTSTEP_H__ */ |