ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer MyRole2.java MyRole1.java ConfigTest5.java ConfigTest4.java DefaultConfigurerTest.java ConfigTest3.java
Date Mon, 28 Jan 2002 00:08:32 GMT
donaldp     02/01/27 16:08:32

  Modified:    proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer
                        DefaultConfigurerTest.java ConfigTest3.java
  Added:       proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer
                        MyRole2.java MyRole1.java ConfigTest5.java
                        ConfigTest4.java
  Log:
  Add some more tests to check recently added features of Configurer
  
  Revision  Changes    Path
  1.4       +53 -1     jakarta-ant/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/DefaultConfigurerTest.java
  
  Index: DefaultConfigurerTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/DefaultConfigurerTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultConfigurerTest.java	27 Jan 2002 23:52:59 -0000	1.3
  +++ DefaultConfigurerTest.java	28 Jan 2002 00:08:31 -0000	1.4
  @@ -362,6 +362,57 @@
       }
   
       /**
  +     * Tests reference resolution via a nested element.
  +     */
  +    public void testNonInterfaceTypedAdder()
  +        throws Exception
  +    {
  +        // Setup test data
  +        final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
  +
  +        final ConfigTest4 test = new ConfigTest4();
  +
  +        try
  +        {
  +            // Configure the object
  +            m_configurer.configure( test, config, m_context );
  +        }
  +        catch( final ConfigurationException ce )
  +        {
  +            final String message = REZ.getString( "typed-adder-non-interface.error",
  +                                                  ConfigTest4.class.getName(),
  +                                                  Integer.class.getName() );
  +            assertSameMessage( message, ce );
  +        }
  +    }
  +
  +    /**
  +     * Tests whether a object with multiple typed adders causes an exception.
  +     */
  +    public void testMultipleTypedAdder()
  +        throws Exception
  +    {
  +        // Setup test data
  +        final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
  +
  +        final ConfigTest5 test = new ConfigTest5();
  +
  +        try
  +        {
  +            // Configure the object
  +            m_configurer.configure( test, config, m_context );
  +        }
  +        catch( final ConfigurationException ce )
  +        {
  +            final String message = REZ.getString( "multiple-typed-adder-methods-for-element.error",
  +                                                  ConfigTest5.class.getName(),
  +                                                  MyRole1.class.getName(),
  +                                                  MyRole2.class.getName() );
  +            assertSameMessage( message, ce );
  +        }
  +    }
  +
  +    /**
        * Test resolving properties in an id.
        */
       public void testIdResolve()
  @@ -473,7 +524,8 @@
        * Tests that string setter/adder/creators are ignored when there
        * are multiple.
        */
  -    public void testIgnoreStringMethods() throws Exception
  +    public void testIgnoreStringMethods()
  +        throws Exception
       {
           // Setup test data
           final DefaultConfiguration config = new DefaultConfiguration( "test", "test" );
  
  
  
  1.2       +0 -1      jakarta-ant/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/ConfigTest3.java
  
  Index: ConfigTest3.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/ConfigTest3.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConfigTest3.java	22 Jan 2002 11:16:02 -0000	1.1
  +++ ConfigTest3.java	28 Jan 2002 00:08:31 -0000	1.2
  @@ -80,5 +80,4 @@
       {
           m_prop3.add( value );
       }
  -
   }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/MyRole2.java
  
  Index: MyRole2.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.myrmidon.components.configurer;
  
  /**
   * A basic interface to test configurer.
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   * @version $Revision: 1.1 $ $Date: 2002/01/28 00:08:31 $
   */
  public interface MyRole2
  {
  }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/MyRole1.java
  
  Index: MyRole1.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.myrmidon.components.configurer;
  
  /**
   * A basic interface to test configurer.
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   * @version $Revision: 1.1 $ $Date: 2002/01/28 00:08:31 $
   */
  public interface MyRole1
  {
  }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/ConfigTest5.java
  
  Index: ConfigTest5.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.myrmidon.components.configurer;
  
  import java.util.ArrayList;
  import junit.framework.AssertionFailedError;
  import org.apache.avalon.framework.configuration.Configuration;
  
  /**
   * Simple class to test typed adder.
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   * @version $Revision: 1.1 $ $Date: 2002/01/28 00:08:31 $
   */
  public class ConfigTest5
  {
      public void add( final MyRole1 role1 )
      {
      }
  
      public void add( final MyRole2 role2 )
      {
      }
  }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/testcases/org/apache/myrmidon/components/configurer/ConfigTest4.java
  
  Index: ConfigTest4.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.myrmidon.components.configurer;
  
  import java.util.ArrayList;
  import junit.framework.AssertionFailedError;
  
  /**
   * Simple class to test typed adder.
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   * @version $Revision: 1.1 $ $Date: 2002/01/28 00:08:31 $
   */
  public class ConfigTest4
  {
      public void add( final Integer integer )
      {
          System.out.println( "This should not have been called as " +
                              "Integer is not an interface" );
      }
  }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message