function forum_startup($remove_id_in_reply = false)
 {
     $this->test_startup();
     //  View forum page
     $this->threadgroup_hashtree->add_child(new httpsampler($this->name . ' View Forum', $this->forum_view, $this->view_params));
     //  Make a post (to insure there is at least one post), find a random discussion, find a reply, make a post
     for ($i = 1; $i <= $this->posts; $i++) {
         //  Store the id if it hasn't yet been removed, else put it back in if we are looping around again
         if (!empty($remove_id_in_reply) && !empty($this->post_arguments['id'])) {
             $id = $this->post_arguments['id'];
         } else {
             if (!empty($remove_id_in_reply) && empty($this->post_arguments['id']) && !empty($id)) {
                 $this->post_arguments['id'] = $id;
             }
         }
         //  View forum post page and regex's to get data
         $this->threadgroup_hashtree->add_child(new httpsampler($this->name . ' View First Discussion Post Data', $this->forum_post, $this->post_params, false, $this->post_regex));
         //  Change the subject of the post
         $this->post_arguments['subject'] = 'testing ${username}';
         //  Post new discussion
         $this->threadgroup_hashtree->add_child(new httpsampler($this->name . ' Post to Discussion', $this->forum_post, $this->post_arguments, (object) array('method' => 'POST')));
         //  Add in the loopconroller
         $this->threadgroup_hashtree->add_child(new loopcontroller($this->name, $this->replys, $loop_forever = 'false'));
         //  Add in the loopconroller hashtree
         $loopcontroller_hashtree = new hashtree();
         //  Find random discussion
         $loopcontroller_hashtree->add_child(new httpsampler($this->name . ' Find random discussion', $this->forum_view, $this->view_params, false, $this->discuss_regex));
         //  View discussion
         $loopcontroller_hashtree->add_child(new httpsampler($this->name . ' View Random Discussion & find random reply', $this->forum_discuss, $this->discuss_params, false, $this->reply_regex));
         //  View random post page passing regex's to get data from
         $loopcontroller_hashtree->add_child(new httpsampler($this->name . ' View Random Reply & get post data', $this->forum_post, $this->reply_params, false, $this->post_regex));
         //  Change the subject of the reply
         $this->post_arguments['subject'] = 'Reply to post ${replyid}.';
         if (!empty($remove_id_in_reply) && isset($this->post_arguments['id'])) {
             unset($this->post_arguments['id']);
         }
         //  Post to random reply
         $loopcontroller_hashtree->add_child(new httpsampler($this->name . ' Post to Random Reply', $this->forum_post, $this->post_arguments, (object) array('method' => 'POST')));
         $this->threadgroup_hashtree->add_child($loopcontroller_hashtree);
     }
     $this->test_finish();
     $this->convert_to_xml_element();
 }
 function chat_ajax_startup()
 {
     $this->test_startup();
     //  View chat page
     $this->threadgroup_hashtree->add_child(new httpsampler($this->name . ' View Chat page', $this->chat_view, $this->view_params));
     //  Open chat window and regex's to get data
     $this->threadgroup_hashtree->add_child(new httpsampler($this->name . ' View Chat window', $this->chat_window, $this->window_params, false, $this->window_regex));
     //  Chat init
     $this->threadgroup_hashtree->add_child(new httpsampler($this->name . ' Init Chat', $this->chat_init, $this->init_params, (object) array('method' => 'POST', 'image_parser' => false)));
     //  Chat initial update
     $this->threadgroup_hashtree->add_child(new httpsampler($this->name . ' Init Initial Update', $this->chat_update, $this->update_params, (object) array('method' => 'POST', 'image_parser' => false), $this->post_regex));
     //  Add in the loopcontroller
     $this->threadgroup_hashtree->add_child(new loopcontroller($this->name, $this->posts, $loop_forever = 'false'));
     //  Add in the loopconroller hashtree
     $loopcontroller_hashtree = new hashtree();
     //  Post to random reply
     $loopcontroller_hashtree->add_child(new httpsampler($this->name . ' Post Chat Message', $this->chat_post, $this->post_params, (object) array('method' => 'POST')));
     //  Refesh chat window and regex's to get data
     $loopcontroller_hashtree->add_child(new httpsampler($this->name . ' Init Update', $this->chat_update, $this->post_update, (object) array('method' => 'POST', 'image_parser' => false), $this->post_regex));
     // Add loopcontroller
     $this->threadgroup_hashtree->add_child($loopcontroller_hashtree);
     //  Now add in random timer element
     $this->threadgroup_hashtree->add_child(new random_timer($this->name));
     $this->convert_to_xml_element();
 }
 function __construct($name, $path, $arguments = array(), $properties = false, $hashtree_children = false)
 {
     $element = new main_element('HTTPSampler', 'HttpTestSampleGui', 'HTTPSampler', $name);
     $element->add_child(new user_def_vars_eleprop('HTTPsampler.Arguments', 'Arguments', 'HTTPArgumentsPanel', 'Arguments', false, $arguments));
     //  Copy the element to this
     $this->copy_to_this($element);
     if (empty($properties)) {
         $properties = new Object();
     }
     //  Override the domain which is set in the master class to be empty.
     if (!isset($properties->domain)) {
         $properties->domain = false;
     }
     //  Add the moodle path to the properties
     if (!empty($path)) {
         $path = MOODLE_PATH . "/{$path}";
         $properties->path = $path;
     }
     $this->httpsampler_defaults($properties);
     $this->httpsampler_extra($properties);
     //  Now add in an empty hashtree
     $hashtree = new hashtree();
     if (!empty($hashtree_children)) {
         foreach ($hashtree_children as $child) {
             $hashtree->add_child($child);
         }
     }
     //  Add the hastree
     $this->add_sibling($hashtree);
 }