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


START_TESTCASE	MSG-IMAP-CONNECT-0001

//!	@SYMTestCaseID			MSG-IMAP-CONNECT-0001
//!	@SYMTestCaseDesc			This test checks that we can connect to an IMAP server and that
//!                                     		a folder called "Inbox" is created.
//!	@SYMTestPriority			Critical
//!   	@SYMTestType				CIT
//!  	@SYMTestStatus				Implemented   
//!	@SYMTestCaseDependencies	requires ced -i c:\ced_default_ras.cfg to set comms.
//!	@SYMTestActions			Initialises the RAS connection
//!							Resets the message store to clean up the central repository
//!							Creates an IMAP account
//!							Connects to the IMAP server and performs a synchronisation
//!							Checks that the Inbox exists
//!							Disconnects from the server
//!	@SYMTestExpectedResults		EPass - Connection made and Inbox found
//!	@SYMAuthor				Rajat Bal & Robert Heal

PRINT Setup Begins #####################################################
PRINT **** msg-imap-connect-0001 ****

RUN_TEST_STEP	300	T_MsgCommonServer	StartUp
RUN_TEST_STEP	300	T_MsgImapServer		StartUp

RUN_TEST_STEP	300	T_MsgCommonServer	InitNtRas			c:\msgtest\email\imap\connect\msg-imap-connect1.ini 	0001-InitNtRas
RUN_TEST_STEP	300	T_MsgCommonServer	ResetMessageStore		c:\msgtest\email\imap\connect\msg-imap-connect1.ini 		0001-ResetMessageStore
RUN_TEST_STEP 	300 	T_MsgImapServer		CreateImapAccount 		c:\msgtest\email\imap\connect\msg-imap-connect1.ini 	0001-CreateImapAccount 
RUN_TEST_STEP 	300 	T_MsgImapServer		ConnectImap4Server		c:\msgtest\email\imap\connect\msg-imap-connect1.ini 	0001-ConnectImap4Server
RUN_TEST_STEP	100	T_MsgImapServer		DoFullImap4Synchronisation	c:\msgtest\email\imap\connect\msg-imap-connect1.ini 	0001-DoFullImap4Synchronisation
RUN_TEST_STEP	100	T_MsgImapServer		FindEntryByName			c:\msgtest\email\imap\connect\msg-imap-connect1.ini 	0001-FindEntryByName_Inbox
RUN_TEST_STEP 	300 	T_MsgImapServer		DisConnectImapServer		c:\msgtest\email\imap\connect\msg-imap-connect1.ini 	0001-DisConnectImap4Server

RUN_TEST_STEP	300	T_MsgCommonServer	ShutDown
RUN_TEST_STEP	300	T_MsgImapServer		ShutDown

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


START_TESTCASE	MSG-IMAP-CONNECT-0002

//!	@SYMTestCaseID			MSG-IMAP-CONNECT-0002
//!	@SYMTestCaseDesc			This test script creates an IMAP account and a message
//!							from the RFC822 file and sends the message to the same account.
//!	@SYMTestPriority			Critical
//!   	@SYMTestType				CIT
//!  	@SYMTestStatus				Implemented   
//!	@SYMTestCaseDependencies	requires ced -i c:\ced_default_ras.cfg to set comms.
//!	@SYMTestActions			Initialises the RAS connection
//!							Resets the message store to clean up the central repository
//!							Creates an IMAP account by reading the settings from the file mentioned
//!							thus setting the IMAP and SMTP service settings
//!							Connects to the IMAP server 
//!					
//!	@SYMTestExpectedResults		EFail, Wrong IMAP sevice name					
//!	@SYMAuthor			Rajat Bal

PRINT Setup Begins #####################################################
PRINT **** msg-imap-connect-0002 ****

RUN_TEST_STEP	300	T_MsgCommonServer	StartUp
RUN_TEST_STEP	300	T_MsgImapServer		StartUp

RUN_TEST_STEP	300	T_MsgCommonServer	InitNtRas			c:\msgtest\email\imap\connect\msg-imap-connect1.ini 		0002-InitNtRas
RUN_TEST_STEP	300	T_MsgCommonServer	ResetMessageStore		c:\msgtest\email\imap\connect\msg-imap-connect1.ini 		0002-ResetMessageStore
RUN_TEST_STEP 	300 	T_MsgImapServer		CreateImapAccount 		c:\msgtest\email\imap\connect\msg-imap-connect1.ini 		0002-CreateImapAccount 
RUN_TEST_STEP 	300 	T_MsgImapServer		ConnectImap4Server		c:\msgtest\email\imap\connect\msg-imap-connect1.ini 		0002-ConnectImap4Server
RUN_TEST_STEP !Error=-16 300 	T_MsgImapServer		ConnectImap4Server		c:\msgtest\email\imap\connect\msg-imap-connect1.ini 		0002-ConnectImap4Server_Fail
RUN_TEST_STEP 	300 	T_MsgImapServer		DisConnectImapServer		c:\msgtest\email\imap\connect\msg-imap-connect1.ini 		0002-DisConnectImap4Server

RUN_TEST_STEP	300	T_MsgCommonServer	ShutDown
RUN_TEST_STEP	300	T_MsgImapServer		ShutDown

PRINT Execute Completed ################################################
END_TESTCASE	MSG-IMAP-CONNECT-0002

START_TESTCASE	MSG-IMAP-DISCONNECT-0001

//!	@SYMTestCaseID			MSG-IMAP-DISCONNECT-0001
//!	@SYMTestCaseDesc			This test script creates an IMAP account and a message
//!							from the RFC822 file and sends the message to the same account.
//!	@SYMTestPriority			Critical
//!   	@SYMTestType				CIT
//!  	@SYMTestStatus				Implemented   
//!	@SYMTestCaseDependencies	requires ced -i c:\ced_default_ras.cfg to set comms.
//!	@SYMTestActions			Initialises the RAS connection
//!							Resets the message store to clean up the central repository
//!							Creates an IMAP account by reading the settings from the file mentioned
//!							thus setting the IMAP and SMTP service settings
//!							Connects to the IMAP server
//!							Disconnect the IMAP Server
//!					
//!	@SYMTestExpectedResults		EFail, Wrong IMAP sevice name					
//!	@SYMAuthor				Rajat Bal

PRINT Setup Begins #####################################################
PRINT **** MSG-IMAP-DISCONNECT-0001 ****

RUN_TEST_STEP	300	T_MsgCommonServer	StartUp
RUN_TEST_STEP	300	T_MsgImapServer		StartUp

RUN_TEST_STEP	300	T_MsgCommonServer	InitNtRas			c:\msgtest\email\imap\connect\msg-imap-connect1.ini 	0003-InitNtRas
RUN_TEST_STEP	300	T_MsgCommonServer	ResetMessageStore		c:\msgtest\email\imap\connect\msg-imap-connect1.ini 		0003-ResetMessageStore
RUN_TEST_STEP 	300 	T_MsgImapServer		CreateImapAccount 		c:\msgtest\email\imap\connect\msg-imap-connect1.ini 		0003-CreateImapAccount 
RUN_TEST_STEP 	300 	T_MsgImapServer		ConnectImap4Server		c:\msgtest\email\imap\connect\msg-imap-connect1.ini 		0003-ConnectImap4Server
RUN_TEST_STEP 	300 	T_MsgImapServer		DisConnectImapServer		c:\msgtest\email\imap\connect\msg-imap-connect1.ini 		0003-DisConnectImap4Server

RUN_TEST_STEP	300	T_MsgCommonServer	ShutDown
RUN_TEST_STEP	300	T_MsgImapServer		ShutDown

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

START_TESTCASE	MSG-IMAP-DISCONNECT-0002

//!	@SYMTestCaseID			MSG-IMAP-DISCONNECT-0002
//!	@SYMTestCaseDesc			This test script creates an IMAP account and a message
//!							from the RFC822 file and sends the message to the same account.
//!	@SYMTestPriority			Critical
//!   	@SYMTestType				CIT
//!  	@SYMTestStatus				Implemented   
//!	@SYMTestCaseDependencies	requires ced -i c:\ced_default_ras.cfg to set comms.
//!	@SYMTestActions			Initialises the RAS connection
//!							Resets the message store to clean up the central repository
//!							Creates an IMAP account by reading the settings from the file mentioned
//!							thus setting the IMAP and SMTP service settings
//!							Connects to the IMAP server
//!							Disconnect the IMAP Server 1st time
//!							Disconnect the IMAP Server 2nd time
//!					
//!	@SYMTestExpectedResults		EFail, Multiple times disconnecting the server					
//!	@SYMAuthor				Rajat Bal

PRINT Setup Begins #####################################################
PRINT **** MSG-IMAP-DISCONNECT-0002 ****

RUN_TEST_STEP	300	T_MsgCommonServer	StartUp
RUN_TEST_STEP	300	T_MsgImapServer		StartUp

RUN_TEST_STEP	300	T_MsgCommonServer	InitNtRas			c:\msgtest\email\imap\connect\msg-imap-connect1.ini 		0004-InitNtRas
RUN_TEST_STEP	300	T_MsgCommonServer	ResetMessageStore		c:\msgtest\email\imap\connect\msg-imap-connect1.ini 		0004-ResetMessageStore
RUN_TEST_STEP 	300 	T_MsgImapServer		CreateImapAccount 		c:\msgtest\email\imap\connect\msg-imap-connect1.ini 		0004-CreateImapAccount 
RUN_TEST_STEP 	300 	T_MsgImapServer		ConnectImap4Server		c:\msgtest\email\imap\connect\msg-imap-connect1.ini 		0004-ConnectImap4Server
RUN_TEST_STEP 	300 	T_MsgImapServer		DisConnectImapServer		c:\msgtest\email\imap\connect\msg-imap-connect1.ini 		0004-DisConnectImap4Server
RUN_TEST_STEP 	300 	T_MsgImapServer		DisConnectImapServer		c:\msgtest\email\imap\connect\msg-imap-connect1.ini 		0004-DisConnectImap4Server_Fail

RUN_TEST_STEP	300	T_MsgCommonServer	ShutDown
RUN_TEST_STEP	300	T_MsgImapServer		ShutDown

PRINT Execute Completed ################################################
END_TESTCASE	MSG-IMAP-DISCONNECT-0002

START_TESTCASE MSG-IMAP-AccessPointApi-0001

//! @SYMTestCaseID		MSG-IMAP-AccessPointApi-0001
//! @SYMTestCaseDesc		Positive: Check we can get the access point ID for an IMAP connection
//! @SYMTestPriority		Critical
//! @SYMTestType		CIT
//! @SYMREQ			6994
//! @SYMPREQ			1307
//! @SYMTestStatus		Implemented
//! @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 to IMAP service using account settings
//!				4.	Check access point is same as listed in config file
//!				5.	Disconnect from IMAP service.
//!
//! @SYMTestExpectedResults	See step 4
//! @SYMAuthor			Robert Heal

RUN_TEST_STEP 300 T_MsgCommonServer	StartUp
RUN_TEST_STEP 300 T_MsgImapServer	StartUp

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

RUN_TEST_STEP 300 T_MsgCommonServer	InitNtRas		c:\msgtest\email\imap\connect\msg-imap-connect1.ini 0005-InitNtRas
RUN_TEST_STEP 300 T_MsgCommonServer	ResetMessageStore	c:\msgtest\email\imap\connect\msg-imap-connect1.ini 0005-ResetMessageStore
RUN_TEST_STEP 300 T_MsgImapServer	CreateImapAccount 	c:\msgtest\email\imap\connect\msg-imap-connect1.ini 0005-CreateImapAccount 
RUN_TEST_STEP 300 T_MsgImapServer	ConnectImap4Server	c:\msgtest\email\imap\connect\msg-imap-connect1.ini 0005-ConnectImap4Server
RUN_TEST_STEP 300 T_MsgImapServer	CheckImap4AccessPoint	c:\msgtest\email\imap\connect\msg-imap-connect1.ini 0005-CheckImap4AccessPoint
RUN_TEST_STEP 300 T_MsgImapServer	DisConnectImapServer	c:\msgtest\email\imap\connect\msg-imap-connect1.ini 0005-DisConnectImap4Server

RUN_TEST_STEP 300 T_MsgCommonServer	ShutDown
RUN_TEST_STEP 300 T_MsgImapServer	ShutDown

PRINT Execute Completed ################################################

END_TESTCASE MSG-IMAP-AccessPointApi-0001
