<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/opt/local/share/tsung/tsung-1.0.dtd">
<tsung loglevel="debug" dumptraffic="true" version="1.0">

  <clients>
    <client host="localhost" weight="1" maxusers="1000" use_controller_vm="true"/>
  </clients>

  <servers>
    <server host="localhost" port="80" type="tcp"></server>
  </servers>

  <monitoring>
    <monitor host="localhost" type="erlang"/> 
  </monitoring>

  <load loop="2">
    <arrivalphase phase="1" duration="1" unit="minute">
      <users maxnumber="1" interarrival="0.1" unit="second"/>
  </arrivalphase>
    <arrivalphase phase="3" duration="1" unit="minute">
      <session_setup name="http_test_1" probability="80"/>
      <session_setup name="fake"        probability="20"/>
      <users maxnumber="2" interarrival="1" unit="second"/>
    </arrivalphase>
  </load>

  <options>
    <option name="file_server" id='userdb' value="./src/test/test_file_server.csv"/>
    <option type="ts_http" name="user_agent">
      <user_agent probability="100">
        Some browser version 42
      </user_agent>
    </option>
  </options>

  <sessions>
    <session name="http_test_1" probability="100" type="ts_http">
      
      <setdynvars sourcetype="erlang" callback="ts_user_server:get_unique_id">
        <var name="id1" />
      </setdynvars>

      <setdynvars sourcetype="erlang" callback="ts_user_server:get_really_unique_id">
        <var name="id2" />
      </setdynvars>
      
      <setdynvars sourcetype="file" fileid="userdb" delimiter=";" order="iter">
        <var name="user" />
        <var name="user_password" />
      </setdynvars> 
      
      <setdynvars sourcetype="random_string" length="13">
        <var name="rndstring1" />
      </setdynvars> 

      <setdynvars sourcetype="random_number" start="3" end="32">
        <var name="rndint" />
      </setdynvars> 

      <request>
        <http url="/" method="GET" version="1.1">
         <http_header name="cache-control" value="no-cache"/>
         <http_header name="User-Agent" value="pseudo googlebot"/>
        </http>
      </request>

      <thinktime min="2" max="4"></thinktime>

      <request subst="true">
        <dyn_variable name="title" re="&lt;title&gt;(.*)&lt;/title&gt;"/>
        <http url="/test.html%%_rndint%%&amp;id=%%_id1%%" method="GET" version="1.1"/></request>
      <thinktime value="5" random="true"/>

      <setdynvars sourcetype="random_string" length="5">
        <var name="rndstring2" />
      </setdynvars> 

      <request subst="true">
        <http url="/index.html?toto=%%_title%%&amp;user=%%_user%%&amp;password=%%_user_password%%&amp;id=%%_rndstring2%%&amp;id2=%%_id2%%" method="GET" version="1.1"/>
      </request>
      
      <thinktime value="4" random="true"/>
      
      <request><http url="/" method="GET" version="1.1"/></request>

    </session>

    <session name="fake" probability="0" type="ts_http">
      <thinktime value="5" random="true"/>
    </session>

</sessions>

</tsung>


