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/02/24 01:38:47 UTC

cvs commit: jakarta-jetspeed-2/components/rdbms/src/test/org/apache/jetspeed/components TestRDBMS.java DatasourceEnabledTestSuite.java TestHSQL.java TestDBCPDatasource.java TestJNDIComponent.java

weaver      2004/02/23 16:38:47

  Modified:    components/rdbms/src/test/org/apache/jetspeed/components
                        DatasourceEnabledTestSuite.java
  Added:       components/rdbms/src/test/org/apache/jetspeed/components
                        TestRDBMS.java
  Removed:     components/rdbms/src/test/org/apache/jetspeed/components
                        TestHSQL.java TestDBCPDatasource.java
                        TestJNDIComponent.java
  Log:
  merged all rdbms tests into one class
  
  Revision  Changes    Path
  1.2       +6 -6      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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DatasourceEnabledTestSuite.java	22 Feb 2004 22:40:01 -0000	1.1
  +++ DatasourceEnabledTestSuite.java	24 Feb 2004 00:38:47 -0000	1.2
  @@ -39,7 +39,7 @@
       
       public static final String DEFAULT_CONTAINER = "org/apache/jetspeed/containers/rdbms.container.groovy";
       
  -    public ComponentManager cm;
  +    private ComponentManager cm;
   
       private String script;
   
  @@ -122,13 +122,13 @@
           {
               initDatasource();            
               super.run(arg0);
  -            System.out.println("========================= DatasourceEnabledTestSuite stopping RDBMS container ");
  -            cm.killContainer();
  +            System.out.println("========================= DatasourceEnabledTestSuite stopping RDBMS container ");            
  +            cm.getRootContainer().stop();
              // Thread.sleep(2000);
           }
  -        catch(Exception e)
  +        catch(Throwable e)
           {
  -            cm.killContainer();
  +            cm.getRootContainer().stop();
               e.printStackTrace();
               throw new IllegalStateException("Unable to start RDBMS container: "+e.toString());
           }
  
  
  
  1.1                  jakarta-jetspeed-2/components/rdbms/src/test/org/apache/jetspeed/components/TestRDBMS.java
  
  Index: TestRDBMS.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.jetspeed.components;
  import java.sql.Connection;
  import java.sql.DriverManager;
  
  import javax.sql.DataSource;
  
  import junit.framework.Test;
  
  import org.apache.jetspeed.components.datasource.DBCPDatasourceComponent;
  import org.apache.jetspeed.components.datasource.DatasourceComponent;
  import org.hsqldb.jdbcDriver;
  import org.picocontainer.MutablePicoContainer;
  /**
   * <p>
   * TestJNDIComponent
   * </p>@
   * 
   * @author <a href="mailto:weaver@apache.org">Scott T. Weaver </a>
   * @version $ $
   *  
   */
  public class TestRDBMS extends AbstractComponentAwareTestCase
  {
      public static Test suite()
      {
          // All methods starting with "test" will be executed in the test suite.
          return new DatasourceEnabledTestSuite(TestRDBMS.class);
      }
      /**
       * Defines the testcase name for JUnit.
       * 
       * @param name
       *            the testcase's name.
       */
      public TestRDBMS(String name)
      {
          super(name);
      }
      public void testHSQL_1() throws Exception
      {
          Class.forName(jdbcDriver.class.getName());
          Connection conn = DriverManager.getConnection("jdbc:hsqldb:hsql://127.0.0.1", "sa", "");
          assertNotNull(conn);
          assertFalse(conn.isClosed());
          conn.close();
      }
      public void testDBCP_1() throws Exception
      {
          assertTrue(DatasourceComponent.class.isAssignableFrom(DBCPDatasourceComponent.class));
          MutablePicoContainer defaultContainer = getComponentManager().getRootContainer();
          DatasourceComponent dsc = (DatasourceComponent) defaultContainer
          .getComponentInstance(DatasourceComponent.class);
          assertNotNull(dsc);
          DataSource ds = dsc.getDatasource();
          assertNotNull(ds);
          Connection conn = ds.getConnection();
          assertNotNull(conn);
          assertFalse(conn.isClosed());
          conn.close();
      }
  
  }
  
  
  

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