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/java/org/apache/myrmidon/libs/selftest ConfigurationTest.java ContentTest.java PrimitiveTypesTest.java SubElementTest.java
Date Sat, 16 Jun 2001 03:35:25 GMT
donaldp     01/06/15 20:35:25

  Added:       proposal/myrmidon/src/java/org/apache/myrmidon/libs/selftest
                        ConfigurationTest.java ContentTest.java
                        PrimitiveTypesTest.java SubElementTest.java
  Removed:     proposal/myrmidon/src/java/org/apache/ant/modules/test
                        ConfigurationTest.java ContentTest.java
                        PrimitiveTypesTest.java SubElementTest.java
  Log:
  Migrated self testing code to new library.
  
  Revision  Changes    Path
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/selftest/ConfigurationTest.java
  
  Index: ConfigurationTest.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 file.
   */
  package org.apache.myrmidon.libs.selftest;
  
  import org.apache.avalon.framework.configuration.Configurable;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.myrmidon.api.AbstractTask;
  import org.apache.myrmidon.api.TaskException;
  
  /**
   * This is to test self interpretation of configuration.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public class ConfigurationTest
      extends AbstractTask
      implements Configurable
  {
      private String              m_message;
  
      public void configure( final Configuration configuration )
          throws ConfigurationException
      {
          String message = configuration.getAttribute( "message" );
  
          Object object = null;
  
          try { object = getContext().resolveValue( message ); }
          catch( final TaskException ae )
          {
              throw new ConfigurationException( "Error resolving : " + message, ae );
          }
  
          if( object instanceof String )
          {
              m_message = (String)object;
          }
          else
          {
              m_message = object.toString();
          }
      }
  
      public void execute()
          throws TaskException
      {
          getLogger().warn( m_message );
      }
  }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/selftest/ContentTest.java
  
  Index: ContentTest.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 file.
   */
  package org.apache.myrmidon.libs.selftest;
  
  import org.apache.myrmidon.api.AbstractTask;
  import org.apache.myrmidon.api.TaskException;
  
  /**
   * This is to test whether content is added.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public class ContentTest
      extends AbstractTask
  {
      public void addContent( final Integer value )
      {
          getLogger().warn( "Integer content: " + value );
      }
  
      /*
        public void addContent( final String blah )
        {
        System.out.println( "String content: " + blah );
        }
      */
  
      public void execute()
          throws TaskException
      {
      }
  }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/selftest/PrimitiveTypesTest.java
  
  Index: PrimitiveTypesTest.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 file.
   */
  package org.apache.myrmidon.libs.selftest;
  
  import org.apache.myrmidon.api.AbstractTask;
  import org.apache.myrmidon.api.TaskException;
  
  /**
   * Test conversion of all the primitive types.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public class PrimitiveTypesTest
      extends AbstractTask
  {
      public void setInteger( final Integer value )
      {
          getLogger().warn( "setInteger( " + value + " );" );
      }
  
      public void setInteger2( final int value )
      {
          getLogger().warn( "setInteger2( " + value + " );" );
      }
  
      public void setShort( final Short value )
      {
          getLogger().warn( "setShort( " + value + " );" );
      }
  
      public void setShort2( final short value )
      {
          getLogger().warn( "setShort2( " + value + " );" );
      }
  
      public void setByte( final Byte value )
      {
          getLogger().warn( "setByte( " + value + " );" );
      }
  
      public void setByte2( final byte value )
      {
          getLogger().warn( "setByte2( " + value + " );" );
      }
  
      public void setLong( final Long value )
      {
          getLogger().warn( "setLong( " + value + " );" );
      }
  
      public void setLong2( final long value )
      {
          getLogger().warn( "setLong2( " + value + " );" );
      }
  
      public void setFloat( final Float value )
      {
          getLogger().warn( "setFloat( " + value + " );" );
      }
  
      public void setFloat2( final float value )
      {
          getLogger().warn( "setFloat2( " + value + " );" );
      }
  
      public void setDouble( final Double value )
      {
          getLogger().warn( "setDouble( " + value + " );" );
      }
  
      public void setDouble2( final double value )
      {
          getLogger().warn( "setDouble2( " + value + " );" );
      }
  
      public void setString( final String value )
      {
          getLogger().warn( "setString( " + value + " );" );
      }
  
      public void execute()
          throws TaskException
      {
      }
  }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/selftest/SubElementTest.java
  
  Index: SubElementTest.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 file.
   */
  package org.apache.myrmidon.libs.selftest;
  
  import org.apache.myrmidon.api.AbstractTask;
  import org.apache.myrmidon.api.TaskException;
  
  /**
   * Test sub-elements addition.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public class SubElementTest
      extends AbstractTask
  {
      public static final class Beep
      {
          public void setMessage( final String string )
          {
              System.out.println( string );
          }
      }
  
      public Beep createCreateBeep()
      {
          System.out.println( "createCreateBeep()" );
          return new Beep();
      }
  
      public void addAddBeep( final Beep beep )
      {
          System.out.println( "addBeeper(" + beep + ");" );
      }
  
      public void execute()
          throws TaskException
      {
      }
  }
  
  
  

Mime
View raw message