1 17 18 package org.apache.tools.ant.taskdefs; 19 20 import org.apache.tools.ant.BuildFileTest; 21 import org.apache.tools.ant.BuildException; 22 import org.apache.tools.ant.Project; 23 import org.apache.tools.ant.Task; 24 import org.apache.tools.ant.types.FileSet; 25 26 28 public class PreSetDefTest extends BuildFileTest { 29 public PreSetDefTest(String name) { 30 super(name); 31 } 32 33 public void setUp() { 34 configureProject("src/etc/testcases/taskdefs/presetdef.xml"); 35 } 36 37 public void testSimple() { 38 expectLog("simple", "Hello world"); 39 } 40 41 public void testText() { 42 expectLog("text", "Inner Text"); 43 } 44 45 public void testUri() { 46 expectLog("uri", "Hello world"); 47 } 48 49 public void testDefaultTest() { 50 expectLog("defaulttest", "attribute is false"); 51 } 52 53 public void testDoubleDefault() { 54 expectLog("doubledefault", "attribute is falseattribute is true"); 55 } 56 57 public void testTextOptional() { 58 expectLog("text.optional", "MyTextoverride text"); 59 } 60 61 public void testElementOrder() { 62 expectLog("element.order", "Line 1Line 2"); 63 } 64 65 public void testElementOrder2() { 66 expectLog("element.order2", "Line 1Line 2Line 3"); 67 } 68 69 public void testAntTypeTest() { 70 expectLog("antTypeTest", ""); 71 } 72 73 76 public static class DefaultTest extends Task { 77 boolean isSet = false; 78 boolean attribute = false; 79 public void setAttribute(boolean b) { 80 if (isSet) { 81 throw new BuildException("Attribute Already set"); 82 } 83 attribute = b; 84 isSet = true; 85 } 86 87 public void execute() { 88 getProject().log("attribute is " + attribute); 89 } 90 } 91 92 95 public static class AntTypeTest extends Task { 96 public void addFileSet(FileSet fileset) { 97 } 98 public void addConfiguredConfigured(FileSet fileset) { 99 } 100 } 101 } 102 103 | Popular Tags |