Skip to main content

Netboard Service Usage in Service Suite

The test designer’s Netboard service is an HTTP service that allows you to store and retrieve named data. The stored data is deleted after 1 hour and since it each entry is named, then if another set of key/values comes with the same name, then the previous value if existing, will get replaced with the new value. The concept is similar to a temporal hash map. So a Netboard is basically a named set of key/value pairs that are stored for 1 hour and then automatically cleared to avoid memory leaks.

Netboard Calls

To make a Netboard call take the AIQ server address but with port 9090, as this service is hosted in the Test Designer server. Example:

http://localhost:9090/ds/dyn/Netboard/<command>

create

Parameters: board

Description: creates an empty net board with id "395". This call is optional as the first put will create the named board if it does not exist.

http://localhost:9090/ds/dyn/Netboard/create?board=staging

put - POST

Parameters: board, key,value

Description: store into the “staging” Netboard a key/value pair data with key = “homepage“ and a JSON string as a value. If a board with the provided key does not exist, a new board is created automatically and the data gets added.

http://localhost:9090/ds/dyn/Netboard/put?board=staging&key=id&value=623465387

get

Parameters: board, key

Description: returns a String with the value for an entry named key in the board provided.

http://localhost:9090/ds/dyn/Netboard/get?board=staging&key=account

containsKey

Parameters: board, key

Description: returns true if the provided board contains an entry with the provided key.

http://localhost:9090/ds/dyn/Netboard/containsKey?board=staging&key=account

getKeys

Parameters: board

Description: returns a JSON string with all keys defined in the board named “staging“

isEmpty

Parameters: board

Description: returns true if the board is empty

clearBoard

Parameters: board

Description: clear all the contents of the board

deleteBoard

Parameters: board

Description: remove the Netboard

getBoards

Parameters: none

Description: returns a JSON string with all the currently existing board names.

Example Test Designer JS Script

Segment.com Integration using the Netboard service

A set of entry points has been implemented along with standard Netboard calls to implement a webhook integration that allows automatic store of http://segment.com events. Segment.com events have JSON data. Need to configure any of the below entry points as webhooks inside http://segment.com configurations. The data received from those entry points will be processed in a way that received events data will be automatically named and put in corresponding Netboards.

_setDomain("http://localhost:9090");
get("/ds/dyn/Netboard/resetBoards");
get("/ds/dyn/Netboard/create?board=hitrecord");
get("/ds/dyn/Netboard/put?board=hitrecord&key=State&value=Alaska");
get("/ds/dyn/Netboard/put?board=hitrecord&key=Country&value=USA");
var $state = get("/ds/dyn/Netboard/get?board=hitrecord&key=State").getDataString();
log($state);
assertEquals($state,"Alaska");
var $contains = get("/ds/dyn/Netboard/containsKey?board=hitrecord&key=State").getDataString();
log($contains);
assertTrue($contains);
var $fields = JSON.parse(get("/ds/dyn/Netboard/getKeys?board=hitrecord").getDataString());
log($fields[0]);
assertEquals("State",$fields[0]);
log($fields[1]);
assertEquals("Country",$fields[1]);
var $isEmpty = get("/ds/dyn/Netboard/isEmpty?board=hitrecord").getDataString();
log("isEmpty: "+$isEmpty)
assertTrue($isEmpty=="false");
get("/ds/dyn/Netboard/create?board=costa%20rica");
get("/ds/dyn/Netboard/put?board=costa%20rica&key=State&value=San%20Jose");
get("/ds/dyn/Netboard/put?board=costa%20rica&key=Country&value=Costa%20Rica");
var $boards = JSON.parse(get("/ds/dyn/Netboard/getBoards").getDataString());
log($boards[0]);
assertEquals("hitrecord",$boards[0]);
assertEquals("costa rica",$boards[1]);
var $text = get("/ds/dyn/Netboard/removeOldEntries").getDataString();
log($text);
assertContains($text,"Removing data from Netboard older than");
get("/ds/dyn/Netboard/clearBoard?board=hitrecord");
$fields = JSON.parse(get("/ds/dyn/Netboard/getKeys?board=hitrecord").getDataString());
log($fields.length);
assertEquals(0,$fields.length);
get("/ds/dyn/Netboard/deleteBoard?board=hitrecord");
$fields = JSON.parse(get("/ds/dyn/Netboard/getBoards").getDataString());
log($fields.length);
assertEquals(1,$fields.length);
get("/ds/dyn/Netboard/deleteBoard?board=costa%20rica");
$fields = JSON.parse(get("/ds/dyn/Netboard/getBoards").getDataString());
log($fields.length);
assertEquals(0,$fields.length);

Segment.com Entry points

There are 5 independent entry points, each one capable of admin many Netboard.

  1. <aiq server dns>:9090/ds/dyn/Netboard/aiq01

  2. <aiq server dns>:9090/ds/dyn/Netboard/aiq02

  3. <aiq server dns>:9090/ds/dyn/Netboard/aiq03

  4. <aiq server dns>:9090/ds/dyn/Netboard/aiq04

  5. <aiq server dns>:9090/ds/dyn/Netboard/aiq05

Once the webhook is configured with one of the above entry points the data from the incoming http://segment.com event will be available to be verified using normal get Netboard calls.


Last updated: July 28, 2023

If you have any feedback on this topic, please contact us at documentation@appvance.ai