## Include script - trans2 response data in several chunks, several SDUs
#
# Body data -
# response_data_2_stub.txt, in 4 parts, response_data_2a_stub.txt, response_data_2b_stub.txt, response_data_2c_stub.txt, response_data_2d_stub.txt
#
# Header data- 
# Content-Type : application/vnd.wap.wmlc
# Trailer : Server
#
# The method will be in the Null state
#
SCRIPT trans2_response_trailers_multisdu_driver
#
# Expect the S-MethodResult.ind primitive - first the headers event...
#
	EXPECT
		INVOCATION TransactionRunL
			VALIDATE aTransaction trans2
			VALIDATE aEvent EGotResponseHeaders
		ENDINVOCATION
	ENDEXPECT
#
# ...then the body data event - first part
#
	EXPECT
		INVOCATION TransactionRunL
			VALIDATE aTransaction trans2
			VALIDATE aEvent EGotResponseBodyData
		ENDINVOCATION
	ENDEXPECT
#
# Check the status code and the content-type header and trailer header
#
	SLEEP 500
	SEND
		INVOKE trans2 GetStatusCode
			VALIDATE :RETURN: 200
		ENDINVOKE
		INVOKE trans2 GetHeaderL
			PARAMETER aFieldName Content-Type
			VALIDATE aFieldType RStringF
			VALIDATE aFieldValue application/vnd.wap.wmlc
			PARAMETER aPart 0
			VALIDATE :RETURN: ETrue
		ENDINVOKE
		INVOKE trans2 GetHeaderL
			PARAMETER aFieldName Trailer
			VALIDATE aFieldType RStringF
			VALIDATE aFieldValue Server
			PARAMETER aPart 0
			VALIDATE :RETURN: ETrue
		ENDINVOKE
	ENDSEND
#
# Get the response body data supplier and the data - first part
#
	SEND
		INVOKE trans2 GetBody
			STOREITEM :RETURN: respBody2
		ENDINVOKE
		INVOKE respBody2 MHTTPDataSupplier::OverallDataSize
			VALIDATE :RETURN: 200
		ENDINVOKE
		INVOKE respBody2 MHTTPDataSupplier::GetNextDataPart
			VALIDATE aDataPart <$file$C:\HttpTest\wsp_pr_hnd_driver\response_data_2a_driver.txt$file$>
			VALIDATE :RETURN: EFalse
		ENDINVOKE
	ENDSEND
	SEND
		INVOKE respBody2 MHTTPDataSupplier::ReleaseData
		ENDINVOKE
	ENDSEND
#
# Expect more body data... - second part
#
	EXPECT
		INVOCATION TransactionRunL
			VALIDATE aTransaction trans2
			VALIDATE aEvent EGotResponseBodyData
		ENDINVOCATION
	ENDEXPECT
#
# Get the data - second part
#
	SLEEP 500
	SEND
		INVOKE respBody2 MHTTPDataSupplier::GetNextDataPart
			VALIDATE aDataPart <$file$C:\HttpTest\wsp_pr_hnd_driver\response_data_2b_driver.txt$file$>
			VALIDATE :RETURN: EFalse
		ENDINVOKE
	ENDSEND
	SEND
		INVOKE respBody2 MHTTPDataSupplier::ReleaseData
		ENDINVOKE
	ENDSEND
#
# Expect more body data... - third part
#
	EXPECT
		INVOCATION TransactionRunL
			VALIDATE aTransaction trans2
			VALIDATE aEvent EGotResponseBodyData
		ENDINVOCATION
	ENDEXPECT
#
# Get the data - third part
#
	SLEEP 500
	SEND
		INVOKE respBody2 MHTTPDataSupplier::GetNextDataPart
			VALIDATE aDataPart <$file$C:\HttpTest\wsp_pr_hnd_driver\response_data_2c_driver.txt$file$>
			VALIDATE :RETURN: EFalse
		ENDINVOKE
	ENDSEND
	SEND
		ALLOWREENTRANCY
		INVOKE respBody2 MHTTPDataSupplier::ReleaseData
		ENDINVOKE
	ENDSEND
#
# Expect more body data... - fourth part
#
	EXPECT
		INVOCATION TransactionRunL
			VALIDATE aTransaction trans2
			VALIDATE aEvent EGotResponseBodyData
		ENDINVOCATION
	ENDEXPECT
#
# Get the data - fourth part
#
	SLEEP 500
	SEND
		INVOKE respBody2 MHTTPDataSupplier::GetNextDataPart
			VALIDATE aDataPart <$file$C:\HttpTest\wsp_pr_hnd_driver\response_data_2d_driver.txt$file$>
			VALIDATE :RETURN: ETrue
		ENDINVOKE
	ENDSEND
	SEND
		ALLOWREENTRANCY
		INVOKE respBody2 MHTTPDataSupplier::ReleaseData
		ENDINVOKE
	ENDSEND
#
# Expect the trailer headers event
#
	EXPECT
		INVOCATION	TransactionRunL
			VALIDATE aTransaction trans2
			VALIDATE aEvent EGotResponseTrailerHeaders
		ENDINVOCATION
	ENDEXPECT
#
# Expect the response complete event
#
	EXPECT
		INVOCATION	TransactionRunL
			VALIDATE aTransaction trans2
			VALIDATE aEvent EResponseComplete
		ENDINVOCATION
	ENDEXPECT
#
# Expect the succeeded event
#
	EXPECT
		INVOCATION	TransactionRunL
			VALIDATE aTransaction trans2
			VALIDATE aEvent ESucceeded
		ENDINVOCATION
	ENDEXPECT
#
# Check the server header
#
	SLEEP 500
	SEND
		INVOKE trans2 GetHeaderL
			PARAMETER aFieldName Server
			VALIDATE aFieldType RStringF
			VALIDATE aFieldValue bunny
			PARAMETER aPart 0
			VALIDATE :RETURN: ETrue
		ENDINVOKE
	ENDSEND
ENDSCRIPT
