-
Notifications
You must be signed in to change notification settings - Fork 12
Stub Configuration, Multi Stub Configuration
Wilma can handle several different stub configurations. There are two optional attributes of wilmaStubConfiguration
object, "groupName" and "active":
{
"wilmaStubConfiguration": {
"groupName": ..., // Name of the Stub Configuration.
"active": ... // Determines whether a loaded Stub Configuration is in use ("active": true) or not.
// Its default value is `true`.
}
}
The property that Wilma uses to detect difference between stub configurations is the "groupName"
field in the stub configuration JSON file. It’s an optional attribute so if you do not set it, Wilma will use a default value (“Default”). There can be only one stub configuration without groupName
field and if another one is uploaded, it will overwrite the existing one.
The field value is visible on the UI:
The "active"
attribute contains the enabled/disabled state of the stub configuration. If it does not exist in the stub configuration JSON, Wilma will use value true
as default.
Possibilities:
- Set the specific stub configuration into enabled or disabled state
- Change the order of stub configurations (move up/down)
- Drop a stub configuration (remove from the list)
- Preserve the actual stub configuration (all groups)
These buttons turn on or off the specific stub configuration. The default statement of every new stub configuration is Enabled, but if you set a stub configuration into disabled status, Wilma will not use those rules.
Enabled statement:
Disabled statement:
Behind the stage:
Wilma uses this servlet to set the Enabled/Disabled statement of any stub configuration.
http://wilmahost:wilmaport/config/admin/stub/changestatus
- nextstatus parameter means the state to be set (true means the configuration will be Enabled, false means the configuration will be Disabled),
- groupname parameter is used at the identification.
This is an example URL to disable the “UNIQUETeamId” stub configuration.
http://wilmahost:wilmaport/config/admin/stub/changestatus?nextstatus=false&groupname=UNIQUETeamId
You can use the marked buttons to modify the order of stub configurations.
Behind the stage:
Wilma uses this servlet to change the order of stub configurations.
http://wilmahost:wilmaport/config/admin/stub/changeorder
- direction parameter is an integer, but the important is just its sign, if you set any minus, that means you want to move the actual configuration down by one. But if you set to 0 or to a positive number, that means you want to move the configuration up by one.
- groupname parameter is used at the identification.
This is an example URL to move down the “Default” stub configuration by one.
http://wilmahost:wilmaport/config/admin/stub/changeorder?direction=-1&groupname=Default
Drop function deletes the chosen stub configuration from the memory of Wilma. So do not use this function to turn off a configuration.
Behind the stage:
Wilma uses this servlet to drop the chosen configuration.
http://localhost:wilmaport/config/admin/stub/drop
- groupname parameter is used at the identification.
This is an example URL to drop the “UNIQUETeamId” stub configuration.
http://wilmahost:wilmaport/config/admin/stub/drop?groupname=UNIQUETeamId
The actual stub configuration is visible via Wilma GUI on page http://wilmahost:wilmaport/stubconfig/
. For scripting purpose, you can get the actual stub configuration in JSON format sending request o the following URL: http://wilmahost:wilmaport/config/public/stubdescriptor
**There is a button under the tables of stub configurations on the Stub configuration tab of http://wilmahost:wilmaport/stubconfig/
. **
Stub configuration saving process:
There is a stub.descriptors.cache.path property in the wilma.conf.properties file. This key shows the relative path of that folder which will be used to save the stub configurations.
This button points to the http://wilmahost:wilmaport/config/admin/stub/save
servlet. If a request arrives to it, a cleaning process runs first which deletes all _*stubConfig.json files where * means >0 integer value.
After that all stub configuration will be written to this folder. After it, a response arrives back to the client whether the saving process was successful or not.
In case the config files is persisted this way, when Wilma restarts, it will (try to) reload the persisted configurations.