portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r643159 [1/2] - in /portals/jetspeed-2/portal/trunk/components: jetspeed-capability/src/test/java/org/apache/jetspeed/capabilities/ jetspeed-cm/src/main/java/org/apache/jetspeed/ jetspeed-cm/src/main/java/org/apache/jetspeed/components/ jet...
Date Mon, 31 Mar 2008 21:30:59 GMT
Author: ate
Date: Mon Mar 31 14:30:38 2008
New Revision: 643159

URL: http://svn.apache.org/viewvc?rev=643159&view=rev
Log:
Big bang commit of fixed testcases.
These changes concern:
- handing surefire forkMode=never (which means sub module tests will not run with their working directly == to project basedir) through new base JetspeedTestCase class
- fixing many test bugs which only became visible when running multiple testcases within one JVM, like missing (or incorrect/incomplete) tearDown calls or static variable instance usages  
- managing all Spring container usage through the updated SpringComponentManager
- cleaning up several empty/useless setup/teardown methods, unused imports, etc.

Added:
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/resources/
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/resources/webapp/
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/resources/webapp/WEB-INF/
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/testdata/pages/folder2/ignore.txt   (with props)
Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-capability/src/test/java/org/apache/jetspeed/capabilities/TestCapability.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/main/java/org/apache/jetspeed/   (props changed)
    portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/   (props changed)
    portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/test/AbstractSpringTestCase.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/test/java/org/apache/jetspeed/cache/TestContentCache.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/test/java/org/apache/jetspeed/cache/general/TestCachingInterceptors.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-file-cache/pom.xml
    portals/jetspeed-2/portal/trunk/components/jetspeed-file-cache/src/test/java/org/apache/jetspeed/cache/file/TestFileCache.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-locator/pom.xml
    portals/jetspeed-2/portal/trunk/components/jetspeed-locator/src/test/java/org/apache/jetspeed/locator/TestTemplateLocator.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/PageManagerTestShared.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestCastorXmlPageManager.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestCreateUserHomePagesFromRoles.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestDatabasePageManager.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecureCastorXmlPageManager.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecureDatabasePageManager.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestTransactions.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/document/psml/TestCastorFileSystemDocumentHandler.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/   (props changed)
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/java/JETSPEED-INF/spring/test-spring.xml
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/java/org/apache/jetspeed/portalsite/TestPortalSite.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/testdata/pages/folder2/   (props changed)
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/assembly/page-manager.xml
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/aggregator/TestAggregator.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/aggregator/TestRenderer.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/cluster/TestCluster.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/state/TestNavigationalState.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/deployment/TestSimpleDeployment.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/engine/AbstractEngineTest.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestConstraintsAction.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestLayout.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/pipeline/TestPipeline.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/testhelpers/SpringEngineHelper.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/tools/pamanager/TestJetspeedPortletDescriptor.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/tools/pamanager/TestPortletDescriptor.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/tools/pamanager/TestPortletDescriptorSecurityRoles.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/userinfo/TestUserInfoManager.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/impl/   (props changed)
    portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/main/java/org/apache/jetspeed/prefs/util/test/AbstractPrefsSupportedTestCase.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/test/java/org/apache/jetspeed/prefs/TestNodePreferences.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/test/java/org/apache/jetspeed/prefs/TestPreferences.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/test/java/org/apache/jetspeed/prefs/TestPreferencesNoPropManager.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-prefs/src/test/java/org/apache/jetspeed/prefs/TestPreferencesProvider.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/pom.xml
    portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestProfiler.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/jndi/JetspeedTestJNDIComponent.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/jndi/SpringJNDIStarter.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/util/DatasourceEnabledSpringTestCase.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/util/DatasourceTestCase.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/util/RegistrySupportedTestCase.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletentity/TestPortletEntityDAO.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/AbstractRegistryTest.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/TestPortletRegistryDAO.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/TestRegistryCache.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/direct/TestRegistryDirectAll.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/direct/TestRegistryDirectPart1a.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/direct/TestRegistryDirectPart1b.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/direct/TestRegistryDirectPart2a.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-rewriter/pom.xml
    portals/jetspeed-2/portal/trunk/components/jetspeed-rewriter/src/test/java/org/apache/jetspeed/rewriter/TestNekoRewriter.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-rewriter/src/test/java/org/apache/jetspeed/rewriter/TestRewriterController.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-search/pom.xml
    portals/jetspeed-2/portal/trunk/components/jetspeed-search/src/test/java/org/apache/jetspeed/search/TestSearch.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/util/test/AbstractSecurityTestcase.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestRdbmsPolicy.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/TestUserManager.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/TestCredentialHandler.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/TestGroupSecurityHandler.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/TestPasswordCredentialProvider.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/TestRoleSecurityHandler.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/ldap/AbstractLdapTest.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/ldap/TestLdapCredentialHandler.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/ldap/TestLdapGroupSecurityHandler.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/ldap/TestLdapRoleSecurityHandler.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/ldap/TestLdapSecurityMappingHandler.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/ldap/TestLdapUserCredentialDao.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/ldap/TestLdapUserSecurityDao.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/spi/ldap/TestLdapUserSecurityHandler.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/test/java/org/apache/jetspeed/sso/TestSSOComponent.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-statistics/src/test/java/org/apache/jetspeed/audit/TestAuditActivity.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-statistics/src/test/java/org/apache/jetspeed/statistics/TestStatistics.java

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-capability/src/test/java/org/apache/jetspeed/capabilities/TestCapability.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-capability/src/test/java/org/apache/jetspeed/capabilities/TestCapability.java?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-capability/src/test/java/org/apache/jetspeed/capabilities/TestCapability.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-capability/src/test/java/org/apache/jetspeed/capabilities/TestCapability.java Mon Mar 31 14:30:38 2008
@@ -23,7 +23,6 @@
 import java.util.Set;
 
 import junit.framework.Test;
-import junit.framework.TestSuite;
 
 import org.apache.jetspeed.components.test.AbstractSpringTestCase;
 import org.apache.jetspeed.serializer.JetspeedSerializer;
@@ -54,28 +53,29 @@
     protected void setUp() throws Exception
     {
         super.setUp();
-        capabilities = (Capabilities) ctx.getBean("capabilities");
+        capabilities = (Capabilities) scm.getComponent("capabilities");
     }
 
     public static Test suite()
     {
-        // All methods starting with "test" will be executed in the test suite.
-        return new TestSuite(TestCapability.class);
+        return createFixturedTestSuite(TestCapability.class, "firstTestSetup", "lastTestTeardown");
     }
 
-    /**
-     * First test defined is used to setup the data(base)
-     * <b>DO NOT ADD TESTS ABOVE THIS ONE</b>
-     * 
-     */
-    public void testSetup() throws Exception
+    public void firstTestSetup() throws Exception
     {
-        System.out.println("testSetup");
-        JetspeedSerializer serializer = (JetspeedSerializer)ctx.getBean("serializer");
+        System.out.println("firstTestSetup");
+        JetspeedSerializer serializer = (JetspeedSerializer)scm.getComponent("serializer");
         serializer.deleteData();
-        serializer.importData("target/test-classes/j2-seed.xml");
+        serializer.importData(getBaseDir()+"target/test-classes/j2-seed.xml");
     }
 
+    public void lastTestTeardown() throws Exception
+    {
+        System.out.println("lastTestTeardown");
+        JetspeedSerializer serializer = (JetspeedSerializer)scm.getComponent("serializer");
+        serializer.deleteData();
+    }
+    
     /**
      * Tests categories
      * 
@@ -539,15 +539,5 @@
     {
         return new String[]
         { "boot/datasource.xml"};
-    }
-    /**
-     * Last test defined is used to cleanup the data(base)
-     * <b>DO NOT ADD TESTS BELOW THIS ONE</b>
-     */
-    public void testTeardown() throws Exception
-    {
-        System.out.println("testTeardown");
-        JetspeedSerializer serializer = (JetspeedSerializer)ctx.getBean("serializer");
-        serializer.deleteData();
     }
 }

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/main/java/org/apache/jetspeed/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Mar 31 14:30:38 2008
@@ -1,2 +1,2 @@
-target
+target
 surefire*.properties

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Mar 31 14:30:38 2008
@@ -1,2 +1,2 @@
-target
+target
 surefire*.properties

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/test/AbstractSpringTestCase.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/test/AbstractSpringTestCase.java?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/test/AbstractSpringTestCase.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/test/AbstractSpringTestCase.java Mon Mar 31 14:30:38 2008
@@ -16,15 +16,11 @@
  */
 package org.apache.jetspeed.components.test;
 
-import java.io.File;
 import java.util.Properties;
 
-import org.apache.jetspeed.engine.JetspeedEngineConstants;
-import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-import junit.framework.TestCase;
+import org.apache.jetspeed.components.JetspeedBeanDefinitionFilter;
+import org.apache.jetspeed.components.SpringComponentManager;
+import org.apache.jetspeed.test.JetspeedTestCase;
 
 /**
  * <p>
@@ -38,12 +34,9 @@
  * @version $Id$
  *  
  */
-public abstract class AbstractSpringTestCase extends TestCase
+public abstract class AbstractSpringTestCase extends JetspeedTestCase
 {
-    /**
-     * Provides access to the Spring ApplicationContext.
-     */
-    protected ClassPathXmlApplicationContext ctx;
+    protected SpringComponentManager scm;
 
     /**
      * setup Spring context as part of test setup
@@ -51,25 +44,8 @@
     protected void setUp() throws Exception
     {        
         super.setUp();
-        if (ctx == null)
-        {
-            String [] bootConfigurations = getBootConfigurations();
-            if (bootConfigurations != null)
-            {
-                ApplicationContext bootContext = new ClassPathXmlApplicationContext(bootConfigurations, true);
-                ctx = new ClassPathXmlApplicationContext(getConfigurations(), false, bootContext);
-            }
-            else
-            {
-                ctx = new ClassPathXmlApplicationContext(getConfigurations(), false);
-            }
-            PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
-            Properties p = getPostProcessProperties();
-            p.setProperty(JetspeedEngineConstants.APPLICATION_ROOT_KEY, System.getProperty("user.dir")+"/target/test-classes/webapp");
-            ppc.setProperties(p);
-            ctx.addBeanFactoryPostProcessor(ppc);
-            ctx.refresh();
-        }
+        scm = new SpringComponentManager(getBeanDefinitionFilter(), getBootConfigurations(), getConfigurations(), getBaseDir()+"target/test-classes/webapp", getPostProcessProperties(), false);
+        scm.start();
     }
 
     /**
@@ -77,11 +53,8 @@
      */
     protected void tearDown() throws Exception
     {        
+        scm.stop();
         super.tearDown();
-        if (ctx != null)
-        {
-            ctx.close();
-        }
     }
 
     /**
@@ -100,5 +73,10 @@
     protected Properties getPostProcessProperties()
     {
         return new Properties();
+    }
+    
+    protected JetspeedBeanDefinitionFilter getBeanDefinitionFilter()
+    {
+        return null;
     }
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/test/java/org/apache/jetspeed/cache/TestContentCache.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/test/java/org/apache/jetspeed/cache/TestContentCache.java?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/test/java/org/apache/jetspeed/cache/TestContentCache.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/test/java/org/apache/jetspeed/cache/TestContentCache.java Mon Mar 31 14:30:38 2008
@@ -16,7 +16,6 @@
  */
 package org.apache.jetspeed.cache;
 
-import java.io.CharArrayWriter;
 import java.io.PrintWriter;
 import java.security.Principal;
 import java.util.LinkedList;
@@ -27,7 +26,6 @@
 import net.sf.ehcache.CacheManager;
 
 import org.apache.jetspeed.aggregator.PortletContent;
-import org.apache.jetspeed.aggregator.PortletRenderer;
 import org.apache.jetspeed.cache.impl.EhPortletContentCacheImpl;
 import org.apache.jetspeed.cache.impl.JetspeedCacheKeyGenerator;
 import org.apache.jetspeed.mockobjects.request.MockRequestContext;

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/test/java/org/apache/jetspeed/cache/general/TestCachingInterceptors.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/test/java/org/apache/jetspeed/cache/general/TestCachingInterceptors.java?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/test/java/org/apache/jetspeed/cache/general/TestCachingInterceptors.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/test/java/org/apache/jetspeed/cache/general/TestCachingInterceptors.java Mon Mar 31 14:30:38 2008
@@ -37,8 +37,8 @@
     
     public void testInterceptors() throws Exception
     {
-        MockComponent mc = (MockComponent) ctx.getBean("mockComponent");
-        InvocationCountingCache cache = (InvocationCountingCache) ctx.getBean("systemCache");
+        MockComponent mc = (MockComponent)scm.getComponent("mockComponent");
+        InvocationCountingCache cache = (InvocationCountingCache) scm.getComponent("systemCache");
         assertNotNull(mc);
         assertNotNull(cache);
         

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-file-cache/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-file-cache/pom.xml?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-file-cache/pom.xml (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-file-cache/pom.xml Mon Mar 31 14:30:38 2008
@@ -61,6 +61,11 @@
             <artifactId>commons-lang</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>${pom.groupId}</groupId>
+            <artifactId>jetspeed-cm</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
 </project>

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-file-cache/src/test/java/org/apache/jetspeed/cache/file/TestFileCache.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-file-cache/src/test/java/org/apache/jetspeed/cache/file/TestFileCache.java?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-file-cache/src/test/java/org/apache/jetspeed/cache/file/TestFileCache.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-file-cache/src/test/java/org/apache/jetspeed/cache/file/TestFileCache.java Mon Mar 31 14:30:38 2008
@@ -24,11 +24,11 @@
 import java.util.Iterator;
 
 import junit.framework.Test;
-import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.exception.ExceptionUtils;
+import org.apache.jetspeed.test.JetspeedTestCase;
 
 
 /**
@@ -38,7 +38,7 @@
  * @version $Id$
  */
 
-public class TestFileCache extends TestCase implements FileCacheEventListener
+public class TestFileCache extends JetspeedTestCase implements FileCacheEventListener
 {    
     protected static final String TEST_DIRECTORY = "target/test-classes";
     protected static final int CACHE_SIZE = 20;
@@ -74,8 +74,8 @@
      */
     public void tearDown() throws Exception
     {
-        super.tearDown();
         removeTestFiles();
+        super.tearDown();
     }
 
      /**
@@ -85,7 +85,7 @@
 
     public void testLoadCache() throws Exception 
     {        
-        String templateFile = TEST_DIRECTORY+"/default.psml";
+        String templateFile = getBaseDir() + TEST_DIRECTORY+"/default.psml";
         try
         {
             File file = new File(templateFile);            
@@ -97,7 +97,7 @@
             // FileCache cache = new FileCache(10, 20);
 
             // load the Cache
-            File directory = new File(TEST_DIRECTORY);
+            File directory = new File(getBaseDir() + TEST_DIRECTORY);
             File[] files = directory.listFiles();
             for (int ix=0; ix < files.length; ix++)
             {
@@ -172,7 +172,7 @@
     {
         for (int ix=1; ix < 31; ix++)
         {
-            String testFile = TEST_DIRECTORY+"/testFile-" + ix + ".psml";
+            String testFile = getBaseDir()+TEST_DIRECTORY+"/testFile-" + ix + ".psml";
             FileCopy.copy(templateFile, testFile);
         }
     }
@@ -181,7 +181,7 @@
     {
         for (int ix=1; ix < 31; ix++)
         {
-            String testFile = TEST_DIRECTORY+"/testFile-" + ix + ".psml";
+            String testFile = getBaseDir()+TEST_DIRECTORY+"/testFile-" + ix + ".psml";
             File file = new File(testFile);
             if ( file.exists() )
                 file.delete();

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-locator/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-locator/pom.xml?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-locator/pom.xml (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-locator/pom.xml Mon Mar 31 14:30:38 2008
@@ -51,6 +51,14 @@
             <groupId>commons-logging</groupId>
             <artifactId>commons-logging</artifactId>
         </dependency>
+        
+        <!-- Test Dependencies -->
+        <dependency>
+            <groupId>${pom.groupId}</groupId>
+            <artifactId>jetspeed-cm</artifactId>
+            <scope>test</scope>
+        </dependency>
+        
     </dependencies>
 
 </project>

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-locator/src/test/java/org/apache/jetspeed/locator/TestTemplateLocator.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-locator/src/test/java/org/apache/jetspeed/locator/TestTemplateLocator.java?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-locator/src/test/java/org/apache/jetspeed/locator/TestTemplateLocator.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-locator/src/test/java/org/apache/jetspeed/locator/TestTemplateLocator.java Mon Mar 31 14:30:38 2008
@@ -16,11 +16,11 @@
  */
 package org.apache.jetspeed.locator;
 
-import java.io.File;
 import java.util.ArrayList;
 
+import org.apache.jetspeed.test.JetspeedTestCase;
+
 import junit.framework.Test;
-import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
 /**
@@ -29,7 +29,7 @@
  * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
  * @version $Id$
  */
-public class TestTemplateLocator extends TestCase
+public class TestTemplateLocator extends JetspeedTestCase
 {
     private JetspeedTemplateLocator templateLocator;
 
@@ -126,7 +126,7 @@
     protected void setUp() throws Exception
     {
         ArrayList roots = new ArrayList(1);
-        roots.add("target/test-classes/templates");
+        roots.add(getBaseDir()+"target/test-classes/templates");
         ArrayList classes = new ArrayList(2);
         classes.add(JetspeedTemplateDescriptor.class);
         classes.add(JetspeedLocatorDescriptor.class);

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/PageManagerTestShared.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/PageManagerTestShared.java?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/PageManagerTestShared.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/PageManagerTestShared.java Mon Mar 31 14:30:38 2008
@@ -93,13 +93,13 @@
          * @param constraintsEnabled
          * @return page manager instance
          */
-        static CastorXmlPageManager makeCastorXMLPageManager(String pagesDirName, boolean permissionsEnabled, boolean constraintsEnabled)
+        static CastorXmlPageManager makeCastorXMLPageManager(String baseDir, String pagesDirName, boolean permissionsEnabled, boolean constraintsEnabled)
             throws Exception
         {
             Map extensionsToXslt = new HashMap();
-            extensionsToXslt.put("psml","src/main/resources/stripIds.xslt");
+            extensionsToXslt.put("psml",baseDir+"src/main/resources/stripIds.xslt");
                 
-            File pagesDirFile = new File("target/testdata/" + pagesDirName);
+            File pagesDirFile = new File(baseDir+"target/testdata/" + pagesDirName);
             
             
             DirectoryXMLTransform dirHelper = new DirectoryXMLTransform(pagesDirFile,extensionsToXslt);
@@ -110,33 +110,33 @@
                         return !pathname.getName().equals("CVS") && !pathname.getName().equals(".svn") && !pathname.getName().endsWith("~");
                     }
                 };
-            dirHelper.copyFrom(new File("src/test/testdata/" + pagesDirName), noCVSorSVNorBackups);
+            dirHelper.copyFrom(new File(baseDir+"src/test/testdata/" + pagesDirName), noCVSorSVNorBackups);
             
             // copy documents under webapp/pages folder and strip fragment Ids
-            File webappDestDirFile = new File("target/testdata/" + pagesDirName+"/webapp-no-ids");
+            File webappDestDirFile = new File(baseDir+"target/testdata/" + pagesDirName+"/webapp-no-ids");
             dirHelper.setBaseDirectory(webappDestDirFile);
-            File webappPagesDirFile = new File("src/test/testdata/pages");
+            File webappPagesDirFile = new File(baseDir+"src/test/testdata/pages");
             dirHelper.copyFromAndTransform(webappPagesDirFile, noCVSorSVNorBackups);
 
             // copy documents under webapp/pages folder without transforming them
-            webappDestDirFile = new File("target/testdata/" + pagesDirName+"/webapp-ids");
+            webappDestDirFile = new File(baseDir+"target/testdata/" + pagesDirName+"/webapp-ids");
             dirHelper.setBaseDirectory(webappDestDirFile);
             dirHelper.copyFrom(webappPagesDirFile, noCVSorSVNorBackups);
 
             IdGenerator idGen = new JetspeedIdGenerator(65536,"P-","");
             FileCache cache = new FileCache(10, 12);
             
-            DocumentHandler psmlHandler = new CastorFileSystemDocumentHandler("/JETSPEED-INF/castor/page-mapping.xml", Page.DOCUMENT_TYPE, PageImpl.class, "target/testdata/" + pagesDirName, cache);
-            DocumentHandler linkHandler = new CastorFileSystemDocumentHandler("/JETSPEED-INF/castor/page-mapping.xml", Link.DOCUMENT_TYPE, LinkImpl.class, "target/testdata/" + pagesDirName, cache);
-            DocumentHandler folderMetaDataHandler = new CastorFileSystemDocumentHandler("/JETSPEED-INF/castor/page-mapping.xml", FolderMetaDataImpl.DOCUMENT_TYPE, FolderMetaDataImpl.class, "target/testdata/" + pagesDirName, cache);
-            DocumentHandler pageSecurityHandler = new CastorFileSystemDocumentHandler("/JETSPEED-INF/castor/page-mapping.xml", PageSecurityImpl.DOCUMENT_TYPE, PageSecurity.class, "target/testdata/" + pagesDirName, cache);
+            DocumentHandler psmlHandler = new CastorFileSystemDocumentHandler("/JETSPEED-INF/castor/page-mapping.xml", Page.DOCUMENT_TYPE, PageImpl.class, baseDir + "target/testdata/" + pagesDirName, cache);
+            DocumentHandler linkHandler = new CastorFileSystemDocumentHandler("/JETSPEED-INF/castor/page-mapping.xml", Link.DOCUMENT_TYPE, LinkImpl.class, baseDir + "target/testdata/" + pagesDirName, cache);
+            DocumentHandler folderMetaDataHandler = new CastorFileSystemDocumentHandler("/JETSPEED-INF/castor/page-mapping.xml", FolderMetaDataImpl.DOCUMENT_TYPE, FolderMetaDataImpl.class, baseDir + "target/testdata/" + pagesDirName, cache);
+            DocumentHandler pageSecurityHandler = new CastorFileSystemDocumentHandler("/JETSPEED-INF/castor/page-mapping.xml", PageSecurityImpl.DOCUMENT_TYPE, PageSecurity.class, baseDir + "target/testdata/" + pagesDirName, cache);
             
             DocumentHandlerFactory handlerFactory = new DocumentHandlerFactoryImpl();
             handlerFactory.registerDocumentHandler(psmlHandler);
             handlerFactory.registerDocumentHandler(linkHandler);
             handlerFactory.registerDocumentHandler(folderMetaDataHandler);
             handlerFactory.registerDocumentHandler(pageSecurityHandler);
-            FolderHandler folderHandler = new FileSystemFolderHandler("target/testdata/" + pagesDirName, handlerFactory, cache);
+            FolderHandler folderHandler = new FileSystemFolderHandler(baseDir+"target/testdata/" + pagesDirName, handlerFactory, cache);
 
             return new CastorXmlPageManager(idGen, handlerFactory, folderHandler, cache, permissionsEnabled, constraintsEnabled);
         }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestCastorXmlPageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestCastorXmlPageManager.java?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestCastorXmlPageManager.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestCastorXmlPageManager.java Mon Mar 31 14:30:38 2008
@@ -25,7 +25,6 @@
 import java.util.Map;
 
 import junit.framework.Test;
-import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
 import org.apache.commons.collections.CollectionUtils;
@@ -47,6 +46,7 @@
 import org.apache.jetspeed.om.preference.FragmentPreference;
 import org.apache.jetspeed.page.document.DocumentNotFoundException;
 import org.apache.jetspeed.page.psml.CastorXmlPageManager;
+import org.apache.jetspeed.test.JetspeedTestCase;
 
 /**
  * TestCastorXmlPageManager
@@ -55,7 +55,7 @@
  * @author <a href="rwatler@apache.org">Randy Watler</a>
  * @version $Id$
  */
-public class TestCastorXmlPageManager extends TestCase implements PageManagerTestShared 
+public class TestCastorXmlPageManager extends JetspeedTestCase implements PageManagerTestShared 
 {
     private String testPage002 = "/test002.psml";
     private String testPage003 = "/test003.psml";
@@ -75,20 +75,7 @@
     protected void setUp() throws Exception
     {
         super.setUp();
-        pageManager = Shared.makeCastorXMLPageManager("pages", false, false);
-    }
-
-    /**
-     * <p>
-     * tearDown
-     * </p>
-     * 
-     * @see junit.framework.TestCase#tearDown()
-     * @throws java.lang.Exception
-     */
-    protected void tearDown() throws Exception
-    {
-        super.tearDown();
+        pageManager = Shared.makeCastorXMLPageManager(getBaseDir(), "pages", false, false);
     }
 
     /**

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestCreateUserHomePagesFromRoles.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestCreateUserHomePagesFromRoles.java?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestCreateUserHomePagesFromRoles.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestCreateUserHomePagesFromRoles.java Mon Mar 31 14:30:38 2008
@@ -23,13 +23,13 @@
 import javax.security.auth.Subject;
 
 import junit.framework.Test;
-import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
 import org.apache.jetspeed.om.folder.Folder;
 import org.apache.jetspeed.page.psml.CastorXmlPageManager;
 import org.apache.jetspeed.security.impl.RolePrincipalImpl;
 import org.apache.jetspeed.security.impl.UserPrincipalImpl;
+import org.apache.jetspeed.test.JetspeedTestCase;
 
 /**
  * TestSecureCastorXmlPageManager
@@ -37,7 +37,7 @@
  * @author <a href="rwatler@apache.org">Randy Watler</a>
  * @version $Id$
  */
-public class TestCreateUserHomePagesFromRoles extends TestCase implements PageManagerTestShared 
+public class TestCreateUserHomePagesFromRoles extends JetspeedTestCase implements PageManagerTestShared 
 {
     protected CastorXmlPageManager pageManager;
 
@@ -49,20 +49,7 @@
     protected void setUp() throws Exception
     {
         super.setUp();
-        pageManager = Shared.makeCastorXMLPageManager("secure-pages", false, true);
-    }
-
-    /**
-     * <p>
-     * tearDown
-     * </p>
-     * 
-     * @see junit.framework.TestCase#tearDown()
-     * @throws java.lang.Exception
-     */
-    protected void tearDown() throws Exception
-    {
-        super.tearDown();
+        pageManager = Shared.makeCastorXMLPageManager(getBaseDir(), "secure-pages", false, true);
     }
 
     /**
@@ -113,7 +100,7 @@
     
     public void testCreateUserHomePagesFromRoles() throws Exception
     {
-        PageManager pageManager = Shared.makeCastorXMLPageManager("pages", false, false);         
+        PageManager pageManager = Shared.makeCastorXMLPageManager(getBaseDir(), "pages", false, false);         
 
         assertTrue("folder1 failed to create", pageManager.folderExists(FOLDER1));
         assertTrue("folder2 failed to create", pageManager.folderExists(FOLDER2));

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestDatabasePageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestDatabasePageManager.java?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestDatabasePageManager.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestDatabasePageManager.java Mon Mar 31 14:30:38 2008
@@ -41,10 +41,7 @@
 import org.apache.jetspeed.page.document.FailedToUpdateDocumentException;
 import org.apache.jetspeed.page.document.Node;
 
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
 import junit.framework.Test;
-import junit.framework.TestSuite;
 
 /**
  * TestPageXmlPersistence
@@ -53,75 +50,52 @@
  * @version $Id: $
  *          
  */
-public class TestDatabasePageManager extends DatasourceEnabledSpringTestCase implements PageManagerTestShared, PageManagerEventListener
+public class TestDatabasePageManager extends DatasourceEnabledSpringTestCase implements PageManagerTestShared
 {
-    private String deepFolderPath = "/__subsite-rootx/_user/userx/_role/rolex/_group/groupx/_mediatype/xhtml/_language/en/_country/us/_custom/customx";
-    private String deepPagePath = deepFolderPath + "/default-page.psml";
-
-    private static ClassPathXmlApplicationContext context;
-    private static boolean lastTestRun;
-
-    private static PageManager pageManager;
-
-    private static int newNodeCount;
-    private static int updatedNodeCount;
-    private static int removedNodeCount;
+    private static final String deepFolderPath = "/__subsite-rootx/_user/userx/_role/rolex/_group/groupx/_mediatype/xhtml/_language/en/_country/us/_custom/customx";
+    private static final String deepPagePath = deepFolderPath + "/default-page.psml";       
 
-    public static void main(String args[])
-    {
-        junit.awtui.TestRunner.main(new String[]
-        { TestDatabasePageManager.class.getName() });
-    }
-    
-    protected void setUp() throws Exception
+    private static class PageManagerEventListenerImpl implements PageManagerEventListener
     {
-        // reuse context between test cases below
-        // that is normally configured if null in
-        // super class setUp() implementation
-        if (context == null)
-        {
-            // new context
-            super.setUp();
-            context = ctx;
-            lastTestRun = false;
-
-            // lookup page manager in context and reset to initial state
-            pageManager = (PageManager)context.getBean("pageManager");
-            try
-            {
-                Folder removeRootFolder = pageManager.getFolder("/");
-                pageManager.removeFolder(removeRootFolder);
-                pageManager.reset();
-            }
-            catch (FolderNotFoundException e)
-            {
-            }
+        int newNodeCount;
+        int updatedNodeCount;
+        int removedNodeCount;
 
-            // setup page manager listener
-            pageManager.addListener(this);
+        /* (non-Javadoc)
+         * @see org.apache.jetspeed.page.PageManagerEventListener#newNode(org.apache.jetspeed.page.document.Node)
+         */
+        public void newNode(Node node)
+        {
+            newNodeCount++;
         }
-        else
+
+        /* (non-Javadoc)
+         * @see org.apache.jetspeed.page.PageManagerEventListener#newNode(org.apache.jetspeed.page.document.Node)
+         */
+        public void updatedNode(Node node)
         {
-            // recycle context
-            ctx = context;
-            super.setUp();
+            updatedNodeCount++;
         }
-    }
 
-    protected void tearDown() throws Exception
-    {
-        // save context for reuse
-        if (!lastTestRun)
+        /* (non-Javadoc)
+         * @see org.apache.jetspeed.page.PageManagerEventListener#newNode(org.apache.jetspeed.page.document.Node)
+         */
+        public void removedNode(Node node)
         {
-            ctx = null;
+            removedNodeCount++;
         }
-        super.tearDown();
     }
+
+    public static void main(String args[])
+    {
+        junit.awtui.TestRunner.main(new String[]
+        { TestDatabasePageManager.class.getName() });
+    }
+    
     
     public static Test suite()
     {
-        // All methods starting with "test" will be executed in the test suite.
-        return new TestSuite(TestDatabasePageManager.class);
+        return createFixturedTestSuite(TestDatabasePageManager.class, "firstTestSetup", null);
     }
     
     protected String[] getConfigurations()
@@ -130,34 +104,26 @@
         { "database-page-manager.xml", "transaction.xml" };
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.page.PageManagerEventListener#newNode(org.apache.jetspeed.page.document.Node)
-     */
-    public void newNode(Node node)
-    {
-        newNodeCount++;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.page.PageManagerEventListener#newNode(org.apache.jetspeed.page.document.Node)
-     */
-    public void updatedNode(Node node)
+    public void firstTestSetup() throws Exception
     {
-        updatedNodeCount++;
-    }
+        System.out.println("Running firstTestSetup");
+        try
+        {
+            PageManager pageManager = (PageManager)scm.getComponent("pageManager");
 
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.page.PageManagerEventListener#newNode(org.apache.jetspeed.page.document.Node)
-     */
-    public void removedNode(Node node)
-    {
-        removedNodeCount++;
+            Folder removeRootFolder = pageManager.getFolder("/");
+            pageManager.removeFolder(removeRootFolder);
+        }
+        catch (FolderNotFoundException e)
+        {
+        }
     }
-
+    
     public void testCreates() throws Exception
     {
-        // reset page manager cache
-        pageManager.reset();
+        PageManager pageManager = (PageManager)scm.getComponent("pageManager");
+        PageManagerEventListenerImpl pmel = new PageManagerEventListenerImpl();
+        pageManager.addListener(pmel);
 
         // test document and folder creation
         Folder folder = pageManager.newFolder("/");
@@ -537,12 +503,18 @@
         assertEquals(0, folder.getAll().inclusiveSubset("nomatch").size());
         assertNotNull(folder.getAll().exclusiveSubset(".*-page.psml"));
         assertEquals(3, folder.getAll().exclusiveSubset(".*-page.psml").size());
+        
+        // verify listener functionality and operation counts
+        assertEquals(22, pmel.newNodeCount);
+        assertEquals(0, pmel.updatedNodeCount);
+        assertEquals(0, pmel.removedNodeCount);
     }
 
     public void testGets() throws Exception
     {
-        // reset page manager cache
-        pageManager.reset();
+        PageManager pageManager = (PageManager)scm.getComponent("pageManager");
+        PageManagerEventListenerImpl pmel = new PageManagerEventListenerImpl();
+        pageManager.addListener(pmel);
         
         // read documents and folders from persisted store
         try
@@ -846,12 +818,18 @@
         {
             assertTrue("Folder " + deepFolderPath + " NOT FOUND", false);
         }
+        
+        // verify listener functionality and operation counts
+        assertEquals(0, pmel.newNodeCount);
+        assertEquals(0, pmel.updatedNodeCount);
+        assertEquals(0, pmel.removedNodeCount);
     }
 
     public void testUpdates() throws Exception
     {
-        // reset page manager cache
-        pageManager.reset();
+        PageManager pageManager = (PageManager)scm.getComponent("pageManager");
+        PageManagerEventListenerImpl pmel = new PageManagerEventListenerImpl();
+        pageManager.addListener(pmel);
         
         // update documents and folders in persisted store
         PageSecurity pageSecurity = pageManager.getPageSecurity();
@@ -905,12 +883,18 @@
         Page deepPage = pageManager.getPage(deepPagePath);
         deepPage.setTitle("FOLDER-UPDATED-DEEP");
         pageManager.updateFolder(folder, true);
+
+        // verify listener functionality and operation counts
+        assertEquals(0, pmel.newNodeCount);
+        assertEquals(26, pmel.updatedNodeCount);
+        assertEquals(0, pmel.removedNodeCount);
     }
 
     public void testRemoves() throws Exception
     {
-        // reset page manager cache
-        pageManager.reset();
+        PageManager pageManager = (PageManager)scm.getComponent("pageManager");
+        PageManagerEventListenerImpl pmel = new PageManagerEventListenerImpl();
+        pageManager.addListener(pmel);
         
         // remove root folder
         try
@@ -984,16 +968,9 @@
         catch (PageNotFoundException e)
         {
         }
-    }
-
-    public void testEvents() throws Exception
-    {
         // verify listener functionality and operation counts
-        assertEquals(22, newNodeCount);
-        assertEquals(26, updatedNodeCount);
-        assertEquals(22, removedNodeCount);
-
-        // last test has been run
-        lastTestRun = true;
+        assertEquals(0, pmel.newNodeCount);
+        assertEquals(0, pmel.updatedNodeCount);
+        assertEquals(22, pmel.removedNodeCount);
     }
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecureCastorXmlPageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecureCastorXmlPageManager.java?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecureCastorXmlPageManager.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecureCastorXmlPageManager.java Mon Mar 31 14:30:38 2008
@@ -17,10 +17,10 @@
 package org.apache.jetspeed.page;
 
 import junit.framework.Test;
-import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
 import org.apache.jetspeed.page.psml.CastorXmlPageManager;
+import org.apache.jetspeed.test.JetspeedTestCase;
 
 /**
  * TestSecureCastorXmlPageManager
@@ -28,7 +28,7 @@
  * @author <a href="rwatler@apache.org">Randy Watler</a>
  * @version $Id$
  */
-public class TestSecureCastorXmlPageManager extends TestCase implements PageManagerTestShared 
+public class TestSecureCastorXmlPageManager extends JetspeedTestCase implements PageManagerTestShared 
 {
     protected CastorXmlPageManager pageManager;
 
@@ -40,20 +40,7 @@
     protected void setUp() throws Exception
     {
         super.setUp();
-        pageManager = Shared.makeCastorXMLPageManager("secure-pages", false, true);
-    }
-
-    /**
-     * <p>
-     * tearDown
-     * </p>
-     * 
-     * @see junit.framework.TestCase#tearDown()
-     * @throws java.lang.Exception
-     */
-    protected void tearDown() throws Exception
-    {
-        super.tearDown();
+        pageManager = Shared.makeCastorXMLPageManager(getBaseDir(), "secure-pages", false, true);
     }
 
     /**

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecureDatabasePageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecureDatabasePageManager.java?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecureDatabasePageManager.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestSecureDatabasePageManager.java Mon Mar 31 14:30:38 2008
@@ -29,22 +29,12 @@
  */
 public class TestSecureDatabasePageManager extends DatasourceEnabledSpringTestCase implements PageManagerTestShared
 {
-    protected PageManager pageManager;
-
-    protected String somePortletId;
-    
     public static void main(String args[])
     {
         junit.awtui.TestRunner.main(new String[]
         { TestSecureDatabasePageManager.class.getName() });
     }
     
-    protected void setUp() throws Exception
-    {
-        super.setUp();
-        pageManager = (PageManager)ctx.getBean("pageManager");
-    }
-
     public static Test suite()
     {
         // All methods starting with "test" will be executed in the test suite.
@@ -60,6 +50,6 @@
     public void testSecurePageManager() throws Exception
     {
         // utilize standard secure page manager test
-        Shared.testSecurePageManager(this, pageManager);
+        Shared.testSecurePageManager(this, (PageManager)scm.getComponent("pageManager"));
     }
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestTransactions.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestTransactions.java?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestTransactions.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/TestTransactions.java Mon Mar 31 14:30:38 2008
@@ -34,29 +34,14 @@
  */
 public class TestTransactions extends  DatasourceEnabledSpringTestCase implements PageManagerTestShared
 {
-    protected PageManager pageManager;
-
-    protected String somePortletId;
-    
     public static void main(String args[])
     {
         junit.awtui.TestRunner.main(new String[]
         { TestTransactions.class.getName() });
     }
     
-    protected void setUp() throws Exception
-    {
-        super.setUp();        
-        pageManager = (PageManager)ctx.getBean("pageManager");
-    }
-
     public static Test suite()
     {
-//        System.setProperty("org.apache.jetspeed.database.url", "jdbc:mysql://j2-server/j2"); 
-//        System.setProperty("org.apache.jetspeed.database.driver", "com.mysql.jdbc.Driver");
-//        System.setProperty("org.apache.jetspeed.database.user", "j2");
-//        System.setProperty("org.apache.jetspeed.database.password", "xxxxx");
-        
         // All methods starting with "test" will be executed in the test suite.
         return new TestSuite(TestTransactions.class);
     }
@@ -75,6 +60,8 @@
     
     public void testTx() throws Exception
     {
+        PageManager pageManager = (PageManager)scm.getComponent("pageManager");
+
         if (pageManager.folderExists("/"))
         {
             pageManager.removeFolder(pageManager.getFolder("/"));

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/document/psml/TestCastorFileSystemDocumentHandler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/document/psml/TestCastorFileSystemDocumentHandler.java?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/document/psml/TestCastorFileSystemDocumentHandler.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/test/java/org/apache/jetspeed/page/document/psml/TestCastorFileSystemDocumentHandler.java Mon Mar 31 14:30:38 2008
@@ -16,21 +16,19 @@
  */
 package org.apache.jetspeed.page.document.psml;
 
-import java.util.Iterator;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Map;
 import java.util.HashMap;
 
 import junit.framework.Test;
-import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
 import org.apache.jetspeed.om.page.Document;
 import org.apache.jetspeed.om.folder.psml.FolderMetaDataImpl;
-import org.apache.jetspeed.page.psml.CastorXmlPageManager;
 import org.apache.jetspeed.page.document.DocumentHandlerFactory;
 import org.apache.jetspeed.page.document.psml.DocumentHandlerFactoryImpl;
+import org.apache.jetspeed.test.JetspeedTestCase;
 import org.apache.jetspeed.cache.file.FileCache;
 
 /**
@@ -45,7 +43,7 @@
  * @version $Id$
  *  
  */
-public class TestCastorFileSystemDocumentHandler extends TestCase
+public class TestCastorFileSystemDocumentHandler extends JetspeedTestCase
 {
 
     protected CastorFileSystemDocumentHandler folderMetaDataDocumentHandler;
@@ -63,26 +61,13 @@
             "/JETSPEED-INF/castor/page-mapping.xml",
             "folder.metadata",
             FolderMetaDataImpl.class,
-            "src/test/testdata/pages",
+            getBaseDir()+"src/test/testdata/pages",
             new FileCache());
             
         Map handlerMap = new HashMap();
         handlerMap.put("folder.metadata", folderMetaDataDocumentHandler);
         DocumentHandlerFactory handlerFactory = new DocumentHandlerFactoryImpl(handlerMap);
         folderMetaDataDocumentHandler.setHandlerFactory(handlerFactory);
-    }
-
-    /**
-     * <p>
-     * tearDown
-     * </p>
-     * 
-     * @see junit.framework.TestCase#tearDown()
-     * @throws java.lang.Exception
-     */
-    protected void tearDown() throws Exception
-    {
-        super.tearDown();
     }
 
     /**

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Mar 31 14:30:38 2008
@@ -1,2 +1,2 @@
-target
+target
 surefire*.properties

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/java/JETSPEED-INF/spring/test-spring.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/java/JETSPEED-INF/spring/test-spring.xml?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/java/JETSPEED-INF/spring/test-spring.xml (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/java/JETSPEED-INF/spring/test-spring.xml Mon Mar 31 14:30:38 2008
@@ -49,7 +49,7 @@
        <constructor-arg index="0"><value>/JETSPEED-INF/castor/page-mapping.xml</value></constructor-arg>
        <constructor-arg index="1"><value>.psml</value></constructor-arg>
        <constructor-arg index="2" ><value>org.apache.jetspeed.om.page.psml.PageImpl</value></constructor-arg>       
-       <constructor-arg index="3" ><value>target/testdata/pages</value></constructor-arg>
+       <constructor-arg index="3" ><value>${applicationRoot}/WEB-INF/pages</value></constructor-arg>
        <constructor-arg index="4" ><ref bean="PageFileCache"/></constructor-arg>
   </bean>
   
@@ -58,7 +58,7 @@
        <constructor-arg index="0"><value>/JETSPEED-INF/castor/page-mapping.xml</value></constructor-arg>
        <constructor-arg index="1"><value>.link</value></constructor-arg>
        <constructor-arg index="2" ><value>org.apache.jetspeed.om.page.psml.LinkImpl</value></constructor-arg>       
-       <constructor-arg index="3" ><value>target/testdata/pages</value></constructor-arg>
+       <constructor-arg index="3" ><value>${applicationRoot}/WEB-INF/pages</value></constructor-arg>
        <constructor-arg index="4" ><ref bean="PageFileCache"/></constructor-arg>
   </bean>
   
@@ -67,7 +67,7 @@
        <constructor-arg index="0"><value>/JETSPEED-INF/castor/page-mapping.xml</value></constructor-arg>
        <constructor-arg index="1"><value>folder.metadata</value></constructor-arg>
        <constructor-arg index="2" ><value>org.apache.jetspeed.om.folder.psml.FolderMetaDataImpl</value></constructor-arg>       
-       <constructor-arg index="3" ><value>target/testdata/pages</value></constructor-arg>
+       <constructor-arg index="3" ><value>${applicationRoot}/WEB-INF/pages</value></constructor-arg>
        <constructor-arg index="4" ><ref bean="PageFileCache"/></constructor-arg>
   </bean>
   
@@ -76,7 +76,7 @@
        <constructor-arg index="0"><value>/JETSPEED-INF/castor/page-mapping.xml</value></constructor-arg>
        <constructor-arg index="1"><value>page.security</value></constructor-arg>
        <constructor-arg index="2" ><value>org.apache.jetspeed.om.page.psml.PageSecurityImpl</value></constructor-arg>       
-       <constructor-arg index="3" ><value>target/testdata/pages</value></constructor-arg>
+       <constructor-arg index="3" ><value>${applicationRoot}/WEB-INF/pages</value></constructor-arg>
        <constructor-arg index="4" ><ref bean="PageFileCache"/></constructor-arg>
   </bean>
   
@@ -103,7 +103,7 @@
   <!-- FolderHandler -->
   <bean id="FolderHandler"         
        class="org.apache.jetspeed.page.document.psml.FileSystemFolderHandler" >         
-       <constructor-arg index="0"><value>target/testdata/pages</value></constructor-arg>
+       <constructor-arg index="0"><value>${applicationRoot}/WEB-INF/pages</value></constructor-arg>
        <constructor-arg index="1"><ref bean="DocumentHandlerFactory"/></constructor-arg>
        <constructor-arg index="2"><ref bean="PageFileCache"/></constructor-arg>        
   </bean>

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/java/org/apache/jetspeed/portalsite/TestPortalSite.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/java/org/apache/jetspeed/portalsite/TestPortalSite.java?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/java/org/apache/jetspeed/portalsite/TestPortalSite.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/java/org/apache/jetspeed/portalsite/TestPortalSite.java Mon Mar 31 14:30:38 2008
@@ -69,8 +69,8 @@
     protected void setUp() throws Exception
     {
         super.setUp();
-        this.pageManager = (PageManager) ctx.getBean("pageManager");
-        this.portalSite = (PortalSite) ctx.getBean("portalSite");
+        this.pageManager = (PageManager) scm.getComponent("pageManager");
+        this.portalSite = (PortalSite) scm.getComponent("portalSite");
         this.defaultLocale = Locale.getDefault();
         Locale.setDefault(Locale.ENGLISH);
     }
@@ -80,8 +80,8 @@
      */
     protected void tearDown() throws Exception
     {
-        super.tearDown();
         Locale.setDefault(this.defaultLocale);
+        super.tearDown();
     }
 
     /**

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/testdata/pages/folder2/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Mar 31 14:30:38 2008
@@ -1,2 +1,2 @@
-target
+target
 surefire*.properties

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/testdata/pages/folder2/ignore.txt
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/testdata/pages/folder2/ignore.txt?rev=643159&view=auto
==============================================================================
    (empty)

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/testdata/pages/folder2/ignore.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/testdata/pages/folder2/ignore.txt
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/testdata/pages/folder2/ignore.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/assembly/page-manager.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/assembly/page-manager.xml?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/assembly/page-manager.xml (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/assembly/page-manager.xml Mon Mar 31 14:30:38 2008
@@ -25,7 +25,7 @@
        <constructor-arg index="0"><value>/JETSPEED-INF/castor/page-mapping.xml</value></constructor-arg>
        <constructor-arg index="1"><value>.psml</value></constructor-arg>
        <constructor-arg index="2" ><value>org.apache.jetspeed.om.page.psml.PageImpl</value></constructor-arg>       
-      <constructor-arg index="3" ><value>src/test/testdata/pages/pages</value></constructor-arg>
+      <constructor-arg index="3" ><value>${applicationRoot}/src/test/testdata/pages/pages</value></constructor-arg>
        <constructor-arg index="4" ><ref bean="PageFileCache"/></constructor-arg>
   </bean>
   
@@ -34,7 +34,7 @@
        <constructor-arg index="0"><value>/JETSPEED-INF/castor/page-mapping.xml</value></constructor-arg>
        <constructor-arg index="1"><value>.link</value></constructor-arg>
        <constructor-arg index="2" ><value>org.apache.jetspeed.om.page.psml.LinkImpl</value></constructor-arg>       
-       <constructor-arg index="3" ><value>src/test/testdata/pages/pages</value></constructor-arg>
+       <constructor-arg index="3" ><value>${applicationRoot}/src/test/testdata/pages/pages</value></constructor-arg>
        <constructor-arg index="4" ><ref bean="PageFileCache"/></constructor-arg>
   </bean>
   
@@ -43,7 +43,7 @@
        <constructor-arg index="0"><value>/JETSPEED-INF/castor/page-mapping.xml</value></constructor-arg>
        <constructor-arg index="1"><value>folder.metadata</value></constructor-arg>
        <constructor-arg index="2" ><value>org.apache.jetspeed.om.folder.psml.FolderMetaDataImpl</value></constructor-arg>       
-      <constructor-arg index="3" ><value>src/test/testdata/pages/pages</value></constructor-arg>
+      <constructor-arg index="3" ><value>${applicationRoot}/src/test/testdata/pages/pages</value></constructor-arg>
        <constructor-arg index="4" ><ref bean="PageFileCache"/></constructor-arg>
   </bean>
   
@@ -52,7 +52,7 @@
        <constructor-arg index="0"><value>/JETSPEED-INF/castor/page-mapping.xml</value></constructor-arg>
        <constructor-arg index="1"><value>page.security</value></constructor-arg>
        <constructor-arg index="2" ><value>org.apache.jetspeed.om.page.psml.PageSecurityImpl</value></constructor-arg>       
-      <constructor-arg index="3" ><value>src/test/testdata/pages/pages</value></constructor-arg>
+      <constructor-arg index="3" ><value>${applicationRoot}/src/test/testdata/pages/pages</value></constructor-arg>
        <constructor-arg index="4" ><ref bean="PageFileCache"/></constructor-arg>
   </bean>
   
@@ -78,7 +78,7 @@
   
   <bean id="FolderHandler"         
        class="org.apache.jetspeed.page.document.psml.FileSystemFolderHandler" >         
-       <constructor-arg index="0"><value>src/test/testdata/pages/pages</value></constructor-arg>
+       <constructor-arg index="0"><value>${applicationRoot}/src/test/testdata/pages/pages</value></constructor-arg>
        <constructor-arg index="1"><ref bean="DocumentHandlerFactory"/></constructor-arg>
        <constructor-arg index="2"><ref bean="PageFileCache"/></constructor-arg>        
   </bean>

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/aggregator/TestAggregator.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/aggregator/TestAggregator.java?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/aggregator/TestAggregator.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/aggregator/TestAggregator.java Mon Mar 31 14:30:38 2008
@@ -28,7 +28,6 @@
 import javax.servlet.ServletContext;
 
 import junit.framework.Test;
-import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
 import org.apache.jetspeed.PortalReservedParameters;
@@ -48,6 +47,7 @@
 import org.apache.jetspeed.request.RequestContextComponent;
 import org.apache.jetspeed.security.JSSubject;
 import org.apache.jetspeed.security.SecurityHelper;
+import org.apache.jetspeed.test.JetspeedTestCase;
 import org.apache.jetspeed.testhelpers.SpringEngineHelper;
 
 import com.mockrunner.mock.web.MockHttpServletRequest;
@@ -62,7 +62,7 @@
  * @version $Id$
  * 
  */
-public class TestAggregator extends TestCase
+public class TestAggregator extends JetspeedTestCase
 {
     private SpringEngineHelper engineHelper;
     private Engine engine;
@@ -103,7 +103,7 @@
         
         HashMap context = new HashMap();
         engineHelper = new SpringEngineHelper(context);
-        engineHelper.setUp();
+        engineHelper.setUp(getBaseDir());
         engine = (Engine) context.get(SpringEngineHelper.ENGINE_ATTR);
 
         pageAggregator = (PageAggregator) engine.getComponentManager().getComponent(PageAggregator.class);

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/aggregator/TestRenderer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/aggregator/TestRenderer.java?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/aggregator/TestRenderer.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/aggregator/TestRenderer.java Mon Mar 31 14:30:38 2008
@@ -32,7 +32,7 @@
 public class TestRenderer extends AbstractPortalContainerTestCase
 {
     protected PortletRenderer renderer;
-    
+    protected WorkerMonitor monitor;
    
     /**
      * Start the tests.
@@ -47,10 +47,16 @@
     protected void setUp() throws Exception
     {
         super.setUp();
-        WorkerMonitor monitor = new WorkerMonitorImpl(5, 20, 5, 10);
+        monitor = new WorkerMonitorImpl(5, 20, 5, 10);
         monitor.start();
         
         renderer = new PortletRendererImpl(portletContainer, windowAccessor, monitor, null);       
+    }
+    
+    protected void tearDown() throws Exception
+    {
+        monitor.stop();
+        super.tearDown();
     }
 
     /**

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/cluster/TestCluster.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/cluster/TestCluster.java?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/cluster/TestCluster.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/cluster/TestCluster.java Mon Mar 31 14:30:38 2008
@@ -41,10 +41,9 @@
      */
     public void setUp() throws Exception
     {
-    	System.setProperty("applicationRoot","target/jetspeed");
         super.setUp();
 
-        single = (NodeManager) ctx.getBean("org.apache.jetspeed.cluster.NodeManager");
+        single = (NodeManager) scm.getComponent("org.apache.jetspeed.cluster.NodeManager");
     }
   
     public static Test suite()

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/state/TestNavigationalState.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/state/TestNavigationalState.java?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/state/TestNavigationalState.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/state/TestNavigationalState.java Mon Mar 31 14:30:38 2008
@@ -24,7 +24,6 @@
 import javax.servlet.http.HttpServletRequest;
 
 import junit.framework.Test;
-import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
 import org.apache.jetspeed.PortalContext;
@@ -43,6 +42,7 @@
 import org.apache.jetspeed.om.common.portlet.MutablePortletEntity;
 import org.apache.jetspeed.om.common.portlet.PortletApplication;
 import org.apache.jetspeed.om.window.impl.PortletWindowImpl;
+import org.apache.jetspeed.test.JetspeedTestCase;
 import org.apache.jetspeed.testhelpers.SpringEngineHelper;
 import org.apache.jetspeed.util.JetspeedLongObjectID;
 import org.apache.pluto.om.entity.PortletEntity;
@@ -65,7 +65,7 @@
  * @version $Id$
  */
 
-public class TestNavigationalState extends TestCase
+public class TestNavigationalState extends JetspeedTestCase
 {
     // needed to be able to Mock PortletWindowListCtrl
     private interface CompositeWindowList extends PortletWindowList, PortletWindowListCtrl{}
@@ -102,7 +102,7 @@
 
         HashMap context = new HashMap();
         engineHelper = new SpringEngineHelper(context);
-        engineHelper.setUp();
+        engineHelper.setUp(getBaseDir());
         engine = (Engine) context.get(SpringEngineHelper.ENGINE_ATTR);
         // mock test PortletWindow, PortletEntity, PortletDefinition and PortletApplication
         Mock entityMock = new Mock(MutablePortletEntity.class);        

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/deployment/TestSimpleDeployment.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/deployment/TestSimpleDeployment.java?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/deployment/TestSimpleDeployment.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/deployment/TestSimpleDeployment.java Mon Mar 31 14:30:38 2008
@@ -108,7 +108,7 @@
     
     public void testFileSystemManagerOnDir() throws Exception
     {
-        File demoApp = new File("src/test/testdata/deploy/webapp");
+        File demoApp = new File(getBaseDir()+"src/test/testdata/deploy/webapp");
         assertTrue(demoApp.exists());
         
         DirectoryHelper dirHelper = new DirectoryHelper(demoApp);
@@ -361,12 +361,12 @@
         try
         {
             super.setUp();
-            copyFrom = new File("src/test/deployment/deploy");
-            deploySrc = new File("./target/deployment/deploy");
+            copyFrom = new File(getBaseDir()+"src/test/deployment/deploy");
+            deploySrc = new File(getBaseDir()+"target/deployment/deploy");
             deploySrc.mkdirs();
-            deployRootFile = new File("./target/deployment/templates/decorators");
+            deployRootFile = new File(getBaseDir()+"target/deployment/templates/decorators");
             deployRootFile.mkdirs();
-            webAppsDirFile = new File("./target/deployment/webapps");
+            webAppsDirFile = new File(getBaseDir()+"target/deployment/webapps");
             webAppsDirFile.mkdirs();
 
             webAppsDir = webAppsDirFile.getCanonicalPath();
@@ -431,48 +431,4 @@
             }
         }
     }
-
-    /**
-     * @see junit.framework.TestCase#tearDown()
-     */
-    public void tearDown() throws Exception
-    {
-/*        
-        manager = new TomcatManager("", "", 0, "", 0, "", "");
-        FileSystemPAM pam = new FileSystemPAM(webAppsDir, portletRegistry, entityAccess, windowAccess, portletCache, portletFactory, manager);
-
-        try
-        {
-            DirectoryHelper dirHelper = new DirectoryHelper(new File(webAppsDir + "/" + TEST_PORTLET_APP_NAME));
-            paWar1 = new PortletApplicationWar(dirHelper, TEST_PORTLET_APP_NAME, "/"
-                    + TEST_PORTLET_APP_NAME);
-            pam.undeploy(paWar1);
-        }
-        catch (Exception e1)
-        {
-
-        }
-
-        pam.unregister("jetspeed");
-
-        try
-        {
-            DirectoryHelper dirHelper = new DirectoryHelper(new File(webAppsDir + "/TestSecurityRoles"));
-            paWar3 = new PortletApplicationWar(dirHelper, "TestSecurityRoles", "/TestSecurityRoles" );
-
-            pam.undeploy(paWar3);
-        }
-        catch (Exception e3)
-        {
-
-        }
-
-        // DirectoryUtils.rmdir(new File("./target/deployment"));
-        new DirectoryHelper(new File("./target/deployment")).remove();
-*/        
-        super.tearDown();
-
-    }
-
-    
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/engine/AbstractEngineTest.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/engine/AbstractEngineTest.java?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/engine/AbstractEngineTest.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/engine/AbstractEngineTest.java Mon Mar 31 14:30:38 2008
@@ -18,9 +18,8 @@
 
 import java.util.HashMap;
 
-import junit.framework.TestCase;
-
 import org.apache.jetspeed.components.ComponentManagement;
+import org.apache.jetspeed.test.JetspeedTestCase;
 import org.apache.jetspeed.testhelpers.SpringEngineHelper;
 
 /**
@@ -31,7 +30,7 @@
  * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
  * @version $Id$
  */
-public abstract class AbstractEngineTest extends TestCase
+public abstract class AbstractEngineTest extends JetspeedTestCase
 {
 
     /**
@@ -70,7 +69,7 @@
     {
        HashMap context = new HashMap();
        engineHelper = new SpringEngineHelper(context);
-       engineHelper.setUp();
+       engineHelper.setUp(getBaseDir());
        engine = (Engine) context.get(SpringEngineHelper.ENGINE_ATTR);
     }
 

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestConstraintsAction.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestConstraintsAction.java?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestConstraintsAction.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestConstraintsAction.java Mon Mar 31 14:30:38 2008
@@ -24,8 +24,6 @@
 
 import javax.security.auth.Subject;
 
-import junit.framework.TestCase;
-
 import org.apache.jetspeed.components.ComponentManager;
 import org.apache.jetspeed.components.SpringComponentManager;
 import org.apache.jetspeed.components.factorybeans.ServletConfigFactoryBean;
@@ -41,6 +39,8 @@
 import org.apache.jetspeed.security.JSSubject;
 import org.apache.jetspeed.security.impl.RolePrincipalImpl;
 import org.apache.jetspeed.security.impl.UserPrincipalImpl;
+import org.apache.jetspeed.test.JetspeedTestCase;
+
 import com.mockrunner.mock.web.MockHttpServletRequest;
 import com.mockrunner.mock.web.MockHttpServletResponse;
 import com.mockrunner.mock.web.MockHttpSession;
@@ -53,7 +53,7 @@
  * @author <a>David Sean Taylor </a>
  * @version $Id: $
  */
-public class TestConstraintsAction extends TestCase
+public class TestConstraintsAction extends JetspeedTestCase
 {
 
     private ComponentManager cm;
@@ -74,10 +74,8 @@
     {
         super.setUp();
 
-        String appRoot =  "./"; //PortalTestConstants.JETSPEED_APPLICATION_ROOT;
-        
         MockServletConfig servletConfig = new MockServletConfig();        
-        ResourceLocatingServletContext servletContent = new ResourceLocatingServletContext(new File(appRoot));        
+        ResourceLocatingServletContext servletContent = new ResourceLocatingServletContext(new File(getBaseDir()));        
         servletConfig.setServletContext(servletContent);
         ServletConfigFactoryBean.setServletConfig(servletConfig);
         
@@ -89,7 +87,7 @@
                 "src/test/assembly/page-manager.xml"};
         
                 
-        cm = new SpringComponentManager(bootConfigs, appConfigs, servletContent, ".");
+        cm = new SpringComponentManager(null, bootConfigs, appConfigs, servletContent, getBaseDir());
         cm.start();
         valve = (LayoutValve) cm.getComponent("layoutValve");
         pageManager = (PageManager) cm.getComponent("pageManager");
@@ -98,6 +96,7 @@
     protected void tearDown() throws Exception
     {
         cm.stop();
+        super.tearDown();
     }
 
     public void testUpdate()

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestLayout.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestLayout.java?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestLayout.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestLayout.java Mon Mar 31 14:30:38 2008
@@ -18,8 +18,6 @@
 
 import java.io.File;
 
-import junit.framework.TestCase;
-
 import org.apache.jetspeed.components.ComponentManager;
 import org.apache.jetspeed.components.SpringComponentManager;
 import org.apache.jetspeed.components.factorybeans.ServletConfigFactoryBean;
@@ -27,6 +25,8 @@
 import org.apache.jetspeed.mocks.ResourceLocatingServletContext;
 import org.apache.jetspeed.pipeline.PipelineException;
 import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.test.JetspeedTestCase;
+
 import com.mockrunner.mock.web.MockServletConfig;
 
 /**
@@ -35,7 +35,7 @@
  * @author <a>David Gurney </a>
  * @version $Id: $
  */
-public class TestLayout extends TestCase
+public class TestLayout extends JetspeedTestCase
 {
 
     private ComponentManager cm;
@@ -54,7 +54,7 @@
     {
         super.setUp();
 
-        String appRoot =  "./"; //PortalTestConstants.JETSPEED_APPLICATION_ROOT;
+        String appRoot = getBaseDir(); //PortalTestConstants.JETSPEED_APPLICATION_ROOT;
         
         MockServletConfig servletConfig = new MockServletConfig();        
         ResourceLocatingServletContext servletContent = new ResourceLocatingServletContext(new File(appRoot));        
@@ -68,7 +68,7 @@
                 "src/test/assembly/test-layout-api.xml"};
         
                 
-        cm = new SpringComponentManager(bootConfigs, appConfigs, servletContent, ".");
+        cm = new SpringComponentManager(null, bootConfigs, appConfigs, servletContent, ".");
         cm.start();
         valve = (LayoutValve) cm.getComponent("layoutValve");
     }
@@ -76,6 +76,7 @@
     protected void tearDown() throws Exception
     {
         cm.stop();
+        super.tearDown();
     }
 
     public void testNullRequestContext()

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/pipeline/TestPipeline.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/pipeline/TestPipeline.java?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/pipeline/TestPipeline.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/pipeline/TestPipeline.java Mon Mar 31 14:30:38 2008
@@ -19,10 +19,9 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import junit.framework.TestCase;
-
 import org.apache.jetspeed.engine.Engine;
 import org.apache.jetspeed.pipeline.valve.Valve;
+import org.apache.jetspeed.test.JetspeedTestCase;
 import org.apache.jetspeed.testhelpers.SpringEngineHelper;
 
 /**
@@ -31,7 +30,7 @@
  * @author <a href="taylor@apache.org">David Sean Taylor</a>
  * @version $Id$
  */
-public class TestPipeline extends TestCase
+public class TestPipeline extends JetspeedTestCase
 {
      private Engine engine;
     private SpringEngineHelper engineHelper;
@@ -74,14 +73,16 @@
 
     protected void setUp() throws Exception
     {
+        super.setUp();
         Map context = new HashMap();
         engineHelper = new SpringEngineHelper(context);
-        engineHelper.setUp();
+        engineHelper.setUp(getBaseDir());
         this.engine = (Engine)context.get(SpringEngineHelper.ENGINE_ATTR);
     }
 
     protected void tearDown() throws Exception
     {
         engineHelper.tearDown();
+        super.tearDown();
     }
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/testhelpers/SpringEngineHelper.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/testhelpers/SpringEngineHelper.java?rev=643159&r1=643158&r2=643159&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/testhelpers/SpringEngineHelper.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/testhelpers/SpringEngineHelper.java Mon Mar 31 14:30:38 2008
@@ -32,35 +32,43 @@
 
 import com.mockrunner.mock.web.MockServletConfig;
 
-public class SpringEngineHelper extends AbstractTestHelper
+public class SpringEngineHelper
 {
     public static final String ENGINE_ATTR = "Engine";     
     
+    private final Map context;
+
+    private Engine engine;
+
     protected JetspeedTestJNDIComponent jndiDS;
     
     public SpringEngineHelper(Map context)
     {
-        super(context);
+        this.context = context;
     }
     
-    private Engine engine;
-
-    public void setUp() throws Exception
+    public Map getContext()
+    {
+        return context;
+    }
+    
+    public void setUp(String baseDir) throws Exception
     {
         jndiDS = new JetspeedTestJNDIComponent();
         jndiDS.setup();
 
+        
         PropertiesConfiguration config = new PropertiesConfiguration();
-        config.load(new FileInputStream(PortalTestConstants.JETSPEED_PROPERTIES_PATH));
+        config.load(new FileInputStream(baseDir+PortalTestConstants.JETSPEED_PROPERTIES_PATH));
                 
-        String appRoot = PortalTestConstants.JETSPEED_APPLICATION_ROOT;
+        String appRoot = baseDir+PortalTestConstants.JETSPEED_APPLICATION_ROOT;
         
         MockServletConfig servletConfig = new MockServletConfig();        
         ResourceLocatingServletContext servletContent = new ResourceLocatingServletContext(new File(appRoot));        
         servletConfig.setServletContext(servletContent);
         ServletConfigFactoryBean.setServletConfig(servletConfig);
         
-        SpringComponentManager scm = new SpringComponentManager(new String[] {"/WEB-INF/assembly/boot/datasource.xml"}, new String[] {"/WEB-INF/assembly/*.xml"}, servletContent, appRoot );
+        SpringComponentManager scm = new SpringComponentManager(null, new String[] {"/WEB-INF/assembly/boot/datasource.xml"}, new String[] {"/WEB-INF/assembly/*.xml"}, servletContent, appRoot );
        
         engine = new JetspeedEngine(config, appRoot, servletConfig, scm );
         Jetspeed.setEngine(engine);



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message