avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance PlaygroundTestCase.java AbstractTestCase.java RuntimeTestCase.java
Date Mon, 19 Jan 2004 16:20:09 GMT
mcconnell    2004/01/19 08:20:09

  Modified:    merlin/activation/impl/src/test/org/apache/avalon/activation/appliance
                        AbstractTestCase.java
  Added:       merlin/activation/impl/src/test/conf playground.xml
               merlin/activation/impl/src/test/org/apache/avalon/activation/appliance
                        PlaygroundTestCase.java
  Removed:     merlin/activation/impl/src/test/conf block.xml
               merlin/activation/impl/src/test/org/apache/avalon/activation/appliance
                        RuntimeTestCase.java
  Log:
  Clean up testcase names.
  
  Revision  Changes    Path
  1.1                  avalon/merlin/activation/impl/src/test/conf/playground.xml
  
  Index: playground.xml
  ===================================================================
  
  <!--
  Example block deployment descriptor.
  -->
  
  <container name="playground">
  
     <classloader>
       <classpath>
         <fileset dir="."/>
         <repository>
           <resource id="avalon-framework:avalon-framework-impl" version="4.1.5"/>
         </repository>
       </classpath>
     </classloader>
  
     <services>
       <service type="org.apache.avalon.playground.basic.BasicService" version="1.1">
         <source>basic</source>
       </service>
     </services>
  
     <container name="subsidiary">
  
       <component name="complex"
             class="org.apache.avalon.playground.ComplexComponent" activation="startup"/>
  
       <container name="test">
         <component name="simple" class="org.apache.avalon.playground.SimpleComponent"/>
       </container>
  
     </container>
  
     <!--
     Commenting the following out to validate demand-driven discovery in 
     combination with automated assembly.
     -->
     <!--
     <component name="demo" 
       class="org.apache.avalon.playground.DemoManager"/>
     
     <component name="exploitation" 
       class="org.apache.avalon.playground.ExploitationManager"/>
  
     <component name="basic"
         class="org.apache.avalon.playground.basic.BasicComponent"
         activation="startup">
       <context class="org.apache.avalon.playground.basic.BasicContextImp">
         <entry key="location">
           <constructor>My Place</constructor>
         </entry>
         <entry key="home">
           <import key="urn:avalon:home.dir"/>
         </entry>
       </context>
     </component>
     -->
  
  </container>
  
  
  
  1.7       +73 -1     avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/AbstractTestCase.java
  
  Index: AbstractTestCase.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/AbstractTestCase.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AbstractTestCase.java	13 Jan 2004 11:41:23 -0000	1.6
  +++ AbstractTestCase.java	19 Jan 2004 16:20:09 -0000	1.7
  @@ -54,17 +54,25 @@
   
   import junit.framework.TestCase;
   
  +import org.apache.avalon.activation.appliance.impl.AbstractBlock;
  +
   import org.apache.avalon.composition.data.ContainmentProfile;
   import org.apache.avalon.composition.data.builder.XMLContainmentProfileCreator;
   import org.apache.avalon.composition.logging.LoggingManager;
   import org.apache.avalon.composition.model.ContainmentModel;
   import org.apache.avalon.composition.model.SystemContext;
   import org.apache.avalon.composition.model.impl.DefaultSystemContext;
  +
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
   import org.apache.avalon.framework.logger.ConsoleLogger;
   import org.apache.avalon.framework.logger.Logger;
   import org.apache.avalon.framework.parameters.Parameters;
  +import org.apache.avalon.framework.activity.Disposable;
  +
  +import org.apache.avalon.util.exception.ExceptionHelper;
  +
  +
   
   
   public abstract class AbstractTestCase extends TestCase
  @@ -113,7 +121,6 @@
           File base = new File( getTestDir(), "test-classes" );
   
           //
  -        // WARNING: ALMOST EVIL
           // Next couple of lines are using a convinience operation
           // on DefaultSystemContext to create the system context.  This 
           // is temporary and will be replaced when a clean configurable 
  @@ -152,6 +159,71 @@
       protected Logger getLogger()
       {
           return m_logger;
  +    }
  +
  +   //-------------------------------------------------------
  +   // tests
  +   //-------------------------------------------------------
  +
  +   /**
  +    * Validate the composition model.
  +    */
  +    public void executeDeploymentCycle() throws Exception
  +    {
  +
  +        //
  +        // 1. assemble the model during which all dependencies
  +        //    are resolved (deployment and runtime)
  +        //
  +
  +        getLogger().debug( "model assembly" );
  +        m_model.assemble();
  +
  +        //
  +        // 2. create the root block using the service context
  +        //    and the root containment model
  +        //
  +
  +        getLogger().debug( "creating root block" );
  +        Block block = AbstractBlock.createRootBlock( m_model );
  +        getLogger().debug( "block: " + block );
  +
  +        //
  +        // 3. deploy the block during which any 'activate on startup'
  +        //    components are created which in turn my cause activation
  +        //    of lazy components
  +        //
  +
  +        block.deploy();
  +
  +        //
  +        // 4-5. suspend and resume the root block (not implemented yet)
  +        //
  +        // 6. decommission the block during which all managed appliances
  +        //    are decommissioned resulting in the decommissioning of all
  +        //    appliance instances
  +        //
  +
  +        block.decommission();
  +
  +        //
  +        // 7. disassemble the block during which reference between 
  +        //    appliances established at assembly time are discarded
  +        //
  +
  +        block.getContainmentModel().disassemble();
  +
  +        //
  +        // 8. dispose of the appliance during which all subsidiary 
  +        //    appliances are disposed of in an orderly fashion
  +        //
  +
  +        if( block instanceof Disposable )
  +        {
  +            ((Disposable)block).dispose();
  +        }
  +
  +        assertTrue( true );
       }
   
   }
  
  
  
  1.1                  avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/PlaygroundTestCase.java
  
  Index: PlaygroundTestCase.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, 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 "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  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", 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 (INCLU-
   DING, 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.avalon.activation.appliance;
  
  public class PlaygroundTestCase extends AbstractTestCase
  {
     //-------------------------------------------------------
     // constructor
     //-------------------------------------------------------
  
      public PlaygroundTestCase( )
      {
          this( "model" );
      }
  
      public PlaygroundTestCase( String name )
      {
          super( name );
      }
  
     //-------------------------------------------------------
     // setup
     //-------------------------------------------------------
  
     public String getPath()
     {
        return "playground.xml";
     }
  
     //-------------------------------------------------------
     // test
     //-------------------------------------------------------
  
     /**
      * Create, assembly, deploy and decommission the block 
      * defined by getPath().
      */
      public void testDeploymentCycle() throws Exception
      {
          try
          {
              executeDeploymentCycle();
          }
          catch( Throwable e )
          {
              final String error = "Playground test failure.";
              final String message = ExceptionHelper.packException( error, e, true );
              getLogger().error( message );
              throw new Exception( message );
          }
      }
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message