//
// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
//
//! @file

RUN_UTILS DeleteFile c:\messaging.db

LOAD_SUITE	T_MsgCommonServer	-SharedData
LOAD_SUITE	T_MsgImapServer		-SharedData
LOAD_SUITE	T_MsgSmtpServer		-SharedData

//!	@SYMTestCaseID				MSG-IMAP-DownloadRulesFetch-0015
//!	@SYMTestCaseDesc			Positive: Maintain default behaviour when synchronising using KIMAP4MTMConnectAndSynchronise where no download rules are defined. (+ve)
//!	@SYMTestPriority			Critical
//!	@SYMTestType				CIT
//! @SYMREQ						6987, 6982
//! @SYMPREQ					1307
//!	@SYMTestStatus				Implemented
//!	@SYMTestCaseDependencies	Requires CED tool to be run over c:\ced_default_ras.cfg to set CommDB as required when using NTRAS for connection to Email servers.
//!	@SYMTestActions				1.	Reset Message Store and Central Repository to default state.
//!								2.	Create IMAP account in Central Repository using standard settings from a configuration file.
//!								3.	Connect and sync to IMAP service using account settings and initialise account on remote IMAP server to default clean state.
//!								4.	Disconnect from IMAP service.
//!								5.	Create multiple messages from file and send using SMTP service to remote INBOX.
//!								6.	Create remote root-level personal folder with multiple messages (messages copied within service from INBOX using a separate IMAP a/c).
//!								7.	Set IMAP service settings to not use IMAP IDLE command.
//!								8.	Modify the email account settings to specify it will use it's defined per bearer type list of email download rules.
//!								9.	Check that a per bearer type list of email download rules for both remote Inbox and the personal folder created in step 6 is not defined.
//!								10.	Connect and sync (KIMAP4MTMConnectAndSynchronise) to IMAP service using account settings and wait for background synchronisation to complete.
//!								11.	Check that only message headers are fetched in remote Inbox and the personal folder created in step 6 as required.
//!								12.	Disconnect from IMAP service.
//!
//!	@SYMTestExpectedResults		See step 11.
//!	@SYMAuthor					Sandip Ahluwalia

START_TESTCASE	MSG-IMAP-DownloadRulesFetch-0015

RUN_TEST_STEP	300	T_MsgCommonServer	StartUp
RUN_TEST_STEP	300	T_MsgImapServer		StartUp
RUN_TEST_STEP	300	T_MsgSmtpServer		StartUp

PRINT Setup Begins #####################################################
RUN_TEST_STEP	300	T_MsgCommonServer	InitNtRas						c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-InitNtRas
RUN_TEST_STEP	300	T_MsgCommonServer	ResetMessageStore				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-ResetMessageStore
PRINT Setup Completed ##################################################
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		CreateImapAccount				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-CreateImapAccount
RUN_TEST_STEP	300	T_MsgImapServer		ChangeImap4SubAndSyncSettings	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-ChangeImap4SubAndSyncSettings
RUN_TEST_STEP	300	T_MsgImapServer		ConnectAndSyncImapServer		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-ConnectAndSyncImapServer
RUN_TEST_STEP	300	T_MsgImapServer		InitialiseImap4Account			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-InitialiseImap4Account
RUN_TEST_STEP	300	T_MsgImapServer		DoFullImap4Synchronisation		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-DoFullImap4Synchronisation
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-CheckChildrenCountRemoteInbox0
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-DisConnectImapServer
PRINT ##################################################################
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-CreateSmtpMessageFromEmailFile1
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-CreateSmtpMessageFromEmailFile2
RUN_TEST_STEP 	300 T_MsgCommonServer  	CheckChildrenCount 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-CheckChildrenCountOutbox
//Only one "Copy from local" function call needed because in addition to the specified messages the SMTP MTM will also attempt to send in the same session any other SMTP messages that appear in the local Outbox folder
RUN_TEST_STEP 	300 T_MsgSmtpServer		SendSmtpMessage 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-SendSmtpMessage
RUN_TEST_STEP 	300 T_MsgCommonServer  	CheckChildrenCount 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-CheckChildrenCountSentItems
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-CheckChildrenCountRemoteInbox0
PRINT ##################################################################
//Messages copied within service from remote INBOX to remote personal folder using a separate IMAP a/c.
RUN_TEST_STEP	300	T_MsgImapServer		CreateImapAccount				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-CreateImapAccount_B
RUN_TEST_STEP	300	T_MsgImapServer		ChangeImap4SubAndSyncSettings	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-ChangeImap4SubAndSyncSettings_B
RUN_TEST_STEP	300	T_MsgImapServer		ConnectAndSyncImapServer		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-ConnectAndSyncImapServer_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-CheckChildrenCountRemoteInbox_B
RUN_TEST_STEP	300	T_MsgImapServer		CreateImap4Folder				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-CreateImap4Folder_B
RUN_TEST_STEP	300	T_MsgImapServer		FindEntryByName					c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-FindEntryByName_B
RUN_TEST_STEP	300	T_MsgImapServer		CopyImapSelectionRemote			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-CopyImapSelectionRemote_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-CheckChildrenCountRemoteTestFolder0_B
RUN_TEST_STEP	300	T_MsgImapServer		DoFullImap4Synchronisation		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-DoFullImap4Synchronisation_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-CheckChildrenCountRemoteTestFolder1_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckImap4Subscription			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-CheckSubscription1_B
RUN_TEST_STEP	300	T_MsgImapServer		SubscribeImap4Folder			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-SubscribeImap4Folder_TestFolder_B
RUN_TEST_STEP	300	T_MsgImapServer		DoFullImap4Synchronisation		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-DoFullImap4Synchronisation_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckImap4Subscription			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-CheckSubscription2_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-CheckChildrenCountRemoteTestFolder0_B
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-DisConnectImapServer_B
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		SetImap4ServiceIdleParamters	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-TurnImapIdleOFF
RUN_TEST_STEP	300	T_MsgImapServer		ModifyImapSettings				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-TurnDownloadRulesON
RUN_TEST_STEP !Error=-1	300	T_MsgImapServer		CheckImapSyncDLRules	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-CheckImapSyncDLRulesINBOX
RUN_TEST_STEP !Error=-1	300	T_MsgImapServer		CheckImapSyncDLRules	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-CheckImapSyncDLRulesOTHER
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-CheckChildrenCountRemoteInbox0
RUN_TEST_STEP !Error=-1	300	T_MsgImapServer		FindEntryByName			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-FindEntryByName_TestFolder
RUN_TEST_STEP	300	T_MsgImapServer		ChangeImap4SubAndSyncSettings	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-ChangeImap4SubAndSyncSettings2
PRINT ##################################################################
//2nd phase synchronisation using download rules happens below...
RUN_TEST_STEP	300	T_MsgImapServer		ConnectAndSyncImapServer		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-ConnectAndSyncImapServer
RUN_TEST_STEP 	300	T_MsgImapServer		FindEntryByName					c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-FindEntryByName_TestFolder
RUN_TEST_STEP	300	T_MsgImapServer		CheckImap4Subscription			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-CheckSubscription_TestFolder
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-CheckChildrenCountRemoteInbox1
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-CheckChildrenCountRemoteTestFolder
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-IsImapMessageHeaderOnly1
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-IsImapMessageHeaderOnly2
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-IsImapMessageHeaderOnly3
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-IsImapMessageHeaderOnly4
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0001-DisConnectImapServer
PRINT ##################################################################

RUN_TEST_STEP	300	T_MsgCommonServer	ShutDown
RUN_TEST_STEP	300	T_MsgImapServer		ShutDown
RUN_TEST_STEP	300	T_MsgSmtpServer		ShutDown

END_TESTCASE	MSG-IMAP-DownloadRulesFetch-0015

//!	@SYMTestCaseID				MSG-IMAP-DownloadRulesFetch-0017
//!	@SYMTestCaseDesc			Positive: Maintain default behaviour when synchronising using KIMAP4MTMFolderFullSync where no download rules are defined. (+ve)
//!	@SYMTestPriority			Critical
//!	@SYMTestType				CIT
//! @SYMREQ						6987, 6982
//! @SYMPREQ					1307
//!	@SYMTestStatus				Implemented
//!	@SYMTestCaseDependencies	Requires CED tool to be run over c:\ced_default_ras.cfg to set CommDB as required when using NTRAS for connection to Email servers.
//!	@SYMTestActions				1.	Reset Message Store and Central Repository to default state.
//!								2.	Create IMAP account in Central Repository using standard settings from a configuration file.
//!								3.	Connect and sync to IMAP service using account settings and initialise account on remote IMAP server to default clean state.
//!								4.	Create remote root-level personal folder and remotely subscribe to it.
//!								5.	Disconnect from IMAP service.
//!								6.	Create multiple messages from file and send using SMTP service to remote INBOX.
//!								7.	Populate remote root-level personal folder with multiple messages (Messages copied within service from remote INBOX using a separate IMAP a/c).
//!								8.	Set IMAP service settings to not use IMAP IDLE command.
//!								9.	Modify the email account settings to specify it will use it's defined per bearer type list of email download rules.
//!								10.	Check that a per bearer type list of email download rules for both remote Inbox and the personal folder created in step 4 is not defined.
//!								11.	Connect without sync to IMAP service using account settings. 
//!								12.	Sync down (KIMAP4MTMFolderFullSync) the personal folder created in step 4.
//!								13.	Check that only message headers are fetched in the personal folder created in step 4 as required and check that no message headers and content are fetched down in remote Inbox.
//!								14.	Disconnect from IMAP service.
//!
//!	@SYMTestExpectedResults		See step 13.
//!	@SYMAuthor					Sandip Ahluwalia

START_TESTCASE	MSG-IMAP-DownloadRulesFetch-0017

RUN_TEST_STEP	300	T_MsgCommonServer	StartUp
RUN_TEST_STEP	300	T_MsgImapServer		StartUp
RUN_TEST_STEP	300	T_MsgSmtpServer		StartUp

PRINT Setup Begins #####################################################
RUN_TEST_STEP	300	T_MsgCommonServer	InitNtRas						c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-InitNtRas
RUN_TEST_STEP	300	T_MsgCommonServer	ResetMessageStore				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-ResetMessageStore
PRINT Setup Completed ##################################################
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		CreateImapAccount				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-CreateImapAccount
RUN_TEST_STEP	300	T_MsgImapServer		ChangeImap4SubAndSyncSettings	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-ChangeImap4SubAndSyncSettings
RUN_TEST_STEP	300	T_MsgImapServer		ConnectAndSyncImapServer		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-ConnectAndSyncImapServer
RUN_TEST_STEP	300	T_MsgImapServer		InitialiseImap4Account			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-InitialiseImap4Account
RUN_TEST_STEP	300	T_MsgImapServer		DoFullImap4Synchronisation		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-DoFullImap4Synchronisation
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-CheckChildrenCountRemoteInbox0
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		CreateImap4Folder				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-CreateImap4Folder
RUN_TEST_STEP	300	T_MsgImapServer		FindEntryByName					c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-FindEntryByName_TestFolder
RUN_TEST_STEP	300	T_MsgImapServer		CheckImap4Subscription			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-CheckSubscription1
RUN_TEST_STEP	300	T_MsgImapServer		SubscribeImap4Folder			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-SubscribeImap4Folder_TestFolder
RUN_TEST_STEP	300	T_MsgImapServer		DoFullImap4Synchronisation		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-DoFullImap4Synchronisation
RUN_TEST_STEP	300	T_MsgImapServer		CheckImap4Subscription			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-CheckSubscription2
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-DisConnectImapServer
PRINT ##################################################################
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-CreateSmtpMessageFromEmailFile1
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-CreateSmtpMessageFromEmailFile2
RUN_TEST_STEP 	300 T_MsgCommonServer  	CheckChildrenCount 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-CheckChildrenCountOutbox
//Only one "Copy from local" function call needed because in addition to the specified messages the SMTP MTM will also attempt to send in the same session any other SMTP messages that appear in the local Outbox folder
RUN_TEST_STEP 	300 T_MsgSmtpServer		SendSmtpMessage 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-SendSmtpMessage
RUN_TEST_STEP 	300 T_MsgCommonServer  	CheckChildrenCount 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-CheckChildrenCountSentItems
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-CheckChildrenCountRemoteInbox0
PRINT ##################################################################
//Messages copied within service from remote INBOX to remote personal folder using a separate IMAP a/c.
RUN_TEST_STEP	300	T_MsgImapServer		CreateImapAccount				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-CreateImapAccount_B
RUN_TEST_STEP	300	T_MsgImapServer		ChangeImap4SubAndSyncSettings	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-ChangeImap4SubAndSyncSettings_B
RUN_TEST_STEP	300	T_MsgImapServer		ConnectAndSyncImapServer		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-ConnectAndSyncImapServer_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-CheckChildrenCountRemoteInbox_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-CheckChildrenCountRemoteTestFolder0_B
RUN_TEST_STEP	300	T_MsgImapServer		CopyImapSelectionRemote			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-CopyImapSelectionRemote_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-CheckChildrenCountRemoteTestFolder1_B
RUN_TEST_STEP	300	T_MsgImapServer		DoFullImap4Synchronisation		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-DoFullImap4Synchronisation_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-CheckChildrenCountRemoteTestFolder1_B
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-DisConnectImapServer_B
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		SetImap4ServiceIdleParamters	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-TurnImapIdleOFF
RUN_TEST_STEP	300	T_MsgImapServer		ModifyImapSettings				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-TurnDownloadRulesON
RUN_TEST_STEP !Error=-1	300	T_MsgImapServer		CheckImapSyncDLRules	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-CheckImapSyncDLRulesINBOX
RUN_TEST_STEP !Error=-1	300	T_MsgImapServer		CheckImapSyncDLRules	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-CheckImapSyncDLRulesOTHER
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-CheckChildrenCountRemoteInbox0
RUN_TEST_STEP	300 T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-CheckChildrenCountRemoteTestFolder0
PRINT ##################################################################
//2nd phase synchronisation using download rules happens below...
RUN_TEST_STEP	300	T_MsgImapServer		ConnectImap4Server				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-ConnectImap4Server
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-CheckChildrenCountRemoteInbox0
RUN_TEST_STEP	300 T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-CheckChildrenCountRemoteTestFolder0
RUN_TEST_STEP	300	T_MsgImapServer		FolderFullSync					c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-FolderFullSync
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-CheckChildrenCountRemoteTestFolder1
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-CheckChildrenCountRemoteInbox0
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-IsImapMessageHeaderOnly1
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-IsImapMessageHeaderOnly2
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0002-DisConnectImapServer
PRINT ##################################################################

RUN_TEST_STEP	300	T_MsgCommonServer	ShutDown
RUN_TEST_STEP	300	T_MsgImapServer		ShutDown
RUN_TEST_STEP	300	T_MsgSmtpServer		ShutDown

END_TESTCASE	MSG-IMAP-DownloadRulesFetch-0017

//!	@SYMTestCaseID				MSG-IMAP-DownloadRulesFetch-0019
//!	@SYMTestCaseDesc			Positive: Maintain default behaviour when synchronising using KIMAP4MTMInboxNewSync where no download rules are defined. (+ve)
//!	@SYMTestPriority			Critical
//!	@SYMTestType				CIT
//! @SYMREQ						6987, 6982
//! @SYMPREQ					1307
//!	@SYMTestStatus				Implemented
//!	@SYMTestCaseDependencies	Requires CED tool to be run over c:\ced_default_ras.cfg to set CommDB as required when using NTRAS for connection to Email servers.
//!	@SYMTestActions				1.	Reset Message Store and Central Repository to default state.
//!								2.	Create IMAP account in Central Repository using standard settings from a configuration file.
//!								3.	Connect and sync to IMAP service using account settings and initialise account on remote IMAP server to default clean state.
//!								4.	Disconnect from IMAP service.
//!								5.	Create 2 messages from file and send using SMTP service to remote INBOX.
//!								6.	Connect and sync to IMAP service using account settings.
//!								7.	Check that the 2 message headers are fetched in remote INBOX as normal.
//!								8.	Disconnect from IMAP service.
//!								9.	Create further 3 messages from file and send using SMTP service to remote INBOX.
//!								10.	Set IMAP service settings to not use IMAP IDLE command.
//!								11.	Modify the email account settings to specify it will use it's defined per bearer type list of email download rules.
//!								12.	Check that a per bearer type list of email download rules for remote Inbox is not defined.
//!								13.	Connect without sync to IMAP service using account settings. 
//!								14.	Sync down (KIMAP4MTMInboxNewSync) the remote Inbox.
//!								15.	Check that only message headers are fetched in the remote Inbox folder as required for first 2 messages sent in step 5 and last 3 messages sent in step 9.
//!								16.	Disconnect from IMAP service.
//!
//!	@SYMTestExpectedResults		See step 15.
//!	@SYMAuthor					Sandip Ahluwalia

START_TESTCASE	MSG-IMAP-DownloadRulesFetch-0019

RUN_TEST_STEP	300	T_MsgCommonServer	StartUp
RUN_TEST_STEP	300	T_MsgImapServer		StartUp
RUN_TEST_STEP	300	T_MsgSmtpServer		StartUp

PRINT Setup Begins #####################################################
RUN_TEST_STEP	300	T_MsgCommonServer	InitNtRas						c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-InitNtRas
RUN_TEST_STEP	300	T_MsgCommonServer	ResetMessageStore				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-ResetMessageStore
PRINT Setup Completed ##################################################
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		CreateImapAccount				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-CreateImapAccount
RUN_TEST_STEP	300	T_MsgImapServer		ChangeImap4SubAndSyncSettings	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-ChangeImap4SubAndSyncSettings
RUN_TEST_STEP	300	T_MsgImapServer		ConnectAndSyncImapServer		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-ConnectAndSyncImapServer
RUN_TEST_STEP	300	T_MsgImapServer		InitialiseImap4Account			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-InitialiseImap4Account
RUN_TEST_STEP	300	T_MsgImapServer		DoFullImap4Synchronisation		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-DoFullImap4Synchronisation
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-CheckChildrenCountRemoteInbox0
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-DisConnectImapServer
PRINT ##################################################################
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-CreateSmtpMessageFromEmailFile1
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-CreateSmtpMessageFromEmailFile2
RUN_TEST_STEP 	300 T_MsgCommonServer  	CheckChildrenCount 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-CheckChildrenCountOutbox1
//Only one "Copy from local" function call needed because in addition to the specified messages the SMTP MTM will also attempt to send in the same session any other SMTP messages that appear in the local Outbox folder
RUN_TEST_STEP 	300 T_MsgSmtpServer		SendSmtpMessage 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-SendSmtpMessages1
RUN_TEST_STEP 	300 T_MsgCommonServer  	CheckChildrenCount 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-CheckChildrenCountSentItems1
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-CheckChildrenCountRemoteInbox0
RUN_TEST_STEP	300	T_MsgImapServer		ConnectAndSyncImapServer		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-ConnectAndSyncImapServer
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-CheckChildrenCountRemoteInbox1
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-DisConnectImapServer
PRINT ##################################################################
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-CreateSmtpMessageFromEmailFile3
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-CreateSmtpMessageFromEmailFile4
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-CreateSmtpMessageFromEmailFile5
RUN_TEST_STEP 	300 T_MsgCommonServer  	CheckChildrenCount 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-CheckChildrenCountOutbox2
//Only one "Copy from local" function call needed because in addition to the specified messages the SMTP MTM will also attempt to send in the same session any other SMTP messages that appear in the local Outbox folder
RUN_TEST_STEP 	300 T_MsgSmtpServer		SendSmtpMessage 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-SendSmtpMessages2
RUN_TEST_STEP 	300 T_MsgCommonServer  	CheckChildrenCount 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-CheckChildrenCountSentItems2
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-CheckChildrenCountRemoteInbox1
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		SetImap4ServiceIdleParamters	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-TurnImapIdleOFF
RUN_TEST_STEP	300	T_MsgImapServer		ModifyImapSettings				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-TurnDownloadRulesON
RUN_TEST_STEP !Error=-1	300	T_MsgImapServer		CheckImapSyncDLRules	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-CheckImapSyncDLRulesINBOX
PRINT ##################################################################
//2nd phase synchronisation using download rules happens below...
RUN_TEST_STEP	300	T_MsgImapServer		ConnectImap4Server				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-ConnectImap4Server
RUN_TEST_STEP	300	T_MsgImapServer		InboxNewEmailsSync				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-InboxNewEmailsSync
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-CheckChildrenCountRemoteInbox2
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-IsImapMessageHeaderOnly1
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-IsImapMessageHeaderOnly2
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-IsImapMessageHeaderOnly3
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-IsImapMessageHeaderOnly4
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-IsImapMessageHeaderOnly5
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0003-DisConnectImapServer
PRINT ##################################################################

RUN_TEST_STEP	300	T_MsgCommonServer	ShutDown
RUN_TEST_STEP	300	T_MsgImapServer		ShutDown
RUN_TEST_STEP	300	T_MsgSmtpServer		ShutDown

END_TESTCASE	MSG-IMAP-DownloadRulesFetch-0019

//!	@SYMTestCaseID				MSG-IMAP-DownloadRulesFetch-0021
//!	@SYMTestCaseDesc			Positive: Maintain default behaviour during background synchronisation resulting from a new message arriving while in IDLE when no download rules are defined. (+ve)
//!	@SYMTestPriority			Critical
//!	@SYMTestType				CIT
//! @SYMREQ						6987, 6982
//! @SYMPREQ					1307
//!	@SYMTestStatus				Implemented
//!	@SYMTestCaseDependencies	Requires CED tool to be run over c:\ced_default_ras.cfg to set CommDB as required when using NTRAS for connection to Email servers.
//!								This test case should ONLY run aganist IMAP email servers that DO SUPPORT the IMAP IDLE command.
//!	@SYMTestActions				1.	Reset Message Store and Central Repository to default state.
//!								2.	Create IMAP account in Central Repository using standard settings from a configuration file.
//!								3.	Connect and sync to IMAP service using account settings and initialise account on remote IMAP server to default clean state.
//!								4.	Disconnect from IMAP service.
//!								5.	Set IMAP service settings to use IMAP IDLE command.
//!								6.	Modify the email account settings to specify it will use it's defined per bearer type list of email download rules.
//!								7.	Check that a per bearer type list of email download rules for the remote Inbox folder is not defined.
//!								8.	Connect without sync to IMAP service using account settings.
//!								9.	Create multiple messages from file and send using SMTP service to remote INBOX.
//!								10.	Check that only message headers are fetched in the remote Inbox folder as required.
//!								11.	Disconnect from IMAP service.
//!
//!	@SYMTestExpectedResults		See step 10.
//!	@SYMAuthor					Sandip Ahluwalia

START_TESTCASE	MSG-IMAP-DownloadRulesFetch-0021

RUN_TEST_STEP	300	T_MsgCommonServer	StartUp
RUN_TEST_STEP	300	T_MsgImapServer		StartUp
RUN_TEST_STEP	300	T_MsgSmtpServer		StartUp

PRINT Setup Begins #####################################################
RUN_TEST_STEP	300	T_MsgCommonServer	InitNtRas						c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0004-InitNtRas
RUN_TEST_STEP	300	T_MsgCommonServer	ResetMessageStore				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0004-ResetMessageStore
PRINT Setup Completed ##################################################
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		CreateImapAccount				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0004-CreateImapAccount
RUN_TEST_STEP	300	T_MsgImapServer		ChangeImap4SubAndSyncSettings	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0004-ChangeImap4SubAndSyncSettings
RUN_TEST_STEP	300	T_MsgImapServer		ConnectAndSyncImapServer		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0004-ConnectAndSyncImapServer
RUN_TEST_STEP	300	T_MsgImapServer		InitialiseImap4Account			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0004-InitialiseImap4Account
RUN_TEST_STEP	300	T_MsgImapServer		DoFullImap4Synchronisation		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0004-DoFullImap4Synchronisation
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0004-CheckChildrenCountRemoteInbox0
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0004-DisConnectImapServer
PRINT ##################################################################
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0004-CreateSmtpMessageFromEmailFile1
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0004-CreateSmtpMessageFromEmailFile2
RUN_TEST_STEP 	300 T_MsgCommonServer  	CheckChildrenCount 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0004-CheckChildrenCountOutbox
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		SetImap4ServiceIdleParamters	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0004-TurnImapIdleON
RUN_TEST_STEP	300	T_MsgImapServer		ModifyImapSettings				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0004-TurnDownloadRulesON
RUN_TEST_STEP !Error=-1	300	T_MsgImapServer		CheckImapSyncDLRules	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0004-CheckImapSyncDLRulesINBOX
PRINT ##################################################################
//2nd phase synchronisation using download rules happens below...
RUN_TEST_STEP	300	T_MsgImapServer		ConnectImap4Server				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0004-ConnectImap4Server
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0004-CheckChildrenCountRemoteInbox0
//Only one "Copy from local" function call needed because in addition to the specified messages the SMTP MTM will also attempt to send in the same session any other SMTP messages that appear in the local Outbox folder
RUN_TEST_STEP 	300 T_MsgSmtpServer		SendSmtpMessage 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0004-SendSmtpMessage
RUN_TEST_STEP 	300 T_MsgCommonServer  	CheckChildrenCount 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0004-CheckChildrenCountSentItems
// Delay to allow the email message to be recieved
DELAY 30000
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0004-CheckChildrenCountRemoteInbox1
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0004-IsImapMessageHeaderOnly1
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0004-IsImapMessageHeaderOnly2
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0004-DisConnectImapServer
PRINT ##################################################################

RUN_TEST_STEP	300	T_MsgCommonServer	ShutDown
RUN_TEST_STEP	300	T_MsgImapServer		ShutDown
RUN_TEST_STEP	300	T_MsgSmtpServer		ShutDown

END_TESTCASE	MSG-IMAP-DownloadRulesFetch-0021

//!	@SYMTestCaseID				MSG-IMAP-DownloadRulesFetch-0022
//!	@SYMTestCaseDesc			Positive: Maintain default behaviour while synchronising using KIMAP4MTMConnectAndSynchronise when the current bearer type is not listed. (+ve)
//!	@SYMTestPriority			Critical
//!	@SYMTestType				CIT
//! @SYMREQ						6987, 6982
//! @SYMPREQ					1307
//!	@SYMTestStatus				Implemented
//!	@SYMTestCaseDependencies	Requires CED tool to be run over c:\ced_default_ras.cfg to set CommDB as required when using NTRAS for connection to Email servers.
//!	@SYMTestActions				1.	Reset Message Store and Central Repository to default state.
//!								2.	Create IMAP account in Central Repository using standard settings from a configuration file.
//!								3.	Connect and sync to IMAP service using account settings and initialise account on remote IMAP server to default clean state.
//!								4.	Disconnect from IMAP service.
//!								5.	Create multiple messages from file and send using SMTP service to remote INBOX.
//!								6.	Create remote root-level personal folder with multiple messages (messages copied within service from INBOX using a separate IMAP a/c).
//!								7.	Set IMAP service settings to not use IMAP IDLE command.
//!								8.	Modify the email account settings to specify it will use it's defined per bearer type list of email download rules.
//!								9.	Define a per bearer type list of email download rules for both remote Inbox and the personal folder created in step 6, but don't list the current bearer type used for email server connection, i.e. CSD or LAN.
//!								10.	Connect and sync (KIMAP4MTMConnectAndSynchronise) to IMAP service using account settings and wait for background synchronisation to complete.
//!								11.	Check that only message headers are fetched in remote Inbox and the personal folder created in step 6 as required.
//!								12.	Disconnect from IMAP service.
//!
//!	@SYMTestExpectedResults		See step 11.
//!	@SYMAuthor					Sandip Ahluwalia

START_TESTCASE	MSG-IMAP-DownloadRulesFetch-0022

RUN_TEST_STEP	300	T_MsgCommonServer	StartUp
RUN_TEST_STEP	300	T_MsgImapServer		StartUp
RUN_TEST_STEP	300	T_MsgSmtpServer		StartUp

PRINT Setup Begins #####################################################
RUN_TEST_STEP	300	T_MsgCommonServer	InitNtRas						c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-InitNtRas
RUN_TEST_STEP	300	T_MsgCommonServer	ResetMessageStore				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-ResetMessageStore
PRINT Setup Completed ##################################################
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		CreateImapAccount				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-CreateImapAccount
RUN_TEST_STEP	300	T_MsgImapServer		ChangeImap4SubAndSyncSettings	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-ChangeImap4SubAndSyncSettings
RUN_TEST_STEP	300	T_MsgImapServer		ConnectAndSyncImapServer		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-ConnectAndSyncImapServer
RUN_TEST_STEP	300	T_MsgImapServer		InitialiseImap4Account			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-InitialiseImap4Account
RUN_TEST_STEP	300	T_MsgImapServer		DoFullImap4Synchronisation		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-DoFullImap4Synchronisation
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-CheckChildrenCountRemoteInbox0
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-DisConnectImapServer
PRINT ##################################################################
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-CreateSmtpMessageFromEmailFile1
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-CreateSmtpMessageFromEmailFile2
RUN_TEST_STEP 	300 T_MsgCommonServer  	CheckChildrenCount 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-CheckChildrenCountOutbox
//Only one "Copy from local" function call needed because in addition to the specified messages the SMTP MTM will also attempt to send in the same session any other SMTP messages that appear in the local Outbox folder
RUN_TEST_STEP 	300 T_MsgSmtpServer		SendSmtpMessage 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-SendSmtpMessage
RUN_TEST_STEP 	300 T_MsgCommonServer  	CheckChildrenCount 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-CheckChildrenCountSentItems
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-CheckChildrenCountRemoteInbox0
PRINT ##################################################################
//Messages copied within service from remote INBOX to remote personal folder using a separate IMAP a/c.
RUN_TEST_STEP	300	T_MsgImapServer		CreateImapAccount				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-CreateImapAccount_B
RUN_TEST_STEP	300	T_MsgImapServer		ChangeImap4SubAndSyncSettings	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-ChangeImap4SubAndSyncSettings_B
RUN_TEST_STEP	300	T_MsgImapServer		ConnectAndSyncImapServer		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-ConnectAndSyncImapServer_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-CheckChildrenCountRemoteInbox_B
RUN_TEST_STEP	300	T_MsgImapServer		CreateImap4Folder				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-CreateImap4Folder_B
RUN_TEST_STEP	300	T_MsgImapServer		FindEntryByName					c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-FindEntryByName_B
RUN_TEST_STEP	300	T_MsgImapServer		CopyImapSelectionRemote			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-CopyImapSelectionRemote_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-CheckChildrenCountRemoteTestFolder0_B
RUN_TEST_STEP	300	T_MsgImapServer		DoFullImap4Synchronisation		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-DoFullImap4Synchronisation_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-CheckChildrenCountRemoteTestFolder1_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckImap4Subscription			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-CheckSubscription1_B
RUN_TEST_STEP	300	T_MsgImapServer		SubscribeImap4Folder			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-SubscribeImap4Folder_TestFolder_B
RUN_TEST_STEP	300	T_MsgImapServer		DoFullImap4Synchronisation		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-DoFullImap4Synchronisation_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckImap4Subscription			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-CheckSubscription2_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-CheckChildrenCountRemoteTestFolder0_B
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-DisConnectImapServer_B
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		SetImap4ServiceIdleParamters	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-TurnImapIdleOFF
RUN_TEST_STEP	300	T_MsgImapServer		ModifyImapSettings				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-TurnDownloadRulesON
RUN_TEST_STEP	300	T_MsgImapServer		AddImapSyncDLRules				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-AddPerBearerListOfDLRulesINBOX
RUN_TEST_STEP	300	T_MsgImapServer		AddImapSyncDLRules				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-AddPerBearerListOfDLRulesOTHER
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-CheckChildrenCountRemoteInbox0
RUN_TEST_STEP !Error=-1	300	T_MsgImapServer		FindEntryByName			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-FindEntryByName_TestFolder
RUN_TEST_STEP	300	T_MsgImapServer		ChangeImap4SubAndSyncSettings	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-ChangeImap4SubAndSyncSettings2
PRINT ##################################################################
//2nd phase synchronisation using download rules happens below...
RUN_TEST_STEP	300	T_MsgImapServer		ConnectAndSyncImapServer		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-ConnectAndSyncImapServer
RUN_TEST_STEP 	300	T_MsgImapServer		FindEntryByName					c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-FindEntryByName_TestFolder
RUN_TEST_STEP	300	T_MsgImapServer		CheckImap4Subscription			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-CheckSubscription_TestFolder
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-CheckChildrenCountRemoteInbox1
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-CheckChildrenCountRemoteTestFolder
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-IsImapMessageHeaderOnly1
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-IsImapMessageHeaderOnly2
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-IsImapMessageHeaderOnly3
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-IsImapMessageHeaderOnly4
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0005-DisConnectImapServer
PRINT ##################################################################

RUN_TEST_STEP	300	T_MsgCommonServer	ShutDown
RUN_TEST_STEP	300	T_MsgImapServer		ShutDown
RUN_TEST_STEP	300	T_MsgSmtpServer		ShutDown

END_TESTCASE	MSG-IMAP-DownloadRulesFetch-0022

//!	@SYMTestCaseID				MSG-IMAP-DownloadRulesFetch-0024
//!	@SYMTestCaseDesc			Positive: Maintain default behaviour while synchronising using KIMAP4MTMFolderFullSync when the current bearer type is not listed. (+ve)
//!	@SYMTestPriority			Critical
//!	@SYMTestType				CIT
//! @SYMREQ						6987, 6982
//! @SYMPREQ					1307
//!	@SYMTestStatus				Implemented
//!	@SYMTestCaseDependencies	Requires CED tool to be run over c:\ced_default_ras.cfg to set CommDB as required when using NTRAS for connection to Email servers.
//!	@SYMTestActions				1.	Reset Message Store and Central Repository to default state.
//!								2.	Create IMAP account in Central Repository using standard settings from a configuration file.
//!								3.	Connect and sync to IMAP service using account settings and initialise account on remote IMAP server to default clean state.
//!								4.	Create remote root-level personal folder and remotely subscribe to it.
//!								5.	Disconnect from IMAP service.
//!								6.	Create multiple messages from file and send using SMTP service to remote INBOX.
//!								7.	Populate remote root-level personal folder with multiple messages (Messages copied within service from remote INBOX using a separate IMAP a/c).
//!								8.	Set IMAP service settings to not use IMAP IDLE command.
//!								9.	Modify the email account settings to specify it will use it's defined per bearer type list of email download rules.
//!								10.	Define a per bearer type list of email download rules for both remote Inbox and the personal folder created in step 4, but don't list the current bearer type used for email server connection, i.e. CSD or LAN.
//!								11.	Connect without sync to IMAP service using account settings. 
//!								12.	Sync down (KIMAP4MTMFolderFullSync) the personal folder created in step 4.
//!								13.	Check that only message headers are fetched in the personal folder created in step 4 as required and check that no message headers and content are fetched down in remote Inbox.
//!								14.	Disconnect from IMAP service.
//!
//!	@SYMTestExpectedResults		See step 13.
//!	@SYMAuthor					Sandip Ahluwalia

START_TESTCASE	MSG-IMAP-DownloadRulesFetch-0024

RUN_TEST_STEP	300	T_MsgCommonServer	StartUp
RUN_TEST_STEP	300	T_MsgImapServer		StartUp
RUN_TEST_STEP	300	T_MsgSmtpServer		StartUp

PRINT Setup Begins #####################################################
RUN_TEST_STEP	300	T_MsgCommonServer	InitNtRas						c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-InitNtRas
RUN_TEST_STEP	300	T_MsgCommonServer	ResetMessageStore				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-ResetMessageStore
PRINT Setup Completed ##################################################
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		CreateImapAccount				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-CreateImapAccount
RUN_TEST_STEP	300	T_MsgImapServer		ChangeImap4SubAndSyncSettings	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-ChangeImap4SubAndSyncSettings
RUN_TEST_STEP	300	T_MsgImapServer		ConnectAndSyncImapServer		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-ConnectAndSyncImapServer
RUN_TEST_STEP	300	T_MsgImapServer		InitialiseImap4Account			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-InitialiseImap4Account
RUN_TEST_STEP	300	T_MsgImapServer		DoFullImap4Synchronisation		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-DoFullImap4Synchronisation
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-CheckChildrenCountRemoteInbox0
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		CreateImap4Folder				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-CreateImap4Folder
RUN_TEST_STEP	300	T_MsgImapServer		FindEntryByName					c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-FindEntryByName_TestFolder
RUN_TEST_STEP	300	T_MsgImapServer		CheckImap4Subscription			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-CheckSubscription1
RUN_TEST_STEP	300	T_MsgImapServer		SubscribeImap4Folder			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-SubscribeImap4Folder_TestFolder
RUN_TEST_STEP	300	T_MsgImapServer		DoFullImap4Synchronisation		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-DoFullImap4Synchronisation
RUN_TEST_STEP	300	T_MsgImapServer		CheckImap4Subscription			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-CheckSubscription2
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-DisConnectImapServer
PRINT ##################################################################
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-CreateSmtpMessageFromEmailFile1
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-CreateSmtpMessageFromEmailFile2
RUN_TEST_STEP 	300 T_MsgCommonServer  	CheckChildrenCount 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-CheckChildrenCountOutbox
//Only one "Copy from local" function call needed because in addition to the specified messages the SMTP MTM will also attempt to send in the same session any other SMTP messages that appear in the local Outbox folder
RUN_TEST_STEP 	300 T_MsgSmtpServer		SendSmtpMessage 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-SendSmtpMessage
RUN_TEST_STEP 	300 T_MsgCommonServer  	CheckChildrenCount 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-CheckChildrenCountSentItems
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-CheckChildrenCountRemoteInbox0
PRINT ##################################################################
//Messages copied within service from remote INBOX to remote personal folder using a separate IMAP a/c.
RUN_TEST_STEP	300	T_MsgImapServer		CreateImapAccount				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-CreateImapAccount_B
RUN_TEST_STEP	300	T_MsgImapServer		ChangeImap4SubAndSyncSettings	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-ChangeImap4SubAndSyncSettings_B
RUN_TEST_STEP	300	T_MsgImapServer		ConnectAndSyncImapServer		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-ConnectAndSyncImapServer_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-CheckChildrenCountRemoteInbox_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-CheckChildrenCountRemoteTestFolder0_B
RUN_TEST_STEP	300	T_MsgImapServer		CopyImapSelectionRemote			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-CopyImapSelectionRemote_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-CheckChildrenCountRemoteTestFolder1_B
RUN_TEST_STEP	300	T_MsgImapServer		DoFullImap4Synchronisation		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-DoFullImap4Synchronisation_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-CheckChildrenCountRemoteTestFolder1_B
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-DisConnectImapServer_B
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		SetImap4ServiceIdleParamters	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-TurnImapIdleOFF
RUN_TEST_STEP	300	T_MsgImapServer		ModifyImapSettings				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-TurnDownloadRulesON
RUN_TEST_STEP	300	T_MsgImapServer		AddImapSyncDLRules				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-AddPerBearerListOfDLRulesINBOX
RUN_TEST_STEP	300	T_MsgImapServer		AddImapSyncDLRules				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-AddPerBearerListOfDLRulesOTHER
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-CheckChildrenCountRemoteInbox0
RUN_TEST_STEP	300 T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-CheckChildrenCountRemoteTestFolder0
PRINT ##################################################################
//2nd phase synchronisation using download rules happens below...
RUN_TEST_STEP	300	T_MsgImapServer		ConnectImap4Server				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-ConnectImap4Server
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-CheckChildrenCountRemoteInbox0
RUN_TEST_STEP	300 T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-CheckChildrenCountRemoteTestFolder0
RUN_TEST_STEP	300	T_MsgImapServer		FolderFullSync					c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-FolderFullSync
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-CheckChildrenCountRemoteTestFolder1
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-CheckChildrenCountRemoteInbox0
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-IsImapMessageHeaderOnly1
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-IsImapMessageHeaderOnly2
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0006-DisConnectImapServer
PRINT ##################################################################

RUN_TEST_STEP	300	T_MsgCommonServer	ShutDown
RUN_TEST_STEP	300	T_MsgImapServer		ShutDown
RUN_TEST_STEP	300	T_MsgSmtpServer		ShutDown

END_TESTCASE	MSG-IMAP-DownloadRulesFetch-0024

//!	@SYMTestCaseID				MSG-IMAP-DownloadRulesFetch-0026
//!	@SYMTestCaseDesc			Positive: Maintain default behaviour while synchronising using KIMAP4MTMInboxNewSync when the current bearer type is not listed. (+ve)
//!	@SYMTestPriority			Critical
//!	@SYMTestType				CIT
//! @SYMREQ						6987, 6982
//! @SYMPREQ					1307
//!	@SYMTestStatus				Implemented
//!	@SYMTestCaseDependencies	Requires CED tool to be run over c:\ced_default_ras.cfg to set CommDB as required when using NTRAS for connection to Email servers.
//!	@SYMTestActions				1.	Reset Message Store and Central Repository to default state.
//!								2.	Create IMAP account in Central Repository using standard settings from a configuration file.
//!								3.	Connect and sync to IMAP service using account settings and initialise account on remote IMAP server to default clean state.
//!								4.	Disconnect from IMAP service.
//!								5.	Create 2 messages from file and send using SMTP service to remote INBOX.
//!								6.	Connect and sync to IMAP service using account settings.
//!								7.	Check that the 2 message headers are fetched in remote INBOX as normal.
//!								8.	Disconnect from IMAP service.
//!								9.	Create further 3 messages from file and send using SMTP service to remote INBOX.
//!								10.	Set IMAP service settings to not use IMAP IDLE command.
//!								11.	Modify the email account settings to specify it will use it's defined per bearer type list of email download rules.
//!								12.	Define a per bearer type list of email download rules for both remote Inbox and the personal folder created in step 6, but don't list the current bearer type used for email server connection, i.e. CSD or LAN.
//!								13.	Connect without sync to IMAP service using account settings. 
//!								14.	Sync down (KIMAP4MTMInboxNewSync) the remote Inbox.
//!								15.	Check that only message headers are fetched in the remote Inbox folder as required for first 2 messages sent in step 5 and last 3 messages sent in step 9.
//!								16.	Disconnect from IMAP service.
//!
//!	@SYMTestExpectedResults		See step 15.
//!	@SYMAuthor					Sandip Ahluwalia

START_TESTCASE	MSG-IMAP-DownloadRulesFetch-0026

RUN_TEST_STEP	300	T_MsgCommonServer	StartUp
RUN_TEST_STEP	300	T_MsgImapServer		StartUp
RUN_TEST_STEP	300	T_MsgSmtpServer		StartUp

PRINT Setup Begins #####################################################
RUN_TEST_STEP	300	T_MsgCommonServer	InitNtRas						c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-InitNtRas
RUN_TEST_STEP	300	T_MsgCommonServer	ResetMessageStore				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-ResetMessageStore
PRINT Setup Completed ##################################################
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		CreateImapAccount				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-CreateImapAccount
RUN_TEST_STEP	300	T_MsgImapServer		ChangeImap4SubAndSyncSettings	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-ChangeImap4SubAndSyncSettings
RUN_TEST_STEP	300	T_MsgImapServer		ConnectAndSyncImapServer		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-ConnectAndSyncImapServer
RUN_TEST_STEP	300	T_MsgImapServer		InitialiseImap4Account			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-InitialiseImap4Account
RUN_TEST_STEP	300	T_MsgImapServer		DoFullImap4Synchronisation		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-DoFullImap4Synchronisation
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-CheckChildrenCountRemoteInbox0
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-DisConnectImapServer
PRINT ##################################################################
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-CreateSmtpMessageFromEmailFile1
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-CreateSmtpMessageFromEmailFile2
RUN_TEST_STEP 	300 T_MsgCommonServer  	CheckChildrenCount 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-CheckChildrenCountOutbox1
//Only one "Copy from local" function call needed because in addition to the specified messages the SMTP MTM will also attempt to send in the same session any other SMTP messages that appear in the local Outbox folder
RUN_TEST_STEP 	300 T_MsgSmtpServer		SendSmtpMessage 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-SendSmtpMessages1
RUN_TEST_STEP 	300 T_MsgCommonServer  	CheckChildrenCount 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-CheckChildrenCountSentItems1
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-CheckChildrenCountRemoteInbox0
RUN_TEST_STEP	300	T_MsgImapServer		ConnectAndSyncImapServer		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-ConnectAndSyncImapServer
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-CheckChildrenCountRemoteInbox1
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-DisConnectImapServer
PRINT ##################################################################
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-CreateSmtpMessageFromEmailFile3
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-CreateSmtpMessageFromEmailFile4
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-CreateSmtpMessageFromEmailFile5
RUN_TEST_STEP 	300 T_MsgCommonServer  	CheckChildrenCount 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-CheckChildrenCountOutbox2
//Only one "Copy from local" function call needed because in addition to the specified messages the SMTP MTM will also attempt to send in the same session any other SMTP messages that appear in the local Outbox folder
RUN_TEST_STEP 	300 T_MsgSmtpServer		SendSmtpMessage 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-SendSmtpMessages2
RUN_TEST_STEP 	300 T_MsgCommonServer  	CheckChildrenCount 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-CheckChildrenCountSentItems2
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-CheckChildrenCountRemoteInbox1
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		SetImap4ServiceIdleParamters	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-TurnImapIdleOFF
RUN_TEST_STEP	300	T_MsgImapServer		ModifyImapSettings				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-TurnDownloadRulesON
RUN_TEST_STEP	300	T_MsgImapServer		AddImapSyncDLRules				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-AddPerBearerListOfDLRulesINBOX
PRINT ##################################################################
//2nd phase synchronisation using download rules happens below...
RUN_TEST_STEP	300	T_MsgImapServer		ConnectImap4Server				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-ConnectImap4Server
RUN_TEST_STEP	300	T_MsgImapServer		InboxNewEmailsSync				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-InboxNewEmailsSync
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-CheckChildrenCountRemoteInbox2
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-IsImapMessageHeaderOnly1
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-IsImapMessageHeaderOnly2
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-IsImapMessageHeaderOnly3
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-IsImapMessageHeaderOnly4
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-IsImapMessageHeaderOnly5
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0007-DisConnectImapServer
PRINT ##################################################################

RUN_TEST_STEP	300	T_MsgCommonServer	ShutDown
RUN_TEST_STEP	300	T_MsgImapServer		ShutDown
RUN_TEST_STEP	300	T_MsgSmtpServer		ShutDown

END_TESTCASE	MSG-IMAP-DownloadRulesFetch-0026

//!	@SYMTestCaseID				MSG-IMAP-DownloadRulesFetch-0028
//!	@SYMTestCaseDesc			Positive: Maintain default behaviour during background synchronisation resulting from a new message arriving while in IDLE when the current bearer type is not listed. (+ve)
//!	@SYMTestPriority			Critical
//!	@SYMTestType				CIT
//! @SYMREQ						6987, 6982
//! @SYMPREQ					1307
//!	@SYMTestStatus				Implemented
//!	@SYMTestCaseDependencies	Requires CED tool to be run over c:\ced_default_ras.cfg to set CommDB as required when using NTRAS for connection to Email servers.
//!								This test case should ONLY run aganist IMAP email servers that DO SUPPORT the IMAP IDLE command.
//!	@SYMTestActions				1.	Reset Message Store and Central Repository to default state.
//!								2.	Create IMAP account in Central Repository using standard settings from a configuration file.
//!								3.	Connect and sync to IMAP service using account settings and initialise account on remote IMAP server to default clean state.
//!								4.	Disconnect from IMAP service.
//!								5.	Set IMAP service settings to use IMAP IDLE command.
//!								6.	Modify the email account settings to specify it will use it's defined per bearer type list of email download rules.
//!								7.	Define a per bearer type list of email download rules for remote Inbox, but don't list the current bearer type used for email server connection, i.e. CSD or LAN.
//!								8.	Connect without sync to IMAP service using account settings.
//!								9.	Create multiple messages from file and send using SMTP service to remote INBOX.
//!								10.	Check that only message headers are fetched in the remote Inbox folder as required.
//!								11.	Disconnect from IMAP service.
//!
//!	@SYMTestExpectedResults		See step 10.
//!	@SYMAuthor					Sandip Ahluwalia

START_TESTCASE	MSG-IMAP-DownloadRulesFetch-0028

RUN_TEST_STEP	300	T_MsgCommonServer	StartUp
RUN_TEST_STEP	300	T_MsgImapServer		StartUp
RUN_TEST_STEP	300	T_MsgSmtpServer		StartUp

PRINT Setup Begins #####################################################
RUN_TEST_STEP	300	T_MsgCommonServer	InitNtRas						c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0008-InitNtRas
RUN_TEST_STEP	300	T_MsgCommonServer	ResetMessageStore				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0008-ResetMessageStore
PRINT Setup Completed ##################################################
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		CreateImapAccount				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0008-CreateImapAccount
RUN_TEST_STEP	300	T_MsgImapServer		ChangeImap4SubAndSyncSettings	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0008-ChangeImap4SubAndSyncSettings
RUN_TEST_STEP	300	T_MsgImapServer		ConnectAndSyncImapServer		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0008-ConnectAndSyncImapServer
RUN_TEST_STEP	300	T_MsgImapServer		InitialiseImap4Account			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0008-InitialiseImap4Account
RUN_TEST_STEP	300	T_MsgImapServer		DoFullImap4Synchronisation		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0008-DoFullImap4Synchronisation
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0008-CheckChildrenCountRemoteInbox0
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0008-DisConnectImapServer
PRINT ##################################################################
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0008-CreateSmtpMessageFromEmailFile1
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0008-CreateSmtpMessageFromEmailFile2
RUN_TEST_STEP 	300 T_MsgCommonServer  	CheckChildrenCount 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0008-CheckChildrenCountOutbox
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		SetImap4ServiceIdleParamters	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0008-TurnImapIdleON
RUN_TEST_STEP	300	T_MsgImapServer		ModifyImapSettings				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0008-TurnDownloadRulesON
RUN_TEST_STEP	300	T_MsgImapServer		AddImapSyncDLRules				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0008-AddPerBearerListOfDLRulesINBOX
PRINT ##################################################################
//2nd phase synchronisation using download rules happens below...
RUN_TEST_STEP	300	T_MsgImapServer		ConnectImap4Server				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0008-ConnectImap4Server
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0008-CheckChildrenCountRemoteInbox0
//Only one "Copy from local" function call needed because in addition to the specified messages the SMTP MTM will also attempt to send in the same session any other SMTP messages that appear in the local Outbox folder
RUN_TEST_STEP 	300 T_MsgSmtpServer		SendSmtpMessage 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0008-SendSmtpMessage
RUN_TEST_STEP 	300 T_MsgCommonServer  	CheckChildrenCount 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0008-CheckChildrenCountSentItems
// Delay to allow the email message to be recieved
DELAY 30000
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0008-CheckChildrenCountRemoteInbox1
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0008-IsImapMessageHeaderOnly1
RUN_TEST_STEP	300 T_MsgImapServer  	IsImapMessageHeaderOnly 		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0008-IsImapMessageHeaderOnly2
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0008-DisConnectImapServer
PRINT ##################################################################

RUN_TEST_STEP	300	T_MsgCommonServer	ShutDown
RUN_TEST_STEP	300	T_MsgImapServer		ShutDown
RUN_TEST_STEP	300	T_MsgSmtpServer		ShutDown

END_TESTCASE	MSG-IMAP-DownloadRulesFetch-0028

//!	@SYMTestCaseID				MSG-IMAP-DownloadRulesFetch-0029
//!	@SYMTestCaseDesc			Positive: When download rule options specify "body text only" for synchronising using KIMAP4MTMConnectAndSynchronise then check the downloaded messages meet the rule. (+ve)
//!	@SYMTestPriority			Critical
//!	@SYMTestType				CIT
//! @SYMREQ						6987, 6982
//! @SYMPREQ					1307
//!	@SYMTestStatus				Implemented
//!	@SYMTestCaseDependencies	Requires CED tool to be run over c:\ced_default_ras.cfg to set CommDB as required when using NTRAS for connection to Email servers.
//!	@SYMTestActions				1.	Reset Message Store and Central Repository to default state.
//!								2.	Create IMAP account in Central Repository using standard settings from a configuration file.
//!								3.	Connect and sync to IMAP service using account settings and initialise account on remote IMAP server to default clean state.
//!								4.	Disconnect from IMAP service.
//!								5.	Create multiple messages with attachments from file and send using SMTP service to remote INBOX.
//!								6.	Create remote root-level personal folder with multiple messages that have attachments (messages copied within service from INBOX using a separate IMAP a/c).
//!								7.	Set IMAP service settings to not use IMAP IDLE command.
//!								8.	Modify the email account settings to specify it will use it's defined per bearer type list of email download rules.
//!								9.	Define a per bearer type list of email download rules for both remote Inbox and the personal folder created in step 6 specifying to download only body texts.
//!								10.	Connect and sync (KIMAP4MTMConnectAndSynchronise) to IMAP service using account settings and wait for both background and 2nd phase synchronisation using download rules to complete.
//!								11.	Check that messages are fetched in remote Inbox and the personal folder created in step 6 as required according to the download rules defined in step 9, i.e. only headers + body texts are downloaded.
//!								12.	Disconnect from IMAP service.
//!
//!	@SYMTestExpectedResults		See step 11.
//!	@SYMAuthor					Sandip Ahluwalia

START_TESTCASE	MSG-IMAP-DownloadRulesFetch-0029

RUN_TEST_STEP	300	T_MsgCommonServer	StartUp
RUN_TEST_STEP	300	T_MsgImapServer		StartUp
RUN_TEST_STEP	300	T_MsgSmtpServer		StartUp

PRINT Setup Begins #####################################################
RUN_TEST_STEP	300	T_MsgCommonServer	InitNtRas						c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-InitNtRas
RUN_TEST_STEP	300	T_MsgCommonServer	ResetMessageStore				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-ResetMessageStore
PRINT Setup Completed ##################################################
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		CreateImapAccount				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-CreateImapAccount
RUN_TEST_STEP	300	T_MsgImapServer		ChangeImap4SubAndSyncSettings	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-ChangeImap4SubAndSyncSettings
RUN_TEST_STEP	300	T_MsgImapServer		ConnectAndSyncImapServer		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-ConnectAndSyncImapServer
RUN_TEST_STEP	300	T_MsgImapServer		InitialiseImap4Account			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-InitialiseImap4Account
RUN_TEST_STEP	300	T_MsgImapServer		DoFullImap4Synchronisation		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-DoFullImap4Synchronisation
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-CheckChildrenCountRemoteInbox0
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-DisConnectImapServer
PRINT ##################################################################
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-CreateSmtpMessageFromEmailFile1
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-CreateSmtpMessageFromEmailFile2
RUN_TEST_STEP 	300 T_MsgCommonServer  	CheckChildrenCount 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-CheckChildrenCountOutbox
//Only one "Copy from local" function call needed because in addition to the specified messages the SMTP MTM will also attempt to send in the same session any other SMTP messages that appear in the local Outbox folder
RUN_TEST_STEP 	300 T_MsgSmtpServer		SendSmtpMessage 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-SendSmtpMessage
RUN_TEST_STEP 	300 T_MsgCommonServer  	CheckChildrenCount 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-CheckChildrenCountSentItems
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-CheckChildrenCountRemoteInbox0
PRINT ##################################################################
//Messages copied within service from remote INBOX to remote personal folder using a separate IMAP a/c.
RUN_TEST_STEP	300	T_MsgImapServer		CreateImapAccount				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-CreateImapAccount_B
RUN_TEST_STEP	300	T_MsgImapServer		ChangeImap4SubAndSyncSettings	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-ChangeImap4SubAndSyncSettings_B
RUN_TEST_STEP	300	T_MsgImapServer		ConnectAndSyncImapServer		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-ConnectAndSyncImapServer_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-CheckChildrenCountRemoteInbox_B
RUN_TEST_STEP	300	T_MsgImapServer		CreateImap4Folder				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-CreateImap4Folder_B
RUN_TEST_STEP	300	T_MsgImapServer		FindEntryByName					c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-FindEntryByName_B
RUN_TEST_STEP	300	T_MsgImapServer		CopyImapSelectionRemote			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-CopyImapSelectionRemote_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-CheckChildrenCountRemoteTestFolder0_B
RUN_TEST_STEP	300	T_MsgImapServer		DoFullImap4Synchronisation		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-DoFullImap4Synchronisation_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-CheckChildrenCountRemoteTestFolder1_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckImap4Subscription			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-CheckSubscription1_B
RUN_TEST_STEP	300	T_MsgImapServer		SubscribeImap4Folder			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-SubscribeImap4Folder_TestFolder_B
RUN_TEST_STEP	300	T_MsgImapServer		DoFullImap4Synchronisation		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-DoFullImap4Synchronisation_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckImap4Subscription			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-CheckSubscription2_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-CheckChildrenCountRemoteTestFolder0_B
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-DisConnectImapServer_B
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		SetImap4ServiceIdleParamters	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-TurnImapIdleOFF
RUN_TEST_STEP	300	T_MsgImapServer		ModifyImapSettings				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-TurnDownloadRulesON
RUN_TEST_STEP	300	T_MsgImapServer		AddImapSyncDLRules				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-AddPerBearerListOfDLRulesINBOX
RUN_TEST_STEP	300	T_MsgImapServer		AddImapSyncDLRules				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-AddPerBearerListOfDLRulesOTHER
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-CheckChildrenCountRemoteInbox0
RUN_TEST_STEP !Error=-1	300	T_MsgImapServer		FindEntryByName			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-FindEntryByName_TestFolder
RUN_TEST_STEP	300	T_MsgImapServer		ChangeImap4SubAndSyncSettings	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-ChangeImap4SubAndSyncSettings2
PRINT ##################################################################
//2nd phase synchronisation using download rules happens below...
RUN_TEST_STEP	300	T_MsgImapServer		ConnectAndSyncImapServer		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-ConnectAndSyncImapServer
RUN_TEST_STEP 	300	T_MsgImapServer		FindEntryByName					c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-FindEntryByName_TestFolder
RUN_TEST_STEP	300	T_MsgImapServer		CheckImap4Subscription			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-CheckSubscription_TestFolder
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-CheckChildrenCountRemoteInbox1
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-CheckChildrenCountRemoteTestFolder
RUN_TEST_STEP 	300 T_MsgImapServer  	CompareEmailMessages 			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-CompareEmailMessagesInbox
RUN_TEST_STEP 	300 T_MsgImapServer  	CompareEmailMessages 			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-CompareEmailMessagesTestFolder
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0009-DisConnectImapServer
PRINT ##################################################################

RUN_TEST_STEP	300	T_MsgCommonServer	ShutDown
RUN_TEST_STEP	300	T_MsgImapServer		ShutDown
RUN_TEST_STEP	300	T_MsgSmtpServer		ShutDown

END_TESTCASE	MSG-IMAP-DownloadRulesFetch-0029

//!	@SYMTestCaseID				MSG-IMAP-DownloadRulesFetch-0031
//!	@SYMTestCaseDesc			Positive: When download rule options specify "body text only" for synchronising using KIMAP4MTMFolderFullSync then check the downloaded messages meet the rule. (+ve)
//!	@SYMTestPriority			Critical
//!	@SYMTestType				CIT
//! @SYMREQ						6987, 6982
//! @SYMPREQ					1307
//!	@SYMTestStatus				Implemented
//!	@SYMTestCaseDependencies	Requires CED tool to be run over c:\ced_default_ras.cfg to set CommDB as required when using NTRAS for connection to Email servers.
//!	@SYMTestActions				1.	Reset Message Store and Central Repository to default state.
//!								2.	Create IMAP account in Central Repository using standard settings from a configuration file.
//!								3.	Connect and sync to IMAP service using account settings and initialise account on remote IMAP server to default clean state.
//!								4.	Create remote root-level personal folder and remotely subscribe to it.
//!								5.	Disconnect from IMAP service.
//!								6.	Create multiple messages with attachments from file and send using SMTP service to remote INBOX.
//!								7.	Populate remote root-level personal folder with multiple messages that have attachments (messages copied within service from remote INBOX using a separate IMAP a/c).
//!								8.	Set IMAP service settings to not use IMAP IDLE command.
//!								9.	Modify the email account settings to specify it will use it's defined per bearer type list of email download rules.
//!								10.	Define a per bearer type list of email download rules for both remote Inbox and the personal folder created in step 4 specifying to download only body texts.
//!								11.	Connect without sync to IMAP service using account settings.
//!								12.	Sync down (KIMAP4MTMFolderFullSync) the personal folder created in step 4.
//!								13.	Check that messages are fetched in the personal folder created in step 4 as required according to the download rules defined in step 10, i.e. only headers + body texts are downloaded, and check that no message headers and content are fetched down in remote Inbox.
//!								14.	Disconnect from IMAP service.
//!
//!	@SYMTestExpectedResults		See step 13.
//!	@SYMAuthor					Sandip Ahluwalia

START_TESTCASE	MSG-IMAP-DownloadRulesFetch-0031

RUN_TEST_STEP	300	T_MsgCommonServer	StartUp
RUN_TEST_STEP	300	T_MsgImapServer		StartUp
RUN_TEST_STEP	300	T_MsgSmtpServer		StartUp

PRINT Setup Begins #####################################################
RUN_TEST_STEP	300	T_MsgCommonServer	InitNtRas						c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-InitNtRas
RUN_TEST_STEP	300	T_MsgCommonServer	ResetMessageStore				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-ResetMessageStore
PRINT Setup Completed ##################################################
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		CreateImapAccount				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-CreateImapAccount
RUN_TEST_STEP	300	T_MsgImapServer		ChangeImap4SubAndSyncSettings	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-ChangeImap4SubAndSyncSettings
RUN_TEST_STEP	300	T_MsgImapServer		ConnectAndSyncImapServer		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-ConnectAndSyncImapServer
RUN_TEST_STEP	300	T_MsgImapServer		InitialiseImap4Account			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-InitialiseImap4Account
RUN_TEST_STEP	300	T_MsgImapServer		DoFullImap4Synchronisation		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-DoFullImap4Synchronisation
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-CheckChildrenCountRemoteInbox0
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		CreateImap4Folder				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-CreateImap4Folder
RUN_TEST_STEP	300	T_MsgImapServer		FindEntryByName					c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-FindEntryByName_TestFolder
RUN_TEST_STEP	300	T_MsgImapServer		CheckImap4Subscription			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-CheckSubscription1
RUN_TEST_STEP	300	T_MsgImapServer		SubscribeImap4Folder			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-SubscribeImap4Folder_TestFolder
RUN_TEST_STEP	300	T_MsgImapServer		DoFullImap4Synchronisation		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-DoFullImap4Synchronisation
RUN_TEST_STEP	300	T_MsgImapServer		CheckImap4Subscription			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-CheckSubscription2
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-DisConnectImapServer
PRINT ##################################################################
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-CreateSmtpMessageFromEmailFile1
RUN_TEST_STEP 	300 T_MsgSmtpServer		CreateSmtpMessageFromEmailFile 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-CreateSmtpMessageFromEmailFile2
RUN_TEST_STEP 	300 T_MsgCommonServer  	CheckChildrenCount 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-CheckChildrenCountOutbox
//Only one "Copy from local" function call needed because in addition to the specified messages the SMTP MTM will also attempt to send in the same session any other SMTP messages that appear in the local Outbox folder
RUN_TEST_STEP 	300 T_MsgSmtpServer		SendSmtpMessage 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-SendSmtpMessage
RUN_TEST_STEP 	300 T_MsgCommonServer  	CheckChildrenCount 				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-CheckChildrenCountSentItems
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-CheckChildrenCountRemoteInbox0
PRINT ##################################################################
//Messages copied within service from remote INBOX to remote personal folder using a separate IMAP a/c.
RUN_TEST_STEP	300	T_MsgImapServer		CreateImapAccount				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-CreateImapAccount_B
RUN_TEST_STEP	300	T_MsgImapServer		ChangeImap4SubAndSyncSettings	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-ChangeImap4SubAndSyncSettings_B
RUN_TEST_STEP	300	T_MsgImapServer		ConnectAndSyncImapServer		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-ConnectAndSyncImapServer_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-CheckChildrenCountRemoteInbox_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-CheckChildrenCountRemoteTestFolder0_B
RUN_TEST_STEP	300	T_MsgImapServer		CopyImapSelectionRemote			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-CopyImapSelectionRemote_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-CheckChildrenCountRemoteTestFolder1_B
RUN_TEST_STEP	300	T_MsgImapServer		DoFullImap4Synchronisation		c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-DoFullImap4Synchronisation_B
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-CheckChildrenCountRemoteTestFolder1_B
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-DisConnectImapServer_B
PRINT ##################################################################
RUN_TEST_STEP	300	T_MsgImapServer		SetImap4ServiceIdleParamters	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-TurnImapIdleOFF
RUN_TEST_STEP	300	T_MsgImapServer		ModifyImapSettings				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-TurnDownloadRulesON
RUN_TEST_STEP	300	T_MsgImapServer		AddImapSyncDLRules				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-AddPerBearerListOfDLRulesINBOX
RUN_TEST_STEP	300	T_MsgImapServer		AddImapSyncDLRules				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-AddPerBearerListOfDLRulesOTHER
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-CheckChildrenCountRemoteInbox0
RUN_TEST_STEP	300 T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-CheckChildrenCountRemoteTestFolder0
PRINT ##################################################################
//2nd phase synchronisation using download rules happens below...
RUN_TEST_STEP	300	T_MsgImapServer		ConnectImap4Server				c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-ConnectImap4Server
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-CheckChildrenCountRemoteInbox0
RUN_TEST_STEP	300 T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-CheckChildrenCountRemoteTestFolder0
RUN_TEST_STEP	300	T_MsgImapServer		FolderFullSync					c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-FolderFullSync
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-CheckChildrenCountRemoteTestFolder1
RUN_TEST_STEP	300	T_MsgImapServer		CheckChildrenCountImap			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-CheckChildrenCountRemoteInbox0
RUN_TEST_STEP !Result=Fail 300 T_MsgImapServer  CompareEmailMessages 	c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-CompareEmailMessagesInbox
RUN_TEST_STEP	300 T_MsgImapServer  	CompareEmailMessages 			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-CompareEmailMessagesTestFolder
RUN_TEST_STEP	300	T_MsgImapServer		DisConnectImapServer			c:\msgtest\email\imap\downloadrules\msg-imap-downloadrules2.ini	0010-DisConnectImapServer
PRINT ##################################################################

RUN_TEST_STEP	300	T_MsgCommonServer	ShutDown
RUN_TEST_STEP	300	T_MsgImapServer		ShutDown
RUN_TEST_STEP	300	T_MsgSmtpServer		ShutDown

END_TESTCASE	MSG-IMAP-DownloadRulesFetch-0031
