You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by ep...@apache.org on 2003/10/27 10:27:31 UTC

cvs commit: jakarta-turbine-fulcrum/testcontainer/xdocs changes.xml

epugh       2003/10/27 01:27:31

  Modified:    testcontainer/src/java/org/apache/fulcrum/testcontainer
                        Container.java BaseUnitTest.java
               testcontainer/src/test/org/apache/fulcrum/testcontainer
                        SimpleComponentImpl.java ContainerTest.java
                        AlternativeComponentImpl.java
               testcontainer/xdocs changes.xml
  Log:
  Update to use componentAppRoot, not ComponentAppRoot.
  
  Revision  Changes    Path
  1.3       +9 -5      jakarta-turbine-fulcrum/testcontainer/src/java/org/apache/fulcrum/testcontainer/Container.java
  
  Index: Container.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/testcontainer/src/java/org/apache/fulcrum/testcontainer/Container.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Container.java	20 Aug 2003 18:06:55 -0000	1.2
  +++ Container.java	27 Oct 2003 09:27:31 -0000	1.3
  @@ -53,10 +53,11 @@
    * <http://www.apache.org/>.
    */
   import java.io.File;
  +
   import org.apache.avalon.excalibur.component.DefaultRoleManager;
   import org.apache.avalon.excalibur.component.ExcaliburComponentManager;
  -import org.apache.avalon.excalibur.logger.LoggerManager;
   import org.apache.avalon.excalibur.logger.Log4JLoggerManager;
  +import org.apache.avalon.excalibur.logger.LoggerManager;
   import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.activity.Initializable;
   import org.apache.avalon.framework.component.Component;
  @@ -74,6 +75,9 @@
    */
   public class Container extends AbstractLogEnabled implements Initializable, Disposable
   {
  +	/** Key used in the context for defining the application root */
  +	public static String COMPONENT_APP_ROOT = "componentAppRoot";
  +	
       /** Component manager */
       private ExcaliburComponentManager manager = new ExcaliburComponentManager();
       /** Configurqation file */
  @@ -101,9 +105,9 @@
           getLogger().debug("Starting container...");
           this.configFileName = configFileName;
           this.roleFileName = roleFileName;
  -        File configFile = new File(configFileName);
  +        File configFile = new File(configFileName);        
           if (!configFile.exists())
  -        {
  +        {            
               throw new RuntimeException(
                   "Could not initialize the container because the config file could not be found:" + configFile);
           }
  @@ -151,7 +155,7 @@
           this.manager.setLoggerManager(lm);
           this.manager.enableLogging(lm.getLoggerForCategory("org.apache.fulcrum"));
           DefaultContext context = new DefaultContext();
  -        context.put("ComponentAppRoot", (new File("")).getAbsolutePath());
  +        context.put(COMPONENT_APP_ROOT, (new File("")).getAbsolutePath());
           this.manager.contextualize(context);
           
           this.manager.configure(sysConfig);
  
  
  
  1.3       +4 -1      jakarta-turbine-fulcrum/testcontainer/src/java/org/apache/fulcrum/testcontainer/BaseUnitTest.java
  
  Index: BaseUnitTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/testcontainer/src/java/org/apache/fulcrum/testcontainer/BaseUnitTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BaseUnitTest.java	20 Aug 2003 17:04:01 -0000	1.2
  +++ BaseUnitTest.java	27 Oct 2003 09:27:31 -0000	1.3
  @@ -67,6 +67,9 @@
    */
   public class BaseUnitTest extends TestCase
   {
  +	/** Key used in the context for defining the application root */
  +	public static String COMPONENT_APP_ROOT = Container.COMPONENT_APP_ROOT;
  +	
       /** Container for the components */
       private Container container;
       /** Setup our default configurationFileName */
  
  
  
  1.2       +2 -2      jakarta-turbine-fulcrum/testcontainer/src/test/org/apache/fulcrum/testcontainer/SimpleComponentImpl.java
  
  Index: SimpleComponentImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/testcontainer/src/test/org/apache/fulcrum/testcontainer/SimpleComponentImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SimpleComponentImpl.java	1 May 2003 17:33:09 -0000	1.1
  +++ SimpleComponentImpl.java	27 Oct 2003 09:27:31 -0000	1.2
  @@ -91,6 +91,6 @@
   
       public void contextualize(Context context) throws ContextException
       {
  -        appRoot = (String) context.get("ComponentAppRoot");
  +        appRoot = (String) context.get("componentAppRoot");
       }
   }
  
  
  
  1.4       +90 -80    jakarta-turbine-fulcrum/testcontainer/src/test/org/apache/fulcrum/testcontainer/ContainerTest.java
  
  Index: ContainerTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/testcontainer/src/test/org/apache/fulcrum/testcontainer/ContainerTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ContainerTest.java	20 Aug 2003 18:06:55 -0000	1.3
  +++ ContainerTest.java	27 Oct 2003 09:27:31 -0000	1.4
  @@ -1,82 +1,71 @@
   package org.apache.fulcrum.testcontainer;
  -/* ====================================================================
  - * The Apache Software License, Version 1.1
  - *
  - * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
  - * reserved.
  - *
  +/*
  + * ==================================================================== The
  + * Apache Software License, Version 1.1
  + * 
  + * Copyright (c) 2001-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 Turbine" 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 Turbine", 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.
  + * 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 Turbine"
  + * 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
  + * Turbine", 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/>.
  + * 
  + * 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/> .
    */
   import java.io.File;
   import org.apache.avalon.framework.component.ComponentException;
   import junit.framework.TestSuite;
   /**
    * Basic testing of the Container
  - *
  + * 
    * @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
    * @version $Id$
    */
   public class ContainerTest extends BaseUnitTest
   {
       /**
  -     * Constructor for test.
  -     *
  -     * @param testName name of the test being executed
  -     */
  +	 * Constructor for test.
  +	 * 
  +	 * @param testName name of the test being executed
  +	 */
       public ContainerTest(String testName)
       {
           super(testName);
       }
       /**
  -     * Factory method for creating a TestSuite for this class.
  -     *
  -     * @return the test suite
  -     */
  +	 * Factory method for creating a TestSuite for this class.
  +	 * 
  +	 * @return the test suite
  +	 */
       public static TestSuite suite()
       {
           TestSuite suite = new TestSuite(ContainerTest.class);
  @@ -122,25 +111,46 @@
           sc.test();
           this.release(sc);
       }
  -    
  -	public void testLoadingContainerWithNoRolesfile()
  -	{
  -		SimpleComponent sc = null;
   
  -		this.setRoleFileName(null);
  -		this.setConfigurationFileName("src/test/TestComponentConfigIntegratedRoles.xml");
  -		try
  -		{
  -			sc = (SimpleComponent) this.lookup(SimpleComponent.ROLE);
  -		}
  -		catch (ComponentException e)
  -		{
  -			e.printStackTrace();
  -			fail(e.getMessage());
  -		}
  -		assertTrue(sc instanceof AlternativeComponentImpl);
  -		assertNotNull(sc);
  -		sc.test();
  -		this.release(sc);
  -	}    
  +    public void testLoadingContainerWithNoRolesfile()
  +    {
  +        SimpleComponent sc = null;
  +
  +        this.setRoleFileName(null);
  +        this.setConfigurationFileName(
  +            "src/test/TestComponentConfigIntegratedRoles.xml");
  +        try
  +        {
  +            sc = (SimpleComponent) this.lookup(SimpleComponent.ROLE);
  +        }
  +        catch (ComponentException e)
  +        {
  +            e.printStackTrace();
  +            fail(e.getMessage());
  +        }
  +        assertTrue(sc instanceof AlternativeComponentImpl);
  +        assertNotNull(sc);
  +        sc.test();
  +        this.release(sc);
  +    }
  +
  +    public void testLoadingNonExistentFile()
  +    {
  +        SimpleComponent sc = null;
  +
  +        this.setRoleFileName(null);
  +        this.setConfigurationFileName("BogusFile.xml");
  +        try
  +        {
  +            sc = (SimpleComponent) this.lookup(SimpleComponent.ROLE);
  +        }
  +        catch(RuntimeException re){
  +            //good
  +        }
  +        catch (ComponentException e)
  +        {
  +            
  +            fail(e.getMessage());
  +        }
  +    }
   }
  
  
  
  1.2       +2 -2      jakarta-turbine-fulcrum/testcontainer/src/test/org/apache/fulcrum/testcontainer/AlternativeComponentImpl.java
  
  Index: AlternativeComponentImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/testcontainer/src/test/org/apache/fulcrum/testcontainer/AlternativeComponentImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AlternativeComponentImpl.java	20 Aug 2003 17:04:01 -0000	1.1
  +++ AlternativeComponentImpl.java	27 Oct 2003 09:27:31 -0000	1.2
  @@ -91,6 +91,6 @@
   
       public void contextualize(Context context) throws ContextException
       {
  -        appRoot = (String) context.get("ComponentAppRoot");
  +        appRoot = (String) context.get("componentAppRoot");
       }
   }
  
  
  
  1.2       +5 -0      jakarta-turbine-fulcrum/testcontainer/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/testcontainer/xdocs/changes.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- changes.xml	8 Sep 2003 15:31:37 -0000	1.1
  +++ changes.xml	27 Oct 2003 09:27:31 -0000	1.2
  @@ -8,6 +8,11 @@
   
     <body>
       <release version="Not applicable" date="">
  +      <action dev="epugh" type="update">
  +        Changed the name of the component app root to "componentAppRoot" from
  +        "ComponentAppRoot".  This matches what Turbine uses.  Really, this should
  +        be a configurable thing, not a hardcoded context value.
  +      </action>
         <action dev="epugh" type="add">
           TestContainer can accept either the split role.xml, config.xml
           or just a single combined xml file.  Additionally, by lazy loading
  
  
  

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