In this assignment, you'll run the application to make sure everything works correctly.
-
Open the
src
folder in VS Code.Throughout the assignment you need to execute all steps in the same instance of VS Code.
-
Open the terminal window in VS Code.
You can do this by using the hotkey
Ctrl-`
(Windows) orShift-Ctrl-`
(macOS). -
Make sure the current folder is
src/VehicleRegistrationService
. -
Start the service using
dotnet run
.
If you receive an error here, please double-check whether or not you have installed all the prerequisites for the workshop!
Now you can test whether you can call the VehicleRegistrationService. You can do this using a browser, CURL or some other HTTP client. But there is a convenient way of testing RESTful APIs directly from VS Code (this uses the REST Client extension VS Code):
-
Open the file
src/VehicleRegistrationService/test.http
in VS Code. The request in this file simulates retrieving the vehicle- and owner information for a certain license-number. -
Click on
Execute request
in the file to send a request to the API: -
The response of the request will be shown in a separate window on the right. It should be a response with HTTP status code
200 OK
and the body should contain some random vehicle and owner-information:HTTP/1.1 200 OK Connection: close Date: Mon, 01 Mar 2021 07:15:55 GMT Content-Type: application/json; charset=utf-8 Server: Kestrel Transfer-Encoding: chunked { "vehicleId": "KZ-49-VX", "brand": "Toyota", "model": "Rav 4", "ownerName": "Angelena Fairbairn", "ownerEmail": "[email protected]" }
-
Check the logging in the terminal window. It should look like this:
-
Make sure the VehicleRegistrationService service is running (result of step 1).
-
Open a new terminal window in VS Code.
You can do this by using the hotkey (
Ctrl-`
on Windows,Shift-Ctrl-`
on macOS) or clicking on the+
button in the terminal window title bar: -
Make sure the current folder is
src/FineCollectionService
. -
Start the service using
dotnet run
. -
Open the file
src/FineCollectionService/test.http
in VS Code. The request in this file simulates sending a detected speeding-violation to the FineCollectionService. -
Click on
Execute request
in the file to send a request to the API. -
The response of the request will be shown in a separate window on the right. It should be a response with HTTP status code
200 OK
and no body. -
Check the logging in the terminal window. It should look like this:
-
Make sure the VehicleRegistrationService and FineCollectionService are running (results of step 1 and 2).
-
Open a new terminal window in VS Code and make sure the current folder is
src/TrafficControlService
. -
Start the service using
dotnet run
. -
Open the
test.http
file in the project folder in VS Code. -
Click on
Execute request
for both requests in the file to send two requests to the API. -
The response of the requests will be shown in a separate window on the right. Both requests should yield a response with HTTP status code
200 OK
and no body. -
Check the logging in the terminal window. It should look like this:
-
Also inspect the logging of the FineCollectionService.
You can do this by selecting another terminal window using the dropdown in the title-bar of the terminal window:
You should see the speeding-violation being handled by the FineCollectionService:
You've tested the APIs directly by using a REST client. Now you're going to run the simulation that actually simulates cars driving on the highway. The simulation will simulate 3 entry- and exit-cameras (one for each lane).
-
Open a new terminal window in VS Code and make sure the current folder is
src/Simulation
. -
Start the service using
dotnet run
. -
In the simulation window you should see something like this:
-
Also check the logging in all the other Terminal windows. You should see all entry- and exit events and any speeding-violations that were detected in the logging.
Now we know the application runs correctly. It's time to start adding Dapr to the application.
Make sure you stop all running processes and close all the terminal windows in VS Code before proceeding to the next assignment. Stopping a service or the simulation is done by pressing Ctrl-C
in the terminal window. To close the terminal window, enter the exit
command.
You can quickly close a terminal window by clicking on the trashcan icon in its title bar:
Go to assignment 2.