-
Notifications
You must be signed in to change notification settings - Fork 203
/
http_no_auth.sh
executable file
·72 lines (62 loc) · 2.59 KB
/
http_no_auth.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
#!/bin/bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
source ${DIR}/../../scripts/utils.sh
cd ../../connect/connect-http-sink/
if [ ! -f jcl-over-slf4j-2.0.7.jar ]
then
wget -q https://repo1.maven.org/maven2/org/slf4j/jcl-over-slf4j/2.0.7/jcl-over-slf4j-2.0.7.jar
fi
cd -
PLAYGROUND_ENVIRONMENT=${PLAYGROUND_ENVIRONMENT:-"plaintext"}
playground start-environment --environment "${PLAYGROUND_ENVIRONMENT}" --docker-compose-override-file "${PWD}/docker-compose.plaintext.yml"
log "Sending messages to topic http-messages"
playground topic produce -t http-messages --nb-messages 10 << 'EOF'
{
"_meta": {
"topic": "",
"key": "",
"relationships": []
},
"nested": {
"phone": "faker.phone.imei()",
"website": "faker.internet.domainName()"
},
"id": "iteration.index",
"name": "faker.internet.userName()",
"email": "faker.internet.exampleEmail()",
"phone": "faker.phone.imei()",
"website": "faker.internet.domainName()",
"city": "faker.address.city()",
"company": "faker.company.name()"
}
EOF
playground debug log-level set --package "org.apache.http" --level TRACE
log "Set webserver to reply with 200"
curl -X PUT -H "Content-Type: application/json" --data '{"errorCode": 200}' http://localhost:9006/set-response-error-code
# curl -X PUT -H "Content-Type: application/json" --data '{"delay": 2000}' http://localhost:9006/set-response-time
# curl -X PUT -H "Content-Type: application/json" --data '{"message":"Hello, World!"}' http://localhost:9006/set-response-body
log "Creating http-sink connector"
playground connector create-or-update --connector http-sink << EOF
{
"topics": "http-messages",
"tasks.max": "1",
"connector.class": "io.confluent.connect.http.HttpSinkConnector",
"key.converter": "org.apache.kafka.connect.storage.StringConverter",
"value.converter":"org.apache.kafka.connect.json.JsonConverter",
"value.converter.schemas.enable":"false",
"confluent.topic.bootstrap.servers": "broker:9092",
"confluent.topic.replication.factor": "1",
"reporter.bootstrap.servers": "broker:9092",
"reporter.error.topic.name": "error-responses",
"reporter.error.topic.replication.factor": 1,
"reporter.result.topic.name": "success-responses",
"reporter.result.topic.replication.factor": 1,
"http.api.url": "http://httpserver:9006",
"request.body.format" : "json",
"headers": "Content-Type: application/json"
}
EOF
sleep 10
log "Check the success-responses topic"
playground topic consume --topic success-responses --min-expected-messages 10 --timeout 60