Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #220

Closed
wants to merge 140 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
f483f14
New geography question template: Area
RicardoDiNu Apr 6, 2024
9f26f04
New geography question template: Currency
RicardoDiNu Apr 6, 2024
6d1b749
New geography question template: Population
RicardoDiNu Apr 6, 2024
8983649
New geography question category: History
RicardoDiNu Apr 6, 2024
3f41285
Revert "New geography question category: History"
RicardoDiNu Apr 6, 2024
2888e2d
New history question template: Artifact
RicardoDiNu Apr 6, 2024
6d67b5e
New history question template: Battle
RicardoDiNu Apr 6, 2024
760b15a
New history question template: Dynasty
RicardoDiNu Apr 6, 2024
53c1dff
New history question template: Event
RicardoDiNu Apr 6, 2024
d559d2a
New history question template: Invention
RicardoDiNu Apr 6, 2024
277b862
New history question template: Leader
RicardoDiNu Apr 6, 2024
983432a
New history question template: Period
RicardoDiNu Apr 6, 2024
4ccf348
InsertSampleDataService updated with new question templates
RicardoDiNu Apr 6, 2024
5b978a5
Fix - Add new question category: History
RicardoDiNu Apr 6, 2024
79cbfb5
Add new question category and templates: Science
RicardoDiNu Apr 6, 2024
8fe0cac
Add new question category and templates: Art
RicardoDiNu Apr 6, 2024
41b2333
Fix generators
RicardoDiNu Apr 6, 2024
61ec4bf
Add new question category and templates: Movie
RicardoDiNu Apr 6, 2024
f7080ce
Update InsertSampleDataService with the new templates
RicardoDiNu Apr 6, 2024
391f82f
frontEnd for multiplayer
uo288061 Apr 9, 2024
152e216
init backEnd for multiplayer
uo288061 Apr 9, 2024
3eb53d9
more backEnd for multiplayer
uo288061 Apr 9, 2024
06f209d
fixing backEnd for multiplayer (It is not yet implemented) done about…
uo288061 Apr 10, 2024
15c35d5
starting multiplayer lobby
uo288061 Apr 10, 2024
7c197e8
done multiplayer lobby, now the list of players updates automatically
uo288061 Apr 10, 2024
a1c33f2
Correción contador de preguntas
uo287568 Apr 10, 2024
989fee5
fix some problems
uo288061 Apr 10, 2024
c1a4d4e
create and join buttons working correctly
uo288061 Apr 11, 2024
5d3c4c4
Correción primera respuesta la correcta
uo287568 Apr 11, 2024
acd0e36
players can can play multiplayer games
uo288061 Apr 11, 2024
c46e273
The multiplayer mode is done but some bugs need to be fixed
uo288061 Apr 13, 2024
81accd1
Players with same multiplayerCode, have same questions
uo288061 Apr 14, 2024
c897fba
Merge pull request #193 from Arquisoft/CorreccionesFuncionalidad
RicardoDiNu Apr 15, 2024
5aaa8db
Undo CategoryServiceImpl and InsertSampleDataService changes to only …
RicardoDiNu Apr 15, 2024
4968265
Update multiplayerGame.html style
RicardoDiNu Apr 15, 2024
863dc8f
Update lobby.html style
RicardoDiNu Apr 15, 2024
db833af
Fix small bug of code validation (only numbers are permited)
RicardoDiNu Apr 15, 2024
586805e
Change multiFinished.html style
RicardoDiNu Apr 15, 2024
ccfb4d3
Cambia color la respuesta. Muestra boton continuar
uo287568 Apr 16, 2024
221cb3e
Avance al mostrar siguiente pregunta.
uo287568 Apr 16, 2024
b32fa20
FinishGame bug fixed
RicardoDiNu Apr 16, 2024
33111ed
Duplicate multiFinished window bug fixed
RicardoDiNu Apr 16, 2024
db70848
multiFinished style update
RicardoDiNu Apr 16, 2024
f8ffba9
Add grafana and prometheus
Pelayori Apr 16, 2024
473e41f
Add grafana and prometheus
Pelayori Apr 16, 2024
cef4298
Add grafana and prometheus
Pelayori Apr 16, 2024
b4b0d1d
Some endMultiGame logic added
RicardoDiNu Apr 16, 2024
d8f41bb
Fix some things
Pelayori Apr 16, 2024
4a61409
Solucion bug contador pregunta
uo287568 Apr 17, 2024
212f5fe
Corrección contador y barra de progreso
uo287568 Apr 17, 2024
9354cfb
Finalizado la eliminación de la pantalla resultado.
uo287568 Apr 17, 2024
d8aaa2b
Merge pull request #200 from Arquisoft/monitoring
Pelayori Apr 17, 2024
884b8d6
Merge pull request #202 from Arquisoft/EliminarPantallaResultado
Pelayori Apr 17, 2024
292eab3
Actualización Whitebox Overall System
uo287568 Apr 22, 2024
a23670c
Actualización Whitebox Overall System Level 2
uo287568 Apr 22, 2024
51f226d
Correción índice ranking
uo287568 Apr 23, 2024
01543f7
new entity on the dataBase (MultiplayerSession)
uo288061 Apr 23, 2024
f9ea290
Error fixed - new entity on the dataBase (MultiplayerSession)
uo288061 Apr 23, 2024
59e24bc
more changes
uo288061 Apr 23, 2024
fcb1a15
logic for MultiplayerSession done
uo288061 Apr 23, 2024
2773302
some problems fixed
uo288061 Apr 23, 2024
cdca207
frontend for multiplayerRanking.html done
uo288061 Apr 23, 2024
c1793ba
some important changes for multiplayer logic
uo288061 Apr 23, 2024
22f450e
Merge pull request #205 from Arquisoft/IndiceRanking
Pelayori Apr 24, 2024
8107a35
Merge pull request #203 from Arquisoft/SincroDocumentacion
Pelayori Apr 24, 2024
e603718
Remove old commented code
Pelayori Apr 24, 2024
2b58429
all problems fixed (I think)
uo288061 Apr 24, 2024
1688771
First version of the base JSON done
uo287545 Apr 24, 2024
48fe605
Added statements for the capital question
uo287545 Apr 24, 2024
147bb7d
small changes
uo288061 Apr 24, 2024
0c7930b
Add table and dropdown to user management
Pelayori Apr 24, 2024
f8374a8
Added currency question
uo287545 Apr 24, 2024
11f09d3
Initial implementation of the new question generator
uo287545 Apr 25, 2024
e5a6f37
First part of the request system
uo287545 Apr 25, 2024
8a8ef29
Added question and answer placeholders to the JSON
uo287545 Apr 25, 2024
e319116
Added statement generation based on language
uo287545 Apr 25, 2024
28e1068
First version of the question generator finished
uo287545 Apr 25, 2024
b812a5f
Added name only constructor for category
uo287545 Apr 25, 2024
a079a21
Removed old templates
uo287545 Apr 25, 2024
4ac734a
Test controller and temporary comments on some classes that used the …
uo287545 Apr 25, 2024
bd06490
New question generator tested and working
uo287545 Apr 25, 2024
c85ee32
All multiplayerGame correct
uo288061 Apr 25, 2024
af999eb
cleaning code
uo288061 Apr 25, 2024
0a8e957
Merge remote-tracking branch 'origin/develop' into multiplayer-bugs-f…
uo288061 Apr 25, 2024
f92a7b1
problems solved
uo288061 Apr 25, 2024
3f4c703
Removed unused method from the question generator interface
uo287545 Apr 25, 2024
d0c2200
Added new question and improved the queries
uo287545 Apr 25, 2024
51f41d8
Added the fourth question
uo287545 Apr 25, 2024
7a27e6e
Started implementation of the QuestionGeneratorService with schedulin…
uo287545 Apr 25, 2024
d829ec9
Added stack to store all the different types of questions along with …
uo287545 Apr 25, 2024
7865da5
Deleted deprecated class
uo287545 Apr 25, 2024
9659f1b
Scheduled question generation working
uo287545 Apr 25, 2024
e848907
Fixed correct question not being associated with the question
uo287545 Apr 25, 2024
5346fe0
Fixed SampleDataService and tests
uo287545 Apr 25, 2024
fb1d726
Merge branch 'develop' into add-question-templates
uo287545 Apr 25, 2024
047bf0f
Fixed unit tests
uo287545 Apr 25, 2024
8f4f72d
All tests working
uo287545 Apr 25, 2024
62f5618
Removed unused code
uo287545 Apr 25, 2024
a49cc53
Trying to fix the game controller test
uo287545 Apr 26, 2024
ee0ae97
Finish user management
Pelayori Apr 26, 2024
afa0bbe
Start adding question management
Pelayori Apr 26, 2024
8c1a4ae
Merge branch 'add-question-templates' into admin-view
Pelayori Apr 26, 2024
2776571
Question management mostly done
Pelayori Apr 26, 2024
4ea0663
unit tests for MultiplayerSession
uo288061 Apr 26, 2024
ccc1a72
unit tests for MultiplayerSession (fixed)
uo288061 Apr 26, 2024
89a6352
Modify so question generation starts over with new JSON
Pelayori Apr 26, 2024
da799e9
Fix sticky footer
Pelayori Apr 26, 2024
ddf24c3
Fix code hotspot
Pelayori Apr 26, 2024
78cde1b
Fix nav
Pelayori Apr 26, 2024
6dbbd28
Fix nav in small widths
Pelayori Apr 26, 2024
33fdce6
Added new scheduled method to regenerate the questions each 24 hours
uo287545 Apr 26, 2024
3725378
User management integration tests
Pelayori Apr 26, 2024
6b8b6dc
Question management integration tests
Pelayori Apr 26, 2024
eec984f
Merge pull request #210 from Arquisoft/add-question-templates
Pelayori Apr 26, 2024
35ecb0f
Merge branch 'develop' into admin-view
Pelayori Apr 26, 2024
8d6c06e
Merge pull request #211 from Arquisoft/admin-view
Pelayori Apr 26, 2024
88ccb95
Fix sonarcloud issues
Pelayori Apr 26, 2024
9791637
Fix code smells
Pelayori Apr 26, 2024
ce95f53
Adjust code
Pelayori Apr 26, 2024
2fdc7f9
Created the documentation chapters for question generation and testin…
uo287545 Apr 26, 2024
cf3f1f7
Included new documentation in the index.adoc
uo287545 Apr 26, 2024
704843a
MultiplayerSession Unit Tests - Entities
RicardoDiNu Apr 26, 2024
ba731ef
MultiplayerSession Unit Tests - GameService
RicardoDiNu Apr 26, 2024
e0f6fd7
MultiplayerSession Unit Tests - QuestionService
RicardoDiNu Apr 26, 2024
dfd89ec
MultiplayerSession Unit Tests - PlayerService(users)
RicardoDiNu Apr 26, 2024
05e25ee
MultiplayerSession Unit Tests - PlayerService(score)
RicardoDiNu Apr 26, 2024
183e050
MultiplayerSession Unit Tests - PlayerService(session and code)
RicardoDiNu Apr 26, 2024
aceb858
Half done testing.adoc
uo287545 Apr 26, 2024
49b1911
Merge branch 'develop' into multiplayer-bugs-fixing
Pelayori Apr 26, 2024
418b15e
Merge and fix footers
Pelayori Apr 26, 2024
b3bceb7
Fix tests
Pelayori Apr 26, 2024
98464b7
Fix tests
Pelayori Apr 26, 2024
929a7b2
Fix tests
Pelayori Apr 26, 2024
d21b9a6
Merge pull request #218 from Arquisoft/multiplayer-bugs-fixing
Pelayori Apr 26, 2024
f68cfeb
Fix tests
Pelayori Apr 26, 2024
8ed53d5
Merge branch 'develop' into code-smells
Pelayori Apr 26, 2024
7c4ac79
Fix compile
Pelayori Apr 26, 2024
6da2da1
Merge pull request #219 from Arquisoft/multiplayer-bugs-fixing
Pelayori Apr 27, 2024
63bccef
Merge pull request #212 from Arquisoft/code-smells
Pelayori Apr 27, 2024
e96b9c2
Merge branch 'master' into develop
Pelayori Apr 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
MYSQL_HOST=db
KEYSTORE_PATH=./testCert.p12
KEYSTORE_PASSWORD=123456
WIQ_IMAGE=pelayori/wiq_es04b
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ jobs:
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_KEY }}
script: |
wget https://raw.githubusercontent.com/${{ github.repository }}/${{ github.ref_name }}/docker-compose.yml -O docker-compose.yml
docker-compose down
wget https://raw.githubusercontent.com/${{ github.repository }}/${{ github.ref_name }}/docker-compose.yml -O docker-compose.yml
wget https://raw.githubusercontent.com/${{ github.repository }}/${{ github.ref_name }}/prometheus.yml -O prometheus.yml
docker compose pull
docker-compose up -d
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ jobs:
kill $(cat spring-boot-app.pid)
- name: Collect Jacoco report and send to Sonar
run: |
./mvnw org.jacoco:jacoco-maven-plugin:report sonar:sonar -Dsonar.projectKey=Arquisoft_wiq_es04b -Dsonar.organization=arquisoft -Dsonar.branch.name=${{ github.head_ref || github.ref_name }} -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${{ secrets.SONAR_TOKEN }} -Dspring.profiles.active=test
./mvnw org.jacoco:jacoco-maven-plugin:report sonar:sonar -Dsonar.projectKey=Arquisoft_wiq_es04b -Dsonar.organization=arquisoft -Dsonar.branch.name=${{ github.head_ref || github.ref_name }} -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${{ secrets.SONAR_TOKEN }} -Dspring.profiles.active=test
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Build stage with Maven and JDK 17
FROM maven:3.8.4-openjdk-17-slim as build
WORKDIR /app
WORKDIR ./app
COPY pom.xml .
COPY src src/
# Use Maven directly instead of the Maven Wrapper
RUN mvn clean package -DskipTests

# Run stage with JDK 17
FROM openjdk:17-slim
COPY --from=build /app/target/*.jar app.jar
COPY --from=build ./app/target/*.jar app.jar
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-Dspring.profiles.active=prod","-jar","/app.jar"]
EXPOSE 443
43 changes: 37 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ services:
restart: always

wiq_es04b:
image: ghcr.io/arquisoft/wiq_es04b:latest
image: ${WIQ_IMAGE:-ghcr.io/arquisoft/wiq_es04b:latest}
environment:
MYSQL_HOST: ${MYSQL_HOST}
MYSQL_PORT: ${MYSQL_PORT}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE:-wiq_es04b}
MYSQL_USER: ${MYSQL_USER:-wiq_es04b}
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-wiq_es04b}
MYSQL_PORT: ${MYSQL_PORT:-3306}
KEYSTORE_PATH: ${KEYSTORE_PATH}
KEYSTORE_PASSWORD: ${KEYSTORE_PASSWORD}
ports:
Expand All @@ -38,9 +38,40 @@ services:
volumes:
- ${KEYSTORE_PATH}:/certs/keystore.p12

prometheus:
image: prom/prometheus:latest
volumes:
- prometheus_data:/prometheus
- ./prometheus.yml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"
networks:
- mynetwork
depends_on:
- wiq_es04b
restart: always

grafana:
image: grafana/grafana:latest
volumes:
- grafana_data:/var/lib/grafana
environment:
GF_AUTH_DISABLE_LOGIN_FORM: 1
GF_AUTH_ANONYMOUS_ENABLED: true
GF_AUTH_ANONYMOUS_ORG_ROLE: Admin
ports:
- "3000:3000"
networks:
- mynetwork
depends_on:
- prometheus
restart: always

volumes:
db_data:
prometheus_data:
grafana_data:

networks:
mynetwork:
driver: bridge
driver: bridge
8 changes: 8 additions & 0 deletions docs/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,12 @@ include::src/11_technical_risks.adoc[]
// 12. Glossary
include::src/12_glossary.adoc[]

<<<<
// 13. Question Generation Strategy
include::src/13_question_generation_strategy.adoc[]

<<<<
// 14. Testing
include::src/14_testing.adoc[]


24 changes: 12 additions & 12 deletions docs/src/05_building_block_view.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ This section provides an overview of the main components of the system and their
actor User
actor "External Developers" as Dev
component "[WIQ QuestionGame]" as WIQ {
component "[Game Logic]" as Logic
component "[User Account\nManagement]" as UserMgmt
component "[Question\nManagement]" as QuestMgmt
component "[API\nManagement]" as APIMgmt
component "[GameSession\nService]" as Logic
component "[PlayerService]" as UserMgmt
component "[QuestionService]" as QuestMgmt
component "[RestApi\nService]" as APIMgmt
}
database "Database" as DB
[WikiData] as WikiData
Expand Down Expand Up @@ -64,13 +64,13 @@ The decomposition provides a clear, high-level overview of how the WIQ system in

For Level 2 of the Building Block View, the WIQ (QuestionGame) system is further decomposed into four primary components that define its operational structure. Each component is designed to fulfill specific roles within the architecture, ensuring the system's functionality and responsiveness to user interactions.

* *Game Logic:* This component acts as the core of the QuestionGame, orchestrating the flow of games, managing question selection, enforcing game rules, and tracking scores. It ensures that gameplay proceeds smoothly and according to the predefined logic, offering a seamless experience for the user.
* *GameService:* This component acts as the core of the QuestionGame, orchestrating the flow of games, managing question selection, enforcing game rules, and tracking scores. It ensures that gameplay proceeds smoothly and according to the predefined logic, offering a seamless experience for the user.

* *User Account Management:* Responsible for handling user accounts, this component manages registration, authentication, and profile management. It safeguards user data while providing a personalized experience through game history tracking and preference settings.
* *PlayerService:* Responsible for handling user accounts, this component manages registration, authentication, and profile management. It safeguards user data while providing a personalized experience through game history tracking and preference settings.

* *Question Management:* This component interacts directly with the Wikidata service to fetch data for question generation. It processes and curates content to produce relevant, challenging questions for the game, thereby ensuring a varied and educational experience.
* *QuestionService:* This component interacts directly with the Wikidata service to fetch data for question generation. It processes and curates content to produce relevant, challenging questions for the game, thereby ensuring a varied and educational experience.

* *API Management:* Serving as the gateway for external developers, this component exposes a set of RESTful APIs that allow access to player information and question data. It handles request processing, authentication, and data delivery, facilitating third-party integrations and extensions of the WIQ platform.
* *RestApiService:* Serving as the gateway for external developers, this component exposes a set of RESTful APIs that allow access to player information and question data. It handles request processing, authentication, and data delivery, facilitating third-party integrations and extensions of the WIQ platform.


[plantuml,"level2",png]
Expand All @@ -79,10 +79,10 @@ For Level 2 of the Building Block View, the WIQ (QuestionGame) system is further
!theme plain

package "WIQ QuestionGame" {
component "[Game Logic]" as Logic
component "[User Account\nManagement]" as UserMgmt
component "[Question\nManagement]" as QuestMgmt
component "[API\nManagement]" as APIMgmt
component "[GameSession\nService]" as Logic
component "[PlayerService]" as UserMgmt
component "[QuestionService]" as QuestMgmt
component "[RestApi\nService]" as APIMgmt

UserMgmt -[hidden]-> Logic : <<uses>>
QuestMgmt -[hidden]-> Logic : <<uses>>
Expand Down
137 changes: 137 additions & 0 deletions docs/src/13_question_generation_strategy.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
ifndef::imagesdir[:imagesdir: ../images]

[[section-question-generation-strategy]]
== Question Generation Strategy

The generation of questions in our application is handled through a combination of classes and interfaces, primarily QuestionGeneratorV2 and QuestionGeneratorService.

=== Question templates

The two classes mentioned before use a JSON file that stores the question templates. These templates are used to generalize the question generation process. The JSON file is structured as follows:

==== JSON Structure

The JSON has the following structure:

- `language_placeholder`, `question_placeholder`, and `answer_placeholder` are strings used as placeholders for the language, question, and answer, respectively.

- `categories` is an array containing objects representing different categories of questions.

Each category object has two properties:

- `name`: The name of the category.
- `questions`: An array of objects representing questions within that category.

Each question object has the following properties:

- `type`: The type of question.
- `statements`: An array of objects representing statements in different languages for the question. Each object has two properties: `language` and `statement`.
- `question`: The property queried to generate the question.
- `answer`: The property queried to obtain the answer.
- `sparqlQuery`: The SPARQL query used to retrieve data for generating the question and answer.

==== Compact Example of JSON Hierarchy

[source,json]
----
{
"language_placeholder": "[LANGUAGE]",
"question_placeholder": "[QUESTION]",
"answer_placeholder": "[ANSWER]",
"categories": [
{
"name": "Geography",
"questions": [
{
"type": "capital",
"statements": [
{
"language": "es",
"statement": "¿Cuál es la capital de [QUESTION]?"
},
{
"language": "en",
"statement": "What is the capital of [QUESTION]?"
},
{
"language": "fr",
"statement": "Quelle est la capitale de [QUESTION]?"
}
],
"question": "countryLabel",
"answer": "capitalLabel",
"sparqlQuery": "..."
},
{
"type": "currency",
"statements": [
{
"language": "es",
"statement": "¿Cuál es la moneda de [QUESTION]?"
},
{
"language": "en",
"statement": "What is the currency of [QUESTION]?"
},
{
"language": "fr",
"statement": "Quelle est la monnaie de [QUESTION]?"
}
],
"question": "countryLabel",
"answer": "currencyLabel",
"sparqlQuery": "..."
}
]
},
{
"name": "Science",
"questions": [
{
"type": "element",
"statements": [
{
"language": "es",
"statement": "¿Cuál es el símbolo químico del [QUESTION]?"
},
{
"language": "en",
"statement": "What is the chemical symbol of [QUESTION]?"
},
{
"language": "fr",
"statement": "Quel est le symbole chimique du [QUESTION]?"
}
],
"question": "elementLabel",
"answer": "symbol",
"sparqlQuery": "..."
}
]
}
]
}
----

=== Example of a query
Here's an example of how you could use this JSON structure to query information:

To execute a query you just need to build a SPARQL query that retrieves the data you need. For example, to get the capital of a country, you could use the following query:
[source, SPARQL]
----
select distinct ?country ?countryLabel ?capital ?capitalLabel where {
?country wdt:P31 wd:Q6256 .
?capital wdt:P31 wd:Q5119 .
?country wdt:P36 ?capital .
?country rdfs:label ?countryLabel .
?capital rdfs:label ?capitalLabel .
FILTER NOT EXISTS {?country wdt:P31 wd:Q3024240} .
FILTER(LANG(?countryLabel)="es" && LANG(?capitalLabel)="es")
}
----
Once you have a query the next step is to add it to thr JSON file. Following the previous example, you should start declaring a new object inside the `questions` array of the `Geography` category. You should fill the `type`, `statements`, `question`, `answer`, and `sparqlQuery` properties with the appropriate values. For the `type` field you could add the value `"capital"`, for the `statements` array you could add the statements in different languages also adding to them the placeholder that you used in the `question_placeholder` field. For the `question` field you should add the value `"countryLabel"`, for the `answer` you should add the value `"capitalLabel"`. For the `sparqlQuery` field you should replace in your original query every instance of `"countryLabel"` with the value of `question_placeholder` and `"capitalLabel"` with the value of `answer_placeholder`. The final object should look like the one showed in the JSON hierarchy example.

By following this approach, you can dynamically generate a wide variety of questions based on the structured data stored in your JSON file. This allows for flexibility and scalability in your question generation process.

=== Question Generation Process
Once we have the JSON file with the question templates, we can start generating questions. Each time the application starts the QuestionGeneratorService class reads the JSON file and stores the question templates in memory. This way, the application can generate questions without needing to read the file each time. These templates are stored in a synchronized stack, which allows for thread-safe access to the templates. When the application starts after reading the JSON file and storing the templates the QuestionGeneratorService class deletes all the questions that are stored in the database. After deleting the questions, the QuestionGeneratorService starts a cycle that generates all the questions in all the 3 main languages of the app for a specific type of question each two and a half minutes. This cycle is repeated until all the question types are generated. After this every 24 hours the cycle will start again with the parsing of the JSON, filling the Stack, emptying the database and generating the questions. All this process can be forced by an Admin user through the Admin panel in the app where an Admin can change the JSON (which will lead to the restart of the question generation process) or delete all questions.
13 changes: 13 additions & 0 deletions docs/src/14_testing.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ifndef::imagesdir[:imagesdir: ../images]

[[section-testing]]
== Testing

To be able to achieve continuous delivery, we need to have a good test coverage. We need to have a good test coverage to be able to refactor the code without breaking it, to be able to deliver the software with confidence and to be able to deliver the software with quality.

=== Unit Test
In our project, we have implemented unit tests for various components of the application. The tests are written in Java and use the JUnit 5 framework for testing. We also use the Spring Boot Test framework for testing Spring Boot applications, which provides utilities and annotations to test the application in a way that is very close to its actual runtime behavior. The tests are located in the src/test/java/com/uniovi directory. The main test class is Wiq_UnitTests.java, which contains tests for various services and repositories in our application.

=== Integration Test (E2E)

=== Load Test
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
12 changes: 12 additions & 0 deletions prometheus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
global:
scrape_interval: 2s
scrape_timeout: 1s

scrape_configs:
- job_name: 'spring-application'
scrape_interval: 2s
scrape_timeout: 1s
metrics_path: '/actuator/prometheus'
scheme: https
static_configs:
- targets: [ 'wikigame.es:443' ]
2 changes: 2 additions & 0 deletions src/main/java/com/uniovi/WiqEs04bApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;

@SpringBootApplication
@EnableScheduling
public class WiqEs04bApplication {
public static void main(String[] args) {
SpringApplication.run(WiqEs04bApplication.class, args);
Expand Down
24 changes: 0 additions & 24 deletions src/main/java/com/uniovi/components/MultipleQuestionGenerator.java

This file was deleted.

This file was deleted.

Loading
Loading