Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PA165 - Airport - project
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ján Macháček
PA165 - Airport - project
Commits
bdf23410
There was an error fetching the commit references. Please try again later.
Commit
bdf23410
authored
1 year ago
by
Ján Macháček
Browse files
Options
Downloads
Patches
Plain Diff
scenario - adding report
parent
49c2ee29
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
locust-scenarios/locustfile.py
+12
-96
12 additions, 96 deletions
locust-scenarios/locustfile.py
with
12 additions
and
96 deletions
locust-scenarios/locustfile.py
+
12
−
96
View file @
bdf23410
...
...
@@ -2,102 +2,24 @@ from locust import HttpUser, task
class
Admin
(
HttpUser
):
def
on_start
(
self
):
#create airplane type - just once because creating airplane type more times would report fail due to not unique name
self
.
client
.
post
(
"
:8080/api/airplaneTypes
"
,
json
=
{
"
name
"
:
"
Práškovač 2000
"
})
self
.
client
.
post
(
"
:8080/api/countries
"
,
json
=
{
"
name
"
:
"
Slovensko
"
})
self
.
client
.
post
(
"
:8080/api/cities
"
,
json
=
{
"
name
"
:
"
Holíč
"
})
self
.
client
.
post
(
"
:8080/api/cities
"
,
json
=
{
"
name
"
:
"
Senica
"
})
self
.
client
.
post
(
"
:8080/api/cities/1/countries/1
"
,
json
=
{
"
name
"
:
"
Senica
"
})
self
.
client
.
post
(
"
:8080/api/cities/2/countries/1
"
,
json
=
{
"
name
"
:
"
Senica
"
})
#create 2 airports - just once because airport need to have unique code
self
.
client
.
post
(
"
:8080/api/airports
"
,
json
=
{
"
name
"
:
"
Trávník Holíč
"
,
"
code
"
:
"
TH
"
,
"
location
"
:
{
"
latitude
"
:
48.48440
,
"
longitude
"
:
17.9380
}
})
self
.
client
.
post
(
"
:8080/api/airports
"
,
json
=
{
"
name
"
:
"
Hlinište Senica
"
,
"
code
"
:
"
HS
"
,
"
location
"
:
{
"
latitude
"
:
48.40500
,
"
longitude
"
:
17.22000
}
})
@task
def
create_airplane
(
self
):
response
=
self
.
client
.
get
(
"
:8080/api/airplaneTypes/1
"
)
if
response
.
status_code
==
200
:
self
.
client
.
post
(
"
:8080/api/airplanes
"
,
json
=
{
"
name
"
:
"
Prášek
"
,
"
capacity
"
:
2
,
"
airplaneTypeId
"
:
1
})
@task
def
create_
steward
(
self
):
self
.
client
.
post
(
"
:8080/api/
steward
s
"
,
json
=
def
create_
airplane_type
(
self
):
self
.
client
.
post
(
"
:8080/api/
airplaneType
s
"
,
json
=
{
"
firstName
"
:
"
John
"
,
"
lastName
"
:
"
Doe
"
"
name
"
:
"
Práškovač 3000
"
})
return
@task
def
create_flight
(
self
):
self
.
client
.
post
(
"
:8080/api/flights
"
,
json
=
def
create_airplane
(
self
):
self
.
client
.
get
(
"
:8080/api/airplaneTypes
"
)
self
.
client
.
post
(
"
:8080/api/airplanes
"
,
json
=
{
"
departureTime
"
:
"
2022-12-22T12:04:04.493908908+01:00
"
,
"
arrivalTime
"
:
"
2022-12-22T12:04:04.493908908+01:00
"
"
name
"
:
"
Prášek
"
,
"
capacity
"
:
2
,
"
airplaneTypeId
"
:
1
})
@task
def
assign_steward_flight
(
self
):
response_steward
=
self
.
client
.
get
(
"
:8080/api/stewards/1
"
)
response_flight
=
self
.
client
.
get
(
"
:8080/api/flights/1
"
)
if
response_steward
.
status_code
==
200
and
response_flight
.
status_code
==
200
:
self
.
client
.
post
(
"
:8080/api/stewards/1/flights/1
"
)
self
.
client
.
delete
(
"
:8080/api/stewards/1/flights/1
"
)
@task
def
assign_airport_flight
(
self
):
response_airport1
=
self
.
client
.
get
(
"
:8080/api/airports/1
"
)
response_airport2
=
self
.
client
.
get
(
"
:8080/api/airports/2
"
)
response_flight
=
self
.
client
.
get
(
"
:8080/api/flights/1
"
)
if
response_airport1
.
status_code
==
200
and
response_flight
.
status_code
==
200
and
response_airport2
.
status_code
==
200
:
self
.
client
.
post
(
"
:8080/api/airports/1/departingFlights/1
"
)
self
.
client
.
post
(
"
:8080/api/airports/2/arrivingFlights/1
"
)
self
.
client
.
delete
(
"
:8080/api/airports/1/departingFlights/1
"
)
self
.
client
.
delete
(
"
:8080/api/airports/2/arrivingFlights/1
"
)
self
.
client
.
get
(
"
:8080/api/airplanes
"
)
class
BasicUser
(
HttpUser
):
...
...
@@ -116,9 +38,3 @@ class BasicUser(HttpUser):
@task
def
generate_airplane_report
(
self
):
self
.
client
.
get
(
"
:8085/api/reports/airplane/1
"
)
@task
def
generate_airport_report
(
self
):
self
.
client
.
get
(
"
:8085/api/reports/airport/1
"
)
@task
def
generate_flight_report
(
self
):
self
.
client
.
get
(
"
:8085/api/reports/flight/1
"
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment