//
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of the License "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
//!	@SYMTestSuiteName			pbase-f32-sfsrv-publicapi-ram
//!	@SYMScriptTestEnvironment		This test script requires a basic ROM.
//!	@SYMScriptAuthor 			Dmitri Trofimov, Anton Grober
//!	@SYMScriptCreationDate			17/12/2006 
//!	@SYMScriptDescription			The test script contains API tests for the following functions of TOpenFileScan class
//!	TOpenFileScan(RFs &aFs);
//!	void NextL(CFileList *&aFileList);
//!	TThreadId ThreadId() const;

LOAD_SERVER	T_SfSrv –SharedData 
DELAY		5000

START_TESTCASE 				PBASE-F32-OpenFileScan-PublicApi-0001
//! @SYMTestCaseID			PBASE-F32-OpenFileScan-PublicApi-0001
//! @SYMAPI				TOpenFileScan
//! @SYMTestCaseDesc			TOpenFileScan() passing a reference to an open RFs object as a parameter
//!					Uses API elements: TOpenFileScan()
//! @SYMTestActions			1. Create RFs object.
//!					2. Call Connect on RFs.
//!					3. Create TOpenFileScan object passing a reference to the RFs object as a parameter.
//!					4. Delete TOpenFileScan object.
//!					5. Delete RFs object.
//!
//! @SYMTestStatus			Implemented
//! @SYMTestPriority			Critical
//! @SYMTestExpectedResults		Function does not leave nor panic.
//!
//! @SYMTestType			CIT
	START_TEST_BLOCK	100	T_SfSrv	\base\PBASE-F32-OpenFileScan-PublicApi.ini
		CREATE_OBJECT	RFs		RFs1
		CREATE_OBJECT	CFileMan	CFileMan1
		COMMAND		RFs1		new			
		COMMAND		RFs1		Connect
		COMMAND		RFs1		MkDirAll	PathToRamDir
		COMMAND		CFileMan1	NewL		RFs1Used
		COMMAND		CFileMan1	Copy		CopyTest1
		COMMAND		CFileMan1	~
		COMMAND		RFs1		~
	END_TEST_BLOCK	
	START_TEST_BLOCK	100	T_SfSrv	\base\PBASE-F32-OpenFileScan-PublicApi.ini
			CREATE_OBJECT	RFs	RFs1	
			CREATE_OBJECT	RFile	RFile1	
			CREATE_OBJECT	TOpenFileScan	TOpenFileScan1	
			COMMAND		RFs1	new		
			COMMAND		RFs1	Connect		
			COMMAND		RFile1	new
			COMMAND		RFile1	Open		filename1
			COMMAND		RFile1	Close
			COMMAND		TOpenFileScan1	new	PBASE-F32-OpenFileScan-PublicApi-0001command4new
			COMMAND		TOpenFileScan1	~		
			COMMAND		RFs1	~		
	END_TEST_BLOCK
	START_TEST_BLOCK	100	T_SfSrv	\base\PBASE-F32-OpenFileScan-PublicApi.ini
		CREATE_OBJECT	RFs		RFs1
		CREATE_OBJECT	CFileMan	CFileMan1
		COMMAND		RFs1		new			
		COMMAND		RFs1		Connect
		COMMAND		CFileMan1	NewL		RFs1Used
		COMMAND		CFileMan1	Delete		DeleteRamFiles
		COMMAND		RFs1		RmDir		PathToRamDir
		COMMAND		CFileMan1	~
		COMMAND		RFs1		~
	END_TEST_BLOCK	
END_TESTCASE				PBASE-F32-OpenFileScan-PublicApi-0001

START_TESTCASE 				PBASE-F32-OpenFileScan-PublicApi-0002
//! @SYMTestCaseID			PBASE-F32-OpenFileScan-PublicApi-0002
//! @SYMAPI				TOpenFileScan
//! @SYMTestCaseDesc			NextL()
//!					Uses API elements: NextL()
//! @SYMTestActions			1. Create RFs object.
//!					2. Call Connect() on RFs.
//!					3. Create TOpenFileScan object passing a reference to th RFs object as a parameter.
//!					4. Call NextL() on TOpenFileScan passing CFileList pointer as a parameter.
//!					5. Delete TOpenFileScan object.
//!					6. Delete RFs object.
//!
//! @SYMTestStatus			Implemented
//! @SYMTestPriority			Critical
//! @SYMTestExpectedResults		NextL() doest not leave nor panic.
//! @SYMTestType			CIT
	START_TEST_BLOCK	100	T_SfSrv	\base\PBASE-F32-OpenFileScan-PublicApi.ini
			CREATE_OBJECT	RFs	RFs1	
			CREATE_OBJECT	TOpenFileScan	TOpenFileScan1	
			COMMAND		RFs1		new		
			COMMAND		RFs1		Connect		
			COMMAND		TOpenFileScan1	new		PBASE-F32-OpenFileScan-PublicApi-0002command4new
			COMMAND		TOpenFileScan1	NextL		
			COMMAND		TOpenFileScan1	~		
			COMMAND		RFs1		~		
	END_TEST_BLOCK
END_TESTCASE				PBASE-F32-OpenFileScan-PublicApi-0002

START_TESTCASE 				PBASE-F32-OpenFileScan-PublicApi-0003
//! @SYMTestCaseID			PBASE-F32-OpenFileScan-PublicApi-0003
//! @SYMAPI				TOpenFileScan
//! @SYMTestCaseDesc			ThreadId() test.
//!					Uses API elements: NextL(), ThreadId()
//! @SYMTestActions			1. Create RFs object.
//!					2. Call Connect() on RFs.
//!					3. Call Open() on RFile to open file name in test dir 'Test1.txt'.
//!					4. Create TOpenFileScan object passing a reference to the RFs object as a parameter.
//!					5. Call NextL(). Call with parameter expected_file to make this function loop until neccessary file found in
//!					 CFileList being returned by function.
//!					6. Call ThreadId() on TOpenFileScan and compare it with returned by CT_FsData::ThreadId() function.
//!					7. Delete TOpenFileScan object.
//!					8. Delete RFs object.
//!
//! @SYMTestStatus			Implemented
//! @SYMTestPriority			Critical
//! @SYMTestExpectedResults		ThreadId() returns same value as got from CT_FsData suite using ThreadId() function.
//! @SYMTestType			CIT
	START_TEST_BLOCK	100	T_SfSrv	\base\PBASE-F32-OpenFileScan-PublicApi.ini
		CREATE_OBJECT	RFs		RFs1
		CREATE_OBJECT	CFileMan	CFileMan1
		COMMAND		RFs1		new			
		COMMAND		RFs1		Connect
		COMMAND		RFs1		MkDirAll	PathToRamDir
		COMMAND		CFileMan1	NewL		RFs1Used
		COMMAND		CFileMan1	Copy		CopyTest1
		COMMAND		CFileMan1	~
		COMMAND		RFs1		~
	END_TEST_BLOCK	
	START_TEST_BLOCK	100	T_SfSrv	\base\PBASE-F32-OpenFileScan-PublicApi.ini
			CREATE_OBJECT	RFs	RFs1	
			CREATE_OBJECT	TOpenFileScan	TOpenFileScan1	
			CREATE_OBJECT	RFile	RFile1	
			COMMAND		RFs1	new		
			COMMAND		RFs1	Connect		
			COMMAND		RFile1	new
			COMMAND		RFile1	Open			filename1
			COMMAND		TOpenFileScan1	new		PBASE-F32-OpenFileScan-PublicApi-0003command4new
			COMMAND		TOpenFileScan1	NextL		look_for_file1
			COMMAND		TOpenFileScan1	ThreadId	filesession_for_thread1
			COMMAND		TOpenFileScan1	~		
			COMMAND		RFs1	~		
			COMMAND		RFile1	Close
			COMMAND		RFile1	~
	END_TEST_BLOCK
	START_TEST_BLOCK	100	T_SfSrv	\base\PBASE-F32-OpenFileScan-PublicApi.ini
		CREATE_OBJECT	RFs		RFs1
		CREATE_OBJECT	CFileMan	CFileMan1
		COMMAND		RFs1		new			
		COMMAND		RFs1		Connect
		COMMAND		CFileMan1	NewL		RFs1Used
		COMMAND		CFileMan1	Delete		DeleteRamFiles
		COMMAND		RFs1		RmDir		PathToRamDir
		COMMAND		CFileMan1	~
		COMMAND		RFs1		~
	END_TEST_BLOCK	
END_TESTCASE				PBASE-F32-OpenFileScan-PublicApi-0003

START_TESTCASE 				PBASE-F32-OpenFileScan-PublicApi-0004
//! @SYMTestCaseID			PBASE-F32-OpenFileScan-PublicApi-0004
//! @SYMAPI				TOpenFileScan
//! @SYMTestCaseDesc			TOpenFileScan() passing a reference to an open RFs object as a parameter
//!					Uses API elements: TOpenFileScan()
//! @SYMTestActions			1. Create RFs object.
//!					2. Create TOpenFileScan object passing a reference to the RFs object as a parameter.
//!					3. Delete TOpenFileScan object.
//!					4. Delete RFs object.
//!
//! @SYMTestStatus			Implemented
//! @SYMTestPriority			Critical
//! @SYMTestExpectedResults		Function does not leave nor panic.
	START_TEST_BLOCK	100	T_SfSrv	\base\PBASE-F32-OpenFileScan-PublicApi.ini
			CREATE_OBJECT	RFs	RFs1	
			CREATE_OBJECT	TOpenFileScan	TOpenFileScan1	
			COMMAND		RFs1		new		
			COMMAND		TOpenFileScan1	new		PBASE-F32-OpenFileScan-PublicApi-0004command3new
			COMMAND		TOpenFileScan1	~		
			COMMAND		RFs1		~		
	END_TEST_BLOCK
END_TESTCASE				PBASE-F32-OpenFileScan-PublicApi-0004



START_TESTCASE 				PBASE-F32-OpenFileScan-PublicApi-0005
//! @SYMTestCaseID			PBASE-F32-OpenFileScan-PublicApi-0005
//! @SYMAPI				TOpenFileScan
//! @SYMTestCaseDesc			ThreadId() test with 2 simulateonus threads.
//!					Uses API elements: NextL(), ThreadId()
//! @SYMTestActions			For thread 1.
//!					1. Create RFs object.
//!					2. Call Connect() on RFs.
//!					3. Call Open() on RFile to open file name 'Test1.txt' in test directory.
//!					4. Create TOpenFileScan object passing a reference to the RFs object as a parameter.
//!					5. Call NextL(). Call with parameter expected_file to make this function loop until neccessary file found in
//!					 CFileList being returned by function.
//!					6. Call ThreadId() on TOpenFileScan.
//!					7. Delete TOpenFileScan object.
//!					8. Delete RFs object.
//!
//!					For thread 2:
//!					1. Create RFs object.
//!					2. Call Connect() on RFs.
//!					3. Call Open() on RFile to open file name 'Test2.txt' in test directory.
//!					4. Create TOpenFileScan object passing a reference to the RFs object as a parameter.
//!					5. Call NextL(). Call with parameter expected_file to make this function loop until neccessary file found in 
//!					CFileList being returned by function.
//!					6. Call ThreadId() on TOpenFileScan.
//!					7. Delete TOpenFileScan object.
//!					8. Delete RFs object.
//!
//! @SYMTestStatus			Implemented
//! @SYMTestPriority			Critical
//! @SYMTestExpectedResults		ThreadId() returns same value as got from CT_FsData suite using ThreadId() function for each thread.
//! @SYMTestType			CIT
	START_TEST_BLOCK	100	T_SfSrv	\base\PBASE-F32-OpenFileScan-PublicApi.ini
		CREATE_OBJECT	RFs		RFs1
		CREATE_OBJECT	CFileMan	CFileMan1
		COMMAND		RFs1		new			
		COMMAND		RFs1		Connect
		COMMAND		RFs1		MkDirAll	PathToRamDir
		COMMAND		CFileMan1	NewL		RFs1Used
		COMMAND		CFileMan1	Copy		CopyTest1
		COMMAND		CFileMan1	Copy		CopyTest2
		COMMAND		CFileMan1	~
		COMMAND		RFs1		~
	END_TEST_BLOCK	
	CONCURRENT
	START_TEST_BLOCK	100	T_SfSrv	\base\PBASE-F32-OpenFileScan-PublicApi.ini
			CREATE_OBJECT	RFs	RFs1	
			CREATE_OBJECT	TOpenFileScan	TOpenFileScan1	
			CREATE_OBJECT	RFile		RFile1	
			COMMAND		RFs1		new		
			COMMAND		RFs1		Connect		
			COMMAND		RFile1		new
			COMMAND		RFile1		Open		filename1
			COMMAND		TOpenFileScan1	new		PBASE-F32-OpenFileScan-PublicApi-0003command4new
			COMMAND		TOpenFileScan1	NextL		look_for_file1
			COMMAND		TOpenFileScan1	ThreadId	filesession_for_thread1
			COMMAND		TOpenFileScan1	~		
			COMMAND		RFs1		~		
			COMMAND		RFile1		Close
			COMMAND		RFile1		~
	END_TEST_BLOCK
	START_TEST_BLOCK	100	T_SfSrv	\base\PBASE-F32-OpenFileScan-PublicApi.ini
			CREATE_OBJECT	RFs	RFs2	
			CREATE_OBJECT	TOpenFileScan	TOpenFileScan2	
			CREATE_OBJECT	RFile	RFile2	
			COMMAND		RFs2	new		
			COMMAND		RFs2	Connect		
			COMMAND		RFile2	new
			COMMAND		RFile2	Open			filename2
			COMMAND		TOpenFileScan2	new		OpenFileScanNew
			COMMAND		TOpenFileScan2	NextL		look_for_file2
			COMMAND		TOpenFileScan2	ThreadId	filesession_for_thread2
			COMMAND		TOpenFileScan2	~		
			COMMAND		RFs2	~		
			COMMAND		RFile2	Close
			COMMAND		RFile2	~
	END_TEST_BLOCK
	CONSECUTIVE
	START_TEST_BLOCK	100	T_SfSrv	\base\PBASE-F32-OpenFileScan-PublicApi.ini
		CREATE_OBJECT	RFs		RFs1
		CREATE_OBJECT	CFileMan	CFileMan1
		COMMAND		RFs1		new			
		COMMAND		RFs1		Connect
		COMMAND		CFileMan1	NewL		RFs1Used
		COMMAND		CFileMan1	Delete		DeleteRamFiles
		COMMAND		RFs1		RmDir		PathToRamDir
		COMMAND		CFileMan1	~
		COMMAND		RFs1		~
	END_TEST_BLOCK	
END_TESTCASE				PBASE-F32-OpenFileScan-PublicApi-0005

START_TESTCASE 				PBASE-F32-OpenFileScan-PublicApi-0006
//! @SYMTestCaseID			PBASE-F32-OpenFileScan-PublicApi-0006
//! @SYMAPI				TOpenFileScan
//! @SYMTestCaseDesc			ThreadId() test.
//!					Uses API elements: NextL(), ThreadId()
//! @SYMTestActions			1. Create RFs object.
//!					2. Call Connect() on RFs.
//!					3. Call Open() on RFile1 to open file named 'Test1.txt' in test directory.
//!					4. Call Open() on RFile2 to open file named 'Test2.txt' in test directory.
//!					5. Create TOpenFileScan object passing a reference to the RFs object as a parameter.
//!					6. Call NextL(). Call with parameter expected_file to make this function loop until neccessary file found in CFileList being returned by function. 
//!					
//!					7. Call ThreadId() on TOpenFileScan.
//!					8. Delete RFile1 object
//!					9. Delete RFile2 object.
//!					8. Delete TOpenFileScan object.
//!					9. Delete RFs object.
//!
//! @SYMTestStatus			Implemented
//! @SYMTestPriority			Critical
//! @SYMTestExpectedResults		ThreadId() returns same value as got from CT_FsData suite using ThreadId() function.
//! @SYMTestType			CIT
	START_TEST_BLOCK	100	T_SfSrv	\base\PBASE-F32-OpenFileScan-PublicApi.ini
		CREATE_OBJECT	RFs		RFs1
		CREATE_OBJECT	CFileMan	CFileMan1
		COMMAND		RFs1		new			
		COMMAND		RFs1		Connect
		COMMAND		RFs1		MkDirAll	PathToRamDir
		COMMAND		CFileMan1	NewL		RFs1Used
		COMMAND		CFileMan1	Copy		CopyTest1
		COMMAND		CFileMan1	Copy		CopyTest2
		COMMAND		CFileMan1	~
		COMMAND		RFs1		~
	END_TEST_BLOCK	
	START_TEST_BLOCK	100	T_SfSrv	\base\PBASE-F32-OpenFileScan-PublicApi.ini
			CREATE_OBJECT	RFs	RFs1	
			CREATE_OBJECT	TOpenFileScan	TOpenFileScan1	
			CREATE_OBJECT	RFile	RFile1	
			CREATE_OBJECT	RFile	RFile2	
			COMMAND		RFs1	new		
			COMMAND		RFs1	Connect		
			COMMAND		RFile1	new
			COMMAND		RFile2	new
			COMMAND		RFile1	Open			filename1
			COMMAND		RFile2	Open			filename3
			COMMAND		TOpenFileScan1	new		PBASE-F32-OpenFileScan-PublicApi-0003command4new
			COMMAND		TOpenFileScan1	NextL		look_for_many_files
			COMMAND		TOpenFileScan1	ThreadId	filesession_for_thread1
			COMMAND		TOpenFileScan1	~		
			COMMAND		RFs1	~		
			COMMAND		RFile1	Close
			COMMAND		RFile1	~
			COMMAND		RFile2	Close
			COMMAND		RFile2	~
	END_TEST_BLOCK
	START_TEST_BLOCK	100	T_SfSrv	\base\PBASE-F32-OpenFileScan-PublicApi.ini
		CREATE_OBJECT	RFs		RFs1
		CREATE_OBJECT	CFileMan	CFileMan1
		COMMAND		RFs1		new			
		COMMAND		RFs1		Connect
		COMMAND		CFileMan1	NewL		RFs1Used
		COMMAND		CFileMan1	Delete		DeleteRamFiles
		COMMAND		RFs1		RmDir		PathToRamDir
		COMMAND		CFileMan1	~
		COMMAND		RFs1		~
	END_TEST_BLOCK	
END_TESTCASE				PBASE-F32-OpenFileScan-PublicApi-0006

