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/11 20:40:16 UTC

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

weaver      2004/05/11 11:40:16

  Modified:    components/rdbms/src/test/org/apache/jetspeed/components
                        Tag: NANOCONTAINER_DEPLOYER TestRDBMS.java
  Added:       components/rdbms/src/test Tag: NANOCONTAINER_DEPLOYER
                        log4j.properties
  Log:
  - lowercased log4j so it is automatically loaded
  - uses new test suite in test cases
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.2.1   +43 -0     jakarta-jetspeed-2/components/rdbms/src/test/Attic/log4j.properties
  
  
  
  
  No                   revision
  No                   revision
  1.5.2.2   +76 -74    jakarta-jetspeed-2/components/rdbms/src/test/org/apache/jetspeed/components/TestRDBMS.java
  
  Index: TestRDBMS.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/rdbms/src/test/org/apache/jetspeed/components/TestRDBMS.java,v
  retrieving revision 1.5.2.1
  retrieving revision 1.5.2.2
  diff -u -r1.5.2.1 -r1.5.2.2
  --- TestRDBMS.java	19 Apr 2004 21:09:07 -0000	1.5.2.1
  +++ TestRDBMS.java	11 May 2004 18:40:16 -0000	1.5.2.2
  @@ -1,74 +1,76 @@
  -/*
  - * Copyright 2000-2004 The Apache Software Foundation.
  - * 
  - * Licensed under the Apache License, Version 2.0 (the "License");
  - * you may not use this file except in compliance with the License.
  - * You may obtain a copy of the License at
  - * 
  - *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  - * Unless required by applicable law or agreed to in writing, software
  - * distributed under the License is distributed on an "AS IS" BASIS,
  - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  - * See the License for the specific language governing permissions and
  - * limitations under the License.
  - */
  -package org.apache.jetspeed.components;
  -import java.io.File;
  -import java.sql.Connection;
  -
  -import javax.sql.DataSource;
  -
  -import junit.framework.Test;
  -
  -import org.apache.jetspeed.components.datasource.DBCPDatasourceComponent;
  -import org.apache.jetspeed.components.datasource.DatasourceComponent;
  -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() throws Exception
  -    {
  -        //ComponentAwareTestSuite suite = new ComponentAwareTestSuite(TestRDBMS.class);
  -        NanoDeployerBasedTestSuite suite = new NanoDeployerBasedTestSuite(TestRDBMS.class);
  -        // suite.setScript("org/apache/jetspeed/containers/rdbms.container.groovy");
  -        suite.setApplicationFolders(new String[] {new File("./target/classes").toURL().toString()});
  -        return suite;
  -    }
  -    
  -    /**
  -     * Defines the testcase name for JUnit.
  -     * 
  -     * @param name
  -     *            the testcase's name.
  -     */
  -    public TestRDBMS(String name)
  -    {
  -        super(name, "./src/test/Log4j.properties");
  -    }
  -    
  -    public void testDBCP_1() throws Exception
  -    {
  -        assertTrue(DatasourceComponent.class.isAssignableFrom(DBCPDatasourceComponent.class));
  -        // MutablePicoContainer defaultContainer = getComponentManager().getRootContainer();
  -        MutablePicoContainer defaultContainer = getContainer();
  -        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();
  -    }
  -
  -}
  +/*
  + * Copyright 2000-2004 The Apache Software Foundation.
  + * 
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + * 
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + * 
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
  +package org.apache.jetspeed.components;
  +import java.sql.Connection;
  +
  +import javax.naming.InitialContext;
  +import javax.sql.DataSource;
  +
  +import junit.framework.Test;
  +
  +import org.apache.jetspeed.components.datasource.DBCPDatasourceComponent;
  +import org.apache.jetspeed.components.datasource.DatasourceComponent;
  +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() throws Exception
  +    {
  +        return new ContainerDeployerTestSuite(TestRDBMS.class, new String[]{"RDBMS"});
  +    }
  +    
  +    /**
  +     * Defines the testcase name for JUnit.
  +     * 
  +     * @param name
  +     *            the testcase's name.
  +     */
  +    public TestRDBMS(String name)
  +    {
  +        super(name);
  +    }
  +    
  +    public void testDBCP_1() throws Exception
  +    {
  +        assertTrue(DatasourceComponent.class.isAssignableFrom(DBCPDatasourceComponent.class));
  +        // MutablePicoContainer defaultContainer = getComponentManager().getRootContainer();
  +        MutablePicoContainer defaultContainer = getContainer();
  +        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();
  +    }
  +    
  +    public void testLookup() throws Exception
  +    {
  +        InitialContext context = new InitialContext();
  +        assertNotNull(context.lookup("java:comp/env/jdbc/jetspeed"));
  +    }
  +
  +}
  
  
  

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