Entity loader syntax
You use the entity loader files to define a set of entities that you load to a system and use in a test scenario for your solution.
Purpose
You define the entity loader in the Entity Loader editor. An entity loader file is used to define the entities that you want to load to a development server. To be loaded, an entity must have an ID.
Syntax
The following syntax describes the basic structure of an entity loader file.
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>;]
load <entity>[where <attribute> is <value>];
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 |
|---|---|---|
| load <entity> ; |
Loads an entity. An entity can have one or more attributes, as well as collections of objects. |
|
| Construct | Description | Example |
|---|---|---|
| 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. |
|
| where <entity type> <entity id> |
Short construct that specifies a relationship between the bound entity and the event. |
|
| where <entity type> identified by <entity id> |
Specifies a relationship between the bound entity and the event. |
|
Example
define 'Jane' as a new customer where
the customer id is "Jane@example.com",
the first name is "Jane" ,
the last name is "Doe" ;
define 'Janes Cart' as a new shopping cart where
the customer is Jane ,
the shopping cart id is "1234567890" ;
load Jane ;
define 'banana' as "BANANA";
load a new product where
the id is 'banana' ,
the description is "A banana" ;
add the product identified by 'banana' to the products of 'Janes Cart' ;
load 'Janes Cart' ;