Skip to content

Stub Configuration, Multi Stub Configuration

Tamás Kőhegyi edited this page Jun 17, 2022 · 4 revisions

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:

wilma-stub configuration group

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:

  1. Set the specific stub configuration into enabled or disabled state
  2. Change the order of stub configurations (move up/down)
  3. Drop a stub configuration (remove from the list)
  4. Preserve the actual stub configuration (all groups)

1. Enabled/Disabled:

wilma-stub enabled or disabled

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: wilma-stub enabled

Disabled statement: wilma-stub disabled

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


2. Change order

wilma-stub change order

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

  1. 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.
  2. 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


3. Drop

wilma-stub drop

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

  1. 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


4. Get information about the actual stub configuration status

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

5. Preserve (Save) the actual stub configuration (all groups)

**There is a button under the tables of stub configurations on the Stub configuration tab of http://wilmahost:wilmaport/stubconfig/. **

wilma-stub persist

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.

 

Clone this wiki locally