Class Index

Classes


Class Composition


Extends CompositionItem.

Class Summary
Constructor Attributes Constructor Name and Description
 
Represents the Composition itself.
Field Summary
Field Attributes Field Name and Description
{boolean}  
True if the Composition is currently trying to abort due to a "force stop" request.
{boolean}  
True if the Composition is currently trying to end early (before normal completion) for any reason, such as a stop request or a fatal error.
{boolean}  
True if the Composition is being played in Preview mode.
{integer}  
If the Composition is repeating, this is the iteration number of the current repeat of the Composition.
{integer}  
Always 0 for Compositions.
{integer}  
Always 0 for Compositions.
{integer}  
Always 0 for Compositions.
{integer}  
Always -1 for Compositions.
{String}  
The value "Composition".
Fields borrowed from class CompositionItem:
children, completionType, failureText, forEachValue, hasErrorEvents, index, name, nextItem, parent, path, previousItem, propertyList, REPEAT_DISTRIBUTION_CONSTANT, REPEAT_TIMING_PARALLEL, REPEAT_TIMING_SERIAL, REPEAT_TYPE_COUNT_CONSTANT, systemPropertyList
Method Summary
Method Attributes Method Name and Description
 
abort(message, details)
Terminates the Composition as if there were an error.
 
Pauses the Composition, as if the user had pressed the "pause" button.
{object}  
rampAdjust(maxWaitTime, adjustments)
Adjusts all or a portion of the Composition's current "ramp" state.
 
Pauses the Composition's "ramp", if any, as if the user had pressed the "pause ramp" button.
 
Resumes the Composition's "ramp", if any, as if the user had pressed the "resume ramp" button.
 
stop()
Stops the Composition, as if the user had pressed the "stop" button.
Methods borrowed from class CompositionItem:
clearRepeat, end, endRepeat, getChild, getItemViaPath, setRepeat
Class Detail
Composition()
Represents the Composition itself.
Field Detail
{boolean} isAborting
True if the Composition is currently trying to abort due to a "force stop" request.

Can be checked periodically by a Script that is doing a time-consuming operation, allowing it to terminate that operation early if it desires to do so. See also Composition#isEnding.

Read only.

Since:
Build 6594

{boolean} isEnding
True if the Composition is currently trying to end early (before normal completion) for any reason, such as a stop request or a fatal error.

Can be checked periodically by a Script that is doing a time-consuming operation, allowing it to terminate that operation early if it desires to do so. See also Composition#isAborting.

Read only.

Since:
Build 6594

{boolean} isPreviewMode
True if the Composition is being played in Preview mode.

Read only.


{integer} iterationNumber
If the Composition is repeating, this is the iteration number of the current repeat of the Composition. The iteration number starts at one.

Compositions can be set to repeat via the "Repeat play" option in the "Play with options" dialog in Central, or in the "Play Options" dialog in the Composition Editor.

Read only.


{integer} playNumber
Always 0 for Compositions.

Read only.


{integer} playNumberBeforeRenewal
Always 0 for Compositions.

Read only.


{integer} playNumberWithinRenewal
Always 0 for Compositions.

Read only.


{integer} repeatIndex
Always -1 for Compositions.

Read only.


{String} type
The value "Composition". Read only.
Method Detail
abort(message, details)
Terminates the Composition as if there were an error. The message and detail text given in the parameters are inserted into the Result object.

Example:

$context.composition.abort("Message text from script", "Details\nfrom\nscript");

Parameters:
{String} message

Message to be inserted into the Result.

{String} details Optional, Default: null

Optional multi-line detail text for the message to be inserted into the Result.


pause()
Pauses the Composition, as if the user had pressed the "pause" button. Note that this merely starts the Composition pausing. The Composition will not actually be completely paused until all portions of the Composition have paused, which cannot happen until the current Script ends.

{object} rampAdjust(maxWaitTime, adjustments)
Adjusts all or a portion of the Composition's current "ramp" state.

"Ramp" is defined as Track parallel repeating with a "start interval" and/or "end interval". The use of parallel repeat renewal is required for ramp adjustments to work properly.

This method may be called at any time, including when the ramp is paused or pausing, or when it is already resuming.

This method institutes the new ramping request, but does not wait for the specified ramping goal to actually be reached, as that might occur much later.

Passed in to this method is an array of objects, one object for each adjustment to be made. If only a single adjustment is to be made, then optionally that single object may be passed in instead of an array.

Each object in the array is a "struct" -- an object with properties (fields) with certain names.

Note that, especially with ramp down, the ramp may not proceed exactly as requested, as playing Clips are not aborted or interrupted in the middle. The system must wait for individual Track instances to naturally come to an end.

In the case of "hold", each server will hold at the current number of virtual users at the time at which the request reaches that server, which may be some time later than when the Script executes, depending upon the number of servers in the Composition, network communication time, etc.

Adjustments for any Tracks may be made from any Script, even if the Script is not running on the server on which the Tracks to be adjusted reside. A Script can adjust the ramping for any Track, not just the Track in which the Script itself resides.

For multi-server Compositions, the request may take some time before it is accepted by all of the servers involved in the Composition, depending upon the number of servers, network communication time and errors, and so forth. The caller may choose whether or not to wait for the request to reach, and be accepted by, all servers. If it is chosen not to wait, then it is not possible for the Script to check back later in order to find out the eventual disposition of the request.

The return value is a "struct" -- an object with properties (fields) with certain names.

Here is an example Script that changes Distribution 1 of Track 1 to ramp to 400 users over 5 minutes and Distribution 1 of Track 2 to to hold at its current level. It waits until the adjustments are accepted and then outputs information about the request to the Result.

 var adjustments = new Array();
 
 var adjustment = new Object();
 adjustment.type = "rampto";
 adjustment.trackName = "Track 1";
 adjustment.distributionName = "Distribution 1";
 adjustment.userCount = 400;
 adjustment.time = 300000;  // 300 seconds = 5 minutes
 
 adjustments[0] = adjustment;
 
 adjustment = new Object();
 adjustment.type = "hold";
 adjustment.trackName = "Track 2";
 adjustment.distributionName = "Distribution 1";
 
 adjustments[1] = adjustment;
 
 var out = $context.composition.rampAdjust(null, adjustments);
 
 var details = "requestStatus=" + out.requestStatus + "\n";
 details += "requestNumber=" + out.requestNumber + "\n";
 details += "resultText=" + out.resultText + "\n";
 
 $context.result.postMessage($context.result.LEVEL_INFO, "Disposition of ramp request", details);

Parameters:
{number} maxWaitTime

The maximum amount of time to wait for the request to complete, in milliseconds. A null or negative value specifies that the call will not return until the adjustments have been accepted.

{object[]} adjustments

An array of objects that represent the ramp adjustments to be made (see above).

Since:
Build 6165
Returns:
{object}

An object that contains properties (fields) that indicate the status of the request (see above).


rampPause()
Pauses the Composition's "ramp", if any, as if the user had pressed the "pause ramp" button.

This merely starts the ramp pausing. The ramp will not actually be completely paused until all portions of the Composition on all servers have paused the ramp.

This method may be called at any time, including when the ramp is already paused or pausing, or when it is resuming.

"Ramp" is defined as Track parallel repeating with a "start interval" and/or "end interval".


rampResume()
Resumes the Composition's "ramp", if any, as if the user had pressed the "resume ramp" button.

This merely starts the ramp resuming. The ramp will not actually be completely resumed until all portions of the Composition on all servers have resumed the ramp.

This method may be called at any time, including when the ramp is not paused or pausing, or when it is already resuming.

"Ramp" is defined as Track parallel repeating with a "start interval" and/or "end interval".


stop()
Stops the Composition, as if the user had pressed the "stop" button.

SOASTA CloudTest Script Documentation (build 8744.736). Copyright 2006-2011. All rights reserved.