-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
475 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/bin/sh | ||
set -x | ||
|
||
EXIT=0 | ||
|
||
# create schema | ||
curl 'http://localhost:8081/subjects/items-snapshots-value/versions' \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{ | ||
"schema": | ||
"{\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"status\",\"type\":\"string\"}],\"name\":\"Event\",\"namespace\":\"io.aklivity.example\",\"type\":\"record\"}", | ||
"schemaType": "AVRO" | ||
}' | ||
|
||
# GIVEN | ||
PORT="7114" | ||
INPUT='{"id": "123", "status": "OK"}' | ||
EXPECTED='{"id":"123","status":"OK"}' | ||
echo \# Testing http.kafka.avro.json/valid | ||
echo PORT="$PORT" | ||
echo INPUT="$INPUT" | ||
echo EXPECTED="$EXPECTED" | ||
echo | ||
|
||
# send message | ||
curl -k http://localhost:7114/items -H 'Idempotency-Key: 1' -H 'Content-Type: application/json' -d "$INPUT" | ||
|
||
# WHEN | ||
OUTPUT=$(curl -k http://localhost:$PORT/items/1) | ||
RESULT=$? | ||
echo RESULT="$RESULT" | ||
|
||
# THEN | ||
echo OUTPUT="$OUTPUT" | ||
echo EXPECTED="$EXPECTED" | ||
echo | ||
if [ "$RESULT" -eq 0 ] && [ "$OUTPUT" = "$EXPECTED" ]; then | ||
echo ✅ | ||
else | ||
echo ❌ | ||
EXIT=1 | ||
fi | ||
|
||
# GIVEN | ||
PORT="7114" | ||
INPUT='{"id": 123,"status": "OK"}' | ||
EXPECTED='404' | ||
echo \# Testing http.kafka.avro.json/invalid | ||
echo PORT="$PORT" | ||
echo INPUT="$INPUT" | ||
echo EXPECTED="$EXPECTED" | ||
echo | ||
|
||
# send message | ||
curl -k http://localhost:7114/items -H 'Idempotency-Key: 2' -H 'Content-Type: application/json' -d "$INPUT" | ||
|
||
# WHEN | ||
OUTPUT=$(curl -w "%{http_code}" http://localhost:$PORT/items/2) | ||
RESULT=$? | ||
echo RESULT="$RESULT" | ||
|
||
# THEN | ||
echo OUTPUT="$OUTPUT" | ||
echo EXPECTED="$EXPECTED" | ||
echo | ||
if [ "$RESULT" -eq 0 ] && [ "$OUTPUT" = "$EXPECTED" ]; then | ||
echo ✅ | ||
else | ||
echo ❌ | ||
EXIT=1 | ||
fi | ||
|
||
exit $EXIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/bin/sh | ||
set -x | ||
|
||
EXIT=0 | ||
|
||
# GIVEN | ||
PORT="7114" | ||
EXPECTED="[]" | ||
echo \# Testing http.kafka.cache/ | ||
echo PORT="$PORT" | ||
echo INPUT="$INPUT" | ||
echo EXPECTED="$EXPECTED" | ||
echo | ||
|
||
# WHEN | ||
OUTPUT=$(curl http://localhost:$PORT/items) | ||
RESULT=$? | ||
echo RESULT="$RESULT" | ||
|
||
# THEN | ||
echo OUTPUT="$OUTPUT" | ||
echo EXPECTED="$EXPECTED" | ||
echo | ||
if [ "$RESULT" -eq 0 ] && [ "$OUTPUT" = "$EXPECTED" ]; then | ||
echo ✅ | ||
else | ||
echo ❌ | ||
EXIT=1 | ||
fi | ||
|
||
|
||
# GIVEN | ||
PORT="7114" | ||
INPUT='{"message":"Hello World"}' | ||
EXPECTED='[{"message":"Hello World"}]' | ||
echo \# Testing http.kafka.cache/ | ||
echo PORT="$PORT" | ||
echo INPUT="$INPUT" | ||
echo EXPECTED="$EXPECTED" | ||
echo | ||
|
||
echo "$INPUT" | docker compose -p zilla-http-kafka-cache exec -T kafkacat \ | ||
kafkacat -P \ | ||
-b kafka:29092 \ | ||
-t items-snapshots \ | ||
-k "5cf7a1d5-3772-49ef-86e7-ba6f2c7d7d07" \ | ||
-H "content-type=application/json" | ||
|
||
# WHEN | ||
OUTPUT=$(curl http://localhost:$PORT/items) | ||
RESULT=$? | ||
echo RESULT="$RESULT" | ||
|
||
# THEN | ||
echo OUTPUT="$OUTPUT" | ||
echo EXPECTED="$EXPECTED" | ||
echo | ||
if [ "$RESULT" -eq 0 ] && [ "$OUTPUT" = "$EXPECTED" ]; then | ||
echo ✅ | ||
else | ||
echo ❌ | ||
EXIT=1 | ||
fi | ||
|
||
exit $EXIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/sh | ||
set -x | ||
|
||
EXIT=0 | ||
|
||
# GIVEN | ||
PORT="7114" | ||
INPUT='{"greeting":"Hello, world1"}' | ||
EXPECTED='{"greeting":"Hello, world1"}' | ||
echo \# Testing http.kafka.crud/ | ||
echo PORT="$PORT" | ||
echo INPUT="$INPUT" | ||
echo EXPECTED="$EXPECTED" | ||
echo | ||
|
||
curl -k -v -X POST http://localhost:$PORT/items -H 'Idempotency-Key: 1' -H 'Content-Type: application/json' -d "$INPUT" | ||
|
||
# WHEN | ||
OUTPUT=$(curl -k http://localhost:$PORT/items/1) | ||
RESULT=$? | ||
echo RESULT="$RESULT" | ||
|
||
# THEN | ||
echo OUTPUT="$OUTPUT" | ||
echo EXPECTED="$EXPECTED" | ||
echo | ||
if [ "$RESULT" -eq 0 ] && [ "$OUTPUT" = "$EXPECTED" ]; then | ||
echo ✅ | ||
else | ||
echo ❌ | ||
EXIT=1 | ||
fi | ||
|
||
exit $EXIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.