Added a script that illustrates the example
[demos/spring/data-jdbc] / README.sh
diff --git a/README.sh b/README.sh
new file mode 100755 (executable)
index 0000000..23bff3a
--- /dev/null
+++ b/README.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+if [ "$1" = "cleanup" ]
+then
+  docker-compose down -v
+  mvn clean
+  docker image rm juplo/data-jdbc:latest
+  exit
+fi
+
+if [[
+  $(docker image ls -q juplo/data-jdbc:latest) == "" ||
+  "$1" = "build"
+]]
+then
+  mvn package || exit
+else
+  echo "Using image existing images:"
+  docker image ls juplo/data-jdbc:latest
+fi
+
+docker-compose up -d jdbc
+
+while ! [[ $(http :8080/actuator/health 2>/dev/null | jq -r .status) == "UP" ]];
+do
+  echo "Waiting for User-Service...";
+  sleep 1;
+done
+
+
+docker-compose logs --tail=0 -f jdbc &
+
+for i in `seq 1 20`;
+do
+  echo peter$i | http :8080/users
+  echo uwe$i | http :8080/users
+  echo peter$i | http :8080/users
+  echo simone$i | http :8080/users
+  http DELETE :8080/users/franz$i
+  http DELETE :8080/users/simone$i
+  echo franz$i | http :8080/users
+  echo franz$i | http :8080/users
+  echo beate$i | http :8080/users
+  http DELETE :8080/users/uwe$i
+  sleep 1
+done;
+
+docker-compose stop