[jboss-cvs] JBossAS SVN: r69214 - trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jan 22 15:41:29 EST 2008


Author: bstansberry at jboss.com
Date: 2008-01-22 15:41:28 -0500 (Tue, 22 Jan 2008)
New Revision: 69214

Modified:
   trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/SessionCountUnitTestCase.java
Log:
Properly segregate passivation directories
Ensure caches get cleaned up if they are instantiated

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/SessionCountUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/SessionCountUnitTestCase.java	2008-01-22 20:40:38 UTC (rev 69213)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/SessionCountUnitTestCase.java	2008-01-22 20:41:28 UTC (rev 69214)
@@ -159,9 +159,10 @@
    {
       log.info("Enter testStandaloneMaxSessions");
       
-      JBossCacheManager jbcm = SessionTestUtil.createManager("test" + ++testCount, 5, true, null, false, false, null);
-      caches.add(jbcm.getPojoCache());
+      ++testCount;
       
+      JBossCacheManager jbcm = SessionTestUtil.createManager("test" + testCount, 5, true, null, false, false, null, caches);
+       
       JBossWebMetaData webMetaData = createWebMetaData(2);
       jbcm.init("test.war", webMetaData);
       
@@ -201,9 +202,10 @@
    {
       log.info("Enter testStandaloneMaxSessionsWithMaxIdle");
       
-      JBossCacheManager jbcm = SessionTestUtil.createManager("test" + ++testCount, 5, true, tempDir, false, false, null);
-      caches.add(jbcm.getPojoCache());
-      
+      ++testCount;
+      String passDir = getPassivationDir(testCount, 1);
+      JBossCacheManager jbcm = SessionTestUtil.createManager("test" + testCount, 5, true, passDir, false, false, null, caches);
+       
       JBossWebMetaData webMetaData = createWebMetaData(1, true, 1, -1);
       jbcm.init("test.war", webMetaData);
       
@@ -254,8 +256,9 @@
    {
       log.info("Enter testStandaloneMaxSessionsWithMinIdle");
       
-      JBossCacheManager jbcm = SessionTestUtil.createManager("test" + ++testCount, 5, true, tempDir, false, false, null);
-      caches.add(jbcm.getPojoCache());
+      ++testCount;
+      String passDir = getPassivationDir(testCount, 1);
+      JBossCacheManager jbcm = SessionTestUtil.createManager("test" + testCount, 5, true, passDir, false, false, null, caches);
       
       JBossWebMetaData webMetaData = createWebMetaData(1, true, 3, 1);
       jbcm.init("test.war", webMetaData);
@@ -306,8 +309,8 @@
    {
       log.info("Enter testReplicatedMaxSessions");
       
-      JBossCacheManager jbcm0 = SessionTestUtil.createManager("test" + ++testCount, 1, false, null, false, false, null);
-      caches.add(jbcm0.getPojoCache());
+      ++testCount;
+      JBossCacheManager jbcm0 = SessionTestUtil.createManager("test" + testCount, 1, false, null, false, false, null, caches);
       
       JBossWebMetaData webMetaData = createWebMetaData(1);
       jbcm0.init("test.war", webMetaData);
@@ -318,8 +321,7 @@
       assertEquals("Correct max active count", 1, jbcm0.getMaxActiveAllowed());
       assertEquals("Correct max inactive interval", 1, jbcm0.getMaxInactiveInterval());
       
-      JBossCacheManager jbcm1 = SessionTestUtil.createManager("test" + testCount, 1, false, null, false, false, null);
-      caches.add(jbcm1.getPojoCache());
+      JBossCacheManager jbcm1 = SessionTestUtil.createManager("test" + testCount, 1, false, null, false, false, null, caches);
       
       jbcm1.init("test.war", webMetaData);
       
@@ -362,8 +364,9 @@
    {
       log.info("Enter testReplicatedMaxSessionsWithMaxIdle");
       
-      JBossCacheManager jbcm0 = SessionTestUtil.createManager("test" + ++testCount, 1, false, tempDir, false, false, null);
-      caches.add(jbcm0.getPojoCache());
+      ++testCount;
+      String passDir = getPassivationDir(testCount, 1);
+      JBossCacheManager jbcm0 = SessionTestUtil.createManager("test" + testCount, 1, false, passDir, false, false, null, caches);
       
       JBossWebMetaData webMetaData = createWebMetaData(1, true, 1, -1);
       jbcm0.init("test.war", webMetaData);
@@ -375,8 +378,8 @@
       assertEquals("Correct max idle time", 1, jbcm0.getPassivationMaxIdleTime());
       assertEquals("Correct min idle time", -1, jbcm0.getPassivationMinIdleTime());
       
-      JBossCacheManager jbcm1 = SessionTestUtil.createManager("test" + testCount, 1, false, tempDir, false, false, null);
-      caches.add(jbcm1.getPojoCache());
+      passDir = getPassivationDir(testCount, 2);
+      JBossCacheManager jbcm1 = SessionTestUtil.createManager("test" + testCount, 1, false, passDir, false, false, null, caches);
       
       jbcm1.init("test.war", webMetaData);
       
@@ -420,8 +423,9 @@
    {
       log.info("Enter testReplicatedMaxSessionsWithMinIdle");
       
-      JBossCacheManager jbcm0 = SessionTestUtil.createManager("test" + ++testCount, 1, false, tempDir, false, false, null);
-      caches.add(jbcm0.getPojoCache());
+      ++testCount;
+      String passDir = getPassivationDir(testCount, 1);
+      JBossCacheManager jbcm0 = SessionTestUtil.createManager("test" + testCount, 1, false, passDir, false, false, null, caches);
       
       JBossWebMetaData webMetaData = createWebMetaData(1, true, 3, 1);
       jbcm0.init("test.war", webMetaData);
@@ -433,8 +437,8 @@
       assertEquals("Correct max idle time", 3, jbcm0.getPassivationMaxIdleTime());
       assertEquals("Correct min idle time", 1, jbcm0.getPassivationMinIdleTime());
       
-      JBossCacheManager jbcm1 = SessionTestUtil.createManager("test" + testCount, 1, false, tempDir, false, false, null);
-      caches.add(jbcm1.getPojoCache());
+      passDir = getPassivationDir(testCount, 2);
+      JBossCacheManager jbcm1 = SessionTestUtil.createManager("test" + testCount, 1, false, passDir, false, false, null, caches);
       
       jbcm1.init("test.war", webMetaData);
       
@@ -479,8 +483,9 @@
    {
       log.info("Enter testTotalReplication");
       
-      JBossCacheManager jbcm0 = SessionTestUtil.createManager("test" + ++testCount, 1, false, tempDir, true, false, null);
-      caches.add(jbcm0.getPojoCache());
+      ++testCount;
+      String passDir = getPassivationDir(testCount, 1);
+      JBossCacheManager jbcm0 = SessionTestUtil.createManager("test" + testCount, 1, false, passDir, true, false, null, caches);
       
       JBossWebMetaData webMetaData = createWebMetaData(1, true, 3, 1);
       jbcm0.init("test.war", webMetaData);
@@ -492,8 +497,8 @@
       assertEquals("Correct max idle time", 3, jbcm0.getPassivationMaxIdleTime());
       assertEquals("Correct min idle time", 1, jbcm0.getPassivationMinIdleTime());
       
-      JBossCacheManager jbcm1 = SessionTestUtil.createManager("test" + testCount, 1, false, tempDir, true, false, null);
-      caches.add(jbcm1.getPojoCache());
+      passDir = getPassivationDir(testCount, 2);
+      JBossCacheManager jbcm1 = SessionTestUtil.createManager("test" + testCount, 1, false, passDir, true, false, null, caches);
       
       jbcm1.init("test.war", webMetaData);
       
@@ -538,8 +543,9 @@
    {
       log.info("Enter testRegionBasedMarshalling");
       
-      JBossCacheManager jbcm0 = SessionTestUtil.createManager("test" + ++testCount, 1, false, tempDir, false, true, null);
-      caches.add(jbcm0.getPojoCache());
+      ++testCount;
+      String passDir = getPassivationDir(testCount, 1);
+      JBossCacheManager jbcm0 = SessionTestUtil.createManager("test" + testCount, 1, false, passDir, false, true, null, caches);
       
       JBossWebMetaData webMetaData = createWebMetaData(1, true, 3, 1);
       jbcm0.init("test.war", webMetaData);
@@ -551,8 +557,8 @@
       assertEquals("Correct max idle time", 3, jbcm0.getPassivationMaxIdleTime());
       assertEquals("Correct min idle time", 1, jbcm0.getPassivationMinIdleTime());
       
-      JBossCacheManager jbcm1 = SessionTestUtil.createManager("test" + testCount, 1, false, tempDir, false, true, null);
-      caches.add(jbcm1.getPojoCache());
+      passDir = getPassivationDir(testCount, 2);
+      JBossCacheManager jbcm1 = SessionTestUtil.createManager("test" + testCount, 1, false, passDir, false, true, null, caches);
       
       jbcm1.init("test.war", webMetaData);
       
@@ -597,8 +603,9 @@
    {
       log.info("Enter testTotalReplicationWithMarshalling");
       
-      JBossCacheManager jbcm0 = SessionTestUtil.createManager("test" + ++testCount, 1, false, tempDir, true, true, null);
-      caches.add(jbcm0.getPojoCache());
+      ++testCount;
+      String passDir = getPassivationDir(testCount, 1);
+      JBossCacheManager jbcm0 = SessionTestUtil.createManager("test" + testCount, 1, false, passDir, true, true, null, caches);
       
       JBossWebMetaData webMetaData = createWebMetaData(1, true, 3, 1);
       jbcm0.init("test.war", webMetaData);
@@ -610,8 +617,8 @@
       assertEquals("Correct max idle time", 3, jbcm0.getPassivationMaxIdleTime());
       assertEquals("Correct min idle time", 1, jbcm0.getPassivationMinIdleTime());
       
-      JBossCacheManager jbcm1 = SessionTestUtil.createManager("test" + testCount, 1, false, tempDir, true, true, null);
-      caches.add(jbcm1.getPojoCache());
+      passDir = getPassivationDir(testCount, 2);
+      JBossCacheManager jbcm1 = SessionTestUtil.createManager("test" + testCount, 1, false, passDir, true, true, null, caches);
       
       jbcm1.init("test.war", webMetaData);
       
@@ -669,9 +676,10 @@
    private void standaloneWarRedeployTest(boolean restartCache)
          throws Exception
    {
-      JBossCacheManager jbcm = SessionTestUtil.createManager("test" + ++testCount, 300, true, tempDir, false, false, null);
+      ++testCount;
+      String passDir = getPassivationDir(testCount, 1);
+      JBossCacheManager jbcm = SessionTestUtil.createManager("test" + testCount, 300, true, passDir, false, false, null, caches);
       PojoCache cache = jbcm.getPojoCache();
-      caches.add(cache);
       
       JBossWebMetaData webMetaData = createWebMetaData(2, true, 3, 1);
       jbcm.init("test.war", webMetaData);
@@ -718,8 +726,8 @@
          cache.destroy();
          caches.remove(cache);
          
-         jbcm = SessionTestUtil.createManager("test" + testCount, 5, true, tempDir, false, false, null);
-         caches.add(jbcm.getPojoCache());
+         passDir = getPassivationDir(testCount, 1);
+         jbcm = SessionTestUtil.createManager("test" + testCount, 5, true, passDir, false, false, null, caches);
       }
       else
       {
@@ -767,9 +775,10 @@
                                           boolean marshalling)
          throws Exception
    {
-      JBossCacheManager jbcm = SessionTestUtil.createManager("test" + ++testCount, 300, false, tempDir, totalReplication, marshalling, null);
+      ++testCount;
+      String passDir = getPassivationDir(testCount, 1);
+      JBossCacheManager jbcm = SessionTestUtil.createManager("test" + testCount, 300, false, passDir, totalReplication, marshalling, null, caches);
       PojoCache cache = jbcm.getPojoCache();
-      caches.add(cache);
       
       JBossWebMetaData webMetaData = createWebMetaData(2, true, 3, 1);
       jbcm.init("test.war", webMetaData);
@@ -781,9 +790,9 @@
       assertEquals("Correct max idle time", 3, jbcm.getPassivationMaxIdleTime());
       assertEquals("Correct min idle time", 1, jbcm.getPassivationMinIdleTime());
       
-      JBossCacheManager jbcm1 = SessionTestUtil.createManager("test" + testCount, 300, false, tempDir, totalReplication, marshalling, null);
+      passDir = getPassivationDir(testCount, 2);
+      JBossCacheManager jbcm1 = SessionTestUtil.createManager("test" + testCount, 300, false, passDir, totalReplication, marshalling, null, caches);
       PojoCache cache1 = jbcm1.getPojoCache();
-      caches.add(cache1);
       
       jbcm1.init("test.war", webMetaData);
       
@@ -850,8 +859,8 @@
          cache.destroy();
          caches.remove(cache);
          
-         jbcm = SessionTestUtil.createManager("test" + testCount, 300, false, tempDir, totalReplication, marshalling, null);
-         caches.add(jbcm.getPojoCache());
+         passDir = getPassivationDir(testCount, 1);
+         jbcm = SessionTestUtil.createManager("test" + testCount, 300, false, passDir, totalReplication, marshalling, null, caches);
       }
       else
       {
@@ -993,4 +1002,9 @@
       }
       catch (InterruptedException e) {}
    }
+   
+   private String getPassivationDir(long testCount, int cacheCount)
+   {
+      return tempDir + File.separatorChar + testCount + File.separatorChar + cacheCount;
+   }
 }




More information about the jboss-cvs-commits mailing list