annotate wildfly/execute.sh @ 1091:8f2b1a8f2a73

Apply database seeding only once and run all tests in sequence. Before many tests were run before the database was filled and thus failed on first run.
author Tom Gottfried <tom@intevation.de>
date Thu, 13 Oct 2016 21:25:51 +0200
parents 75e87b7d37c0
children
rev   line source
748
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
1 #!/bin/bash
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
2
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
3 if [ -z $JBOSS_HOME ]
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
4 then
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
5 JBOSS_HOME=/opt/jboss/wildfly
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
6 fi
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
7 JBOSS_CLI=$JBOSS_HOME/bin/jboss-cli.sh
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
8 JBOSS_MODE=${1:-"standalone"}
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
9 JBOSS_CONFIG=${2:-"$JBOSS_MODE.xml"}
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
10
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
11 function wait_for_server() {
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
12 until `$JBOSS_CLI -c "ls /deployment" &> /dev/stdout`; do
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
13 sleep 1
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
14 done
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
15 }
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
16
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
17 function wait_for_shutdown() {
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
18 until `$JBOSS_CLI -c "ls /deployment" &> /dev/stdout`; do
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
19 sleep 1
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
20 done
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
21 }
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
22
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
23 echo "=> Starting WildFly server"
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
24 $JBOSS_HOME/bin/$JBOSS_MODE.sh -c $JBOSS_CONFIG &
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
25
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
26 echo "=> Waiting for the server to boot"
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
27 wait_for_server
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
28
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
29 echo "=> Executing the commands"
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
30 $JBOSS_CLI -c --user=admin --password=secret --file=`dirname "$0"`/commands.cli
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
31
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
32 echo "=> Shutting down WildFly"
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
33 if [ "$JBOSS_MODE" = "standalone" ]; then
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
34 $JBOSS_CLI -c ":shutdown"
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
35 sleep 10
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
36 echo "=> done."
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
37 else
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
38 $JBOSS_CLI -c "/host=*:shutdown"
75e87b7d37c0 Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
39 fi
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)