Author: toulmean
Date: Thu Jul  1 07:39:57 2010
New Revision: 959547

URL: http://svn.apache.org/viewvc?rev=959547&view=rev
Log:
BUILDR-439 "The command line is too long" when running TestNG tests

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/lib/buildr/java/tests.rb

Modified: buildr/trunk/CHANGELOG
URL: 
http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=959547&r1=959546&r2=959547&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Thu Jul  1 07:39:57 2010
@@ -4,6 +4,7 @@
 * Change: BUILDR-459 Update gemspec to accept json_pure ~> 1.4.3
 * Fixed:  BUILDR-455 cc_spec.rb l 160 depends on time and thus fails 
intermittently
 * Fixed:  BUILDR-461 Packages with different ids collide
+* Fixed:  BUILDR-439 "The command line is too long" when running TestNG tests
 
 1.4.0 (2010-06-18)
 * Added:  BUILDR-405 Enhance the idea7x extension to supply a task to delete 
generated files

Modified: buildr/trunk/lib/buildr/java/tests.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/tests.rb?rev=959547&r1=959546&r2=959547&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/tests.rb (original)
+++ buildr/trunk/lib/buildr/java/tests.rb Thu Jul  1 07:39:57 2010
@@ -321,15 +321,20 @@ module Buildr
     end
 
     def run(tests, dependencies) #:nodoc:
-      cmd_args = [ 'org.testng.TestNG', '-log', '2', '-sourcedir', 
task.compile.sources.join(';'), '-suitename', task.project.id ]
+      cmd_args = ['-log', '2', '-sourcedir', task.compile.sources.join(';'), 
'-suitename', task.project.id ]
       cmd_args << '-d' << task.report_to.to_s
       # run all tests in the same suite
       cmd_args << '-testclass' << tests
+      
       cmd_options = { :properties=>options[:properties], 
:java_args=>options[:java_args],
         :classpath=>dependencies, :name => "TestNG in 
#{task.send(:project).name}" }
-
+      
+      tmp = nil
       begin
-        Java::Commands.java cmd_args, cmd_options
+        tmp = Tempfile.open("testNG")
+        tmp.write cmd_args.join("\n")
+        tmp.close
+        Java::Commands.java ['org.testng.TestNG', "@#{tmp.path}"], cmd_options
         return tests
       rescue
         # testng-failed.xml contains the list of failed tests *only*
@@ -338,6 +343,8 @@ module Buildr
         error "TestNG regexp returned unexpected failed tests 
#{failed.inspect}" unless (failed - tests).empty?
         # return the list of passed tests
         return tests - failed
+      ensure
+        tmp.close unless tmp.nil?
       end
     end
 


Reply via email to