mcconnell    2003/10/14 03:53:41

  Modified:    merlin/platform/xdocs/starting/advanced index.xml
                        navigation.xml
  Added:       merlin/platform/xdocs/starting/advanced/unit example.xml
                        index.xml navigation.xml
  Log:
  Addition of documetation concerning unit tests that leverage Merlin as a component 
factory.
  
  Revision  Changes    Path
  1.6       +4 -0      avalon/merlin/platform/xdocs/starting/advanced/index.xml
  
  Index: index.xml
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/platform/xdocs/starting/advanced/index.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- index.xml 4 Oct 2003 11:08:40 -0000       1.5
  +++ index.xml 14 Oct 2003 10:53:41 -0000      1.6
  @@ -82,6 +82,10 @@
                   export statements that isolate a block implementation from the 
services 
                   it provides.</td>
             </tr>
  +          <tr>
  +            <td><a href="unit/index.html">Unit Tests</a></td>
  +            <td>Setting up unit tests the leverage merlin as the component 
factory.</td>
  +          </tr>
           </table>
       </section>
     </body>
  
  
  
  1.6       +1 -0      avalon/merlin/platform/xdocs/starting/advanced/navigation.xml
  
  Index: navigation.xml
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/platform/xdocs/starting/advanced/navigation.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- navigation.xml    4 Oct 2003 11:08:40 -0000       1.5
  +++ navigation.xml    14 Oct 2003 10:53:41 -0000      1.6
  @@ -72,6 +72,7 @@
             <item name="Deployment Templates" 
href="/starting/advanced/profiles.html"/>
             <item name="Profile Selection" href="/starting/advanced/selection.html"/>
             <item name="Composition" href="/starting/advanced/composite.html"/>
  +          <item name="Unit Test" href="/starting/advanced/unit/index.html"/>
           </item>
         </item>
         <item name="Merlin System" href="/merlin/index.html"/>
  
  
  
  1.1                  avalon/merlin/platform/xdocs/starting/advanced/unit/example.xml
  
  Index: example.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <!--
   ============================================================================
                     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 [EMAIL PROTECTED]
  
   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/.
  -->
  
  <document>
    <header>
      <title>Using Merlin</title>
      <authors>
        <person name="Stephen McConnell" email="[EMAIL PROTECTED]"/>
      </authors>
    </header>
    <body>
      <section name="Advanced Features">
        <subsection name="Unit Test Example">
          <p>
          The section presents a complete example of the unit test 
          included in the hello tutorial.
          </p>
          <p><i>block.xml<br/>
          Definition of a container holding a single componet.
          </i></p>
  <source><![CDATA[
  <container name="tutorial">
     <component name="hello" class="tutorial.HelloComponent"/>
  </container>
  ]]></source>
          <p>
          The test case implementation.
          </p>
  <source><![CDATA[
  package tutorial;
  
  import org.apache.avalon.merlin.unit.AbstractMerlinTestCase;
  
  /**
   * Hello Test Case.
   *
   * @author [EMAIL PROTECTED]
   */
  public class StandardTestCase extends AbstractMerlinTestCase
  {
  
      //--------------------------------------------------------
      // constructors
      //--------------------------------------------------------
  
     /**
      * @param name the name of the test case
      * @param root the merlin system install directory
      */
      public StandardTestCase( String name )
      {
          super( 
            MAVEN_TARGET_CLASSES_DIR, 
            MERLIN_DEFAULT_CONFIG_FILE, 
            MERLIN_DEBUG_OFF, 
            MERLIN_INFO_OFF, 
            name );
      }
  
      //--------------------------------------------------------
      // testcase
      //--------------------------------------------------------
  
      public void testServiceResolution() throws Exception
      {
          Object hello = resolve( "hello" );
          assertTrue( hello != null );
          getLogger().info( "Hello established." );
      }
  }
  ]]></source>
        </subsection>
      </section>
    </body>
  
  </document>
  
  
  
  
  
  1.1                  avalon/merlin/platform/xdocs/starting/advanced/unit/index.xml
  
  Index: index.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <!--
   ============================================================================
                     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 [EMAIL PROTECTED]
  
   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/.
  -->
  
  <document>
    <header>
      <title>Using Merlin</title>
      <authors>
        <person name="Stephen McConnell" email="[EMAIL PROTECTED]"/>
      </authors>
    </header>
    <body>
      <section name="Advanced Features">
        <subsection name="Unit Tests">
          <p>
          The Merlin platform provides an abstract test case class that you
          can use as a component factory.  To create a Merlin based unit
          test you simply extend AbstractMerlinTestCase.
          </p>
          <p>
          To use AbstractMerlinTestCase you should include the following 
          dependency in you maven project definition.
          </p>
  <source><![CDATA[
      <dependency>
        <groupId>merlin</groupId>
        <artifactId>merlin-unit</artifactId>
        <version>3.1-dev</version>
      </dependency>
  ]]></source>
          <p>
          The following code fragment declares a new test case using the 
          abstract Merlin test case.
          </p>
          <source>
  import org.apache.avalon.merlin.unit.AbstractMerlinTestCase;
  
  public class ExampleTestCase extends AbstractMerlinTestCase
  {
      public ExampleTestCase( String name )
      {
          super( name );
      }
  
      // ...
  }
          </source>
          <p>
          The default behaviour it to deploy a block based on the 
          deployment path ${basedir}/target/classes/.  Merlin will attempt
          to locate a block.xml file at the [DEPLOYMENT-PATH]/BLOCK-INF/block.xml. 
          To make sure that a block.xml file and component meta-info is available 
under 
          ${basedir}/target/classes/ and you need to include the following resource
          statement in you maven project descriptor.
          </p>
  <source><![CDATA[
    <build>
      <sourceDirectory>${basedir}/src/java/</sourceDirectory>
      <unitTestSourceDirectory>${basedir}/src/test/</unitTestSourceDirectory>
      <resources>
        <resource>
          <directory>${basedir}/conf</directory>
          <targetPath>BLOCK-INF</targetPath>
          <includes>
            <include>block.xml</include>
          </includes>
        </resource>
        <resource>
          <directory>${basedir}/src/java</directory>
          <includes>
            <include>**/*.x*</include>
          </includes>
        </resource>
      </resources>
    </build>
  ]]></source>
  
          <p>
          You can now access components established by Merlin via 
          the component name.  For example, if you block.xml defines
          a component named "hello" you access the component by 
          requesting the relative path "hello".  Relative paths are 
          resolved relative to the container defined by your block
          defintion.
          </p>
          <p>
          The following code fragment demonstrates the usage of the 
          resolve method to locate a named component and a convinience 
          getLogger() method.
          </p>
  <source><![CDATA[
  public void testServiceResolution() throws Exception
  {
      Hello hello = (Hello) resolve( "hello" );
      assertTrue( hello != null );
      getLogger().info( "Message from hello service: " + hello.getMessage() );
  }
  ]]></source>
  
        </subsection>
        <subsection name="Customizing Merlin behaviour">
          <p>
          The abstract test case include a constructor that allows
          control over the deployment path, configuration, debugging 
          and info generation policies.  Please refer to the supporting
          javadoc for more details.
          </p>
  <source><![CDATA[
  public StandardTestCase( String name )
  {
      super( 
        MAVEN_TARGET_TEST_CLASSES_DIR, 
        MERLIN_DEFAULT_CONFIG_FILE, 
        MERLIN_DEBUG_OFF, 
        MERLIN_INFO_OFF, 
        name );
      }
  ]]></source>
        </subsection>
      </section>
    </body>
  
  </document>
  
  
  
  
  
  
  
  1.1                  
avalon/merlin/platform/xdocs/starting/advanced/unit/navigation.xml
  
  Index: navigation.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <!--
   ============================================================================
                     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 [EMAIL PROTECTED]
  
   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/.
  -->
  
  <project>
   <title>Merlin</title>
  
   <body>
  
       <links>
         <item name="Home" href="http://avalon.apache.org/"/>
         <item name="Framework" href="http://avalon.apache.org/framework/"/>
         <item name="Components" href="http://avalon.apache.org/components"/>
         <item name="Containers" href="http://avalon.apache.org/containers/"/>
         <item name="Sandbox" href="http://avalon.apache.org/sandbox/"/>
       </links>
  
      <menu name="About Merlin">
        <item name="Overview" href="/about/index.html"/>
        <item name="Getting Started" href="/starting/index.html">
          <item name="Installation" href="/starting/installation.html"/>
          <item name="Using Merlin" href="/starting/tutorial/index.html"/>
          <item name="Advanced Features" href="/starting/advanced/index.html">
            <item name="Lifecycle Extensions" 
href="/starting/advanced/lifecycle/index.html"/>
            <item name="Contextualization" href="/starting/advanced/context.html"/>
            <item name="Deployment Templates" href="/starting/advanced/profiles.html"/>
            <item name="Profile Selection" href="/starting/advanced/selection.html"/>
            <item name="Composition" href="/starting/advanced/composite.html"/>
            <item name="Unit Test" href="/starting/advanced/unit/index.html">
              <item name="Hello Example" href="/starting/advanced/unit/example.html"/>
            </item>
          </item>
        </item>
        <item name="Merlin System" href="/merlin/index.html"/>
        <item name="Meta Model" href="/meta/index.html"/>
        <item name="Tools" href="/tools/index.html"/>
      </menu>
  
      <menu name="Resources">
        <item name="Javadoc" href="/api/index.html"/>
        <item name="Download" href="/resources/download.html"/>
        <item name="Roadmap" href="/resources/roadmap/index.html"/>
        <item name="DPML" href="/dpml/index.html"/>
      </menu>
  
   </body>
  
  </project>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to