git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275903 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -49,6 +49,22 @@ | |||||
| <dd attribute="true"/> | <dd attribute="true"/> | ||||
| </target> | </target> | ||||
| <target name="antTypeTest"> | |||||
| <taskdef name="anttypetest" | |||||
| classname="org.apache.tools.ant.taskdefs.PreSetDefTest$AntTypeTest" | |||||
| classpathref="test-classes"/> | |||||
| <presetdef name="java.fileset"> | |||||
| <fileset> | |||||
| <include name="**/*.java"/> | |||||
| </fileset> | |||||
| </presetdef> | |||||
| <anttypetest> | |||||
| <fileset ant-type="java.fileset" dir="."/> | |||||
| <configured ant-type="java.fileset" dir="."/> | |||||
| </anttypetest> | |||||
| </target> | |||||
| <target name="text.optional"> | <target name="text.optional"> | ||||
| <presetdef name="echo.mytext"> | <presetdef name="echo.mytext"> | ||||
| <echo>MyText</echo> | <echo>MyText</echo> | ||||
| @@ -349,19 +349,22 @@ public final class IntrospectionHelper implements BuildListener { | |||||
| throws InvocationTargetException, | throws InvocationTargetException, | ||||
| IllegalAccessException, InstantiationException { | IllegalAccessException, InstantiationException { | ||||
| if (child != null) { | if (child != null) { | ||||
| return child; | |||||
| } else if (c.getParameterTypes().length == 0) { | } else if (c.getParameterTypes().length == 0) { | ||||
| return c.newInstance(new Object[] {}); | |||||
| child = c.newInstance(new Object[] {}); | |||||
| } else { | } else { | ||||
| return c.newInstance(new Object[] { | |||||
| child = c.newInstance(new Object[] { | |||||
| project}); | project}); | ||||
| } | } | ||||
| if (child instanceof PreSetDef.PreSetDefinition) { | |||||
| child = ((PreSetDef.PreSetDefinition) child) | |||||
| .createObject(project); | |||||
| } | |||||
| return child; | |||||
| } | } | ||||
| public void store(Object parent, Object child) | public void store(Object parent, Object child) | ||||
| throws InvocationTargetException, | throws InvocationTargetException, | ||||
| IllegalAccessException, InstantiationException { | IllegalAccessException, InstantiationException { | ||||
| m.invoke(parent, new Object[] {child}); | m.invoke(parent, new Object[] {child}); | ||||
| } | } | ||||
| @@ -415,6 +418,10 @@ public final class IntrospectionHelper implements BuildListener { | |||||
| child = c.newInstance(new Object[] { | child = c.newInstance(new Object[] { | ||||
| project}); | project}); | ||||
| } | } | ||||
| if (child instanceof PreSetDef.PreSetDefinition) { | |||||
| child = ((PreSetDef.PreSetDefinition) child) | |||||
| .createObject(project); | |||||
| } | |||||
| m.invoke(parent, new Object[] {child}); | m.invoke(parent, new Object[] {child}); | ||||
| return child; | return child; | ||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2003 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2003-2004 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -58,6 +58,7 @@ import org.apache.tools.ant.BuildFileTest; | |||||
| import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
| import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.types.FileSet; | |||||
| /** | /** | ||||
| * @author Peter Reilly | * @author Peter Reilly | ||||
| @@ -102,6 +103,10 @@ public class PreSetDefTest extends BuildFileTest { | |||||
| public void testElementOrder2() { | public void testElementOrder2() { | ||||
| expectLog("element.order2", "Line 1Line 2Line 3"); | expectLog("element.order2", "Line 1Line 2Line 3"); | ||||
| } | } | ||||
| public void testAntTypeTest() { | |||||
| expectLog("antTypeTest", ""); | |||||
| } | |||||
| /** | /** | ||||
| * A test class to check default properties | * A test class to check default properties | ||||
| @@ -121,5 +126,15 @@ public class PreSetDefTest extends BuildFileTest { | |||||
| getProject().log("attribute is " + attribute); | getProject().log("attribute is " + attribute); | ||||
| } | } | ||||
| } | } | ||||
| /** | |||||
| * A test class to check presetdef with add and addConfigured and ant-type | |||||
| */ | |||||
| public static class AntTypeTest extends Task { | |||||
| public void addFileSet(FileSet fileset) { | |||||
| } | |||||
| public void addConfiguredConfigured(FileSet fileset) { | |||||
| } | |||||
| } | |||||
| } | } | ||||