. $OSPL_HOME/examples/functions

check_osplhome



stopOSPL

startOSPL

echo "=== Launching Lifecycle "

echo "=== (step 1)" 

./sac_lifecycle_sub > subResult_1.txt &
cmd_pid=$!

sleep 2
./sac_lifecycle_pub  false dispose > pubResult_1.txt

echo "=== Waiting for processes to terminate"
waitForProcessTermination $cmd_pid 30

stopOSPL

startOSPL

echo "=== (step 2)" 

./sac_lifecycle_sub > subResult_2.txt &
cmd_pid=$!

sleep 2
./sac_lifecycle_pub  false unregister > pubResult_2.txt

echo "=== Waiting for processes to terminate"
waitForProcessTermination $cmd_pid 30

stopOSPL

startOSPL

echo "=== (step 3)" 

./sac_lifecycle_sub > subResult_3.txt &
cmd_pid=$!

sleep 2
./sac_lifecycle_pub  false stoppub > pubResult_3.txt

echo "=== Waiting for processes to terminate"
waitForProcessTermination $cmd_pid 30

lifecycleCheckResult

stopOSPL
