ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs AntTest.java
Date Mon, 22 Apr 2002 13:43:52 GMT
bodewig     02/04/22 06:43:52

  Modified:    src/main/org/apache/tools/ant/taskdefs Ant.java
               src/testcases/org/apache/tools/ant/taskdefs AntTest.java
  Log:
  Inherit input handlers in <ant*>
  
  Revision  Changes    Path
  1.56      +3 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java
  
  Index: Ant.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- Ant.java	16 Apr 2002 10:36:25 -0000	1.55
  +++ Ant.java	22 Apr 2002 13:43:52 -0000	1.56
  @@ -193,9 +193,11 @@
        * project, configures a possible logfile, transfers task and
        * data-type definitions, transfers properties (either all or just
        * the ones specified as user properties to the current project,
  -     * depending on inheritall).
  +     * depending on inheritall), transfers the input handler.
        */
       private void initializeProject() {
  +        newProject.setInputHandler(getProject().getInputHandler());
  +
           Vector listeners = project.getBuildListeners();
           final int count = listeners.size();
           for (int i = 0; i < count; i++) {
  
  
  
  1.11      +64 -1     jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/AntTest.java
  
  Index: AntTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/AntTest.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- AntTest.java	3 Apr 2002 08:25:10 -0000	1.10
  +++ AntTest.java	22 Apr 2002 13:43:52 -0000	1.11
  @@ -61,12 +61,14 @@
   import org.apache.tools.ant.BuildEvent;
   import org.apache.tools.ant.BuildFileTest;
   import org.apache.tools.ant.BuildListener;
  +import org.apache.tools.ant.input.InputHandler;
  +import org.apache.tools.ant.input.PropertyFileInputHandler;
   import org.apache.tools.ant.types.Path;
   
   /**
    * @author Nico Seessle <nico@seessle.de> 
    * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> 
  - * @version $Revision: 1.10 $
  + * @version $Revision: 1.11 $
    */
   public class AntTest extends BuildFileTest { 
       
  @@ -237,6 +239,19 @@
           }
       }
   
  +    public void testInputHandlerInheritance() {
  +        InputHandler ih = new PropertyFileInputHandler();
  +        getProject().setInputHandler(ih);
  +        InputHandlerChecker ic = new InputHandlerChecker(ih);
  +        getProject().addBuildListener(ic);
  +        executeTarget("tripleCall");
  +        AssertionFailedError ae = ic.getError();
  +        if (ae != null) {
  +            throw ae;
  +        }
  +        getProject().removeBuildListener(ic);
  +    }
  +
       private class BasedirChecker implements BuildListener {
           private String[] expectedBasedirs;
           private int calls = 0;
  @@ -329,6 +344,54 @@
                               }
                           }
                       }
  +                } catch (AssertionFailedError e) {
  +                    error = e;
  +                }
  +            }
  +        }
  +
  +        AssertionFailedError getError() {
  +            return error;
  +        }
  +
  +    }
  +
  +    private class InputHandlerChecker implements BuildListener {
  +        private InputHandler ih;
  +        private AssertionFailedError error;
  +
  +        InputHandlerChecker(InputHandler value) {
  +            ih = value;
  +        }
  +
  +        public void buildStarted(BuildEvent event) {
  +            check(event);
  +        }
  +        public void buildFinished(BuildEvent event) {
  +            check(event);
  +        }
  +        public void targetFinished(BuildEvent event) {
  +            check(event);
  +        }
  +        public void taskStarted(BuildEvent event) {
  +            check(event);
  +        }
  +        public void taskFinished(BuildEvent event) {
  +            check(event);
  +        }
  +        public void messageLogged(BuildEvent event) {
  +            check(event);
  +        }
  +
  +        public void targetStarted(BuildEvent event) {
  +            check(event);
  +        }
  +
  +        private void check(BuildEvent event) {
  +            if (error == null) {
  +                try {
  +                    assertNotNull(event.getProject().getInputHandler());
  +                    assertSame(ih, event.getProject().getInputHandler());
                   } catch (AssertionFailedError e) {
                       error = e;
                   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message