39 lines
No EOL
1.1 KiB
Bash
Executable file
39 lines
No EOL
1.1 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# Include Beaker environment
|
|
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
|
|
|
CATALINA_BASE=/var/lib/tomcat
|
|
|
|
rlJournalStart
|
|
|
|
rlPhaseStartSetup "Pre-Test Environment Setup"
|
|
rlRun "cp javaee.war ${CATALINA_BASE}/webapps-javaee" 0 "Copying sample webapp"
|
|
rlLog "Starting Tomcat service"
|
|
rlServiceStart tomcat
|
|
rlPhaseEnd
|
|
|
|
rlPhaseStartTest "Verify Tomcat Service Functionality"
|
|
# Wait until Tomcat is ready on localhost:8080
|
|
rlLog "Waiting for Tomcat to become responsive on port 8080"
|
|
for i in {1..10}; do
|
|
if curl -s http://localhost:8080/ >/dev/null; then
|
|
rlLog "Tomcat is up after ${i} seconds"
|
|
break
|
|
else
|
|
sleep 1
|
|
fi
|
|
done
|
|
rlLog "Checking that javaee webapp exists"
|
|
rlAssertExists ${CATALINA_BASE}/webapps/javaee
|
|
rlRun "curl http://localhost:8080/javaee/hello | grep '<h1>Hello, World! This is a Javaee Servlet!'" 0 "Sample servlet"
|
|
rlPhaseEnd
|
|
|
|
rlPhaseStartCleanup "Post-Test Teardown"
|
|
rlLog "Stopping Tomcat service"
|
|
rlServiceStop tomcat
|
|
rlPhaseEnd
|
|
|
|
|
|
rlJournalEnd
|
|
rlJournalPrintText |