contentctrl_plat/adapter_customization_api/tsrc/ContactAdapter/cnsmldummydatastore_test.h
branchRCL_3
changeset 52 4f0867e42d62
parent 14 b922b9936679
equal deleted inserted replaced
51:8e7494275d3a 52:4f0867e42d62
       
     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:  Header file for contact adapter's datastore unit tests.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CNSMLDUMMYDATASTORE_TEST_H__
       
    19 #define __CNSMLDUMMYDATASTORE_TEST_H__
       
    20 
       
    21 // INCLUDES
       
    22 #include <CEUnitTestSuiteClass.h>
       
    23 #include <SmlDataSyncDefs.h>
       
    24 #include <cntdb.h>
       
    25 #include <s32mem.h>
       
    26 #include <MVPbkContactViewBase.h>
       
    27 #include <MVPbkContactViewObserver.h>
       
    28 #include <CVPbkContactManager.h>
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CNSmlDummyDataStore;
       
    32 class CNSmlAdapterTestUtilities;
       
    33 class CNSmlDummyDataStoreWaiter;
       
    34 class CSmlDataStore;
       
    35 // CLASS DEFINITION
       
    36 
       
    37 /**
       
    38  * Generated EUnit test suite class.
       
    39  */
       
    40 NONSHARABLE_CLASS( CNSmlDummyDataStore_Test )
       
    41 	: public CEUnitTestSuiteClass, 
       
    42 	public MSmlSyncRelationship,
       
    43     public MVPbkContactViewObserver
       
    44     {
       
    45     public:  // Constructors and destructor
       
    46 
       
    47         static CNSmlDummyDataStore_Test* NewL();
       
    48         static CNSmlDummyDataStore_Test* NewLC();
       
    49         ~CNSmlDummyDataStore_Test();
       
    50 
       
    51     private: // Constructors
       
    52 
       
    53         CNSmlDummyDataStore_Test();
       
    54         void ConstructL();
       
    55 
       
    56     private: // New methods
       
    57 
       
    58         void Empty() {};
       
    59 
       
    60         // ++ Setup methods ++
       
    61         void SetupL();
       
    62         
       
    63         void SetupAndOpenStoreL();
       
    64         
       
    65         void SetupAndPopulateContactDbL();
       
    66         
       
    67         void SetupPopulateDbAndOpenStoreL();
       
    68 
       
    69         // ++ Teardown methods ++
       
    70         void Teardown();
       
    71         
       
    72         void TeardownAndCloseStore();
       
    73         
       
    74         void TeardownAndEmptyContactDb();
       
    75         
       
    76         void TeardownCloseAndEmptyContactDb();
       
    77 
       
    78         // ++ DataStore test cases ++
       
    79         void NewLL();
       
    80 
       
    81         void DoOpenLL();
       
    82 
       
    83         void DoHasSyncHistoryL();
       
    84 
       
    85         void DoModifiedItemsL();
       
    86 
       
    87         void DoResetChangeInfoLL();
       
    88 
       
    89         void DoCommitChangeInfoLL();
       
    90 
       
    91         void AddSingleItemL();
       
    92 
       
    93         void AddEmptyBatchL();
       
    94 
       
    95         void AddTwoItemBatchL();
       
    96         
       
    97         void CancelBatchL();
       
    98 
       
    99         void FetchItemL();
       
   100 
       
   101         void FetchItem2L();
       
   102         
       
   103         void UpdateItemL();
       
   104 
       
   105         void DeleteItemL();
       
   106 
       
   107         void DeleteAllItemsL();
       
   108 
       
   109         void GetStoreFormatResourceFileLL();
       
   110 
       
   111         void RemoveItemFromAddBatchL();
       
   112 
       
   113         void TestStoreSupportMimeTypeL();
       
   114         
       
   115         void DoBeginTransactionL();
       
   116         
       
   117         void DoCommitTransactionL();
       
   118         
       
   119         void DoRevertTransaction();
       
   120         
       
   121         void StoreNameL();
       
   122         
       
   123         void FindChangedItemsL();
       
   124         
       
   125         void MoveAndDeleteL();
       
   126         
       
   127         void ExecuteMoveL();
       
   128         
       
   129         void DoSetRemoteMaxObjectSize();
       
   130         
       
   131         void DoMaxObjectSize();
       
   132         
       
   133         void LdoFetchItemL();
       
   134         
       
   135         void ContactsSavingFailedL();
       
   136         
       
   137         void StepFailed();
       
   138         
       
   139         void GetDataMod();
       
   140  
       
   141 //
       
   142 
       
   143         // ++ Helper methods ++
       
   144         TContactItemId AddContactL( const TDesC& aFirstName,
       
   145                  const TDesC& aLastName,
       
   146                  const TDesC& aPhoneNumber );
       
   147         TInt CountItemsLeftInBatchL( CBufBase& aItems );
       
   148         
       
   149         void CreateViewL();
       
   150         
       
   151         void CreateDataStoreL();
       
   152 
       
   153         void DeleteDataStoreL();
       
   154         
       
   155         // From MVPbkContactViewObserver  
       
   156         void ContactViewReady( MVPbkContactViewBase& aView ) ;
       
   157        
       
   158         void ContactViewUnavailable(
       
   159                     MVPbkContactViewBase& aView ) ;
       
   160         
       
   161         void ContactAddedToView(
       
   162                     MVPbkContactViewBase& aView, 
       
   163                     TInt aIndex, 
       
   164                     const MVPbkContactLink& aContactLink );
       
   165         
       
   166         void ContactRemovedFromView(
       
   167                     MVPbkContactViewBase& aView, 
       
   168                     TInt aIndex, 
       
   169                     const MVPbkContactLink& aContactLink ) ;
       
   170              
       
   171         void ContactViewError(
       
   172                     MVPbkContactViewBase& aView, 
       
   173                     TInt aError, 
       
   174                     TBool aErrorNotified ) ;
       
   175         
       
   176     private: // from MSmlSyncRelationship
       
   177         TSmlSyncTaskKey SyncTaskKey() const;
       
   178         
       
   179         void OpenReadStreamLC(RReadStream& aReadStream, TUid aStreamUid);
       
   180         
       
   181         void OpenWriteStreamLC(RWriteStream& aWriteStream, TUid aStreamUid);
       
   182         
       
   183         TBool IsStreamPresentL(TUid aStreamUid) const;
       
   184 
       
   185     private: // Data
       
   186 
       
   187         CNSmlDummyDataStore* iCNSmlDummyDataStore;
       
   188         CNSmlAdapterTestUtilities* iTestUtilities;
       
   189 
       
   190         CContactDatabase*   iContactDatabase;
       
   191         CContactIdArray*    iIdArray;
       
   192         RFs                 iFsSession;
       
   193         RFileWriteStream    iWriteStream;
       
   194         TSmlDbItemUid       iItemUid;
       
   195         TSmlDbItemUid       iItemUid2;
       
   196 
       
   197         CNSmlDummyDataStoreWaiter* iStoreWaiter;
       
   198         MVPbkContactViewBase* iContactViewBase;
       
   199         CVPbkContactManager* iContactManager;
       
   200         
       
   201         CSmlDataStore* iDataStore;
       
   202 
       
   203         EUNIT_DECLARE_TEST_TABLE;
       
   204     };
       
   205 
       
   206 #endif      //  __CNSMLDUMMYDATASTORE_TEST_H__