// Copyright (c) 2006-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:
//

LOAD_SUITE LbsClientTestServer -SharedData

PRINT Run LbsClientTestServer
PRINT

//Before we start LBS, select the test A-GPS integration module and network reg status txt file to use.
PREFIX RUN_UTILS
	MkDir c:\private\10282253\
	MkDir c:\private\10282253\lbs\
	MkDir c:\private\10282253\lbs\locmods\
	CopyFile c:\testdata\configs\xtestmodule.ini c:\private\10282253\lbs\locmods\agpsintegmodule.ini
    CopyFile c:\testdata\configs\lbstestconfig.txt c:\config.txt
	DeleteFile c:\private\10282253\lbs\lbsprofile.ini
REMOVE_PREFIX

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_ResetDefaultAdmin 
RUN_TEST_STEP 030 LbsClientTestServer LbsStep_StartLbs


START_TESTCASE LBS-Client-ModInfo-0001

//!@SYMTestCaseID			LBS-Client-ModInfo-0001
//!@SYMTestCaseDesc			Module count
//!
//!@SYMTestActions			1. Connect to the location server.
//!					        2. Request module count - use GetNumModules.
//!
//!@SYMTestExpectedResults	Ensure a count is  more than zero returned to indicate the correct
//!					        number of modules is installed. 
//!
//!@SYMPREQ				PREQ786
//!@SYMREQ 				REQ786.15
//!
//!@SYMTestType				CIT
//!@SYMTestPriority			1
//!@SYMTestStatus			Implemented
RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP 20 LbsClientTestServer LbsClientStep_ModInfo c:\testdata\configs\LbsClientModInfo.ini LBS-Mod-Cnt-0001

END_TESTCASE LBS-Client-ModInfo-0001


START_TESTCASE LBS-Client-ModInfo-0002

//!@SYMTestCaseID			LBS-Client-ModInfo-0002
//!@SYMTestCaseDesc			Module count
//!
//!@SYMTestActions			1. Request module count - use GetNumModules().
//!					Note: No server connection is carried out.
//!
//!@SYMTestExpectedResults	        Verify the correct panic is given, as a result of
//!					not having a connection established with the location server.
//!
//!@SYMPREQ				PREQ786
//!@SYMREQ 				REQ786.15
//!
//!@SYMTestType				CIT
//!@SYMTestPriority			2
//!@SYMTestStatus			Implemented

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP !PanicCode=6 20 LbsClientTestServer LbsClientStep_ModInfo c:\testdata\configs\LbsClientModInfo.ini LBS-Mod-Cnt-0002

END_TESTCASE LBS-Client-ModInfo-0002



//START_TESTCASE LBS-Client-ModInfo-0003
//

//!@SYMTestCaseID			LBS-Client-ModInfo-0003
//!@SYMTestCaseDesc			Module count, modules on different drives.
//!
//!@SYMTestActions			1. Two module files exist on C:, one module file exists on Z:
//							2. Request module count - use GetNumModules().
//!
//!@SYMTestExpectedResults	Ensure a count of 3 is returned to indicate the correct
//!							number of modules is installed (Network and A-GPS modules).
//!							Check the expected modules are returned in GetModuleInfo.
//!
//!@SYMPREQ				PREQ786
//!@SYMREQ 				REQ786.15
//!
//!@SYMTestType				CIT
//!@SYMTestPriority			2
//!@SYMTestStatus			Not Used - No way to re-start LBS

// Setup mod info INI files for test
//RUN_UTILS CopyFile c:\testdata\configs\xtestmodule.ini c:\private\10282253\lbs\locmods\agpsintegmodule.ini
//RUN_UTILS CopyFile c:\testdata\configs\othermodule.ini c:\private\10282253\lbs\locmods\agpsintegmodule.ini
//RUN_UTILS DeleteFile c:\private\10282253\lbs\locmods\agpsintegmodule.ini

// Run test
//RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
//RUN_TEST_STEP 20 LbsClientTestServer LbsClientStep_ModInfo c:\testdata\configs\LbsClientModInfo.ini LBS-Mod-Cnt-0003

// Re-select the real A-GPS integration module.
//RUN_TEST_STEP 030 LbsClientTestServer LbsStep_StopLbs
//RUN_UTILS DeleteFile c:\private\10282253\lbs\locmods\agpsintegmodule.ini
//RUN_UTILS DeleteFile c:\private\10282253\lbs\locmods\agpsintegmodule.ini
//RUN_UTILS CopyFile c:\testdata\configs\xtestmodule.ini c:\private\10282253\lbs\locmods\agpsintegmodule.ini

// Restart LBS
//RUN_TEST_STEP 030 LbsClientTestServer LbsStep_StartLbs

//END_TESTCASE LBS-Client-ModInfo-0003


//START_TESTCASE LBS-Client-ModInfo-0004

//!@SYMTestCaseID			LBS-Client-ModInfo-0004
//!@SYMTestCaseDesc			Module count, 1 module supersedes Z: drive module
//!
//!@SYMTestActions			1. Three module files exist on C:, one module file exists on Z:
//!							   A module on Z: has the same filename as one module on C: (Module name 
//!							   is different however).
//							2. Request module count - use GetNumModules().
//!
//!@SYMTestExpectedResults	Ensure a count of 3 is returned to indicate the correct
//!							number of modules is installed (Network and A-GPS modules).
//!							Check the expected modules are returned in GetModuleInfo.
//!							Check the SIRF module is the one on C: drive (name matches).
//!
//!@SYMPREQ				PREQ786
//!@SYMREQ 				REQ786.15
//!
//!@SYMTestType				CIT
//!@SYMTestPriority			2
//!@SYMTestStatus			Not Used - No way to re-start LBS

// Setup mod info INI files for test
//RUN_UTILS CopyFile c:\testdata\configs\xtestmodule.ini c:\private\10282253\lbs\locmods\agpsintegmodule.ini
//RUN_UTILS CopyFile c:\testdata\configs\othermodule.ini c:\private\10282253\lbs\locmods\agpsintegmodule.ini
//RUN_UTILS CopyFile c:\testdata\configs\sirfdatasource_c.ini c:\private\10282253\lbs\locmods\agpsintegmodule.ini

// Run test
//RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
//RUN_TEST_STEP 20 LbsClientTestServer LbsClientStep_ModInfo c:\testdata\configs\LbsClientModInfo.ini LBS-Mod-Cnt-0004

// Re-select the real A-GPS integration module.
//RUN_TEST_STEP 030 LbsClientTestServer LbsStep_StopLbs
//RUN_UTILS DeleteFile c:\private\10282253\lbs\locmods\agpsintegmodule.ini
//RUN_UTILS DeleteFile c:\private\10282253\lbs\locmods\agpsintegmodule.ini
//RUN_UTILS DeleteFile c:\private\10282253\lbs\locmods\agpsintegmodule.ini
//RUN_UTILS CopyFile c:\testdata\configs\xtestmodule.ini c:\private\10282253\lbs\locmods\agpsintegmodule.ini
//RUN_UTILS CopyFile c:\testdata\configs\agpsnpeintegmodule.ini c:\private\10282253\lbs\locmods\agpsintegmodule.ini

// Restart LBS
//RUN_TEST_STEP 030 LbsClientTestServer LbsStep_StartLbs

//END_TESTCASE LBS-Client-ModInfo-0004


START_TESTCASE LBS-Client-ModInfo-0003

//!@SYMTestCaseID			LBS-Client-ModInfo-0003
//!@SYMTestCaseDesc			Module info by index for a valid index
//!
//!@SYMTestActions			1. Connect to the location server.
//!					2. Request module info use a valid index - use GetModulesInfoByIndex().
//!
//!@SYMTestExpectedResults	        Which module is returned cannot be guaranteed, so merely check that call works with no error
//!
//!@SYMPREQ				PREQ786
//!@SYMREQ 				REQ786.16
//!
//!@SYMTestType				CIT
//!@SYMTestPriority			1
//!@SYMTestStatus			Implemented

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP 20 LbsClientTestServer LbsStep_CreateVerifyModInfo c:\testdata\configs\LbsClientModInfo.ini LBS-Mod-Info-0001
RUN_TEST_STEP 20 LbsClientTestServer LbsClientStep_ModInfo c:\testdata\configs\LbsClientModInfo.ini LBS-Mod-Info-0001
//RUN_TEST_STEP 20 LbsClientTestServer LbsStep_VerifyModInfo

END_TESTCASE LBS-Client-ModInfo-0003


START_TESTCASE LBS-Client-ModInfo-0004

//!@SYMTestCaseID			LBS-Client-ModInfo-0004
//!@SYMTestCaseDesc			Module info by index for a negative in-valid index
//!@SYMTestActions			1. Connect to the location server.
//!					2. Request module info using an in-valid index of -1,
//!					use GetModulesInfoByIndex().
//!@SYMTestExpectedResults	        Verify the correct not found error is returned (KErrNotFound).
//!
//!@SYMPREQ				PREQ786
//!@SYMREQ 				REQ786.16
//!
//!@SYMTestType				CIT
//!@SYMTestPriority			2
//!@SYMTestStatus			Implemented

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP 20 LbsClientTestServer LbsClientStep_ModInfo c:\testdata\configs\LbsClientModInfo.ini LBS-Mod-Info-0002

END_TESTCASE LBS-Client-ModInfo-0004


START_TESTCASE LBS-Client-ModInfo-0005

//!@SYMTestCaseID			LBS-Client-ModInfo-0005
//!@SYMTestCaseDesc			Module info by index for a positive in-valid index
//!@SYMTestActions			1. Connect to the location server.
//!					2. Request module info using a in-valid index of
//!					(number of modules installed + 1) - use GetModulesInfoByIndex().
//!@SYMTestExpectedResults	        Verify the correct not found error is returned (KErrNotFound).
//!
//!@SYMPREQ				PREQ786
//!@SYMREQ 				REQ786.16
//!
//!@SYMTestType				CIT
//!@SYMTestPriority			2
//!@SYMTestStatus			Implemented

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP 20 LbsClientTestServer LbsClientStep_ModInfo c:\testdata\configs\LbsClientModInfo.ini LBS-Mod-Info-0003

END_TESTCASE LBS-Client-ModInfo-0005


START_TESTCASE LBS-Client-ModInfo-0006

//!@SYMTestCaseID			LBS-Client-ModInfo-0006
//!@SYMTestCaseDesc			Module info by index with no server connection
//!@SYMTestActions			1. Request module info using a valid index - use GetModulesInfoByIndex().
//!					Note: No server connection is carried out.
//!@SYMTestExpectedResults	        Verify the correct panic is given, as a result of not having a
//!					connection established with the location server.
//!
//!@SYMPREQ				PREQ786
//!@SYMREQ 				REQ786.16
//!
//!@SYMTestType				CIT
//!@SYMTestPriority			2
//!@SYMTestStatus			Implemented

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP !PanicCode=6 20 LbsClientTestServer LbsClientStep_ModInfo c:\testdata\configs\LbsClientModInfo.ini LBS-Mod-Info-0004

END_TESTCASE LBS-Client-ModInfo-0006


START_TESTCASE LBS-Client-ModInfo-0007

//!@SYMTestCaseID			LBS-Client-ModInfo-0007
//!@SYMTestCaseDesc			Module info by id for a valid id
//!@SYMTestActions			1. Connect to the location server.
//!					2. Request module info use a valid id - use GetModulesInfoById().
//!@SYMTestExpectedResults	        Which module is returned cannot be guaranteed, so merely check that call works with no error
//!
//!@SYMPREQ				PREQ786
//!@SYMREQ 				REQ786.16
//!
//!@SYMTestType				CIT
//!@SYMTestPriority			1
//!@SYMTestStatus			Implemented

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP 20 LbsClientTestServer LbsStep_CreateVerifyModInfo c:\testdata\configs\LbsClientModInfo.ini LBS-Mod-Info-0005
RUN_TEST_STEP 20 LbsClientTestServer LbsClientStep_ModInfo c:\testdata\configs\LbsClientModInfo.ini LBS-Mod-Info-0005

END_TESTCASE LBS-Client-ModInfo-0007


START_TESTCASE LBS-Client-ModInfo-0008

//!@SYMTestCaseID			LBS-Client-ModInfo-0008
//!@SYMTestCaseDesc			Module info by id for a in-valid id
//!@SYMTestActions			1. Connect to the location server.
//!					2. Request module info using an in-valid - use GetModulesInfoById().
//!@SYMTestExpectedResults	        Verify the correct not found error is returned (KErrNotFound).
//!
//!@SYMPREQ				PREQ786
//!@SYMREQ 				REQ786.16
//!
//!@SYMTestType				CIT
//!@SYMTestPriority			2
//!@SYMTestStatus			Implemented

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP 20 LbsClientTestServer LbsClientStep_ModInfo c:\testdata\configs\LbsClientModInfo.ini LBS-Mod-Info-0006

END_TESTCASE LBS-Client-ModInfo-0008


START_TESTCASE LBS-Client-ModInfo-0009

//!@SYMTestCaseID			LBS-Client-ModInfo-0009
//!@SYMTestCaseDesc			Module info by id with no server connection
//!@SYMTestActions			1. Request module info using a valid id - use GetModulesInfoById().
//!					Note: No server connection is carried out.
//!@SYMTestExpectedResults	        Verify the correct panic is given, as a result of not having a
//!					connection established with the location server.
//!
//!@SYMPREQ				PREQ786
//!@SYMREQ 				REQ786.16
//!
//!@SYMTestType				CIT
//!@SYMTestPriority			2
//!@SYMTestStatus			Implemented

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP !PanicCode=6 20 LbsClientTestServer LbsClientStep_ModInfo c:\testdata\configs\LbsClientModInfo.ini LBS-Mod-Info-0007

END_TESTCASE LBS-Client-ModInfo-0009


START_TESTCASE LBS-Client-ModInfo-0010

//!@SYMTestCaseID			LBS-Client-ModInfo-0010
//!@SYMTestCaseDesc			Get default module id 
//!
//!@SYMTestActions			1. Connect to the location server.
//!					        2. Request default module id  - use GetDefaultModuleId().
//!
//!@SYMTestExpectedResults	Verify the correct module id is returned for the selected default module . 
//!					
//!@SYMPREQ				PREQ786
//!@SYMREQ 				REQ786.16
//!
//!@SYMTestType				CIT
//!@SYMTestPriority			2
//!@SYMTestStatus			Implemented

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP 020 LbsClientTestServer LbsStep_SetUpPsy c:\testdata\configs\lbsclientmodinfo.ini LBS-Mod-Info
RUN_TEST_STEP 20 LbsClientTestServer LbsClientStep_ModInfo c:\testdata\configs\LbsClientModInfo.ini LBS-Mod-Info-0008

END_TESTCASE LBS-Client-ModInfo-0010


START_TESTCASE LBS-Client-ModInfo-0011

//!@SYMTestCaseID			LBS-Client-ModInfo-0011
//!@SYMTestCaseDesc			Get default module id with no server connection
//!@SYMTestActions			1. Request the default module id - use GetDefaultModuleId().
//!					Note: No server connection is carried out.
//!@SYMTestExpectedResults	        Verify the correct panic is given, as a result of not having
//!					a connection established with the location server.
//!
//!@SYMPREQ				PREQ786
//!@SYMREQ 				REQ786.15
//!
//!@SYMTestType				CIT
//!@SYMTestPriority			2
//!@SYMTestStatus			Implemented

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP !PanicCode=6 20 LbsClientTestServer LbsClientStep_ModInfo c:\testdata\configs\LbsClientModInfo.ini LBS-Mod-Info-0009

END_TESTCASE LBS-Client-ModInfo-0011


RUN_TEST_STEP 030 LbsClientTestServer LbsStep_StopLbs
// Re-select the real A-GPS integration module.
RUN_UTILS DeleteFile c:\private\10282253\lbs\locmods\agpsintegmodule.ini

// Delete network registration status text file
RUN_UTILS DeleteFile c:\config.txt
