//! @File
//! @SYMTestSuiteName	lbsclientmodstatusevent.script
//! @SYMScriptTestEnvironment

// Copyright (c) 2008-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-ModStatusEvent-0001

//!@SYMTestCaseID		LBS-Client-ModStatusEvent-0001
//!@SYMTestCaseDesc		Request module status event for all modules
//!
//!@SYMTestActions			1. Configure test agps module with device and data quality
//!					2. Connect to the location server.
//!					3. Set the notify module event mask to select device status event 
//!					4. Request module status event for all modules (ie do not provide a moduleid)
//!					5. Kick test agps module to cause events requested above
//!					6. Wait for events from (test) agps module and verify as below
//!
//!@SYMTestExpectedResults	Verify the correct event is returned for agps modules. Ensure the event
//!				details are correct.
//!@SYMPREQ			
//!                             PREQ786
//!@SYMREQ 			REQ786.18
//!
//!@SYMTestType			CIT
//!@SYMTestPriority		1
//!@SYMTestStatus			Implemented, test a-gps modules maybe required.

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP 020 LbsClientTestServer LbsStep_SetUpPsy c:\testdata\configs\LbsClientModStatusEvent.ini LBS-CLIENT-MODSTATUSEVENT
RUN_TEST_STEP 120 LbsClientTestServer LbsStep_CreateVerifyModuleData c:\testdata\configs\LbsClientModStatusEvent.ini LBS-Mod-Status-Event-0002
RUN_TEST_STEP 20 LbsClientTestServer  LbsClientStep_ModStatus c:\testdata\configs\LbsClientModStatusEvent.ini LBS-Mod-Status-Event-0002
RUN_TEST_STEP 120 LbsClientTestServer LbsStep_VerifyModuleStatus

END_TESTCASE LBS-Client-ModStatusEvent-0001


START_TESTCASE LBS-Client-ModStatusEvent-0002

//!@SYMTestCaseID		LBS-Client-ModStatusEvent-0002
//!@SYMTestCaseDesc		Request multiple module status events for a given module
//!
//!@SYMTestActions		1. Configure test agps module with device and data quality
//!				2. Connect to the location server.
//!				3. Set the notify module event mask to select device status event 
//!				4. Request module status event using module id for (test) agps module
//!				5. Kick test agps module to cause events requested above
//!				6. Wait for event and verify as below
//!				7. Repeat steps 4 to 6, to request a further status event.
//!
//!@SYMTestExpectedResults	Verify the correct events are returned for the module. Ensure the event
//!				details are correct.
//!@SYMPREQ			
//!                             PREQ786
//!@SYMREQ 			REQ786.18
//!
//!@SYMTestType			CIT
//!@SYMTestPriority		1
//!@SYMTestStatus			Implemented, test a-gps module required.

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP 020 LbsClientTestServer LbsStep_SetUpPsy c:\testdata\configs\LbsClientModStatusEvent.ini LBS-CLIENT-MODSTATUSEVENT
RUN_TEST_STEP 120 LbsClientTestServer LbsStep_CreateVerifyModuleData c:\testdata\configs\LbsClientModStatusEvent.ini LBS-Mod-Status-Event-0003
RUN_TEST_STEP 20 LbsClientTestServer LbsClientStep_ModStatus c:\testdata\configs\LbsClientModStatusEvent.ini LBS-Mod-Status-Event-0003
RUN_TEST_STEP 120 LbsClientTestServer LbsStep_VerifyModuleStatus

END_TESTCASE LBS-Client-ModStatusEvent-0002


START_TESTCASE LBS-Client-ModStatusEvent-0003

//!@SYMTestCaseID		LBS-Client-ModStatusEvent-0003
//!@SYMTestCaseDesc		Request module device status event for a-gps module
//!
//!@SYMTestActions		1. Configure test agps module with device and data quality
//!				2. Connect to the location server.
//!				3. Set the notify module event mask to select device status event 
//!				4. Request module status event using a valid module id for a-gps module
//!				5. Kick test agps module to cause events requested above
//!				6. Wait for event and verify as below 
//!
//!					

//!@SYMTestExpectedResults	Verify the correct event is returned for the module. Ensure the event
//!				details are correct.
//!@SYMPREQ			PREQ786
//!@SYMREQ 			REQ786.18
//!
//!@SYMTestType			CIT
//!@SYMTestPriority		1
//!@SYMTestStatus		Implemented. test a-gps required.

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP 020 LbsClientTestServer LbsStep_SetUpPsy c:\testdata\configs\LbsClientModStatusEvent.ini LBS-CLIENT-MODSTATUSEVENT
RUN_TEST_STEP 120 LbsClientTestServer LbsStep_CreateVerifyModuleData c:\testdata\configs\LbsClientModStatusEvent.ini LBS-Mod-Status-Event-0004
RUN_TEST_STEP 20 LbsClientTestServer LbsClientStep_ModStatus c:\testdata\configs\LbsClientModStatusEvent.ini LBS-Mod-Status-Event-0004
RUN_TEST_STEP 120 LbsClientTestServer LbsStep_VerifyModuleStatus

END_TESTCASE LBS-Client-ModStatusEvent-0003


START_TESTCASE LBS-Client-ModStatusEvent-0004

//!@SYMTestCaseID		LBS-Client-ModStatusEvent-0004
//!@SYMTestCaseDesc		Request module data quality status event
//!
//!@SYMTestActions			
//!					1. Configure test agps module with device and data quality
//!					2. Connect to the location server.
//!					3. Set the notify module event mask to select data quality status event
//!					4. Request module status event using a valid agps module id
//!					5. Kick test agps module to cause events requested above
//!					6. Wait for event and verify as below 

//!@SYMTestExpectedResults	Verify the correct data quality event is returned. Ensure the event details
//!								are correct.
//!@SYMPREQ				PREQ786
//!@SYMREQ 				REQ786.17
//!
//!@SYMTestType			CIT
//!@SYMTestPriority		1
//!@SYMTestStatus			Implemented, test a-gps module required.

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP 020 LbsClientTestServer LbsStep_SetUpPsy c:\testdata\configs\LbsClientModStatusEvent.ini LBS-CLIENT-MODSTATUSEVENT
RUN_TEST_STEP 120 LbsClientTestServer LbsStep_CreateVerifyModuleData c:\testdata\configs\LbsClientModStatusEvent.ini LBS-Mod-Status-Event-0005
RUN_TEST_STEP 20 LbsClientTestServer LbsClientStep_ModStatus c:\testdata\configs\LbsClientModStatusEvent.ini LBS-Mod-Status-Event-0005
RUN_TEST_STEP 120 LbsClientTestServer LbsStep_VerifyModuleStatus

END_TESTCASE LBS-Client-ModStatusEvent-0004


START_TESTCASE LBS-Client-ModStatusEvent-0005

//!@SYMTestCaseID		LBS-Client-ModStatusEvent-0005
//!@SYMTestCaseDesc		Request system module status event - system module error.
//!
//!@SYMTestActions		1. configure system to be transient
//!				2. use agps test module that leaves during install or have a configuration file with no binary (Billy's suggestions)
//!				3. Connect to the location server.
//!				4. Set the notify module event mask to select system status event
//!				5. Request module status event using agps module id
//!				6. Cause a-gps manager to attempt to install agps module (how?)
//!				7. Wait for event and verify as below 
//!							
//!@SYMTestExpectedResults	Verify the correct system module error event is returned for. Ensure the
//!				event details are correct.
//!@SYMPREQ			
//!                             PREQ786
//!@SYMREQ 			REQXXX.XX
//!
//!@SYMTestType			CIT
//!@SYMTestPriority		1
//!@SYMTestStatus		Not Implemented. Requires leaving test agps module. Needs to be in a different script file since requires 'transient' config?

END_TESTCASE LBS-Client-ModStatusEvent-0005


START_TESTCASE LBS-Client-ModStatusEvent-0006

//!@SYMTestCaseID		LBS-Client-ModStatusEvent-0006
//!@SYMTestCaseDesc		Request system module status event - system module installed.
//!
//!@SYMTestActions		1. configure system to be transient
//!				2. Connect to the location server.
//!				3. Set the notify module event mask to select system status event
//!				4. Request module status event using agps module id
//!				5. Cause a-gps manager to attempt to install agps module (how?)
//!				6. Wait for event and verify as below 
//!				
//!@SYMTestExpectedResults	Verify the correct system module installed event is returned. Ensure the
//!								event details are correct.
//!@SYMPREQ				PREQ786
//!@SYMREQ 				REQXXX.XX
//!
//!@SYMTestType			CIT
//!@SYMTestPriority		2
//!@SYMTestStatus			Not Implemented. Requires leaving test agps module. Needs to be in a different script file since requires 'transient' config?

END_TESTCASE LBS-Client-ModStatusEvent-0006


START_TESTCASE LBS-Client-ModStatusEvent-0007

//!@SYMTestCaseID		LBS-Client-ModStatusEvent-0007
//!@SYMTestCaseDesc		Request system module status event - system module removed
//!
//!@SYMTestActions		1. configure system to be transient
//!				2. Connect to the location server.
//!				3. Set the notify module event mask to select system status event
//!				4. Request module status event using agps module id
//!				5. Cause a-gps manager to attempt to install agps module (how?)
//!				6. Wait for install event (?)
//!				7. Wait long enough (how long's that?) for a-gps mgr to uninstall a-gps module
//!				8. Wait for event and verify as below
//!							
//!@SYMTestExpectedResults	Verify the correct system module error event is returned. Ensure the
//!								event details are correct.
//!@SYMPREQ				PREQ786
//!@SYMREQ 				REQXXX.XX
//!
//!@SYMTestType			CIT
//!@SYMTestPriority		2
//!@SYMTestStatus			Not Implemented. Needs to be in a different script file since requires 'transient' config?

END_TESTCASE LBS-Client-ModStatusEvent-0007


START_TESTCASE LBS-Client-ModStatusEvent-0008

//!@SYMTestCaseID		LBS-Client-ModStatusEvent-0008
//!@SYMTestCaseDesc		Request devicestatus and device quality status events
//!
//!@SYMTestActions		1. Configure test agps module with device and data quality
//!				2. Connect to the location server.
//!				3. Set the notify module event mask to select both status events
//!				4. Request module status event using a-gps module id
//!				5. Kick test agps module to cause events requested above
//!				6. Wait for all module status events and verify as below
//!							
//!@SYMTestExpectedResults	Verify all the correct events are returned. Ensure the event details are
//!								correct.
//!@SYMPREQ			PREQ786
//!@SYMREQ 			REQ786.17
//!@SYMREQ 			REQ786.18
//!
//!@SYMTestType			CIT
//!@SYMTestPriority		1
//!@SYMTestStatus			Implemented, test module required.

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP 020 LbsClientTestServer LbsStep_SetUpPsy c:\testdata\configs\LbsClientModStatusEvent.ini LBS-CLIENT-MODSTATUSEVENT
RUN_TEST_STEP 120 LbsClientTestServer LbsStep_CreateVerifyModuleData c:\testdata\configs\LbsClientModStatusEvent.ini LBS-Mod-Status-Event-0009
RUN_TEST_STEP 20 LbsClientTestServer LbsClientStep_ModStatus c:\testdata\configs\LbsClientModStatusEvent.ini LBS-Mod-Status-Event-0009
RUN_TEST_STEP 120 LbsClientTestServer LbsStep_VerifyModuleStatus

END_TESTCASE LBS-Client-ModStatusEvent-0008


START_TESTCASE LBS-Client-ModStatusEvent-0009

//!@SYMTestCaseID		LBS-Client-ModStatusEvent-0009
//!@SYMTestCaseDesc		Request module status event for a non-existing module
//!
//!@SYMTestActions		1. Connect to the location server.
//!				2. Set the notify module event mask to select all status events
//!				3. Request module status event using an in-valid module id
//!				4. Wait for module status event and verify as below
//!
//!@SYMTestExpectedResults	Verify the correct error is returned (KErrNotFound).
//!
//!@SYMPREQ			PREQ786
//!@SYMREQ 			REQ786.17
//!@SYMREQ 			REQ786.18
//!
//!@SYMTestType			CIT
//!@SYMTestPriority		2
//!@SYMTestStatus			Implemented.

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP 020 LbsClientTestServer LbsStep_SetUpPsy c:\testdata\configs\LbsClientModStatusEvent.ini LBS-CLIENT-MODSTATUSEVENT
RUN_TEST_STEP 20 LbsClientTestServer LbsClientStep_ModStatus c:\testdata\configs\LbsClientModStatusEvent.ini LBS-Mod-Status-Event-0010

END_TESTCASE LBS-Client-ModStatusEvent-0009


// Not a valid test on variant2
//START_TESTCASE LBS-Client-ModStatusEvent-0010

//!@SYMTestCaseID		LBS-Client-ModStatusEvent-0010
//!@SYMTestCaseDesc		Request module status event when no events have been requested
//!
//!@SYMTestActions		1. Connect to the location server.
//!				2. Set the notify module event mask to select no events
//!				3. Request module status event using a valid module id
//!				4. Wait for module status event and verify as below
//!								
//!@SYMTestExpectedResults	Verify the correct error is returned (KErrArgument).
//!
//!@SYMPREQ			PREQ786
//!@SYMREQ 			REQ786.17
//!@SYMREQ 			REQ786.18
//!
//!@SYMTestType			CIT
//!@SYMTestPriority		2
//!@SYMTestStatus			Implemented. 

//RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
//RUN_TEST_STEP 020 LbsClientTestServer LbsStep_SetUpPsy c:\testdata\configs\LbsClientModStatusEvent.ini LBS-CLIENT-MODSTATUSEVENT
//RUN_TEST_STEP 20 LbsClientTestServer LbsClientStep_ModStatus c:\testdata\configs\LbsClientModStatusEvent.ini LBS-Mod-Status-Event-0011

//END_TESTCASE LBS-Client-ModStatusEvent-0010


START_TESTCASE LBS-Client-ModStatusEvent-0011

//!@SYMTestCaseID			LBS-Client-ModStatusEvent-0011
//!@SYMTestCaseDesc		Cancel module status event request
//!
//!@SYMTestActions		1. Connect to the location server.
//!				2. Set the notify module event mask to select device status event
//!				3. Request module status event using a-gps module id
//!				4. Cancel module status event
//!				5. Wait for event to be cancelled and verify as below.
//!
//!@SYMTestExpectedResults	Request completed with the correct error (KErrCancel).
//!
//!@SYMPREQ			PREQ786
//!@SYMREQ 			REQ786.13
//!@SYMREQ 			REQ786.17
//!@SYMREQ 			REQ786.18
//!
//!@SYMTestType			CIT
//!@SYMTestPriority		1
//!@SYMTestStatus			Implemented.

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP 020 LbsClientTestServer LbsStep_SetUpPsy c:\testdata\configs\LbsClientModStatusEvent.ini LBS-CLIENT-MODSTATUSEVENT
RUN_TEST_STEP 20 LbsClientTestServer LbsClientStep_ModStatus c:\testdata\configs\LbsClientModStatusEvent.ini LBS-Mod-Status-Event-0012

END_TESTCASE LBS-Client-ModStatusEvent-0011


START_TESTCASE LBS-Client-ModStatusEvent-0012

//!@SYMTestCaseID		LBS-Client-ModStatusEvent-0012
//!@SYMTestCaseDesc		Cancel a non-existent module status event request
//!
//!@SYMTestActions		1. Connect to the location server.
//!				2. Cancel module status event 
//!				Note: do not request module status event.
//!
//!@SYMTestExpectedResults	Verify the correct bad argument error (KErrNotFound) is returned to
//!						indicate there is no outstanding request with the specified ID.
//!@SYMPREQ				PREQ786
//!@SYMREQ 				REQ786.13
//!@SYMREQ 				REQ786.17
//!@SYMREQ 				REQ786.18
//!
//!@SYMTestType			CIT
//!@SYMTestPriority		2
//!@SYMTestStatus			Implemented. 

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP 020 LbsClientTestServer LbsStep_SetUpPsy c:\testdata\configs\LbsClientModStatusEvent.ini LBS-CLIENT-MODSTATUSEVENT
RUN_TEST_STEP 20 LbsClientTestServer LbsClientStep_ModStatus c:\testdata\configs\LbsClientModStatusEvent.ini LBS-Mod-Status-Event-0013

END_TESTCASE LBS-Client-ModStatusEvent-0012


START_TESTCASE LBS-Client-ModStatusEvent-0013

//!@SYMTestCaseID		LBS-Client-ModStatusEvent-0013
//!@SYMTestCaseDesc		Request module status event with no server connection
//!
//!@SYMTestActions		1. Cancel a module status event request - use CancelRequest().
//!				  Note: no server connection is carried out and the request ID is not valid.
//!
//!@SYMTestExpectedResults	Verify the correct panic (EPositionServerBadHandle) is given, as a result of not having a connection
//!								established with the location server.
//!@SYMPREQ				PREQ786
//!@SYMREQ 				REQ786.13
//!@SYMREQ 				REQ786.17
//!@SYMREQ 				REQ786.18
//!
//!@SYMTestType			CIT
//!@SYMTestPriority		2
//!@SYMTestStatus			Not Implemented.

RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
RUN_TEST_STEP 020 LbsClientTestServer LbsStep_SetUpPsy c:\testdata\configs\LbsClientModStatusEvent.ini LBS-CLIENT-MODSTATUSEVENT
RUN_TEST_STEP !PanicCode=6 20 LbsClientTestServer LbsClientStep_ModStatus c:\testdata\configs\LbsClientModStatusEvent.ini LBS-Mod-Status-Event-0014

END_TESTCASE LBS-Client-ModStatusEvent-0013





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
