FileDocCategorySizeDatePackage
IncludeTest.javaAPI DocApache Ant 1.705047Wed Dec 13 06:16:20 GMT 2006org.apache.tools.ant

IncludeTest

public class IncludeTest extends org.apache.tools.ant.BuildFileTest
Test the build file inclusion using XML entities.

Fields Summary
Constructors Summary
public IncludeTest(String name)

        super(name);
    
Methods Summary
public voidtest1()

        configureProject("src/etc/testcases/core/include/basic/include.xml");
        expectLog("test1", "from included entity");
    
public voidtest2()

        configureProject("src/etc/testcases/core/include/frag#ment/include.xml");
        expectLog("test1", "from included entity");
    
public voidtest3()

        configureProject("src/etc/testcases/core/include/frag#ment/simple.xml");
        expectLog("test1", "from simple buildfile");
    
public voidtest4()

        configureProject("src/etc/testcases/core/include/basic/relative.xml");
        expectLog("test1", "from included entity");
    
public voidtest5()

        configureProject("src/etc/testcases/core/include/frag#ment/relative.xml");
        expectLog("test1", "from included entity");
    
public voidtestParseErrorInIncluded()

        try {
            configureProject("src/etc/testcases/core/include/included_file_parse_error/build.xml");
            fail("should have caused a parser exception");
        } catch (BuildException e) {
            assertTrue(e.getLocation().toString()
                       + " should refer to included_file.xml",
                       e.getLocation().toString()
                       .indexOf("included_file.xml:") > -1);
        }
    
public voidtestParseErrorInIncluding()

        try {
            configureProject("src/etc/testcases/core/include/including_file_parse_error/build.xml");
            fail("should have caused a parser exception");
        } catch (BuildException e) {
            assertTrue(e.getLocation().toString()
                       + " should refer to build.xml",
                       e.getLocation().toString().indexOf("build.xml:") > -1);
        }
    
public voidtestTaskErrorInIncluded()

        configureProject("src/etc/testcases/core/include/included_file_task_error/build.xml");
        try {
            executeTarget("test");
            fail("should have cause a build failure");
        } catch (BuildException e) {
            assertTrue(e.getMessage()
                       + " should start with \'Warning: Could not find",
                         e.getMessage().startsWith("Warning: Could not find file "));
            assertTrue(e.getLocation().toString()
                       + " should end with included_file.xml:2: ",
                       e.getLocation().toString().endsWith("included_file.xml:2: "));
        }
    
public voidtestTaskErrorInIncluding()

        configureProject("src/etc/testcases/core/include/including_file_task_error/build.xml");
        try {
            executeTarget("test");
            fail("should have cause a build failure");
        } catch (BuildException e) {
            assertTrue(e.getMessage()
                       + " should start with \'Warning: Could not find",
                         e.getMessage().startsWith("Warning: Could not find file "));
            assertTrue(e.getLocation().toString()
                       + " should end with build.xml:14: ",
                       e.getLocation().toString().endsWith("build.xml:14: "));
        }
    
public voidtestWithSpaceInclude()

        configureProject("src/etc/testcases/core/include/with space/include.xml");
        try {
            expectLog("test1", "from included entity in 'with space'");
        } catch (Throwable t) {
            throw new AssertionFailedError(
                t.toString() + "; log=\n" + getFullLog());
        }
    
public voidtestWithSpaceRelative()

        configureProject("src/etc/testcases/core/include/with space/relative.xml");
        expectLog("test1", "from included entity in 'with space'");
    
public voidtestWithSpaceSimple()

        configureProject("src/etc/testcases/core/include/with space/simple.xml");
        expectLog("test1", "from simple buildfile in 'with space'");