git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270979 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -1,56 +0,0 @@ | |||||
| /* | |||||
| * 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.antlib.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:peter@apache.org">Peter Donald</a> | |||||
| */ | |||||
| public class ConfigurationTest | |||||
| extends AbstractTask | |||||
| implements Configurable | |||||
| { | |||||
| private String m_message; | |||||
| public void configure( final Configuration configuration ) | |||||
| throws ConfigurationException | |||||
| { | |||||
| final String message = configuration.getAttribute( "message" ); | |||||
| final Object object; | |||||
| try | |||||
| { | |||||
| object = resolveValue( message ); | |||||
| } | |||||
| catch( final TaskException te ) | |||||
| { | |||||
| throw new ConfigurationException( te.getMessage(), te ); | |||||
| } | |||||
| if( object instanceof String ) | |||||
| { | |||||
| m_message = (String)object; | |||||
| } | |||||
| else | |||||
| { | |||||
| m_message = object.toString(); | |||||
| } | |||||
| } | |||||
| public void execute() | |||||
| throws TaskException | |||||
| { | |||||
| getLogger().warn( m_message ); | |||||
| } | |||||
| } | |||||
| @@ -1,37 +0,0 @@ | |||||
| /* | |||||
| * 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.antlib.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:peter@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,44 +0,0 @@ | |||||
| /* | |||||
| * 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.antlib.selftest; | |||||
| import org.apache.myrmidon.api.AbstractTask; | |||||
| import org.apache.myrmidon.api.TaskException; | |||||
| /** | |||||
| * Test sub-elements addition. | |||||
| * | |||||
| * @author <a href="mailto:peter@apache.org">Peter Donald</a> | |||||
| */ | |||||
| public class SubElementTest | |||||
| extends AbstractTask | |||||
| { | |||||
| public final static 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 | |||||
| { | |||||
| } | |||||
| } | |||||
| @@ -20,28 +20,14 @@ Legal: | |||||
| <property name="year" value="2000"/> | <property name="year" value="2000"/> | ||||
| <target name="main" depends="test-target" /> | |||||
| <target name="file-manip"> | |||||
| <!-- | |||||
| <file-manip-test base-directory="."> | |||||
| <source> | |||||
| <include value="**/*.java" /> | |||||
| </source> | |||||
| </file-manip-test> | |||||
| --> | |||||
| </target> | |||||
| <target name="main" depends="extensions-test" /> | |||||
| <target name="undefined-task"> | <target name="undefined-task"> | ||||
| <log message="About to execute task that hasn't been defined"/> | <log message="About to execute task that hasn't been defined"/> | ||||
| <log2 message="This should have failed"/> | <log2 message="This should have failed"/> | ||||
| </target> | </target> | ||||
| <target name="no-test-target" if="no-do-tests"> | |||||
| <log message="No tests done here"/> | |||||
| </target> | |||||
| <target name="test-target" depends="no-test-target,extensions-test" unless="no-do-tests"> | |||||
| <target name="prim-tests"> | |||||
| <log message="Tests away"/> | <log message="Tests away"/> | ||||
| @@ -60,24 +46,10 @@ Legal: | |||||
| double="3.0" | double="3.0" | ||||
| double2="4.0" /> | double2="4.0" /> | ||||
| <sub-elements-test> | |||||
| <create-beep message="A string" /> | |||||
| <add-beep message="Another String" /> | |||||
| </sub-elements-test> | |||||
| <conf-test message="..." /> | |||||
| <content-test>123</content-test> | |||||
| </target> | </target> | ||||
| <target name="extensions-test"> | <target name="extensions-test"> | ||||
| <extensions-test/> | <extensions-test/> | ||||
| </target> | </target> | ||||
| <target name="typed-adder-test"> | |||||
| <log message="About to execute typed-adder-test"/> | |||||
| <typed-adder-test/> | |||||
| </target> | |||||
| </project> | </project> | ||||
| @@ -23,8 +23,8 @@ Legal: | |||||
| <target name="main" | <target name="main" | ||||
| depends="typedef-test, converterdef-test, | depends="typedef-test, converterdef-test, | ||||
| datatype-test, namespace-test, | datatype-test, namespace-test, | ||||
| ant1-tasklib-test, prim->file-manip, | |||||
| prim->extensions-test, prim->typed-adder-test" /> | |||||
| ant1-tasklib-test, | |||||
| prim->extensions-test" /> | |||||
| <target name="xp-deployer-test" depends="typedef-test, prim->undefined-task" /> | <target name="xp-deployer-test" depends="typedef-test, prim->undefined-task" /> | ||||
| @@ -2,10 +2,6 @@ | |||||
| <types> | <types> | ||||
| <!-- tasks to test operation of engine --> | <!-- tasks to test operation of engine --> | ||||
| <task name="prim-test" classname="org.apache.antlib.selftest.PrimitiveTypesTest" /> | <task name="prim-test" classname="org.apache.antlib.selftest.PrimitiveTypesTest" /> | ||||
| <task name="sub-elements-test" classname="org.apache.antlib.selftest.SubElementTest" /> | |||||
| <task name="conf-test" classname="org.apache.antlib.selftest.ConfigurationTest" /> | |||||
| <task name="content-test" classname="org.apache.antlib.selftest.ContentTest" /> | |||||
| <task name="file-manip-test" classname="org.apache.antlib.selftest.FileManipulationTest" /> | |||||
| <task name="extensions-test" classname="org.apache.antlib.selftest.ExtensionsTest" /> | <task name="extensions-test" classname="org.apache.antlib.selftest.ExtensionsTest" /> | ||||
| </types> | </types> | ||||
| </ant-lib> | </ant-lib> | ||||