git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268600 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -0,0 +1,47 @@ | |||
| /* | |||
| * 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.ant.modules.test; | |||
| import org.apache.ant.AntException; | |||
| import org.apache.ant.configuration.Configurable; | |||
| import org.apache.ant.configuration.Configuration; | |||
| import org.apache.ant.tasklet.AbstractTasklet; | |||
| import org.apache.avalon.ConfigurationException; | |||
| /** | |||
| * This is to test self interpretation of configuration. | |||
| * | |||
| * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||
| */ | |||
| public class ConfigurationTest | |||
| extends AbstractTasklet | |||
| implements Configurable | |||
| { | |||
| protected String m_message; | |||
| public void configure( final Configuration configuration ) | |||
| throws ConfigurationException | |||
| { | |||
| String message = configuration.getAttribute( "message" ); | |||
| final Object object = getContext().resolveValue( message ); | |||
| if( object instanceof String ) | |||
| { | |||
| m_message = (String)object; | |||
| } | |||
| else | |||
| { | |||
| m_message = object.toString(); | |||
| } | |||
| } | |||
| public void run() | |||
| throws AntException | |||
| { | |||
| getLogger().warn( m_message ); | |||
| } | |||
| } | |||
| @@ -0,0 +1,37 @@ | |||
| /* | |||
| * 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.ant.modules.test; | |||
| import org.apache.ant.AntException; | |||
| import org.apache.ant.tasklet.AbstractTasklet; | |||
| /** | |||
| * This is to test whether content is added. | |||
| * | |||
| * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||
| */ | |||
| public class ContentTest | |||
| extends AbstractTasklet | |||
| { | |||
| public void addContent( final Integer value ) | |||
| { | |||
| getLogger().warn( "Integer content: " + value ); | |||
| } | |||
| /* | |||
| public void addContent( final String blah ) | |||
| { | |||
| System.out.println( "String: " + blah ); | |||
| } | |||
| */ | |||
| public void run() | |||
| throws AntException | |||
| { | |||
| } | |||
| } | |||
| @@ -0,0 +1,91 @@ | |||
| /* | |||
| * 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.ant.modules.test; | |||
| import org.apache.ant.AntException; | |||
| import org.apache.ant.tasklet.AbstractTasklet; | |||
| /** | |||
| * Test conversion of all the primitive types. | |||
| * | |||
| * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||
| */ | |||
| public class PrimitiveTypesTest | |||
| extends AbstractTasklet | |||
| { | |||
| 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 run() | |||
| throws AntException | |||
| { | |||
| } | |||
| } | |||
| @@ -0,0 +1,44 @@ | |||
| /* | |||
| * 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.ant.modules.test; | |||
| import org.apache.ant.AntException; | |||
| import org.apache.ant.tasklet.AbstractTasklet; | |||
| /** | |||
| * Test sub-elements addition. | |||
| * | |||
| * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||
| */ | |||
| public class SubElementTest | |||
| extends AbstractTasklet | |||
| { | |||
| 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 run() | |||
| throws AntException | |||
| { | |||
| } | |||
| } | |||