portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wea...@apache.org
Subject cvs commit: jakarta-jetspeed-2/components/persistence/src/test/org/apache/jetspeed/components/persistence TestPersistenceContainer.java
Date Tue, 09 Mar 2004 16:15:37 GMT
weaver      2004/03/09 08:15:37

  Modified:    components/persistence/src/test/org/apache/jetspeed/components/persistence
                        TestPersistenceContainer.java
  Log:
  tests the PortletEntityComponentAccess was registered
  
  Revision  Changes    Path
  1.10      +15 -40    jakarta-jetspeed-2/components/persistence/src/test/org/apache/jetspeed/components/persistence/TestPersistenceContainer.java
  
  Index: TestPersistenceContainer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/persistence/src/test/org/apache/jetspeed/components/persistence/TestPersistenceContainer.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TestPersistenceContainer.java	8 Mar 2004 00:47:20 -0000	1.9
  +++ TestPersistenceContainer.java	9 Mar 2004 16:15:37 -0000	1.10
  @@ -14,20 +14,16 @@
    * limitations under the License.
    */
   package org.apache.jetspeed.components.persistence;
  -import java.io.InputStreamReader;
  -import java.io.Reader;
   import java.util.ArrayList;
  +
   import junit.framework.Test;
  -import junit.framework.TestSuite;
  +
   import org.apache.jetspeed.components.AbstractComponentAwareTestCase;
  -import org.apache.jetspeed.components.ComponentManager;
  +import org.apache.jetspeed.components.ComponentAwareTestSuite;
   import org.apache.jetspeed.components.persistence.store.Filter;
   import org.apache.jetspeed.components.persistence.store.PersistenceStore;
   import org.apache.jetspeed.components.persistence.store.PersistenceStoreContainer;
   import org.picocontainer.MutablePicoContainer;
  -import org.picocontainer.defaults.DefaultPicoContainer;
  -import org.picocontainer.defaults.ObjectReference;
  -import org.picocontainer.defaults.SimpleReference;
   
   /**
    * <p>
  @@ -40,12 +36,10 @@
    */
   public class TestPersistenceContainer extends AbstractComponentAwareTestCase
   {
  -
  -    private ComponentManager persistenceCm;
  -    private ComponentManager rdbmsCm;
  +    
       private MutablePicoContainer rdbmsContainer;
       private PersistenceStoreContainer persistenceContainer;
  -    private DefaultPicoContainer parent;
  +    private MutablePicoContainer parent;
       private PersistenceStore store;
   
   
  @@ -60,14 +54,17 @@
   
       public static Test suite()
       {
  -        // All methods starting with "test" will be executed in the test suite.
  -        return new TestSuite(TestPersistenceContainer.class);
  +        ComponentAwareTestSuite suite = new ComponentAwareTestSuite(TestPersistenceContainer.class);
  +        suite.setScript("org/apache/jetspeed/containers/test.persistence.groovy");
  +        
  +        return suite;
       }
   
       public void testStartContainer()
       {
  -        assertNotNull(rdbmsCm);
  -        assertNotNull(persistenceCm);
  +        assertNotNull(parent);
  +        assertNotNull(persistenceContainer);
  +        assertNotNull(store);
       }
   
       public void test001() throws Exception
  @@ -142,30 +139,8 @@
       protected void setUp() throws Exception
       {
           super.setUp();
  -        ClassLoader cl = Thread.currentThread().getContextClassLoader();
  -        Reader rdbmsScript = new InputStreamReader(cl
  -        .getResourceAsStream("org/apache/jetspeed/containers/rdbms.container.groovy"));
  -        Reader persistenceScript = new InputStreamReader(cl
  -        .getResourceAsStream("org/apache/jetspeed/containers/persistence.container.groovy"));
  -        rdbmsCm = new ComponentManager(rdbmsScript, ComponentManager.GROOVY);
  -        persistenceCm = new ComponentManager(persistenceScript, ComponentManager.GROOVY);
  -        ObjectReference parentRef = new SimpleReference();
  -        ObjectReference rdbmsRef = new SimpleReference();
  -        ObjectReference persistenceRef = new SimpleReference();
  -        parentRef.set(parent);
  -        rdbmsCm.getContainerBuilder().buildContainer(rdbmsRef, parentRef, "TEST_PERSISTENCE");
  -        persistenceCm.getContainerBuilder().buildContainer(persistenceRef, parentRef, "TEST_PERSISTENCE");
  -        rdbmsContainer = (MutablePicoContainer) rdbmsRef.get();
  -        persistenceContainer = (PersistenceStoreContainer) persistenceRef.get();
  -        store = persistenceContainer.getStoreForThread("jetspeed");
  -    }
  -
  -    protected void tearDown() throws Exception
  -    {
  -        // parent.stop();
  -
  -        rdbmsContainer.stop();
  -        ((MutablePicoContainer) persistenceContainer).stop();
  -        super.tearDown();
  +        parent = (MutablePicoContainer) getContainer();
  +        persistenceContainer = (PersistenceStoreContainer) parent.getComponentInstance(PersistenceStoreContainer.class);
  +        store = persistenceContainer.getStore("jetspeed");
       }
   }
  
  
  

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


Mime
View raw message