messagingfw/biomsgfw/T_BIOMSG/INC/commands.h
changeset 62 db3f5fa34ec7
parent 0 8e480a14352b
equal deleted inserted replaced
60:9f5ae1728557 62:db3f5fa34ec7
       
     1 // Copyright (c) 2003-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 // commands.h
       
    15 //
       
    16 
       
    17 #ifndef __COMMANDS_H
       
    18 #define __COMMANDS_H
       
    19 #include "harness.h"
       
    20 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS 
       
    21 #include "tmsvbioinfo.h"
       
    22 #endif
       
    23 #include <commsdattypesv1_1.h>
       
    24 using namespace CommsDat;
       
    25 
       
    26 extern RFs g_rfs;
       
    27 
       
    28 
       
    29 _LIT(KBioTMsgDirectory, "C:\\msgtest\\biomsg\\data\\");
       
    30 
       
    31 const TChar KCommaSeparator = ',';
       
    32 _LIT(KTrue, "true");
       
    33 _LIT(KFalse, "false");
       
    34 _LIT(KText, "text");
       
    35 _LIT(KBool, "bool");
       
    36 _LIT(KUint, "uint");
       
    37 
       
    38 //
       
    39 // CDoCmdGeneral
       
    40 // Handles the running of the genral commands
       
    41 class CDoCmdGeneral : public CBase, public MBaseTestState 
       
    42 {
       
    43 public:
       
    44 	enum TCmdGeneral
       
    45 	{
       
    46 		ECmdGeneralClean,
       
    47 		ECmdGeneralDumpMsg,
       
    48 		ECmdGeneralPrettifyLog,
       
    49 		ECmdGeneralComment,
       
    50 		ECmdGeneralGenerateFromFile,
       
    51 		ECmdGeneralGenerateFromSection,
       
    52 		ECmdGeneralCheckUsedBif,
       
    53 		ECmdGeneralCheckFileWithExtExists,
       
    54 		ECmdGeneralCleanAllBioMsgs
       
    55 	};
       
    56 
       
    57 	static CDoCmdGeneral* NewL(CClientTestHarness& aTestUtils, const HBufC*& aBuffer, const TBIOMessageType& aMsgType, TCmdGeneral aCmd);
       
    58 	static CDoCmdGeneral* NewL(CClientTestHarness& aTestHarness, const CDesCArrayFlat& aComment, TCmdGeneral aCmd);
       
    59 	static CDoCmdGeneral* NewL(CClientTestHarness& aTestUtils, TCmdGeneral aCmd);
       
    60 	void StartL(TRequestStatus& aStatus);
       
    61 	~CDoCmdGeneral();
       
    62 
       
    63 private:
       
    64 	inline CDoCmdGeneral(CClientTestHarness& aTestHarness, TCmdGeneral aCmd) : iTestHarness(aTestHarness) , iCmd(aCmd) {}
       
    65 	void ConstructL(const CDesCArrayFlat& aComment);
       
    66 	void ConstructL(const HBufC*& aBuffer, const TBIOMessageType& aMsgType);
       
    67 	void GenerateBIOMessageFromFileL(const TDesC& aFilename);
       
    68 	void GenerateBIOMessageFromSectionL();
       
    69 	void CheckDataFileCreatedL();
       
    70 	void CheckBifFileUsedL(TDesC& aExpectedName);
       
    71 	void DumpCurrentMessageL();
       
    72 	void PrettifyLogL();
       
    73 	void CleanAllBioMsgsL();
       
    74 	
       
    75 #ifdef SYMBIAN_BOOKMARK_DATABASE
       
    76 	void CheckBookmarksDbL() const;
       
    77 #endif // SYMBIAN_BOOKMARK_DATABASE
       
    78 
       
    79 protected:
       
    80 	CClientTestHarness& iTestHarness;
       
    81 	HBufC* iComment;
       
    82 	TCmdGeneral iCmd;
       
    83 	HBufC* iBuffer;
       
    84 	TBIOMessageType iMsgType;
       
    85 
       
    86 friend class CGenericScriptParser;
       
    87 };
       
    88 
       
    89 //
       
    90 // CDoCmdBioDB
       
    91 // Handles the running of the BIODB commands
       
    92 
       
    93 class CDoCmdBioDB : public CBase, public MBaseTestState
       
    94 {
       
    95 public:
       
    96 	enum TCmdBioDB
       
    97 	{
       
    98 		ECmdBioDBDump,				// bio_db_dump
       
    99 		ECmdBioDBTestAPI,			// bio_db_test_api
       
   100 		ECmdBioDBDumpWapBif,		// bio_db_dump_wap
       
   101 		ECmdBioDBCheckBioness,		// bio_db_check_bioness
       
   102 		ECmdBioDBDefaultSendBearer, // bio_db_default_send_bearer
       
   103 	};
       
   104 
       
   105 	static CDoCmdBioDB* NewL(CClientTestHarness& aTestHarness, TCmdBioDB aCmd);
       
   106 	void StartL(TRequestStatus& aStatus);
       
   107 	~CDoCmdBioDB();
       
   108 
       
   109 private:
       
   110 	inline CDoCmdBioDB(CClientTestHarness& aTestHarness, TCmdBioDB aCmd) : iTestHarness(aTestHarness), iCmd(aCmd) {}
       
   111 	void DoBioDBDumpL();
       
   112 	void DoBioDBTestAPIL();
       
   113 	void DoBioDBDumpWapBifsL();
       
   114 	void DoBioDBCheckBionessL();
       
   115 	void DoBioDBDefaultSendBearerL();
       
   116 	void GetBearerText(TInt aBearer, TBuf<100>& rBearerString);
       
   117 
       
   118 protected:
       
   119 	CClientTestHarness& iTestHarness;
       
   120 	TCmdBioDB iCmd;
       
   121 };
       
   122 
       
   123 //
       
   124 // CDoCmdCommDB
       
   125 // Handles the running of the COMMDB commands
       
   126 class CDoCmdCommDB : public CBase, public MBaseTestState
       
   127 {
       
   128 public:
       
   129 	enum TCmdCommDB
       
   130 	{
       
   131 		ECmdCommDBReadText,
       
   132 		ECmdCommDBReadLongText,
       
   133 		ECmdCommDBReadUint,
       
   134 		ECmdCommDBReadBool,
       
   135 		ECmdCommDBCheck
       
   136 	};
       
   137 
       
   138 	static CDoCmdCommDB* NewL(const CDesCArrayFlat& aArgs,CClientTestHarness& aTestHarness, TCmdCommDB aCmd);
       
   139 	void StartL(TRequestStatus& aStatus);
       
   140 	~CDoCmdCommDB();
       
   141 
       
   142 private:
       
   143 	TBool DoFindRecordExists(const TDesC& aTableNam,const TDesC& aData);
       
   144 	TBool CheckBool(const TDesC& aValue);
       
   145 	TInt GetIntValue(const TDesC& aValue);	
       
   146 
       
   147 	inline CDoCmdCommDB(CClientTestHarness& aTestHarness, TCmdCommDB aCmd) : iTestHarness(aTestHarness), iCmd(aCmd) {}
       
   148 	void ConstructL(const CDesCArrayFlat& aArgs);
       
   149 	void DoCmdCommDBReadTextL();
       
   150 	
       
   151 	void DoCmdCommDBCheckL();
       
   152 private:
       
   153 	CDesCArrayFlat* iArgs;
       
   154 	CClientTestHarness& iTestHarness;
       
   155 	TCmdCommDB iCmd;
       
   156 	CMDBSession* iDBSession; //commsdat session
       
   157 };
       
   158 
       
   159 //
       
   160 // CDoCmdClient
       
   161 // Handles the running of the Client commands
       
   162 class CDoCmdClient : public CBase, public MBaseTestState
       
   163 {
       
   164 public:
       
   165 	enum TCmdClient
       
   166 	{
       
   167 		ECmdClientParse,		// bio_client_parse
       
   168 		ECmdClientProcess,		// bio_client_process
       
   169 		ECmdClientFindBody,		// bio_client_find_in_body
       
   170 		ECmdClientFindSubject	// bio_client_find_in_subject
       
   171 	};
       
   172 
       
   173 	~CDoCmdClient();
       
   174 	static CDoCmdClient* NewL(CDesCArrayFlat& aArgs, CClientTestHarness& aTestHarness, const TCmdClient& aCmd);
       
   175 	void StartL(TRequestStatus& aStatus);
       
   176 
       
   177 private:
       
   178 	inline CDoCmdClient(CClientTestHarness& aTestHarness, const TCmdClient& aCmd) : iTestHarness(aTestHarness), iCmd(aCmd) {}
       
   179 	void DoCmdClientParseL();
       
   180 	void DoCmdClientProcessL();
       
   181 	void DoCmdClientFindInSubjectL();
       
   182 	void DoCmdClientFindInBodyL();
       
   183 	void ConstructL(const CDesCArrayFlat& aArgs);
       
   184 
       
   185 private:
       
   186 	CDesCArrayFlat* iArgs;
       
   187 	CClientTestHarness& iTestHarness;
       
   188 	TCmdClient iCmd;
       
   189 };
       
   190 
       
   191 
       
   192 //
       
   193 // CDoCmdServer
       
   194 // Handles the running of the Server commands
       
   195 class CDoCmdServer : public CBase, public MBaseTestState
       
   196 {
       
   197 public:
       
   198 	enum TCmdServer
       
   199 	{
       
   200 		ECmdServerParse,		// bio_server_parse
       
   201 		ECmdServerProcess,		// bio_server_process
       
   202 	};
       
   203 
       
   204 	~CDoCmdServer();
       
   205 	static CDoCmdServer* NewL(CDesCArrayFlat& aArgs, CClientTestHarness& aTestHarness, const TCmdServer& aCmd);
       
   206 	void StartL(TRequestStatus& aStatus);
       
   207 
       
   208 private:
       
   209 	inline CDoCmdServer(CClientTestHarness& aTestHarness, const TCmdServer& aCmd) : iTestHarness(aTestHarness), iCmd(aCmd) {}
       
   210 	void DoCmdServerParseL();
       
   211 	void DoCmdServerProcessL();
       
   212 	void ConstructL(const CDesCArrayFlat& aArgs);
       
   213 
       
   214 private:
       
   215 	CDesCArrayFlat* iArgs;
       
   216 	CClientTestHarness& iTestHarness;
       
   217 	TCmdServer iCmd;
       
   218 };
       
   219 
       
   220 
       
   221 //
       
   222 // CDoCmdMsv
       
   223 // Handles the running of the COMMDB commands
       
   224 class CDoCmdMsv : public CBase, public MBaseTestState
       
   225 {
       
   226 public:
       
   227 	enum TCmdMsv
       
   228 	{
       
   229 		//Pop3 Settings
       
   230 		ECmdChkPop3Apop,ECmdChkPop3AutoSendOnConnect,ECmdChkPop3LoginName,
       
   231 		ECmdChkPop3Password,ECmdChkPop3Port,ECmdChkPop3Restore,ECmdChkPop3ServerAddress,
       
   232 		ECmdChkPop3Store,ECmdChkPop3UserAddress,ECmdChkPop3Version,ECmdChkDeleteMsgsFromServer,
       
   233 		ECmdInstantDefaultPop3,ECmdInstantDefaultSmtp,ECmdInstantDefaultImap,
       
   234 		ECmdInstantNamedPop3,ECmdInstantNamedImap,ECmdInstantNamedSmtp,
       
   235 		//Smtp Settings
       
   236 		ECmdChkSmtpEmailAlias,ECmdChkSmtpEmailAddress,ECmdChkSmtpReplyToAddress,
       
   237 		ECmdChkSmtpReceiptAddress,ECmdChkSmtpBodyEncoding,
       
   238 		ECmdChkSmtpDefaultMsgCharSet,ECmdChkSmtpAddVCardToEmail,
       
   239 		ECmdChkSmtpAddSignatureToEmail,ECmdChkSmtpRequestReceipts,
       
   240 		ECmdChkSmtpSendCopyToSelf,ECmdChkSmtpSendMessageOption,ECmdChkSmtpServerAddress,
       
   241 		ECmdChkSmtpUserAddress,ECmdChkSmtpPort,
       
   242 		//Imap Settings
       
   243 		ECmdChkImapLoginName,ECmdChkImapPassword,ECmdChkImapFolderPath,ECmdChkImapPathSeparator,
       
   244 		ECmdChkImapDisconnectedUserMode,ECmdChkImapSynchronise,ECmdChkImapSubscribe,
       
   245 		ECmdChkImapAutoSendOnConnect,ECmdChkImapMaxEmailSize,ECmdChkImapDeleteEmailsWhenDisconnecting,
       
   246 		ECmdChkImapAcknowledgeReceipts,ECmdChkImapGetMailOptions,ECmdChkImapInboxSynchronisationLimit,
       
   247 		ECmdChkImapMailboxSynchronisationLimit,ECmdChkImapServerAddress,ECmdChkImapPort,
       
   248 		//Sms Settings
       
   249 		ECmdChkSmsMsgCentreNumber,ECmdDumpSmsMsgCentres,ECmdChkDefaultSmsMsgCentre
       
   250 		
       
   251 	};
       
   252 
       
   253 	static CDoCmdMsv* NewL(const CDesCArrayFlat& aArgs,CClientTestHarness& aTestHarness, TCmdMsv aCmd);
       
   254 	static CDoCmdMsv* NewL(const TDesC& aSettingsName,CClientTestHarness& aTestHarness, TCmdMsv aCmd);
       
   255 	void StartL(TRequestStatus& aStatus);
       
   256 	~CDoCmdMsv();
       
   257 
       
   258 private:
       
   259 	inline CDoCmdMsv(CClientTestHarness& aTestHarness, TCmdMsv aCmd) : iTestHarness(aTestHarness), iCmd(aCmd) {}
       
   260 	inline CDoCmdMsv(const TDesC& aName,CClientTestHarness& aTestHarness, TCmdMsv aCmd) : iName(aName), iTestHarness(aTestHarness), iCmd(aCmd) {}
       
   261 	void ConstructL(const CDesCArrayFlat& aArgs);
       
   262 
       
   263 private:
       
   264 	TBuf<50> iName;
       
   265 	CDesCArrayFlat* iArgs;
       
   266 	CClientTestHarness& iTestHarness;
       
   267 	TCmdMsv iCmd;
       
   268 };
       
   269 
       
   270 #endif
       
   271