//
// 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


START_TESTCASE MSG-IMAP-HEADER-0001
//! 	@SYMTestCaseDesc	Verification of header parts for multiple messages with multiple different receipents
//!				
//! 	@SYMTestPriority	High
//! 	@SYMTestStatus 		Implemented
//!				
//!	@SYMPREQ 		PREQ2073
//!	@SYMREQ			REQ11120, REQ11156, REQ11158, REQ11161
//!				
//! 	@SYMTestActions		1.	Initialize the NT-RAS
//!				2.	Reset the Message Store in a cleanup state
//!				3.	Create a IMAP account 
//!				4.	Connect and Synchronize the POP server using IMAP account
//!				5.	Initialize IMAP account in a cleanup state
//!				6.	Disconnect IMAP server
//!				7.	Create first Message with multiple different addresses in To , Cc, and Bcc
//!				8.	Send the Messages
//!				9.	Create second Message with multiple different addresses in To , Cc, and Bcc
//!				10.	Send the Messages
//!				11.	Connect to the IMAP server
//!				12.	Download the Messages using IMAP client MTM populate command 
//!				13.	Disconnect IMAP server
//!				14.	Verify header parts for all messages in Inbox folder
//!				
//! 	@SYMTestExpectedResults Ensure all the header parts are verified without any error
//!	@SYMAuthor		Rajat Bal
//! 	@SYMTestType		CIT

PRINT Setup Begins #####################################################

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

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

RUN_TEST_STEP 300 T_MsgCommonServer 	InitNtRas			c:\msgtest\email\imap\header\msg-imap-header1.ini 	0001-InitNtRas
RUN_TEST_STEP 300 T_MsgCommonServer 	ResetMessageStore		c:\msgtest\email\imap\header\msg-imap-header1.ini 	0001-ResetMessageStore
RUN_TEST_STEP 300 T_MsgImapServer 	CreateImapAccount		c:\msgtest\email\imap\header\msg-imap-header1.ini 	0001-CreateImapAccount

RUN_TEST_STEP 300 T_MsgImapServer	ChangeImap4SubAndSyncSettings	c:\msgtest\email\imap\header\msg-imap-header1.ini 	0001-ChangeImapSettings
RUN_TEST_STEP 300 T_MsgImapServer	ConnectAndSyncImapServer	c:\msgtest\email\imap\header\msg-imap-header1.ini 	0001-ConnectAndSyncImapServer
RUN_TEST_STEP 300 T_MsgImapServer	InitialiseImap4Account		c:\msgtest\email\imap\header\msg-imap-header1.ini 	0001-InitialiseImap4Account
RUN_TEST_STEP 300 T_MsgImapServer	DoFullImap4Synchronisation	c:\msgtest\email\imap\header\msg-imap-header1.ini 	0001-DoFullImap4Synchronisation
RUN_TEST_STEP 300 T_MsgImapServer	CheckChildrenCountImap		c:\msgtest\email\imap\header\msg-imap-header1.ini 	0001-CheckChildrenCountRemoteInbox
RUN_TEST_STEP 300 T_MsgImapServer	DisConnectImapServer		c:\msgtest\email\imap\header\msg-imap-header1.ini 	0001-DisConnectImap4Server

PRINT ############ Create first Message with multiple different addresses in To , Cc, and Bcc #########################  
RUN_TEST_STEP 300 T_MsgSmtpServer 	CreateSmtpMessageFromEmailFile	c:\msgtest\email\imap\header\msg-imap-header1.ini 	0001-CreateSmtpMessageFromEmailFile1
RUN_TEST_STEP 300 T_MsgCommonServer 	CheckChildrenCount 		c:\msgtest\email\imap\header\msg-imap-header1.ini 	0001-CheckChildrenCountOutbox1
RUN_TEST_STEP 300 T_MsgCommonServer	VerifyHeaders	 		c:\msgtest\email\imap\header\msg-imap-header1.ini  	0001-VerifyHeaders_Outbox1
RUN_TEST_STEP 300 T_MsgSmtpServer	SendSmtpMessage			c:\msgtest\email\imap\header\msg-imap-header1.ini 	0001-SendSmtpMessage1
RUN_TEST_STEP 300 T_MsgCommonServer 	CheckChildrenCount 		c:\msgtest\email\imap\header\msg-imap-header1.ini 	0001-CheckChildrenCountSentItems1

PRINT ############ Create second Message with multiple different addresses in To , Cc, and Bcc ########################
RUN_TEST_STEP 300 T_MsgSmtpServer 	CreateSmtpMessageFromEmailFile	c:\msgtest\email\imap\header\msg-imap-header1.ini 	0001-CreateSmtpMessageFromEmailFile2
RUN_TEST_STEP 300 T_MsgCommonServer 	CheckChildrenCount 		c:\msgtest\email\imap\header\msg-imap-header1.ini 	0001-CheckChildrenCountOutbox2
RUN_TEST_STEP 300 T_MsgCommonServer	VerifyHeaders	 		c:\msgtest\email\imap\header\msg-imap-header1.ini  	0001-VerifyHeaders_Outbox2
RUN_TEST_STEP 300 T_MsgSmtpServer	SendSmtpMessage			c:\msgtest\email\imap\header\msg-imap-header1.ini 	0001-SendSmtpMessage2
RUN_TEST_STEP 300 T_MsgCommonServer 	CheckChildrenCount 		c:\msgtest\email\imap\header\msg-imap-header1.ini 	0001-CheckChildrenCountSentItems2

RUN_TEST_STEP 300 T_MsgImapServer	SetImap4FullDownloadLimits	c:\msgtest\email\imap\header\msg-imap-header1.ini 	0001-SetImap4FullDownloadLimits
RUN_TEST_STEP 300 T_MsgImapServer 	ConnectImap4Server		c:\msgtest\email\imap\header\msg-imap-header1.ini 	0001-ConnectImap4Server
RUN_TEST_STEP 300 T_MsgImapServer 	DoFullImap4Synchronisation	c:\msgtest\email\imap\header\msg-imap-header1.ini 	0001-DoFullImap4Synchronisation
RUN_TEST_STEP 300 T_MsgImapServer 	ImapInvokeAsyncFunction		c:\msgtest\email\imap\header\msg-imap-header1.ini 	0001-ImapInvokeAsyncFunction
RUN_TEST_STEP 300 T_MsgImapServer 	DisConnectImapServer		c:\msgtest\email\imap\header\msg-imap-header1.ini 	0001-DisConnectImap4Server

PRINT ############ Verify header parts for all messages in Inbox folder #######
RUN_TEST_STEP 300 T_MsgImapServer 	VerifyHeaders			c:\msgtest\email\imap\header\msg-imap-header1.ini  	0001-VerifyHeaders

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

PRINT Execute Completed ################################################
END_TESTCASE MSG-IMAP-HEADER-0001

