messagingfw/msgtest/testutils/server/inc/Msgservertestutils.h
changeset 62 db3f5fa34ec7
parent 0 8e480a14352b
equal deleted inserted replaced
60:9f5ae1728557 62:db3f5fa34ec7
       
     1 // Copyright (c) 2000-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 #ifndef __MSGSERVERTESTUTILS_H__
       
    17 #define __MSGSERVERTESTUTILS_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <s32file.h>
       
    21 #include <f32file.h>
       
    22 #include <e32test.h>
       
    23 #include <e32uid.h>
       
    24 #include "msvtestutilsbase.h"
       
    25 #include <msvapi.h>
       
    26 #include <msvstd.h>
       
    27 #include "MSVSERV.H"
       
    28 #include <msvruids.h>
       
    29 
       
    30 
       
    31 const TUid KUidMsvIndexFile = {0x10003C6B};
       
    32 const TInt KMsvIndexStoreVersionNumber = 1;
       
    33 
       
    34 class CMsgServerTestUtils : public CTestUtils
       
    35 	{
       
    36 public:
       
    37 	IMPORT_C static CMsgServerTestUtils* NewL(RTest& aRTest);
       
    38 	IMPORT_C static CMsgServerTestUtils* NewLC(RTest& aRTest);
       
    39 
       
    40 	IMPORT_C ~CMsgServerTestUtils();
       
    41 
       
    42 	IMPORT_C void SetupL();
       
    43 	IMPORT_C void Close(TInt aRet);
       
    44 
       
    45 	IMPORT_C void SetConfigL(TMsvConfig& aConfig);
       
    46 	IMPORT_C void SetDebugL(TBool aDebug);
       
    47 	IMPORT_C void GetConfigL(TMsvConfig& aConfig);
       
    48 	IMPORT_C void CleanMessageFolderL(const TDesC& aDes = KNullDesC);
       
    49 	IMPORT_C void SetDriveL(TInt aDrive, TBool aStoreId = EFalse);
       
    50 	IMPORT_C CMsvServer* CreateServerL(const TDesC& aIndexFile);
       
    51 	IMPORT_C void FileExists(const TDesC& aDes);
       
    52 	IMPORT_C void FileMissing(const TDesC& aDes);
       
    53 	IMPORT_C void CreateDataFilesL(const TDesC& aFilename, const TDesC& aMtmName, TUid aUid, const TDesC& aServerMtmFileName, const TDesC& aClientMtmFileName);
       
    54 	IMPORT_C void InstallMtmL(const TDesC& aDataFile, const TDesC& aMtmName, TUid aId, const TDesC& aServerMtmFileName, const TDesC& aClientMtmFileName);
       
    55 	IMPORT_C TBool WaitForKeyL(TTimeIntervalMicroSeconds32 aDelay, TKeyCode* aKeyCode = NULL);
       
    56 	IMPORT_C void WaitForServerClose();
       
    57 	IMPORT_C void RemoveMailFolderL(TInt aDrive);
       
    58 	IMPORT_C void CorruptIndexFileL(TInt aMode, const TDesC& aDes = KNullDesC);
       
    59 	IMPORT_C void RemoveIndexFile(TInt aDrive);
       
    60 	IMPORT_C TInt IndexSizeL(TInt aDrive = EDriveC, const TDesC& aIndexFile = KMsvDefaultIndexFile2);
       
    61 	
       
    62 	IMPORT_C void Start(const TDesC& aDes);
       
    63 	IMPORT_C void Next(const TDesC& aDes);
       
    64 	IMPORT_C void Complete();
       
    65 	IMPORT_C void End();
       
    66 
       
    67 	IMPORT_C TInt ReadInteger(const TDesC& aDes,TInt &aResult);
       
    68 	IMPORT_C void ChooseDriveL(TDriveUnit &aResult);
       
    69 
       
    70 	IMPORT_C TMsvId CreateServiceL(const TUid aMtm, TBool aReadOnly, TBool aVisible);
       
    71 private:
       
    72 	CMsgServerTestUtils(RTest& aRTest);
       
    73 	void ConstructL();
       
    74 	void Panic(TInt aPanic);
       
    75 
       
    76 private:
       
    77 	TDriveUnit iRemovableDrive;
       
    78 	TInt	   iTestNum;
       
    79 public:
       
    80 	};
       
    81 
       
    82 
       
    83 class CTestScheduler : public CActiveScheduler
       
    84 	{
       
    85 public:
       
    86 	IMPORT_C CTestScheduler();
       
    87 private:
       
    88 	
       
    89 	IMPORT_C void Error(TInt aError) const;
       
    90 public:
       
    91 	TInt iSchedulerError;
       
    92 	TBool iSchedulerActive;
       
    93 	TBool iPanicSchedulerOnError;
       
    94 	};
       
    95 
       
    96 
       
    97 class TTestMsvEntry : public TMsvEntry
       
    98 	{
       
    99 public:
       
   100 	void SetOwner(TBool aFlag) {TMsvEntry::SetOwner(aFlag);};
       
   101 	void SetId(TMsvId aId) {TMsvEntry::SetId(aId);};
       
   102 	void SetParent(TMsvId aId) {TMsvEntry::SetParent(aId);};
       
   103 	void SetDeleted(TBool aFlag) {TMsvEntry::SetDeleted(aFlag);};
       
   104 	TInt PcSyncCount() {return TMsvEntry::PcSyncCount();};
       
   105 	TInt Reserved() {TInt* ptr = (TInt*)&iServiceId; return *--ptr;};
       
   106 	void SetReserved(TInt aValue) {TInt* ptr = (TInt*)&iServiceId; *--ptr=aValue;};
       
   107 	void SetData(TInt aData) {*(((TInt*)this)+2) = aData;};
       
   108 	};
       
   109 
       
   110 
       
   111 #endif