Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
tool_generator_testplan_backend Class Reference

Generates the files required by JMeter. More...

Inheritance diagram for tool_generator_testplan_backend:
tool_generator_backend

Static Public Member Functions

static create_testplan_file ($courseid, $size)
 Creates the test plan file. More...
 
static create_users_file ($courseid, $updateuserspassword)
 Creates the users data file. More...
 
static get_repourl ()
 Getter for moodle-performance-comparison project URL. More...
 
static get_size_choices ()
 Gets a list of size choices supported by this backend. More...
 
static has_selected_course_any_problem ($course, $size)
 Checks if the selected target course is ok. More...
 
static size_for_name ($sizename)
 Converts a size name into the numeric constant. More...
 

Public Attributes

int const DEFAULT_SIZE = 3
 Default size index.
 
int const MAX_SIZE = 5
 Highest (largest) size index.
 
int const MIN_SIZE = 0
 Lowest (smallest) size index.
 

Protected Member Functions

 dot ($number, $total)
 Outputs dots. More...
 
 end_log ()
 Ends a log string that was started using log function with $leaveopen.
 
 log ($langstring, $a=null, $leaveopen=false)
 Displays information as part of progress. More...
 

Static Protected Member Functions

static generate_test_plan ($targetcourseid, $size)
 Generates the test plan according to the target course contents. More...
 
static generate_users_file ($targetcourseid, $updateuserspassword)
 Generates the user's credentials file with all the course's users. More...
 
static get_course_test_data ($targetcourseid)
 Gets the data required to fill the test plan template with the database contents. More...
 
static get_file_record ($filearea, $filetype)
 Returns a tool_generator file record. More...
 

Protected Attributes

int bool $filesizelimit
 Maximum number of bytes for file.
 
bool $fixeddataset
 True if we want a fixed dataset or false to generate random data.
 
int $lastdot
 Epoch time at which last dot was displayed.
 
int $lastpercentage
 Epoch time at which last percentage was displayed.
 
bool $progress
 True if displaying progress.
 
int $size
 Size code (index in the above arrays)
 
int $starttime
 Epoch time at which current step (current set of dots) started.
 

Static Protected Attributes

static Number $loops = array(5, 5, 5, 6, 6, 7)
 of loops depending on the selected size.
 
static Rampup $rampups = array(1, 6, 40, 100, 500, 800)
 period depending on the selected size.
 
static The $repourl = 'https://github.com/moodlehq/moodle-performance-comparison'
 URL to the repository of the external project.
 
static Number $users = array(1, 30, 100, 1000, 5000, 10000)
 of users depending on the selected size.
 

Detailed Description

Generates the files required by JMeter.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ create_testplan_file()

static tool_generator_testplan_backend::create_testplan_file (   $courseid,
  $size 
)
static

Creates the test plan file.

Parameters
int$courseidThe target course id
int$sizeThe test plan size
Return values
stored_file

◆ create_users_file()

static tool_generator_testplan_backend::create_users_file (   $courseid,
  $updateuserspassword 
)
static

Creates the users data file.

Parameters
int$courseidThe target course id
bool$updateuserspasswordUpdates the course users password to $CFG->tool_generator_users_password
Return values
stored_file

◆ dot()

tool_generator_backend::dot (   $number,
  $total 
)
protectedinherited

Outputs dots.

There is up to one dot per second. Once a minute, it displays a percentage.

Parameters
int$numberNumber of completed items
int$totalTotal number of items to complete

◆ generate_test_plan()

static tool_generator_testplan_backend::generate_test_plan (   $targetcourseid,
  $size 
)
staticprotected

Generates the test plan according to the target course contents.

Parameters
int$targetcourseidThe target course id
int$sizeThe test plan size
Return values
stringThe test plan as a string

◆ generate_users_file()

static tool_generator_testplan_backend::generate_users_file (   $targetcourseid,
  $updateuserspassword 
)
staticprotected

Generates the user's credentials file with all the course's users.

Parameters
int$targetcourseid
bool$updateuserspasswordUpdates the course users password to $CFG->tool_generator_users_password
Return values
stringThe users csv file contents.

◆ get_course_test_data()

static tool_generator_testplan_backend::get_course_test_data (   $targetcourseid)
staticprotected

Gets the data required to fill the test plan template with the database contents.

Parameters
int$targetcourseidThe target course id
Return values
stdClassThe ids required by the test plan

◆ get_file_record()

static tool_generator_testplan_backend::get_file_record (   $filearea,
  $filetype 
)
staticprotected

Returns a tool_generator file record.

Parameters
string$fileareatestplan or users
string$filetypeThe file extension jmx or csv
Return values
stdClassThe file record to use when creating tool_generator files

◆ get_repourl()

static tool_generator_testplan_backend::get_repourl ( )
static

Getter for moodle-performance-comparison project URL.

Return values
string

◆ get_size_choices()

static tool_generator_testplan_backend::get_size_choices ( )
static

Gets a list of size choices supported by this backend.

Return values
arrayList of size (int) => text description for display

◆ has_selected_course_any_problem()

static tool_generator_testplan_backend::has_selected_course_any_problem (   $course,
  $size 
)
static

Checks if the selected target course is ok.

Parameters
int | string$course
int$size
Return values
arrayErrors array or false if everything is ok

◆ log()

tool_generator_backend::log (   $langstring,
  $a = null,
  $leaveopen = false 
)
protectedinherited

Displays information as part of progress.

Parameters
string$langstringPart of langstring (after progress_)
mixed$aOptional lang string parameters
bool$leaveopenIf true, doesn't close LI tag (ready for dots)

◆ size_for_name()

static tool_generator_backend::size_for_name (   $sizename)
staticinherited

Converts a size name into the numeric constant.

Parameters
string$sizenameSize name e.g. 'L'
Return values
intNumeric version
Exceptions
coding_exceptionIf the size name is not known

The documentation for this class was generated from the following file: