Event sequence syntax
You use the event sequence file to define a set of events that you can emit to the system and use in a test scenario for your solution.
Purpose
You define the event sequence in the Event Sequence editor. An event sequence file is used to define the events that you want to emit and the attributes that compose the events. To be emitted, an event needs the following elements:- A type.
- A timestamp.
Syntax
The following syntax shows all of the constructs you can add to a common definitions file. All of the constructs are optional. Use as many constructs as it takes to define a test scenario or reusable subset of a scenario.
[using definitions from:
- "<common definitions file>" ;]
[define <variable> as <value> [where
<entity type> <entity id>
<entity type> identified by <entity id>] ;]
[add <value> to <collection> ;]
[clear <list> of <object> ;]
[make it <true or false> that <object> is <boolean field>;]
[remove <an object> from <a list> ;]
[set <attribute> of <object> to <value>;]
emit [<event>] [where <attribute> is <value>];
emit [<event>] [where <attribute> is <value>][ , time-stamped <date & time>] ;
emit [<event>] [where <attribute> is <value>][, time-stamped <calendar duration> earlier|later] ;
If you use the optional using definitions from : <common definitions file> construct, it must be the first phrase in the test files. Do not create circular dependencies by which two common definitions files reference each other.
Construct | Description | Example |
---|---|---|
emit <event> ; |
Emits an event. An event must have a timestamp, and can have one or more attributes, as well as collections of objects. |
|
emit <an event> , time-stamped <date & time> ; |
Emits an event with an absolute timestamp. |
|
emit <an event> , time-stamped <calendar duration> earlier ; |
Emits an event with a timestamp that is relative to the timestamp of the previous event, according to the order of the events order of definition in the file. |
|
emit <an event> , time-stamped <calendar duration> later ; |
Emits an event with a timestamp that is relative to the timestamp of the previous event, according to the order of the events order of definition in the file. |
|
Construct | Description | Example |
---|---|---|
<entity type> <entity id> |
Short construct that specifies a relationship between the bound entity and the event. |
|
<entity type> identified by <entity id> |
Specifies a relationship between the bound entity and the event. |
|
add <value> to <collection> ; |
Adds an object to a collection. The target of this construct cannot be a relationship. |
|
define <variable> as <value> ; |
Defines a variable. The value of the variable can be an object or a constant. Variables can be used in the definition of the event emission. |
|
clear <list> of <object> ; |
Clears a collection or removes a relationship between two objects. The clear <list> keywords specify the collection or types of relationship, and the of <object> keywords define the entity or event that you want to clear from the relationship or collection. |
|
make it <true or false> that <object> is <boolean field>; |
Replaces the value of a boolean attribute. |
|
remove <an object> from <a list> ; |
Removes an item from a list. The remove <object> keywords specify the object that you want to remove, and the from <a list> keywords define the collection from which you want to remove the object. |
|
set <attribute> of <object> to <value>; |
Replaces the value of an attribute with the value of another type. Values can be simple, relationship, geospatial, or complex types. |
|
using definitions from: - "<common definitions file>" ; |
Specifies the common definitions file or files from which an entity loader, event sequence, or common definitions file uses the definitions. When you use this construct, it must be used in the header of the file and precede all of the other constructs. |
|
Examples
The following example shows a single event with an absolute timestamp.
emit a new transaction where
the account is the account identified by "1234" ,
the amount is 100 ,
time-stamped 3/24/2015 10:36:12 AM ;
The following example shows a more complex event sequence with three events. The example also includes definitions of variables, and a collection of the account objects. The first event is a transaction event with several attributes, and has an absolute timestamp. The variable the customer is used in the definition of the customer subscription variable. In the next construct, an account is added to the collection of accounts of this customer subscription. Finally, two events are written with relative timestamps. The subscription event is time-stamped 5 minutes after the transaction event, and the authorization response event is time-stamped 15 minutes before the subscription event. The subscription event is emitted after the authorization response event, based on their order in the file, and regardless of their timestamps.
emit a new transaction where
the account is the account identified by "1234",
the amount is 13000 ,
the country code is "FR" ,
time-stamped 3/24/2015 10:36:12 AM ;
define 'the customer' as the customer identified by "jane@doe.com" ;
define 'the subscription' as a new customer subscription where
the customer is 'the customer';
add the account "98098432" to
the accounts of 'the subscription';
emit 'the subscription' ,
time-stamped 5 minutes later;
emit a new authorization response where
the message is "Approved" ,
time-stamped 15 minutes earlier ;