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/rdbms/src/test/org/apache/jetspeed/components DatasourceEnabledTestSuite.java
Date Fri, 27 Feb 2004 19:44:11 GMT
weaver      2004/02/27 11:44:11

  Modified:    components/rdbms/src/java/org/apache/jetspeed/containers
                        rdbms.container.groovy
               components/rdbms/src/test/org/apache/jetspeed/components
                        DatasourceEnabledTestSuite.java
  Log:
  now uses the bound datasource component
  
  Revision  Changes    Path
  1.6       +5 -5      jakarta-jetspeed-2/components/rdbms/src/java/org/apache/jetspeed/containers/rdbms.container.groovy
  
  Index: rdbms.container.groovy
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/rdbms/src/java/org/apache/jetspeed/containers/rdbms.container.groovy,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- rdbms.container.groovy	27 Feb 2004 18:30:00 -0000	1.5
  +++ rdbms.container.groovy	27 Feb 2004 19:44:11 -0000	1.6
  @@ -2,7 +2,7 @@
   import org.apache.commons.configuration.PropertiesConfiguration
   import org.apache.jetspeed.components.jndi.JNDIComponent
   import org.apache.jetspeed.components.jndi.TyrexJNDIComponent
  -import org.apache.jetspeed.components.datasource.DBCPDatasourceComponent
  +import org.apache.jetspeed.components.datasource.BoundDBCPDatasourceComponent
   import org.apache.jetspeed.components.datasource.DatasourceComponent
   import org.hsqldb.jdbcDriver
   import org.apache.commons.pool.impl.GenericObjectPool
  @@ -23,9 +23,9 @@
   container = new DefaultPicoContainer()
   
   // This JNDI component helps us publish the datasource
  -Class jndiClass = Class.forName("org.apache.jetspeed.components.jndi.JNDIComponent")
  -Class tyrexJndiClass = Class.forName("org.apache.jetspeed.components.jndi.TyrexJNDIComponent")
  -container.registerComponentImplementation(jndiClass, tyrexJndiClass)
  +Class jndiClass = JNDIComponent
  +JNDIComponent jndiImpl = new TyrexJNDIComponent()
  +container.registerComponentInstance(jndiClass, jndiImpl)
   
   // Create a datasource based on the HSQL server we just created
   Class dsClass = Class.forName("org.apache.jetspeed.components.datasource.DatasourceComponent")
  @@ -34,7 +34,7 @@
   String user = System.getProperty("org.apache.jetspeed.database.user")
   String password = System.getProperty("org.apache.jetspeed.database.password")
   
  -container.registerComponentInstance(dsClass, new DBCPDatasourceComponent(user, password,
driver, url, 20, 5000, GenericObjectPool.WHEN_EXHAUSTED_GROW, true))
  +container.registerComponentInstance(dsClass, new BoundDBCPDatasourceComponent(user, password,
driver, url, 20, 5000, GenericObjectPool.WHEN_EXHAUSTED_GROW, true, "jetspeed", jndiImpl))
   
   
   
  
  
  
  1.5       +5 -21     jakarta-jetspeed-2/components/rdbms/src/test/org/apache/jetspeed/components/DatasourceEnabledTestSuite.java
  
  Index: DatasourceEnabledTestSuite.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/rdbms/src/test/org/apache/jetspeed/components/DatasourceEnabledTestSuite.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DatasourceEnabledTestSuite.java	27 Feb 2004 17:49:39 -0000	1.4
  +++ DatasourceEnabledTestSuite.java	27 Feb 2004 19:44:11 -0000	1.5
  @@ -95,24 +95,11 @@
   
   
       protected void initDatasource()throws Exception
  -    {
  -       System.out.println("========= JDBC Driver "+System.getProperty("org.apache.jetspeed.database.driver"));
  -        System.out.println("========================= DatasourceEnabledTestSuite start
RDBMS container ");
  +    {        
           Reader composition = new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(
           script));
           cm = new ComponentManager(composition, ComponentManager.GROOVY);
  -       	MutablePicoContainer container = cm.getRootContainer();	
  -        
  -		JNDIComponent jndi = (JNDIComponent) container.getComponentInstanceOfType(JNDIComponent.class);
  -		DatasourceComponent dsc = (DatasourceComponent) container.getComponentInstanceOfType(DatasourceComponent.class);
  -		try
  -        {
  -            jndi.bindObject("comp/env/jdbc/jetspeed", dsc.getDatasource());
  -        }
  -        catch (NamingException e)
  -        {
  -            throw new RuntimeException(e.toString());
  -        }
  +       	MutablePicoContainer container = cm.getRootContainer();       
       }
   
       /**
  @@ -123,10 +110,8 @@
           try
           {
               initDatasource();            
  -            super.run(arg0);
  -            System.out.println("========================= DatasourceEnabledTestSuite stopping
RDBMS container ");            
  +            super.run(arg0);                        
               cm.getRootContainer().stop();
  -           // Thread.sleep(2000);
           }
           catch(Throwable e)
           {
  @@ -141,8 +126,7 @@
        * @see junit.framework.TestSuite#runTest(junit.framework.Test, junit.framework.TestResult)
        */
       public void runTest(Test arg0, TestResult arg1)
  -    {
  -        System.out.println("========================= DatasourceEnabledTestSuite running
test "+arg0);
  +    {        
           
           if(arg0 instanceof AbstractComponentAwareTestCase)
           {
  
  
  

---------------------------------------------------------------------
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