You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Esempio05testJunit5Mokito/README.md
+15Lines changed: 15 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,21 @@ Presente anche un `docker-compose` dedicato per eseguire **SonarQube** per la ve
18
18
docker compose up --build
19
19
```
20
20
Nota: il microservizio ci mette un po' a partire perchè deve aspettare che il server MySql sia partito. Per evitare il problema che il microservizio si rompa in avvio è stato fatto uno script `start_microservice.sh` che aspetta che il MySql sia attivo prima di partire.
21
+
- Comandi per il monitoraggio del database MySql
22
+
```
23
+
docker logs es05-mysql-db
24
+
docker exec -it es05-mysql-db mysql -u root -pstupendo
25
+
> SHOW DATABASES;
26
+
> USE Applicazione;
27
+
> SHOW TABLES;
28
+
```
29
+
- Comandi curl per provare il funzionamento
30
+
```
31
+
curl -X POST "http://localhost:8045/api/login?nome=alnao&password=bellissimo"
32
+
curl -X POST "http://localhost:8045/api/users" -H "Content-Type: application/json" -d '{"nome":"NuovoUtente","password":"password123" }'
33
+
curl -X GET "http://localhost:8045/api/users"
34
+
curl -X GET "http://localhost:8045/api/users/1"
35
+
```
21
36
- Comando per la distruzione di tutta l'architettura
Copy file name to clipboardExpand all lines: Esempio05testJunit5Mokito/init/start_microservice.sh
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ echo "> Avvio del microservizio Spring Boot con MySQL... ${MYSQL_DATASOURCE_HOST
6
6
# Attesa che MySQL sia pronto
7
7
echo">Attesa che MySQL sia raggiungibile..."
8
8
counter=0
9
-
until mysql -h"${MYSQL_DATASOURCE_HOST}" -P"${MYSQL_DATASOURCE_PORT}" -u"${MYSQL_DATASOURCE_USERNAME}" -p"${MYSQL_DATASOURCE_PASSWORD}" -e 'SELECT 1';do
9
+
until mysql -h"${MYSQL_DATASOURCE_HOST}" -p"${MYSQL_DATASOURCE_PORT}" -u"${MYSQL_DATASOURCE_USERNAME}" -p"${MYSQL_DATASOURCE_PASSWORD}" --ssl-verify-server-cert=0 -e 'SELECT 1';do
10
10
counter=$((counter +1))
11
11
if [ $counter-ge 10 ];then
12
12
echo"> MySQL non raggiungibile dopo 10 tentativi. Proseguo comunque..."
0 commit comments