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


// Test script for testing IMAP commands using codenomicon test tool

START_TESTCASE		MSG-IMAP-SRCH-0001

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

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

PRINT Running Test 1, no search string
// First clean out the remote inbox and local message store
RUN_TEST_STEP 	300 	T_MsgCommonServer	InitNtRas			c:\msgtest\email\imap\search\msg-imap-search1.ini	0001-InitNtRas
RUN_TEST_STEP 	300 	T_MsgImapServer		CreateImapAccount		c:\msgtest\email\imap\search\msg-imap-search1.ini	0001-CreateImapAccount
RUN_TEST_STEP 	300 	T_MsgImapServer		ConnectImap4Server		c:\msgtest\email\imap\search\msg-imap-search1.ini   	0001-ConnectImap4Server
RUN_TEST_STEP 	300 	T_MsgImapServer		DoFullImap4Synchronisation	c:\msgtest\email\imap\search\msg-imap-search1.ini	0001-DoFullImap4Synchronisation0
RUN_TEST_STEP 	300 	T_MsgImapServer		DeleteAllImapChildren		c:\msgtest\email\imap\search\msg-imap-search1.ini	0001-DeleteAllImapChildren
RUN_TEST_STEP 	300 	T_MsgCommonServer	ResetMessageStore		c:\msgtest\email\imap\search\msg-imap-search1.ini	0001-ResetMessageStore

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




START_TESTCASE		MSG-IMAP-SRCH-0002

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


PRINT Running Test 2, search string is defined
// First clean out the remote inbox and local message store
RUN_TEST_STEP 	300 	T_MsgCommonServer	InitNtRas			c:\msgtest\email\imap\search\msg-imap-search1.ini   	0002-InitNtRas
RUN_TEST_STEP 	300 	T_MsgImapServer		CreateImapAccount		c:\msgtest\email\imap\search\msg-imap-search1.ini   	0002-CreateImapAccount
RUN_TEST_STEP 	300 	T_MsgImapServer		ConnectImap4Server		c:\msgtest\email\imap\search\msg-imap-search1.ini   	0002-ConnectImap4Server
RUN_TEST_STEP 	300 	T_MsgImapServer		DoFullImap4Synchronisation	c:\msgtest\email\imap\search\msg-imap-search1.ini   	0002-DoFullImap4Synchronisation0
RUN_TEST_STEP 	300 	T_MsgImapServer		DeleteAllImapChildren		c:\msgtest\email\imap\search\msg-imap-search1.ini   	0002-DeleteAllImapChildren
// Send the test emails
//RUN_TEST_STEP 	300 	T_MsgImapServer		DoFullImap4Synchronisation	c:\msgtest\email\imap\search\msg-imap-search1.ini    	0002-DoFullImap4Synchronisation

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




START_TESTCASE		MSG-IMAP-SRCH-0003

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


PRINT Running Test 3, verify that local inbox matches fetch operation
// First clean out the remote inbox and local message store
RUN_TEST_STEP 	300 	T_MsgCommonServer	InitNtRas			c:\msgtest\email\imap\search\msg-imap-search1.ini    	0003-InitNtRas
RUN_TEST_STEP 	300 	T_MsgImapServer		CreateImapAccount		c:\msgtest\email\imap\search\msg-imap-search1.ini    	0003-CreateImapAccount
RUN_TEST_STEP 	300 	T_MsgImapServer		ConnectImap4Server		c:\msgtest\email\imap\search\msg-imap-search1.ini   	0003-ConnectImap4Server
RUN_TEST_STEP 	300 	T_MsgImapServer		DoFullImap4Synchronisation	c:\msgtest\email\imap\search\msg-imap-search1.ini    	0003-DoFullImap4Synchronisation0
RUN_TEST_STEP 	300 	T_MsgImapServer		DeleteAllImapChildren		c:\msgtest\email\imap\search\msg-imap-search1.ini    	0003-DeleteAllImapChildren
// get all messages, should have 10 messages after this step
//RUN_TEST_STEP 	300 	T_MsgImapServer		DoFullImap4Synchronisation	c:\msgtest\email\imap\search\msg-imap-search1.ini    	0003-DoFullImap4Synchronisation

PRINT Execute Completed ################################################
END_TESTCASE	MSG-IMAP-SRCH-0003




START_TESTCASE		MSG-IMAP-SRCH-0004

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


PRINT Running Test 4, non-matching search string is defined
// First clean out the remote inbox and local message store
RUN_TEST_STEP 	300 	T_MsgCommonServer	InitNtRas			c:\msgtest\email\imap\search\msg-imap-search1.ini    	0004-InitNtRas
RUN_TEST_STEP 	300 	T_MsgImapServer		CreateImapAccount		c:\msgtest\email\imap\search\msg-imap-search1.ini    	0004-CreateImapAccount
RUN_TEST_STEP 	300 	T_MsgImapServer		ConnectImap4Server		c:\msgtest\email\imap\search\msg-imap-search1.ini   	0004-ConnectImap4Server
RUN_TEST_STEP 	300 	T_MsgImapServer		DoFullImap4Synchronisation	c:\msgtest\email\imap\search\msg-imap-search1.ini    	0004-DoFullImap4Synchronisation0
RUN_TEST_STEP 	300 	T_MsgImapServer		DeleteAllImapChildren		c:\msgtest\email\imap\search\msg-imap-search1.ini    	0004-DeleteAllImapChildren
//RUN_TEST_STEP 	300 	T_MsgImapServer		DoFullImap4Synchronisation	c:\msgtest\email\imap\search\msg-imap-search1.ini   	0004-DoFullImap4Synchronisation

PRINT Execute Completed ################################################
END_TESTCASE	MSG-IMAP-SRCH-0004




