## GT0128 Hurricane WAP
## WSP Protocol Handler
#######################
## Ref. SGL.GT0128.aaa.bbb WSP Protocol Handler Unit Tests
## Unit test 2.3.1.1
## Driver chat script
#
# Test Synopsis
# * Invoke GET method 

# Expected Result
# * Expected result: GET returns successfully


SCRIPT UnitTestDriver2.3.1.1 

#
# Sleep before start, allows stub time to start up and initialise.
#
	SLEEP 500
#
# Step 1 - set up the desired WSP proxy for this test
#
	INCLUDE "C:\HttpTest\wsp_pr_hnd_driver\setproxyinfo_driver.txt"

#
# Step 1a - make a clean connection to a WSP proxy
#
	INCLUDE "C:\HttpTest\wsp_pr_hnd_driver\doconnect_accept_driver.txt"

#
# Step 2 - open a transaction (will be given ID trans1)
#
	INCLUDE "C:\HttpTest\wsp_pr_hnd_driver\doopen_get_trans_driver.txt"

#
# Step 3 - submit the transaction
#
	SEND
		INVOKE trans1 SubmitL
		ENDINVOKE
	ENDSEND

#
# Step 4 - await the arrival of the response headers event
#
	EXPECT
		INVOCATION TransactionRunL
			VALIDATE aTransaction trans1
			VALIDATE aEvent EGotResponseHeaders
		ENDINVOCATION
	ENDEXPECT

#
# Step 4a - validate the response status code and headers
#
	SEND
		INVOKE trans1 GetStatusCode
			VALIDATE :RETURN: 200
		ENDINVOKE
		INVOKE trans1 GetHeaderL
			PARAMETER aFieldName Content-Type
			PARAMETER aFieldType RStringF
			VALIDATE aFieldValue application/vnd.wap.wmlc
			PARAMETER aPart 0
			VALIDATE :RETURN: ETrue
		ENDINVOKE
	ENDSEND

#
# Step 5 - await the arrival of the response body event
#
	EXPECT
		INVOCATION TransactionRunL
			VALIDATE aTransaction trans1
			VALIDATE aEvent EGotResponseBodyData
		ENDINVOCATION
	ENDEXPECT

#
# Step 5a - validate the response body
#
	SEND
		INVOKE trans1 GetBody
			STOREITEM :RETURN: respBody
		ENDINVOKE
		INVOKE respBody MHTTPDataSupplier::OverallDataSize
			VALIDATE :RETURN: 12
		ENDINVOKE
		INVOKE respBody MHTTPDataSupplier::GetNextDataPart
			VALIDATE aDataPart "SomeBodyData"
			VALIDATE :RETURN: ETrue
		ENDINVOKE
	ENDSEND

#
# Step 5b - release the response body and expect to be reentered with the
#			response complete event
#
	SEND
		ALLOWREENTRANCY
		INVOKE respBody MHTTPDataSupplier::ReleaseData
		ENDINVOKE
	ENDSEND
	EXPECT
		INVOCATION TransactionRunL
			VALIDATE aTransaction trans1
			VALIDATE aEvent EResponseComplete
		ENDINVOCATION
	ENDEXPECT

#
# Step 6 - close the transaction
#
	SEND
		INVOKE trans1 Close
		ENDINVOKE
	ENDSEND
#
# Ask for disconnect
# 
	SLEEP 500
	INCLUDE "C:\HttpTest\wsp_pr_hnd_driver\do_clientdisconnect_driver.txt"
#
# Give the stub a chance to finish before exiting
#
	SLEEP 500
#
# Done!
#

ENDSCRIPT


