You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by do...@apache.org on 2011/07/19 09:15:10 UTC

svn commit: r1148201 - in /buildr/trunk: CHANGELOG doc/languages.textile lib/buildr/java/bdd.rb lib/buildr/java/jtestr_result.rb lib/buildr/java/jtestr_runner.rb.erb spec/java/bdd_spec.rb

Author: donaldp
Date: Tue Jul 19 07:15:09 2011
New Revision: 1148201

URL: http://svn.apache.org/viewvc?rev=1148201&view=rev
Log:
BUILDR-548 Remove support for JTestR as it is no longer maintained (Antoine Toulme)

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/doc/languages.textile
    buildr/trunk/lib/buildr/java/bdd.rb
    buildr/trunk/lib/buildr/java/jtestr_result.rb
    buildr/trunk/lib/buildr/java/jtestr_runner.rb.erb
    buildr/trunk/spec/java/bdd_spec.rb

Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=1148201&r1=1148200&r2=1148201&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Tue Jul 19 07:15:09 2011
@@ -1,4 +1,5 @@
 1.4.7 (Pending)
+* Chage: BUILDR-548 Remove support for JTestR as it is no longer maintained (Antoine Toulme)
 * Added: BUILDR-598 TestNG support for :groups and :excludegroups (Christopher Coco)
 * Fixed: BUILDR-439 "The command line is too long" when running TestNG tests (Tammo Van Lessen)
 * Fixed: BUILDR-595 Add option to specifiy location of ca cert

Modified: buildr/trunk/doc/languages.textile
URL: http://svn.apache.org/viewvc/buildr/trunk/doc/languages.textile?rev=1148201&r1=1148200&r2=1148201&view=diff
==============================================================================
--- buildr/trunk/doc/languages.textile (original)
+++ buildr/trunk/doc/languages.textile Tue Jul 19 07:15:09 2011
@@ -559,41 +559,3 @@ Supports the following options:
 | @:properties@   | Hash of system properties available to the test case. |
 | @:java_args@    | Arguments passed as is to the JVM. (only when fork is enabled) |
 
-h4.  JtestR
-
-"JtestR":http://jtestr.codehaus.org is a tool that makes it easier to test Java code with state of the art Ruby tools. Using JtestR you can describe your application behaviour using many testing frameworks at the same time.
-
-To use this framework in your project you can select it with @test.using :jtestr@.
-
-You can use the @build.yaml@ settings file to specify a particular version of JtestR (defaults to @0.3.1@).  For example:
-
-{% highlight yaml %}
-jtestr: 0.3.1
-{% endhighlight %}
-
-To customize TestNG/JUnit versions refer to their respective section.
-
-When selected, Buildr will configure JtestR to use your project/testing classpath and will search for the following test patterns for each framework supported by JtestR:
-
-|_. Framework                    |_. Patterns |
-| "RSpec":http://rspec.info      | Files in @src/spec/ruby@ ending with @*_spec.rb@ or @*_story.rb@ |
-| "TestUnit":http://ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.html | Files in @src/spec/ruby@ ending with @*_test.rb@, @*Test.rb@ |
-| "Expectations":http://expectations.rubyforge.org/ | Files in @src/spec/ruby@ ending with @*_expect.rb@ |
-| "JUnit":http://www.junit.org   | Classes from @src/test/java@ that either subclass @junit.framework.TestCase@, include methods annotated with @org.junit.Test@, or test suites annotated with @org.org.junit.runner.RunWith@. |
-| "TestNG":http://testng.org     | Classes from @src/test/java@ annotated with  @org.testng.annotations.Test@ |
-
-If you create a @src/spec/ruby/jtestr_config.rb@ file, it will be loaded by JtestR, just after being configured by Buildr, this way you can configure as described on "JtestR guide":http://jtestr.codehaus.org/Configuration.
-
-p(tip). If you have a @jtestr_config.rb@ file, don't set @JtestR::result_handler@. Buildr uses its (@RSpecResultHandler@)  so that it can know which tests succeeded/failed, this handler is capable of using RSpec formatter classes, so that you can obtain an html report or use a custom rspec formatter with @JtestR@. See the @format@ option.
-
-Supports the following options:
-
-|_. Option        |_. Value |
-| @:config@       | The JtestR config file to be loaded after being configured by Buildr. Defaults to @src/spec/ruby/jtestr_config.rb@. |
-| @:gems@         | Hash of gems needed before running the tests. Keys are gem names, values are the required gem version. An example use of this option would be to require the ci_reporter gem to generate xml reports |
-| @:requires@     | Array of ruby files to require before running the specs |
-| @:format@       | Array of valid RSpec @--format@ option values. Defaults to html report on the @reports@ directory and text progress |
-| @:output@       | File path to output dump. @false@ to supress output |
-| @:fork@         | Run the tests on a new java vm. (enabled unless running on JRuby) |
-| @:properties@   | Hash of system properties available to the test case. (only when fork is enabled) |
-| @:java_args@    | Arguments passed as is to the JVM. (only when fork is enabled) |

Modified: buildr/trunk/lib/buildr/java/bdd.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/bdd.rb?rev=1148201&r1=1148200&r2=1148201&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/bdd.rb (original)
+++ buildr/trunk/lib/buildr/java/bdd.rb Tue Jul 19 07:15:09 2011
@@ -47,7 +47,7 @@ module Buildr
   module TestFramework::JRubyBased
     extend self
 
-    VERSION = '1.5.4' # Note: JtestR 0.6.0 only works up to 1.5.4
+    VERSION = '1.6.2'
 
     class << self
       def version
@@ -276,119 +276,6 @@ module Buildr
 
   end
 
-  # <a href="http://jtestr.codehaus.org/">JtestR</a> is a framework for BDD and TDD using JRuby and ruby tools.
-  # To test your project with JtestR use:
-  #   test.using :jtestr
-  #
-  #
-  # Support the following options:
-  # * :config     -- path to JtestR config file. defaults to @spec/ruby/jtestr_config.rb@
-  # * :gems       -- A hash of gems to install before running the tests.
-  #                  The keys of this hash are the gem name, the value must be the required version.
-  # * :requires   -- A list of ruby files to require before running the specs
-  #                  Mainly used if an rspec format needs to require some file.
-  # * :format     -- A list of valid Rspec --format option values. (defaults to 'progress')
-  # * :output     -- File path to output dump. @false@ to supress output
-  # * :fork       -- Create a new JavaVM to run the tests on
-  # * :properties -- Hash of properties passed to the test suite.
-  # * :java_args  -- Arguments passed to the JVM.
-  class JtestR < TestFramework::JavaBDD
-    @lang = :ruby
-    @bdd_dir = :spec
-
-    include TestFramework::JRubyBased
-
-    VERSION = '0.6'
-
-    # pattern for rspec stories
-    STORY_PATTERN    = /_(steps|story)\.rb$/
-    # pattern for test_unit files
-    TESTUNIT_PATTERN = /(_test|Test)\.rb$|(tc|ts)[^\\\/]+\.rb$/
-    # pattern for test files using http://expectations.rubyforge.org/
-    EXPECT_PATTERN   = /_expect\.rb$/
-
-    TESTS_PATTERN = [STORY_PATTERN, TESTUNIT_PATTERN, EXPECT_PATTERN] + RSpec::TESTS_PATTERN
-
-    class << self
-
-      def version
-        Buildr.settings.build['jtestr'] || VERSION
-      end
-
-      def dependencies
-        unless @dependencies
-          super
-          @dependencies |= ["org.jtestr:jtestr:jar:#{version}"] +
-                           JUnit.dependencies + TestNG.dependencies
-        end
-        @dependencies
-      end
-
-      def applies_to?(project) #:nodoc:
-        File.exist?(project.path_to(:source, bdd_dir, lang, 'jtestr_config.rb')) ||
-          Dir[project.path_to(:source, bdd_dir, lang, '**/*.rb')].any? { |f| TESTS_PATTERN.any? { |r| r === f } } ||
-          JUnit.applies_to?(project) || TestNG.applies_to?(project)
-      end
-
-    private
-      def const_missing(const)
-        return super unless const == :REQUIRES # TODO: remove in 1.5
-        Buildr.application.deprecated 'Please use JtestR.dependencies/.version instead of JtestR::REQUIRES/VERSION'
-        dependencies
-      end
-
-    end
-
-    def initialize(task, options) #:nodoc:
-      super
-      [:test, :spec].each do |usage|
-        java_tests = task.project.path_to(:source, usage, :java)
-        task.compile.from java_tests if File.directory?(java_tests)
-        resources = task.project.path_to(:source, usage, :resources)
-        task.resources.from resources if File.directory?(resources)
-      end
-    end
-
-    def user_config
-      options[:config] || task.project.path_to(:source, bdd_dir, lang, 'jtestr_config.rb')
-    end
-
-    def tests(dependencies) #:nodoc:
-      dependencies |= [task.compile.target.to_s]
-      types = { :story => STORY_PATTERN, :rspec => RSpec::TESTS_PATTERN,
-                :testunit => TESTUNIT_PATTERN, :expect => EXPECT_PATTERN }
-      tests = types.keys.inject({}) { |h, k| h[k] = []; h }
-      tests[:junit] = JUnit.new(task, {}).tests(dependencies)
-      tests[:testng] = TestNG.new(task, {}).tests(dependencies)
-      Dir[task.project.path_to(:source, bdd_dir, lang, '**/*.rb')].each do |rb|
-        type = types.find { |k, v| Array(v).any? { |r| r === rb } }
-        tests[type.first] << rb if type
-      end
-      @jtestr_tests = tests
-      tests.values.flatten
-    end
-
-    def runner_config
-      runner = super
-      # JtestR 0.6.0 comes with rspec 1.3.0 (and any other jtestr dependency) included,
-      # so the rspec version used depends on the jtestr jar.
-      runner.gems.update 'rspec' => '=1.3.0'
-      runner.requires.clear
-      runner.requires.unshift 'jtestr'
-      runner.requires.unshift 'spec'
-      runner.requires.unshift File.join(File.dirname(__FILE__), 'jtestr_result')
-      runner.rspec = ['--format', 'progress', '--format', "html:#{runner.html_report}"]
-      runner.format.each { |format| runner.rspec << '--format' << format } if runner.format
-      runner.rspec.push '--format', "Buildr::JtestR::YamlFormatter:#{runner.result}"
-      runner
-    end
-
-    def runner_content(binding)
-      runner_erb = File.join(File.dirname(__FILE__), 'jtestr_runner.rb.erb')
-      Filter::Mapper.new(:erb, binding).transform(File.read(runner_erb), runner_erb)
-    end
-  end
-
   # JBehave is a Java BDD framework. To use in your project:
   #   test.using :jbehave
   #
@@ -458,6 +345,5 @@ module Buildr
 end
 
 Buildr::TestFramework << Buildr::RSpec
-Buildr::TestFramework << Buildr::JtestR
 Buildr::TestFramework << Buildr::JBehave
 

Modified: buildr/trunk/lib/buildr/java/jtestr_result.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/jtestr_result.rb?rev=1148201&r1=1148200&r2=1148201&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/jtestr_result.rb (original)
+++ buildr/trunk/lib/buildr/java/jtestr_result.rb Tue Jul 19 07:15:09 2011
@@ -1,331 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with this
-# work for additional information regarding copyright ownership.  The ASF
-# licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-# License for the specific language governing permissions and limitations under
-# the License.
-
-# necessary to require YAML even if it is mentioned by autoload as it fails on some platforms.
-require 'yaml'
-require 'fileutils'
-
-module Buildr #:nodoc:
-
-  module TestFramework
-
-    # A class used by buildr for jruby based frameworks, so that buildr can know
-    # which tests succeeded/failed.
-    class TestResult
-
-      class Error < ::Exception
-        attr_reader :message, :backtrace
-        def initialize(message, backtrace)
-          @message = message
-          @backtrace = backtrace
-          set_backtrace backtrace
-        end
-
-        def self.dump_yaml(file, e)
-          FileUtils.mkdir_p File.dirname(file)
-          File.open(file, 'w') { |f| f.puts(YAML.dump(Error.new(e.message, e.backtrace))) }
-        end
-
-        def self.guard(file)
-          begin
-            yield
-          rescue => e
-            dump_yaml(file, e)
-          end
-        end
-      end
-
-      attr_accessor :failed, :succeeded
-
-      def initialize
-        @failed, @succeeded = [], []
-      end
-    end
-  end
-
-  module JtestR
-
-    # An Rspec formatter used by JtestR
-    class YamlFormatter
-      attr_reader :result
-
-      attr_accessor :example_group, :options, :where
-
-      def initialize(options, where)
-        @options = options
-        @where = where
-      end
-
-      %w[ example_started
-          start_dump dump_failure dump_summary dump_pending ].each do |meth|
-        module_eval "def #{meth}(*args); end"
-      end
-
-      def example_group_started(example_group)
-        @example_group = example_group
-      end
-
-      def example_passed(example)
-        result.succeeded << example_name(example)
-      end
-
-      def example_pending(example, counter)
-        result.succeeded << example_name(example)
-      end
-
-      def example_failed(example, counter, failure)
-        result.failed << example_name(example)
-      end
-
-      def start(example_count)
-        @result = Buildr::TestFramework::TestResult.new
-      end
-
-      def close
-        result.succeeded = result.succeeded - result.failed
-        FileUtils.mkdir_p File.dirname(where)
-        File.open(where, 'w') { |f| f.puts YAML.dump(result) }
-      end
-
-    private
-      def example_name(example)
-        if Spec::Example::ExampleProxy === example
-          example_group.location.gsub(/:\d+$/, '')
-        else
-          example.name.gsub(/(.+)(\..+\(\))/, '\1')
-        end
-      end
-    end # YamlFormatter
-
-    # A JtestR ResultHandler
-    # Using this handler we can use RSpec formatters, like html/ci_reporter with JtestR
-    # Created for JTestrYamlFormatter
-    class ResultHandler
-
-      # Workaround for http://jira.codehaus.org/browse/JTESTR-68
-      module TestNGResultHandlerMixin
-        def onTestSuccess(test_result)
-          @result_handler.succeed_single(test_result.name)
-        end
-      end
-
-      class BacktraceTweaker
-        attr_reader :ignore_patterns
-        def initialize
-          @ignore_patterns = ::Spec::Runner::QuietBacktraceTweaker::IGNORE_PATTERNS.dup
-          # ignore jruby/jtestr backtrace
-          ignore_patterns << /org\.jruby\.javasupport\.JavaMethod\./
-          ignore_patterns << /jtestr.*\.jar!/i << /runner\.rb/
-        end
-
-        def clean_up_double_slashes(line)
-          line.gsub!('//','/')
-        end
-
-        def tweak_backtrace(error)
-          return if error.backtrace.nil?
-          error.backtrace.collect! do |line|
-            clean_up_double_slashes(line)
-            ignore_patterns.each do |ignore|
-              if line =~ ignore
-                line = nil
-                break
-              end
-            end
-            line
-          end
-          error.backtrace.compact!
-        end
-      end
-
-      class << self
-        # an rspec reporter used to proxy events to rspec formatters
-        attr_reader :reporter
-        attr_accessor :test_files
-
-        def init(argv = [], out = STDOUT, err = STDERR)
-          ::JtestR::TestNGResultHandler.module_eval { include TestNGResultHandlerMixin }
-          rspec_parser = ::Spec::Runner::OptionParser.new(err, out)
-          rspec_parser.order!(argv)
-          rspec_parser.options.backtrace_tweaker = BacktraceTweaker.new
-          @reporter = Spec::Runner::Reporter.new(rspec_parser.options)
-        end
-
-        def before
-          reporter.start(reporter.options.files.size)
-        end
-
-        def after
-          reporter.end
-          reporter.dump
-        end
-
-      end
-
-      module ExampleMethods
-        attr_accessor :name, :description, :__full_description, :location
-      end
-
-      def reporter
-        self.class.reporter
-      end
-
-      attr_accessor :example_group, :current_example, :current_failure
-
-      def initialize(name, desc, *args)
-        self.example_group = ::Spec::Example::ExampleGroup.new(desc)
-        example_group.extend ExampleMethods
-        example_group.name = name.to_s
-        if example_group.name[/Spec/]
-          example_group.description = desc.to_s
-        else
-          example_group.description = name.to_s
-        end
-        reporter.example_group_started(example_group)
-      end
-
-
-      def starting
-      end
-
-      def ending
-      end
-
-      def add_fault(fault)
-        self.current_failure = fault
-      end
-
-      def add_pending(pending)
-      end
-
-      def starting_single(name = nil)
-        self.current_failure = nil
-        self.current_example = Object.new
-        current_example.extend ::Spec::Example::ExampleMethods
-        current_example.extend ExampleMethods
-        name = name.to_s
-        current_example.location = name.to_s
-        current_example.name = name.gsub(/(.*)\((.+)\)/, '\2')
-        current_example.description = name
-        if example_group.name[/Spec/]
-          current_example.__full_description = "#{example_group.description} #{name}"
-        else
-          current_example.__full_description = "#{example_group.name}: #{name}"
-        end
-        reporter.example_started(current_example)
-      end
-
-      def succeed_single(name = nil)
-        reporter.example_finished(current_example, nil)
-      end
-
-      def fail_single(name = nil)
-        current_example.name = current_name
-        reporter.example_finished(current_example, current_error)
-      end
-
-      def error_single(name = nil)
-        current_example.name = current_name
-        reporter.example_finished(current_example, current_error)
-      end
-
-      def pending_single(name = nil)
-        error = ::Spec::Example::ExamplePendingError.new(name)
-        reporter.example_finished(current_example, error)
-      end
-
-    private
-      def detect_file(trace)
-        # find first matching test file in stacktrace
-        file = nil
-        first_pos = nil
-        ResultHandler.test_files.each do |f|
-          pos = trace.index(f)
-          if pos && (first_pos.nil? || pos < first_pos)
-            file = f
-            first_pos = pos
-          end
-        end
-        file || fail("JTestR::ResultHandler.detect_file failed: #{trace}")
-      end
-
-      def current_name(example = current_example, fault = current_failure)
-        return example.name unless fault
-        case fault
-        when Test::Unit::Error
-          detect_file(fault.long_display)
-        when Test::Unit::Failure
-          detect_file(fault.location.to_s)
-        when Spec::Runner::Reporter::Failure
-          detect_file(fault.exception.backtrace.to_s)
-        else
-          example.name
-        end
-      end
-
-      def current_error(fault = current_failure)
-        case fault
-        when nil
-          nil
-        when Test::Unit::Failure
-          Buildr::TestFramework::TestResult::Error.new(fault.message, fault.location)
-        when Test::Unit::Error
-          if fault.exception.is_a?(NativeException)
-            exception = fault.exception.cause
-            bt = exception.stack_trace.to_a
-          else
-            exception = fault.exception
-            bt = exception.backtrace
-          end
-          Buildr::TestFramework::TestResult::Error.new(exception.message, bt)
-        when Expectations::Results::Error
-          fault.exception
-        when Spec::Runner::Reporter::Failure
-          ex = fault.exception
-          Buildr::TestFramework::TestResult::Error.new(ex.message, ex.backtrace)
-        when Expectations::Results
-          file = fault.file
-          line = fault.line
-          Buildr::TestFramework::TestResult::Error.new(fault.message, ["#{fault.file}:#{fault.line}"])
-        else
-          if fault.respond_to?(:test_header)
-            fault.test_header[/\((.+)\)/]
-            test_cls, test_meth = $1.to_s, $`.to_s
-            exception = fault.exception
-            (class << exception; self; end).module_eval do
-              define_method(:backtrace) do
-                (["#{test_cls}:in `#{test_meth}'"] + stackTrace).map { |s| s.to_s }
-              end
-            end
-            exception
-          elsif fault.respond_to?(:method)
-            test_cls, test_meth = fault.method.test_class.name, fault.method.method_name
-            exception = fault.throwable
-            (class << exception; self; end).module_eval do
-              define_method(:backtrace) do
-                (["#{test_cls}:in `#{test_meth}'"] + stackTrace).map { |s| s.to_s }
-              end
-            end
-            exception
-          else
-            raise "Cannot handle fault #{fault.class}: #{fault.inspect}"
-          end
-        end
-      end
-
-    end # ResultHandler
-  end
-end
-

Modified: buildr/trunk/lib/buildr/java/jtestr_runner.rb.erb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/jtestr_runner.rb.erb?rev=1148201&r1=1148200&r2=1148201&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/jtestr_runner.rb.erb (original)
+++ buildr/trunk/lib/buildr/java/jtestr_runner.rb.erb Tue Jul 19 07:15:09 2011
@@ -1,116 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with this
-# work for additional information regarding copyright ownership.  The ASF
-# licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-# License for the specific language governing permissions and limitations under
-# the License.
-
-#  ___   ___     _  _  ___ _____    ___ ___ ___ _____    _____ _  _ ___ ___
-# |   \ / _ \   | \| |/ _ \_   _|  | __|   \_ _|_   _|  |_   _| || |_ _/ __|
-# | |) | (_) |  | .` | (_) || |    | _|| |) | |  | |      | | | __ || |\__ \
-# |___/ \___/   |_|\_|\___/ |_|    |___|___/___| |_|      |_| |_||_|___|___/
-#
-#  ___ ___ _    ___
-# | __|_ _| |  | __|  CHANGES TO THIS FILE WILL BE LOST
-# | _| | || |__| _|   AUTO-GENERATED BY BUILDR on <%= Time.now %>
-# |_| |___|____|___|  PREFER TO EDIT JtestR CONFIGURATION FILE:
-#
-# <%= user_config %>
-
-begin
-  <%= jruby_gem %>
-  <%= dependencies.map(&:to_s).inspect %>.each { |dep| $CLASSPATH << dep }
-  <%= runner.gems.inspect %>.each { |ary| JRuby.gem(*ary.flatten) }
-  <%= runner.requires.inspect %>.each { |rb| Kernel.require rb }
-
-  jtestr = JtestR::TestRunner.new
-
-  class << jtestr
-    def config(&block)
-      @config_blocks ||= []
-      @config_blocks << block if block
-      @config_blocks
-    end
-
-    def load_configuration
-      super
-      config.each { |block| @configuration.instance_eval(&block) }
-    end
-  end
-
-  jtestr.config do
-    classpath [] # already loaded
-    add_common_classpath false
-
-    <% ts = ( @jtestr_tests[:junit] & tests ).map { |c| 'Java.' + c } %>
-    junit [<%= ts.join(', ') %>]
-
-    <% ts = ( @jtestr_tests[:testng] & tests ).map { |c| 'Java.' + c } %>
-    testng [<%= ts.join(', ') %>]
-
-    <% ts = @jtestr_tests[:testunit] & tests %>
-    test_unit <%= ts.inspect %>
-
-    <% ts = @jtestr_tests[:story] & tests %>
-    story <%= ts.inspect %>
-
-    <% ts = @jtestr_tests[:rspec] & tests %>
-    rspec <%= ts.inspect %>
-
-    <% ts = @jtestr_tests[:expect] & tests %>
-    expectations <%= ts.inspect %>
-
-    ignore __FILE__
-
-    if File.file?(<%= user_config.inspect %>)
-      ignore <%= user_config.inspect %>
-      load <%= user_config.inspect %>
-    end
-  end # config
-
-  fake_out = StringIO.new
-
-  <% if runner.output == false %>
-     output = fake_out
-  <% elsif runner.output.kind_of?(String) %>
-     output = File.open(<%= result.output.inspect %>, 'w')
-  <% else %>
-     output = STDOUT
-  <% end %>
-
-  args = [ '<%= spec_dir %>', # the directory to search for jtestr files
-           JtestR::SimpleLogger::ERR, # log level (DEBUG/WARN/ERR)
-           JtestR::GenericResultHandler::QUIET, #output level (QUIET/VERBOSE)
-           fake_out, # output STDOUT
-           [], # groups to run
-           # Use JtestR::GenericResultHandler for debugging
-           Buildr::JtestR::ResultHandler, # result handler
-           []  # classpath
-         ]
-
-  argv = <%= runner.rspec.inspect %> || []
-  argv.push *<%= tests.inspect %>
-  Buildr::JtestR::ResultHandler.init(argv, output, output)
-  Buildr::JtestR::ResultHandler.test_files = <%= tests.inspect %>
-
-  jtestr.run *args
-
-rescue => e
-  Buildr::TestFramework::TestResult::Error.dump_yaml('<%= runner.result %>', e) rescue \
-  puts "-[--- ERROR ---]-", e.class, e.message, *e.backtrace
-end
-
-exit 0 # let buildr find the errors from the result yaml
-
-# Local Variables:
-# mode: ruby
-# End:
-

Modified: buildr/trunk/spec/java/bdd_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/bdd_spec.rb?rev=1148201&r1=1148200&r2=1148201&view=diff
==============================================================================
--- buildr/trunk/spec/java/bdd_spec.rb (original)
+++ buildr/trunk/spec/java/bdd_spec.rb Tue Jul 19 07:15:09 2011
@@ -51,224 +51,6 @@ describe Buildr::RSpec do
 
 end if RUBY_PLATFORM =~ /java/ || ENV['JRUBY_HOME'] # RSpec
 
-describe Buildr::JtestR do
-
-  before do
-    # clear cached dependencies
-    Buildr::JUnit.instance_eval { @dependencies = nil }
-    Buildr::JtestR.instance_eval { @dependencies = nil }
-  end
-
-  def foo(*args, &prc)
-    define('foo', *args) do
-      test.using :jtestr, :output => false
-      if prc
-        instance_eval(&prc)
-      else
-        self
-      end
-    end
-  end
-
-  it 'should be selected by :jtestr name' do
-    foo { test.framework.should eql(:jtestr) }
-  end
-
-  it 'should apply to projects having test_unit sources' do
-    define('one', :base_dir => 'one') do
-      write _('src/spec/ruby/one_test.rb')
-      JtestR.applies_to?(self).should be_true
-    end
-    define('two', :base_dir => 'two') do
-      write _('src/spec/ruby/twoTest.rb')
-      JtestR.applies_to?(self).should be_true
-    end
-    define('three', :base_dir => 'three') do
-      write _('src/spec/ruby/tc_three.rb')
-      JtestR.applies_to?(self).should be_true
-    end
-    define('four', :base_dir => 'four') do
-      write _('src/spec/ruby/ts_four.rb')
-      JtestR.applies_to?(self).should be_true
-    end
-  end
-
-  it 'should apply to projects having rspec sources' do
-    define('one', :base_dir => 'one') do
-      write _('src/spec/ruby/one_spec.rb')
-      JtestR.applies_to?(self).should be_true
-    end
-  end
-
-  it 'should apply to projects having expectations sources' do
-    define('one', :base_dir => 'one') do
-      write _('src/spec/ruby/one_expect.rb')
-      JtestR.applies_to?(self).should be_true
-    end
-  end
-
-  it 'should apply to projects having junit sources' do
-    define('one', :base_dir => 'one') do
-      write _('src/test/java/example/OneTest.java'), <<-JAVA
-        package example;
-        public class OneTest extends junit.framework.TestCase { }
-      JAVA
-      JtestR.applies_to?(self).should be_true
-    end
-  end
-
-  it 'should apply to projects having testng sources' do
-    define('one', :base_dir => 'one') do
-      write _('src/test/java/example/OneTest.java'), <<-JAVA
-        package example;
-        public class OneTest {
-           @org.testng.annotations.Test
-           public void testNothing() {}
-        }
-      JAVA
-      JtestR.applies_to?(self).should be_true
-    end
-  end
-
-  it 'should use a java compiler if java sources found' do
-    foo do
-      write _('src/spec/java/Something.java'), 'public class Something {}'
-      test.compile.language.should eql(:java)
-    end
-  end
-
-  it 'should load user jtestr_config.rb' do
-    foo do
-      hello = _('hello')
-      write('src/spec/ruby/jtestr_config.rb', "File.open('#{hello}', 'w') { |f| f.write 'HELLO' }")
-      write('src/spec/ruby/some_spec.rb')
-      test.invoke
-      File.should be_exist(hello)
-      File.read(hello).should == 'HELLO'
-    end
-  end
-
-  it 'should run junit tests' do
-    write('src/test/java/example/SuccessTest.java', <<-JAVA)
-        package example;
-        public class SuccessTest extends junit.framework.TestCase {
-           public void testSuccess() { assertTrue(true); }
-        }
-    JAVA
-    write('src/test/java/example/FailureTest.java', <<-JAVA)
-        package example;
-        public class FailureTest extends junit.framework.TestCase {
-           public void testFailure() { assertTrue(false); }
-        }
-    JAVA
-    foo do
-      lambda { test.invoke }.should raise_error(/Tests failed/)
-      test.tests.should include('example.SuccessTest', 'example.FailureTest')
-      test.failed_tests.should include('example.FailureTest')
-      test.passed_tests.should include('example.SuccessTest')
-    end
-  end
-
-  it 'should run testng tests' do
-    write('src/test/java/example/Success.java', <<-JAVA)
-        package example;
-        public class Success {
-          @org.testng.annotations.Test
-          public void annotatedSuccess() { org.testng.Assert.assertTrue(true); }
-        }
-    JAVA
-    write('src/test/java/example/Failure.java', <<-JAVA)
-        package example;
-        public class Failure {
-          @org.testng.annotations.Test
-          public void annotatedFail() { org.testng.Assert.fail("FAIL"); }
-        }
-    JAVA
-    foo do
-      lambda { test.invoke }.should raise_error(/Tests failed/)
-      test.tests.should include('example.Success', 'example.Failure')
-      test.failed_tests.should include('example.Failure')
-      test.passed_tests.should include('example.Success')
-    end
-  end
-
-  it 'should run test_unit' do
-    success = File.expand_path('src/spec/ruby/success_test.rb')
-    write(success, <<-TESTUNIT)
-      require 'test/unit'
-      class TC_Success < Test::Unit::TestCase
-        def test_success
-          assert true
-        end
-      end
-    TESTUNIT
-    failure = File.expand_path('src/spec/ruby/failure_test.rb')
-    write(failure, <<-TESTUNIT)
-      require 'test/unit'
-      class TC_Failure < Test::Unit::TestCase
-        def test_failure
-          assert false
-        end
-      end
-    TESTUNIT
-    error = File.expand_path('src/spec/ruby/error_test.rb')
-    write(error, <<-TESTUNIT)
-      require 'test/unit'
-      class TC_Error < Test::Unit::TestCase
-        def test_error
-          lambda;
-        end
-      end
-    TESTUNIT
-    foo do
-      lambda { test.invoke }.should raise_error(/Tests failed/)
-      test.tests.should include(success, failure, error)
-      test.failed_tests.should include(failure, error)
-      test.passed_tests.should include(success)
-    end
-  end
-
-  it 'should run expectations' do
-    success = File.expand_path('src/spec/ruby/success_expect.rb')
-    write(success, 'Expectations { expect(true) { true } }')
-    failure = File.expand_path('src/spec/ruby/failure_expect.rb')
-    write(failure, 'Expectations { expect(true) { false } }')
-    error = File.expand_path('src/spec/ruby/error_expect.rb')
-    write(error, 'Expectations { expect(nil) { lambda {}; } }')
-    foo do
-      lambda { test.invoke }.should raise_error(/Tests failed/)
-      test.tests.should include(success, failure, error)
-      test.failed_tests.should include(failure, error)
-      test.passed_tests.should include(success)
-    end
-  end
-
-  it 'should run rspecs' do
-    success = File.expand_path('src/spec/ruby/success_spec.rb')
-    write(success, 'describe("success") { it("is true") { nil.should be_nil } }')
-    failure = File.expand_path('src/spec/ruby/failure_spec.rb')
-    write(failure, 'describe("failure") { it("is false") { true.should == false } }')
-    error = File.expand_path('src/spec/ruby/error_spec.rb')
-    write(error, 'describe("error") { it("raises") { lambda; } }')
-    pending =  File.expand_path('src/spec/ruby/pending_spec.rb')
-    write(pending, 'describe("pending") { it "is not implemented" }')
-    foo do
-      lambda { test.invoke }.should raise_error(/Tests failed/)
-      test.tests.should include(success, failure, error)
-      test.failed_tests.should include(failure, error)
-      test.passed_tests.should include(success)
-    end
-  end
-
-  after do
-    # reset to default
-    Buildr.settings.build['junit'] = nil
-    Buildr::JUnit.instance_eval { @dependencies = nil }
-    Buildr::JtestR.instance_eval { @dependencies = nil }
-  end
-
-end if ENV["JTESTR"] && (RUBY_PLATFORM =~ /java/ || ENV['JRUBY_HOME']) # JtestR
-
 describe Buildr::JBehave do
   def foo(*args, &prc)
     define('foo', *args) do