You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by we...@apache.org on 2004/05/27 21:32:26 UTC

cvs commit: jakarta-jetspeed-2/components/prefs/src/test/org/apache/jetspeed/prefs TestPropertyManager.java TestPreferences.java

weaver      2004/05/27 12:32:26

  Modified:    components/prefs/src/test/org/apache/jetspeed/prefs
                        TestPropertyManager.java TestPreferences.java
  Log:
  see JS2-40: <http://nagoya.apache.org/jira/browse/JS2-40>
  & JS2-59 <http://nagoya.apache.org/jira/browse/JS2-59>
  
  Revision  Changes    Path
  1.15      +15 -32    jakarta-jetspeed-2/components/prefs/src/test/org/apache/jetspeed/prefs/TestPropertyManager.java
  
  Index: TestPropertyManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/prefs/src/test/org/apache/jetspeed/prefs/TestPropertyManager.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- TestPropertyManager.java	16 May 2004 20:03:29 -0000	1.14
  +++ TestPropertyManager.java	27 May 2004 19:32:26 -0000	1.15
  @@ -20,29 +20,22 @@
   import java.util.prefs.Preferences;
   
   import junit.framework.Test;
  +import junit.framework.TestSuite;
   
  -import org.apache.jetspeed.components.AbstractComponentAwareTestCase;
  -import org.apache.jetspeed.components.ComponentAwareTestSuite;
  -import org.apache.jetspeed.components.persistence.store.PersistenceStore;
  +import org.apache.jetspeed.components.persistence.store.util.PersistenceSupportedTestCase;
  +import org.apache.jetspeed.prefs.impl.PreferencesProviderImpl;
   import org.apache.jetspeed.prefs.impl.PropertyException;
  +import org.apache.jetspeed.prefs.impl.PropertyManagerImpl;
   import org.apache.jetspeed.prefs.om.Property;
   
  -import org.picocontainer.MutablePicoContainer;
  -
   /**
    * <p>Unit testing for {@link PropertyManager}.</p>
    *
    * @author <a href="mailto:dlestrat@apache.org">David Le Strat</a>
    */
  -public class TestPropertyManager extends AbstractComponentAwareTestCase
  +public class TestPropertyManager extends PersistenceSupportedTestCase
   {
   
  -    /** The mutable pico container. */
  -    private MutablePicoContainer container;
  -
  -    /** The persistence store. */
  -    private static PersistenceStore store;
  -
       /** The property manager. */
       private static PropertyManager pms;
   
  @@ -52,13 +45,15 @@
       private final static int USER_PROPERTY_SET_TYPE = 0;
       private final static int SYSTEM_PROPERTY_SET_TYPE = 1;
   
  +    private PreferencesProvider provider;
  +
       /**
        * <p>Defines the test case name for junit.</p>
        * @param testName The test case name.
        */
       public TestPropertyManager(String testName)
       {
  -        super(testName, "./src/test/Log4j.properties");
  +        super(testName);
       }
   
       /**
  @@ -67,8 +62,9 @@
       public void setUp() throws Exception
       {
           super.setUp();
  -        container = (MutablePicoContainer) getContainer();
  -        pms = (PropertyManager) container.getComponentInstance(PropertyManager.class);
  +        pms =new PropertyManagerImpl(persistenceStore);
  +        provider = new PreferencesProviderImpl(persistenceStore, "org.apache.jetspeed.prefs.impl.PreferencesFactoryImpl");
  +        // Class.forName("org.apache.jetspeed.prefs.impl.PreferencesImpl");
       }
   
       /**
  @@ -76,30 +72,17 @@
        */
       public void tearDown() throws Exception
       {
  -        super.tearDown();
           clean();
  +        // super.tearDown();        
       }
   
  -    /**
  -     * <p>Creates the test suite.</p>
  -     * @return A test suite (<code>TestSuite</code>) that includes all methods
  -     *         starting with "test"
  -     */
       public static Test suite()
       {
  -        ComponentAwareTestSuite suite = new ComponentAwareTestSuite(TestPropertyManager.class);
  -        suite.setScript("org/apache/jetspeed/prefs/containers/test.prefs.groovy");
  -        return suite;
  -    }
  -
  -    /**
  -     * <p>Test the container.</p>
  -     */
  -    public void testContainer()
  -    {
  -        assertNotNull(container);
  +        // All methods starting with "test" will be executed in the test suite.
  +        return new TestSuite(TestPropertyManager.class);
       }
   
  + 
       /**
        * <p>Test add property keys to a {@link Preferences} node.</p>
        */
  
  
  
  1.14      +15 -34    jakarta-jetspeed-2/components/prefs/src/test/org/apache/jetspeed/prefs/TestPreferences.java
  
  Index: TestPreferences.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/prefs/src/test/org/apache/jetspeed/prefs/TestPreferences.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- TestPreferences.java	16 May 2004 20:04:09 -0000	1.13
  +++ TestPreferences.java	27 May 2004 19:32:26 -0000	1.14
  @@ -20,28 +20,21 @@
   import java.util.prefs.Preferences;
   
   import junit.framework.Test;
  +import junit.framework.TestSuite;
   
  -import org.apache.jetspeed.components.AbstractComponentAwareTestCase;
  -import org.apache.jetspeed.components.ComponentAwareTestSuite;
  -import org.apache.jetspeed.components.persistence.store.PersistenceStore;
  +import org.apache.jetspeed.components.persistence.store.util.PersistenceSupportedTestCase;
  +import org.apache.jetspeed.prefs.impl.PreferencesProviderImpl;
   import org.apache.jetspeed.prefs.impl.PropertyException;
  -
  -import org.picocontainer.MutablePicoContainer;
  +import org.apache.jetspeed.prefs.impl.PropertyManagerImpl;
   
   /**
    * <p>Unit testing for {@link Preferences}.</p>
    * 
    * @author <a href="dlestrat@yahoo.com">David Le Strat</a>
    */
  -public class TestPreferences extends AbstractComponentAwareTestCase
  +public class TestPreferences extends PersistenceSupportedTestCase
   {
   
  -    /** The mutable pico container. */
  -    private MutablePicoContainer container;
  -
  -    /** The persistence store. */
  -    private static PersistenceStore store;
  -
       /** The property manager. */
       private static PropertyManager pms;
   
  @@ -51,13 +44,15 @@
       private final static int USER_PROPERTY_SET_TYPE = 0;
       private final static int SYSTEM_PROPERTY_SET_TYPE = 1;
   
  +    private PreferencesProvider provider;
  +
       /**
        * <p>Defines the test case name for junit.</p>
        * @param testName The test case name.
        */
       public TestPreferences(String testName)
       {
  -        super(testName, "./src/test/Log4j.properties");
  +        super(testName);
       }
   
       /**
  @@ -66,39 +61,25 @@
       public void setUp() throws Exception
       {
           super.setUp();
  -        container = (MutablePicoContainer) getContainer();
  -        pms = (PropertyManager) container.getComponentInstance(PropertyManager.class);
  +        pms = new PropertyManagerImpl(persistenceStore);
  +        provider = new PreferencesProviderImpl(persistenceStore, "org.apache.jetspeed.prefs.impl.PreferencesFactoryImpl");
       }
   
       /**
        * @see junit.framework.TestCase#tearDown()
        */
       public void tearDown() throws Exception
  -    {
  -        super.tearDown();
  +    {      
           clean();
  +        // super.tearDown();
       }
   
  -    /**
  -     * <p>Creates the test suite.</p>
  -     * @return A test suite (<code>TestSuite</code>) that includes all methods
  -     *         starting with "test"
  -     */
       public static Test suite()
       {
  -        ComponentAwareTestSuite suite = new ComponentAwareTestSuite(TestPreferences.class);
  -        suite.setScript("org/apache/jetspeed/prefs/containers/test.prefs.groovy");
  -        return suite;
  +        // All methods starting with "test" will be executed in the test suite.
  +        return new TestSuite(TestPreferences.class);
       }
  -
  -    /**
  -     * <p>Test the container.</p>
  -     */
  -    public void testContainer()
  -    {
  -        assertNotNull(container);
  -    }
  -
  +    
       /**
        * <p>Test user root.</p>
        */
  
  
  

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