diff --git a/Jenkinsfile b/Jenkinsfile
index d646d1a..9cb326b 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -50,7 +50,7 @@ pipeline {
sh 'midpoint/download-midpoint'
docker.withRegistry('https://registry.hub.docker.com/', "dockerhub-$maintainer") {
def baseImg = docker.build("$maintainer/$imagename", "--no-cache midpoint/midpoint-server")
- sh './test.sh'
+ sh 'env NOCOLOR=true ./test.sh'
baseImg.push("$tag")
}
}
diff --git a/midpoint/test.sh b/midpoint/test.sh
index 96071d9..c1cf894 100755
--- a/midpoint/test.sh
+++ b/midpoint/test.sh
@@ -1,22 +1,46 @@
#!/bin/bash
-trap 'exitcode=$? ; echo "Exiting midpoint/test.sh because of an error ($exitcode) occurred" ; exit $exitcode' ERR
+trap 'exitcode=$? ; error "Exiting midpoint/test.sh because of an error ($exitcode) occurred" ; exit $exitcode' ERR
cd "$(dirname "$0")"
. ../test/common.sh
-yellow "*** Composing midPoint..."
+heading "Composing midPoint..."
docker-compose up --no-start
-green "==> midPoint composed OK"
+ok "midPoint composed OK"
echo
-yellow "*** Starting midPoint..."
+
+heading "Starting midPoint..."
docker-compose start
-green "==> midPoint started OK"
+ok "midPoint started OK"
+echo
+
+heading "Test 010: Waiting for midPoint to start..."
+test/t010-wait-for-start.sh
+ok "midPoint started"
echo
-yellow "*** Waiting for midPoint to start..."
-test/wait-for-start.sh
-green "==> midPoint started"
+
+heading "Test 100: Checking health via HTTP..."
+test/t100-check-health.sh
+ok "Health check passed"
+echo
+
+heading "Test 110: Getting user 'administrator'..."
+test/t110-get-administrator.sh
+ok "User 'administrator' retrieved and checked"
echo
-yellow "*** Checking health via HTTP..."
-(set -o pipefail ; curl -k -f https://localhost:8443/midpoint/actuator/health | tr -d '[:space:]' | grep -q "\"status\":\"UP\"")
-green "==> Health is OK"
+
+heading "Test 120: Adding and getting a user..."
+test/t120-add-get-user.sh
+ok "OK"
+echo
+
+heading "Test 200: Stop/start cycle..."
+test/t200-stop-start.sh
+ok "OK"
+echo
+
+#heading "Test 300: Checking repository preservation across compose down/up..."
+#test/t300-repository-preservation.sh
+#ok "OK"
+#echo
diff --git a/midpoint/test/wait-for-start.sh b/midpoint/test/t010-wait-for-start.sh
similarity index 100%
rename from midpoint/test/wait-for-start.sh
rename to midpoint/test/t010-wait-for-start.sh
diff --git a/midpoint/test/t100-check-health.sh b/midpoint/test/t100-check-health.sh
new file mode 100755
index 0000000..c6e864c
--- /dev/null
+++ b/midpoint/test/t100-check-health.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+set -o pipefail ; curl -k -f https://localhost:8443/midpoint/actuator/health | tr -d '[:space:]' | grep -q "\"status\":\"UP\""
diff --git a/midpoint/test/t110-get-administrator.sh b/midpoint/test/t110-get-administrator.sh
new file mode 100755
index 0000000..43b8af9
--- /dev/null
+++ b/midpoint/test/t110-get-administrator.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+curl -k --user administrator:5ecr3t -H "Content-Type: application/xml" -X GET "https://localhost:8443/midpoint/ws/rest/users/00000000-0000-0000-0000-000000000002" >/tmp/admin.xml
+grep -q "administrator"
+ test120
+
+EOF
+echo "OK"
+
+echo "Searching for user 'test120'..."
+curl -k --user administrator:5ecr3t -H "Content-Type: application/xml" -X POST "https://localhost:8443/midpoint/ws/rest/users/search" -d @- << EOF >/tmp/test120.xml
+
+
+
+ name
+ test120
+
+
+
+EOF
+echo "OK"
+
+grep -q "test120" &1 | grep "ERROR Shibboleth.Listener : failed socket call (bind), result (98): Address already in use") && yellow "=== Address already in use! ===" && docker-compose down && docker-compose up --no-start && docker-compose start
+
+echo
+echo "Getting user 'administrator'..."
+test/t110-get-administrator.sh
diff --git a/midpoint/test/t300-repository-preservation.sh b/midpoint/test/t300-repository-preservation.sh
new file mode 100755
index 0000000..92403d8
--- /dev/null
+++ b/midpoint/test/t300-repository-preservation.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+USER=test300
+trap 'exitcode=$? ; error "Exiting because of an error ($exitcode) occurred" ; exit $exitcode' ERR
+. ../test/common.sh
+
+echo "Adding user '${USER}'..."
+curl -k --user administrator:5ecr3t -H "Content-Type: application/xml" -X POST "https://localhost:8443/midpoint/ws/rest/users" -d @- << EOF
+
+ ${USER}
+
+EOF
+echo "OK"
+
+echo "Searching for user '${USER}'..."
+curl -k --user administrator:5ecr3t -H "Content-Type: application/xml" -X POST "https://localhost:8443/midpoint/ws/rest/users/search" -d @- << EOF >/tmp/${USER}.xml
+
+
+
+ name
+ ${USER}
+
+
+
+EOF
+echo "OK"
+
+grep -q "${USER}" /tmp/${USER}.xml
+
+
+
+ name
+ ${USER}
+
+
+
+EOF
+echo "OK"
+
+grep -q "${USER}" $*"
+}
+
+function error () {
+ lred "$*"
+}
+