-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-app.sh
executable file
·81 lines (67 loc) · 2.39 KB
/
test-app.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#bin/sh
if [ "$#" -ne 2 ]; then
echo "Error: This script requires exactly 2 arguments."
echo "Usage: ./test-app.sh TARGET_APP AWS_REGION"
echo "TARGET_APP in ['plain-java', 'serverless-java-container', 'spring', 'micronaut', 'quarkus'"
echo "Example: ./test-app.sh plain-java eu-west-1"
exit 1
fi
APP=$1
AWS_REGION=$2
STACK_NAME="workshop-java-lambda-optimizations"
API_GW_URL=$(aws cloudformation describe-stacks --stack-name $STACK_NAME --query "Stacks[0].Outputs[?OutputKey=='WorkshopApiUrl'].OutputValue" --region $AWS_REGION --output text)
if [ $APP == "plain-java" ]; then
curl --location --request POST $API_GW_URL'/Prod/plain-java-request-handler/users' \
--header 'Content-Type: application/json' \
--data-raw '{
"firstName": "Plain",
"lastName": "Java",
"email": "plain.java@workshop.demo"
}' | jq
exit 0
fi
if [ $APP == "serverless-java-container" ]; then
curl --location --request POST $API_GW_URL'/Prod/serverless-java-container/users' \
--header 'Content-Type: application/json' \
--data-raw '{
"firstName": "Serverless",
"lastName": "Java-Container",
"email": "serverless.java.container@workshop.demo"
}' | jq
exit 0
fi
if [ $APP == "spring" ]; then
curl --location --request POST $API_GW_URL'/Prod/springboot-function-handler/users' \
--header 'Content-Type: application/json' \
--data-raw '{
"firstName": "Springboot",
"lastName": "Function-Handler",
"email": "spring@workshop.demo"
}' | jq
exit 0
fi
if [ $APP == "micronaut" ]; then
curl --location --request POST $API_GW_URL'/Prod/micronaut-request-handler/users' \
--header 'Content-Type: application/json' \
--data-raw '{
"firstName": "Micronaut",
"lastName": "Request-Handler",
"email": "micronaut@workshop.demo"
}' | jq
exit 0
fi
if [ $APP == "quarkus" ]; then
curl --location --request POST $API_GW_URL'/Prod/quarkus-request-handler/users' \
--header 'Content-Type: application/json' \
--data-raw '{
"firstName": "Quarkus",
"lastName": "Request-Handler",
"email": "quarkus@workshop.demo"
}' | jq
exit 0
fi
echo "Error: This script requires exactly 2 arguments."
echo "Usage: ./benchmark.sh TARGET_APP AWS_REGION"
echo "TARGET_APP in ['plain-java', 'serverless-java-container', 'spring', 'micronaut', 'quarkus'"
echo "Example: ./test-app.sh plain-java eu-west-1"
exit 1