FileDocCategorySizeDatePackage
ExecutorTest.javaAPI DocApache Ant 1.703936Wed Dec 13 06:16:18 GMT 2006org.apache.tools.ant

ExecutorTest

public class ExecutorTest extends BuildFileTest implements BuildListener
Executor tests

Fields Summary
private static final String
SINGLE_CHECK
private static final Vector
targetNames
private int
targetCount
Constructors Summary
public ExecutorTest(String name)

        super(name);
    
Methods Summary
public voidbuildFinished(BuildEvent event)

public voidbuildStarted(BuildEvent event)

private ProjectgetProject(java.lang.String e)

        return getProject(e, false);
    
private ProjectgetProject(java.lang.String e, boolean f)

        return getProject(e, f, false);
    
private ProjectgetProject(java.lang.String e, boolean f, boolean k)

        Project p = getProject();
        p.setNewProperty("ant.executor.class", e);
        p.setKeepGoingMode(k);
        if (f) {
            p.setNewProperty("failfoo", "foo");
        }
        return p;
    
public voidmessageLogged(BuildEvent event)

public voidsetUp()

        configureProject("src/etc/testcases/core/executor.xml");
        targetCount = 0;
        getProject().addBuildListener(this);
    
public voidtargetFinished(BuildEvent event)

public voidtargetStarted(BuildEvent event)

        targetCount++;
    
public voidtaskFinished(BuildEvent event)

public voidtaskStarted(BuildEvent event)

public voidtestDefaultExecutor()

        getProject().executeTargets(targetNames);
        assertEquals(targetCount, 4);
    
public voidtestDefaultFailure()

        try {
            getProject(null, true).executeTargets(targetNames);
            fail("should fail");
        } catch (BuildException e) {
            assertTrue(e.getMessage().equals("failfoo"));
            assertEquals(targetCount, 1);
        }
    
public voidtestKeepGoingDefault()

        try {
            getProject(null, true, true).executeTargets(targetNames);
            fail("should fail");
        } catch (BuildException e) {
            assertTrue(e.getMessage().equals("failfoo"));
            assertEquals(targetCount, 2);
        }
    
public voidtestKeepGoingSingleCheck()

        try {
            getProject(SINGLE_CHECK, true, true).executeTargets(targetNames);
            fail("should fail");
        } catch (BuildException e) {
            assertTrue(e.getMessage().equals("failfoo"));
            assertEquals(targetCount, 1);
        }
    
public voidtestSingleCheckExecutor()

        getProject(SINGLE_CHECK).executeTargets(targetNames);
        assertEquals(targetCount, 3);
    
public voidtestSingleCheckFailure()

        try {
            getProject(SINGLE_CHECK, true).executeTargets(targetNames);
            fail("should fail");
        } catch (BuildException e) {
            assertTrue(e.getMessage().equals("failfoo"));
            assertEquals(targetCount, 1);
        }