avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon-sandbox/merlin-test/hello/src/test/tutorial StandardTestCase.java
Date Tue, 30 Dec 2003 00:41:20 GMT
mcconnell    2003/12/29 16:41:20

  Added:       merlin-test/hello .cvsignore maven.xml merlin.properties
                        project.xml
               merlin-test/hello/src/java/tutorial Hello.java
                        HelloComponent.java
               merlin-test/hello/src/test/tutorial StandardTestCase.java
  Log:
  Add a example that uses the merlin unit test with multiple tests.
  
  Revision  Changes    Path
  1.1                  avalon-sandbox/merlin-test/hello/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  maven.log
  velocity.log
  build.xml
  build.properties
  target
  maven.log
  working
  .classpath
  .project
  
  
  1.1                  avalon-sandbox/merlin-test/hello/maven.xml
  
  Index: maven.xml
  ===================================================================
  
  <project default="test">
  
    <preGoal name="java:compile">
      <attainGoal name="avalon:meta"/>
    </preGoal>
  
  </project>
  
  
  
  1.1                  avalon-sandbox/merlin-test/hello/merlin.properties
  
  Index: merlin.properties
  ===================================================================
  
  merlin.info = false
  merlin.debug = false
  merlin.deployment = target/classes
  merlin.override = conf/config.xml
  
  
  
  1.1                  avalon-sandbox/merlin-test/hello/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <project>
  
    <extend>${basedir}/../project.xml</extend>
    <groupId>merlin/tutorial</groupId>
    <id>hello</id>
    <name>Merlin Hello Tutorials</name>
    <package>tutorial</package>
    <currentVersion>1.1</currentVersion>
  
    <inceptionYear>2003</inceptionYear>
    <shortDescription>Merlin Hello Tutorial</shortDescription>
  
    <description>
  	'Hello' merlin tutorial
    </description>
  
    <dependencies>
  
      <dependency>
        <groupId>avalon-framework</groupId>
        <artifactId>avalon-framework-api</artifactId>
        <version>4.1.5</version>
      </dependency>
  
      <dependency>
        <groupId>merlin</groupId>
        <artifactId>merlin-unit</artifactId>
        <version>3.2.7</version>
      </dependency>
  
    </dependencies>
  
  </project>
  
  
  
  1.1                  avalon-sandbox/merlin-test/hello/src/java/tutorial/Hello.java
  
  Index: Hello.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 tutorial;
  
  /**
   * A sample service interface.
   */
  public interface Hello
  {
      void sayHello();
  }
  
  
  
  1.1                  avalon-sandbox/merlin-test/hello/src/java/tutorial/HelloComponent.java
  
  Index: HelloComponent.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 tutorial;
  
  import org.apache.avalon.framework.logger.Logger;
  import org.apache.avalon.framework.logger.LogEnabled;
  import org.apache.avalon.framework.activity.Disposable;
  import org.apache.avalon.framework.activity.Executable;
  import org.apache.avalon.framework.activity.Initializable;
  
  /**
   * A sample component.  This component implements a number 
   * of lifecycle interface.  Each lifecycle interface is a stage
   * that is processed by a container during the deployment of 
   * the component.  The lifecycle stages demonstrated here include
   * LogEnabled (association of a logging channel), Initializable
   * (initialization of the component), Executable (component
   * execution), and Disposable (componet disposal).  Please note 
   * that all lifecycle stages are optional.
   *
   * @avalon.component version="1.0" name="hello" lifestyle="singleton"
   * @avalon.service type="tutorial.Hello"
   */
  public class HelloComponent 
    implements LogEnabled, Initializable, Executable, Disposable, Hello
  {
  
      public void sayHello()
      {
          getLogger().info( "HELLO" );
      }
  
     /**
      * Internal reference to the logging channel supplied to us 
      * by the container. 
      */
      private Logger m_logger;
  
     /**
      * Supply of a logging channel by the container.
      *
      * @param logger the logging channel for this component
      */
      public void enableLogging( final Logger logger )
      {
          m_logger = logger;
          getLogger().info( "logging" );
      }
  
     /**
      * Initialization of the component by the container.
      * @exception Exception if an initialization error occurs
      */
      public void initialize() throws Exception
      {
          getLogger().info( "initialization" );
      }
  
     /**
      * Component execution trigger by the container following 
      * completion of the initialization stage.
      */
      public void execute()
      {
          getLogger().info( "execution" );
      } 
  
     /**
      * Component disposal trigger by the container during which
      * the component will release consumed resources.
      */
      public void dispose()
      {
          getLogger().info( "disposal" );
          m_logger = null;
      }
  
     /**
      * Return the logging channel assigned to us by the container.
      * @return the logging channel
      */
      private Logger getLogger()
      {
          return m_logger;
      }
  
  }
  
  
  
  1.1                  avalon-sandbox/merlin-test/hello/src/test/tutorial/StandardTestCase.java
  
  Index: StandardTestCase.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 2002-2003 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 tutorial;
  
  import org.apache.avalon.merlin.unit.AbstractMerlinTestCase;
  
  /**
   * Hello Test Case.
   *
   * @author mcconnell@apache.org
   */
  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( name );
      }
  
      //--------------------------------------------------------
      // testcase
      //--------------------------------------------------------
  
      public void testServiceResolution() throws Exception
      {
          Object hello = resolve( "/tutorial/hello" );
          assertTrue( hello != null );
      }
  
      public void testServiceResolutionAgain() throws Exception
      {
          Object hello = resolve( "/tutorial/hello" );
          assertTrue( hello != null );
      }
  
  }
  
  
  
  

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


Mime
View raw message