<?xml version="1.0" encoding="UTF-8"?>
<ccxml xmlns="http://www.w3.org/2002/09/ccxml" xmlns:conf="http://www.w3.org/2005/ccxml-conformance" version="1.0">
<!--
Serguei's infrastructure performs a loop on the 'assertions' Ecma array, based on "name_prepare_new" event for doing the "loop".

Mainly we have to different levels of assertions: 

- Main assertions, stored in 'assertions' array
- Children assertions, stored into 'assert_trace'

An assertion is a child assertion if it does not need to perform any action, but it is sufficient to test its father assertion result to determine if it passes or fails.

The test finishes when all the main assertions have been tested. Children assertions are tested after the father itself.

If an unexpected event is caught by the <transition event"*"/> a comment is printed and the loop continues with the next iteration.

An hang up event causes the interruption of test: session exits.

All the send.successful events are caught and ignored (they are generated by the loop mechanism).
-->

<!--
Release 1.1 - 2010-06-15
FIXED: 
ISSUE-709, declaration of result variable into javascript. 
-->

	<conf:docsetup/>

	<var name="myFetchID"/>
 	<var name="var632_fetchevent_arrived" expr="false"/>
 	<var name="var632_parallel_arrived" expr="false"/>
 	<var name="par1" expr="'val_par_1'"/>
 	<var name="flag1" expr="false"/>
 	

<!-- FIXED ISSUE-709: result variable declaration -->
	<script><![CDATA[
		
		function extractCurrentDir(currUri)
		{
			var result;
			i = currUri.lastIndexOf("/");
			result = currUri.substring(0,i+1);
			return result;
		}
	
		var i=0;
		
		assertions[i++] = init_assertion('632');		
		assertions[i++] = init_assertion('631');		
		assertions[i++] = init_assertion('634');		
		assertions[i++] = init_assertion('635');				
		assertions[i++] = init_assertion('1001');				
		assertions[i++] = init_assertion('1002');				
		assertions[i++] = init_assertion('650');				
		assertions[i++] = init_assertion('995');				
		assertions[i++] = init_assertion('642');
		assertions[i++] = init_assertion('646');
		assertions[i++] = init_assertion('996');
		assertions[i++] = init_assertion('641');
		assertions[i++] = init_assertion('1298');
		assertions[i++] = init_assertion('1299');
		
		// must be the last one
		assertions[i++] = init_assertion('638');				
		
			
		var assert_last = i - 1;
		var assert_index = -1;
		//
		// out of the loop assertions (children)

		// Children of 632
		add_2_assert_trace('630');
		add_2_assert_trace('633');

		// Children of 631
		add_2_assert_trace('636');
		add_2_assert_trace('637');
		add_2_assert_trace('640');
		add_2_assert_trace('645');

		// Children of 1001
		add_2_assert_trace('643');
				
		s_ASSERTIONS_LEFT = show_remained_assertions();
		var b_in_test = false;
	]]></script>
	
	
	<eventprocessor statevariable="current_state">
		<conf:setup type="connected"/>

		<transition event="connection.connected" state="init">
			<conf:comment expr="'Event: ' + event$.name"/>
	    <send targettype="'ccxml'" target="session.id" name="'user.timeout'" delay="TEST_LONG_TIMEOUT"/>			
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>

		<transition event="user.PREPARE_NEW">
			<conf:comment expr="'Event: ' + event$.name"/>
			<if cond="assert_index &gt;= 0">
				<assign name="ASSERTION_NUM" expr="assertions[assert_index].number"/>
				<assign name="t_ASSERT_RESULT" expr="assertions[assert_index].P_F"/>
				<script>assertions[assert_index].reason = t_ASSERT_REASON;</script>
				<if cond="t_ASSERT_RESULT == s_PASS">
					<conf:pass reason="t_ASSERT_REASON"/>
					<elseif cond="t_ASSERT_RESULT == s_FAIL"/>
					<conf:fail reason="t_ASSERT_REASON"/>
					<else/>
					<conf:not_exec reason="t_ASSERT_REASON"/>
				</if>
			</if>
			<assign name="assert_index" expr="assert_index + 1"/>
			<if cond="assert_index &gt; assert_last">
				<log label="s_TA" expr="s_ASSERTIONS_LEFT"/>
				<conf:uncond_exit expr="'DONE'"/>
				<else/>
				<log label="s_TA" expr="s_ASSERTIONS_LEFT"/>
				<assign name="ASSERTION_NUM" expr=" assertions[assert_index].number"/>
				<assign name="t_ASSERT_REASON" expr="''"/>
				<script>assertions[assert_index].P_F = s_FAIL;</script>
				<assign name="current_state" expr="state_prefix + ASSERTION_NUM"/>
				<send targettype="'ccxml'" target="session.id" name="start_name_prefix + ASSERTION_NUM"/>
			</if>
		</transition>

    	      			
<!-- 
632. Execution returns from the element immediately, and the CCXML application can continue on while the platform works to fetch the identified resource.
-->
		<transition event="user.START_ASSERTION_632" state="ASSERTION_NMBR_632">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>					
		
			<fetch next="'cgi-bin/load_ccxml_page.ircgi'"/>
			<assign name="var632_parallel_arrived" expr="false"/>
			<assign name="var632_fetchevent_arrived" expr="false"/>

			<send targettype="'ccxml'" target="session.id" name="'ccxml.632.parallel'"/>
    	  		    	
		</transition>

		<transition event="ccxml.632.parallel" state="ASSERTION_NMBR_632">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
		
			<assign name="var632_parallel_arrived" expr="true"/>
			<if cond="var632_fetchevent_arrived">
				<script>assertions[assert_index].P_F = s_FAIL;</script>
				<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
			</if>
		
		</transition>
		
<!--
630.
<fetch> is used to asynchronously fetch content identified by the attributes of the <fetch>

633.
When the fetch request has been completed, a fetch.done event is thrown to indicates that the identified content was fetched successfully
-->

		<transition event="fetch.done" state="ASSERTION_NMBR_632">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<assign name="var632_fetchevent_arrived" expr="true"/>
			
			<!-- Begin Related Tests -->
			<assign name="ASSERTION_NUM" expr="'633'"/>		
			<conf:pass/>
			
			<assign name="ASSERTION_NUM" expr="'630'"/>		
			<conf:pass/>			
			<!-- End Related Tests -->
			
			<if cond="var632_parallel_arrived">
				<script>assertions[assert_index].P_F = s_PASS;</script>
				<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
			</if>
		
		</transition>

		<transition event="error.fetch" state="ASSERTION_NMBR_632">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<assign name="var632_fetchevent_arrived" expr="true"/>

			<!-- Begin Related Tests -->
			<assign name="ASSERTION_NUM" expr="'633'"/>		
			<conf:fail/>
			
			<assign name="ASSERTION_NUM" expr="'630'"/>		
			<conf:fail/>

			<!-- End Related Tests -->
						
			<script>assertions[assert_index].P_F = s_FAIL;</script>
			<if cond="var632_parallel_arrived">
				<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
			</if>
		</transition>

<!--
631.
The fetched content may either be a CCXML document, or script content.

636.
The application may obtain the unique identifier for a fetch request by providing an ECMAScript left-hand-side expression in the fetchid attribute when the fetch is performed

637.
The fetch identifier can be obtained as a property of the fetch.done event.

640.
A CCXML <fetch> element may contain a type attribute.

645.
A CCXML <fetch> element may contain a fetchid attribute.

-->
		<transition event="user.START_ASSERTION_631" state="ASSERTION_NMBR_631">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>					
			<fetch next="'ccxml_ok.ccxml'" fetchid="myFetchID"/>

			<!-- Begin Related Tests -->
			<assign name="ASSERTION_NUM" expr="'636'"/>		
			<if cond="myFetchID != undefined">
				<conf:pass/>
			<else/>
				<conf:fail/>
			</if>
			

			<!-- End Related Tests -->			
		</transition>

		<transition event="error.semantic" state="ASSERTION_NMBR_631">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			
			<!-- Begin Related Tests -->
			<assign name="ASSERTION_NUM" expr="'645'"/>		
			<conf:fail/>
			<!-- End Related Tests -->			

			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>	
				
		<transition event="fetch.done" state="ASSERTION_NMBR_631">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<assign name="current_state" expr="'ASSERTION_NMBR_631_SECOND'"/>
			<!-- Begin Related Tests -->

			<assign name="ASSERTION_NUM" expr="'645'"/>	
			<conf:pass/>
			
			<assign name="ASSERTION_NUM" expr="'637'"/>		
			<if cond="myFetchID == event$.fetchid">
				<conf:pass/>
			<else/>
				<conf:fail/>
			</if>

			<!-- End Related Tests -->			
			
			<fetch type="'text/ecmascript'" next="'script_ok.es'" fetchid="myFetchID"/>
		</transition>		

		<transition event="error.semantic" state="ASSERTION_NMBR_631_SECOND">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			
			
			<!-- Begin Related Tests -->
			<assign name="ASSERTION_NUM" expr="'640'"/>		
			<conf:fail/>
			
			<!-- End Related Tests -->	
			
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>	

		<transition event="fetch.done" state="ASSERTION_NMBR_631_SECOND">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<script>assertions[assert_index].P_F = s_PASS;</script>
			
			<!-- Begin Related Tests -->
			<assign name="ASSERTION_NUM" expr="'640'"/>		
			<conf:pass/>
			<!-- End Related Tests -->			

			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>	
		
		<transition event="error.fetch" state="ASSERTION_NMBR_631 ASSERTION_NMBR_631_SECOND">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			
			<script>assertions[assert_index].P_F = s_FAIL;</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
			
		</transition>
		
    
<!--
634.

When the fetch request has been completed, a error.fetch event is thrown to indicate a failure to fetch the requested content

-->
    
		<transition event="user.START_ASSERTION_634" state="ASSERTION_NMBR_634">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>					
			<fetch next="'ccxml_file_which_does_not_exists.ccxml'"/>
		</transition>
		
		<transition event="error.fetch" state="ASSERTION_NMBR_634">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			
			<script>assertions[assert_index].P_F = s_PASS;</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>		

		<transition event="fetch.done" state="ASSERTION_NMBR_634">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			
			<script>assertions[assert_index].P_F = s_FAIL;</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>				    
		
		
<!--
635. If content is successfully fetched, errors in processing fetched content (for instance, a CCXML document with a syntax error) may result in an error.fetch being thrown.

-->		
		
		<transition event="user.START_ASSERTION_635" state="ASSERTION_NMBR_635">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>					
			<fetch next="'ccxml_ko.ccxml'"/>
		</transition>
		
		<transition event="error.fetch" state="ASSERTION_NMBR_635">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			
			<script>assertions[assert_index].P_F = s_PASS;</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>		

		<transition event="fetch.done" state="ASSERTION_NMBR_635">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			
			<script>assertions[assert_index].P_F = s_FAIL;</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>	

<!--

1001.
The <fetch> method attribute may be have a value set to "get"

643.
A CCXML <fetch> element may contain a method attribute specifying the HTTP method to use.

-->
		<transition event="user.START_ASSERTION_1001" state="ASSERTION_NMBR_1001">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>					
			<fetch next="'ccxml_ok.ccxml'" method="'get'"/>
		</transition>
		
		<transition event="error.fetch" state="ASSERTION_NMBR_1001">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
	
			<!-- Begin Related Tests -->
			<assign name="ASSERTION_NUM" expr="'643'"/>		
			<conf:fail/>
			<!-- End Related Tests -->			
			
			<script>assertions[assert_index].P_F = s_FAIL;</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>		

		<transition event="fetch.done" state="ASSERTION_NMBR_1001">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<script>assertions[assert_index].P_F = s_PASS;</script>
			
			<!-- Begin Related Tests -->
			<assign name="ASSERTION_NUM" expr="'643'"/>		
			<conf:pass/>
			<!-- End Related Tests -->			
						
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>	

<!--
1002.

The <fetch> method attribute may have a value set to "post"
-->
		<transition event="user.START_ASSERTION_1002" state="ASSERTION_NMBR_1002">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>					
			<fetch next="'ccxml_ok.ccxml'" method="'post'"/>
		</transition>
		
		<transition event="error.fetch" state="ASSERTION_NMBR_1002">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<script>assertions[assert_index].P_F = s_FAIL;</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>		


		<transition event="error.semantic" state="ASSERTION_NMBR_1002">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<script>assertions[assert_index].P_F = s_FAIL;</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>						
		</transition>	
									
									
		<transition event="fetch.done" state="ASSERTION_NMBR_1002">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<assign name="current_state" expr="'ASSERTION_NMBR_1002_SECOND'"/>
			<fetch next="'ccxml_ok.ccxml'" method="'xxx'"/>
								
		</transition>	

		<transition event="fetch.done" state="ASSERTION_NMBR_1002_SECOND">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<script>assertions[assert_index].P_F = s_FAIL;</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>						
		</transition>	

		<transition event="error.semantic" state="ASSERTION_NMBR_1002_SECOND">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<script>assertions[assert_index].P_F = s_PASS;</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>						
		</transition>	
										
										
<!--
650.

A CCXML <fetch> element may contain an enctype attribute indicating the media encoding type of the submitted document. If an enctype is specified, the value must be: application/x-www-form-urlencoded
-->
										
		<transition event="user.START_ASSERTION_650" state="ASSERTION_NMBR_650">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>					
			<fetch next="'ccxml_ok.ccxml'" method="'post'" enctype="'application/x-www-form-urlencoded'"/>
		</transition>
		
		<transition event="error.fetch" state="ASSERTION_NMBR_650">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<script>assertions[assert_index].P_F = s_FAIL;</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>		


		<transition event="error.semantic" state="ASSERTION_NMBR_650">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<script>assertions[assert_index].P_F = s_FAIL;</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>						
		</transition>	
									
									
		<transition event="fetch.done" state="ASSERTION_NMBR_650">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<assign name="current_state" expr="'ASSERTION_NMBR_650_SECOND'"/>
			<fetch next="'ccxml_ok.ccxml'" method="'post'" enctype="'application/xxx'"/>
								
		</transition>	

		<transition event="fetch.done" state="ASSERTION_NMBR_650_SECOND">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<script>assertions[assert_index].P_F = s_FAIL;</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>						
		</transition>	


		<transition event="error.semantic" state="ASSERTION_NMBR_650_SECOND">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<script>assertions[assert_index].P_F = s_PASS;</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>						
		</transition>	
											
<!--
995.
Content that has been acquired using <fetch> is accessible through other elements defined by CCXML

-->
		<transition event="user.START_ASSERTION_995" state="ASSERTION_NMBR_995">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>					
			<fetch type="'text/ecmascript'" next="'script_ok.es'" fetchid="myFetchID"/>
		</transition>

		<transition event="fetch.done" state="ASSERTION_NMBR_995">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>													
			<script fetchid="myFetchID"/>
			<if cond="script_ok">
				<script>assertions[assert_index].P_F = s_PASS;</script>
			<else/>
				<script>assertions[assert_index].P_F = s_FAIL;</script>
			</if>
			
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>						
			
		</transition>		

		<transition event="error.semantic" state="ASSERTION_NMBR_995">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<script>assertions[assert_index].P_F = s_FAIL;</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>						
			
		</transition>													



<!--
642.
A CCXML <fetch> element may contain a namelist attribute. The namelist content will be submitted to the server where the URL is located.

-->


		<transition event="user.START_ASSERTION_642" state="ASSERTION_NMBR_642">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>					
			<fetch next="'cgi-bin/load_ccxml_page_with_param.ircgi'" namelist="par1"/>			
		</transition>	

		<transition event="fetch.done" state="ASSERTION_NMBR_642">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<script>assertions[assert_index].P_F = s_PASS;</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>						
		</transition>		
									
		<transition event="error.fetch" state="ASSERTION_NMBR_642">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<script>assertions[assert_index].P_F = s_FAIL;</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>						
		</transition>	
		
<!--
646.
A CCXML <fetch> element may contain a timeout attribute. The fetch will fail if not completed at the end of this interval. A failed fetch will return the error.fetch event.
-->
		<transition event="user.START_ASSERTION_646" state="ASSERTION_NMBR_646">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>								
			<fetch next="'cgi-bin/load_ccxml_page.ircgi'" timeout="'5s'"/>			
		</transition>	

		<transition event="fetch.done" state="ASSERTION_NMBR_646">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<script>assertions[assert_index].P_F = s_FAIL;</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>						
		</transition>		
									
		<transition event="error.fetch" state="ASSERTION_NMBR_646">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<script>assertions[assert_index].P_F = s_PASS;</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>						
		</transition>	
		
		
<!--
996.
The "http" URI scheme MUST be supported by CCXML platforms
-->		
		<transition event="user.START_ASSERTION_996" state="ASSERTION_NMBR_996">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>								
			<var name="complete_uri" expr="extractCurrentDir(session.uri)+'ccxml_ok.ccxml'"/>
			<conf:comment expr=" 'Fetching page : ' + complete_uri"/>	
			<fetch next="complete_uri"/>			
		</transition>	

		<transition event="fetch.done" state="ASSERTION_NMBR_996">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<script>assertions[assert_index].P_F = s_PASS;</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>						
		</transition>		
									
		<transition event="error.fetch" state="ASSERTION_NMBR_996">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<script>assertions[assert_index].P_F = s_FAIL;</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>						
		</transition>	
 			


<!-- 641.
If a type attribute is not provided the default value is: In processed mode "application/ccxml+xml". In raw mode "*/*".
-->

		<transition event="user.START_ASSERTION_641" state="ASSERTION_NMBR_641">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>					
			<fetch next="'cgi-bin/load_ccxml_page_with_header_processed.ircgi'" fetchid="myFetchID" mode="'processed'"/>			
		</transition>										


		<transition event="fetch.done" state="ASSERTION_NMBR_641">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<assign name="current_state" expr="'ASSERTION_NMBR_641_SECOND'"/>
			<fetch next="'cgi-bin/load_ccxml_page_with_header_raw.ircgi'" fetchid="myFetchID" mode="'raw'"/>					
		</transition>		

		<transition event="error.fetch" state="ASSERTION_NMBR_641">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<script>assertions[assert_index].P_F = s_FAIL;</script>
			<assign name="t_ASSERT_REASON" expr="'Accept header should be: application/ccxml+xml'"/>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>	
		</transition>		
									
		<transition event="fetch.done" state="ASSERTION_NMBR_641_SECOND">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<script>assertions[assert_index].P_F = s_PASS;</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>															
		</transition>		

		<transition event="error.fecth" state="ASSERTION_NMBR_641_SECOND">		
			<script>assertions[assert_index].P_F = s_FAIL;</script>
			<assign name="t_ASSERT_REASON" expr="'Accept header should be: */*'"/>			
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>															
		</transition>		
		
<!--
1298.
In fetch tag, if mode attribute is set to processed (the default) the CCXML platform MUST attempt to parse and validate the returned content.
-->		

		<transition event="user.START_ASSERTION_1298" state="ASSERTION_NMBR_1298">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>					
			<fetch next="'ccxml_ko.ccxml'" fetchid="myFetchID" mode="'processed'"/>			
		</transition>	

		<transition event="fetch.done" state="ASSERTION_NMBR_1298">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>
			<script>assertions[assert_index].P_F = s_FAIL;</script>
			<assign name="t_ASSERT_REASON" expr="'an error should have raised in parsing the document'"/>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>			
		</transition>		

		<transition event="error.fetch" state="ASSERTION_NMBR_1298">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<script>assertions[assert_index].P_F = s_PASS;</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>																		
		</transition>		
									
		
<!--
1299.
In fetch tag, if mode attribute is set to raw the platform MUST NOT attempt to process the data and MUST leave processing of the content to the application who can do what it wishes with the content via the content attribute of the fetch.done event
-->																			

		<transition event="user.START_ASSERTION_1299" state="ASSERTION_NMBR_1299">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>					
			<fetch next="'ccxml_ko.ccxml'" fetchid="myFetchID" mode="'raw'"/>			
		</transition>	

		<transition event="fetch.done" state="ASSERTION_NMBR_1299">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<script>assertions[assert_index].P_F = s_PASS;</script>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>																				
		</transition>		

		<transition event="error.fetch" state="ASSERTION_NMBR_1299">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>
			<script>assertions[assert_index].P_F = s_FAIL;</script>
			<assign name="t_ASSERT_REASON" expr="'no errors should have raised, because the document must not be parsed'"/>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>			
	 </transition>		


	<!--
	************** last test ********************
	-->

<!--
638.
Fetched content has a lifetime that is limited to that of the document in which it is fetched. Therefore, following a transition to a new CCXML document using <goto>, content fetched in the scope of the current document is no longer accessible.
-->
		<transition event="user.START_ASSERTION_638" state="ASSERTION_NMBR_638">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>					
			<fetch type="'text/ecmascript'" next="'script_ok.es'" fetchid="application.lastFetchID"/>			
		</transition>	

		<transition event="fetch.done" state="ASSERTION_NMBR_638" cond="event$.fetchid == application.lastFetchID">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>		
			<fetch next="'last_page.ccxml'" fetchid="myFetchID"/>					
		</transition>		
									
		<transition event="fetch.done" state="ASSERTION_NMBR_638" cond="event$.fetchid == myFetchID">		
			<conf:comment expr=" 'Current state : ' + current_state + ' , Event: ' + event$.name"/>													
			<goto fetchid="event$.fetchid"/>					
		</transition>																	
		
		
	<!--  ***************** COMMON ******************************** -->
		<transition event="send.successful">
		</transition>


    <transition event="user.timeout">
			<assign name="current_state" expr="'GEN'"/>
			<conf:uncond_exit expr="'TEST-TIMEOUT.' + show_remained_assertions()"/>
		</transition>
		
		<transition event="connection.disconnected">
			<conf:uncond_exit expr="'CONNECTION-DISCONNECTED'"/>
		</transition>
	
		<transition event="*">
			<assign name="t_ASSERT_REASON" expr="'UNEXPECTED EVENT ' + event$.name + ' IN STATE ' + current_state"/>
				<conf:comment expr="t_ASSERT_REASON"/>
				<if cond="current_state == 'init'">
					<conf:uncond_exit expr="'Did not come out from init state.'"/>
				<else/>
					<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
				</if>   
			</transition>
	
		</eventprocessor>
</ccxml>
