Author: toulmean
Date: Sat Aug 28 18:01:12 2010
New Revision: 990401

URL: http://svn.apache.org/viewvc?rev=990401&view=rev
Log:
make sure junit3 is supported ; adding an integration test and tweaking 
filter_classes

Added:
    buildr/trunk/tests/junit3/
    buildr/trunk/tests/junit3/Buildfile
    buildr/trunk/tests/junit3/src/
    buildr/trunk/tests/junit3/src/main/
    buildr/trunk/tests/junit3/src/main/java/
    buildr/trunk/tests/junit3/src/main/java/Foo.java
    buildr/trunk/tests/junit3/src/test/
    buildr/trunk/tests/junit3/src/test/java/
    buildr/trunk/tests/junit3/src/test/java/FooTest.java
Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/lib/buildr/java/tests.rb
    buildr/trunk/tests/integration_testing.rb

Modified: buildr/trunk/CHANGELOG
URL: 
http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=990401&r1=990400&r2=990401&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Sat Aug 28 18:01:12 2010
@@ -1,6 +1,7 @@
 1.4.2 (pending)
 * Added:  BUILDR-415 Ability to exclude tests from command line
 * Added:  BUILDR-495 Document twitter on Buildr's homepage
+* Added:  Integration test to show how to use junit 3.
 * Added:  Integration test to show how to get ahold of parent project
 * Change: BUILDR-473 Update jruby-openssl dependency version or support a 
range of versions
 * Change: BUILDR-478 Upgrade to net-ssh 2.0.23 and net-sftp 2.0.4 (Shane 
Witbeck)

Modified: buildr/trunk/lib/buildr/java/tests.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/tests.rb?rev=990401&r1=990400&r2=990401&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/tests.rb (original)
+++ buildr/trunk/lib/buildr/java/tests.rb Sat Aug 28 18:01:12 2010
@@ -219,10 +219,15 @@ module Buildr
     end
 
     def tests(dependencies) #:nodoc:
-      filter_classes(dependencies,
-                     :interfaces => %w{junit.framework.TestCase},
-                     :class_annotations => %w{org.junit.runner.RunWith},
-                     :method_annotations => %w{org.junit.Test})
+      if (self.class.version[0,1].to_i < 4)
+        filter_classes(dependencies, :interfaces => 
%w{junit.framework.TestCase})
+      else
+        filter_classes(dependencies,
+                       :interfaces => %w{junit.framework.TestCase},
+                       :class_annotations => %w{org.junit.runner.RunWith},
+                       :method_annotations => %w{org.junit.Test})
+      end
+      
     end
 
     def run(tests, dependencies) #:nodoc:

Modified: buildr/trunk/tests/integration_testing.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/tests/integration_testing.rb?rev=990401&r1=990400&r2=990401&view=diff
==============================================================================
--- buildr/trunk/tests/integration_testing.rb (original)
+++ buildr/trunk/tests/integration_testing.rb Sat Aug 28 18:01:12 2010
@@ -13,7 +13,7 @@
 # License for the specific language governing permissions and limitations under
 # the License.
 
-BUILDR = ENV['BUILDR'] || File.join(File.expand_path(File.dirname(__FILE__)), 
"..", "bin", "buildr")
+BUILDR = ENV['BUILDR'] || File.join(File.expand_path(File.dirname(__FILE__)), 
"..", "_buildr")
 
 require 'test/unit'
 
@@ -22,7 +22,7 @@ def test(folder, cmd)
 class #{folder.sub("-", "").capitalize} < Test::Unit::TestCase
 
   def test_#{folder.sub("-", "")}
-    result = %x[cd #{File.join(File.expand_path(File.dirname(__FILE__)), 
"#{folder}")} ; #{cmd} ; buildr clean]
+    result = %x[cd #{File.join(File.expand_path(File.dirname(__FILE__)), 
"#{folder}")} ; #{cmd} ; #{BUILDR} clean]
     assert($?.success?)
   end
 
@@ -32,14 +32,14 @@ TEST
 end
 
 class Buildr320 < Test::Unit::TestCase
-  
-  def test_circular_dependency
-    result = %x[cd #{File.join(File.expand_path(File.dirname(__FILE__)), 
"BUILDR-320")} ; #{BUILDR} --trace -P]
-    assert($?.success?)
-  end
-  
+   
+   def test_circular_dependency
+     result = %x[cd #{File.join(File.expand_path(File.dirname(__FILE__)), 
"BUILDR-320")} ; #{BUILDR} --trace -P]
+     assert($?.success?)
+   end   
 end
 
 test("JavaSystemProperty", "#{BUILDR} test")
 test("helloWorld", "#{BUILDR} package")
-test("compile_with_parent", "#{BUILDR} compile")
\ No newline at end of file
+test("compile_with_parent", "#{BUILDR} compile")
+test("junit3", "#{BUILDR} test")
\ No newline at end of file

Added: buildr/trunk/tests/junit3/Buildfile
URL: 
http://svn.apache.org/viewvc/buildr/trunk/tests/junit3/Buildfile?rev=990401&view=auto
==============================================================================
--- buildr/trunk/tests/junit3/Buildfile (added)
+++ buildr/trunk/tests/junit3/Buildfile Sat Aug 28 18:01:12 2010
@@ -0,0 +1,9 @@
+
+repositories.remote << "http://repo1.maven.org/maven2";
+Buildr.settings.build['junit'] = '3.8.1'
+
+define "foo" do
+  compile
+  test
+  
+end
\ No newline at end of file

Added: buildr/trunk/tests/junit3/src/main/java/Foo.java
URL: 
http://svn.apache.org/viewvc/buildr/trunk/tests/junit3/src/main/java/Foo.java?rev=990401&view=auto
==============================================================================
--- buildr/trunk/tests/junit3/src/main/java/Foo.java (added)
+++ buildr/trunk/tests/junit3/src/main/java/Foo.java Sat Aug 28 18:01:12 2010
@@ -0,0 +1,7 @@
+
+public class Foo {
+       
+       public String bar() {
+               return "bar";
+       }
+}
\ No newline at end of file

Added: buildr/trunk/tests/junit3/src/test/java/FooTest.java
URL: 
http://svn.apache.org/viewvc/buildr/trunk/tests/junit3/src/test/java/FooTest.java?rev=990401&view=auto
==============================================================================
--- buildr/trunk/tests/junit3/src/test/java/FooTest.java (added)
+++ buildr/trunk/tests/junit3/src/test/java/FooTest.java Sat Aug 28 18:01:12 
2010
@@ -0,0 +1,12 @@
+
+import junit.framework.TestCase;
+import static junit.framework.Assert.assertEquals;
+
+public class FooTest extends TestCase {
+       
+       public void testFoo() {
+               Foo foo = new Foo();
+               assertEquals("bar", foo.bar());
+       }
+       
+}
\ No newline at end of file


Reply via email to