avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From leosim...@apache.org
Subject cvs commit: avalon-sandbox/magic/impl/src/test/org/apache/avalon/magic/test/impl AssertionConfiguration.java AssertionContext.java AssertionParameters.java TweetyImpl2.java TweetyImpl3.java TweetyImpl4.java Avalon2PicoAdapterTestCase.java
Date Thu, 21 Aug 2003 20:58:31 GMT
leosimons    2003/08/21 13:58:31

  Modified:    magic/impl/src/java/org/apache/avalon/magic/impl
                        Avalon2PicoAdapter.java
               magic/impl/src/test/org/apache/avalon/magic/test/impl
                        Avalon2PicoAdapterTestCase.java
  Added:       magic/impl/src/test/org/apache/avalon/magic/test/impl
                        AssertionConfiguration.java AssertionContext.java
                        AssertionParameters.java TweetyImpl2.java
                        TweetyImpl3.java TweetyImpl4.java
  Log:
  support Parameters, add more tests, squash some bugs.
  
  Revision  Changes    Path
  1.2       +16 -11    avalon-sandbox/magic/impl/src/java/org/apache/avalon/magic/impl/Avalon2PicoAdapter.java
  
  Index: Avalon2PicoAdapter.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/magic/impl/src/java/org/apache/avalon/magic/impl/Avalon2PicoAdapter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Avalon2PicoAdapter.java	16 Aug 2003 15:43:53 -0000	1.1
  +++ Avalon2PicoAdapter.java	21 Aug 2003 20:58:31 -0000	1.2
  @@ -77,6 +77,7 @@
   import org.apache.avalon.framework.configuration.Configurable;
   import org.apache.avalon.framework.activity.Initializable;
   import org.apache.avalon.framework.container.ContainerUtil;
  +import org.apache.avalon.framework.parameters.Parameters;
   
   /**
    * An InvocationHandler that intercepts calls to the avalon-framework
  @@ -85,8 +86,6 @@
    * populated from stuff retrieved from the avalon-framework lifecycle
    * arguments.
    *
  - * TODO: fully support the complete lifecycle
  - *
    * Usage:
    *
    * <pre>
  @@ -385,6 +384,7 @@
           ContainerUtil.service( m_target, getServiceManager() );
           ContainerUtil.contextualize( m_target, getContext() );
           ContainerUtil.configure( m_target, getConfiguration() );
  +        ContainerUtil.parameterize( m_target, Parameters.fromConfiguration( getConfiguration()
) );
           ContainerUtil.initialize( m_target );
   
           initialized = true;
  @@ -398,14 +398,10 @@
   
           for( int i = 0; i < paramTypes.length; i++ )
           {
  -            if( paramTypes[i].isAssignableFrom( Logger.class ) )
  -            {
  -                args.add( i, getLog() );
  -                break;
  -            }
  -            if( paramTypes[i].isAssignableFrom( Context.class ) )
  +            // first try a (reversed) avalon lifecycle ordering
  +            if( paramTypes[i].isAssignableFrom( Parameters.class ) )
               {
  -                args.add( i, getContext() );
  +                args.add( i, Parameters.fromConfiguration( getConfiguration() ) );
                   break;
               }
               if( paramTypes[i].isAssignableFrom( Configuration.class ) )
  @@ -418,13 +414,17 @@
                   args.add( i, getServiceManager() );
                   break;
               }
  -
               if( getServiceManager().hasService( getRole( paramTypes[i] ) ) )
               {
                   Object comp = getServiceManager().lookup( paramTypes[i].getName() );
                   args.add( i, comp );
                   break;
               }
  +            if( paramTypes[i].isAssignableFrom( Context.class ) )
  +            {
  +                args.add( i, getContext() );
  +                break;
  +            }
   
               Object comp = null;
               String role = getRole( paramTypes[i] );
  @@ -439,6 +439,11 @@
               if( comp != null )
               {
                   args.add( i, comp );
  +                break;
  +            }
  +            if( paramTypes[i].isAssignableFrom( Logger.class ) )
  +            {
  +                args.add( i, getLog() );
                   break;
               }
   
  
  
  
  1.2       +161 -4    avalon-sandbox/magic/impl/src/test/org/apache/avalon/magic/test/impl/Avalon2PicoAdapterTestCase.java
  
  Index: Avalon2PicoAdapterTestCase.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/magic/impl/src/test/org/apache/avalon/magic/test/impl/Avalon2PicoAdapterTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Avalon2PicoAdapterTestCase.java	16 Aug 2003 15:43:53 -0000	1.1
  +++ Avalon2PicoAdapterTestCase.java	21 Aug 2003 20:58:31 -0000	1.2
  @@ -54,12 +54,14 @@
    */
   package org.apache.avalon.magic.test.impl;
   
  +import java.io.File;
  +
   import org.apache.avalon.framework.logger.Logger;
  +import org.apache.avalon.framework.logger.ConsoleLogger;
   import org.apache.avalon.framework.container.ContainerUtil;
   import org.apache.avalon.framework.context.DefaultContext;
   import org.apache.avalon.framework.configuration.DefaultConfiguration;
   import org.apache.avalon.framework.service.DefaultServiceManager;
  -import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.avalon.magic.impl.Avalon2PicoAdapter;
   
   import junit.framework.TestCase;
  @@ -74,18 +76,173 @@
   {
       public void testLogEnabledPicoComponent() throws Exception
       {
  -        AssertionLogger logger = new AssertionLogger( this );
           Tweety tweety = (Tweety)Avalon2PicoAdapter.getProxy( TweetyImpl.class );
   
  +        AssertionLogger logger = new AssertionLogger( this );
           ContainerUtil.enableLogging( tweety, logger );
           ContainerUtil.contextualize( tweety, new DefaultContext() );
           ContainerUtil.service( tweety, new DefaultServiceManager() );
           ContainerUtil.configure( tweety, new DefaultConfiguration( "blah" ) );
  -        ContainerUtil.parameterize( tweety, new Parameters() );
  +        //ContainerUtil.parameterize( tweety, new Parameters() ); -- from config
           ContainerUtil.initialize( tweety );
           ContainerUtil.start( tweety );
   
           tweety.chilp();
           assertTrue( "The Logger was not properly passed to the proxied pico-style component",
logger.isInfoCalled() );
  +    }
  +
  +    public void testContextualizablePicoComponent() throws Exception
  +    {
  +        Tweety tweety = (Tweety)Avalon2PicoAdapter.getProxy( TweetyImpl2.class );
  +
  +        Logger logger = new ConsoleLogger();
  +        ContainerUtil.enableLogging( tweety, logger );
  +
  +        AssertionContext context = new AssertionContext();
  +        context.put( File.class.getName(), new File(".") );
  +        context.makeReadOnly();
  +        ContainerUtil.contextualize( tweety, context );
  +        ContainerUtil.service( tweety, new DefaultServiceManager() );
  +        ContainerUtil.configure( tweety, new DefaultConfiguration( "blah" ) );
  +        //ContainerUtil.parameterize( tweety, new Parameters() ); -- from config
  +        ContainerUtil.initialize( tweety );
  +        ContainerUtil.start( tweety );
  +
  +        tweety.chilp();
  +        assertTrue( "The homedir was not passed by retrieving it from the context", context.isGetCalled()
);
  +    }
  +
  +    public void testServicablePicoComponent() throws Exception
  +    {
  +        Tweety tweety = (Tweety)Avalon2PicoAdapter.getProxy( TweetyImpl2.class );
  +
  +        Logger logger = new ConsoleLogger();
  +        ContainerUtil.enableLogging( tweety, logger );
  +
  +        DefaultContext context = new DefaultContext();
  +        context.makeReadOnly();
  +        ContainerUtil.contextualize( tweety, context );
  +
  +        AssertionServiceManager sm = new AssertionServiceManager();
  +        sm.put( File.class.getName(), new File(".") );
  +        sm.makeReadOnly();
  +        ContainerUtil.service( tweety, sm );
  +        ContainerUtil.configure( tweety, new DefaultConfiguration( "blah" ) );
  +        //ContainerUtil.parameterize( tweety, new Parameters() ); -- from config
  +        ContainerUtil.initialize( tweety );
  +        ContainerUtil.start( tweety );
  +
  +        tweety.chilp();
  +        assertTrue( "The homedir was not passed by retrieving it from the servicemanager",
sm.isLookupCalled() );
  +    }
  +
  +    public void testConfigurablePicoComponent() throws Exception
  +    {
  +        Tweety tweety = (Tweety)Avalon2PicoAdapter.getProxy( TweetyImpl3.class );
  +
  +        Logger logger = new ConsoleLogger();
  +        ContainerUtil.enableLogging( tweety, logger );
  +
  +        DefaultContext context = new DefaultContext();
  +        context.makeReadOnly();
  +        ContainerUtil.contextualize( tweety, context );
  +
  +        DefaultServiceManager sm = new DefaultServiceManager();
  +        sm.makeReadOnly();
  +        ContainerUtil.service( tweety, sm );
  +
  +        AssertionConfiguration conf = new AssertionConfiguration( "blah" );
  +        conf.setAttribute( "message", "dummy message");
  +        conf.makeReadOnly();
  +        ContainerUtil.configure( tweety, conf );
  +        //ContainerUtil.parameterize( tweety, new Parameters() );
  +        ContainerUtil.initialize( tweety );
  +        ContainerUtil.start( tweety );
  +
  +        tweety.chilp();
  +        assertTrue( "The message was not passed by retrieving it from the configuration",
conf.isGetAttributeCalled() );
  +    }
  +
  +    public void testParameterizedPicoComponent() throws Exception
  +    {
  +        // note the difference: TweetyImpl4 is 'parameterizable',
  +        // not configurable
  +        Tweety tweety = (Tweety)Avalon2PicoAdapter.getProxy( TweetyImpl4.class );
  +
  +        Logger logger = new ConsoleLogger();
  +        ContainerUtil.enableLogging( tweety, logger );
  +
  +        DefaultContext context = new DefaultContext();
  +        context.makeReadOnly();
  +        ContainerUtil.contextualize( tweety, context );
  +
  +        DefaultServiceManager sm = new DefaultServiceManager();
  +        sm.makeReadOnly();
  +        ContainerUtil.service( tweety, sm );
  +
  +        AssertionConfiguration conf = new AssertionConfiguration( "blah" );
  +        AssertionConfiguration conf2 = new AssertionConfiguration( "parameter" );
  +        conf2.setAttribute( "name", "message");
  +        conf2.setAttribute( "value", "empty message");
  +        conf2.makeReadOnly();
  +        conf.addChild( conf2 );
  +        conf.makeReadOnly();
  +        ContainerUtil.configure( tweety, conf );
  +        //ContainerUtil.parameterize( tweety, new Parameters() );
  +        ContainerUtil.initialize( tweety );
  +        ContainerUtil.start( tweety );
  +
  +        tweety.chilp();
  +        assertTrue( "The message was not passed by retrieving it from the configuration",
conf2.isGetAttributeCalled() );
  +    }
  +
  +    public void testServicedLoggerOverridesLogEnabledLogger() throws Exception
  +    {
  +        Tweety tweety = (Tweety)Avalon2PicoAdapter.getProxy( TweetyImpl.class );
  +
  +        AssertionLogger firstlogger = new AssertionLogger( this );
  +        ContainerUtil.enableLogging( tweety, firstlogger );
  +        ContainerUtil.contextualize( tweety, new DefaultContext() );
  +
  +        AssertionLogger secondlogger = new AssertionLogger( this );
  +        DefaultServiceManager sm = new DefaultServiceManager();
  +        sm.put( Logger.class.getName(), secondlogger );
  +        sm.makeReadOnly();
  +        ContainerUtil.service( tweety, sm );
  +        ContainerUtil.configure( tweety, new DefaultConfiguration( "blah" ) );
  +        //ContainerUtil.parameterize( tweety, new Parameters() ); -- from config
  +        ContainerUtil.initialize( tweety );
  +        ContainerUtil.start( tweety );
  +
  +        tweety.chilp();
  +        assertFalse( "The first Logger was used by the proxied pico-style component", firstlogger.isInfoCalled()
);
  +        assertTrue( "The second Logger was not used by the proxied pico-style component",
secondlogger.isInfoCalled() );
  +    }
  +
  +    public void testServicedFileOverridesContextualizedFile() throws Exception
  +    {
  +        Tweety tweety = (Tweety)Avalon2PicoAdapter.getProxy( TweetyImpl2.class );
  +
  +        ConsoleLogger logger = new ConsoleLogger();
  +        ContainerUtil.enableLogging( tweety, logger );
  +
  +        AssertionContext context = new AssertionContext();
  +        context.put( File.class.getName(), new File(".") );
  +        context.makeReadOnly();
  +        ContainerUtil.contextualize( tweety, context );
  +
  +        AssertionServiceManager sm = new AssertionServiceManager();
  +        sm.put( File.class.getName(), new File(".") );
  +        sm.makeReadOnly();
  +        ContainerUtil.service( tweety, sm );
  +        ContainerUtil.configure( tweety, new DefaultConfiguration( "blah" ) );
  +        //ContainerUtil.parameterize( tweety, new Parameters() ); -- from config
  +        ContainerUtil.initialize( tweety );
  +        ContainerUtil.start( tweety );
  +
  +        tweety.chilp();
  +        assertFalse( "The first File was used by the proxied pico-style component", context.isGetCalled()
);
  +        assertTrue( "The second File was not used by the proxied pico-style component",
sm.isLookupCalled() );
  +
       }
   }
  
  
  
  1.1                  avalon-sandbox/magic/impl/src/test/org/apache/avalon/magic/test/impl/AssertionConfiguration.java
  
  Index: AssertionConfiguration.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1997-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 "Avalon", 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 (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/>.
   */
  package org.apache.avalon.magic.test.impl;
  
  import org.apache.avalon.framework.configuration.DefaultConfiguration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  
  /**
   *
   *
   * @author <a href="mail at leosimons dot com">Leo Simons</a>
   * @version $Id: AssertionConfiguration.java,v 1.1 2003/08/21 20:58:31 leosimons Exp $
   */
  public class AssertionConfiguration extends DefaultConfiguration
  {
      private boolean getAttributeCalled = false;
  
      public AssertionConfiguration( String name )
      {
          super( name );
      }
  
      public String getAttribute( String name ) throws ConfigurationException
      {
          getAttributeCalled = true;
          return super.getAttribute( name );
      }
  
      public boolean isGetAttributeCalled()
      {
          return getAttributeCalled;
      }
  }
  
  
  
  1.1                  avalon-sandbox/magic/impl/src/test/org/apache/avalon/magic/test/impl/AssertionContext.java
  
  Index: AssertionContext.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1997-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 "Avalon", 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 (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/>.
   */
  package org.apache.avalon.magic.test.impl;
  
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.DefaultContext;
  import org.apache.avalon.framework.context.ContextException;
  
  /**
   *
   *
   * @author <a href="mail at leosimons dot com">Leo Simons</a>
   * @version $Id: AssertionContext.java,v 1.1 2003/08/21 20:58:31 leosimons Exp $
   */
  public class AssertionContext extends DefaultContext
  {
      private boolean getCalled = false;
  
      public Object get( Object key )
              throws ContextException
      {
          getCalled = true;
          return super.get( key );
      }
  
      public boolean isGetCalled()
      {
          return getCalled;
      }
  }
  
  
  
  1.1                  avalon-sandbox/magic/impl/src/test/org/apache/avalon/magic/test/impl/AssertionParameters.java
  
  Index: AssertionParameters.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1997-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 "Avalon", 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 (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/>.
   */
  package org.apache.avalon.magic.test.impl;
  
  import org.apache.avalon.framework.parameters.Parameters;
  import org.apache.avalon.framework.parameters.ParameterException;
  
  /**
   *
   *
   * @author <a href="mail at leosimons dot com">Leo Simons</a>
   * @version $Id: AssertionParameters.java,v 1.1 2003/08/21 20:58:31 leosimons Exp $
   */
  public class AssertionParameters extends Parameters
  {
      private boolean getParameterCalled = false;
  
      public String getParameter( String name )
              throws ParameterException
      {
          return super.getParameter( name );
      }
  
      public boolean isGetParameterCalled()
      {
          return getParameterCalled;
      }
  }
  
  
  
  1.1                  avalon-sandbox/magic/impl/src/test/org/apache/avalon/magic/test/impl/TweetyImpl2.java
  
  Index: TweetyImpl2.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1997-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 "Avalon", 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 (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/>.
   */
  package org.apache.avalon.magic.test.impl;
  
  import java.io.File;
  
  /**
   *
   *
   * @author <a href="mail at leosimons dot com">Leo Simons</a>
   * @version $Id: TweetyImpl2.java,v 1.1 2003/08/21 20:58:31 leosimons Exp $
   */
  public class TweetyImpl2 implements Tweety
  {
      File m_homedir;
  
      public TweetyImpl2( File homedir )
      {
          m_homedir = homedir;
      }
      public void chilp()
      {
          if( m_homedir == null )
              throw new NullPointerException( "Homedir may not be null!" );
      }
  }
  
  
  
  1.1                  avalon-sandbox/magic/impl/src/test/org/apache/avalon/magic/test/impl/TweetyImpl3.java
  
  Index: TweetyImpl3.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1997-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 "Avalon", 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 (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/>.
   */
  package org.apache.avalon.magic.test.impl;
  
  import org.apache.avalon.framework.configuration.Configuration;
  
  /**
   *
   *
   * @author <a href="mail at leosimons dot com">Leo Simons</a>
   * @version $Id: TweetyImpl3.java,v 1.1 2003/08/21 20:58:31 leosimons Exp $
   */
  public class TweetyImpl3 implements Tweety
  {
      Configuration m_configuration;
  
      public TweetyImpl3( Configuration configuration )
      {
          m_configuration = configuration;
      }
      public void chilp()
      {
          m_configuration.getAttribute( "message", "null" );
      }
  }
  
  
  
  1.1                  avalon-sandbox/magic/impl/src/test/org/apache/avalon/magic/test/impl/TweetyImpl4.java
  
  Index: TweetyImpl4.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1997-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 "Avalon", 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 (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/>.
   */
  package org.apache.avalon.magic.test.impl;
  
  import org.apache.avalon.framework.parameters.Parameters;
  
  /**
   *
   *
   * @author <a href="mail at leosimons dot com">Leo Simons</a>
   * @version $Id: TweetyImpl4.java,v 1.1 2003/08/21 20:58:31 leosimons Exp $
   */
  public class TweetyImpl4 implements Tweety
  {
      Parameters m_parameters;
  
      public TweetyImpl4( Parameters parameters )
      {
          m_parameters = parameters;
      }
      public void chilp()
      {
          m_parameters.getParameter( "message", "null" );
      }
  }
  
  
  

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


Mime
View raw message