You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by mb...@apache.org on 2006/09/20 19:05:25 UTC

svn commit: r448264 - /ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java

Author: mbenson
Date: Wed Sep 20 10:05:25 2006
New Revision: 448264

URL: http://svn.apache.org/viewvc?view=rev&rev=448264
Log:
Differentiate between no RCs specified and no matching Resources.

Modified:
    ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java

Modified: ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java?view=diff&rev=448264&r1=448263&r2=448264
==============================================================================
--- ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java (original)
+++ ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java Wed Sep 20 10:05:25 2006
@@ -68,7 +68,7 @@
     /**
      * The build files to process.
      */
-    private Union buildFiles = new Union();
+    private Union buildFiles;
 
     /**
      * project instance for the build file currently under test.
@@ -123,6 +123,9 @@
      * adds build files to run as tests.
      */
     public void add(ResourceCollection rc) {
+        if (buildFiles == null) {
+            buildFiles = new Union();
+        }
         buildFiles.add(rc);
     }
 
@@ -156,7 +159,7 @@
     }
 
     public void execute() {
-        if (buildFiles.size() == 0) {
+        if (buildFiles == null) {
             throw new BuildException(ERROR_NO_TESTS);
         }
         doResourceCollection(buildFiles);
@@ -179,12 +182,13 @@
      * Processes a ResourceCollection.
      */
     private void doResourceCollection(ResourceCollection rc) {
+        //should relax this restriction if/when Ant core allows non-files
         if (!rc.isFilesystemOnly()) {
             throw new BuildException(ERROR_NON_FILES);
         }
 
         Iterator i = rc.iterator();
-        while(i.hasNext()) {
+        while (i.hasNext()) {
             FileResource r = (FileResource) i.next();
             if (r.isExists()) {
                 doFile(r.getFile());
@@ -439,4 +443,4 @@
         public void messageLogged(BuildEvent event) {}
     }
 
-}
\ No newline at end of file
+}



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


Re: svn commit: r448264 - /ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java

Posted by Matt Benson <gu...@yahoo.com>.
Hi all,
I would prefer that this change also be included in
the antunit beta, since it must already be rebuilt.

-Matt

--- mbenson@apache.org wrote:

> Author: mbenson
> Date: Wed Sep 20 10:05:25 2006
> New Revision: 448264
> 
> URL:
> http://svn.apache.org/viewvc?view=rev&rev=448264
> Log:
> Differentiate between no RCs specified and no
> matching Resources.
> 
> Modified:
>    
>
ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java
> 
> Modified:
>
ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java
> URL:
>
http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java?view=diff&rev=448264&r1=448263&r2=448264
>
==============================================================================
> ---
>
ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java
> (original)
> +++
>
ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java
> Wed Sep 20 10:05:25 2006
> @@ -68,7 +68,7 @@
>      /**
>       * The build files to process.
>       */
> -    private Union buildFiles = new Union();
> +    private Union buildFiles;
>  
>      /**
>       * project instance for the build file
> currently under test.
> @@ -123,6 +123,9 @@
>       * adds build files to run as tests.
>       */
>      public void add(ResourceCollection rc) {
> +        if (buildFiles == null) {
> +            buildFiles = new Union();
> +        }
>          buildFiles.add(rc);
>      }
>  
> @@ -156,7 +159,7 @@
>      }
>  
>      public void execute() {
> -        if (buildFiles.size() == 0) {
> +        if (buildFiles == null) {
>              throw new
> BuildException(ERROR_NO_TESTS);
>          }
>          doResourceCollection(buildFiles);
> @@ -179,12 +182,13 @@
>       * Processes a ResourceCollection.
>       */
>      private void
> doResourceCollection(ResourceCollection rc) {
> +        //should relax this restriction if/when Ant
> core allows non-files
>          if (!rc.isFilesystemOnly()) {
>              throw new
> BuildException(ERROR_NON_FILES);
>          }
>  
>          Iterator i = rc.iterator();
> -        while(i.hasNext()) {
> +        while (i.hasNext()) {
>              FileResource r = (FileResource)
> i.next();
>              if (r.isExists()) {
>                  doFile(r.getFile());
> @@ -439,4 +443,4 @@
>          public void messageLogged(BuildEvent event)
> {}
>      }
>  
> -}
> \ No newline at end of file
> +}
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> dev-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> dev-help@ant.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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