Skip to main content
Version: 1.x

API Reference

This documentation describes the functionality that is available for configuration authors.

Documentation describing the functionality and schema of configuration (workflow, bootstrap etc) is referred to as the model and is available below.

Documentation describing the functionality and schema of the testing harness is available below.

Packages available:

opscotch model:​

The opscotch model is relatively straight forward, and uses repeated patterns - once you grasp these you should be able to understand the entire structure.

Here is the outline of the entire structure of the two configurations: the bootstrap and the workflow. Note that not every field is required, so be sure to check the detailed descriptions.

The bootstrap schema​

[
{
"agentPrivateKey": "",
"deploymentId": "",
"remoteConfiguration": "",
"remoteConfigurationAuth": "",
"frequency": 0,
"errorHandling": {
"enableLocalLogging": true,
"metrics": {
"enabled": true,
"routingToken": "",
"outputUrl": "",
"outputAuthorization": ""
},
"logs": {
"enabled": true,
"routingToken": "",
"outputUrl": "",
"outputAuthorization": ""
},
"redactionPatterns": [
""
]
},
"hosts" {
"": {
"host": "",
"headers": {
"": ""
},
"allowlist": [
["",""]
],
"data": {}
}
},
"data": {}
}
]

The workflow schema​

{
"enabled": true,
"name": "",
"steps": [
{
"enabled": true,
"debug": true,
"type": "",
"stepId": "",
"authenticationProcessor": {
"script": "",
"resource": "",
"data": {}
},
"splitGenerator": {
"script": "",
"resource": "",
"data": {}
}
"urlGenerator": {
"script": "",
"resource": "",
"data": {}
},
"payloadGenerator": {
"script": "",
"resource": "",
"data": {}
}
"itemResultProcessor": {
"script": "",
"resource": "",
"data": {}
}
"resultsProcessor": {
"script": "",
"resource": "",
"data": {}
},
"timer": "",
"persistenceFile",
"data": {}
}
],
"data" : {}
}

JSON Schema in the Model Package:

Scripting context objects in the Model Package:

JSON schema: Workflow​

Defines a set of Steps that the agent will perform in order to generate metrics

JSON Properties​

The following properties are available to set on the JSON schema.

enabled​

Type: Boolean

Enable or disables the loading of the route.

Defaults to true

{
"enabled": false
}

This property is optional


name​

Type: String

Required The user friendly name of the route.

{
"name": "my route"
}

This property is required


steps​

Type: Array of Step

Required The list of Steps or actions to take to perform the intention of the Workflow.

Please note that steps are not executed in order, rather they are a group of actions that can send messages to one and other. The order of execution is defined by the actions taken by the Step

{
"steps": [
...
]
}

This property is required


data​

Type: Object

A JSON Object for adding properties.

Used to pass parameters and data to the JavaScriptSource elements.

These properties will be merged with all other data fields in the json path, available to the step JavaScriptSource elements.

{
"data": {
"somedata" : {
"abc: 123
},
"someotherdata" : [ 1, 2, 3],
}
}

This property is optional


JSON schema: Host​

A HTTP(S) host that the agent is expected to communicate with.

This only applies to customer specific hosts, not to Service Provider hosts.

Hosts are defined in Bootstrap.data and WorkflowConfiguration.data

JSON Properties​

The following properties are available to set on the JSON schema.

host​

Type: String

Required A URL that is used as the base for constructing URLs to call.

{
"host": "https://www.example.com:8080"
}

This property is required


headers​

Type: Object of Strings

A object of HTTP headers to be sent with every call.

{
"headers": {
"Content-Type": "application/json;charset=UTF-8",
"Accept": "application/json, text/plain, *\/*"
}
}

This property is optional


allowlist​

Type: Array of String tuple

A list of allowed paths that may be called on this host.

A list of regex that will be matched to URL path. Matching results will be allowed, non-matching results will be blocked and logged.

{
"allowlist": [
["GET","/this/is/allowed"],
["POST","/this/.*\/allowed"]
]
}

This property is optional


data​

Type: Object

A JSON Object with Additional properties that will accessible during authentication steps",

{
"data": {
"somedata" : {
"abc: 123
},
"someotherdata" : [ 1, 2, 3]
}
}

This property is optional


JSON schema: ErrorHandling​

A configuration defining if and how to send error metrics or log to a remote system

Its definition only apply to the process configuration they are defined for. For example the Bootstrap.errorHandling defines error handling while loading configurations, and the WorkflowConfiguration.errorHandling defines error handling during the execution of configuration steps.

JSON Properties​

The following properties are available to set on the JSON schema.

enableLocalLogging​

Type: Boolean

Enable or disables logging of errors and information to the agent standard out

Defaults to false

{
"enableLocalLogging": true
}

This property is optional


metrics​

Type: Output

Defines how error metrics are sent to a remote system.

Error metrics represent a fault in the agent and are sent to a remote system for attention.

Error metric configuration only apply to the process configuration they are defined for. For example the Bootstrap.errorHandling defines error handling while loading configurations, and the WorkflowConfiguration.errorHandling defines error handling during the execution of configuration steps.

{
"metrics": {
...
}
}

This property is optional


logs​

Type: Output

Defines how error logs are sent to a remote system.

Error logs are brief messages from a fault in the agent and are sent to a remote system for attention.

Error log configuration only apply to the process configuration they are defined for. For example the Bootstrap.errorHandling defines error handling while loading configurations, and the WorkflowConfiguration.errorHandling defines error handling during the execution of configuration steps.

{
"logs": {
...
}
}

This property is optional


redactionPatterns​

Type: Array of String

Defines regex patterns to apply redaction to log statements

Log statements from will have these redaction patterns applied before logging.

{
"redactionPatterns": [
"[0-9]+"
]
}

This property is optional


JSON schema: Step​

The key configuration item for the agent configuration.

This configuration describes how to perform a single step or action in a Workflow

There are different types of steps, however they all have the same execution structure:

  1. Optionally perform authentication steps (call other steps)
  2. Optionally generate a URL and payload
  3. Optionally call out to a named Bootstrap Host with the generated URL and payload
  4. Process the response (or something), and perhaps
  • Send a message to another Step
  • Produce some metrics

Steps take three forms of input:

  • The response from a call to a Host
  • The message passed from another Step
  • Data from the configuration

The different types of Steps allow for specialised behaviour:

  • "scripted" type: this is the default type with the exact workflow described above.
  • "scripted-split-aggregate" type: this is a modified "scripted" type that has the following workflow of:
    1. transforming the input into a list
    2. calling a URL with each item in the list:
      1. Generate a URL and payload
      2. Call out to a named Host with the generated URL and payload
      3. Process each items response
      4. Collect the result into a response list
    3. The list of collected responses can then be processed and per normal, perhaps:
      • Send a message to another Step}
      • Produce some metrics
  • "scripted-auth" type: this is identical to "scripted" except that it has a alternative javascript context - it is not allowed to send metrics or call to non-authentication steps, but has access to the bootstrap data which may contain secrets.

At least one step in a Workflow will define a Step.timer that will trigger the start of Workflow processing.

These forms of input and different type allows for the construction of flexible pipelines that should be sufficient to perform most tasks.

JSON Properties​

The following properties are available to set on the JSON schema.

enabled​

Type: Boolean

Enables or disables the execution of this step. Defaults to true.

{
"enabled": true
}

This property is optional


debug​

Type: Boolean

Enables or disables the debug logs for this step. Defaults to false.

{
"debug": true
}

This property is optional


type​

Type: String

Sets the type of the step.

Either "scripted" or "scripted-split-aggregate" or "scripted-auth" as defined above.

Defaults to "scripted"

{
"type": "scripted-split-aggregate"
}

This property is optional


stepId​

Type: String

Required Sets the id of the step.

Must be unique.

{
"stepId": "the-first-step-in-my-route"
}

This property is required


urlGenerator​

Type: JavaScriptSource

Required Defines how to generate the URL

{
"urlGenerator": {
...
}
}

This property is optional


resultsProcessor​

Type: JavaScriptSource

Required Defines how to process the result of the call to the host.

{
"resultsProcessor": {
...
}
}

This property is required


authenticationProcessor​

Type: JavaScriptSource

Performs authentication tasks. Generally this step might call to authentication steps and/or apply headers.

{
"authenticationProcessor": {
...
}
}

This property is optional


payloadGenerator​

Type: JavaScriptSource

Defines how to generate the call payload, including setting headers.

{
"payloadGenerator": {
...
}
}

This property is optional


splitGenerator​

Type: JavaScriptSource

When using Step.type "scripted-split-aggregate", defines how to generate the list to be operated on.

{
"splitGenerator": {
...
}
}

This property is optional


itemResultProcessor​

Type: JavaScriptSource

When using Step.type "scripted-split-aggregate", defines if and how to process items before they're added to the list.

{
"itemResultProcessor": {
...
}
}

This property is optional


timer​

Type: String

Defines a timer to trigger the execution of a step.

There will likely only be one timer in a Workflow.

Accepts Apache Camel Timer query string parameters

{
"timer": "fixedRate=true&period=3600000"
}

This property is optional


persistenceFile​

Type: String

Defines a cache/memory/key-value store that the Step has access to.

Required if using various functions. If required and not defined an error will be logged

{
"persistenceFile": "persistenceFile.data"
}

This property is optional


data​

Type: Object

A JSON Object for adding properties.

Used to pass parameters and data to the JavaScriptSource elements.

These properties will be merged with all other data fields in the json path, available to the step JavaScriptSource elements.

{
"data": {
"somedata" : {
"abc: 123
},
"someotherdata" : [ 1, 2, 3],
}
}

This property is optional


JSON schema: Output​

Configuration for how to send data to a remote system.

JSON Properties​

The following properties are available to set on the JSON schema.

enabled​

Type: Boolean

Enables or disables the sending of data.

{
"enabled": true
}

This property is optional


routingToken​

Type: String

Required A Service Provider defined value that must be unique per deployed agent.

This property is used by Service Provider downstream processor to direct and enrich the transmitted data.

{
"routingToken": "dogurj"
}

This property is required


outputUrl​

Type: String

Required The URL that data is transmitted to.

Accepts Apache Camel HTTP query string parameters

{
"outputUrl": "http://www.example.com"
}

This property is required


outputAuthorization​

Type: String

Set the "Authorization" header.

{
"outputAuthorization" : "xodsjfujrhdjfk"
}

This property is optional


JSON schema: PackagingConfig​

JSON configuration required for packaging configurations for agents

JSON Properties​

The following properties are available to set on the JSON schema.

configPath​

Type: String

The path to the .json configuration file


agentPublicKey​

Type: String

The path to the agent public key


resourceDir​

Type: String

The path to the configuration resource directory


messagesPath​

Type: String

The path to the .json messages file for the configuration


license​

Type: String

The license key


JSON schema: JavaScriptSource​

A JavaScript that is executed during the processing of a Step

JSON Properties​

The following properties are available to set on the JSON schema.

script​

Type: String

The script to execute.

A json-escaped script. Must be supplied if JavaScriptSource.resource is not supplied

{
"script": "console.log(\\"hello world\\");"
}

This property is optional


resource​

Type: String

A file path to the script to execute.

Must be supplied if JavaScriptSource.script is not supplied

{
"resource": "scripts/myscript.js"
}

This property is optional


data​

Type: Object

A JSON Object for adding properties.

Used to pass parameters and data to the script.

These properties will be merged with all other data fields in the json path, available to the step script elements.

{
"data": {
"somedata" : {
"abc: 123
},
"someotherdata" : [ 1, 2, 3],
}
}

This property is optional


JSON schema: WorkflowConfiguration​

The configuration that describes the main activities of the agent

JSON Properties​

The following properties are available to set on the JSON schema.

metricOutput​

Type: Output

Required Defines how metrics are sent to a remote system.

Metrics represent a data point that is interesting, generated by the agent and are sent to a remote system for analysis.

{
"metricOutput": {
...
}
}

This property is required


errorHandling​

Type: ErrorHandling

Required Determines the behavior of error handling while running the main configuration

{
"errorHandling": {
...
}
}

This property is required


workflows​

Type: Array of Workflow

Required A list of Workflow describing the agent tasks

{
"workflows" [
...
]
}

This property is required


data​

Type: Object

A JSON Object for adding properties.

These properties will be merged with the Bootstrap.date configuration field and be available to all child elements.

{
"data": {
"somedata" : {
"abc: 123
},
"someotherdata" : [ 1, 2, 3]
}
}

This property is optional


JSON schema: Bootstrap​

A configuration that is loaded into the agent at startup and determines how the agent loads the main configuration is loaded.

Please note that the bootstap file that is authored is an ARRAY of these objects ie:

[
{
"agentPrivateKey": ...
"deploymentId": ...
}
]

It will be provided to the agent as an argument, either via a base64 encoded json text or a path to a json file

JSON Properties​

The following properties are available to set on the JSON schema.

agentPrivateKey​

Type: String

Required The private key for the agent to decrypt the remote configuration.

This should be a base64 encoded private key in pkcs8 format

This is how to create an appropriate key

1. Create key pair
openssl genrsa -out keypair.pem 2048

2. Extract public part
openssl rsa -in keypair.pem -pubout -out public.key

3. Extract private part
openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in keypair.pem -out private.key

4. Base64 the contents of this file
cat private.key | base64
{
"agentPrivateKey": "LS0tLS1CRUdJTiBQUklWQV...."
}

This property is required


deploymentId​

Type: String

Required A Service Provider defined value that must be unique per deployed agent configuration.

This property is used by Service Provider downstream processor to enrich the transmitted data.

{
"deploymentId": "dogurj"
}

This property is required


remoteConfiguration​

Type: String

Required A URL or file path to the main configuration.

The main configuration does not exist, the agent will wait until it becomes available.

Accepts Apache Camel HTTP query string parameters

{
"remoteConfiguration": "http://www.example.com",
"remoteConfigurationAuth" : "xodsjfujrhdjfk",
"frequency" : 60000
}

This property is required


remoteConfigurationAuth​

Type: String

When using a URL remoteConfiguration, setting this property will set the "Authorization" header

{
"remoteConfiguration": "http://www.example.com",
"remoteConfigurationAuth" : "xodsjfujrhdjfk",
"frequency" : 60000
}

This property is optional


frequency​

Type: Integer

When using a URL Bootstrap.remoteConfiguration, setting this property will set the polling period in milliseconds

{
"remoteConfiguration": "http://www.example.com",
"remoteConfigurationAuth" : "xodsjfujrhdjfk",
"frequency" : 60000
}

This property is optional


errorHandling​

Type: ErrorHandling

Determines the behavior of error handling while loading the main configuration

{
"errorHandling": {
...
}
}

This property is optional


hosts​

Type: Object of Host

A set of named Host objects. This allows the bootstrap to define http(s) host that can be called from the main configuration.

{
"hosts": {
"mynamedhost": {
"host": "https://www.example.com",
"stepId": "example.com",
"headers": {
"Content-Type": "application/json;charset=UTF-8",
"Accept": "application/json, text/plain, *\/*"
},
"allowlist" : [
["GET", "/this/is/allowed.*"],
["POST", "/this/.*\/allowed"]
],
"data" : {

}
}
}
}

This property is optional


data​

Type: Object

A JSON Object for adding properties.

These properties will be merged with the WorkflowConfiguration.data configuration field and be available to all child elements in the main configuration tree.

{
"data": {
"somedata" : {
"abc: 123
},
"someotherdata" : [ 1, 2, 3]
}
}

This property is optional


Context Object: TimestampManager​

Looks after timestamps for metrics, for example recording the last known timestamp for a metric

TimestampManager is local to the step.

Timestamps can have a named key, or if not provided with a key, will just store with a default key.

Methods​

The following methods are available to call on the context object.

Long get()​

Returns: the last timestamp set without a key


Long get(String key)​

Returns: the last timestamp set for the given key


void set(String timestamp)​

Sets the timestamp without a key see: set(String key, String timestamp)


void set(String key, String timestamp)​

Sets the timestamp for the given key


void setIfLastest(String key, String timestamp)​

Only performs the set operation if the passed timestamp is later than the previously stored.


Long firstTimestamp()​

Returns: the earliest timestamp stored


Integer minutesAgo(Long timestamp)​

Returns: the number of minutes since the given timestamp


Context Object: JavascriptContext​

This is a really important class. It is the only class that javascript files can (should) interact with. Anything that a javascript needs to do must be referenced here.

This class is referenced from javascript as context

Methods​

The following methods are available to call on the context object.

String getPassedMessageAsString()​

Returns: the message body that was passed to this step.

passedMessage = context.getPassedMessageAsString();

Note that is will likely be in JSON format and need to be parsed to be useful


String getMessageBodyAsString()​

Returns: the current message body, this could be the response from an http call for example

body = context.getMessageBodyAsString();

void sendToStep(String stepName, String body, Map headers)​

Send a message to another step

context.sendToStep("myStep", "theBody", { "header1" : "abc"});

void sendToStep(String stepName, String body)​

Send a message to another step

context.sendToStep("myStep", "theBody");

void sendMetric(String key, double value)​

Send a metric

context.sendMetric("theKey", 123);

void sendMetric(String routingToken, long timestamp, String key, double value, Map metadata)​

Send a metric

context.sendMetric("theRoutingToken", theTimestamp, "theKey", 123, { "someMeta" : "Data"});

void sendMetric(long timestamp, String key, double value)​

Send a metric

context.sendMetric(theTimestamp, "theKey", 123);

void sendMetric(long timestamp, String key, double value, Map metadata)​

Send a metric

context.sendMetric(theTimestamp, "theKey", 123, { "someMeta" : "Data"});

void diagnosticLog(String message)​

Write a diagnostic log. This will only be emitted in development mode, or in Production mode if the step is enabled via a "enableDiagnostics" message

context.diagnosticLog("Hello World");

long getTimestamp()​

Returns: the current timestamp (note that the timestamp might be set by a test or other mechanism)

ts = context.getTimestamp();

TimestampManager getTimestampManager()​

Returns: the TimestampManager for the step

tm = context.getTimestampManager();

The timestamp manager allows for persistence of timestamps


void setProperty(String key, Object value)​

Sets a property onto this running exchange, to be used later

context.setProperty("aKey", "aValue");

Object getProperty(String key)​

Returns: the propery for the key

property = context.getProperty("aKey");

Gets a property from this running step


void setPersistedItem(String key, String value)​

Sets an item to the step persistence

context.setPersistedItem("myItem", "theValue");

String getPersistedItem(String key)​

Returns: the string value

item = context.getPersistedItem("myItem");

Gets an item from the step persistence


Map getStepProperties()​

Returns: the propery object

property = context.getStepProperties().put("myProperty", "ok");

Returns the set properties for the Step. These properties will persist after requests.


void setMessage(Object message)​

Sets the message body for this running exchange

context.setMessage("hello world");

void addSplitReturnItem(String item)​

When the current step is a "scripted-split-aggregate" type (see Step the processed item must be added to the aggregate using this method.

context.addSplitReturnItem("hello world");

String getData()​

Returns: the JSON string for the data for this step

data = JSON.parse(context.getData());

String getData(String key)​

Returns: the string for the key in the data for this step

data = context.getData(key);

void setData(String data)​

Set the JSON data for this step

context.setData(JSON.stringify(data));

void setHeader(String name, Object value)​

Add a header to the next http request

context.setHeader("aHeader", "aValue");

String getHeader(String name)​

Returns: the header value as a json array

headerArray = context.getHeader("aHeader");
header = headerArray[0];

Get a header from the a previous request/response


void setUrl(String hostref, String path)​

Set the url for the next http action with reference to a named host

context.setUrl("myHost", "/a/path");

List getSplitReturnArray()​

Returns: the processed aggregtate items

items = context.getSplitReturnArray;

When the current step is a "scripted-split-aggregate" type (see Step the processed items are available here.


String hash(String toHash)​

Returns: the hashed value

hashedValue = context.hash("hello world");

When hashing a value, the original and the hash are emitted to the log to be referred to at a later date. The hash can be used in metrics etc so that the original value is not transmitted


double delta(String key, Double currentValue)​

Returns: currentValue - lastValue

delta = context.delta("myTs", 12);

Returns the differences between the current value and the last value stored for given key


List regexMatch(String regex, String input)​

Returns: array of matches
Returns the regex matches


String mergeJsonStrings(String one, String two)​

Returns: the merged json object
Returns a merged json string


String xmlToJson(String xml)​

Returns: json string
Returns a json string from an xml string


void sleep(long ms)​

Force the currently running script to sleep for the given milliseconds


Context Object: AuthenticationJavascriptContext​

This is a specialised Javascript Context for authentication steps.

All the methods on Javascript Context are still available, the methods listed below are specialisations.

Methods​

The following methods are available to call on the context object.

String getRestrictedDataFromHost(String host)​

Returns: json object string of host data

hostData = JSON.parse(context.getRestrictedDataFromHost("myhost"));

ACCESSES RESTRICTED DATA

Gets the json string of restricted data for a host name


String getAuthenticationPropertiesFromStep(String stepId, String key)​

Returns: json string of authentication properties value or null if expired
ACCESSES RESTRICTED DATA

Gets the authentication properties from another step. These properties can expire.


void setAuthenticationPropertiesOnStep(String stepName, Long expiresInMs, String key, String authenticationProperties)​

ACCESSES RESTRICTED DATA

Sets the authentication properties from another step. These properties can expire.


void sendMetric(String routingToken, long timestamp, String key, double value, Map metadata)​

This method is not allowed in the authentication context


void sendToStep(String stepId, String body, Map headers)​

This method is not allowed in the authentication context


void sendMetric(String key, double value)​

This method is not allowed in the authentication context


void sendMetric(long timestamp, String key, double value)​

This method is not allowed in the authentication context


void sendMetric(long timestamp, String key, double value, Map metadata)​

This method is not allowed in the authentication context


opscotch testing model:​

The opscotch testing model describes how to define tests that are executed against a running opscotch agent.

The test runner configuration is passed to the test runner and describes the locations of tests and resource files. The test configuration describes each individual test.

Here is the outline of the entire structure of the opscotch testing models: the runner configuration and the test configuration.

Note that not every field is required, so be sure to check the detailed descriptions.

The test runner schema​

{
"resourceDir": "",
"testDir": "",
"license": ""
}

The test schema​

{
"ignore": true,
"fromDirectory": "",
"testThisRoute": "",
"useThisTestConfigFile": "",
"useThisBootstrapFile": "",
"mockEndpointResponses" : [
{
"whenThisIsCalled": "",
"expectedPayload": "",
"expectedHeaders": {
"": ""
},
"returnThisFile": "",
"mockedHeaders" : {
"": ""
}
}
],
"theseMetricsShouldHaveBeenSent" : [
{
"timestamp": 0,
"key": "",
"value": 0.0,
"dimensionMap" : {
"": ""
}
}
],
"theseLogsShouldHaveBeenSent" : [
""
],
"timestampOverride": 0
}

JSON Schema in the Test Package:

Scripting context objects in the Test Package:

JSON schema: TestRunnerConfig​

JSON configuration required for defining test configurations against agents.

This configuration file is passed to the test runner as a command line argument and tells it where to find the tests and resource files.

JSON Properties​

The following properties are available to set on the JSON schema.

resourceDir​

Type: String

Required The path to the configuration resource directory

This property is required


testDir​

Type: String

Required The path to the configuration test directory

This property is required


license​

Type: String

Required The license key

This property is required


JSON schema: TestConfig​

Describes how to execute a test and verify results

JSON Properties​

The following properties are available to set on the JSON schema.

ignore​

Type: Boolean

If true the test will not be run.

{
"ignore" : true
}

This property is optional


fromDirectory​

Type: String

Required The relative path from the test directory to the test resources (test workflow configurations, mock response files etc).

{
"fromDirectory" : "/mytest/"
}

This property is required


testThisRoute​

Type: String

Required The name of the step in the workflow configuration to trigger to start the test.

{
"testThisRoute" : "start-application"
}

This property is required


useThisTestConfigFile​

Type: String

Required The workflow configuration file to load for the test.

{
"useThisTestConfigFile" : "test.config.json"
}

This property is required


useThisTestBootstrapFile​

Type: String

The bootstrap configuration to include for the test.

{
"useThisBootstrapFile" : "test.bootstrap.json"
}

This property is optional


mockEndpointResponses​

Type: Array of MockHttpResponse

Required Sets up a http server with mocked responses.

{
"mockEndpointResponses" : [
...
]
}

This property is required


theseMetricsShouldHaveBeenSent​

Type: Array of SendMetricVerification

Required These metrics are expected and the test will fail if they are not generated by the workflow configuration

{
"theseMetricsShouldHaveBeenSent" : [
...
]
}

This property is required


theseLogsShouldHaveBeenSent​

Type: Array of String

These logs are expected and the test will fail if they are not generated by the workflow configuration

{
"theseLogsShouldHaveBeenSent" : [
...
]
}

This property is optional


timestampOverride​

Type: Long

If set (to a millisecond timestamp) the system clock will be set to this time.

{
"timestampOverride" : 1593658546131
}

This property is optional


JSON schema: MockHttpResponse​

Instructs the mock http server what urls to expect and how to respond.

These requests and responses are required to have been called by the test, otherwise the test will fail.

JSON Properties​

The following properties are available to set on the JSON schema.

whenThisIsCalled​

Type: String

Required The complete url that the mock server will listen for.

The "mockserver" host is replaced out to the actual host and port for the mock server.

{
"whenThisIsCalled" : "http://mockserver/controller/restui/licenseRule/getAllRulesSummary"
}

This property is required


expectedPayload​

Type: String

If set will assert that the exact payload was received.

{
"expectedPayload": "{\"some\":\"thing\"}"
}

This property is optional


expectedHeaders​

Type: Object

If set, will assert that expectedHeader's key/value pair is found within the HTTP header.

{
"expectedHeaders" : {"some": "thing}
}

This property is optional


returnThisFile​

Type: String

Required The file path of the response to return.

{
"returnThisFile" : "test.response.summary.json"
}

This property is required


mockedHeaders​

Type: Object

If set will return these headers with the response.

{
"mockedHeaders" : {
"Set-Cookie": "JSESSIONID=A;X-CSRF-TOKEN=B"
}
}

This property is optional


JSON schema: SendMetricVerification​

Defines expected metrics to have been published from the test. If these metrics are not received the test will fail.

Pay special note to the timestamp field.

{
"theseMetricsShouldHaveBeenSent": [
{
"key": "mymetric",
"value": 67.0
}
]
}

JSON Properties​

The following properties are available to set on the JSON schema.

timestamp​

Type: Long

If set will assert the exact timestamp on the metric, otherwise the timestamp will be ignored during assertion.

{
"timestamp" : 1593658546131
}

This property is optional


key​

Type: String

Required Assert the exact key on the metric.

{
"key" : "abcde"
}

This property is required


value​

Type: Double

Required Assert the exact value on the metric.

{
"value" : "1234.56"
}

This property is required


dimensionMap​

Type: Object

Assert that received and expected dimensions are exact.

{
"dimensionMap" : {
"ad" : "ad_mh"
}
}

This property is optional