#!/bin/bash

echo "Run from AS root folder."
echo ""
echo "will test clustered cl leaks by deploying repeatedly"
echo ""

export SOURCE="testsuite/output/lib/cluster-clleak-nopass.war" 
export TARGET="build/target/jboss-6.0.0-SNAPSHOT/server/cluster-classloader-leak-0/deploy/cluster-clleak-nopass.war"

cp "testsuite/output/lib/classloader-leak-test.sar" "build/target/jboss-6.0.0-SNAPSHOT/server/cluster-classloader-leak-0/deploy/"

for i in {1..10000}
do
   echo "deploy loop $i"

   cp $SOURCE $TARGET

   echo "sleep 10"
   sleep 10
curl http://172.19.1.2:8080/clustered-clleak/SimpleServlet

   echo "sleep 10"
   sleep 10

   echo "undeploy by removing $TARGET"
   rm $TARGET

   echo "sleep 20"
   sleep 20

done


