Skip to content

Commit ca411ab

Browse files
author
zell92
committed
aggiunto client rest
1 parent 3a55424 commit ca411ab

File tree

4 files changed

+126
-3
lines changed

4 files changed

+126
-3
lines changed

Diff for: ClientREST.bat

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
@setlocal enableextensions enabledelayedexpansion
2+
@echo Client Applicazione REST
3+
@SET PRODUCT_SERVICE_URL=http://192.168.33.10:8080/AutoRest
4+
@pause
5+
:loop
6+
@cls
7+
@echo Effettua una scelta:
8+
@echo 1-Lista case automobilistiche
9+
@echo 2-Lista automobili
10+
@echo 3-Lista automobili di una casa automobilistica
11+
@echo 4-Dati automobile
12+
@echo 5-Dati casa automobilistica
13+
@echo 6-Inserisci casa automobilistica
14+
@echo 7-Inserisci automobile
15+
@echo 8-Elimina casa automobilistica
16+
@echo 9-Elimina automobile
17+
@echo 0-Esci
18+
19+
20+
@SET /P SCELTA=
21+
22+
@if %SCELTA% == 1 (@curl -s -H "Accept:application/json" -get "%PRODUCT_SERVICE_URL%/carmakers")
23+
24+
@if %SCELTA% == 2 (@curl -s -H "Accept:application/json" -get "%PRODUCT_SERVICE_URL%/cars")
25+
26+
@if %SCELTA% == 3 (
27+
@echo Inserisci l'ID della casa automobilistica:
28+
@SET /P ID=
29+
@curl -s -H "Accept:application/json" -get "%PRODUCT_SERVICE_URL%/cars/!ID!"
30+
@SET ID=
31+
)
32+
33+
@if %SCELTA% == 4 (
34+
@echo Inserisci l'ID della macchina:
35+
@SET /P ID=
36+
@curl -s -H "Accept:application/json" -get "%PRODUCT_SERVICE_URL%/car/!ID!"
37+
@SET ID=
38+
)
39+
40+
@if %SCELTA% == 5 (
41+
@echo Inserisci l'ID della casa automobilistica:
42+
@SET /P ID=
43+
@curl -s -H "Accept:application/json" -get "%PRODUCT_SERVICE_URL%/carmaker/!ID!"
44+
@SET ID=
45+
)
46+
47+
48+
@if %SCELTA% == 6 (
49+
50+
@echo Inserisci il nome della casa automobilistica:
51+
@SET /P NAME=
52+
@curl -s -H "Accept:application/json" --data "name=!NAME!" -post "%PRODUCT_SERVICE_URL%/carmakers"
53+
@SET NAME=
54+
)
55+
56+
57+
@if %SCELTA% == 7 (
58+
@echo Inserisci il modello dell'auto:
59+
@SET /P MODEL=
60+
@echo Inserisci il prezzo:
61+
@SET /P PRICE=
62+
@echo Inserisci il codice prodotto:
63+
@SET /P CODE=
64+
@echo Inserisci una descrizione dell'auto:
65+
@SET /P DESCRIPTION=
66+
@echo Inserisci l'ID della casa automobilistica:
67+
@SET /P CARMAKERID=
68+
69+
@curl -s -H "Accept:application/json" --data "model=!MODEL!&price=!PRICE!&code=!CODE!&description=!DESCRIPTION!&carmakerId=!CARMAKERID!" -post "%PRODUCT_SERVICE_URL%/cars"
70+
71+
@echo Auto inserita:
72+
@echo modello:!MODEL!
73+
@echo prezzo:!PRICE!
74+
@echo codice:!CODE!
75+
@echo descrizione:!DESCRIPTION!
76+
@echo Id casa automobilistica:!CARMAKERID!
77+
78+
79+
@SET MODEL=
80+
@SET PRICE=
81+
@SET DESCRIPTION=
82+
@SET CODE=
83+
@SET CARMAKERID=
84+
)
85+
86+
@if %SCELTA% == 8 (
87+
88+
@echo Inserisci l'id della casa automobilistica che vuoi eliminare:
89+
@SET /P ID=
90+
@echo %PRODUCT_SERVICE_URL%/carmaker/!ID!
91+
@curl -s -H "Accept:application/json" -X DELETE "%PRODUCT_SERVICE_URL%/carmaker/!ID!"
92+
@SET ID=
93+
)
94+
95+
@if %SCELTA% == 9 (
96+
97+
@echo Inserisci l'id dell'auto che vuoi eliminare:
98+
@SET /P ID=
99+
@curl -s -H "Accept:application/json" -X DELETE "%PRODUCT_SERVICE_URL%/car/!ID!"
100+
@SET ID=
101+
)
102+
103+
104+
@if %SCELTA% == 0 (@goto end)
105+
@echo.
106+
@pause
107+
@goto loop
108+
:end
109+
@endlocal

Diff for: README.md

+14
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,17 @@ APPLICATION AUTO
2525

2626
You can find the application used in this project at this link:
2727
[click here](https://github.com/zell92/Auto)
28+
29+
30+
APPLICATION AUTO-REST
31+
===========
32+
You can find the application used in this project (REST VERSION) at this link:
33+
[click here](https://github.com/zell92/AutoRest)
34+
35+
36+
HOW TO USE APPLICATION AUTO-REST
37+
===========
38+
39+
* Run `vagrant up` or launch `./startup.bat` to start up the two virtual machines
40+
* Launch `ClientREST.bat` to start up the two virtual machines
41+
* You **must** download and install cUrl on your windows machine.

Diff for: suspend.bat renamed to restart.bat

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
@echo off
22

3-
echo Suspending Vagrant VM...
4-
vagrant suspend
3+
echo Restarting Vagrant VM...
4+
vagrant reload
55

66
if errorlevel 1 (
77
echo FAILURE! Vagrant VM unresponsive...
88
) else (
9-
echo Vagrant is suspended!
9+
echo Vagrant is restarted!
1010
)
1111

1212
echo Press a key to continue...

Diff for: webapps/AutoRest.war

-236 KB
Binary file not shown.

0 commit comments

Comments
 (0)