//
// 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-SMTP-Migration3-0001

//! @SYMTestCaseID	MSG-SMTP-Migration3-0001
//! @SYMTestCaseDesc	Positive: Check changing migration type while waiting for complete
//! @SYMTestPriority	Critical
//! @SYMTestType	CIT
//! @SYMREQ		6991, 6992, 6993
//! @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, sync, initialise, disconnect IMAP service.
//!			4. Disconnect from IMAP service.
//!			5. Create 3 messages with 1K body text in outbox
//!			6. Install bearer mobility test framework event handlers
//!			7. Send email to SMTP server
//!			8. Check expected number of messages have been sent
//!			9. Repeat steps 5 - 8 for various different migration types
//!			10. Connect and sync to IMAP service
//!			11. Check there are no sent emails in the IMAP inbox
//!			12. Disconnect from IMAP service.
//!
//! @SYMTestExpectedResults	See step 8 & 11
//! @SYMAuthor			Robert Heal

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\smtp\migration\msg-smtp-migration3.ini InitNtRas
RUN_TEST_STEP 300 T_MsgCommonServer	ResetMessageStore		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini ResetMessageStore
RUN_TEST_STEP 300 T_MsgImapServer	CreateImapAccount		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateImapAccount
RUN_TEST_STEP 300 T_MsgImapServer	ChangeImap4SubAndSyncSettings	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini ChangeImap4SubAndSyncSettings
RUN_TEST_STEP 300 T_MsgImapServer	ConnectAndSyncImapServer	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini ConnectAndSyncImapServer
RUN_TEST_STEP 300 T_MsgImapServer	InitialiseImap4Account		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini InitialiseImap4Account
RUN_TEST_STEP 300 T_MsgImapServer	DoFullImap4Synchronisation	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini DoFullImap4Synchronisation
RUN_TEST_STEP 300 T_MsgImapServer	CheckChildrenCountImap		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CheckChildrenCountRemoteInbox_0
RUN_TEST_STEP 300 T_MsgImapServer	DisConnectImapServer		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini DisConnectImapServer

PRINT Setup Completed ##################################################

PRINT Start - WaitComplete to CarrierLost ###################################

RUN_TEST_STEP 300 T_MsgSmtpServer	CreateSmtpMessageFromEmailFile 	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateSmtpMessageFromEmailFile
RUN_TEST_STEP 300 T_MsgSmtpServer	CreateSmtpMessageFromEmailFile 	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateSmtpMessageFromEmailFile
RUN_TEST_STEP 300 T_MsgSmtpServer	CreateSmtpMessageFromEmailFile 	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateSmtpMessageFromEmailFile
RUN_TEST_STEP 300 T_MsgCommonServer	CheckChildrenCount 		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CheckChildrenCountOutbox_3

RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerInit		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerInit

RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Sending_Upgrade
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Upgrade_Complete
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Sending_Downgrade
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Downgrade
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Migrate_NewCarrierActive
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Connecting_Ignore
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_NewCarrierAccepted
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_MigrationComplete
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Sending_Ignore
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Sending_Ignore

RUN_TEST_STEP 300 T_MsgSmtpServer	SendSmtpMessage 		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini SendSmtpMessage

RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerCheck		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerCheck

RUN_TEST_STEP 300 T_MsgCommonServer	CheckChildrenCount		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CheckChildrenCountSentItems_3

PRINT End - WaitComplete to CarrierLost #####################################

RUN_TEST_STEP 300 T_MsgCommonServer	ResetMessageStore		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini ResetMessageStore
RUN_TEST_STEP 300 T_MsgImapServer	CreateImapAccount		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateImapAccount
RUN_TEST_STEP 300 T_MsgImapServer	ChangeImap4SubAndSyncSettings	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini ChangeImap4SubAndSyncSettings

PRINT Start - WaitComplete to Immediate ###################################

RUN_TEST_STEP 300 T_MsgSmtpServer	CreateSmtpMessageFromEmailFile 	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateSmtpMessageFromEmailFile
RUN_TEST_STEP 300 T_MsgSmtpServer	CreateSmtpMessageFromEmailFile 	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateSmtpMessageFromEmailFile
RUN_TEST_STEP 300 T_MsgSmtpServer	CreateSmtpMessageFromEmailFile 	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateSmtpMessageFromEmailFile
RUN_TEST_STEP 300 T_MsgCommonServer	CheckChildrenCount 		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CheckChildrenCountOutbox_3

RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerInit		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerInit

RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Sending_Upgrade
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Upgrade_Complete
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Sending_Upgrade
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Upgrade_Immediate
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Migrate_NewCarrierActive
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Connecting_Ignore
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_NewCarrierAccepted
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_MigrationComplete
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Sending_Ignore
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Sending_Ignore

RUN_TEST_STEP 300 T_MsgSmtpServer	SendSmtpMessage 		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini SendSmtpMessage

RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerCheck		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerCheck

RUN_TEST_STEP 300 T_MsgCommonServer	CheckChildrenCount		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CheckChildrenCountSentItems_3

PRINT End - WaitComplete to Immediate #####################################

DELAY 5000

RUN_TEST_STEP 300 T_MsgImapServer	ConnectImap4Server		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini ConnectImap4Server
RUN_TEST_STEP 300 T_MsgImapServer	DoFullImap4Synchronisation	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini DoFullImap4Synchronisation
RUN_TEST_STEP 300 T_MsgImapServer	CheckChildrenCountImap		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CheckChildrenCountRemoteInbox_6
RUN_TEST_STEP 300 T_MsgImapServer	DisConnectImapServer		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini DisConnectImapServer

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

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

END_TESTCASE MSG-SMTP-Migration3-0001

START_TESTCASE MSG-SMTP-Migration3-0002

//! @SYMTestCaseID	MSG-SMTP-Migration3-0002
//! @SYMTestCaseDesc	Positive: Check changing migration type while disconnecting for migrate
//! @SYMTestPriority	Critical
//! @SYMTestType	CIT
//! @SYMREQ		6991, 6992, 6993
//! @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, sync, initialise, disconnect IMAP service.
//!			4. Disconnect from IMAP service.
//!			5. Create 3 messages with 1K body text in outbox
//!			6. Install bearer mobility test framework event handlers
//!			7. Send email to SMTP server
//!			8. Check expected number of messages have been sent
//!			9. Repeat steps 5 - 8 for various different migration types
//!			10. Connect and sync to IMAP service
//!			11. Check there are no sent emails in the IMAP inbox
//!			12. Disconnect from IMAP service.
//!
//! @SYMTestExpectedResults	See step 8 & 11
//! @SYMAuthor			Robert Heal

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\smtp\migration\msg-smtp-migration3.ini InitNtRas
RUN_TEST_STEP 300 T_MsgCommonServer	ResetMessageStore		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini ResetMessageStore
RUN_TEST_STEP 300 T_MsgImapServer	CreateImapAccount		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateImapAccount
RUN_TEST_STEP 300 T_MsgImapServer	ChangeImap4SubAndSyncSettings	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini ChangeImap4SubAndSyncSettings
RUN_TEST_STEP 300 T_MsgImapServer	ConnectAndSyncImapServer	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini ConnectAndSyncImapServer
RUN_TEST_STEP 300 T_MsgImapServer	InitialiseImap4Account		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini InitialiseImap4Account
RUN_TEST_STEP 300 T_MsgImapServer	DoFullImap4Synchronisation	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini DoFullImap4Synchronisation
RUN_TEST_STEP 300 T_MsgImapServer	CheckChildrenCountImap		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CheckChildrenCountRemoteInbox_0
RUN_TEST_STEP 300 T_MsgImapServer	DisConnectImapServer		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini DisConnectImapServer

PRINT Setup Completed ##################################################

PRINT Start - WaitStop to CarrierLost in Disconnect ###################################

RUN_TEST_STEP 300 T_MsgSmtpServer	CreateSmtpMessageFromEmailFile 	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateSmtpMessageFromEmailFile
RUN_TEST_STEP 300 T_MsgSmtpServer	CreateSmtpMessageFromEmailFile 	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateSmtpMessageFromEmailFile
RUN_TEST_STEP 300 T_MsgCommonServer	CheckChildrenCount 		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CheckChildrenCountOutbox_2

RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerInit		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerInit

RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Sending_Upgrade
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Upgrade_Stop
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Closing_Downgrade
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Downgrade
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Migrate_NewCarrierActive
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Connecting_Ignore
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_NewCarrierAccepted
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_MigrationComplete
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Sending_Ignore

RUN_TEST_STEP 300 T_MsgSmtpServer	SendSmtpMessage 		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini SendSmtpMessage

RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerCheck		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerCheck

RUN_TEST_STEP 300 T_MsgCommonServer	CheckChildrenCount		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CheckChildrenCountSentItems_2

PRINT End - WaitStop to CarrierLost in Disconnect #####################################

RUN_TEST_STEP 300 T_MsgCommonServer	ResetMessageStore		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini ResetMessageStore
RUN_TEST_STEP 300 T_MsgImapServer	CreateImapAccount		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateImapAccount
RUN_TEST_STEP 300 T_MsgImapServer	ChangeImap4SubAndSyncSettings	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini ChangeImap4SubAndSyncSettings

PRINT Start - WaitStop to Immediate in Disconnect ###################################

RUN_TEST_STEP 300 T_MsgSmtpServer	CreateSmtpMessageFromEmailFile 	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateSmtpMessageFromEmailFile
RUN_TEST_STEP 300 T_MsgSmtpServer	CreateSmtpMessageFromEmailFile 	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateSmtpMessageFromEmailFile
RUN_TEST_STEP 300 T_MsgCommonServer	CheckChildrenCount 		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CheckChildrenCountOutbox_2

RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerInit		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerInit

RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Sending_Upgrade
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Upgrade_Stop
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Closing_Upgrade
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Upgrade_Immediate
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Migrate_NewCarrierActive
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Connecting_Ignore
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_NewCarrierAccepted
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_MigrationComplete
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Sending_Ignore

RUN_TEST_STEP 300 T_MsgSmtpServer	SendSmtpMessage 		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini SendSmtpMessage

RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerCheck		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerCheck

RUN_TEST_STEP 300 T_MsgCommonServer	CheckChildrenCount		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CheckChildrenCountSentItems_2

PRINT End - WaitStop to Immediate in Disconnect #####################################

DELAY 5000

RUN_TEST_STEP 300 T_MsgImapServer	ConnectImap4Server		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini ConnectImap4Server
RUN_TEST_STEP 300 T_MsgImapServer	DoFullImap4Synchronisation	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini DoFullImap4Synchronisation
RUN_TEST_STEP 300 T_MsgImapServer	CheckChildrenCountImap		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CheckChildrenCountRemoteInbox_4
RUN_TEST_STEP 300 T_MsgImapServer	DisConnectImapServer		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini DisConnectImapServer

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

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

END_TESTCASE MSG-SMTP-Migration3-0002

START_TESTCASE MSG-SMTP-Migration3-0003

//! @SYMTestCaseID	MSG-SMTP-Migration3-0003
//! @SYMTestCaseDesc	Positive: Check changing migration type while waiting for new carrier
//! @SYMTestPriority	Critical
//! @SYMTestType	CIT
//! @SYMREQ		6991, 6992, 6993
//! @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, sync, initialise, disconnect IMAP service.
//!			4. Disconnect from IMAP service.
//!			5. Create 3 messages with 1K body text in outbox
//!			6. Install bearer mobility test framework event handlers
//!			7. Send email to SMTP server
//!			8. Check expected number of messages have been sent
//!			9. Repeat steps 5 - 8 for various different migration types
//!			10. Connect and sync to IMAP service
//!			11. Check there are no sent emails in the IMAP inbox
//!			12. Disconnect from IMAP service.
//!
//! @SYMTestExpectedResults	See step 8 & 11
//! @SYMAuthor			Robert Heal

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\smtp\migration\msg-smtp-migration3.ini InitNtRas
RUN_TEST_STEP 300 T_MsgCommonServer	ResetMessageStore		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini ResetMessageStore
RUN_TEST_STEP 300 T_MsgImapServer	CreateImapAccount		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateImapAccount
RUN_TEST_STEP 300 T_MsgImapServer	ChangeImap4SubAndSyncSettings	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini ChangeImap4SubAndSyncSettings
RUN_TEST_STEP 300 T_MsgImapServer	ConnectAndSyncImapServer	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini ConnectAndSyncImapServer
RUN_TEST_STEP 300 T_MsgImapServer	InitialiseImap4Account		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini InitialiseImap4Account
RUN_TEST_STEP 300 T_MsgImapServer	DoFullImap4Synchronisation	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini DoFullImap4Synchronisation
RUN_TEST_STEP 300 T_MsgImapServer	CheckChildrenCountImap		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CheckChildrenCountRemoteInbox_0
RUN_TEST_STEP 300 T_MsgImapServer	DisConnectImapServer		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini DisConnectImapServer

PRINT Setup Completed ##################################################

PRINT Start - WaitStop to CarrierLost when ready to migrate ###################################

RUN_TEST_STEP 300 T_MsgSmtpServer	CreateSmtpMessageFromEmailFile 	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateSmtpMessageFromEmailFile
RUN_TEST_STEP 300 T_MsgSmtpServer	CreateSmtpMessageFromEmailFile 	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateSmtpMessageFromEmailFile
RUN_TEST_STEP 300 T_MsgCommonServer	CheckChildrenCount 		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CheckChildrenCountOutbox_2

RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerInit		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerInit

RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Sending_Upgrade
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Upgrade_Stop
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Migrate_Downgrade
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Downgrade
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Migrate_NewCarrierActive
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Connecting_Ignore
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_NewCarrierAccepted
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_MigrationComplete
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Sending_Ignore

RUN_TEST_STEP 300 T_MsgSmtpServer	SendSmtpMessage 		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini SendSmtpMessage

RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerCheck		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerCheck

RUN_TEST_STEP 300 T_MsgCommonServer	CheckChildrenCount		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CheckChildrenCountSentItems_2

PRINT End - WaitStop to CarrierLost when ready to migrate #####################################

RUN_TEST_STEP 300 T_MsgCommonServer	ResetMessageStore		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini ResetMessageStore
RUN_TEST_STEP 300 T_MsgImapServer	CreateImapAccount		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateImapAccount
RUN_TEST_STEP 300 T_MsgImapServer	ChangeImap4SubAndSyncSettings	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini ChangeImap4SubAndSyncSettings

PRINT Start - WaitStop to Immediate when ready to migrate ###################################

RUN_TEST_STEP 300 T_MsgSmtpServer	CreateSmtpMessageFromEmailFile 	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateSmtpMessageFromEmailFile
RUN_TEST_STEP 300 T_MsgSmtpServer	CreateSmtpMessageFromEmailFile 	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateSmtpMessageFromEmailFile
RUN_TEST_STEP 300 T_MsgCommonServer	CheckChildrenCount 		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CheckChildrenCountOutbox_2

RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerInit		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerInit

RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Sending_Upgrade
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Upgrade_Stop
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Migrate_Upgrade
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Upgrade_Immediate
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Migrate_NewCarrierActive
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Connecting_Ignore
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_NewCarrierAccepted
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_MigrationComplete
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Sending_Ignore

RUN_TEST_STEP 300 T_MsgSmtpServer	SendSmtpMessage 		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini SendSmtpMessage

RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerCheck		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerCheck

RUN_TEST_STEP 300 T_MsgCommonServer	CheckChildrenCount		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CheckChildrenCountSentItems_2

PRINT End - WaitStop to Immediate when ready to migrate #####################################

DELAY 5000

RUN_TEST_STEP 300 T_MsgImapServer	ConnectImap4Server		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini ConnectImap4Server
RUN_TEST_STEP 300 T_MsgImapServer	DoFullImap4Synchronisation	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini DoFullImap4Synchronisation
RUN_TEST_STEP 300 T_MsgImapServer	CheckChildrenCountImap		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CheckChildrenCountRemoteInbox_4
RUN_TEST_STEP 300 T_MsgImapServer	DisConnectImapServer		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini DisConnectImapServer

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

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

END_TESTCASE MSG-SMTP-Migration3-0003

START_TESTCASE MSG-SMTP-Migration3-0004

//! @SYMTestCaseID	MSG-SMTP-Migration3-0004
//! @SYMTestCaseDesc	Positive: Check changing migration type while connecting after migration
//! @SYMTestPriority	Critical
//! @SYMTestType	CIT
//! @SYMREQ		6991, 6992, 6993
//! @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, sync, initialise, disconnect IMAP service.
//!			4. Disconnect from IMAP service.
//!			5. Create 3 messages with 1K body text in outbox
//!			6. Install bearer mobility test framework event handlers
//!			7. Send email to SMTP server
//!			8. Check expected number of messages have been sent
//!			9. Repeat steps 5 - 8 for various different migration types
//!			10. Connect and sync to IMAP service
//!			11. Check there are no sent emails in the IMAP inbox
//!			12. Disconnect from IMAP service.
//!
//! @SYMTestExpectedResults	See step 8 & 11
//! @SYMAuthor			Robert Heal

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\smtp\migration\msg-smtp-migration3.ini InitNtRas
RUN_TEST_STEP 300 T_MsgCommonServer	ResetMessageStore		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini ResetMessageStore
RUN_TEST_STEP 300 T_MsgImapServer	CreateImapAccount		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateImapAccount
RUN_TEST_STEP 300 T_MsgImapServer	ChangeImap4SubAndSyncSettings	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini ChangeImap4SubAndSyncSettings
RUN_TEST_STEP 300 T_MsgImapServer	ConnectAndSyncImapServer	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini ConnectAndSyncImapServer
RUN_TEST_STEP 300 T_MsgImapServer	InitialiseImap4Account		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini InitialiseImap4Account
RUN_TEST_STEP 300 T_MsgImapServer	DoFullImap4Synchronisation	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini DoFullImap4Synchronisation
RUN_TEST_STEP 300 T_MsgImapServer	CheckChildrenCountImap		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CheckChildrenCountRemoteInbox_0
RUN_TEST_STEP 300 T_MsgImapServer	DisConnectImapServer		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini DisConnectImapServer

PRINT Setup Completed ##################################################

PRINT Start - WaitStop to CarrierLost while connecting after migration  ###################################

RUN_TEST_STEP 300 T_MsgSmtpServer	CreateSmtpMessageFromEmailFile 	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateSmtpMessageFromEmailFile
RUN_TEST_STEP 300 T_MsgSmtpServer	CreateSmtpMessageFromEmailFile 	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateSmtpMessageFromEmailFile
RUN_TEST_STEP 300 T_MsgCommonServer	CheckChildrenCount 		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CheckChildrenCountOutbox_2

RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerInit		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerInit

RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Sending_Upgrade
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Upgrade_Stop
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Migrate_NewCarrierActive
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Connecting_Downgrade
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Downgrade
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Migrate_NewCarrierActive
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Connecting_Ignore
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_NewCarrierAccepted
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_MigrationComplete
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Sending_Ignore

RUN_TEST_STEP 300 T_MsgSmtpServer	SendSmtpMessage 		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini SendSmtpMessage

RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerCheck		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerCheck

RUN_TEST_STEP 300 T_MsgCommonServer	CheckChildrenCount		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CheckChildrenCountSentItems_2

PRINT End - WaitStop to CarrierLost while connecting after migration #####################################

RUN_TEST_STEP 300 T_MsgCommonServer	ResetMessageStore		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini ResetMessageStore
RUN_TEST_STEP 300 T_MsgImapServer	CreateImapAccount		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateImapAccount
RUN_TEST_STEP 300 T_MsgImapServer	ChangeImap4SubAndSyncSettings	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini ChangeImap4SubAndSyncSettings

PRINT Start - WaitStop to Immediate while connecting after migration ###################################

RUN_TEST_STEP 300 T_MsgSmtpServer	CreateSmtpMessageFromEmailFile 	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateSmtpMessageFromEmailFile
RUN_TEST_STEP 300 T_MsgSmtpServer	CreateSmtpMessageFromEmailFile 	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CreateSmtpMessageFromEmailFile
RUN_TEST_STEP 300 T_MsgCommonServer	CheckChildrenCount 		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CheckChildrenCountOutbox_2

RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerInit		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerInit

RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Sending_Upgrade
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Upgrade_Stop
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Migrate_NewCarrierActive
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Connecting_Upgrade
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Upgrade_Immediate
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Migrate_NewCarrierActive
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Connecting_Ignore
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_NewCarrierAccepted
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_MigrationComplete
RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerAdd		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerAdd_Sending_Ignore

RUN_TEST_STEP 300 T_MsgSmtpServer	SendSmtpMessage 		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini SendSmtpMessage

RUN_TEST_STEP 300 T_MsgCommonServer	EventHandlerCheck		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini EventHandlerCheck

RUN_TEST_STEP 300 T_MsgCommonServer	CheckChildrenCount		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CheckChildrenCountSentItems_2

PRINT End - WaitStop to Immediate while connecting after migration #####################################

DELAY 5000

RUN_TEST_STEP 300 T_MsgImapServer	ConnectImap4Server		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini ConnectImap4Server
RUN_TEST_STEP 300 T_MsgImapServer	DoFullImap4Synchronisation	c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini DoFullImap4Synchronisation
RUN_TEST_STEP 300 T_MsgImapServer	CheckChildrenCountImap		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini CheckChildrenCountRemoteInbox_4
RUN_TEST_STEP 300 T_MsgImapServer	DisConnectImapServer		c:\msgtest\email\smtp\migration\msg-smtp-migration3.ini DisConnectImapServer

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

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

END_TESTCASE MSG-SMTP-Migration3-0004
