#!/bin/bash # Include Beaker environment . /usr/share/beakerlib/beakerlib.sh || exit 1 rlJournalStart rlPhaseStartSetup "Pre-Test Environment Setup" rlLog "Create tomcat instances" rlRun "tomcat-user-instance-create tomcatInstance1" 0 "Create tomcatInstance1" rlRun "tomcat-user-instance-create -p 8081 -c 8006 tomcatInstance2" 0 "Create tomcatInstance2" rlRun "tomcat-user-instance-create -p 8082 -c 8007 tomcatInstance3" 0 "Create tomcatInstance3" rlLog "Deploy apps" rlRun "cp jakartahelloworld.war tomcatInstance1/webapps" 0 "Copying sample webapp to tomcatInstance1" rlRun "cp jakartahelloworld.war tomcatInstance2/webapps" 0 "Copying sample webapp to tomcatInstance2" rlRun "cp jakartahelloworld.war tomcatInstance3/webapps" 0 "Copying sample webapp to tomcatInstance3" rlLog "Start Tomcat instances" rlRun "tomcatInstance1/bin/startup.sh" 0 "Starting tomcatInstance1" rlRun "tomcatInstance2/bin/startup.sh" 0 "Starting tomcatInstance2" rlRun "tomcatInstance3/bin/startup.sh" 0 "Starting tomcatInstance3" rlPhaseEnd rlPhaseStartTest "Verify Tomcat instances Functionality" sleep 10 rlLog "Checking Tomcats via curl" rlAssertExists tomcatInstance1/webapps/jakartahelloworld rlAssertExists tomcatInstance2/webapps/jakartahelloworld rlAssertExists tomcatInstance3/webapps/jakartahelloworld rlRun "curl http://localhost:8080/jakartahelloworld/hello | grep '

Hello, World! This is a Jakarta Servlet!'" 0 "Sample servlet of tomcatInstance1" rlRun "curl http://localhost:8081/jakartahelloworld/hello | grep '

Hello, World! This is a Jakarta Servlet!'" 0 "Sample servlet of tomcatInstance2" rlRun "curl http://localhost:8082/jakartahelloworld/hello | grep '

Hello, World! This is a Jakarta Servlet!'" 0 "Sample servlet of tomcatInstance3" rlPhaseEnd rlPhaseStartCleanup "Post-Test Teardown" rlLog "Stopping Tomcat instances" rlRun "tomcatInstance1/bin/shutdown.sh" 0 "Stopping tomcatInstance1" rlRun "tomcatInstance2/bin/shutdown.sh" 0 "Stopping tomcatInstance2" rlRun "tomcatInstance3/bin/shutdown.sh" 0 "Stopping tomcatInstance3" rlPhaseEnd rlJournalEnd rlJournalPrintText