The extremestartupng-referee is the referee for the recruitment test.
It asks a new question every 5 seconds to every registered candidate. Every question belongs to a question family. A level is associated to each question family. The extremestartupng-referee holds a current level to determine which questions can be asked. If the current level is x then questions will be picked from level 1 to level x families.
Let's consider two question families :
- CharToIntFamily is a char to int conversion question (What is the integer value for character 'a' ?). It's associated level is 1
- DecimalToBinary is a decimal to binary number conversion (What is the binary value for 12 ?). It's associated level is 2.
Every 5 seconds, a new question corresponding to current level will be randomly generated. The current level of the extremestartupng-referee is 1, so only CharToIntFamily questions will be generated :
- (t) : What is the integer value for character 'c' ?
- (t+5s) : What is the integer value for character 'w' ?
- (t+10s) : What is the integer value for character 'k' ?
- ...
When the current level is increased, changing to level 2, question will be generated from level 1 and level 2 question families :
- (t) : What is the binary value for 10 ?
- (t+5s) : What is the binary value for 5 ?
- (t+10s) : What is the integer value for character 'n' ?
- (t+15s) : What is the binary value for 12 ?
Each family question has a success and a failure mark. If a candidate answer is correct, the success mark will be added to its score. Otherwise, it is the failure mark that will be added.
Let's consider that the CharToIntFamily question family's success mark is 10 and that its failure mark is -20 :
- (t) : What is the integer value for character 'c' ? 42 => incorrect => score : -20
- (t+5s) : What is the integer value for character 'w' ? 38 => incorrect => score : -40
- (t+10s) : What is the integer value for character 'p' ? 112 => correct => score : -30
Extremestartupng-referee can be executed using different methods.
mvn clean spring-boot:run
.
mvn clean package
java -cp 'target/*:target/lib/*' com.github.barasher.esng.Main
The command mvn clean package
creates a tarball archive that gathers alls JAR dependencies for extremestartupng-referee (and its JAR itself) :
mvn clean package
tar -xzf target/esng-referee.tar.gz -C /tmp/
java -cp '/tmp/esng-referee/*' com.github.barasher.esng.Main
A Docker image of the extremestartupng-referee is available on the docker hub.
docker pull barasher/extremestartupng-referee:1.0
docker run --rm -it -p 8080:8080 barasher/extremestartupng-referee:1.0
Extremestartupng-referee can be configured through a YAML file.
To specify which configuration file to use, you have to add a -D
parameter in the command line (-Dspring.config.location
) :
java -cp '/tmp/esng-referee/*' -Dspring.config.location=/tmp/application.yaml com.github.barasher.esng.Main
- server.port : listening port for the extremestartupng-referee's REST webservices
- esng.questions : question configuration (list)
- esng.questions**.family** : specify the question family that is beeing configured
- esng.questions**.enabled** : enable (default, "true" value) or disable ("false" value) the question family
- esng.questions**.level** : overriding level for the question family
Here is a sample :
server:
port: 8081
esng:
questions:
-
family: "aFamily"
enabled: false
-
family: "anotherFamily"
level: 3
With this configuration :
- The REST webservices will be listening on port 8081
- The question family
aFamily
will be disabled - The question family
anotherFamily
will be used from level 3
Here is the "classical" workflow :
- The extremestartupng-referee starts
- A sample "pause" question will be asked to every candidate (but no one will receive it because there is no candidate that has been registered)
- All the candidates are getting registered. When registered, each candidate will receive a sample question that doesn't provide any point.
- The referee starts the game : real questions will be asked
A swagger
UI is available : http://192.168.0.1:8080/swagger-ui.html
To get questions, candidates have to register to the referee through a REST webservice.
Once the new candidate has been registered, the extremestartupng-referee starts asking him questions.
- Method : POST
- Path : player
- QueryParams
- nick : (required) Nickname of the candidate
- host : (required) Host of the candidate's extremestartupng-candidate
- port : (required) Port of the candidate's extremestartupng-candidate
{
"_nick" : "john",
"_uri" : "http://192.168.0.2:8081",
"_score":0
}
This service returns every registered candidates.
- Method : GET
- Path : players
[
{
"_nick" : "john",
"_uri" : "http://192.168.0.2:8081",
"_score" : 120
}
]
This service unregisters a candidate.
- Method : DELETE
- Path : player/{nick}
- PathParams
- nick : Candidate's nickname
[
{
"_nick" : "john",
"_uri" : "http://192.168.0.2:8081",
"_score" : 120
}
]
This service changes the current level.
- Method : POST
- Path : level/{lvl}
- PathParams
- lvl : New level
{
"_currentLevel" : 5,
"_players" : [
{
"_nick" : "john",
"_uri" : "http://192.168.0.2:8081",
"_score" : 150
}
]
}
This service increases the current level.
- Method : POST
- Path : level
{
"_currentLevel" : 5,
"_players" : [
{
"_nick" : "john",
"_uri" : "http://192.168.0.2:8081",
"_score" : 150
}
]
}
This service starts or resumes the game (if it has been paused).
- Method : POST
- Path : pause
{
"_currentLevel" : 5,
"_players" : [
{
"_nick" : "john",
"_uri" : "http://192.168.0.2:8081",
"_score" : 150
}
]
}
This service pauses the game : a sample question will be asked.
- Method : POST
- Path : pause
{
"_currentLevel" : 5,
"_players" : [
{
"_nick" : "john",
"_uri" : "http://192.168.0.2:8081",
"_score" : 150
}
]
}
Several metrics are available during test.
- Method : GET
- Path : resume
- Sample :
http://192.168.0.1:8080/resume
- gauge.extremeStartupNG.currentLevel : current level,
- counter.extremeStartupNG.questions.count : question count since the beginning of the test,
- counter.extremeStartupNG.[nickname].incorrectAnswer.count : incorrect answer count,
- counter.extremeStartupNG.[nickname].correctAnswer.count : correct answer count.
{
"gauge.extremeStartupNG.currentLevel": 2.0,
"counter.extremeStartupNG.questions.count": 16,
"counter.extremeStartupNG.john.incorrectAnswer.count": 3,
"counter.extremeStartupNG.john.correctAnswer.count": 8
}
The current level is 2, 16 questions have been asked, John gave 3 incorrect answers and 8 correct answers. 16 - (3 + 8) questions were already asked when John joined the test.