From 48624ff3a91107c73de23e71a6ea9496ca73f4ab Mon Sep 17 00:00:00 2001 From: Chad Wilson Date: Wed, 22 Jan 2025 00:14:27 +0800 Subject: [PATCH 01/20] Support only Rack 2.x with Rails, removing old 1.x rack/rails compat Rack 2.x wraps the @env within @req so previous overrides were not working correctly in all cases. --- Gemfile | 2 +- Gemfile.lock | 2 +- src/main/ruby/jruby/rack/session_store.rb | 96 ++++--------------- .../session/java_servlet_store_spec.rb | 8 +- 4 files changed, 25 insertions(+), 83 deletions(-) diff --git a/Gemfile b/Gemfile index e36b3b55..10693d08 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ group :default do if rack_version = ENV['RACK_VERSION'] gem 'rack', rack_version else - gem 'rack', '< 3.0' + gem 'rack', '~> 2.2', '< 3.0' end end diff --git a/Gemfile.lock b/Gemfile.lock index ba9fe00e..587bc011 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -29,7 +29,7 @@ PLATFORMS DEPENDENCIES appraisal (< 1.0) - rack (< 3.0) + rack (~> 2.2, < 3.0) rake (~> 13.2) rspec diff --git a/src/main/ruby/jruby/rack/session_store.rb b/src/main/ruby/jruby/rack/session_store.rb index 860d6bc8..a49c5364 100644 --- a/src/main/ruby/jruby/rack/session_store.rb +++ b/src/main/ruby/jruby/rack/session_store.rb @@ -10,74 +10,38 @@ module JRuby::Rack module Session - if defined?(::Rack::Session::Abstract::SessionHash) # Rack 1.3+ + class SessionHash < ::Rack::Session::Abstract::SessionHash - # as of rails 3.1.x the rack session hash implementation is used - # rather than the custom rails AbstractStore::SessionHash class - class SessionHash < ::Rack::Session::Abstract::SessionHash; end - - # 1.5.0 removed SessionHash http://github.com/rack/rack/commit/83a270d64820 - OptionsHash = if defined?(::Rack::Session::Abstract::OptionsHash) - ::Rack::Session::Abstract::OptionsHash - else nil + def enabled? # Rails 7.0 added a need for this in Sessions, and forgot to make it optional within flash middleware + true end - elsif defined?(ActionDispatch::Session::AbstractStore) # Rails 3.0 - - require 'active_support/core_ext/hash' # non-loaded SessionHash dependency - - class SessionHash < ActionDispatch::Session::AbstractStore::SessionHash; end - - OptionsHash = ActionDispatch::Session::AbstractStore::OptionsHash - - else # a fallback for (old) Rails 2.3 - - class SessionHash < ActionController::Session::AbstractStore::SessionHash; end - - OptionsHash = ActionController::Session::AbstractStore::OptionsHash - - end - - SessionHash.class_eval do - # Allows direct delegation to servlet session methods when session is active def method_missing(method, *args, &block) - servlet_session = store.get_servlet_session(@env) + servlet_session = @store.get_servlet_session(@req.env) if servlet_session && servlet_session.respond_to?(method) servlet_session.send(method, *args, &block) else super end end - - private - def store - @store ||= defined?(@store) ? @store : @by # Rack 1.5 renamed @by - end - end # Rack based SessionStore implementation but compatible with (older) AbstractStore. class SessionStore < ::Rack::Session::Abstract::ID - ENV_SESSION_KEY = defined?(::Rack::Session::Abstract::ENV_SESSION_KEY) ? - ::Rack::Session::Abstract::ENV_SESSION_KEY : 'rack.session'.freeze - - ENV_SESSION_OPTIONS_KEY = defined?(::Rack::Session::Abstract::ENV_SESSION_OPTIONS_KEY) ? - ::Rack::Session::Abstract::ENV_SESSION_OPTIONS_KEY : 'rack.session.options'.freeze - ENV_SERVLET_SESSION_KEY = 'java.servlet_session'.freeze - RAILS_SESSION_KEY = "__current_rails_session".freeze def initialize(app, options={}) super(app, options.merge!(:cookie_only => false, :defer => true)) end - def context(env, app = @app) # adapt Rack 1.1/1.2 to be compatible with 1.3+ - prepare_session(env) - status, headers, body = app.call(env) - commit_session(env, status, headers, body) + def context(env, app = @app) + req = make_request env + prepare_session(req) + status, headers, body = app.call(req.env) + commit_session(req, status, headers, body) end # (public) servlet specific methods : @@ -117,20 +81,9 @@ def generate_sid(secure = @sid_secure) nil # dummy method - no session id generation with servlet API end - def prepare_session(env) # exist since Rack 1.3 - session_was = env[ENV_SESSION_KEY] - env[ENV_SESSION_KEY] = session_class.new(self, env) - if options_hash = ::JRuby::Rack::Session::OptionsHash - env[ENV_SESSION_OPTIONS_KEY] = options_hash.new(self, env, @default_options) - else - env[ENV_SESSION_OPTIONS_KEY] = @default_options.dup - end - env[ENV_SESSION_KEY].merge! session_was if session_was - end - - def load_session(env, session_id = nil) # session_id arg for get_session alias + def load_session(req) # session_id arg for get_session alias session_id, session = false, {} - if servlet_session = get_servlet_session(env) + if servlet_session = get_servlet_session(req.env) begin session_id = servlet_session.getId servlet_session.synchronized do @@ -152,33 +105,27 @@ def load_session(env, session_id = nil) # session_id arg for get_session alias end [ session_id, session ] end - alias :get_session :load_session # for AbstractStore::SessionHash compatibility - def extract_session_id(env) - servlet_session = get_servlet_session(env) + def extract_session_id(req) + servlet_session = get_servlet_session(req.env) servlet_session.getId rescue nil if servlet_session end - def current_session_id(env) - env[ENV_SESSION_OPTIONS_KEY][:id] # 1.5.0: env[ENV_SESSION_KEY].id - end if ::JRuby::Rack::Session::OptionsHash - - def session_exists?(env) - value = current_session_id(env) + def session_exists?(req) + value = current_session_id(req) value && ! value.empty? end - alias :exists? :session_exists? # for AbstractStore::SessionHash compatibility def loaded_session?(session) ! session.is_a?(::JRuby::Rack::Session::SessionHash) || session.loaded? end - def commit_session(env, status, headers, body) - session = env[ENV_SESSION_KEY] - options = env[ENV_SESSION_OPTIONS_KEY] + def commit_session(req, status, headers, body) + session = req.env[::Rack::RACK_SESSION] + options = req.env[::Rack::RACK_SESSION_OPTIONS] if options[:drop] || options[:renew] - destroy_session(env, options[:id], options) + destroy_session(req.env, options[:id], options) end return [status, headers, body] if options[:drop] || options[:skip] @@ -186,8 +133,8 @@ def commit_session(env, status, headers, body) if loaded_session?(session) session_id = session.respond_to?(:id=) ? session.id : options[:id] session_data = session.to_hash.delete_if { |_,v| v.nil? } - unless set_session(env, session_id, session_data, options) - env["rack.errors"].puts("WARNING #{self.class.name} failed to save session. Content dropped.") + unless set_session(req.env, session_id, session_data, options) + req.env["rack.errors"].puts("WARNING #{self.class.name} failed to save session. Content dropped.") end end @@ -245,7 +192,6 @@ def destroy_session(env, session_id = nil, options = nil) rescue java.lang.IllegalStateException # if session already invalid nil end - alias :destroy :destroy_session # for AbstractStore::SessionHash compatibility end diff --git a/src/spec/ruby/action_controller/session/java_servlet_store_spec.rb b/src/spec/ruby/action_controller/session/java_servlet_store_spec.rb index caa804c3..b4c0f57f 100644 --- a/src/spec/ruby/action_controller/session/java_servlet_store_spec.rb +++ b/src/spec/ruby/action_controller/session/java_servlet_store_spec.rb @@ -32,10 +32,6 @@ @session_store = ActionController::Session::JavaServletStore.new(@app) end - it "should raise an error if the servlet request is not present" do - expect { @session_store.call({}) }.to raise_error(RuntimeError) - end - it "should do nothing if the session is not accessed" do @app.should_receive(:call) @session_store.call(@env) @@ -95,7 +91,7 @@ @request.should_receive(:getSession).with(false).and_return @session @app.should_receive(:call) @session_store.call(@env) - @session_store.send(:extract_session_id, @env).should == @session_id + expect(@session_store.send(:extract_session_id, Rack::Request.new(@env))).to eq @session_id end it "should retrieve the marshalled session from the java session" do @@ -313,7 +309,7 @@ def new_session_hash(*args) else store = @session_store; env = args[0]; end - ::JRuby::Rack::Session::SessionHash.new(store, env) + ::JRuby::Rack::Session::SessionHash.new(store, ::Rack::Request.new(env)) end end if defined? Rails From d35b12220b5978987acd33d63bf198d2b437199b Mon Sep 17 00:00:00 2001 From: Chad Wilson Date: Wed, 22 Jan 2025 15:21:49 +0800 Subject: [PATCH 02/20] Workaround NameError frozen string literal issues with JRuby 9.3 and Rails 5.2/6.0 --- src/main/ruby/jruby/rack/helpers.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/ruby/jruby/rack/helpers.rb b/src/main/ruby/jruby/rack/helpers.rb index b19512f2..b5e2028c 100644 --- a/src/main/ruby/jruby/rack/helpers.rb +++ b/src/main/ruby/jruby/rack/helpers.rb @@ -134,7 +134,7 @@ def resolve_constant(camel_cased_name, context = Object) require underscore(camel_cased_name) retry rescue LoadError => le - e.message << " (#{le.message})" + e.message = "#{e.message} (#{le.message})" end unless required raise e end From be1f62974409f5006315d5c2a4ac15622e0a106b Mon Sep 17 00:00:00 2001 From: Chad Wilson Date: Wed, 22 Jan 2025 00:15:28 +0800 Subject: [PATCH 03/20] Correct mock method visibility for newer JRuby tests Only affects appraisals/rails tests right now it seems where the MockHttpSession is used. --- src/spec/java/org/jruby/rack/mock/MockHttpSession.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/spec/java/org/jruby/rack/mock/MockHttpSession.java b/src/spec/java/org/jruby/rack/mock/MockHttpSession.java index 9435e257..7275bf90 100644 --- a/src/spec/java/org/jruby/rack/mock/MockHttpSession.java +++ b/src/spec/java/org/jruby/rack/mock/MockHttpSession.java @@ -101,7 +101,7 @@ public String getId() { return this.id; } - void setId(String id) { + public void setId(String id) { this.id = id; } @@ -256,7 +256,7 @@ public String toString() { return getClass().getName() + "@" + Integer.toHexString(hashCode()) + this.attributes; } - Map getAttributes() { + public Map getAttributes() { return attributes; } From 78bc656c4a8a8e5f7fd1a3bf12668722dc0b86e0 Mon Sep 17 00:00:00 2001 From: Chad Wilson Date: Wed, 22 Jan 2025 01:23:26 +0800 Subject: [PATCH 04/20] Workaround logger require issues with concurrent-ruby 1.3.5 and older Rails versions --- src/spec/ruby/spec_helper.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/src/spec/ruby/spec_helper.rb b/src/spec/ruby/spec_helper.rb index b629dab1..0cbac5b2 100644 --- a/src/spec/ruby/spec_helper.rb +++ b/src/spec/ruby/spec_helper.rb @@ -163,6 +163,7 @@ def should_not_eval_as_nil(code, runtime = @runtime) # alias begin # NOTE: only if running with a `bundle exec` to better isolate if $LOAD_PATH.find { |path| path =~ /\/rails\-[\w\.]*\// } + require 'logger' # Workaround for concurrent-ruby problems on older rails versions require 'rails/version' # use Rails::VERSION to detect current env require 'rails' # attempt to load rails - for "real life" testing end From e34b0f6ce0c3184d083622bf4782e94f2ab7f07c Mon Sep 17 00:00:00 2001 From: Chad Wilson Date: Wed, 22 Jan 2025 13:35:44 +0800 Subject: [PATCH 05/20] Remove some deprecated rspec usage --- .../session/java_servlet_store_spec.rb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/spec/ruby/action_controller/session/java_servlet_store_spec.rb b/src/spec/ruby/action_controller/session/java_servlet_store_spec.rb index b4c0f57f..8ef7bc31 100644 --- a/src/spec/ruby/action_controller/session/java_servlet_store_spec.rb +++ b/src/spec/ruby/action_controller/session/java_servlet_store_spec.rb @@ -28,6 +28,7 @@ @session.stub(:synchronized).and_yield @request = double "servlet request" @app = double "app" + @app.stub(:call).and_return [200, {}, ["body"]] @env = {"java.servlet_request" => @request, "rack.errors" => $stderr} @session_store = ActionController::Session::JavaServletStore.new(@app) end @@ -41,13 +42,13 @@ @app.should_receive(:call) @session_store.call(@env) session = @env['rack.session'] - @session_store.send(:loaded_session?, session).should == false + expect(@session_store.send(:loaded_session?, session)).to eq false end it "should pass the application response untouched" do response = [200, {}, ["body"]] @app.should_receive(:call).and_return response - @session_store.call(@env).should == response + expect(@session_store.call(@env)).to eq response end it "should load the session when accessed" do @@ -74,7 +75,7 @@ end @session_store.call(@env) session = @env['rack.session'] - @session_store.send(:loaded_session?, session).should == true + expect(@session_store.send(:loaded_session?, session)).to eq true end it "should use custom session hash when loading session" do @@ -103,8 +104,8 @@ @session.should_receive(:getAttribute).with(session_key).and_return marshal_data.to_java_bytes @session.stub(:setAttribute); @session.stub(:getCreationTime).and_return 1 @app.should_receive(:call) do |env| - env['rack.session']["foo"].should == 1 - env['rack.session']["bar"].should == true + expect(env['rack.session']["foo"]).to eq 1 + expect(env['rack.session']["bar"]).to eq true end @session_store.call(@env) end @@ -117,8 +118,8 @@ @session.should_receive(:getAttribute).with("bar").and_return hash["bar"] @session.stub(:setAttribute); @session.stub(:getCreationTime).and_return 1 @app.should_receive(:call) do |env| - env['rack.session']["foo"].should == hash["foo"] - env['rack.session']["bar"].should == hash["bar"] + expect(env['rack.session']["foo"]).to eq hash["foo"] + expect(env['rack.session']["bar"]).to eq hash["bar"] end @session_store.call(@env) end @@ -257,7 +258,7 @@ @session.should_receive(:getLastAccessedTime).and_return time @session.stub(:setAttribute) @app.should_receive(:call) do |env| - env['rack.session'].getLastAccessedTime.should == time + expect(env['rack.session'].getLastAccessedTime).to eq time lambda { env['rack.session'].blah_blah }.should raise_error(NoMethodError) end @session_store.call(@env) From c27409ffa7df3e305a48966cb4103d81b15acce9 Mon Sep 17 00:00:00 2001 From: Chad Wilson Date: Tue, 26 Nov 2024 17:43:45 +0800 Subject: [PATCH 06/20] Re-enable Rails appraisals to run on modern Rails versions --- .github/workflows/maven.yml | 86 ++++++- .travis.yml | 299 ------------------------- Appraisals | 44 ++-- Gemfile | 2 +- Gemfile.lock | 6 +- gemfiles/.bundle/config | 2 + gemfiles/rails23.gemfile | 9 - gemfiles/rails23.gemfile.lock | 44 ---- gemfiles/rails30.gemfile | 9 - gemfiles/rails30.gemfile.lock | 92 -------- gemfiles/rails31.gemfile | 10 - gemfiles/rails31.gemfile.lock | 104 --------- gemfiles/rails32.gemfile | 10 - gemfiles/rails32.gemfile.lock | 102 --------- gemfiles/rails40.gemfile | 9 - gemfiles/rails40.gemfile.lock | 84 ------- gemfiles/rails41.gemfile | 9 - gemfiles/rails41.gemfile.lock | 91 -------- gemfiles/rails42.gemfile | 10 - gemfiles/rails42.gemfile.lock | 113 ---------- gemfiles/rails50.gemfile | 15 ++ gemfiles/rails50.gemfile.lock | 149 ++++++++++++ gemfiles/rails52.gemfile | 15 ++ gemfiles/rails52.gemfile.lock | 157 +++++++++++++ gemfiles/rails60.gemfile | 15 ++ gemfiles/rails60.gemfile.lock | 173 ++++++++++++++ gemfiles/rails61.gemfile | 15 ++ gemfiles/rails61.gemfile.lock | 176 +++++++++++++++ gemfiles/rails62.gemfile | 15 ++ gemfiles/rails70.gemfile | 15 ++ gemfiles/rails70.gemfile.lock | 175 +++++++++++++++ gemfiles/rails71.gemfile | 15 ++ gemfiles/rails71.gemfile.lock | 212 ++++++++++++++++++ gemfiles/rails72.gemfile | 15 ++ gemfiles/rails72.gemfile.lock | 206 +++++++++++++++++ gemfiles/railsNG.gemfile | 8 - gemfiles/railsNG.gemfile.lock | 165 -------------- src/spec/ruby/rack/application_spec.rb | 2 +- 38 files changed, 1465 insertions(+), 1213 deletions(-) delete mode 100644 .travis.yml create mode 100644 gemfiles/.bundle/config delete mode 100644 gemfiles/rails23.gemfile delete mode 100644 gemfiles/rails23.gemfile.lock delete mode 100644 gemfiles/rails30.gemfile delete mode 100644 gemfiles/rails30.gemfile.lock delete mode 100644 gemfiles/rails31.gemfile delete mode 100644 gemfiles/rails31.gemfile.lock delete mode 100644 gemfiles/rails32.gemfile delete mode 100644 gemfiles/rails32.gemfile.lock delete mode 100644 gemfiles/rails40.gemfile delete mode 100644 gemfiles/rails40.gemfile.lock delete mode 100644 gemfiles/rails41.gemfile delete mode 100644 gemfiles/rails41.gemfile.lock delete mode 100644 gemfiles/rails42.gemfile delete mode 100644 gemfiles/rails42.gemfile.lock create mode 100644 gemfiles/rails50.gemfile create mode 100644 gemfiles/rails50.gemfile.lock create mode 100644 gemfiles/rails52.gemfile create mode 100644 gemfiles/rails52.gemfile.lock create mode 100644 gemfiles/rails60.gemfile create mode 100644 gemfiles/rails60.gemfile.lock create mode 100644 gemfiles/rails61.gemfile create mode 100644 gemfiles/rails61.gemfile.lock create mode 100644 gemfiles/rails62.gemfile create mode 100644 gemfiles/rails70.gemfile create mode 100644 gemfiles/rails70.gemfile.lock create mode 100644 gemfiles/rails71.gemfile create mode 100644 gemfiles/rails71.gemfile.lock create mode 100644 gemfiles/rails72.gemfile create mode 100644 gemfiles/rails72.gemfile.lock delete mode 100644 gemfiles/railsNG.gemfile delete mode 100644 gemfiles/railsNG.gemfile.lock diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index e3ce1e00..3771421c 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -1,12 +1,4 @@ -# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven - -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -name: Java CI with Maven +name: Java CI on: push: @@ -21,22 +13,94 @@ jobs: strategy: matrix: - java_version: [ '8', '11', '17', '21' ] jruby_version: [ '9.3.15.0', '9.4.9.0' ] + java_version: [ '8', '11', '17', '21' ] fail-fast: false steps: - uses: actions/checkout@v4 + - name: Set up JDK uses: actions/setup-java@v4 with: java-version: ${{ matrix.java_version }} distribution: 'temurin' cache: maven + - name: Build with Maven - run: mvn -B install --file pom.xml -Djruby.version=${{ matrix.jruby_version }} + run: mvn -B install -Djruby.version=${{ matrix.jruby_version }} # Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive - name: Update dependency graph uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6 if: github.head_ref == 'refs/heads/master' && matrix.java_version == '8' && startsWith(matrix.jruby_version, '9.4') + + appraisals: + needs: build + name: ${{ matrix.appraisal }} appraisal on ${{ matrix.jruby_version }} / Java ${{ matrix.java_version }} + runs-on: ubuntu-latest + + strategy: + matrix: + jruby_version: [ '9.3.15.0', '9.4.9.0' ] + java_version: [ '8', '11', '17', '21' ] + appraisal: [ 'rails50', 'rails52', 'rails60', 'rails61', 'rails70', 'rails71', 'rails72' ] + exclude: + - jruby_version: '9.3.15.0' + java_version: '8' + appraisal: 'rails70' # Requires Ruby 2.7 compatibility, which JRuby 9.3 does not support + - jruby_version: '9.3.15.0' + java_version: '8' + appraisal: 'rails71' # Requires Ruby 2.7 compatibility, which JRuby 9.3 does not support + - jruby_version: '9.3.15.0' + java_version: '8' + appraisal: 'rails72' # Requires Ruby 3.1 compatibility, which JRuby 9.3 does not support + - jruby_version: '9.3.15.0' + java_version: '11' + appraisal: 'rails70' # Requires Ruby 2.7 compatibility, which JRuby 9.3 does not support + - jruby_version: '9.3.15.0' + java_version: '11' + appraisal: 'rails71' # Requires Ruby 2.7 compatibility, which JRuby 9.3 does not support + - jruby_version: '9.3.15.0' + java_version: '11' + appraisal: 'rails72' # Requires Ruby 3.1 compatibility, which JRuby 9.3 does not support + - jruby_version: '9.3.15.0' + java_version: '17' + appraisal: 'rails70' # Requires Ruby 2.7 compatibility, which JRuby 9.3 does not support + - jruby_version: '9.3.15.0' + java_version: '17' + appraisal: 'rails71' # Requires Ruby 2.7 compatibility, which JRuby 9.3 does not support + - jruby_version: '9.3.15.0' + java_version: '17' + appraisal: 'rails72' # Requires Ruby 3.1 compatibility, which JRuby 9.3 does not support + - jruby_version: '9.3.15.0' + java_version: '21' + appraisal: 'rails70' # Requires Ruby 2.7 compatibility, which JRuby 9.3 does not support + - jruby_version: '9.3.15.0' + java_version: '21' + appraisal: 'rails71' # Requires Ruby 2.7 compatibility, which JRuby 9.3 does not support + - jruby_version: '9.3.15.0' + java_version: '21' + appraisal: 'rails72' # Requires Ruby 3.1 compatibility, which JRuby 9.3 does not support + fail-fast: false + + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java_version }} + distribution: 'temurin' + cache: maven + + - name: Setup JRuby + uses: ruby/setup-ruby@v1 + with: + ruby-version: jruby-${{ matrix.jruby_version }} + + - name: Run appraisal for ${{ matrix.appraisal }} + env: + BUNDLE_GEMFILE: gemfiles/${{ matrix.appraisal }}.gemfile + run: bundle install && bundle exec rake spec + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d59f7c81..00000000 --- a/.travis.yml +++ /dev/null @@ -1,299 +0,0 @@ -language: ruby -sudo: false -bundler_args: --without development -script: rake spec -branches: - only: - - master - - maintenance-1.1.13 - - /.*stable$/ - - /^test-.*$/ -rvm: - # NOTE: do not use jruby-19mode otherwise some specs might fail - # @see ruby/rack/application_spec.rb for an explanation on this - #- jruby-18mode - #- jruby-19mode - - jruby-1.7.16 - - jruby-head -jdk: - - openjdk6 - - oraclejdk7 - - oraclejdk8 -gemfile: - - Gemfile - - gemfiles/rails23.gemfile - - gemfiles/rails30.gemfile - - gemfiles/rails31.gemfile - - gemfiles/rails32.gemfile - - gemfiles/rails40.gemfile - - gemfiles/rails41.gemfile -env: - - JRUBY_OPTS="--1.8 $JRUBY_OPTS" - - JRUBY_OPTS="$JRUBY_OPTS" JAVA_OPTS="-Djruby.version=$JRUBY_VERSION" # for mvn's jruby plugins -before_script: - - export JRUBY_OPTS="--server -Xcext.enabled=false -Xcompile.invokedynamic=false -J-XX:MaxPermSize=128m" - - export JRUBY_VERSION="1.7.13" - - jruby -S gem env || true -before_install: - # NOTE: RubyGems 2.4.x fails us at application_spec's gem_install_rack_unless_installed ! - - (jruby --1.9 -S gem update --system 2.2.3) || true - - ((jruby -v | grep 1.8.7) && jruby --1.9 -S gem update --system 2.1.11) || true - - ((echo $BUNDLE_GEMFILE | grep rails23) && jruby --1.9 -S gem update --system 1.8.29) || true -matrix: - allow_failures: - #- gemfile: gemfiles/rails41.gemfile - exclude: - ## avoid jruby-head with JDK6 : - - rvm: jruby-head - gemfile: Gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: openjdk6 - - rvm: jruby-head - gemfile: Gemfile - env: JRUBY_OPTS="$JRUBY_OPTS" JAVA_OPTS="-Djruby.version=$JRUBY_VERSION" - jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails23.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails23.gemfile - env: JRUBY_OPTS="$JRUBY_OPTS" JAVA_OPTS="-Djruby.version=$JRUBY_VERSION" - jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails30.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails30.gemfile - env: JRUBY_OPTS="$JRUBY_OPTS" JAVA_OPTS="-Djruby.version=$JRUBY_VERSION" - jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails31.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails31.gemfile - env: JRUBY_OPTS="$JRUBY_OPTS" JAVA_OPTS="-Djruby.version=$JRUBY_VERSION" - jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails32.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails32.gemfile - env: JRUBY_OPTS="$JRUBY_OPTS" JAVA_OPTS="-Djruby.version=$JRUBY_VERSION" - jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails40.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails40.gemfile - env: JRUBY_OPTS="$JRUBY_OPTS" JAVA_OPTS="-Djruby.version=$JRUBY_VERSION" - jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails41.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails41.gemfile - env: JRUBY_OPTS="$JRUBY_OPTS" JAVA_OPTS="-Djruby.version=$JRUBY_VERSION" - jdk: openjdk6 - ## rails 4.0 does not run on --1.8 - - rvm: jruby-1.7.16 - gemfile: gemfiles/rails40.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: openjdk6 - - rvm: jruby-1.7.16 - gemfile: gemfiles/rails40.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: oraclejdk7 - - rvm: jruby-1.7.16 - gemfile: gemfiles/rails40.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: oraclejdk8 - ## rails 4.1 won't run on --1.8 - - rvm: jruby-1.7.16 - gemfile: gemfiles/rails41.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: openjdk6 - - rvm: jruby-1.7.16 - gemfile: gemfiles/rails41.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: oraclejdk7 - - rvm: jruby-1.7.16 - gemfile: gemfiles/rails41.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: openjdk6 - - rvm: jruby-1.7.16 - gemfile: gemfiles/rails41.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: oraclejdk7 - - rvm: jruby-1.7.16 - gemfile: gemfiles/rails41.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: oraclejdk8 - ## rails 4.0 does not run on --1.8 (jruby-head) - #- rvm: jruby-head - # gemfile: gemfiles/rails40.gemfile - # env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - # jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails40.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: oraclejdk7 - - rvm: jruby-head - gemfile: gemfiles/rails40.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: oraclejdk8 - ## rails 4.1 won't run on --1.8 (jruby-head) - #- rvm: jruby-head - # gemfile: gemfiles/rails41.gemfile - # env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - # jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails41.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: oraclejdk7 - - rvm: jruby-head - gemfile: gemfiles/rails41.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: oraclejdk8 - ## rails 3.2 jruby-head won't support --1.8 - #- rvm: jruby-head - # gemfile: gemfiles/rails32.gemfile - # env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - # jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails32.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: oraclejdk7 - - rvm: jruby-head - gemfile: gemfiles/rails32.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: oraclejdk8 - ## jruby-head won't run on Java 6 : - - rvm: jruby-head - gemfile: gemfiles/rails23.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails23.gemfile - env: JRUBY_OPTS="$JRUBY_OPTS" JAVA_OPTS="-Djruby.version=$JRUBY_VERSION" - jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails30.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails30.gemfile - env: JRUBY_OPTS="$JRUBY_OPTS" JAVA_OPTS="-Djruby.version=$JRUBY_VERSION" - jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails31.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails31.gemfile - env: JRUBY_OPTS="$JRUBY_OPTS" JAVA_OPTS="-Djruby.version=$JRUBY_VERSION" - jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails32.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails32.gemfile - env: JRUBY_OPTS="$JRUBY_OPTS" JAVA_OPTS="-Djruby.version=$JRUBY_VERSION" - jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails40.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails40.gemfile - env: JRUBY_OPTS="$JRUBY_OPTS" JAVA_OPTS="-Djruby.version=$JRUBY_VERSION" - jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails41.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails41.gemfile - env: JRUBY_OPTS="$JRUBY_OPTS" JAVA_OPTS="-Djruby.version=$JRUBY_VERSION" - jdk: openjdk6 - ## do not run with 2.3 (jruby-head) : - #- rvm: jruby-head - # gemfile: gemfiles/rails23.gemfile - # env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - # jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails23.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: oraclejdk7 - - rvm: jruby-head - gemfile: gemfiles/rails23.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: oraclejdk8 - - rvm: jruby-head - gemfile: gemfiles/rails23.gemfile - env: JRUBY_OPTS="$JRUBY_OPTS" JAVA_OPTS="-Djruby.version=$JRUBY_VERSION" - jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails23.gemfile - env: JRUBY_OPTS="$JRUBY_OPTS" JAVA_OPTS="-Djruby.version=$JRUBY_VERSION" - jdk: oraclejdk7 - - rvm: jruby-head - gemfile: gemfiles/rails23.gemfile - env: JRUBY_OPTS="$JRUBY_OPTS" JAVA_OPTS="-Djruby.version=$JRUBY_VERSION" - jdk: oraclejdk8 - ## do not run with 3.0 (jruby-head) : - #- rvm: jruby-head - # gemfile: gemfiles/rails30.gemfile - # env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - # jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails30.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: oraclejdk7 - - rvm: jruby-head - gemfile: gemfiles/rails30.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: oraclejdk8 - #- rvm: jruby-head - # gemfile: gemfiles/rails30.gemfile - # env: JRUBY_OPTS="$JRUBY_OPTS" JAVA_OPTS="-Djruby.version=$JRUBY_VERSION" - # jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails30.gemfile - env: JRUBY_OPTS="$JRUBY_OPTS" JAVA_OPTS="-Djruby.version=$JRUBY_VERSION" - jdk: oraclejdk7 - - rvm: jruby-head - gemfile: gemfiles/rails30.gemfile - env: JRUBY_OPTS="$JRUBY_OPTS" JAVA_OPTS="-Djruby.version=$JRUBY_VERSION" - jdk: oraclejdk8 - ## do not run with 3.1 (jruby-head) : - #- rvm: jruby-head - # gemfile: gemfiles/rails31.gemfile - # env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - # jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails31.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: oraclejdk7 - - rvm: jruby-head - gemfile: gemfiles/rails31.gemfile - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" - jdk: oraclejdk8 - #- rvm: jruby-head - # gemfile: gemfiles/rails31.gemfile - # env: JRUBY_OPTS="$JRUBY_OPTS" JAVA_OPTS="-Djruby.version=$JRUBY_VERSION" - # jdk: openjdk6 - - rvm: jruby-head - gemfile: gemfiles/rails31.gemfile - env: JRUBY_OPTS="$JRUBY_OPTS" JAVA_OPTS="-Djruby.version=$JRUBY_VERSION" - jdk: oraclejdk7 - - rvm: jruby-head - gemfile: gemfiles/rails31.gemfile - env: JRUBY_OPTS="$JRUBY_OPTS" JAVA_OPTS="-Djruby.version=$JRUBY_VERSION" - jdk: oraclejdk8 diff --git a/Appraisals b/Appraisals index fe01ec6c..ef834bbd 100644 --- a/Appraisals +++ b/Appraisals @@ -1,43 +1,27 @@ -appraise "rails23" do - gem "rails", "~> 2.3.18" -end - -appraise "rails30" do - gem "rails", "~> 3.0.20" -end - -appraise "rails31" do - gem "i18n", "< 0.7" - gem "rails", "~> 3.1.12" -end - -appraise "rails32" do - gem "i18n", "< 0.7" - gem "rails", "~> 3.2.21" +appraise "rails50" do + gem "rails", "~> 5.0.0" end -appraise "rails40" do - gem "rails", "~> 4.0.13" +appraise "rails52" do + gem "rails", "~> 5.2.0" end -appraise "rails41" do - gem "rails", "~> 4.1.16" +appraise "rails60" do + gem "rails", "~> 6.0.0" end -appraise "rails42" do - gem "mime-types", "< 3", :require => false - gem "rails", "~> 4.2.9" +appraise "rails61" do + gem "rails", "~> 6.1.0" end -appraise "rails50" do - gem "rails", "~> 5.0.5" +appraise "rails70" do + gem "rails", "~> 7.0.0" end -appraise "rails51" do - gem "rails", "~> 5.1.2" +appraise "rails71" do + gem "rails", "~> 7.1.0" end -appraise "railsNG" do - gem 'rails', :github => 'rails/rails', :branch => 'master' - gem 'arel', :github => 'rails/arel', :branch => 'master' +appraise "rails72" do + gem "rails", "~> 7.2.0" end diff --git a/Gemfile b/Gemfile index 10693d08..9a3b630b 100644 --- a/Gemfile +++ b/Gemfile @@ -9,7 +9,7 @@ group :default do end group :development do - gem 'appraisal', '< 1.0', :require => nil + gem 'appraisal', :require => nil end gem 'rake', '~> 13.2', :group => :test, :require => nil diff --git a/Gemfile.lock b/Gemfile.lock index 587bc011..e8c76e01 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,9 +1,10 @@ GEM remote: https://rubygems.org/ specs: - appraisal (0.5.2) + appraisal (2.5.0) bundler rake + thor (>= 0.14.0) diff-lcs (1.5.1) rack (2.2.10) rake (13.2.1) @@ -20,6 +21,7 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-support (3.13.1) + thor (1.3.2) PLATFORMS universal-java-1.8 @@ -28,7 +30,7 @@ PLATFORMS universal-java-21 DEPENDENCIES - appraisal (< 1.0) + appraisal rack (~> 2.2, < 3.0) rake (~> 13.2) rspec diff --git a/gemfiles/.bundle/config b/gemfiles/.bundle/config new file mode 100644 index 00000000..c127f802 --- /dev/null +++ b/gemfiles/.bundle/config @@ -0,0 +1,2 @@ +--- +BUNDLE_RETRY: "1" diff --git a/gemfiles/rails23.gemfile b/gemfiles/rails23.gemfile deleted file mode 100644 index f238fadd..00000000 --- a/gemfiles/rails23.gemfile +++ /dev/null @@ -1,9 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "rake", "~> 10.4.2", :group=>:test, :require=>nil -gem "rspec", "~> 2.14.1", :group=>:test -gem "jruby-openssl", "~> 0.9.20", :group=>:test -gem "rails", "~> 2.3.18" - diff --git a/gemfiles/rails23.gemfile.lock b/gemfiles/rails23.gemfile.lock deleted file mode 100644 index 90f66c6b..00000000 --- a/gemfiles/rails23.gemfile.lock +++ /dev/null @@ -1,44 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - actionmailer (2.3.18) - actionpack (= 2.3.18) - actionpack (2.3.18) - activesupport (= 2.3.18) - rack (~> 1.1.0) - activerecord (2.3.18) - activesupport (= 2.3.18) - activeresource (2.3.18) - activesupport (= 2.3.18) - activesupport (2.3.18) - diff-lcs (1.2.5) - jruby-openssl (0.9.21-java) - rack (1.1.6) - rails (2.3.18) - actionmailer (= 2.3.18) - actionpack (= 2.3.18) - activerecord (= 2.3.18) - activeresource (= 2.3.18) - activesupport (= 2.3.18) - rake (>= 0.8.3) - rake (10.4.2) - rspec (2.14.1) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - rspec-core (2.14.8) - rspec-expectations (2.14.5) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.14.6) - -PLATFORMS - java - -DEPENDENCIES - jruby-openssl (~> 0.9.20) - rails (~> 2.3.18) - rake (~> 10.4.2) - rspec (~> 2.14.1) - -BUNDLED WITH - 1.14.6 diff --git a/gemfiles/rails30.gemfile b/gemfiles/rails30.gemfile deleted file mode 100644 index ecf30f7e..00000000 --- a/gemfiles/rails30.gemfile +++ /dev/null @@ -1,9 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "rake", "~> 10.4.2", :group=>:test, :require=>nil -gem "rspec", "~> 2.14.1", :group=>:test -gem "jruby-openssl", "~> 0.9.20", :group=>:test -gem "rails", "~> 3.0.20" - diff --git a/gemfiles/rails30.gemfile.lock b/gemfiles/rails30.gemfile.lock deleted file mode 100644 index 81927341..00000000 --- a/gemfiles/rails30.gemfile.lock +++ /dev/null @@ -1,92 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - abstract (1.0.0) - actionmailer (3.0.20) - actionpack (= 3.0.20) - mail (~> 2.2.19) - actionpack (3.0.20) - activemodel (= 3.0.20) - activesupport (= 3.0.20) - builder (~> 2.1.2) - erubis (~> 2.6.6) - i18n (~> 0.5.0) - rack (~> 1.2.5) - rack-mount (~> 0.6.14) - rack-test (~> 0.5.7) - tzinfo (~> 0.3.23) - activemodel (3.0.20) - activesupport (= 3.0.20) - builder (~> 2.1.2) - i18n (~> 0.5.0) - activerecord (3.0.20) - activemodel (= 3.0.20) - activesupport (= 3.0.20) - arel (~> 2.0.10) - tzinfo (~> 0.3.23) - activeresource (3.0.20) - activemodel (= 3.0.20) - activesupport (= 3.0.20) - activesupport (3.0.20) - arel (2.0.10) - builder (2.1.2) - diff-lcs (1.2.5) - erubis (2.6.6) - abstract (>= 1.0.0) - i18n (0.5.4) - jruby-openssl (0.9.21-java) - json (1.8.1-java) - mail (2.2.20) - activesupport (>= 2.3.6) - i18n (>= 0.4.0) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mime-types (1.25.1) - polyglot (0.3.5) - rack (1.2.8) - rack-mount (0.6.14) - rack (>= 1.0.0) - rack-test (0.5.7) - rack (>= 1.0) - rails (3.0.20) - actionmailer (= 3.0.20) - actionpack (= 3.0.20) - activerecord (= 3.0.20) - activeresource (= 3.0.20) - activesupport (= 3.0.20) - bundler (~> 1.0) - railties (= 3.0.20) - railties (3.0.20) - actionpack (= 3.0.20) - activesupport (= 3.0.20) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (~> 0.14.4) - rake (10.4.2) - rdoc (3.12.2) - json (~> 1.4) - rspec (2.14.1) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - rspec-core (2.14.8) - rspec-expectations (2.14.5) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.14.6) - thor (0.14.6) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.41) - -PLATFORMS - java - -DEPENDENCIES - jruby-openssl (~> 0.9.20) - rails (~> 3.0.20) - rake (~> 10.4.2) - rspec (~> 2.14.1) - -BUNDLED WITH - 1.14.6 diff --git a/gemfiles/rails31.gemfile b/gemfiles/rails31.gemfile deleted file mode 100644 index 08a6e69a..00000000 --- a/gemfiles/rails31.gemfile +++ /dev/null @@ -1,10 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "rake", "~> 10.4.2", :group=>:test, :require=>nil -gem "rspec", "~> 2.14.1", :group=>:test -gem "jruby-openssl", "~> 0.9.20", :group=>:test -gem "i18n", "< 0.7" -gem "rails", "~> 3.1.12" - diff --git a/gemfiles/rails31.gemfile.lock b/gemfiles/rails31.gemfile.lock deleted file mode 100644 index d2ba1cb6..00000000 --- a/gemfiles/rails31.gemfile.lock +++ /dev/null @@ -1,104 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - actionmailer (3.1.12) - actionpack (= 3.1.12) - mail (~> 2.4.4) - actionpack (3.1.12) - activemodel (= 3.1.12) - activesupport (= 3.1.12) - builder (~> 3.0.0) - erubis (~> 2.7.0) - i18n (~> 0.6) - rack (~> 1.3.6) - rack-cache (~> 1.2) - rack-mount (~> 0.8.2) - rack-test (~> 0.6.1) - sprockets (~> 2.0.4) - activemodel (3.1.12) - activesupport (= 3.1.12) - builder (~> 3.0.0) - i18n (~> 0.6) - activerecord (3.1.12) - activemodel (= 3.1.12) - activesupport (= 3.1.12) - arel (~> 2.2.3) - tzinfo (~> 0.3.29) - activeresource (3.1.12) - activemodel (= 3.1.12) - activesupport (= 3.1.12) - activesupport (3.1.12) - multi_json (~> 1.0) - arel (2.2.3) - builder (3.0.4) - diff-lcs (1.2.5) - erubis (2.7.0) - hike (1.2.3) - i18n (0.6.11) - jruby-openssl (0.9.21-java) - json (1.8.2-java) - mail (2.4.4) - i18n (>= 0.4.0) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mime-types (1.25.1) - multi_json (1.11.0) - polyglot (0.3.5) - rack (1.3.10) - rack-cache (1.2) - rack (>= 0.4) - rack-mount (0.8.3) - rack (>= 1.0.0) - rack-ssl (1.3.4) - rack - rack-test (0.6.3) - rack (>= 1.0) - rails (3.1.12) - actionmailer (= 3.1.12) - actionpack (= 3.1.12) - activerecord (= 3.1.12) - activeresource (= 3.1.12) - activesupport (= 3.1.12) - bundler (~> 1.0) - railties (= 3.1.12) - railties (3.1.12) - actionpack (= 3.1.12) - activesupport (= 3.1.12) - rack-ssl (~> 1.3.2) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (~> 0.14.6) - rake (10.4.2) - rdoc (3.12.2) - json (~> 1.4) - rspec (2.14.1) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - rspec-core (2.14.8) - rspec-expectations (2.14.5) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.14.6) - sprockets (2.0.5) - hike (~> 1.2) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - thor (0.14.6) - tilt (1.4.1) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.44) - -PLATFORMS - java - -DEPENDENCIES - i18n (< 0.7) - jruby-openssl (~> 0.9.20) - rails (~> 3.1.12) - rake (~> 10.4.2) - rspec (~> 2.14.1) - -BUNDLED WITH - 1.14.6 diff --git a/gemfiles/rails32.gemfile b/gemfiles/rails32.gemfile deleted file mode 100644 index 34a0b91a..00000000 --- a/gemfiles/rails32.gemfile +++ /dev/null @@ -1,10 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "rake", "~> 10.4.2", :group=>:test, :require=>nil -gem "rspec", "~> 2.14.1", :group=>:test -gem "jruby-openssl", "~> 0.9.20", :group=>:test -gem "i18n", "< 0.7" -gem "rails", "~> 3.2.21" - diff --git a/gemfiles/rails32.gemfile.lock b/gemfiles/rails32.gemfile.lock deleted file mode 100644 index 5cbb592f..00000000 --- a/gemfiles/rails32.gemfile.lock +++ /dev/null @@ -1,102 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - actionmailer (3.2.22) - actionpack (= 3.2.22) - mail (~> 2.5.4) - actionpack (3.2.22) - activemodel (= 3.2.22) - activesupport (= 3.2.22) - builder (~> 3.0.0) - erubis (~> 2.7.0) - journey (~> 1.0.4) - rack (~> 1.4.5) - rack-cache (~> 1.2) - rack-test (~> 0.6.1) - sprockets (~> 2.2.1) - activemodel (3.2.22) - activesupport (= 3.2.22) - builder (~> 3.0.0) - activerecord (3.2.22) - activemodel (= 3.2.22) - activesupport (= 3.2.22) - arel (~> 3.0.2) - tzinfo (~> 0.3.29) - activeresource (3.2.22) - activemodel (= 3.2.22) - activesupport (= 3.2.22) - activesupport (3.2.22) - i18n (~> 0.6, >= 0.6.4) - multi_json (~> 1.0) - arel (3.0.3) - builder (3.0.4) - diff-lcs (1.2.5) - erubis (2.7.0) - hike (1.2.3) - i18n (0.7.0) - journey (1.0.4) - jruby-openssl (0.9.21-java) - json (1.8.3-java) - mail (2.5.4) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mime-types (1.25.1) - multi_json (1.11.1) - polyglot (0.3.5) - rack (1.4.7) - rack-cache (1.2) - rack (>= 0.4) - rack-ssl (1.3.4) - rack - rack-test (0.6.3) - rack (>= 1.0) - rails (3.2.22) - actionmailer (= 3.2.22) - actionpack (= 3.2.22) - activerecord (= 3.2.22) - activeresource (= 3.2.22) - activesupport (= 3.2.22) - bundler (~> 1.0) - railties (= 3.2.22) - railties (3.2.22) - actionpack (= 3.2.22) - activesupport (= 3.2.22) - rack-ssl (~> 1.3.2) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.14.6, < 2.0) - rake (10.4.2) - rdoc (3.12.2) - json (~> 1.4) - rspec (2.14.1) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - rspec-core (2.14.8) - rspec-expectations (2.14.5) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.14.6) - sprockets (2.2.3) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - thor (0.19.1) - tilt (1.4.1) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.44) - -PLATFORMS - java - -DEPENDENCIES - i18n (< 0.7) - jruby-openssl (~> 0.9.20) - rails (~> 3.2.21) - rake (~> 10.4.2) - rspec (~> 2.14.1) - -BUNDLED WITH - 1.14.6 diff --git a/gemfiles/rails40.gemfile b/gemfiles/rails40.gemfile deleted file mode 100644 index debd7a5d..00000000 --- a/gemfiles/rails40.gemfile +++ /dev/null @@ -1,9 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "rake", "~> 10.4.2", :group=>:test, :require=>nil -gem "rspec", "~> 2.14.1", :group=>:test -gem "jruby-openssl", "~> 0.9.20", :group=>:test -gem "rails", "~> 4.0.13" - diff --git a/gemfiles/rails40.gemfile.lock b/gemfiles/rails40.gemfile.lock deleted file mode 100644 index 5d3715d8..00000000 --- a/gemfiles/rails40.gemfile.lock +++ /dev/null @@ -1,84 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - actionmailer (4.0.13) - actionpack (= 4.0.13) - mail (~> 2.5, >= 2.5.4) - actionpack (4.0.13) - activesupport (= 4.0.13) - builder (~> 3.1.0) - erubis (~> 2.7.0) - rack (~> 1.5.2) - rack-test (~> 0.6.2) - activemodel (4.0.13) - activesupport (= 4.0.13) - builder (~> 3.1.0) - activerecord (4.0.13) - activemodel (= 4.0.13) - activerecord-deprecated_finders (~> 1.0.2) - activesupport (= 4.0.13) - arel (~> 4.0.0) - activerecord-deprecated_finders (1.0.4) - activesupport (4.0.13) - i18n (~> 0.6, >= 0.6.9) - minitest (~> 4.2) - multi_json (~> 1.3) - thread_safe (~> 0.1) - tzinfo (~> 0.3.37) - arel (4.0.2) - builder (3.1.4) - diff-lcs (1.2.5) - erubis (2.7.0) - i18n (0.7.0) - jruby-openssl (0.9.21-java) - mail (2.6.3) - mime-types (>= 1.16, < 3) - mime-types (2.6.1) - minitest (4.7.5) - multi_json (1.11.1) - rack (1.5.5) - rack-test (0.6.3) - rack (>= 1.0) - rails (4.0.13) - actionmailer (= 4.0.13) - actionpack (= 4.0.13) - activerecord (= 4.0.13) - activesupport (= 4.0.13) - bundler (>= 1.3.0, < 2.0) - railties (= 4.0.13) - sprockets-rails (~> 2.0) - railties (4.0.13) - actionpack (= 4.0.13) - activesupport (= 4.0.13) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (10.4.2) - rspec (2.14.1) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - rspec-core (2.14.8) - rspec-expectations (2.14.5) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.14.6) - sprockets (3.2.0) - rack (~> 1.0) - sprockets-rails (2.3.2) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (>= 2.8, < 4.0) - thor (0.19.1) - thread_safe (0.3.5-java) - tzinfo (0.3.44) - -PLATFORMS - java - -DEPENDENCIES - jruby-openssl (~> 0.9.20) - rails (~> 4.0.13) - rake (~> 10.4.2) - rspec (~> 2.14.1) - -BUNDLED WITH - 1.14.6 diff --git a/gemfiles/rails41.gemfile b/gemfiles/rails41.gemfile deleted file mode 100644 index 28928149..00000000 --- a/gemfiles/rails41.gemfile +++ /dev/null @@ -1,9 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "rake", "~> 10.4.2", :group=>:test, :require=>nil -gem "rspec", "~> 2.14.1", :group=>:test -gem "jruby-openssl", "~> 0.9.20", :group=>:test -gem "rails", "~> 4.1.16" - diff --git a/gemfiles/rails41.gemfile.lock b/gemfiles/rails41.gemfile.lock deleted file mode 100644 index e223b9be..00000000 --- a/gemfiles/rails41.gemfile.lock +++ /dev/null @@ -1,91 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - actionmailer (4.1.16) - actionpack (= 4.1.16) - actionview (= 4.1.16) - mail (~> 2.5, >= 2.5.4) - actionpack (4.1.16) - actionview (= 4.1.16) - activesupport (= 4.1.16) - rack (~> 1.5.2) - rack-test (~> 0.6.2) - actionview (4.1.16) - activesupport (= 4.1.16) - builder (~> 3.1) - erubis (~> 2.7.0) - activemodel (4.1.16) - activesupport (= 4.1.16) - builder (~> 3.1) - activerecord (4.1.16) - activemodel (= 4.1.16) - activesupport (= 4.1.16) - arel (~> 5.0.0) - activesupport (4.1.16) - i18n (~> 0.6, >= 0.6.9) - json (~> 1.7, >= 1.7.7) - minitest (~> 5.1) - thread_safe (~> 0.1) - tzinfo (~> 1.1) - arel (5.0.1.20140414130214) - builder (3.2.3) - concurrent-ruby (1.0.5-java) - diff-lcs (1.2.5) - erubis (2.7.0) - i18n (0.7.0) - jruby-openssl (0.9.21-java) - json (1.8.6-java) - mail (2.6.6) - mime-types (>= 1.16, < 4) - mime-types (2.6.2) - minitest (5.10.3) - rack (1.5.5) - rack-test (0.6.3) - rack (>= 1.0) - rails (4.1.16) - actionmailer (= 4.1.16) - actionpack (= 4.1.16) - actionview (= 4.1.16) - activemodel (= 4.1.16) - activerecord (= 4.1.16) - activesupport (= 4.1.16) - bundler (>= 1.3.0, < 2.0) - railties (= 4.1.16) - sprockets-rails (~> 2.0) - railties (4.1.16) - actionpack (= 4.1.16) - activesupport (= 4.1.16) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (10.4.2) - rspec (2.14.1) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - rspec-core (2.14.8) - rspec-expectations (2.14.5) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.14.6) - sprockets (3.7.1) - concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (2.3.3) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (>= 2.8, < 4.0) - thor (0.19.4) - thread_safe (0.3.6-java) - tzinfo (1.2.3) - thread_safe (~> 0.1) - -PLATFORMS - java - -DEPENDENCIES - jruby-openssl (~> 0.9.20) - rails (~> 4.1.16) - rake (~> 10.4.2) - rspec (~> 2.14.1) - -BUNDLED WITH - 1.14.6 diff --git a/gemfiles/rails42.gemfile b/gemfiles/rails42.gemfile deleted file mode 100644 index de51d434..00000000 --- a/gemfiles/rails42.gemfile +++ /dev/null @@ -1,10 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "rake", "~> 10.4.2", :group=>:test, :require=>nil -gem "rspec", "~> 2.14.1", :group=>:test -gem "jruby-openssl", "~> 0.9.20", :group=>:test -gem "mime-types", "< 3", :require=>false -gem "rails", "~> 4.2.9" - diff --git a/gemfiles/rails42.gemfile.lock b/gemfiles/rails42.gemfile.lock deleted file mode 100644 index c7cc62ad..00000000 --- a/gemfiles/rails42.gemfile.lock +++ /dev/null @@ -1,113 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - actionmailer (4.2.9) - actionpack (= 4.2.9) - actionview (= 4.2.9) - activejob (= 4.2.9) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.9) - actionview (= 4.2.9) - activesupport (= 4.2.9) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.9) - activesupport (= 4.2.9) - builder (~> 3.1) - erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (4.2.9) - activesupport (= 4.2.9) - globalid (>= 0.3.0) - activemodel (4.2.9) - activesupport (= 4.2.9) - builder (~> 3.1) - activerecord (4.2.9) - activemodel (= 4.2.9) - activesupport (= 4.2.9) - arel (~> 6.0) - activesupport (4.2.9) - i18n (~> 0.7) - minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) - tzinfo (~> 1.1) - arel (6.0.4) - builder (3.2.3) - concurrent-ruby (1.0.5-java) - diff-lcs (1.2.5) - erubis (2.7.0) - globalid (0.4.0) - activesupport (>= 4.2.0) - i18n (0.8.6) - jruby-openssl (0.9.21-java) - loofah (2.0.3) - nokogiri (>= 1.5.9) - mail (2.6.6) - mime-types (>= 1.16, < 4) - mime-types (2.99) - minitest (5.10.3) - nokogiri (1.8.0-java) - rack (1.6.8) - rack-test (0.6.3) - rack (>= 1.0) - rails (4.2.9) - actionmailer (= 4.2.9) - actionpack (= 4.2.9) - actionview (= 4.2.9) - activejob (= 4.2.9) - activemodel (= 4.2.9) - activerecord (= 4.2.9) - activesupport (= 4.2.9) - bundler (>= 1.3.0, < 2.0) - railties (= 4.2.9) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.8) - activesupport (>= 4.2.0.beta, < 5.0) - nokogiri (~> 1.6) - rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.0.3) - loofah (~> 2.0) - railties (4.2.9) - actionpack (= 4.2.9) - activesupport (= 4.2.9) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (10.4.2) - rspec (2.14.1) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - rspec-core (2.14.8) - rspec-expectations (2.14.5) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.14.6) - sprockets (3.7.1) - concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.2.0) - actionpack (>= 4.0) - activesupport (>= 4.0) - sprockets (>= 3.0.0) - thor (0.19.4) - thread_safe (0.3.6-java) - tzinfo (1.2.3) - thread_safe (~> 0.1) - -PLATFORMS - java - -DEPENDENCIES - jruby-openssl (~> 0.9.20) - mime-types (< 3) - rails (~> 4.2.9) - rake (~> 10.4.2) - rspec (~> 2.14.1) - -BUNDLED WITH - 1.14.6 diff --git a/gemfiles/rails50.gemfile b/gemfiles/rails50.gemfile new file mode 100644 index 00000000..16f8a43b --- /dev/null +++ b/gemfiles/rails50.gemfile @@ -0,0 +1,15 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rake", "~> 13.2", group: :test, require: nil +gem "rspec", group: :test +gem "rails", "~> 5.0.0" + +group :default do + gem "rack", "~> 2.2", "< 3.0" +end + +group :development do + gem "appraisal", require: nil +end diff --git a/gemfiles/rails50.gemfile.lock b/gemfiles/rails50.gemfile.lock new file mode 100644 index 00000000..8fde8380 --- /dev/null +++ b/gemfiles/rails50.gemfile.lock @@ -0,0 +1,149 @@ +GEM + remote: https://rubygems.org/ + specs: + actioncable (5.0.7.2) + actionpack (= 5.0.7.2) + nio4r (>= 1.2, < 3.0) + websocket-driver (~> 0.6.1) + actionmailer (5.0.7.2) + actionpack (= 5.0.7.2) + actionview (= 5.0.7.2) + activejob (= 5.0.7.2) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (5.0.7.2) + actionview (= 5.0.7.2) + activesupport (= 5.0.7.2) + rack (~> 2.0) + rack-test (~> 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.0.7.2) + activesupport (= 5.0.7.2) + builder (~> 3.1) + erubis (~> 2.7.0) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.0.7.2) + activesupport (= 5.0.7.2) + globalid (>= 0.3.6) + activemodel (5.0.7.2) + activesupport (= 5.0.7.2) + activerecord (5.0.7.2) + activemodel (= 5.0.7.2) + activesupport (= 5.0.7.2) + arel (~> 7.0) + activesupport (5.0.7.2) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + appraisal (2.5.0) + bundler + rake + thor (>= 0.14.0) + arel (7.1.4) + builder (3.3.0) + concurrent-ruby (1.3.5) + crass (1.0.6) + date (3.4.1-java) + diff-lcs (1.5.1) + erubis (2.7.0) + globalid (1.1.0) + activesupport (>= 5.0) + i18n (1.14.7) + concurrent-ruby (~> 1.0) + loofah (2.24.0) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + mail (2.8.1) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + method_source (1.1.0) + mini_mime (1.1.5) + minitest (5.25.4) + net-imap (0.5.5) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.5.0) + net-protocol + nio4r (2.7.4-java) + nokogiri (1.18.2-java) + racc (~> 1.4) + racc (1.8.1-java) + rack (2.2.10) + rack-test (0.6.3) + rack (>= 1.0) + rails (5.0.7.2) + actioncable (= 5.0.7.2) + actionmailer (= 5.0.7.2) + actionpack (= 5.0.7.2) + actionview (= 5.0.7.2) + activejob (= 5.0.7.2) + activemodel (= 5.0.7.2) + activerecord (= 5.0.7.2) + activesupport (= 5.0.7.2) + bundler (>= 1.3.0) + railties (= 5.0.7.2) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.2) + loofah (~> 2.21) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (5.0.7.2) + actionpack (= 5.0.7.2) + activesupport (= 5.0.7.2) + method_source + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (13.2.1) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.2) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.2) + sprockets (4.2.1) + concurrent-ruby (~> 1.0) + rack (>= 2.2.4, < 4) + sprockets-rails (3.2.2) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + thor (1.3.2) + thread_safe (0.3.6-java) + timeout (0.4.3) + tzinfo (1.2.11) + thread_safe (~> 0.1) + websocket-driver (0.6.5-java) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + +PLATFORMS + universal-java + +DEPENDENCIES + appraisal + rack (~> 2.2, < 3.0) + rails (~> 5.0.0) + rake (~> 13.2) + rspec + +BUNDLED WITH + 2.3.26 diff --git a/gemfiles/rails52.gemfile b/gemfiles/rails52.gemfile new file mode 100644 index 00000000..38dc919e --- /dev/null +++ b/gemfiles/rails52.gemfile @@ -0,0 +1,15 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rake", "~> 13.2", group: :test, require: nil +gem "rspec", group: :test +gem "rails", "~> 5.2.0" + +group :default do + gem "rack", "~> 2.2", "< 3.0" +end + +group :development do + gem "appraisal", require: nil +end diff --git a/gemfiles/rails52.gemfile.lock b/gemfiles/rails52.gemfile.lock new file mode 100644 index 00000000..97e9964e --- /dev/null +++ b/gemfiles/rails52.gemfile.lock @@ -0,0 +1,157 @@ +GEM + remote: https://rubygems.org/ + specs: + actioncable (5.2.8.1) + actionpack (= 5.2.8.1) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailer (5.2.8.1) + actionpack (= 5.2.8.1) + actionview (= 5.2.8.1) + activejob (= 5.2.8.1) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (5.2.8.1) + actionview (= 5.2.8.1) + activesupport (= 5.2.8.1) + rack (~> 2.0, >= 2.0.8) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.2.8.1) + activesupport (= 5.2.8.1) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.2.8.1) + activesupport (= 5.2.8.1) + globalid (>= 0.3.6) + activemodel (5.2.8.1) + activesupport (= 5.2.8.1) + activerecord (5.2.8.1) + activemodel (= 5.2.8.1) + activesupport (= 5.2.8.1) + arel (>= 9.0) + activestorage (5.2.8.1) + actionpack (= 5.2.8.1) + activerecord (= 5.2.8.1) + marcel (~> 1.0.0) + activesupport (5.2.8.1) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + appraisal (2.5.0) + bundler + rake + thor (>= 0.14.0) + arel (9.0.0) + base64 (0.2.0) + builder (3.3.0) + concurrent-ruby (1.3.5) + crass (1.0.6) + date (3.4.1-java) + diff-lcs (1.5.1) + erubi (1.13.1) + globalid (1.1.0) + activesupport (>= 5.0) + i18n (1.14.7) + concurrent-ruby (~> 1.0) + loofah (2.24.0) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + mail (2.8.1) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.4) + method_source (1.1.0) + mini_mime (1.1.5) + minitest (5.25.4) + net-imap (0.5.5) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.5.0) + net-protocol + nio4r (2.7.4-java) + nokogiri (1.18.2-java) + racc (~> 1.4) + racc (1.8.1-java) + rack (2.2.10) + rack-test (2.2.0) + rack (>= 1.3) + rails (5.2.8.1) + actioncable (= 5.2.8.1) + actionmailer (= 5.2.8.1) + actionpack (= 5.2.8.1) + actionview (= 5.2.8.1) + activejob (= 5.2.8.1) + activemodel (= 5.2.8.1) + activerecord (= 5.2.8.1) + activestorage (= 5.2.8.1) + activesupport (= 5.2.8.1) + bundler (>= 1.3.0) + railties (= 5.2.8.1) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.2) + loofah (~> 2.21) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (5.2.8.1) + actionpack (= 5.2.8.1) + activesupport (= 5.2.8.1) + method_source + rake (>= 0.8.7) + thor (>= 0.19.0, < 2.0) + rake (13.2.1) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.2) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.2) + sprockets (4.2.1) + concurrent-ruby (~> 1.0) + rack (>= 2.2.4, < 4) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) + sprockets (>= 3.0.0) + thor (1.3.2) + thread_safe (0.3.6-java) + timeout (0.4.3) + tzinfo (1.2.11) + thread_safe (~> 0.1) + websocket-driver (0.7.7-java) + base64 + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + +PLATFORMS + universal-java + +DEPENDENCIES + appraisal + rack (~> 2.2, < 3.0) + rails (~> 5.2.0) + rake (~> 13.2) + rspec + +BUNDLED WITH + 2.3.26 diff --git a/gemfiles/rails60.gemfile b/gemfiles/rails60.gemfile new file mode 100644 index 00000000..de5d6b45 --- /dev/null +++ b/gemfiles/rails60.gemfile @@ -0,0 +1,15 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rake", "~> 13.2", group: :test, require: nil +gem "rspec", group: :test +gem "rails", "~> 6.0.0" + +group :default do + gem "rack", "~> 2.2", "< 3.0" +end + +group :development do + gem "appraisal", require: nil +end diff --git a/gemfiles/rails60.gemfile.lock b/gemfiles/rails60.gemfile.lock new file mode 100644 index 00000000..81a61ef4 --- /dev/null +++ b/gemfiles/rails60.gemfile.lock @@ -0,0 +1,173 @@ +GEM + remote: https://rubygems.org/ + specs: + actioncable (6.0.6.1) + actionpack (= 6.0.6.1) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (6.0.6.1) + actionpack (= 6.0.6.1) + activejob (= 6.0.6.1) + activerecord (= 6.0.6.1) + activestorage (= 6.0.6.1) + activesupport (= 6.0.6.1) + mail (>= 2.7.1) + actionmailer (6.0.6.1) + actionpack (= 6.0.6.1) + actionview (= 6.0.6.1) + activejob (= 6.0.6.1) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (6.0.6.1) + actionview (= 6.0.6.1) + activesupport (= 6.0.6.1) + rack (~> 2.0, >= 2.0.8) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.0.6.1) + actionpack (= 6.0.6.1) + activerecord (= 6.0.6.1) + activestorage (= 6.0.6.1) + activesupport (= 6.0.6.1) + nokogiri (>= 1.8.5) + actionview (6.0.6.1) + activesupport (= 6.0.6.1) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.0.6.1) + activesupport (= 6.0.6.1) + globalid (>= 0.3.6) + activemodel (6.0.6.1) + activesupport (= 6.0.6.1) + activerecord (6.0.6.1) + activemodel (= 6.0.6.1) + activesupport (= 6.0.6.1) + activestorage (6.0.6.1) + actionpack (= 6.0.6.1) + activejob (= 6.0.6.1) + activerecord (= 6.0.6.1) + marcel (~> 1.0) + activesupport (6.0.6.1) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + zeitwerk (~> 2.2, >= 2.2.2) + appraisal (2.5.0) + bundler + rake + thor (>= 0.14.0) + base64 (0.2.0) + builder (3.3.0) + concurrent-ruby (1.3.5) + crass (1.0.6) + date (3.4.1-java) + diff-lcs (1.5.1) + erubi (1.13.1) + globalid (1.1.0) + activesupport (>= 5.0) + i18n (1.14.7) + concurrent-ruby (~> 1.0) + loofah (2.24.0) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + mail (2.8.1) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.4) + method_source (1.1.0) + mini_mime (1.1.5) + minitest (5.25.4) + net-imap (0.5.5) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.5.0) + net-protocol + nio4r (2.7.4-java) + nokogiri (1.18.2-java) + racc (~> 1.4) + racc (1.8.1-java) + rack (2.2.10) + rack-test (2.2.0) + rack (>= 1.3) + rails (6.0.6.1) + actioncable (= 6.0.6.1) + actionmailbox (= 6.0.6.1) + actionmailer (= 6.0.6.1) + actionpack (= 6.0.6.1) + actiontext (= 6.0.6.1) + actionview (= 6.0.6.1) + activejob (= 6.0.6.1) + activemodel (= 6.0.6.1) + activerecord (= 6.0.6.1) + activestorage (= 6.0.6.1) + activesupport (= 6.0.6.1) + bundler (>= 1.3.0) + railties (= 6.0.6.1) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.2) + loofah (~> 2.21) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (6.0.6.1) + actionpack (= 6.0.6.1) + activesupport (= 6.0.6.1) + method_source + rake (>= 0.8.7) + thor (>= 0.20.3, < 2.0) + rake (13.2.1) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.2) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.2) + sprockets (4.2.1) + concurrent-ruby (~> 1.0) + rack (>= 2.2.4, < 4) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) + sprockets (>= 3.0.0) + thor (1.3.2) + thread_safe (0.3.6-java) + timeout (0.4.3) + tzinfo (1.2.11) + thread_safe (~> 0.1) + websocket-driver (0.7.7-java) + base64 + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + zeitwerk (2.6.18) + +PLATFORMS + universal-java + +DEPENDENCIES + appraisal + rack (~> 2.2, < 3.0) + rails (~> 6.0.0) + rake (~> 13.2) + rspec + +BUNDLED WITH + 2.3.26 diff --git a/gemfiles/rails61.gemfile b/gemfiles/rails61.gemfile new file mode 100644 index 00000000..f5dca2ae --- /dev/null +++ b/gemfiles/rails61.gemfile @@ -0,0 +1,15 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rake", "~> 13.2", group: :test, require: nil +gem "rspec", group: :test +gem "rails", "~> 6.1.0" + +group :default do + gem "rack", "~> 2.2", "< 3.0" +end + +group :development do + gem "appraisal", require: nil +end diff --git a/gemfiles/rails61.gemfile.lock b/gemfiles/rails61.gemfile.lock new file mode 100644 index 00000000..5eccb1fb --- /dev/null +++ b/gemfiles/rails61.gemfile.lock @@ -0,0 +1,176 @@ +GEM + remote: https://rubygems.org/ + specs: + actioncable (6.1.7.9) + actionpack (= 6.1.7.9) + activesupport (= 6.1.7.9) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (6.1.7.9) + actionpack (= 6.1.7.9) + activejob (= 6.1.7.9) + activerecord (= 6.1.7.9) + activestorage (= 6.1.7.9) + activesupport (= 6.1.7.9) + mail (>= 2.7.1) + actionmailer (6.1.7.9) + actionpack (= 6.1.7.9) + actionview (= 6.1.7.9) + activejob (= 6.1.7.9) + activesupport (= 6.1.7.9) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (6.1.7.9) + actionview (= 6.1.7.9) + activesupport (= 6.1.7.9) + rack (~> 2.0, >= 2.0.9) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.1.7.9) + actionpack (= 6.1.7.9) + activerecord (= 6.1.7.9) + activestorage (= 6.1.7.9) + activesupport (= 6.1.7.9) + nokogiri (>= 1.8.5) + actionview (6.1.7.9) + activesupport (= 6.1.7.9) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.1.7.9) + activesupport (= 6.1.7.9) + globalid (>= 0.3.6) + activemodel (6.1.7.9) + activesupport (= 6.1.7.9) + activerecord (6.1.7.9) + activemodel (= 6.1.7.9) + activesupport (= 6.1.7.9) + activestorage (6.1.7.9) + actionpack (= 6.1.7.9) + activejob (= 6.1.7.9) + activerecord (= 6.1.7.9) + activesupport (= 6.1.7.9) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (6.1.7.9) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) + appraisal (2.5.0) + bundler + rake + thor (>= 0.14.0) + base64 (0.2.0) + builder (3.3.0) + concurrent-ruby (1.3.5) + crass (1.0.6) + date (3.4.1-java) + diff-lcs (1.5.1) + erubi (1.13.1) + globalid (1.2.1) + activesupport (>= 6.1) + i18n (1.14.7) + concurrent-ruby (~> 1.0) + loofah (2.24.0) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + mail (2.8.1) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.4) + method_source (1.1.0) + mini_mime (1.1.5) + minitest (5.25.4) + net-imap (0.5.5) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.5.0) + net-protocol + nio4r (2.7.4-java) + nokogiri (1.18.2-java) + racc (~> 1.4) + racc (1.8.1-java) + rack (2.2.10) + rack-test (2.2.0) + rack (>= 1.3) + rails (6.1.7.9) + actioncable (= 6.1.7.9) + actionmailbox (= 6.1.7.9) + actionmailer (= 6.1.7.9) + actionpack (= 6.1.7.9) + actiontext (= 6.1.7.9) + actionview (= 6.1.7.9) + activejob (= 6.1.7.9) + activemodel (= 6.1.7.9) + activerecord (= 6.1.7.9) + activestorage (= 6.1.7.9) + activesupport (= 6.1.7.9) + bundler (>= 1.15.0) + railties (= 6.1.7.9) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.2) + loofah (~> 2.21) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (6.1.7.9) + actionpack (= 6.1.7.9) + activesupport (= 6.1.7.9) + method_source + rake (>= 12.2) + thor (~> 1.0) + rake (13.2.1) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.2) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.2) + sprockets (4.2.1) + concurrent-ruby (~> 1.0) + rack (>= 2.2.4, < 4) + sprockets-rails (3.5.2) + actionpack (>= 6.1) + activesupport (>= 6.1) + sprockets (>= 3.0.0) + thor (1.3.2) + timeout (0.4.3) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + websocket-driver (0.7.7-java) + base64 + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + zeitwerk (2.6.18) + +PLATFORMS + universal-java + +DEPENDENCIES + appraisal + rack (~> 2.2, < 3.0) + rails (~> 6.1.0) + rake (~> 13.2) + rspec + +BUNDLED WITH + 2.3.26 diff --git a/gemfiles/rails62.gemfile b/gemfiles/rails62.gemfile new file mode 100644 index 00000000..f0997017 --- /dev/null +++ b/gemfiles/rails62.gemfile @@ -0,0 +1,15 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rake", "~> 13.2", group: :test, require: nil +gem "rspec", group: :test +gem "rails", "~> 6.2.0" + +group :default do + gem "rack", "~> 2.2", "< 3.0" +end + +group :development do + gem "appraisal", require: nil +end diff --git a/gemfiles/rails70.gemfile b/gemfiles/rails70.gemfile new file mode 100644 index 00000000..26f20bef --- /dev/null +++ b/gemfiles/rails70.gemfile @@ -0,0 +1,15 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rake", "~> 13.2", group: :test, require: nil +gem "rspec", group: :test +gem "rails", "~> 7.0.0" + +group :default do + gem "rack", "~> 2.2", "< 3.0" +end + +group :development do + gem "appraisal", require: nil +end diff --git a/gemfiles/rails70.gemfile.lock b/gemfiles/rails70.gemfile.lock new file mode 100644 index 00000000..b161112e --- /dev/null +++ b/gemfiles/rails70.gemfile.lock @@ -0,0 +1,175 @@ +GEM + remote: https://rubygems.org/ + specs: + actioncable (7.0.8.7) + actionpack (= 7.0.8.7) + activesupport (= 7.0.8.7) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (7.0.8.7) + actionpack (= 7.0.8.7) + activejob (= 7.0.8.7) + activerecord (= 7.0.8.7) + activestorage (= 7.0.8.7) + activesupport (= 7.0.8.7) + mail (>= 2.7.1) + net-imap + net-pop + net-smtp + actionmailer (7.0.8.7) + actionpack (= 7.0.8.7) + actionview (= 7.0.8.7) + activejob (= 7.0.8.7) + activesupport (= 7.0.8.7) + mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp + rails-dom-testing (~> 2.0) + actionpack (7.0.8.7) + actionview (= 7.0.8.7) + activesupport (= 7.0.8.7) + rack (~> 2.0, >= 2.2.4) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (7.0.8.7) + actionpack (= 7.0.8.7) + activerecord (= 7.0.8.7) + activestorage (= 7.0.8.7) + activesupport (= 7.0.8.7) + globalid (>= 0.6.0) + nokogiri (>= 1.8.5) + actionview (7.0.8.7) + activesupport (= 7.0.8.7) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (7.0.8.7) + activesupport (= 7.0.8.7) + globalid (>= 0.3.6) + activemodel (7.0.8.7) + activesupport (= 7.0.8.7) + activerecord (7.0.8.7) + activemodel (= 7.0.8.7) + activesupport (= 7.0.8.7) + activestorage (7.0.8.7) + actionpack (= 7.0.8.7) + activejob (= 7.0.8.7) + activerecord (= 7.0.8.7) + activesupport (= 7.0.8.7) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (7.0.8.7) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + appraisal (2.5.0) + bundler + rake + thor (>= 0.14.0) + base64 (0.2.0) + builder (3.3.0) + concurrent-ruby (1.3.5) + crass (1.0.6) + date (3.4.1-java) + diff-lcs (1.5.1) + erubi (1.13.1) + globalid (1.2.1) + activesupport (>= 6.1) + i18n (1.14.7) + concurrent-ruby (~> 1.0) + loofah (2.24.0) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + mail (2.8.1) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.4) + method_source (1.1.0) + mini_mime (1.1.5) + minitest (5.25.4) + net-imap (0.5.5) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.5.0) + net-protocol + nio4r (2.7.4-java) + nokogiri (1.18.2-java) + racc (~> 1.4) + racc (1.8.1-java) + rack (2.2.10) + rack-test (2.2.0) + rack (>= 1.3) + rails (7.0.8.7) + actioncable (= 7.0.8.7) + actionmailbox (= 7.0.8.7) + actionmailer (= 7.0.8.7) + actionpack (= 7.0.8.7) + actiontext (= 7.0.8.7) + actionview (= 7.0.8.7) + activejob (= 7.0.8.7) + activemodel (= 7.0.8.7) + activerecord (= 7.0.8.7) + activestorage (= 7.0.8.7) + activesupport (= 7.0.8.7) + bundler (>= 1.15.0) + railties (= 7.0.8.7) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.2) + loofah (~> 2.21) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (7.0.8.7) + actionpack (= 7.0.8.7) + activesupport (= 7.0.8.7) + method_source + rake (>= 12.2) + thor (~> 1.0) + zeitwerk (~> 2.5) + rake (13.2.1) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.2) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.2) + thor (1.3.2) + timeout (0.4.3) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + websocket-driver (0.7.7-java) + base64 + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + zeitwerk (2.6.18) + +PLATFORMS + universal-java + +DEPENDENCIES + appraisal + rack (~> 2.2, < 3.0) + rails (~> 7.0.0) + rake (~> 13.2) + rspec + +BUNDLED WITH + 2.3.26 diff --git a/gemfiles/rails71.gemfile b/gemfiles/rails71.gemfile new file mode 100644 index 00000000..1eaef1ec --- /dev/null +++ b/gemfiles/rails71.gemfile @@ -0,0 +1,15 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rake", "~> 13.2", group: :test, require: nil +gem "rspec", group: :test +gem "rails", "~> 7.1.0" + +group :default do + gem "rack", "~> 2.2", "< 3.0" +end + +group :development do + gem "appraisal", require: nil +end diff --git a/gemfiles/rails71.gemfile.lock b/gemfiles/rails71.gemfile.lock new file mode 100644 index 00000000..2e45efe6 --- /dev/null +++ b/gemfiles/rails71.gemfile.lock @@ -0,0 +1,212 @@ +GEM + remote: https://rubygems.org/ + specs: + actioncable (7.1.5.1) + actionpack (= 7.1.5.1) + activesupport (= 7.1.5.1) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + zeitwerk (~> 2.6) + actionmailbox (7.1.5.1) + actionpack (= 7.1.5.1) + activejob (= 7.1.5.1) + activerecord (= 7.1.5.1) + activestorage (= 7.1.5.1) + activesupport (= 7.1.5.1) + mail (>= 2.7.1) + net-imap + net-pop + net-smtp + actionmailer (7.1.5.1) + actionpack (= 7.1.5.1) + actionview (= 7.1.5.1) + activejob (= 7.1.5.1) + activesupport (= 7.1.5.1) + mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp + rails-dom-testing (~> 2.2) + actionpack (7.1.5.1) + actionview (= 7.1.5.1) + activesupport (= 7.1.5.1) + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4) + rack-session (>= 1.0.1) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + actiontext (7.1.5.1) + actionpack (= 7.1.5.1) + activerecord (= 7.1.5.1) + activestorage (= 7.1.5.1) + activesupport (= 7.1.5.1) + globalid (>= 0.6.0) + nokogiri (>= 1.8.5) + actionview (7.1.5.1) + activesupport (= 7.1.5.1) + builder (~> 3.1) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (7.1.5.1) + activesupport (= 7.1.5.1) + globalid (>= 0.3.6) + activemodel (7.1.5.1) + activesupport (= 7.1.5.1) + activerecord (7.1.5.1) + activemodel (= 7.1.5.1) + activesupport (= 7.1.5.1) + timeout (>= 0.4.0) + activestorage (7.1.5.1) + actionpack (= 7.1.5.1) + activejob (= 7.1.5.1) + activerecord (= 7.1.5.1) + activesupport (= 7.1.5.1) + marcel (~> 1.0) + activesupport (7.1.5.1) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + logger (>= 1.4.2) + minitest (>= 5.1) + mutex_m + securerandom (>= 0.3) + tzinfo (~> 2.0) + appraisal (2.5.0) + bundler + rake + thor (>= 0.14.0) + base64 (0.2.0) + benchmark (0.4.0) + bigdecimal (3.1.9-java) + builder (3.3.0) + concurrent-ruby (1.3.5) + connection_pool (2.5.0) + crass (1.0.6) + date (3.4.1-java) + diff-lcs (1.5.1) + drb (2.2.1) + erubi (1.13.1) + globalid (1.2.1) + activesupport (>= 6.1) + i18n (1.14.7) + concurrent-ruby (~> 1.0) + io-console (0.8.0-java) + irb (1.14.3) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + jar-dependencies (0.4.1) + logger (1.6.5) + loofah (2.24.0) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + mail (2.8.1) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.4) + mini_mime (1.1.5) + minitest (5.25.4) + mutex_m (0.3.0) + net-imap (0.5.5) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.5.0) + net-protocol + nio4r (2.7.4-java) + nokogiri (1.18.2-java) + racc (~> 1.4) + psych (5.2.3-java) + date + jar-dependencies (>= 0.1.7) + racc (1.8.1-java) + rack (2.2.10) + rack-session (1.0.2) + rack (< 3) + rack-test (2.2.0) + rack (>= 1.3) + rackup (1.0.1) + rack (< 3) + webrick + rails (7.1.5.1) + actioncable (= 7.1.5.1) + actionmailbox (= 7.1.5.1) + actionmailer (= 7.1.5.1) + actionpack (= 7.1.5.1) + actiontext (= 7.1.5.1) + actionview (= 7.1.5.1) + activejob (= 7.1.5.1) + activemodel (= 7.1.5.1) + activerecord (= 7.1.5.1) + activestorage (= 7.1.5.1) + activesupport (= 7.1.5.1) + bundler (>= 1.15.0) + railties (= 7.1.5.1) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.2) + loofah (~> 2.21) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (7.1.5.1) + actionpack (= 7.1.5.1) + activesupport (= 7.1.5.1) + irb + rackup (>= 1.0.0) + rake (>= 12.2) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) + rake (13.2.1) + rdoc (6.11.0) + psych (>= 4.0.0) + reline (0.6.0) + io-console (~> 0.5) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.2) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.2) + securerandom (0.4.1) + thor (1.3.2) + timeout (0.4.3) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + webrick (1.9.1) + websocket-driver (0.7.7-java) + base64 + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + zeitwerk (2.6.18) + +PLATFORMS + universal-java + +DEPENDENCIES + appraisal + rack (~> 2.2, < 3.0) + rails (~> 7.1.0) + rake (~> 13.2) + rspec + +BUNDLED WITH + 2.3.26 diff --git a/gemfiles/rails72.gemfile b/gemfiles/rails72.gemfile new file mode 100644 index 00000000..8c8c83a6 --- /dev/null +++ b/gemfiles/rails72.gemfile @@ -0,0 +1,15 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rake", "~> 13.2", group: :test, require: nil +gem "rspec", group: :test +gem "rails", "~> 7.2.0" + +group :default do + gem "rack", "~> 2.2", "< 3.0" +end + +group :development do + gem "appraisal", require: nil +end diff --git a/gemfiles/rails72.gemfile.lock b/gemfiles/rails72.gemfile.lock new file mode 100644 index 00000000..f3bec09c --- /dev/null +++ b/gemfiles/rails72.gemfile.lock @@ -0,0 +1,206 @@ +GEM + remote: https://rubygems.org/ + specs: + actioncable (7.2.2.1) + actionpack (= 7.2.2.1) + activesupport (= 7.2.2.1) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + zeitwerk (~> 2.6) + actionmailbox (7.2.2.1) + actionpack (= 7.2.2.1) + activejob (= 7.2.2.1) + activerecord (= 7.2.2.1) + activestorage (= 7.2.2.1) + activesupport (= 7.2.2.1) + mail (>= 2.8.0) + actionmailer (7.2.2.1) + actionpack (= 7.2.2.1) + actionview (= 7.2.2.1) + activejob (= 7.2.2.1) + activesupport (= 7.2.2.1) + mail (>= 2.8.0) + rails-dom-testing (~> 2.2) + actionpack (7.2.2.1) + actionview (= 7.2.2.1) + activesupport (= 7.2.2.1) + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4, < 3.2) + rack-session (>= 1.0.1) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + useragent (~> 0.16) + actiontext (7.2.2.1) + actionpack (= 7.2.2.1) + activerecord (= 7.2.2.1) + activestorage (= 7.2.2.1) + activesupport (= 7.2.2.1) + globalid (>= 0.6.0) + nokogiri (>= 1.8.5) + actionview (7.2.2.1) + activesupport (= 7.2.2.1) + builder (~> 3.1) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (7.2.2.1) + activesupport (= 7.2.2.1) + globalid (>= 0.3.6) + activemodel (7.2.2.1) + activesupport (= 7.2.2.1) + activerecord (7.2.2.1) + activemodel (= 7.2.2.1) + activesupport (= 7.2.2.1) + timeout (>= 0.4.0) + activestorage (7.2.2.1) + actionpack (= 7.2.2.1) + activejob (= 7.2.2.1) + activerecord (= 7.2.2.1) + activesupport (= 7.2.2.1) + marcel (~> 1.0) + activesupport (7.2.2.1) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + logger (>= 1.4.2) + minitest (>= 5.1) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + appraisal (2.5.0) + bundler + rake + thor (>= 0.14.0) + base64 (0.2.0) + benchmark (0.4.0) + bigdecimal (3.1.9-java) + builder (3.3.0) + concurrent-ruby (1.3.5) + connection_pool (2.5.0) + crass (1.0.6) + date (3.4.1-java) + diff-lcs (1.5.1) + drb (2.2.1) + erubi (1.13.1) + globalid (1.2.1) + activesupport (>= 6.1) + i18n (1.14.7) + concurrent-ruby (~> 1.0) + io-console (0.8.0-java) + irb (1.14.3) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + jar-dependencies (0.4.1) + logger (1.6.5) + loofah (2.24.0) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + mail (2.8.1) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.4) + mini_mime (1.1.5) + minitest (5.25.4) + net-imap (0.5.5) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.5.0) + net-protocol + nio4r (2.7.4-java) + nokogiri (1.18.2-java) + racc (~> 1.4) + psych (5.2.3-java) + date + jar-dependencies (>= 0.1.7) + racc (1.8.1-java) + rack (2.2.10) + rack-session (1.0.2) + rack (< 3) + rack-test (2.2.0) + rack (>= 1.3) + rackup (1.0.1) + rack (< 3) + webrick + rails (7.2.2.1) + actioncable (= 7.2.2.1) + actionmailbox (= 7.2.2.1) + actionmailer (= 7.2.2.1) + actionpack (= 7.2.2.1) + actiontext (= 7.2.2.1) + actionview (= 7.2.2.1) + activejob (= 7.2.2.1) + activemodel (= 7.2.2.1) + activerecord (= 7.2.2.1) + activestorage (= 7.2.2.1) + activesupport (= 7.2.2.1) + bundler (>= 1.15.0) + railties (= 7.2.2.1) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.2) + loofah (~> 2.21) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (7.2.2.1) + actionpack (= 7.2.2.1) + activesupport (= 7.2.2.1) + irb (~> 1.13) + rackup (>= 1.0.0) + rake (>= 12.2) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) + rake (13.2.1) + rdoc (6.11.0) + psych (>= 4.0.0) + reline (0.6.0) + io-console (~> 0.5) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.2) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.2) + securerandom (0.4.1) + thor (1.3.2) + timeout (0.4.3) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + useragent (0.16.11) + webrick (1.9.1) + websocket-driver (0.7.7-java) + base64 + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + zeitwerk (2.6.18) + +PLATFORMS + universal-java + +DEPENDENCIES + appraisal + rack (~> 2.2, < 3.0) + rails (~> 7.2.0) + rake (~> 13.2) + rspec + +BUNDLED WITH + 2.3.26 diff --git a/gemfiles/railsNG.gemfile b/gemfiles/railsNG.gemfile deleted file mode 100644 index 17a24553..00000000 --- a/gemfiles/railsNG.gemfile +++ /dev/null @@ -1,8 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "rake", "~> 10.4.2", :group=>:test, :require=>nil -gem "rspec", "~> 2.14.1", :group=>:test -gem "rails", "5.0.0.beta1" - diff --git a/gemfiles/railsNG.gemfile.lock b/gemfiles/railsNG.gemfile.lock deleted file mode 100644 index 8a77f951..00000000 --- a/gemfiles/railsNG.gemfile.lock +++ /dev/null @@ -1,165 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - actioncable (5.0.0.beta1) - actionpack (= 5.0.0.beta1) - celluloid (~> 0.17.2) - coffee-rails (~> 4.1.0) - em-hiredis (~> 0.3.0) - faye-websocket (~> 0.10.0) - redis (~> 3.0) - websocket-driver (~> 0.6.1) - actionmailer (5.0.0.beta1) - actionpack (= 5.0.0.beta1) - actionview (= 5.0.0.beta1) - activejob (= 5.0.0.beta1) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (5.0.0.beta1) - actionview (= 5.0.0.beta1) - activesupport (= 5.0.0.beta1) - rack (~> 2.x) - rack-test (~> 0.6.3) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.0.0.beta1) - activesupport (= 5.0.0.beta1) - builder (~> 3.1) - erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (5.0.0.beta1) - activesupport (= 5.0.0.beta1) - globalid (>= 0.3.6) - activemodel (5.0.0.beta1) - activesupport (= 5.0.0.beta1) - builder (~> 3.1) - activerecord (5.0.0.beta1) - activemodel (= 5.0.0.beta1) - activesupport (= 5.0.0.beta1) - arel (~> 7.0) - activesupport (5.0.0.beta1) - concurrent-ruby (~> 1.0) - i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) - method_source - minitest (~> 5.1) - tzinfo (~> 1.1) - arel (7.0.0) - builder (3.2.2) - celluloid (0.17.3) - celluloid-essentials - celluloid-extras - celluloid-fsm - celluloid-pool - celluloid-supervision - timers (>= 4.1.1) - celluloid-essentials (0.20.5) - timers (>= 4.1.1) - celluloid-extras (0.20.5) - timers (>= 4.1.1) - celluloid-fsm (0.20.5) - timers (>= 4.1.1) - celluloid-pool (0.20.5) - timers (>= 4.1.1) - celluloid-supervision (0.20.5) - timers (>= 4.1.1) - coffee-rails (4.1.1) - coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.1.x) - coffee-script (2.4.1) - coffee-script-source - execjs - coffee-script-source (1.10.0) - concurrent-ruby (1.0.0-java) - diff-lcs (1.2.5) - em-hiredis (0.3.0) - eventmachine (~> 1.0) - hiredis (~> 0.5.0) - erubis (2.7.0) - eventmachine (1.0.9.1-java) - execjs (2.6.0) - faye-websocket (0.10.2) - eventmachine (>= 0.12.0) - websocket-driver (>= 0.5.1) - globalid (0.3.6) - activesupport (>= 4.1.0) - hiredis (0.5.2-java) - hitimes (1.2.3-java) - i18n (0.7.0) - json (1.8.3-java) - loofah (2.0.3) - nokogiri (>= 1.5.9) - mail (2.6.3) - mime-types (>= 1.16, < 3) - method_source (0.8.2) - mime-types (2.99) - minitest (5.8.4) - nokogiri (1.6.7.2-java) - rack (2.0.0.alpha) - json - rack-test (0.6.3) - rack (>= 1.0) - rails (5.0.0.beta1) - actioncable (= 5.0.0.beta1) - actionmailer (= 5.0.0.beta1) - actionpack (= 5.0.0.beta1) - actionview (= 5.0.0.beta1) - activejob (= 5.0.0.beta1) - activemodel (= 5.0.0.beta1) - activerecord (= 5.0.0.beta1) - activesupport (= 5.0.0.beta1) - bundler (>= 1.3.0, < 2.0) - railties (= 5.0.0.beta1) - sprockets-rails (>= 2.0.0) - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.7) - activesupport (>= 4.2.0.beta, < 5.0) - nokogiri (~> 1.6.0) - rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.0.2) - loofah (~> 2.0) - railties (5.0.0.beta1) - actionpack (= 5.0.0.beta1) - activesupport (= 5.0.0.beta1) - method_source - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (10.4.2) - redis (3.2.2) - rspec (2.14.1) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - rspec-core (2.14.8) - rspec-expectations (2.14.5) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.14.6) - sprockets (3.5.2) - concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.0.0) - actionpack (>= 4.0) - activesupport (>= 4.0) - sprockets (>= 3.0.0) - thor (0.19.1) - thread_safe (0.3.5-java) - timers (4.1.1) - hitimes - tzinfo (1.2.2) - thread_safe (~> 0.1) - websocket-driver (0.6.3-java) - websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.2) - -PLATFORMS - java - -DEPENDENCIES - rails (= 5.0.0.beta1) - rake (~> 10.4.2) - rspec (~> 2.14.1) - -BUNDLED WITH - 1.11.2 diff --git a/src/spec/ruby/rack/application_spec.rb b/src/spec/ruby/rack/application_spec.rb index d8a5e175..9c32a578 100644 --- a/src/spec/ruby/rack/application_spec.rb +++ b/src/spec/ruby/rack/application_spec.rb @@ -830,7 +830,7 @@ def createRackServletWrapper(runtime, rackup, filename); end @pooling_factory.init(@rack_context) sleep(0.10) @pooling_factory.getApplicationPool.size.should < 6 - sleep(ENV['TRAVIS'] == 'true' ? 0.9 : 0.45) # 6 x 0.15 == 0.9 but we're parallel + sleep(0.9) @pooling_factory.getApplicationPool.size.should >= 6 expect( @pooling_factory.getManagedApplications ).to_not be_empty From 6bab581ef3b9468d408189f394e35c3c00efd1c5 Mon Sep 17 00:00:00 2001 From: Chad Wilson Date: Wed, 22 Jan 2025 15:59:21 +0800 Subject: [PATCH 07/20] Remove old Rack 1.x / Rails < 3 compatibility code We are only supporting Rack 2.x onwards now anyway. --- .../jruby/rack/servlet/ResponseCapture.java | 15 +-------------- src/main/ruby/jruby/rack/chunked.rb | 12 ------------ src/main/ruby/jruby/rack/session_store.rb | 4 +++- src/spec/ruby/jruby/rack/integration_spec.rb | 15 ++------------- src/spec/ruby/jruby/rack/response_spec.rb | 10 ++-------- src/spec/ruby/rack/handler/servlet_spec.rb | 18 +++--------------- 6 files changed, 11 insertions(+), 63 deletions(-) diff --git a/src/main/java/org/jruby/rack/servlet/ResponseCapture.java b/src/main/java/org/jruby/rack/servlet/ResponseCapture.java index 6fce178c..c744c5d2 100644 --- a/src/main/java/org/jruby/rack/servlet/ResponseCapture.java +++ b/src/main/java/org/jruby/rack/servlet/ResponseCapture.java @@ -231,7 +231,7 @@ public boolean isHandled(final HttpServletRequest request) { // consider HTTP OPTIONS with "Allow" header unhandled : if ( request != null && "OPTIONS".equals( request.getMethod() ) ) { - final Collection headerNames = getHeaderNamesOrNull(); + final Collection headerNames = getHeaderNames(); if ( headerNames == null || headerNames.isEmpty() ) { // not to happen but there's all kind of beasts out there return false; @@ -277,17 +277,4 @@ public void setHandledByDefault(boolean handledByDefault) { public boolean isOutputAccessed() { return output != null; } - - @SuppressWarnings("unchecked") - private Collection getHeaderNamesOrNull() { - // NOTE: getHeaderNames since Servlet API 3.0 JRuby-Rack 1.1 still supports 2.5 - try { - final Method getHeaderNames = getResponse().getClass().getMethod("getHeaderNames"); - return (Collection) getHeaderNames.invoke( getResponse() ); - } - catch (NoSuchMethodException e) { return null; } - catch (IllegalAccessException e) { return null; } - catch (InvocationTargetException e) { return null; } - } - } diff --git a/src/main/ruby/jruby/rack/chunked.rb b/src/main/ruby/jruby/rack/chunked.rb index 0cdaf454..74c79b85 100644 --- a/src/main/ruby/jruby/rack/chunked.rb +++ b/src/main/ruby/jruby/rack/chunked.rb @@ -20,16 +20,4 @@ def each(&block) @body.each(&block) # no-chunking on servlets end -end if defined? Rack::Chunked::Body - -unless defined? Rack::Chunked::Body # Rack 1.1 - - Rack::Chunked.class_eval do - - def each(&block) - @body.each(&block) # no-chunking on servlets - end - - end - end \ No newline at end of file diff --git a/src/main/ruby/jruby/rack/session_store.rb b/src/main/ruby/jruby/rack/session_store.rb index a49c5364..9aeb3f47 100644 --- a/src/main/ruby/jruby/rack/session_store.rb +++ b/src/main/ruby/jruby/rack/session_store.rb @@ -71,7 +71,9 @@ def get_servlet_session(env, create = false) private # Rack::Session::Abstract::ID overrides : - def session_class; ::JRuby::Rack::Session::SessionHash; end # Rack 1.5 + def session_class + ::JRuby::Rack::Session::SessionHash + end def initialize_sid nil # dummy method - not usable with servlet API diff --git a/src/spec/ruby/jruby/rack/integration_spec.rb b/src/spec/ruby/jruby/rack/integration_spec.rb index 96a1f009..38183c0c 100644 --- a/src/spec/ruby/jruby/rack/integration_spec.rb +++ b/src/spec/ruby/jruby/rack/integration_spec.rb @@ -407,15 +407,7 @@ def expect_to_have_monkey_patched_chunked script = %{ headers = { 'Transfer-Encoding' => 'chunked' } - body = [ \"1\".freeze, \"\", \"\nsecond\" ] - - if defined? Rack::Chunked::Body # Rails 3.x - body = Rack::Chunked::Body.new body - else # Rack 1.1 / 1.2 - chunked = Rack::Chunked.new(nil) - chunked.chunk(200, headers, body) - body = chunked - end + body = Rack::Chunked::Body.new [ \"1\".freeze, \"\", \"\nsecond\" ] parts = []; body.each { |part| parts << part } parts.join @@ -431,10 +423,7 @@ def initialize_rails(env = nil, servlet_context = @servlet_context) servlet_context = new_servlet_context(base) end listener = org.jruby.rack.rails.RailsServletContextListener.new - # Travis-CI might have RAILS_ENV=test set, which is not desired for us : - #if ENV['RAILS_ENV'] || ENV['RACK_ENV'] - #ENV['RAILS_ENV'] = env; ENV.delete('RACK_ENV') - #end + the_env = "GEM_HOME=#{ENV['GEM_HOME']},GEM_PATH=#{ENV['GEM_PATH']}" the_env << "\nRAILS_ENV=#{env}" if env servlet_context.addInitParameter("jruby.runtime.env", the_env) diff --git a/src/spec/ruby/jruby/rack/response_spec.rb b/src/spec/ruby/jruby/rack/response_spec.rb index c9338230..7de11aa0 100644 --- a/src/spec/ruby/jruby/rack/response_spec.rb +++ b/src/spec/ruby/jruby/rack/response_spec.rb @@ -170,14 +170,8 @@ class << value; undef_method :each; end if value.respond_to?(:each) ] with_dechunk do - if defined? Rack::Chunked::Body # Rails 3.x - body = Rack::Chunked::Body.new body - response = JRuby::Rack::Response.new([ 200, headers, body ]) - else # Rails 2.3 -> Rack 1.1 - chunked = Rack::Chunked.new nil # nil application - response = JRuby::Rack::Response.new chunked.chunk(200, headers, body) - end - + body = Rack::Chunked::Body.new body + response = JRuby::Rack::Response.new([ 200, headers, body ]) response.write_headers(response_environment) times = 0 diff --git a/src/spec/ruby/rack/handler/servlet_spec.rb b/src/spec/ruby/rack/handler/servlet_spec.rb index 72296972..fba0d667 100644 --- a/src/spec/ruby/rack/handler/servlet_spec.rb +++ b/src/spec/ruby/rack/handler/servlet_spec.rb @@ -642,11 +642,7 @@ def getAttributeNames request.logger.should be nil # we do not setup rack.logger lambda { request.scheme }.should_not raise_error - if Rack.release >= '1.3' # rack 1.3.x 1.4.x - request.scheme.should == 'https' # X-Forwarded-Proto - else - request.scheme.should == 'http' # Rails 3.0 / 2.3 - end + request.scheme.should == 'https' # X-Forwarded-Proto lambda { request.port }.should_not raise_error request.port.should == 80 @@ -662,19 +658,11 @@ def getAttributeNames if defined?(request.base_url) lambda { request.base_url }.should_not raise_error - if Rack.release >= '1.3' # Rails >= 3.1.x - request.base_url.should == 'https://serverhost:80' - else - request.base_url.should == 'http://serverhost' - end + request.base_url.should == 'https://serverhost:80' end lambda { request.url }.should_not raise_error - if Rack.release >= '1.3' # Rails >= 3.1.x - request.url.should == 'https://serverhost:80/main/app1/path/info?hello=there' - else - request.url.should == 'http://serverhost/main/app1/path/info?hello=there' - end + request.url.should == 'https://serverhost:80/main/app1/path/info?hello=there' end describe 'dumped-and-loaded' do From f52da2e27d0d0550752af7c4fd0d9e92fcb39dec Mon Sep 17 00:00:00 2001 From: Chad Wilson Date: Wed, 22 Jan 2025 16:21:15 +0800 Subject: [PATCH 08/20] Update README / history to reflect 1.2.x releases. --- History.md | 19 ++++++++++++++++++- README.md | 19 +++++++++++-------- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/History.md b/History.md index 98e3d2b5..53355760 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,21 @@ +## 1.2.3 + +- Corrects Rack 2.x compatibility when used with modern Rails, and requires Rack 2.x going forward +- update (bundled) rack to 2.2.10 +- forward ports all 1.1.x fixes to the 1.2.x stream which were omitted in 1.2.2 release (#262) +- fixes regression NoMethodError undefined method get_header (#259) +- correct use of session store with Rails 7.0+ (#244) +- reinstate automated tests for Rails 5.0 - 7.2 (#271) + +## 1.2.2 + +First release of the 1.2.x branch. +- Requires Java 8 or later +- Requires Java Servlet API 3.0 or later +- Improved logger implementation +- Fixes broken multipart data (#247) +- update (bundled) rack to 2.2.9 + ## 1.1.22 - compile using Java 6 source compat @@ -216,7 +234,6 @@ Changes from 1.1.15 apply since the previous release got yanked due a regression - jruby runtime pooling for plain Rack applications (not just Rails) ## 1.1.7 (21/06/12) ->>>>>>> 1.1-stable:History.md - support for delegating logs to java.util.logging (jruby.rack.logging: JUL) - extend RackLogger with levels for better logging with underlying log impl diff --git a/README.md b/README.md index 654fb220..e0c89cf1 100644 --- a/README.md +++ b/README.md @@ -6,20 +6,23 @@ JRuby-Rack supports Rails as well as any Rack-compatible Ruby web framework. For more information on Rack, visit http://rack.github.io/. -**This README (master) targets JRuby-Rack 1.2 (unreleased) please use the +**This README (master) targets JRuby-Rack 1.2. Please use the [1.1-stable](https://github.com/jruby/jruby-rack/tree/1.1-stable) branch for current stable 1.1.x releases.** [![Gem Version](https://badge.fury.io/rb/jruby-rack.png)][8] -[![Build Status][9]](http://travis-ci.org/jruby/jruby-rack) +[![Build Status](https://github.com/jruby/jruby-rack/actions/workflows/maven.yml/badge.svg)][9] ## Compatibility -JRuby-Rack 1.1.x aims to be compatible with JRuby >= 1.6.4 (we recommend 1.7.x), -Generally, any container that supports Java Servlet >= 2.5 (JEE 5) is supported. +JRuby-Rack 1.2.x +- aims to be compatible with JRuby >= 9.3 and its supported JDK versions +- supports any container compatible with Java Servlet 3.0 API + +JRuby-Rack 1.1.x +- aims to be compatible with JRuby >= 1.6.4 (used successfully through JRuby 9.4.x) +- supports any container compatible with Java Servlet 2.5 API (JEE 5) -JRuby-Rack 1.2.x is expected to officially support JRuby >= 1.7.10 and will be -compiled against the Java Servlet 3.0 API. ## Getting Started @@ -277,7 +280,7 @@ provided *config.ru* the bundled (latest) version of Rack will get loaded. Use **rack.version** to specify the Rack gem version to be loaded before rackup : # encoding: UTF-8 - # rack.version: ~>1.3.6 (before code is loaded gem '~>1.3.6' will be called) + # rack.version: ~>2.2.10 (before code is loaded gem '~>2.2.10' will be called) Or the equivalent of doing `bundle exec rackup ...` if you're using Bundler : @@ -349,4 +352,4 @@ More information at the [wiki][5] or ask us at **#jruby**'s IRC channel. [4]: https://github.com/jruby/jruby-rack/issues [5]: https://wiki.github.com/jruby/jruby-rack [8]: http://badge.fury.io/rb/jruby-rack -[9]: https://secure.travis-ci.org/jruby/jruby-rack.png?branch=master +[9]: https://github.com/jruby/jruby-rack/actions/workflows/maven.yml From 4dcb31c3c164ffa508137cb26ac2ed6873635920 Mon Sep 17 00:00:00 2001 From: Chad Wilson Date: Thu, 23 Jan 2025 14:56:55 +0800 Subject: [PATCH 09/20] Fix Rails 7.1 compatibility by ensuring active_support is required before railtie Not sure if this is us, strictly speaking but we seem to need to require active_support before the railties or the issue at https://github.com/rails/rails/issues/49495#issuecomment-1749085658 occurs --- src/main/ruby/jruby/rack/rails/railtie.rb | 1 + src/spec/ruby/rails3x/stub/active_support.rb | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 src/spec/ruby/rails3x/stub/active_support.rb diff --git a/src/main/ruby/jruby/rack/rails/railtie.rb b/src/main/ruby/jruby/rack/rails/railtie.rb index 1ef002ab..567a8817 100644 --- a/src/main/ruby/jruby/rack/rails/railtie.rb +++ b/src/main/ruby/jruby/rack/rails/railtie.rb @@ -6,6 +6,7 @@ # See the file LICENSE.txt for details. #++ +require 'active_support' require 'rails/railtie' require 'pathname' diff --git a/src/spec/ruby/rails3x/stub/active_support.rb b/src/spec/ruby/rails3x/stub/active_support.rb new file mode 100644 index 00000000..3012c894 --- /dev/null +++ b/src/spec/ruby/rails3x/stub/active_support.rb @@ -0,0 +1,9 @@ +#-- +# Copyright (c) 2010-2012 Engine Yard, Inc. +# Copyright (c) 2007-2009 Sun Microsystems, Inc. +# This source code is available under the MIT license. +# See the file LICENSE.txt for details. +#++ + +module ActiveSupport +end \ No newline at end of file From 28727fd914a0054ec9cf931ed29f04a99e7bee0c Mon Sep 17 00:00:00 2001 From: Chad Wilson Date: Wed, 19 Feb 2025 17:52:11 +0800 Subject: [PATCH 10/20] Bump jruby version to 9.4.12.0 (cherry picked from commit 58301dbeac51d09cb9f503d6907803b2d549eb2f) --- .github/workflows/maven.yml | 5 +++-- Gemfile.lock | 2 +- gemfiles/rails50.gemfile.lock | 7 +++++-- gemfiles/rails52.gemfile.lock | 7 +++++-- gemfiles/rails60.gemfile.lock | 7 +++++-- gemfiles/rails61.gemfile.lock | 7 +++++-- gemfiles/rails70.gemfile.lock | 7 +++++-- gemfiles/rails71.gemfile.lock | 7 +++++-- gemfiles/rails72.gemfile.lock | 7 +++++-- pom.xml | 2 +- 10 files changed, 40 insertions(+), 18 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 3771421c..e1362eae 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - jruby_version: [ '9.3.15.0', '9.4.9.0' ] + jruby_version: [ '9.3.15.0', '9.4.12.0' ] java_version: [ '8', '11', '17', '21' ] fail-fast: false @@ -42,7 +42,7 @@ jobs: strategy: matrix: - jruby_version: [ '9.3.15.0', '9.4.9.0' ] + jruby_version: [ '9.3.15.0', '9.4.12.0' ] java_version: [ '8', '11', '17', '21' ] appraisal: [ 'rails50', 'rails52', 'rails60', 'rails61', 'rails70', 'rails71', 'rails72' ] exclude: @@ -98,6 +98,7 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: jruby-${{ matrix.jruby_version }} + bundler: 2.3.27 # use version that is OK for JRuby 9.3 - name: Run appraisal for ${{ matrix.appraisal }} env: diff --git a/Gemfile.lock b/Gemfile.lock index e8c76e01..eb9b6cd4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -36,4 +36,4 @@ DEPENDENCIES rspec BUNDLED WITH - 2.3.26 + 2.6.3 diff --git a/gemfiles/rails50.gemfile.lock b/gemfiles/rails50.gemfile.lock index 8fde8380..0df27408 100644 --- a/gemfiles/rails50.gemfile.lock +++ b/gemfiles/rails50.gemfile.lock @@ -136,7 +136,10 @@ GEM websocket-extensions (0.1.5) PLATFORMS - universal-java + universal-java-1.8 + universal-java-11 + universal-java-17 + universal-java-21 DEPENDENCIES appraisal @@ -146,4 +149,4 @@ DEPENDENCIES rspec BUNDLED WITH - 2.3.26 + 2.3.27 diff --git a/gemfiles/rails52.gemfile.lock b/gemfiles/rails52.gemfile.lock index 97e9964e..9f89dca4 100644 --- a/gemfiles/rails52.gemfile.lock +++ b/gemfiles/rails52.gemfile.lock @@ -144,7 +144,10 @@ GEM websocket-extensions (0.1.5) PLATFORMS - universal-java + universal-java-1.8 + universal-java-11 + universal-java-17 + universal-java-21 DEPENDENCIES appraisal @@ -154,4 +157,4 @@ DEPENDENCIES rspec BUNDLED WITH - 2.3.26 + 2.3.27 diff --git a/gemfiles/rails60.gemfile.lock b/gemfiles/rails60.gemfile.lock index 81a61ef4..97f9e716 100644 --- a/gemfiles/rails60.gemfile.lock +++ b/gemfiles/rails60.gemfile.lock @@ -160,7 +160,10 @@ GEM zeitwerk (2.6.18) PLATFORMS - universal-java + universal-java-1.8 + universal-java-11 + universal-java-17 + universal-java-21 DEPENDENCIES appraisal @@ -170,4 +173,4 @@ DEPENDENCIES rspec BUNDLED WITH - 2.3.26 + 2.3.27 diff --git a/gemfiles/rails61.gemfile.lock b/gemfiles/rails61.gemfile.lock index 5eccb1fb..7682f118 100644 --- a/gemfiles/rails61.gemfile.lock +++ b/gemfiles/rails61.gemfile.lock @@ -163,7 +163,10 @@ GEM zeitwerk (2.6.18) PLATFORMS - universal-java + universal-java-1.8 + universal-java-11 + universal-java-17 + universal-java-21 DEPENDENCIES appraisal @@ -173,4 +176,4 @@ DEPENDENCIES rspec BUNDLED WITH - 2.3.26 + 2.3.27 diff --git a/gemfiles/rails70.gemfile.lock b/gemfiles/rails70.gemfile.lock index b161112e..26fb525d 100644 --- a/gemfiles/rails70.gemfile.lock +++ b/gemfiles/rails70.gemfile.lock @@ -162,7 +162,10 @@ GEM zeitwerk (2.6.18) PLATFORMS - universal-java + universal-java-1.8 + universal-java-11 + universal-java-17 + universal-java-21 DEPENDENCIES appraisal @@ -172,4 +175,4 @@ DEPENDENCIES rspec BUNDLED WITH - 2.3.26 + 2.3.27 diff --git a/gemfiles/rails71.gemfile.lock b/gemfiles/rails71.gemfile.lock index 2e45efe6..2382b27b 100644 --- a/gemfiles/rails71.gemfile.lock +++ b/gemfiles/rails71.gemfile.lock @@ -199,7 +199,10 @@ GEM zeitwerk (2.6.18) PLATFORMS - universal-java + universal-java-1.8 + universal-java-11 + universal-java-17 + universal-java-21 DEPENDENCIES appraisal @@ -209,4 +212,4 @@ DEPENDENCIES rspec BUNDLED WITH - 2.3.26 + 2.3.27 diff --git a/gemfiles/rails72.gemfile.lock b/gemfiles/rails72.gemfile.lock index f3bec09c..01fb9bf3 100644 --- a/gemfiles/rails72.gemfile.lock +++ b/gemfiles/rails72.gemfile.lock @@ -193,7 +193,10 @@ GEM zeitwerk (2.6.18) PLATFORMS - universal-java + universal-java-1.8 + universal-java-11 + universal-java-17 + universal-java-21 DEPENDENCIES appraisal @@ -203,4 +206,4 @@ DEPENDENCIES rspec BUNDLED WITH - 2.3.26 + 2.3.27 diff --git a/pom.xml b/pom.xml index ac7e9f65..15cfa269 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ - 9.4.9.0 + 9.4.12.0 3.0.3 ${project.build.directory}/rubygems 2.0.16 From 61aef5bf8a390da45b859e87774390e0049df4de Mon Sep 17 00:00:00 2001 From: Chad Wilson Date: Wed, 19 Feb 2025 17:53:16 +0800 Subject: [PATCH 11/20] Bump commons-logging from 1.3.4 to 1.3.5 (cherry picked from commit c6ae29dc8cfd4fdc2925c044f8efecf2d91a7df7) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 15cfa269..9ff9bd3d 100644 --- a/pom.xml +++ b/pom.xml @@ -118,7 +118,7 @@ commons-logging commons-logging - 1.3.4 + 1.3.5 provided From 96073cf86082b5e983689df89ef5855f1549c5b0 Mon Sep 17 00:00:00 2001 From: Chad Wilson Date: Wed, 19 Feb 2025 17:59:35 +0800 Subject: [PATCH 12/20] Update maven plugins to latest version (cherry picked from commit acd3be892a3d1094b0f8eeb53e6403ec872c5fda) --- pom.xml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 9ff9bd3d..a93a6103 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ 9.4.12.0 - 3.0.3 + 3.0.5 ${project.build.directory}/rubygems 2.0.16 @@ -173,6 +173,26 @@ + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-maven + + enforce + + + + + 3.6.3 + + + + + + org.apache.maven.plugins maven-compiler-plugin @@ -308,7 +328,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.11.1 + 3.11.2 attach-javadocs From d392f949426447aa045640148f02b73139c47cb5 Mon Sep 17 00:00:00 2001 From: Chad Wilson Date: Wed, 19 Feb 2025 18:05:15 +0800 Subject: [PATCH 13/20] Bump minor dependency versions (cherry picked from commit 92d6c23c43000d3fb58714cafd78aee341af1be2) --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index eb9b6cd4..0b690f49 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,14 +5,14 @@ GEM bundler rake thor (>= 0.14.0) - diff-lcs (1.5.1) + diff-lcs (1.6.0) rack (2.2.10) rake (13.2.1) rspec (3.13.0) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.2) + rspec-core (3.13.3) rspec-support (~> 3.13.0) rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) @@ -20,7 +20,7 @@ GEM rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-support (3.13.1) + rspec-support (3.13.2) thor (1.3.2) PLATFORMS From ab807bed488ac70fa1e148c606192e359332f429 Mon Sep 17 00:00:00 2001 From: Chad Wilson Date: Wed, 19 Feb 2025 18:17:38 +0800 Subject: [PATCH 14/20] Bump minor dependency versions for appraisals (cherry picked from commit a3057f1238764a2df743e84bbef6b2684058157e) --- gemfiles/rails50.gemfile.lock | 12 ++-- gemfiles/rails52.gemfile.lock | 12 ++-- gemfiles/rails60.gemfile.lock | 12 ++-- gemfiles/rails61.gemfile.lock | 118 +++++++++++++++++----------------- gemfiles/rails70.gemfile.lock | 12 ++-- gemfiles/rails71.gemfile.lock | 24 ++++--- gemfiles/rails72.gemfile.lock | 24 ++++--- 7 files changed, 111 insertions(+), 103 deletions(-) diff --git a/gemfiles/rails50.gemfile.lock b/gemfiles/rails50.gemfile.lock index 0df27408..24e1f583 100644 --- a/gemfiles/rails50.gemfile.lock +++ b/gemfiles/rails50.gemfile.lock @@ -47,7 +47,7 @@ GEM concurrent-ruby (1.3.5) crass (1.0.6) date (3.4.1-java) - diff-lcs (1.5.1) + diff-lcs (1.6.0) erubis (2.7.0) globalid (1.1.0) activesupport (>= 5.0) @@ -64,20 +64,20 @@ GEM method_source (1.1.0) mini_mime (1.1.5) minitest (5.25.4) - net-imap (0.5.5) + net-imap (0.5.6) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.5.0) + net-smtp (0.5.1) net-protocol nio4r (2.7.4-java) - nokogiri (1.18.2-java) + nokogiri (1.18.3-java) racc (~> 1.4) racc (1.8.1-java) - rack (2.2.10) + rack (2.2.11) rack-test (0.6.3) rack (>= 1.0) rails (5.0.7.2) @@ -110,7 +110,7 @@ GEM rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.2) + rspec-core (3.13.3) rspec-support (~> 3.13.0) rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) diff --git a/gemfiles/rails52.gemfile.lock b/gemfiles/rails52.gemfile.lock index 9f89dca4..c224ab1e 100644 --- a/gemfiles/rails52.gemfile.lock +++ b/gemfiles/rails52.gemfile.lock @@ -52,7 +52,7 @@ GEM concurrent-ruby (1.3.5) crass (1.0.6) date (3.4.1-java) - diff-lcs (1.5.1) + diff-lcs (1.6.0) erubi (1.13.1) globalid (1.1.0) activesupport (>= 5.0) @@ -70,20 +70,20 @@ GEM method_source (1.1.0) mini_mime (1.1.5) minitest (5.25.4) - net-imap (0.5.5) + net-imap (0.5.6) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.5.0) + net-smtp (0.5.1) net-protocol nio4r (2.7.4-java) - nokogiri (1.18.2-java) + nokogiri (1.18.3-java) racc (~> 1.4) racc (1.8.1-java) - rack (2.2.10) + rack (2.2.11) rack-test (2.2.0) rack (>= 1.3) rails (5.2.8.1) @@ -117,7 +117,7 @@ GEM rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.2) + rspec-core (3.13.3) rspec-support (~> 3.13.0) rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) diff --git a/gemfiles/rails60.gemfile.lock b/gemfiles/rails60.gemfile.lock index 97f9e716..eb50df24 100644 --- a/gemfiles/rails60.gemfile.lock +++ b/gemfiles/rails60.gemfile.lock @@ -65,7 +65,7 @@ GEM concurrent-ruby (1.3.5) crass (1.0.6) date (3.4.1-java) - diff-lcs (1.5.1) + diff-lcs (1.6.0) erubi (1.13.1) globalid (1.1.0) activesupport (>= 5.0) @@ -83,20 +83,20 @@ GEM method_source (1.1.0) mini_mime (1.1.5) minitest (5.25.4) - net-imap (0.5.5) + net-imap (0.5.6) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.5.0) + net-smtp (0.5.1) net-protocol nio4r (2.7.4-java) - nokogiri (1.18.2-java) + nokogiri (1.18.3-java) racc (~> 1.4) racc (1.8.1-java) - rack (2.2.10) + rack (2.2.11) rack-test (2.2.0) rack (>= 1.3) rails (6.0.6.1) @@ -132,7 +132,7 @@ GEM rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.2) + rspec-core (3.13.3) rspec-support (~> 3.13.0) rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) diff --git a/gemfiles/rails61.gemfile.lock b/gemfiles/rails61.gemfile.lock index 7682f118..573dc2e6 100644 --- a/gemfiles/rails61.gemfile.lock +++ b/gemfiles/rails61.gemfile.lock @@ -1,60 +1,60 @@ GEM remote: https://rubygems.org/ specs: - actioncable (6.1.7.9) - actionpack (= 6.1.7.9) - activesupport (= 6.1.7.9) + actioncable (6.1.7.10) + actionpack (= 6.1.7.10) + activesupport (= 6.1.7.10) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.7.9) - actionpack (= 6.1.7.9) - activejob (= 6.1.7.9) - activerecord (= 6.1.7.9) - activestorage (= 6.1.7.9) - activesupport (= 6.1.7.9) + actionmailbox (6.1.7.10) + actionpack (= 6.1.7.10) + activejob (= 6.1.7.10) + activerecord (= 6.1.7.10) + activestorage (= 6.1.7.10) + activesupport (= 6.1.7.10) mail (>= 2.7.1) - actionmailer (6.1.7.9) - actionpack (= 6.1.7.9) - actionview (= 6.1.7.9) - activejob (= 6.1.7.9) - activesupport (= 6.1.7.9) + actionmailer (6.1.7.10) + actionpack (= 6.1.7.10) + actionview (= 6.1.7.10) + activejob (= 6.1.7.10) + activesupport (= 6.1.7.10) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.1.7.9) - actionview (= 6.1.7.9) - activesupport (= 6.1.7.9) + actionpack (6.1.7.10) + actionview (= 6.1.7.10) + activesupport (= 6.1.7.10) rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.7.9) - actionpack (= 6.1.7.9) - activerecord (= 6.1.7.9) - activestorage (= 6.1.7.9) - activesupport (= 6.1.7.9) + actiontext (6.1.7.10) + actionpack (= 6.1.7.10) + activerecord (= 6.1.7.10) + activestorage (= 6.1.7.10) + activesupport (= 6.1.7.10) nokogiri (>= 1.8.5) - actionview (6.1.7.9) - activesupport (= 6.1.7.9) + actionview (6.1.7.10) + activesupport (= 6.1.7.10) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.7.9) - activesupport (= 6.1.7.9) + activejob (6.1.7.10) + activesupport (= 6.1.7.10) globalid (>= 0.3.6) - activemodel (6.1.7.9) - activesupport (= 6.1.7.9) - activerecord (6.1.7.9) - activemodel (= 6.1.7.9) - activesupport (= 6.1.7.9) - activestorage (6.1.7.9) - actionpack (= 6.1.7.9) - activejob (= 6.1.7.9) - activerecord (= 6.1.7.9) - activesupport (= 6.1.7.9) + activemodel (6.1.7.10) + activesupport (= 6.1.7.10) + activerecord (6.1.7.10) + activemodel (= 6.1.7.10) + activesupport (= 6.1.7.10) + activestorage (6.1.7.10) + actionpack (= 6.1.7.10) + activejob (= 6.1.7.10) + activerecord (= 6.1.7.10) + activesupport (= 6.1.7.10) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (6.1.7.9) + activesupport (6.1.7.10) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -69,7 +69,7 @@ GEM concurrent-ruby (1.3.5) crass (1.0.6) date (3.4.1-java) - diff-lcs (1.5.1) + diff-lcs (1.6.0) erubi (1.13.1) globalid (1.2.1) activesupport (>= 6.1) @@ -87,36 +87,36 @@ GEM method_source (1.1.0) mini_mime (1.1.5) minitest (5.25.4) - net-imap (0.5.5) + net-imap (0.5.6) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.5.0) + net-smtp (0.5.1) net-protocol nio4r (2.7.4-java) - nokogiri (1.18.2-java) + nokogiri (1.18.3-java) racc (~> 1.4) racc (1.8.1-java) - rack (2.2.10) + rack (2.2.11) rack-test (2.2.0) rack (>= 1.3) - rails (6.1.7.9) - actioncable (= 6.1.7.9) - actionmailbox (= 6.1.7.9) - actionmailer (= 6.1.7.9) - actionpack (= 6.1.7.9) - actiontext (= 6.1.7.9) - actionview (= 6.1.7.9) - activejob (= 6.1.7.9) - activemodel (= 6.1.7.9) - activerecord (= 6.1.7.9) - activestorage (= 6.1.7.9) - activesupport (= 6.1.7.9) + rails (6.1.7.10) + actioncable (= 6.1.7.10) + actionmailbox (= 6.1.7.10) + actionmailer (= 6.1.7.10) + actionpack (= 6.1.7.10) + actiontext (= 6.1.7.10) + actionview (= 6.1.7.10) + activejob (= 6.1.7.10) + activemodel (= 6.1.7.10) + activerecord (= 6.1.7.10) + activestorage (= 6.1.7.10) + activesupport (= 6.1.7.10) bundler (>= 1.15.0) - railties (= 6.1.7.9) + railties (= 6.1.7.10) sprockets-rails (>= 2.0.0) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) @@ -125,9 +125,9 @@ GEM rails-html-sanitizer (1.6.2) loofah (~> 2.21) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) - railties (6.1.7.9) - actionpack (= 6.1.7.9) - activesupport (= 6.1.7.9) + railties (6.1.7.10) + actionpack (= 6.1.7.10) + activesupport (= 6.1.7.10) method_source rake (>= 12.2) thor (~> 1.0) @@ -136,7 +136,7 @@ GEM rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.2) + rspec-core (3.13.3) rspec-support (~> 3.13.0) rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) diff --git a/gemfiles/rails70.gemfile.lock b/gemfiles/rails70.gemfile.lock index 26fb525d..48310f12 100644 --- a/gemfiles/rails70.gemfile.lock +++ b/gemfiles/rails70.gemfile.lock @@ -75,7 +75,7 @@ GEM concurrent-ruby (1.3.5) crass (1.0.6) date (3.4.1-java) - diff-lcs (1.5.1) + diff-lcs (1.6.0) erubi (1.13.1) globalid (1.2.1) activesupport (>= 6.1) @@ -93,20 +93,20 @@ GEM method_source (1.1.0) mini_mime (1.1.5) minitest (5.25.4) - net-imap (0.5.5) + net-imap (0.5.6) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.5.0) + net-smtp (0.5.1) net-protocol nio4r (2.7.4-java) - nokogiri (1.18.2-java) + nokogiri (1.18.3-java) racc (~> 1.4) racc (1.8.1-java) - rack (2.2.10) + rack (2.2.11) rack-test (2.2.0) rack (>= 1.3) rails (7.0.8.7) @@ -142,7 +142,7 @@ GEM rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.2) + rspec-core (3.13.3) rspec-support (~> 3.13.0) rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) diff --git a/gemfiles/rails71.gemfile.lock b/gemfiles/rails71.gemfile.lock index 2382b27b..6e36ffaf 100644 --- a/gemfiles/rails71.gemfile.lock +++ b/gemfiles/rails71.gemfile.lock @@ -90,7 +90,7 @@ GEM connection_pool (2.5.0) crass (1.0.6) date (3.4.1-java) - diff-lcs (1.5.1) + diff-lcs (1.6.0) drb (2.2.1) erubi (1.13.1) globalid (1.2.1) @@ -98,11 +98,12 @@ GEM i18n (1.14.7) concurrent-ruby (~> 1.0) io-console (0.8.0-java) - irb (1.14.3) + irb (1.15.1) + pp (>= 0.6.0) rdoc (>= 4.0.0) reline (>= 0.4.2) - jar-dependencies (0.4.1) - logger (1.6.5) + jar-dependencies (0.5.5) + logger (1.6.6) loofah (2.24.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -115,23 +116,26 @@ GEM mini_mime (1.1.5) minitest (5.25.4) mutex_m (0.3.0) - net-imap (0.5.5) + net-imap (0.5.6) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.5.0) + net-smtp (0.5.1) net-protocol nio4r (2.7.4-java) - nokogiri (1.18.2-java) + nokogiri (1.18.3-java) racc (~> 1.4) + pp (0.6.2) + prettyprint + prettyprint (0.2.0) psych (5.2.3-java) date jar-dependencies (>= 0.1.7) racc (1.8.1-java) - rack (2.2.10) + rack (2.2.11) rack-session (1.0.2) rack (< 3) rack-test (2.2.0) @@ -169,7 +173,7 @@ GEM thor (~> 1.0, >= 1.2.2) zeitwerk (~> 2.6) rake (13.2.1) - rdoc (6.11.0) + rdoc (6.12.0) psych (>= 4.0.0) reline (0.6.0) io-console (~> 0.5) @@ -177,7 +181,7 @@ GEM rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.2) + rspec-core (3.13.3) rspec-support (~> 3.13.0) rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) diff --git a/gemfiles/rails72.gemfile.lock b/gemfiles/rails72.gemfile.lock index 01fb9bf3..19d611ee 100644 --- a/gemfiles/rails72.gemfile.lock +++ b/gemfiles/rails72.gemfile.lock @@ -84,7 +84,7 @@ GEM connection_pool (2.5.0) crass (1.0.6) date (3.4.1-java) - diff-lcs (1.5.1) + diff-lcs (1.6.0) drb (2.2.1) erubi (1.13.1) globalid (1.2.1) @@ -92,11 +92,12 @@ GEM i18n (1.14.7) concurrent-ruby (~> 1.0) io-console (0.8.0-java) - irb (1.14.3) + irb (1.15.1) + pp (>= 0.6.0) rdoc (>= 4.0.0) reline (>= 0.4.2) - jar-dependencies (0.4.1) - logger (1.6.5) + jar-dependencies (0.5.5) + logger (1.6.6) loofah (2.24.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -108,23 +109,26 @@ GEM marcel (1.0.4) mini_mime (1.1.5) minitest (5.25.4) - net-imap (0.5.5) + net-imap (0.5.6) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.5.0) + net-smtp (0.5.1) net-protocol nio4r (2.7.4-java) - nokogiri (1.18.2-java) + nokogiri (1.18.3-java) racc (~> 1.4) + pp (0.6.2) + prettyprint + prettyprint (0.2.0) psych (5.2.3-java) date jar-dependencies (>= 0.1.7) racc (1.8.1-java) - rack (2.2.10) + rack (2.2.11) rack-session (1.0.2) rack (< 3) rack-test (2.2.0) @@ -162,7 +166,7 @@ GEM thor (~> 1.0, >= 1.2.2) zeitwerk (~> 2.6) rake (13.2.1) - rdoc (6.11.0) + rdoc (6.12.0) psych (>= 4.0.0) reline (0.6.0) io-console (~> 0.5) @@ -170,7 +174,7 @@ GEM rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.2) + rspec-core (3.13.3) rspec-support (~> 3.13.0) rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) From 4fed7a4b806617b9ed767ecc499b83c6033701cd Mon Sep 17 00:00:00 2001 From: Chad Wilson Date: Wed, 19 Feb 2025 18:17:52 +0800 Subject: [PATCH 15/20] Bump bundled rack from 2.2.10 to 2.2.11 (cherry picked from commit d01f04d21eba0a8af511806181e1c85b655479b5) --- Gemfile.lock | 2 +- History.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0b690f49..3fe1e359 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,7 +6,7 @@ GEM rake thor (>= 0.14.0) diff-lcs (1.6.0) - rack (2.2.10) + rack (2.2.11) rake (13.2.1) rspec (3.13.0) rspec-core (~> 3.13.0) diff --git a/History.md b/History.md index 53355760..ef6bf9c9 100644 --- a/History.md +++ b/History.md @@ -1,7 +1,7 @@ ## 1.2.3 +- update (bundled) rack to 2.2.11 - Corrects Rack 2.x compatibility when used with modern Rails, and requires Rack 2.x going forward -- update (bundled) rack to 2.2.10 - forward ports all 1.1.x fixes to the 1.2.x stream which were omitted in 1.2.2 release (#262) - fixes regression NoMethodError undefined method get_header (#259) - correct use of session store with Rails 7.0+ (#244) From bbc9c0b53220b70ba59cf10e2ee1e306d48821e1 Mon Sep 17 00:00:00 2001 From: Chad Wilson Date: Wed, 19 Feb 2025 18:40:20 +0800 Subject: [PATCH 16/20] Remove old TODO (cherry picked from commit 7402823d2a1d33e9034eae7aa262907df0edca73) --- TODO | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 TODO diff --git a/TODO b/TODO deleted file mode 100644 index ec9269f9..00000000 --- a/TODO +++ /dev/null @@ -1,8 +0,0 @@ -- Get rid of RackApplicationFactory; make custom factories just a decorating RackApplication instead - - Move JRuby runtime factory logic into separate small factory that accepts a rackup script -- Introduce application bootstrap strategy concept - - Get rid of custom context listeners, instead accept a "application type" context init param - - The default application bootstrap strategy should be a new automatic bootstrapper that attempts - to detect the application type -- Try to support a public root other than '/' in RackFilter -- Rails: detect JNDI connections and auto-close connections after each request (clear_active_connections!) From efd05d3ae89d35b9480b33842a9a551228fda2b4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Mar 2025 06:34:51 +0000 Subject: [PATCH 17/20] Bump rack in the ruby-deps group across 1 directory Bumps the ruby-deps group with 1 update in the / directory: [rack](https://github.com/rack/rack). Updates `rack` from 2.2.11 to 2.2.12 - [Release notes](https://github.com/rack/rack/releases) - [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md) - [Commits](https://github.com/rack/rack/compare/v2.2.11...v2.2.12) --- updated-dependencies: - dependency-name: rack dependency-type: direct:production update-type: version-update:semver-patch dependency-group: ruby-deps ... Signed-off-by: dependabot[bot] (cherry picked from commit 7c1601bc75f96db9dca24e4ca5d0a27f135938fc) --- Gemfile | 2 +- Gemfile.lock | 5 +++-- History.md | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 9a3b630b..d399346e 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ group :default do if rack_version = ENV['RACK_VERSION'] gem 'rack', rack_version else - gem 'rack', '~> 2.2', '< 3.0' + gem 'rack', '~> 2.2' end end diff --git a/Gemfile.lock b/Gemfile.lock index 3fe1e359..b9659d12 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,7 +6,7 @@ GEM rake thor (>= 0.14.0) diff-lcs (1.6.0) - rack (2.2.11) + rack (2.2.12) rake (13.2.1) rspec (3.13.0) rspec-core (~> 3.13.0) @@ -28,10 +28,11 @@ PLATFORMS universal-java-11 universal-java-17 universal-java-21 + x86_64-linux DEPENDENCIES appraisal - rack (~> 2.2, < 3.0) + rack (~> 2.2) rake (~> 13.2) rspec diff --git a/History.md b/History.md index ef6bf9c9..55e87700 100644 --- a/History.md +++ b/History.md @@ -1,6 +1,6 @@ ## 1.2.3 -- update (bundled) rack to 2.2.11 +- update (bundled) rack to 2.2.12 - Corrects Rack 2.x compatibility when used with modern Rails, and requires Rack 2.x going forward - forward ports all 1.1.x fixes to the 1.2.x stream which were omitted in 1.2.2 release (#262) - fixes regression NoMethodError undefined method get_header (#259) From 8c2f3342a68b61b323f76cc95767ef82efb0a801 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Mar 2025 07:00:15 +0000 Subject: [PATCH 18/20] Bump the maven-deps group across 1 directory with 4 updates Bumps the maven-deps group with 4 updates in the / directory: org.slf4j:slf4j-api, org.slf4j:slf4j-simple, [org.apache.maven.plugins:maven-compiler-plugin](https://github.com/apache/maven-compiler-plugin) and [org.apache.maven.plugins:maven-deploy-plugin](https://github.com/apache/maven-deploy-plugin). Updates `org.slf4j:slf4j-api` from 2.0.16 to 2.0.17 Updates `org.slf4j:slf4j-simple` from 2.0.16 to 2.0.17 Updates `org.apache.maven.plugins:maven-compiler-plugin` from 3.13.0 to 3.14.0 - [Release notes](https://github.com/apache/maven-compiler-plugin/releases) - [Commits](https://github.com/apache/maven-compiler-plugin/compare/maven-compiler-plugin-3.13.0...maven-compiler-plugin-3.14.0) Updates `org.apache.maven.plugins:maven-deploy-plugin` from 3.1.3 to 3.1.4 - [Release notes](https://github.com/apache/maven-deploy-plugin/releases) - [Commits](https://github.com/apache/maven-deploy-plugin/compare/maven-deploy-plugin-3.1.3...maven-deploy-plugin-3.1.4) --- updated-dependencies: - dependency-name: org.slf4j:slf4j-api dependency-type: direct:production update-type: version-update:semver-patch dependency-group: maven-deps - dependency-name: org.slf4j:slf4j-simple dependency-type: direct:development update-type: version-update:semver-patch dependency-group: maven-deps - dependency-name: org.apache.maven.plugins:maven-compiler-plugin dependency-type: direct:production update-type: version-update:semver-minor dependency-group: maven-deps - dependency-name: org.apache.maven.plugins:maven-deploy-plugin dependency-type: direct:production update-type: version-update:semver-patch dependency-group: maven-deps ... Signed-off-by: dependabot[bot] (cherry picked from commit 640d13a17a5b56ff96d8cff677784b1b5d72b1ec) --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index a93a6103..e7270be1 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ 9.4.12.0 3.0.5 ${project.build.directory}/rubygems - 2.0.16 + 2.0.17 @@ -196,7 +196,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.13.0 + 3.14.0 8 8 @@ -235,7 +235,7 @@ org.apache.maven.plugins maven-deploy-plugin - 3.1.3 + 3.1.4 org.jruby.maven From a31a9e1a1b54508e1dda5768d4b7abd0155efca5 Mon Sep 17 00:00:00 2001 From: Chad Wilson Date: Wed, 5 Mar 2025 17:08:31 +0800 Subject: [PATCH 19/20] Remove copy+pasted Spring test code, preferring upstream --- pom.xml | 11 +- .../mock/DelegatingServletInputStream.java | 63 - .../mock/DelegatingServletOutputStream.java | 68 -- .../jruby/rack/mock/HeaderValueHolder.java | 138 --- .../rack/mock/LinkedCaseInsensitiveMap.java | 139 --- .../org/jruby/rack/mock/MockAsyncContext.java | 166 --- .../rack/mock/MockHttpServletRequest.java | 1018 ----------------- .../rack/mock/MockHttpServletResponse.java | 555 --------- .../org/jruby/rack/mock/MockHttpSession.java | 270 ----- .../rack/mock/MockRequestDispatcher.java | 75 -- .../jruby/rack/mock/MockServletConfig.java | 105 -- .../jruby/rack/mock/MockServletContext.java | 633 ---------- .../rack/mock/MockSessionCookieConfig.java | 115 -- .../mock/RackLoggingMockServletContext.java | 80 ++ .../java/org/jruby/rack/mock/WebUtils.java | 738 ------------ .../mock/fail/FailingHttpServletResponse.java | 13 +- .../mock/fail/FailingServletOutputStream.java | 6 +- .../session/java_servlet_store_spec.rb | 17 +- src/spec/ruby/jruby/rack/integration_spec.rb | 10 +- src/spec/ruby/jruby/rack/logger_spec.rb | 2 +- src/spec/ruby/jruby/rack/rails_booter_spec.rb | 4 +- src/spec/ruby/jruby/rack/servlet_ext_spec.rb | 6 +- src/spec/ruby/rack/application_spec.rb | 4 +- src/spec/ruby/rack/handler/servlet_spec.rb | 22 +- .../rack/servlet_context_listener_spec.rb | 2 +- src/spec/ruby/spec_helper.rb | 8 +- 26 files changed, 134 insertions(+), 4134 deletions(-) delete mode 100644 src/spec/java/org/jruby/rack/mock/DelegatingServletInputStream.java delete mode 100644 src/spec/java/org/jruby/rack/mock/DelegatingServletOutputStream.java delete mode 100644 src/spec/java/org/jruby/rack/mock/HeaderValueHolder.java delete mode 100644 src/spec/java/org/jruby/rack/mock/LinkedCaseInsensitiveMap.java delete mode 100644 src/spec/java/org/jruby/rack/mock/MockAsyncContext.java delete mode 100644 src/spec/java/org/jruby/rack/mock/MockHttpServletRequest.java delete mode 100644 src/spec/java/org/jruby/rack/mock/MockHttpServletResponse.java delete mode 100644 src/spec/java/org/jruby/rack/mock/MockHttpSession.java delete mode 100644 src/spec/java/org/jruby/rack/mock/MockRequestDispatcher.java delete mode 100644 src/spec/java/org/jruby/rack/mock/MockServletConfig.java delete mode 100644 src/spec/java/org/jruby/rack/mock/MockServletContext.java delete mode 100644 src/spec/java/org/jruby/rack/mock/MockSessionCookieConfig.java create mode 100644 src/spec/java/org/jruby/rack/mock/RackLoggingMockServletContext.java delete mode 100644 src/spec/java/org/jruby/rack/mock/WebUtils.java diff --git a/pom.xml b/pom.xml index e7270be1..9577e10f 100644 --- a/pom.xml +++ b/pom.xml @@ -23,6 +23,7 @@ 3.0.5 ${project.build.directory}/rubygems 2.0.17 + 4.3.30.RELEASE @@ -135,8 +136,14 @@ org.springframework - spring-core - 3.2.18.RELEASE + spring-web + ${spring.version} + test + + + org.springframework + spring-test + ${spring.version} test diff --git a/src/spec/java/org/jruby/rack/mock/DelegatingServletInputStream.java b/src/spec/java/org/jruby/rack/mock/DelegatingServletInputStream.java deleted file mode 100644 index d8694c00..00000000 --- a/src/spec/java/org/jruby/rack/mock/DelegatingServletInputStream.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2002-2013 the original author or authors. - * - * Licensed 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. - */ - -package org.jruby.rack.mock; - -import java.io.IOException; -import java.io.InputStream; -import javax.servlet.ServletInputStream; - -/** - * Delegating implementation of {@link javax.servlet.ServletInputStream}. - * - *

Used by {@link MockHttpServletRequest}; typically not directly - * used for testing application controllers. - * - * @author Juergen Hoeller - * @since 1.0.2 - * @see MockHttpServletRequest - */ -public class DelegatingServletInputStream extends ServletInputStream { - - private final InputStream sourceStream; - - - /** - * Create a DelegatingServletInputStream for the given source stream. - * @param sourceStream the source stream (never null) - */ - public DelegatingServletInputStream(InputStream sourceStream) { - this.sourceStream = sourceStream; - } - - /** - * Return the underlying source stream (never null). - */ - public final InputStream getSourceStream() { - return this.sourceStream; - } - - - public int read() throws IOException { - return this.sourceStream.read(); - } - - public void close() throws IOException { - super.close(); - this.sourceStream.close(); - } - -} diff --git a/src/spec/java/org/jruby/rack/mock/DelegatingServletOutputStream.java b/src/spec/java/org/jruby/rack/mock/DelegatingServletOutputStream.java deleted file mode 100644 index e4c5feb7..00000000 --- a/src/spec/java/org/jruby/rack/mock/DelegatingServletOutputStream.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2002-2013 the original author or authors. - * - * Licensed 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. - */ - -package org.jruby.rack.mock; - -import java.io.IOException; -import java.io.OutputStream; -import javax.servlet.ServletOutputStream; - -/** - * Delegating implementation of {@link javax.servlet.ServletOutputStream}. - * - *

Used by {@link MockHttpServletResponse}; typically not directly - * used for testing application controllers. - * - * @author Juergen Hoeller - * @since 1.0.2 - * @see MockHttpServletResponse - */ -public class DelegatingServletOutputStream extends ServletOutputStream { - - private final OutputStream targetStream; - - /** - * Create a DelegatingServletOutputStream for the given target stream. - * @param targetStream the target stream (never null) - */ - public DelegatingServletOutputStream(OutputStream targetStream) { - this.targetStream = targetStream; - } - - /** - * Return the underlying target stream (never null). - */ - public final OutputStream getTargetStream() { - return this.targetStream; - } - - public void write(int b) throws IOException { - this.targetStream.write(b); - } - - @Override - public void flush() throws IOException { - super.flush(); - this.targetStream.flush(); - } - - @Override - public void close() throws IOException { - super.close(); - this.targetStream.close(); - } - -} diff --git a/src/spec/java/org/jruby/rack/mock/HeaderValueHolder.java b/src/spec/java/org/jruby/rack/mock/HeaderValueHolder.java deleted file mode 100644 index 1565e618..00000000 --- a/src/spec/java/org/jruby/rack/mock/HeaderValueHolder.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright 2002-2013 the original author or authors. - * - * Licensed 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. - */ - -package org.jruby.rack.mock; - -import java.lang.reflect.Array; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -/** - * Internal helper class that serves as value holder for request headers. - * - * @author Juergen Hoeller - * @author Rick Evans - */ -class HeaderValueHolder { - - private final List values = new LinkedList(); - - public void setValue(Object value) { - this.values.clear(); - this.values.add(value); - } - - public void addValue(Object value) { - this.values.add(value); - } - - public void addValues(Collection values) { - this.values.addAll(values); - } - - public void addValueArray(Object values) { - mergeArrayIntoCollection(values, this.values); - } - - public List getValues() { - return Collections.unmodifiableList(this.values); - } - - public List getStringValues() { - List stringList = new ArrayList(this.values.size()); - for (Object value : this.values) { - stringList.add(value.toString()); - } - return Collections.unmodifiableList(stringList); - } - - public Object getValue() { - return (!this.values.isEmpty() ? this.values.get(0) : null); - } - - public String getStringValue() { - return (!this.values.isEmpty() ? this.values.get(0).toString() : null); - } - - - /** - * Find a HeaderValueHolder by name, ignoring casing. - * @param headers the Map of header names to HeaderValueHolders - * @param name the name of the desired header - * @return the corresponding HeaderValueHolder, - * or null if none found - */ - public static HeaderValueHolder getByName(Map headers, String name) { - for (String headerName : headers.keySet()) { - if (headerName.equalsIgnoreCase(name)) { - return headers.get(headerName); - } - } - return null; - } - - /** - * Merge the given array into the given Collection. - * @param array the array to merge (may be null) - * @param collection the target Collection to merge the array into - */ - @SuppressWarnings({"unchecked","rawtypes"}) - private static void mergeArrayIntoCollection(Object array, Collection collection) { - if (collection == null) { - throw new IllegalArgumentException("Collection must not be null"); - } - Object[] arr = toObjectArray(array); - for (Object elem : arr) { - collection.add(elem); - } - } - - /** - * Convert the given array (which may be a primitive array) to an - * object array (if necessary of primitive wrapper objects). - *

A null source value will be converted to an - * empty Object array. - * @param source the (potentially primitive) array - * @return the corresponding object array (never null) - * @throws IllegalArgumentException if the parameter is not an array - */ - private static Object[] toObjectArray(Object source) { - if (source instanceof Object[]) { - return (Object[]) source; - } - if (source == null) { - return new Object[0]; - } - if (!source.getClass().isArray()) { - throw new IllegalArgumentException("Source is not an array: " + source); - } - int length = Array.getLength(source); - if (length == 0) { - return new Object[0]; - } - Class wrapperType = Array.get(source, 0).getClass(); - Object[] newArray = (Object[]) Array.newInstance(wrapperType, length); - for (int i = 0; i < length; i++) { - newArray[i] = Array.get(source, i); - } - return newArray; - } - -} diff --git a/src/spec/java/org/jruby/rack/mock/LinkedCaseInsensitiveMap.java b/src/spec/java/org/jruby/rack/mock/LinkedCaseInsensitiveMap.java deleted file mode 100644 index ad45d067..00000000 --- a/src/spec/java/org/jruby/rack/mock/LinkedCaseInsensitiveMap.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright 2002-2013 the original author or authors. - * - * Licensed 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. - */ - -package org.jruby.rack.mock; - -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Locale; -import java.util.Map; - -/** - * {@link LinkedHashMap} variant that stores String keys in a case-insensitive - * manner, for example for key-based access in a results table. - * - *

Preserves the original order as well as the original casing of keys, - * while allowing for contains, get and remove calls with any case of key. - * - *

Does not support null keys. - * - * @author Juergen Hoeller - */ -@SuppressWarnings("serial") -class LinkedCaseInsensitiveMap extends LinkedHashMap { - - private final Map caseInsensitiveKeys; - - private final Locale locale; - - - /** - * Create a new LinkedCaseInsensitiveMap for the default Locale. - * @see java.lang.String#toLowerCase() - */ - public LinkedCaseInsensitiveMap() { - this(null); - } - - /** - * Create a new LinkedCaseInsensitiveMap that stores lower-case keys - * according to the given Locale. - * @param locale the Locale to use for lower-case conversion - * @see java.lang.String#toLowerCase(java.util.Locale) - */ - public LinkedCaseInsensitiveMap(Locale locale) { - super(); - this.caseInsensitiveKeys = new HashMap(); - this.locale = (locale != null ? locale : Locale.getDefault()); - } - - /** - * Create a new LinkedCaseInsensitiveMap that wraps a {@link LinkedHashMap} - * with the given initial capacity and stores lower-case keys according - * to the default Locale. - * @param initialCapacity the initial capacity - * @see java.lang.String#toLowerCase() - */ - public LinkedCaseInsensitiveMap(int initialCapacity) { - this(initialCapacity, null); - } - - /** - * Create a new LinkedCaseInsensitiveMap that wraps a {@link LinkedHashMap} - * with the given initial capacity and stores lower-case keys according - * to the given Locale. - * @param initialCapacity the initial capacity - * @param locale the Locale to use for lower-case conversion - * @see java.lang.String#toLowerCase(java.util.Locale) - */ - public LinkedCaseInsensitiveMap(int initialCapacity, Locale locale) { - super(initialCapacity); - this.caseInsensitiveKeys = new HashMap(initialCapacity); - this.locale = (locale != null ? locale : Locale.getDefault()); - } - - - @Override - public V put(String key, V value) { - this.caseInsensitiveKeys.put(convertKey(key), key); - return super.put(key, value); - } - - @Override - public boolean containsKey(Object key) { - return (key instanceof String && this.caseInsensitiveKeys.containsKey(convertKey((String) key))); - } - - @Override - public V get(Object key) { - if (key instanceof String) { - return super.get(this.caseInsensitiveKeys.get(convertKey((String) key))); - } - else { - return null; - } - } - - @Override - public V remove(Object key) { - if (key instanceof String ) { - return super.remove(this.caseInsensitiveKeys.remove(convertKey((String) key))); - } - else { - return null; - } - } - - @Override - public void clear() { - this.caseInsensitiveKeys.clear(); - super.clear(); - } - - - /** - * Convert the given key to a case-insensitive key. - *

The default implementation converts the key - * to lower-case according to this Map's Locale. - * @param key the user-specified key - * @return the key to use for storing - * @see java.lang.String#toLowerCase(java.util.Locale) - */ - protected String convertKey(String key) { - return key.toLowerCase(this.locale); - } - -} \ No newline at end of file diff --git a/src/spec/java/org/jruby/rack/mock/MockAsyncContext.java b/src/spec/java/org/jruby/rack/mock/MockAsyncContext.java deleted file mode 100644 index ab291817..00000000 --- a/src/spec/java/org/jruby/rack/mock/MockAsyncContext.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright 2002-2013 the original author or authors. - * - * Licensed 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. - */ -package org.jruby.rack.mock; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import javax.servlet.AsyncContext; -import javax.servlet.AsyncEvent; -import javax.servlet.AsyncListener; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -//import org.springframework.beans.BeanUtils; -//import org.springframework.web.util.WebUtils; - -/** - * Mock implementation of the {@link AsyncContext} interface. - * - * @author Rossen Stoyanchev - */ -public class MockAsyncContext implements AsyncContext { - - private final HttpServletRequest request; - - private final HttpServletResponse response; - - private final List listeners = new ArrayList(); - - private String dispatchedPath; - - private long timeout = 10 * 1000L; // 10 seconds is Tomcat's default - - private final List dispatchHandlers = new ArrayList(); - - - public MockAsyncContext(ServletRequest request, ServletResponse response) { - this.request = (HttpServletRequest) request; - this.response = (HttpServletResponse) response; - } - - - public void addDispatchHandler(Runnable handler) { - this.dispatchHandlers.add(handler); - } - - @Override - public ServletRequest getRequest() { - return this.request; - } - - @Override - public ServletResponse getResponse() { - return this.response; - } - - @Override - public boolean hasOriginalRequestAndResponse() { - return (this.request instanceof MockHttpServletRequest) && (this.response instanceof MockHttpServletResponse); - } - - @Override - public void dispatch() { - dispatch(this.request.getRequestURI()); - } - - @Override - public void dispatch(String path) { - dispatch(null, path); - } - - @Override - public void dispatch(ServletContext context, String path) { - this.dispatchedPath = path; - for (Runnable r : this.dispatchHandlers) { - r.run(); - } - } - - public String getDispatchedPath() { - return this.dispatchedPath; - } - - @Override - public void complete() { - MockHttpServletRequest mockRequest = WebUtils.getNativeRequest(request, MockHttpServletRequest.class); - if (mockRequest != null) { - mockRequest.setAsyncStarted(false); - } - for (AsyncListener listener : this.listeners) { - try { - listener.onComplete(new AsyncEvent(this, this.request, this.response)); - } - catch (IOException e) { - throw new IllegalStateException("AsyncListener failure", e); - } - } - } - - @Override - public void start(Runnable runnable) { - runnable.run(); - } - - @Override - public void addListener(AsyncListener listener) { - this.listeners.add(listener); - } - - @Override - public void addListener(AsyncListener listener, ServletRequest request, ServletResponse response) { - this.listeners.add(listener); - } - - public List getListeners() { - return this.listeners; - } - - @Override - public T createListener(Class clazz) throws ServletException { - return instantiate(clazz); // BeanUtils.instantiateClass(clazz); - } - - @Override - public void setTimeout(long timeout) { - this.timeout = timeout; - } - - @Override - public long getTimeout() { - return this.timeout; - } - - private static T instantiate(Class clazz) throws IllegalArgumentException { - if (clazz.isInterface()) { - throw new IllegalArgumentException(clazz + " is an interface"); - } - try { - return clazz.newInstance(); - } - catch (InstantiationException ex) { - throw new IllegalArgumentException(clazz + " is it an abstract class?", ex); - } - catch (IllegalAccessException ex) { - throw new IllegalArgumentException(clazz + " constructor accessible?", ex); - } - } - -} diff --git a/src/spec/java/org/jruby/rack/mock/MockHttpServletRequest.java b/src/spec/java/org/jruby/rack/mock/MockHttpServletRequest.java deleted file mode 100644 index c3be6d4a..00000000 --- a/src/spec/java/org/jruby/rack/mock/MockHttpServletRequest.java +++ /dev/null @@ -1,1018 +0,0 @@ -/* - * Copyright 2002-2013 the original author or authors. - * - * Licensed 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. - */ - -package org.jruby.rack.mock; - -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.io.UnsupportedEncodingException; -import java.security.Principal; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; -import java.util.Vector; - -import javax.servlet.AsyncContext; -import javax.servlet.DispatcherType; -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletInputStream; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import javax.servlet.http.Part; - -/** - * Mock implementation of the {@link javax.servlet.http.HttpServletRequest} interface. - * - *

As of Spring 4.0, this set of mocks is designed on a Servlet 3.0 baseline. - * - * @author Juergen Hoeller - * @author Rod Johnson - * @author Rick Evans - * @author Mark Fisher - * @author Chris Beams - * @author Sam Brannen - */ -public class MockHttpServletRequest implements HttpServletRequest { - - /** - * The default protocol: 'http'. - */ - public static final String DEFAULT_PROTOCOL = "http"; - - /** - * The default server address: '127.0.0.1'. - */ - public static final String DEFAULT_SERVER_ADDR = "127.0.0.1"; - - /** - * The default server name: 'localhost'. - */ - public static final String DEFAULT_SERVER_NAME = "localhost"; - - /** - * The default server port: '80'. - */ - public static final int DEFAULT_SERVER_PORT = 80; - - /** - * The default remote address: '127.0.0.1'. - */ - public static final String DEFAULT_REMOTE_ADDR = "127.0.0.1"; - - /** - * The default remote host: 'localhost'. - */ - public static final String DEFAULT_REMOTE_HOST = "localhost"; - - private boolean active = true; - - - // --------------------------------------------------------------------- - // ServletRequest properties - // --------------------------------------------------------------------- - - private final Map attributes = new LinkedHashMap(); - - private String characterEncoding; - - private byte[] content; - - private String contentType; - - private ServletInputStream inputStream; - private BufferedReader reader; - - private final Map parameters = new LinkedHashMap(16); - - private String protocol = DEFAULT_PROTOCOL; - - private String scheme = DEFAULT_PROTOCOL; - - private String serverName = DEFAULT_SERVER_NAME; - - private int serverPort = DEFAULT_SERVER_PORT; - - private String remoteAddr = DEFAULT_REMOTE_ADDR; - - private String remoteHost = DEFAULT_REMOTE_HOST; - - /** List of locales in descending order */ - private final List locales = new LinkedList(); - - private boolean secure = false; - - private final ServletContext servletContext; - - private int remotePort = DEFAULT_SERVER_PORT; - - private String localName = DEFAULT_SERVER_NAME; - - private String localAddr = DEFAULT_SERVER_ADDR; - - private int localPort = DEFAULT_SERVER_PORT; - - private boolean asyncStarted = false; - - private boolean asyncSupported = false; - - private MockAsyncContext asyncContext; - - private DispatcherType dispatcherType = DispatcherType.REQUEST; - - // --------------------------------------------------------------------- - // HttpServletRequest properties - // --------------------------------------------------------------------- - - private String authType; - - private Cookie[] cookies; - - private final Map headers = new LinkedCaseInsensitiveMap(); - - private String method; - - private String pathInfo; - - private String contextPath = ""; - - private String queryString; - - private String remoteUser; - - private final Set userRoles = new HashSet(); - - private Principal userPrincipal; - - private String requestedSessionId; - - private String requestURI; - - private String servletPath = ""; - - private HttpSession session; - - private boolean requestedSessionIdValid = true; - - private boolean requestedSessionIdFromCookie = true; - - private boolean requestedSessionIdFromURL = false; - - private final Map parts = new LinkedHashMap(); - - - // --------------------------------------------------------------------- - // Constructors - // --------------------------------------------------------------------- - - /** - * Create a new MockHttpServletRequest with a default - * {@link MockServletContext}. - * @see MockServletContext - */ - public MockHttpServletRequest() { - this(null, "", ""); - } - - /** - * Create a new MockHttpServletRequest with a default - * {@link MockServletContext}. - * @param method the request method (may be null) - * @param requestURI the request URI (may be null) - * @see #setMethod - * @see #setRequestURI - * @see MockServletContext - */ - public MockHttpServletRequest(String method, String requestURI) { - this(null, method, requestURI); - } - - /** - * Create a new MockHttpServletRequest. - * @param servletContext the ServletContext that the request runs in (may be - * null to use a default MockServletContext) - * @see MockServletContext - */ - public MockHttpServletRequest(ServletContext servletContext) { - this(servletContext, "", ""); - } - - /** - * Create a new MockHttpServletRequest. - * @param servletContext the ServletContext that the request runs in (may be - * null to use a default MockServletContext) - * @param method the request method (may be null) - * @param requestURI the request URI (may be null) - * @see #setMethod - * @see #setRequestURI - * @see MockServletContext - */ - public MockHttpServletRequest(ServletContext servletContext, String method, String requestURI) { - this.servletContext = servletContext; - this.method = method; - this.requestURI = requestURI; - this.locales.add(Locale.ENGLISH); - } - - - // --------------------------------------------------------------------- - // Lifecycle methods - // --------------------------------------------------------------------- - - /** - * Return the ServletContext that this request is associated with. (Not - * available in the standard HttpServletRequest interface for some reason.) - */ - @Override - public ServletContext getServletContext() { - return this.servletContext; - } - - /** - * Return whether this request is still active (that is, not completed yet). - */ - public boolean isActive() { - return this.active; - } - - /** - * Mark this request as completed, keeping its state. - */ - public void close() { - this.active = false; - } - - /** - * Invalidate this request, clearing its state. - */ - public void invalidate() { - close(); - clearAttributes(); - } - - /** - * Check whether this request is still active (that is, not completed yet), - * throwing an IllegalStateException if not active anymore. - */ - protected void checkActive() throws IllegalStateException { - if (!this.active) { - throw new IllegalStateException("Request is not active anymore"); - } - } - - - // --------------------------------------------------------------------- - // ServletRequest interface - // --------------------------------------------------------------------- - - @Override - public Object getAttribute(String name) { - checkActive(); - return this.attributes.get(name); - } - - @Override - public Enumeration getAttributeNames() { - checkActive(); - return new Vector(this.attributes.keySet()).elements(); - } - - @Override - public String getCharacterEncoding() { - return this.characterEncoding; - } - - @Override - public void setCharacterEncoding(String characterEncoding) { - this.characterEncoding = characterEncoding; - } - - public void setContent(byte[] content) { - this.content = content; - } - - @Override - public int getContentLength() { - return (this.content != null ? this.content.length : -1); - } - - public void setContentType(String contentType) { - this.contentType = contentType; - } - - @Override - public String getContentType() { - return this.contentType; - } - - @Override - public ServletInputStream getInputStream() throws IllegalStateException { - // NOTE: make sure it behaves like a real ServletRequest : - if (this.reader != null) { - throw new IllegalStateException("getReader() method has already been called for this request"); - } - if (this.inputStream != null) return this.inputStream; - - if (this.content != null) { - return this.inputStream = new DelegatingServletInputStream(new ByteArrayInputStream(this.content)); - } - else { - return null; - } - } - - public void resetInputStream() { - this.inputStream = null; - } - - /** - * Set a single value for the specified HTTP parameter. - *

- * If there are already one or more values registered for the given - * parameter name, they will be replaced. - */ - public void setParameter(String name, String value) { - setParameter(name, new String[] { value }); - } - - /** - * Set an array of values for the specified HTTP parameter. - *

- * If there are already one or more values registered for the given - * parameter name, they will be replaced. - */ - public void setParameter(String name, String[] values) { - this.parameters.put(name, values); - } - - /** - * Sets all provided parameters replacing any existing - * values for the provided parameter names. To add without replacing - * existing values, use {@link #addParameters(java.util.Map)}. - */ - @SuppressWarnings("rawtypes") - public void setParameters(Map params) { - for (Object key : params.keySet()) { - Object value = params.get(key); - if (value instanceof String) { - this.setParameter((String) key, (String) value); - } - else if (value instanceof String[]) { - this.setParameter((String) key, (String[]) value); - } - else { - throw new IllegalArgumentException("Parameter map value must be single value " + " or array of type [" - + String.class.getName() + "]"); - } - } - } - - /** - * Add a single value for the specified HTTP parameter. - *

- * If there are already one or more values registered for the given - * parameter name, the given value will be added to the end of the list. - */ - public void addParameter(String name, String value) { - addParameter(name, new String[] { value }); - } - - /** - * Add an array of values for the specified HTTP parameter. - *

- * If there are already one or more values registered for the given - * parameter name, the given values will be added to the end of the list. - */ - public void addParameter(String name, String[] values) { - String[] oldArr = this.parameters.get(name); - if (oldArr != null) { - String[] newArr = new String[oldArr.length + values.length]; - System.arraycopy(oldArr, 0, newArr, 0, oldArr.length); - System.arraycopy(values, 0, newArr, oldArr.length, values.length); - this.parameters.put(name, newArr); - } - else { - this.parameters.put(name, values); - } - } - - /** - * Adds all provided parameters without replacing any - * existing values. To replace existing values, use - * {@link #setParameters(java.util.Map)}. - */ - @SuppressWarnings("rawtypes") - public void addParameters(Map params) { - for (Object key : params.keySet()) { - Object value = params.get(key); - if (value instanceof String) { - this.addParameter((String) key, (String) value); - } - else if (value instanceof String[]) { - this.addParameter((String) key, (String[]) value); - } - else { - throw new IllegalArgumentException("Parameter map value must be single value " + " or array of type [" - + String.class.getName() + "]"); - } - } - } - - /** - * Remove already registered values for the specified HTTP parameter, if - * any. - */ - public void removeParameter(String name) { - this.parameters.remove(name); - } - - /** - * Removes all existing parameters. - */ - public void removeAllParameters() { - this.parameters.clear(); - } - - @Override - public String getParameter(String name) { - String[] arr = this.parameters.get(name); - return (arr != null && arr.length > 0 ? arr[0] : null); - } - - @Override - public Enumeration getParameterNames() { - return Collections.enumeration(this.parameters.keySet()); - } - - @Override - public String[] getParameterValues(String name) { - return this.parameters.get(name); - } - - @Override - public Map getParameterMap() { - return Collections.unmodifiableMap(this.parameters); - } - - public void setProtocol(String protocol) { - this.protocol = protocol; - } - - @Override - public String getProtocol() { - return this.protocol; - } - - public void setScheme(String scheme) { - this.scheme = scheme; - } - - @Override - public String getScheme() { - return this.scheme; - } - - public void setServerName(String serverName) { - this.serverName = serverName; - } - - @Override - public String getServerName() { - return this.serverName; - } - - public void setServerPort(int serverPort) { - this.serverPort = serverPort; - } - - @Override - public int getServerPort() { - return this.serverPort; - } - - @Override - public BufferedReader getReader() throws UnsupportedEncodingException { - // NOTE: make sure it behaves like a real ServletRequest : - if (this.inputStream != null) { - throw new IllegalStateException("getInputStream() method has already been called for this request"); - } - if (this.reader != null) return this.reader; - - if (this.content != null) { - InputStream sourceStream = new ByteArrayInputStream(this.content); - Reader sourceReader = (this.characterEncoding != null) ? new InputStreamReader(sourceStream, - this.characterEncoding) : new InputStreamReader(sourceStream); - return this.reader = new BufferedReader(sourceReader); - } - else { - return null; - } - } - - public void setRemoteAddr(String remoteAddr) { - this.remoteAddr = remoteAddr; - } - - @Override - public String getRemoteAddr() { - return this.remoteAddr; - } - - public void setRemoteHost(String remoteHost) { - this.remoteHost = remoteHost; - } - - @Override - public String getRemoteHost() { - return this.remoteHost; - } - - @Override - public void setAttribute(String name, Object value) { - checkActive(); - if (value != null) { - this.attributes.put(name, value); - } - else { - this.attributes.remove(name); - } - } - - @Override - public void removeAttribute(String name) { - checkActive(); - this.attributes.remove(name); - } - - /** - * Clear all of this request's attributes. - */ - public void clearAttributes() { - this.attributes.clear(); - } - - /** - * Add a new preferred locale, before any existing locales. - */ - public void addPreferredLocale(Locale locale) { - this.locales.add(0, locale); - } - - @Override - public Locale getLocale() { - return this.locales.get(0); - } - - @Override - public Enumeration getLocales() { - return Collections.enumeration(this.locales); - } - - public void setSecure(boolean secure) { - this.secure = secure; - } - - @Override - public boolean isSecure() { - return this.secure; - } - - @Override - public RequestDispatcher getRequestDispatcher(String path) { - return new MockRequestDispatcher(path); - } - - @Override @Deprecated - public String getRealPath(String path) { - return this.servletContext.getRealPath(path); - } - - public void setRemotePort(int remotePort) { - this.remotePort = remotePort; - } - - @Override - public int getRemotePort() { - return this.remotePort; - } - - public void setLocalName(String localName) { - this.localName = localName; - } - - @Override - public String getLocalName() { - return this.localName; - } - - public void setLocalAddr(String localAddr) { - this.localAddr = localAddr; - } - - @Override - public String getLocalAddr() { - return this.localAddr; - } - - public void setLocalPort(int localPort) { - this.localPort = localPort; - } - - @Override - public int getLocalPort() { - return this.localPort; - } - - - // --------------------------------------------------------------------- - // HttpServletRequest interface - // --------------------------------------------------------------------- - - public void setAuthType(String authType) { - this.authType = authType; - } - - @Override - public String getAuthType() { - return this.authType; - } - - /** - * Return the set of Cookies received with this Request. - */ - @Override - public Cookie[] getCookies() { - return cookies; - } - - /** - * Set the set of cookies received with this Request. - */ - public void setCookies(Cookie... cookies) { - this.cookies = cookies; - } - - /** - * Add a header entry for the given name. - *

If there was no entry for that header name before, the value will be used - * as-is. In case of an existing entry, a String array will be created, - * adding the given value (more specifically, its toString representation) - * as further element. - *

Multiple values can only be stored as list of Strings, following the - * Servlet spec (see getHeaders accessor). As alternative to - * repeated addHeader calls for individual elements, you can - * use a single call with an entire array or Collection of values as - * parameter. - * @see #getHeaderNames - * @see #getHeader - * @see #getHeaders - * @see #getDateHeader - * @see #getIntHeader - */ - @SuppressWarnings("rawtypes") - public void addHeader(String name, Object value) { - HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); - if (header == null) { - header = new HeaderValueHolder(); - this.headers.put(name, header); - } - if (value instanceof Collection) { - header.addValues((Collection) value); - } - else if (value.getClass().isArray()) { - header.addValueArray(value); - } - else { - header.addValue(value); - } - } - - @Override - public long getDateHeader(String name) { - HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); - Object value = (header != null ? header.getValue() : null); - if (value instanceof Date) { - return ((Date) value).getTime(); - } - else if (value instanceof Number) { - return ((Number) value).longValue(); - } - else if (value != null) { - throw new IllegalArgumentException("Value for header '" + name + "' is neither a Date nor a Number: " - + value); - } - else { - return -1L; - } - } - - @Override - public int getIntHeader(String name) { - HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); - Object value = (header != null ? header.getValue() : null); - if (value instanceof Number) { - return ((Number) value).intValue(); - } - else if (value instanceof String) { - return Integer.parseInt((String) value); - } - else if (value != null) { - throw new NumberFormatException("Value for header '" + name + "' is not a Number: " + value); - } - else { - return -1; - } - } - - @Override - public String getHeader(String name) { - HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); - return (header != null ? header.getStringValue() : null); - } - - @Override - public Enumeration getHeaders(String name) { - HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); - return Collections.enumeration(header != null ? header.getStringValues() : new LinkedList()); - } - - @Override - public Enumeration getHeaderNames() { - return Collections.enumeration(this.headers.keySet()); - } - - public void setMethod(String method) { - this.method = method; - } - - @Override - public String getMethod() { - return this.method; - } - - public void setPathInfo(String pathInfo) { - this.pathInfo = pathInfo; - } - - @Override - public String getPathInfo() { - return this.pathInfo; - } - - @Override - public String getPathTranslated() { - return (this.pathInfo != null ? getRealPath(this.pathInfo) : null); - } - - public void setContextPath(String contextPath) { - this.contextPath = contextPath; - } - - @Override - public String getContextPath() { - return this.contextPath; - } - - public void setQueryString(String queryString) { - this.queryString = queryString; - } - - @Override - public String getQueryString() { - return this.queryString; - } - - public void setRemoteUser(String remoteUser) { - this.remoteUser = remoteUser; - } - - @Override - public String getRemoteUser() { - return this.remoteUser; - } - - public void addUserRole(String role) { - this.userRoles.add(role); - } - - @Override - public boolean isUserInRole(String role) { - return this.userRoles.contains(role); - } - - public void setUserPrincipal(Principal userPrincipal) { - this.userPrincipal = userPrincipal; - } - - @Override - public Principal getUserPrincipal() { - return this.userPrincipal; - } - - public void setRequestedSessionId(String requestedSessionId) { - this.requestedSessionId = requestedSessionId; - } - - @Override - public String getRequestedSessionId() { - return this.requestedSessionId; - } - - public void setRequestURI(String requestURI) { - this.requestURI = requestURI; - } - - @Override - public String getRequestURI() { - return this.requestURI; - } - - @Override - public StringBuffer getRequestURL() { - StringBuffer url = new StringBuffer(this.scheme); - url.append("://").append(this.serverName).append(':').append(this.serverPort); - url.append(getRequestURI()); - return url; - } - - public void setServletPath(String servletPath) { - this.servletPath = servletPath; - } - - @Override - public String getServletPath() { - return this.servletPath; - } - - public void setSession(HttpSession session) { - this.session = session; - if (session instanceof MockHttpSession) { - MockHttpSession mockSession = ((MockHttpSession) session); - mockSession.access(); - } - } - - @Override - public HttpSession getSession(boolean create) { - checkActive(); - // Reset session if invalidated. - if (this.session instanceof MockHttpSession && ((MockHttpSession) this.session).isInvalid()) { - this.session = null; - } - // Create new session if necessary. - if (this.session == null && create) { - this.session = new MockHttpSession(this.servletContext); - } - return this.session; - } - - @Override - public HttpSession getSession() { - return getSession(true); - } - - public void setRequestedSessionIdValid(boolean requestedSessionIdValid) { - this.requestedSessionIdValid = requestedSessionIdValid; - } - - @Override - public boolean isRequestedSessionIdValid() { - return this.requestedSessionIdValid; - } - - public void setRequestedSessionIdFromCookie(boolean requestedSessionIdFromCookie) { - this.requestedSessionIdFromCookie = requestedSessionIdFromCookie; - } - - @Override - public boolean isRequestedSessionIdFromCookie() { - return this.requestedSessionIdFromCookie; - } - - public void setRequestedSessionIdFromURL(boolean requestedSessionIdFromURL) { - this.requestedSessionIdFromURL = requestedSessionIdFromURL; - } - - @Override - public boolean isRequestedSessionIdFromURL() { - return this.requestedSessionIdFromURL; - } - - @Override @Deprecated - public boolean isRequestedSessionIdFromUrl() { - return isRequestedSessionIdFromURL(); - } - - @Override - public boolean authenticate(HttpServletResponse response) throws IOException, ServletException { - throw new UnsupportedOperationException(); - } - - @Override - public void login(String username, String password) throws ServletException { - throw new UnsupportedOperationException(); - } - - @Override - public void logout() throws ServletException { - this.userPrincipal = null; - this.remoteUser = null; - this.authType = null; - } - - public void addPart(Part part) { - this.parts.put(part.getName(), part); - } - - @Override - public Part getPart(String name) throws IOException, IllegalStateException, ServletException { - return this.parts.get(name); - } - - @Override - public Collection getParts() throws IOException, IllegalStateException, ServletException { - return this.parts.values(); - } - - @Override - public AsyncContext startAsync() { - return startAsync(this, null); - } - - @Override - public AsyncContext startAsync(ServletRequest request, ServletResponse response) { - if (!this.asyncSupported) { - throw new IllegalStateException("Async not supported"); - } - this.asyncStarted = true; - this.asyncContext = new MockAsyncContext(request, response); - return this.asyncContext; - } - - public void setAsyncStarted(boolean asyncStarted) { - this.asyncStarted = asyncStarted; - } - - @Override - public boolean isAsyncStarted() { - return this.asyncStarted; - } - - public void setAsyncSupported(boolean asyncSupported) { - this.asyncSupported = asyncSupported; - } - - @Override - public boolean isAsyncSupported() { - return this.asyncSupported; - } - - public void setAsyncContext(MockAsyncContext asyncContext) { - this.asyncContext = asyncContext; - } - - @Override - public AsyncContext getAsyncContext() { - return this.asyncContext; - } - - public void setDispatcherType(DispatcherType dispatcherType) { - this.dispatcherType = dispatcherType; - } - - @Override - public DispatcherType getDispatcherType() { - return this.dispatcherType; - } - -} diff --git a/src/spec/java/org/jruby/rack/mock/MockHttpServletResponse.java b/src/spec/java/org/jruby/rack/mock/MockHttpServletResponse.java deleted file mode 100644 index 286a7fc0..00000000 --- a/src/spec/java/org/jruby/rack/mock/MockHttpServletResponse.java +++ /dev/null @@ -1,555 +0,0 @@ -/* - * Copyright (c) 2010-2012 Engine Yard, Inc. - * Copyright (c) 2007-2009 Sun Microsystems, Inc. - * This source code is available under the MIT license. - * See the file LICENSE.txt for details. - * - * Licensed 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. - */ - -package org.jruby.rack.mock; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.io.UnsupportedEncodingException; -import java.io.Writer; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletResponse; - -/** - * Mock implementation of the {@link javax.servlet.http.HttpServletResponse} interface. - * - *

Compatible with Servlet 2.5 as well as Servlet 3.0. - * - * @author Juergen Hoeller - * @author Rod Johnson - */ -public class MockHttpServletResponse implements HttpServletResponse { - - private static final String CHARSET_PREFIX = "charset="; - - - //--------------------------------------------------------------------- - // ServletResponse properties - //--------------------------------------------------------------------- - - private boolean outputStreamAccessAllowed = true; - - private boolean writerAccessAllowed = true; - - private String characterEncoding = "ISO-8859-1"; - - private final ByteArrayOutputStream content = new ByteArrayOutputStream(); - - private final ServletOutputStream outputStream = new ResponseServletOutputStream(this.content); - - private PrintWriter writer; - - private int contentLength = 0; - - private String contentType; - - private int bufferSize = 4096; - - private boolean committed; - - private Locale locale = Locale.getDefault(); - - - //--------------------------------------------------------------------- - // HttpServletResponse properties - //--------------------------------------------------------------------- - - private final List cookies = new ArrayList(); - - private final Map headers = new LinkedCaseInsensitiveMap(); - - private int status = HttpServletResponse.SC_OK; - - private String errorMessage; - - private String redirectedUrl; - - private String forwardedUrl; - - private final List includedUrls = new ArrayList(); - - - //--------------------------------------------------------------------- - // ServletResponse interface - //--------------------------------------------------------------------- - - /** - * Set whether {@link #getOutputStream()} access is allowed. - *

Default is true. - */ - public void setOutputStreamAccessAllowed(boolean outputStreamAccessAllowed) { - this.outputStreamAccessAllowed = outputStreamAccessAllowed; - } - - /** - * Return whether {@link #getOutputStream()} access is allowed. - */ - public boolean isOutputStreamAccessAllowed() { - return this.outputStreamAccessAllowed; - } - - /** - * Set whether {@link #getWriter()} access is allowed. - *

Default is true. - */ - public void setWriterAccessAllowed(boolean writerAccessAllowed) { - this.writerAccessAllowed = writerAccessAllowed; - } - - /** - * Return whether {@link #getOutputStream()} access is allowed. - */ - public boolean isWriterAccessAllowed() { - return this.writerAccessAllowed; - } - - public void setCharacterEncoding(String characterEncoding) { - this.characterEncoding = characterEncoding; - } - - public String getCharacterEncoding() { - return this.characterEncoding; - } - - public ServletOutputStream getOutputStream() { - if (!this.outputStreamAccessAllowed) { - throw new IllegalStateException("OutputStream access not allowed"); - } - return this.outputStream; - } - - public PrintWriter getWriter() throws UnsupportedEncodingException { - if (!this.writerAccessAllowed) { - throw new IllegalStateException("Writer access not allowed"); - } - if (this.writer == null) { - Writer targetWriter = (this.characterEncoding != null ? - new OutputStreamWriter(this.content, this.characterEncoding) : new OutputStreamWriter(this.content)); - this.writer = new ResponsePrintWriter(targetWriter); - } - return this.writer; - } - - public byte[] getContentAsByteArray() { - flushBuffer(); - return this.content.toByteArray(); - } - - public String getContentAsString() throws UnsupportedEncodingException { - flushBuffer(); - return (this.characterEncoding != null) ? - this.content.toString(this.characterEncoding) : this.content.toString(); - } - - public void setContentLength(int contentLength) { - this.contentLength = contentLength; - } - - public int getContentLength() { - return this.contentLength; - } - - public void setContentType(String contentType) { - this.contentType = contentType; - if (contentType != null) { - int charsetIndex = contentType.toLowerCase().indexOf(CHARSET_PREFIX); - if (charsetIndex != -1) { - String encoding = contentType.substring(charsetIndex + CHARSET_PREFIX.length()); - setCharacterEncoding(encoding); - } - } - } - - public String getContentType() { - return this.contentType; - } - - public void setBufferSize(int bufferSize) { - this.bufferSize = bufferSize; - } - - public int getBufferSize() { - return this.bufferSize; - } - - public void flushBuffer() { - setCommitted(true); - } - - public void resetBuffer() { - if (isCommitted()) { - throw new IllegalStateException("Cannot reset buffer - response is already committed"); - } - this.content.reset(); - } - - private void setCommittedIfBufferSizeExceeded() { - int bufSize = getBufferSize(); - if (bufSize > 0 && this.content.size() > bufSize) { - setCommitted(true); - } - } - - public void setCommitted(boolean committed) { - this.committed = committed; - } - - public boolean isCommitted() { - return this.committed; - } - - public void reset() { - resetBuffer(); - this.characterEncoding = null; - this.contentLength = 0; - this.contentType = null; - this.locale = null; - this.cookies.clear(); - this.headers.clear(); - this.status = HttpServletResponse.SC_OK; - this.errorMessage = null; - } - - public void setLocale(Locale locale) { - this.locale = locale; - } - - public Locale getLocale() { - return this.locale; - } - - - //--------------------------------------------------------------------- - // HttpServletResponse interface - //--------------------------------------------------------------------- - - public void addCookie(Cookie cookie) { - this.cookies.add(cookie); - } - - public Cookie[] getCookies() { - return this.cookies.toArray(new Cookie[this.cookies.size()]); - } - - public Cookie getCookie(String name) { - for (Cookie cookie : this.cookies) { - if (name.equals(cookie.getName())) { - return cookie; - } - } - return null; - } - - public boolean containsHeader(String name) { - return (HeaderValueHolder.getByName(this.headers, name) != null); - } - - /** - * Return the names of all specified headers as a Set of Strings. - *

As of Servlet 3.0, this method is also defined HttpServletResponse. - * @return the Set of header name Strings, or an empty Set if none - */ - public Set getHeaderNames() { - return this.headers.keySet(); - } - - /** - * Return the primary value for the given header as a String, if any. - * Will return the first value in case of multiple values. - *

As of Servlet 3.0, this method is also defined HttpServletResponse. - * As of Spring 3.1, it returns a stringified value for Servlet 3.0 compatibility. - * Consider using {@link #getHeaderValue(String)} for raw Object access. - * @param name the name of the header - * @return the associated header value, or null if none - */ - public String getHeader(String name) { - HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); - return (header != null ? header.getStringValue() : null); - } - - /** - * Return all values for the given header as a List of Strings. - *

As of Servlet 3.0, this method is also defined HttpServletResponse. - * As of Spring 3.1, it returns a List of stringified values for Servlet 3.0 compatibility. - * Consider using {@link #getHeaderValues(String)} for raw Object access. - * @param name the name of the header - * @return the associated header values, or an empty List if none - */ - public List getHeaders(String name) { - HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); - if (header != null) { - return header.getStringValues(); - } - else { - return Collections.emptyList(); - } - } - - /** - * Return the primary value for the given header, if any. - *

Will return the first value in case of multiple values. - * @param name the name of the header - * @return the associated header value, or null if none - */ - public Object getHeaderValue(String name) { - HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); - return (header != null ? header.getValue() : null); - } - - /** - * Return all values for the given header as a List of value objects. - * @param name the name of the header - * @return the associated header values, or an empty List if none - */ - public List getHeaderValues(String name) { - HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); - if (header != null) { - return header.getValues(); - } - else { - return Collections.emptyList(); - } - } - - /** - * The default implementation returns the given URL String as-is. - *

Can be overridden in subclasses, appending a session id or the like. - */ - public String encodeURL(String url) { - return url; - } - - /** - * The default implementation delegates to {@link #encodeURL}, - * returning the given URL String as-is. - *

Can be overridden in subclasses, appending a session id or the like - * in a redirect-specific fashion. For general URL encoding rules, - * override the common {@link #encodeURL} method instead, appyling - * to redirect URLs as well as to general URLs. - */ - public String encodeRedirectURL(String url) { - return encodeURL(url); - } - - public String encodeUrl(String url) { - return encodeURL(url); - } - - public String encodeRedirectUrl(String url) { - return encodeRedirectURL(url); - } - - public void sendError(int status, String errorMessage) throws IOException { - if (isCommitted()) { - throw new IllegalStateException("Cannot set error status - response is already committed"); - } - this.status = status; - this.errorMessage = errorMessage; - setCommitted(true); - } - - public void sendError(int status) throws IOException { - if (isCommitted()) { - throw new IllegalStateException("Cannot set error status - response is already committed"); - } - this.status = status; - setCommitted(true); - } - - public void sendRedirect(String url) throws IOException { - if (isCommitted()) { - throw new IllegalStateException("Cannot send redirect - response is already committed"); - } - this.redirectedUrl = url; - setCommitted(true); - } - - public String getRedirectedUrl() { - return this.redirectedUrl; - } - - public void setDateHeader(String name, long value) { - setHeaderValue(name, value); - } - - public void addDateHeader(String name, long value) { - addHeaderValue(name, value); - } - - public void setHeader(String name, String value) { - setHeaderValue(name, value); - } - - public void addHeader(String name, String value) { - addHeaderValue(name, value); - } - - public void setIntHeader(String name, int value) { - setHeaderValue(name, value); - } - - public void addIntHeader(String name, int value) { - addHeaderValue(name, value); - } - - private void setHeaderValue(String name, Object value) { - doAddHeaderValue(name, value, true); - } - - private void addHeaderValue(String name, Object value) { - doAddHeaderValue(name, value, false); - } - - private void doAddHeaderValue(String name, Object value, boolean replace) { - HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name); - if (header == null) { - header = new HeaderValueHolder(); - this.headers.put(name, header); - } - if (replace) { - header.setValue(value); - } - else { - header.addValue(value); - } - } - - public void setStatus(int status) { - this.status = status; - } - - public void setStatus(int status, String errorMessage) { - this.status = status; - this.errorMessage = errorMessage; - } - - public int getStatus() { - return this.status; - } - - public String getErrorMessage() { - return this.errorMessage; - } - - - //--------------------------------------------------------------------- - // Methods for MockRequestDispatcher - //--------------------------------------------------------------------- - - public void setForwardedUrl(String forwardedUrl) { - this.forwardedUrl = forwardedUrl; - } - - public String getForwardedUrl() { - return this.forwardedUrl; - } - - public void setIncludedUrl(String includedUrl) { - this.includedUrls.clear(); - if (includedUrl != null) { - this.includedUrls.add(includedUrl); - } - } - - public String getIncludedUrl() { - int count = this.includedUrls.size(); - if (count > 1) { - throw new IllegalStateException( - "More than 1 URL included - check getIncludedUrls instead: " + this.includedUrls); - } - return (count == 1 ? this.includedUrls.get(0) : null); - } - - public void addIncludedUrl(String includedUrl) { - this.includedUrls.add(includedUrl); - } - - public List getIncludedUrls() { - return this.includedUrls; - } - - - /** - * Inner class that adapts the ServletOutputStream to mark the - * response as committed once the buffer size is exceeded. - */ - private class ResponseServletOutputStream extends DelegatingServletOutputStream { - - public ResponseServletOutputStream(OutputStream out) { - super(out); - } - - public void write(int b) throws IOException { - super.write(b); - super.flush(); - setCommittedIfBufferSizeExceeded(); - } - - public void flush() throws IOException { - super.flush(); - setCommitted(true); - } - } - - - /** - * Inner class that adapts the PrintWriter to mark the - * response as committed once the buffer size is exceeded. - */ - private class ResponsePrintWriter extends PrintWriter { - - public ResponsePrintWriter(Writer out) { - super(out, true); - } - - public void write(char buf[], int off, int len) { - super.write(buf, off, len); - super.flush(); - setCommittedIfBufferSizeExceeded(); - } - - public void write(String s, int off, int len) { - super.write(s, off, len); - super.flush(); - setCommittedIfBufferSizeExceeded(); - } - - public void write(int c) { - super.write(c); - super.flush(); - setCommittedIfBufferSizeExceeded(); - } - - public void flush() { - super.flush(); - setCommitted(true); - } - } - -} diff --git a/src/spec/java/org/jruby/rack/mock/MockHttpSession.java b/src/spec/java/org/jruby/rack/mock/MockHttpSession.java deleted file mode 100644 index 7275bf90..00000000 --- a/src/spec/java/org/jruby/rack/mock/MockHttpSession.java +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Copyright (c) 2010-2012 Engine Yard, Inc. - * Copyright (c) 2007-2009 Sun Microsystems, Inc. - * This source code is available under the MIT license. - * See the file LICENSE.txt for details. - * - * Licensed 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. - */ - -package org.jruby.rack.mock; - -import java.io.Serializable; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Vector; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpSession; -import javax.servlet.http.HttpSessionBindingEvent; -import javax.servlet.http.HttpSessionBindingListener; -import javax.servlet.http.HttpSessionContext; - -/** - * Mock implementation of the {@link javax.servlet.http.HttpSession} interface. - * - *

Compatible with Servlet 2.5 as well as Servlet 3.0. - * - * @author Juergen Hoeller - * @author Rod Johnson - * @author Mark Fisher - */ -@SuppressWarnings("deprecation") -public class MockHttpSession implements HttpSession { - - private static int nextId = 1; - - private String id; - - private final long creationTime = System.currentTimeMillis(); - - private int maxInactiveInterval; - - private long lastAccessedTime = System.currentTimeMillis(); - - private final ServletContext servletContext; - - private final Map attributes = new LinkedHashMap(); - - private boolean invalid = false; - - private boolean isNew = true; - - - /** - * Create a new MockHttpSession with a default {@link MockServletContext}. - * - * @see MockServletContext - */ - public MockHttpSession() { - this(null); - } - - /** - * Create a new MockHttpSession. - * - * @param servletContext the ServletContext that the session runs in - */ - public MockHttpSession(ServletContext servletContext) { - this(servletContext, null); - } - - /** - * Create a new MockHttpSession. - * - * @param servletContext the ServletContext that the session runs in - * @param id a unique identifier for this session - */ - public MockHttpSession(ServletContext servletContext, String id) { - this.servletContext = servletContext; - this.id = (id != null ? id : Integer.toString(nextId++)); - } - - public long getCreationTime() throws IllegalStateException { - checkInvalid("getCreationTime()"); - return this.creationTime; - } - - public String getId() { - return this.id; - } - - public void setId(String id) { - this.id = id; - } - - public void access() { - this.lastAccessedTime = System.currentTimeMillis(); - this.isNew = false; - } - - public long getLastAccessedTime() throws IllegalStateException { - checkInvalid("getLastAccessedTime()"); - return this.lastAccessedTime; - } - - public ServletContext getServletContext() { - return this.servletContext; - } - - public void setMaxInactiveInterval(int interval) { - this.maxInactiveInterval = interval; - } - - public int getMaxInactiveInterval() { - return this.maxInactiveInterval; - } - - public HttpSessionContext getSessionContext() { - throw new UnsupportedOperationException("getSessionContext"); - } - - public Object getAttribute(String name) throws IllegalStateException { - checkInvalid("getAttribute("+ name +")"); - return this.attributes.get(name); - } - - public Object getValue(String name) { - return getAttribute(name); - } - - public Enumeration getAttributeNames() throws IllegalStateException { - checkInvalid("getAttributeNames()"); - return new Vector(this.attributes.keySet()).elements(); - } - - public String[] getValueNames() throws IllegalStateException { - checkInvalid("getValueNames()"); - return this.attributes.keySet().toArray(new String[this.attributes.size()]); - } - - public void setAttribute(String name, Object value) throws IllegalStateException { - checkInvalid("setAttribute("+ name + ")"); - if (value != null) { - this.attributes.put(name, value); - if (value instanceof HttpSessionBindingListener) { - ((HttpSessionBindingListener) value).valueBound(new HttpSessionBindingEvent(this, name, value)); - } - } - else { - removeAttribute(name); - } - } - - public void putValue(String name, Object value) { - setAttribute(name, value); - } - - public void removeAttribute(String name) throws IllegalStateException { - checkInvalid("removeAttribute("+ name + ")"); - Object value = this.attributes.remove(name); - if (value instanceof HttpSessionBindingListener) { - ((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value)); - } - } - - public void removeValue(String name) { - removeAttribute(name); - } - - /** - * Clear all of this session's attributes. - */ - public void clearAttributes() { - for (Iterator> it = this.attributes.entrySet().iterator(); it.hasNext();) { - Map.Entry entry = it.next(); - String name = entry.getKey(); - Object value = entry.getValue(); - it.remove(); - if (value instanceof HttpSessionBindingListener) { - ((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value)); - } - } - } - - public void invalidate() throws IllegalStateException { - checkInvalid("invalidate()"); - this.invalid = true; - clearAttributes(); - } - - public boolean isInvalid() { - return this.invalid; - } - - public void setNew(boolean value) { - this.isNew = value; - } - - public boolean isNew() throws IllegalStateException { - checkInvalid("isNew()"); - return this.isNew; - } - - /** - * Serialize the attributes of this session into an object that can be - * turned into a byte array with standard Java serialization. - * - * @return a representation of this session's serialized state - */ - public Serializable serializeState() { - HashMap state = new HashMap(); - for (Iterator> it = this.attributes.entrySet().iterator(); it.hasNext();) { - Map.Entry entry = it.next(); - String name = entry.getKey(); - Object value = entry.getValue(); - it.remove(); - if (value instanceof Serializable) { - state.put(name, (Serializable) value); - } - else { - // Not serializable... Servlet containers usually automatically - // unbind the attribute in this case. - if (value instanceof HttpSessionBindingListener) { - ((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value)); - } - } - } - return state; - } - - /** - * Deserialize the attributes of this session from a state object created by - * {@link #serializeState()}. - * - * @param state a representation of this session's serialized state - */ - @SuppressWarnings("unchecked") - public void deserializeState(Serializable state) { - this.attributes.putAll((Map) state); - } - - @Override - public String toString() { - return getClass().getName() + "@" + Integer.toHexString(hashCode()) + this.attributes; - } - - public Map getAttributes() { - return attributes; - } - - private void checkInvalid(String method) throws IllegalStateException { - if ( invalid == true ) { - if ( method == null ) method = ""; - throw new IllegalStateException(method + ": session already invalidated"); - } - } - -} diff --git a/src/spec/java/org/jruby/rack/mock/MockRequestDispatcher.java b/src/spec/java/org/jruby/rack/mock/MockRequestDispatcher.java deleted file mode 100644 index 3a1c79dd..00000000 --- a/src/spec/java/org/jruby/rack/mock/MockRequestDispatcher.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2010-2012 Engine Yard, Inc. - * Copyright (c) 2007-2009 Sun Microsystems, Inc. - * This source code is available under the MIT license. - * See the file LICENSE.txt for details. - * - * Licensed 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. - */ - -package org.jruby.rack.mock; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletResponseWrapper; - -/** - * Mock implementation of the {@link javax.servlet.RequestDispatcher} interface. - * - *

Used for testing the web framework; typically not necessary for - * testing application controllers. - * - * @author Rod Johnson - * @author Juergen Hoeller - */ -public class MockRequestDispatcher implements RequestDispatcher { - - private final String url; - - - /** - * Create a new MockRequestDispatcher for the given URL. - * @param url the URL to dispatch to. - */ - public MockRequestDispatcher(String url) { - this.url = url; - } - - - public void forward(ServletRequest request, ServletResponse response) { - if (response.isCommitted()) { - throw new IllegalStateException("Cannot perform forward - response is already committed"); - } - getMockHttpServletResponse(response).setForwardedUrl(this.url); - } - - public void include(ServletRequest request, ServletResponse response) { - getMockHttpServletResponse(response).addIncludedUrl(this.url); - } - - /** - * Obtain the underlying MockHttpServletResponse, - * unwrapping {@link HttpServletResponseWrapper} decorators if necessary. - */ - protected MockHttpServletResponse getMockHttpServletResponse(ServletResponse response) { - if (response instanceof MockHttpServletResponse) { - return (MockHttpServletResponse) response; - } - if (response instanceof HttpServletResponseWrapper) { - return getMockHttpServletResponse(((HttpServletResponseWrapper) response).getResponse()); - } - throw new IllegalArgumentException("MockRequestDispatcher requires MockHttpServletResponse"); - } - -} diff --git a/src/spec/java/org/jruby/rack/mock/MockServletConfig.java b/src/spec/java/org/jruby/rack/mock/MockServletConfig.java deleted file mode 100644 index 3dc31489..00000000 --- a/src/spec/java/org/jruby/rack/mock/MockServletConfig.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2002-2009 the original author or authors. - * - * Licensed 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. - */ - -package org.jruby.rack.mock; - -import java.util.Collections; -import java.util.Enumeration; -import java.util.LinkedHashMap; -import java.util.Map; -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; - -/** - * Mock implementation of the {@link javax.servlet.ServletConfig} interface. - * - *

Used for testing the web framework; typically not necessary for - * testing application controllers. - * - * @author Rod Johnson - * @author Juergen Hoeller - * @since 1.0.2 - */ -public class MockServletConfig implements ServletConfig { - - private final ServletContext servletContext; - - private final String servletName; - - private final Map initParameters = new LinkedHashMap(); - - - /** - * Create a new MockServletConfig with a default {@link MockServletContext}. - */ - public MockServletConfig() { - this(null, ""); - } - - /** - * Create a new MockServletConfig with a default {@link MockServletContext}. - * @param servletName the name of the servlet - */ - public MockServletConfig(String servletName) { - this(null, servletName); - } - - /** - * Create a new MockServletConfig. - * @param servletContext the ServletContext that the servlet runs in - */ - public MockServletConfig(ServletContext servletContext) { - this(servletContext, ""); - } - - /** - * Create a new MockServletConfig. - * @param servletContext the ServletContext that the servlet runs in - * @param servletName the name of the servlet - */ - public MockServletConfig(ServletContext servletContext, String servletName) { - this.servletContext = (servletContext != null ? servletContext : new MockServletContext()); - this.servletName = servletName; - } - - - public String getServletName() { - return this.servletName; - } - - public ServletContext getServletContext() { - return this.servletContext; - } - - public void addInitParameter(String name, String value) { - if (name == null) { - throw new IllegalArgumentException("parameter name must not be null"); - } - this.initParameters.put(name, value); - } - - public String getInitParameter(String name) { - if (name == null) { - throw new IllegalArgumentException("parameter name must not be null"); - } - return this.initParameters.get(name); - } - - public Enumeration getInitParameterNames() { - return Collections.enumeration(this.initParameters.keySet()); - } - -} diff --git a/src/spec/java/org/jruby/rack/mock/MockServletContext.java b/src/spec/java/org/jruby/rack/mock/MockServletContext.java deleted file mode 100644 index 79c54da0..00000000 --- a/src/spec/java/org/jruby/rack/mock/MockServletContext.java +++ /dev/null @@ -1,633 +0,0 @@ -/* - * Copyright 2002-2013 the original author or authors. - * - * Licensed 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. - */ - -package org.jruby.rack.mock; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Collections; -import java.util.EnumSet; -import java.util.Enumeration; -import java.util.EventListener; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.Map; -import java.util.Set; -import javax.servlet.Filter; -import javax.servlet.FilterRegistration; -import javax.servlet.RequestDispatcher; -import javax.servlet.Servlet; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRegistration; -import javax.servlet.SessionCookieConfig; -import javax.servlet.SessionTrackingMode; -import javax.servlet.descriptor.JspConfigDescriptor; - -import org.springframework.core.io.DefaultResourceLoader; -import org.springframework.core.io.Resource; -import org.springframework.core.io.ResourceLoader; - -import org.jruby.rack.RackLogger; -import static org.jruby.rack.RackLogger.*; - -/** - * Mock implementation of the {@link javax.servlet.ServletContext} interface. - * - *

As of Spring 4.0, this set of mocks is designed on a Servlet 3.0 baseline. - * - *

Compatible with Servlet 3.0 but can be configured to expose a specific version - * through {@link #setMajorVersion}/{@link #setMinorVersion}; default is 3.0. - * Note that Servlet 3.0 support is limited: servlet, filter and listener - * registration methods are not supported; neither is JSP configuration. - * We generally do not recommend to unit-test your ServletContainerInitializers and - * WebApplicationInitializers which is where those registration methods would be used. - * - *

Used for testing the Spring web framework; only rarely necessary for testing - * application controllers. As long as application components don't explicitly - * access the {@code ServletContext}, {@code ClassPathXmlApplicationContext} or - * {@code FileSystemXmlApplicationContext} can be used to load the context files - * for testing, even for {@code DispatcherServlet} context definitions. - * - *

For setting up a full {@code WebApplicationContext} in a test environment, - * you can use {@code AnnotationConfigWebApplicationContext}, - * {@code XmlWebApplicationContext}, or {@code GenericWebApplicationContext}, - * passing in an appropriate {@code MockServletContext} instance. You might want - * to configure your {@code MockServletContext} with a {@code FileSystemResourceLoader} - * in that case to ensure that resource paths are interpreted as relative filesystem - * locations. - * - *

A common setup is to point your JVM working directory to the root of your - * web application directory, in combination with filesystem-based resource loading. - * This allows to load the context files as used in the web application, with - * relative paths getting interpreted correctly. Such a setup will work with both - * {@code FileSystemXmlApplicationContext} (which will load straight from the - * filesystem) and {@code XmlWebApplicationContext} with an underlying - * {@code MockServletContext} (as long as the {@code MockServletContext} has been - * configured with a {@code FileSystemResourceLoader}). - * - * @author Rod Johnson - * @author Juergen Hoeller - * @author Sam Brannen - */ -public class MockServletContext implements ServletContext { - - private static final String TEMP_DIR_SYSTEM_PROPERTY = "java.io.tmpdir"; - - private static final String TEMP_DIR_CONTEXT_ATTRIBUTE = "javax.servlet.context.tempdir"; - - private final ResourceLoader resourceLoader; - - private final String resourceBasePath; - - private String contextPath = ""; - - private int majorVersion = 3; - private int minorVersion = 0; - - private int effectiveMajorVersion = 3; - private int effectiveMinorVersion = 0; - - private final Map contexts = new HashMap(); - private final Map initParameters = new LinkedHashMap(); - private final Map attributes = new LinkedHashMap(); - - private String servletContextName = "MockServletContext"; - //private String defaultServletName = "default"; - - //final Map namedRequestDispatchers = new HashMap(); - - private final Set declaredRoles = new HashSet(); - - private Set sessionTrackingModes; - - private Object sessionCookieConfig; // SessionCookieConfig - - private RackLogger logger = new NullLogger(); - - /** - * Create a new MockServletContext, using no base path and a - * DefaultResourceLoader (i.e. the classpath root as WAR root). - * @see org.springframework.core.io.DefaultResourceLoader - */ - public MockServletContext() { - this("", null); - } - - /** - * Create a new MockServletContext, using a DefaultResourceLoader. - * @param resourceBasePath the WAR root directory (should not end with a slash) - * @see org.springframework.core.io.DefaultResourceLoader - */ - public MockServletContext(String resourceBasePath) { - this(resourceBasePath, null); - } - - /** - * Create a new MockServletContext, using the specified ResourceLoader - * and no base path. - * @param resourceLoader the ResourceLoader to use (or null for the default) - */ - MockServletContext(ResourceLoader resourceLoader) { - this("", resourceLoader); - } - - /** - * Create a new MockServletContext. - * @param resourceBasePath the WAR root directory (should not end with a slash) - * @param resourceLoader the ResourceLoader to use (or null for the default) - */ - MockServletContext(String resourceBasePath, ResourceLoader resourceLoader) { - this.resourceLoader = (resourceLoader != null ? resourceLoader : new DefaultResourceLoader()); - this.resourceBasePath = (resourceBasePath != null ? resourceBasePath : ""); - - // Use JVM temp dir as ServletContext temp dir. - String tempDir = System.getProperty(TEMP_DIR_SYSTEM_PROPERTY); - if (tempDir != null) { - this.attributes.put(TEMP_DIR_CONTEXT_ATTRIBUTE, new File(tempDir)); - } - } - - - /** - * Build a full resource location for the given path, - * prepending the resource base path of this MockServletContext. - * @param path the path as specified - * @return the full resource path - */ - protected String getResourceLocation(String path) { - if (!path.startsWith("/")) { - path = "/" + path; - } - return this.resourceBasePath + path; - } - - private static class NullLogger extends RackLogger.Base { - - @Override - public void log(String message) { /* NOOP */ } - - @Override - public void log(String message, Throwable ex) { /* NOOP */ } - - @Override - public boolean isEnabled(Level level) { return false; } - - @Override - public void log(Level level, String message) { /* NOOP */ } - - @Override - public void log(Level level, String message, Throwable ex) { /* NOOP */ } - - @Override - public Level getLevel() { return null; } - - } - - public void setContextPath(String contextPath) { - this.contextPath = (contextPath != null ? contextPath : ""); - } - - @Override // Servlet API 2.5 - public String getContextPath() { - return this.contextPath; - } - - public void registerContext(String contextPath, ServletContext context) { - this.contexts.put(contextPath, context); - } - - @Override - public ServletContext getContext(String contextPath) { - if (this.contextPath.equals(contextPath)) { - return this; - } - return this.contexts.get(contextPath); - } - - public void setMajorVersion(int majorVersion) { - this.majorVersion = majorVersion; - } - - @Override - public int getMajorVersion() { - return this.majorVersion; - } - - public void setMinorVersion(int minorVersion) { - this.minorVersion = minorVersion; - } - - @Override - public int getMinorVersion() { - return this.minorVersion; - } - - public void setEffectiveMajorVersion(int effectiveMajorVersion) { - this.effectiveMajorVersion = effectiveMajorVersion; - } - - @Override - - public int getEffectiveMajorVersion() { - return this.effectiveMajorVersion; - } - - public void setEffectiveMinorVersion(int effectiveMinorVersion) { - this.effectiveMinorVersion = effectiveMinorVersion; - } - - @Override - public int getEffectiveMinorVersion() { - return this.effectiveMinorVersion; - } - - @Override - public String getMimeType(String filePath) { - try { - Path path = Paths.get(filePath); - return Files.probeContentType(path); - } catch (IOException e) { - return "application/octet-stream"; // default MIME type - } - } - - @Override - public Set getResourcePaths(String path) { - String actualPath = (path.endsWith("/") ? path : path + "/"); - Resource resource = this.resourceLoader.getResource(getResourceLocation(actualPath)); - try { - File file = resource.getFile(); - String[] fileList = file.list(); - if (fileList == null || fileList.length == 0) { - return null; - } - Set resourcePaths = new LinkedHashSet(fileList.length); - for (String fileEntry : fileList) { - String resultPath = actualPath + fileEntry; - if (resource.createRelative(fileEntry).getFile().isDirectory()) { - resultPath += "/"; - } - resourcePaths.add(resultPath); - } - return resourcePaths; - } - catch (IOException ex) { - logger.log(WARN, "Couldn't get resource paths for " + resource, ex); - return null; - } - } - - @Override - public URL getResource(String path) throws MalformedURLException { - Resource resource = this.resourceLoader.getResource(getResourceLocation(path)); - if (!resource.exists()) { - return null; - } - try { - return resource.getURL(); - } - catch (MalformedURLException ex) { - throw ex; - } - catch (IOException ex) { - logger.log(WARN, "Couldn't get URL for " + resource, ex); - return null; - } - } - - @Override - public InputStream getResourceAsStream(String path) { - Resource resource = this.resourceLoader.getResource(getResourceLocation(path)); - if (!resource.exists()) { - return null; - } - try { - return resource.getInputStream(); - } - catch (IOException ex) { - logger.log(WARN, "Couldn't open InputStream for " + resource, ex); - return null; - } - } - - @Override - public RequestDispatcher getRequestDispatcher(String path) { - if (!path.startsWith("/")) { - throw new IllegalArgumentException("RequestDispatcher path at ServletContext level must start with '/'"); - } - return new MockRequestDispatcher(path); - } - - @Override - public RequestDispatcher getNamedDispatcher(String path) { - return null; - } - - @Override @SuppressWarnings("deprecation") - public Servlet getServlet(String name) { - return null; - } - - @Override - public Enumeration getServlets() { - return Collections.enumeration(new HashSet()); - } - - @Override @SuppressWarnings("deprecation") - public Enumeration getServletNames() { - return Collections.enumeration(new HashSet()); - } - - @Override - public void log(String message) { - logger.log(message); - } - - @Override @SuppressWarnings("deprecation") - public void log(Exception ex, String message) { - logger.log(message, ex); - } - - @Override - public void log(String message, Throwable ex) { - logger.log(message, ex); - } - - public RackLogger getLogger() { - return (logger instanceof NullLogger) ? null : logger; - } - - public void setLogger(RackLogger logger) { - this.logger = logger == null ? new NullLogger() : logger; - } - - @Override - public String getRealPath(String path) { - Resource resource = this.resourceLoader.getResource(getResourceLocation(path)); - try { - return resource.getFile().getAbsolutePath(); - } - catch (IOException ex) { - logger.log(WARN, "Couldn't determine real path of resource " + resource, ex); - return null; - } - } - - @Override - public String getServerInfo() { - return "MockServletContext"; - } - - @Override - public String getInitParameter(String name) { - if (name == null) { - throw new IllegalArgumentException("parameter name must not be null"); - } - return this.initParameters.get(name); - } - - public void addInitParameter(String name, String value) { - if (name == null) { - throw new IllegalArgumentException("parameter name must not be null"); - } - this.initParameters.put(name, value); - } - - @Override - public Enumeration getInitParameterNames() { - return Collections.enumeration(this.initParameters.keySet()); - } - - @Override - public Object getAttribute(String name) { - if (name == null) { - throw new IllegalArgumentException("attribute name must not be null"); - } - return this.attributes.get(name); - } - - @Override - public Enumeration getAttributeNames() { - return Collections.enumeration(this.attributes.keySet()); - } - - @Override - public void setAttribute(String name, Object value) { - if (name == null) { - throw new IllegalArgumentException("attribute name must not be null"); - } - if (value != null) { - this.attributes.put(name, value); - } - else { - this.attributes.remove(name); - } - } - - @Override - public void removeAttribute(String name) { - if (name == null) { - throw new IllegalArgumentException("attribute name must not be null"); - } - this.attributes.remove(name); - } - - public void setServletContextName(String servletContextName) { - this.servletContextName = servletContextName; - } - - @Override - public String getServletContextName() { - return this.servletContextName; - } - - //--------------------------------------------------------------------- - // Methods introduced in Servlet 3.0 - //--------------------------------------------------------------------- - - @Override - public ClassLoader getClassLoader() { - // return ClassUtils.getDefaultClassLoader(); - ClassLoader cl = null; - try { - cl = Thread.currentThread().getContextClassLoader(); - } - catch (Exception ex) { - // Cannot access thread context ClassLoader - falling back... - } - if (cl == null) { - // No thread context class loader -> use class loader of this class. - cl = MockServletContext.class.getClassLoader(); - if (cl == null) { - // getClassLoader() returning null indicates the bootstrap ClassLoader - try { - cl = ClassLoader.getSystemClassLoader(); - } - catch (Exception ex) { - // Cannot access system ClassLoader - oh well, maybe the caller can live with null... - } - } - } - return cl; - } - - @Override - public void declareRoles(String... roleNames) { - // Assert.notNull(roleNames, "Role names array must not be null"); - for (String roleName : roleNames) { - // Assert.hasLength(roleName, "Role name must not be empty"); - this.declaredRoles.add(roleName); - } - } - - public Set getDeclaredRoles() { - return Collections.unmodifiableSet(this.declaredRoles); - } - - @Override - public boolean setInitParameter(String name, String value) { - // Assert.notNull(name, "Parameter name must not be null"); - if (this.initParameters.containsKey(name)) { - return false; - } - this.initParameters.put(name, value); - return true; - } - - @Override - public void setSessionTrackingModes(Set sessionTrackingModes) - throws IllegalStateException, IllegalArgumentException { - this.sessionTrackingModes = sessionTrackingModes; - } - - @Override - public Set getDefaultSessionTrackingModes() { - return EnumSet.of(SessionTrackingMode.COOKIE, SessionTrackingMode.URL, SessionTrackingMode.SSL); - } - - @Override - public Set getEffectiveSessionTrackingModes() { - return (this.sessionTrackingModes != null ? - Collections.unmodifiableSet(this.sessionTrackingModes) : getDefaultSessionTrackingModes()); - } - - @Override - public SessionCookieConfig getSessionCookieConfig() { - if (sessionCookieConfig == null) { - sessionCookieConfig = new MockSessionCookieConfig(); - } - return (SessionCookieConfig) sessionCookieConfig; - } - - //--------------------------------------------------------------------- - // Unsupported Servlet 3.0 registration methods - //--------------------------------------------------------------------- - - @Override - public JspConfigDescriptor getJspConfigDescriptor() { - throw new UnsupportedOperationException(); - } - - @Override - public ServletRegistration.Dynamic addServlet(String servletName, String className) { - throw new UnsupportedOperationException(); - } - - @Override - public ServletRegistration.Dynamic addServlet(String servletName, Servlet servlet) { - throw new UnsupportedOperationException(); - } - - @Override - public ServletRegistration.Dynamic addServlet(String servletName, Class servletClass) { - throw new UnsupportedOperationException(); - } - - @Override - public T createServlet(Class c) throws ServletException { - throw new UnsupportedOperationException(); - } - - @Override - public ServletRegistration getServletRegistration(String servletName) { - throw new UnsupportedOperationException(); - } - - @Override - public Map getServletRegistrations() { - throw new UnsupportedOperationException(); - } - - @Override - public FilterRegistration.Dynamic addFilter(String filterName, String className) { - throw new UnsupportedOperationException(); - } - - @Override - public FilterRegistration.Dynamic addFilter(String filterName, Filter filter) { - throw new UnsupportedOperationException(); - } - - @Override - public FilterRegistration.Dynamic addFilter(String filterName, Class filterClass) { - throw new UnsupportedOperationException(); - } - - @Override - public T createFilter(Class c) throws ServletException { - throw new UnsupportedOperationException(); - } - - @Override - public FilterRegistration getFilterRegistration(String filterName) { - throw new UnsupportedOperationException(); - } - - @Override - public Map getFilterRegistrations() { - throw new UnsupportedOperationException(); - } - - @Override - public void addListener(Class listenerClass) { - throw new UnsupportedOperationException(); - } - - @Override - public void addListener(String className) { - throw new UnsupportedOperationException(); - } - - @Override - public void addListener(T t) { - throw new UnsupportedOperationException(); - } - - @Override - public T createListener(Class c) throws ServletException { - throw new UnsupportedOperationException(); - } - -} diff --git a/src/spec/java/org/jruby/rack/mock/MockSessionCookieConfig.java b/src/spec/java/org/jruby/rack/mock/MockSessionCookieConfig.java deleted file mode 100644 index 55e4fc0b..00000000 --- a/src/spec/java/org/jruby/rack/mock/MockSessionCookieConfig.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2002-2013 the original author or authors. - * - * Licensed 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. - */ -package org.jruby.rack.mock; - -import javax.servlet.SessionCookieConfig; - -/** - * Mock implementation of the {@link javax.servlet.SessionCookieConfig} interface. - * - * @author Juergen Hoeller - * @since 4.0 - * @see javax.servlet.ServletContext#getSessionCookieConfig() - */ -public class MockSessionCookieConfig implements SessionCookieConfig { - - private String name; - - private String domain; - - private String path; - - private String comment; - - private boolean httpOnly; - - private boolean secure; - - private int maxAge; - - - @Override - public void setName(String name) { - this.name = name; - } - - @Override - public String getName() { - return this.name; - } - - @Override - public void setDomain(String domain) { - this.domain = domain; - } - - @Override - public String getDomain() { - return this.domain; - } - - @Override - public void setPath(String path) { - this.path = path; - } - - @Override - public String getPath() { - return this.path; - } - - @Override - public void setComment(String comment) { - this.comment = comment; - } - - @Override - public String getComment() { - return this.comment; - } - - @Override - public void setHttpOnly(boolean httpOnly) { - this.httpOnly = httpOnly; - } - - @Override - public boolean isHttpOnly() { - return this.httpOnly; - } - - @Override - public void setSecure(boolean secure) { - this.secure = secure; - } - - @Override - public boolean isSecure() { - return this.secure; - } - - @Override - public void setMaxAge(int maxAge) { - this.maxAge = maxAge; - } - - @Override - public int getMaxAge() { - return this.maxAge; - } - -} - diff --git a/src/spec/java/org/jruby/rack/mock/RackLoggingMockServletContext.java b/src/spec/java/org/jruby/rack/mock/RackLoggingMockServletContext.java new file mode 100644 index 00000000..4e4d2438 --- /dev/null +++ b/src/spec/java/org/jruby/rack/mock/RackLoggingMockServletContext.java @@ -0,0 +1,80 @@ +/* + * Copyright 2002-2013 the original author or authors. + * + * Licensed 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. + */ + +package org.jruby.rack.mock; + +import org.jruby.rack.RackLogger; + +public class RackLoggingMockServletContext extends org.springframework.mock.web.MockServletContext { + private RackLogger logger = new NullLogger(); + + public RackLoggingMockServletContext() { + } + + public RackLoggingMockServletContext(String resourceBasePath) { + super(resourceBasePath); + } + + private static class NullLogger extends RackLogger.Base { + + @Override + public void log(String message) { /* NOOP */ } + + @Override + public void log(String message, Throwable ex) { /* NOOP */ } + + @Override + public boolean isEnabled(Level level) { + return false; + } + + @Override + public void log(Level level, String message) { /* NOOP */ } + + @Override + public void log(Level level, String message, Throwable ex) { /* NOOP */ } + + @Override + public Level getLevel() { + return null; + } + + } + + @Override + public void log(String message) { + logger.log(message); + } + + @Override + @SuppressWarnings("deprecation") + public void log(Exception ex, String message) { + logger.log(message, ex); + } + + @Override + public void log(String message, Throwable ex) { + logger.log(message, ex); + } + + public RackLogger getLogger() { + return (logger instanceof NullLogger) ? null : logger; + } + + public void setLogger(RackLogger logger) { + this.logger = logger == null ? new NullLogger() : logger; + } +} diff --git a/src/spec/java/org/jruby/rack/mock/WebUtils.java b/src/spec/java/org/jruby/rack/mock/WebUtils.java deleted file mode 100644 index cafd326e..00000000 --- a/src/spec/java/org/jruby/rack/mock/WebUtils.java +++ /dev/null @@ -1,738 +0,0 @@ -/* - * Copyright 2002-2014 the original author or authors. - * - * Licensed 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. - */ -package org.jruby.rack.mock; - -import java.io.File; -import java.io.FileNotFoundException; -import java.util.Enumeration; -import java.util.Map; -import java.util.StringTokenizer; -import java.util.TreeMap; -import javax.servlet.ServletContext; -import javax.servlet.ServletRequest; -import javax.servlet.ServletRequestWrapper; -import javax.servlet.ServletResponse; -import javax.servlet.ServletResponseWrapper; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.springframework.util.Assert; -import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; -import org.springframework.util.StringUtils; - -/** - * Miscellaneous utilities for web applications. - * Used by various framework classes. - * - * @author Rod Johnson - * @author Juergen Hoeller - */ -abstract class WebUtils { - - /** - * Standard Servlet 2.3+ spec request attributes for include URI and paths. - *

If included via a RequestDispatcher, the current resource will see the - * originating request. Its own URI and paths are exposed as request attributes. - */ - public static final String INCLUDE_REQUEST_URI_ATTRIBUTE = "javax.servlet.include.request_uri"; - public static final String INCLUDE_CONTEXT_PATH_ATTRIBUTE = "javax.servlet.include.context_path"; - public static final String INCLUDE_SERVLET_PATH_ATTRIBUTE = "javax.servlet.include.servlet_path"; - public static final String INCLUDE_PATH_INFO_ATTRIBUTE = "javax.servlet.include.path_info"; - public static final String INCLUDE_QUERY_STRING_ATTRIBUTE = "javax.servlet.include.query_string"; - - /** - * Standard Servlet 2.4+ spec request attributes for forward URI and paths. - *

If forwarded to via a RequestDispatcher, the current resource will see its - * own URI and paths. The originating URI and paths are exposed as request attributes. - */ - public static final String FORWARD_REQUEST_URI_ATTRIBUTE = "javax.servlet.forward.request_uri"; - public static final String FORWARD_CONTEXT_PATH_ATTRIBUTE = "javax.servlet.forward.context_path"; - public static final String FORWARD_SERVLET_PATH_ATTRIBUTE = "javax.servlet.forward.servlet_path"; - public static final String FORWARD_PATH_INFO_ATTRIBUTE = "javax.servlet.forward.path_info"; - public static final String FORWARD_QUERY_STRING_ATTRIBUTE = "javax.servlet.forward.query_string"; - - /** - * Standard Servlet 2.3+ spec request attributes for error pages. - *

To be exposed to JSPs that are marked as error pages, when forwarding - * to them directly rather than through the servlet container's error page - * resolution mechanism. - */ - public static final String ERROR_STATUS_CODE_ATTRIBUTE = "javax.servlet.error.status_code"; - public static final String ERROR_EXCEPTION_TYPE_ATTRIBUTE = "javax.servlet.error.exception_type"; - public static final String ERROR_MESSAGE_ATTRIBUTE = "javax.servlet.error.message"; - public static final String ERROR_EXCEPTION_ATTRIBUTE = "javax.servlet.error.exception"; - public static final String ERROR_REQUEST_URI_ATTRIBUTE = "javax.servlet.error.request_uri"; - public static final String ERROR_SERVLET_NAME_ATTRIBUTE = "javax.servlet.error.servlet_name"; - - - /** - * Prefix of the charset clause in a content type String: ";charset=" - */ - public static final String CONTENT_TYPE_CHARSET_PREFIX = ";charset="; - - /** - * Default character encoding to use when {@code request.getCharacterEncoding} - * returns {@code null}, according to the Servlet spec. - * @see ServletRequest#getCharacterEncoding - */ - public static final String DEFAULT_CHARACTER_ENCODING = "ISO-8859-1"; - - /** - * Standard Servlet spec context attribute that specifies a temporary - * directory for the current web application, of type {@code java.io.File}. - */ - public static final String TEMP_DIR_CONTEXT_ATTRIBUTE = "javax.servlet.context.tempdir"; - - /** - * HTML escape parameter at the servlet context level - * (i.e. a context-param in {@code web.xml}): "defaultHtmlEscape". - */ - public static final String HTML_ESCAPE_CONTEXT_PARAM = "defaultHtmlEscape"; - - /** - * Web app root key parameter at the servlet context level - * (i.e. a context-param in {@code web.xml}): "webAppRootKey". - */ - public static final String WEB_APP_ROOT_KEY_PARAM = "webAppRootKey"; - - /** Default web app root key: "webapp.root" */ - public static final String DEFAULT_WEB_APP_ROOT_KEY = "webapp.root"; - - /** Name suffixes in case of image buttons */ - public static final String[] SUBMIT_IMAGE_SUFFIXES = {".x", ".y"}; - - /** Key for the mutex session attribute */ - public static final String SESSION_MUTEX_ATTRIBUTE = WebUtils.class.getName() + ".MUTEX"; - - - /** - * Set a system property to the web application root directory. - * The key of the system property can be defined with the "webAppRootKey" - * context-param in {@code web.xml}. Default is "webapp.root". - *

Can be used for tools that support substition with {@code System.getProperty} - * values, like log4j's "${key}" syntax within log file locations. - * @param servletContext the servlet context of the web application - * @throws IllegalStateException if the system property is already set, - * or if the WAR file is not expanded - * @see #WEB_APP_ROOT_KEY_PARAM - * @see #DEFAULT_WEB_APP_ROOT_KEY - * @see WebAppRootListener - * @see Log4jWebConfigurer - */ - public static void setWebAppRootSystemProperty(ServletContext servletContext) throws IllegalStateException { - Assert.notNull(servletContext, "ServletContext must not be null"); - String root = servletContext.getRealPath("/"); - if (root == null) { - throw new IllegalStateException( - "Cannot set web app root system property when WAR file is not expanded"); - } - String param = servletContext.getInitParameter(WEB_APP_ROOT_KEY_PARAM); - String key = (param != null ? param : DEFAULT_WEB_APP_ROOT_KEY); - String oldValue = System.getProperty(key); - if (oldValue != null && !StringUtils.pathEquals(oldValue, root)) { - throw new IllegalStateException( - "Web app root system property already set to different value: '" + - key + "' = [" + oldValue + "] instead of [" + root + "] - " + - "Choose unique values for the 'webAppRootKey' context-param in your web.xml files!"); - } - System.setProperty(key, root); - servletContext.log("Set web app root system property: '" + key + "' = [" + root + "]"); - } - - /** - * Remove the system property that points to the web app root directory. - * To be called on shutdown of the web application. - * @param servletContext the servlet context of the web application - * @see #setWebAppRootSystemProperty - */ - public static void removeWebAppRootSystemProperty(ServletContext servletContext) { - Assert.notNull(servletContext, "ServletContext must not be null"); - String param = servletContext.getInitParameter(WEB_APP_ROOT_KEY_PARAM); - String key = (param != null ? param : DEFAULT_WEB_APP_ROOT_KEY); - System.getProperties().remove(key); - } - - /** - * Return whether default HTML escaping is enabled for the web application, - * i.e. the value of the "defaultHtmlEscape" context-param in {@code web.xml} - * (if any). Falls back to {@code false} in case of no explicit default given. - * @param servletContext the servlet context of the web application - * @return whether default HTML escaping is enabled (default is false) - */ - public static boolean isDefaultHtmlEscape(ServletContext servletContext) { - if (servletContext == null) { - return false; - } - String param = servletContext.getInitParameter(HTML_ESCAPE_CONTEXT_PARAM); - return Boolean.valueOf(param); - } - - /** - * Return whether default HTML escaping is enabled for the web application, - * i.e. the value of the "defaultHtmlEscape" context-param in {@code web.xml} - * (if any). - *

This method differentiates between no param specified at all and - * an actual boolean value specified, allowing to have a context-specific - * default in case of no setting at the global level. - * @param servletContext the servlet context of the web application - * @return whether default HTML escaping is enabled (null = no explicit default) - */ - public static Boolean getDefaultHtmlEscape(ServletContext servletContext) { - if (servletContext == null) { - return null; - } - String param = servletContext.getInitParameter(HTML_ESCAPE_CONTEXT_PARAM); - return (StringUtils.hasText(param)? Boolean.valueOf(param) : null); - } - - /** - * Return the temporary directory for the current web application, - * as provided by the servlet container. - * @param servletContext the servlet context of the web application - * @return the File representing the temporary directory - */ - public static File getTempDir(ServletContext servletContext) { - Assert.notNull(servletContext, "ServletContext must not be null"); - return (File) servletContext.getAttribute(TEMP_DIR_CONTEXT_ATTRIBUTE); - } - - /** - * Return the real path of the given path within the web application, - * as provided by the servlet container. - *

Prepends a slash if the path does not already start with a slash, - * and throws a FileNotFoundException if the path cannot be resolved to - * a resource (in contrast to ServletContext's {@code getRealPath}, - * which returns null). - * @param servletContext the servlet context of the web application - * @param path the path within the web application - * @return the corresponding real path - * @throws FileNotFoundException if the path cannot be resolved to a resource - * @see javax.servlet.ServletContext#getRealPath - */ - public static String getRealPath(ServletContext servletContext, String path) throws FileNotFoundException { - Assert.notNull(servletContext, "ServletContext must not be null"); - // Interpret location as relative to the web application root directory. - if (!path.startsWith("/")) { - path = "/" + path; - } - String realPath = servletContext.getRealPath(path); - if (realPath == null) { - throw new FileNotFoundException( - "ServletContext resource [" + path + "] cannot be resolved to absolute file path - " + - "web application archive not expanded?"); - } - return realPath; - } - - - /** - * Determine the session id of the given request, if any. - * @param request current HTTP request - * @return the session id, or {@code null} if none - */ - public static String getSessionId(HttpServletRequest request) { - Assert.notNull(request, "Request must not be null"); - HttpSession session = request.getSession(false); - return (session != null ? session.getId() : null); - } - - /** - * Check the given request for a session attribute of the given name. - * Returns null if there is no session or if the session has no such attribute. - * Does not create a new session if none has existed before! - * @param request current HTTP request - * @param name the name of the session attribute - * @return the value of the session attribute, or {@code null} if not found - */ - public static Object getSessionAttribute(HttpServletRequest request, String name) { - Assert.notNull(request, "Request must not be null"); - HttpSession session = request.getSession(false); - return (session != null ? session.getAttribute(name) : null); - } - - /** - * Check the given request for a session attribute of the given name. - * Throws an exception if there is no session or if the session has no such - * attribute. Does not create a new session if none has existed before! - * @param request current HTTP request - * @param name the name of the session attribute - * @return the value of the session attribute, or {@code null} if not found - * @throws IllegalStateException if the session attribute could not be found - */ - public static Object getRequiredSessionAttribute(HttpServletRequest request, String name) - throws IllegalStateException { - - Object attr = getSessionAttribute(request, name); - if (attr == null) { - throw new IllegalStateException("No session attribute '" + name + "' found"); - } - return attr; - } - - /** - * Set the session attribute with the given name to the given value. - * Removes the session attribute if value is null, if a session existed at all. - * Does not create a new session if not necessary! - * @param request current HTTP request - * @param name the name of the session attribute - * @param value the value of the session attribute - */ - public static void setSessionAttribute(HttpServletRequest request, String name, Object value) { - Assert.notNull(request, "Request must not be null"); - if (value != null) { - request.getSession().setAttribute(name, value); - } - else { - HttpSession session = request.getSession(false); - if (session != null) { - session.removeAttribute(name); - } - } - } - - /** - * Get the specified session attribute, creating and setting a new attribute if - * no existing found. The given class needs to have a public no-arg constructor. - * Useful for on-demand state objects in a web tier, like shopping carts. - * @param session current HTTP session - * @param name the name of the session attribute - * @param clazz the class to instantiate for a new attribute - * @return the value of the session attribute, newly created if not found - * @throws IllegalArgumentException if the session attribute could not be instantiated - */ - public static Object getOrCreateSessionAttribute(HttpSession session, String name, Class clazz) - throws IllegalArgumentException { - - Assert.notNull(session, "Session must not be null"); - Object sessionObject = session.getAttribute(name); - if (sessionObject == null) { - try { - sessionObject = clazz.newInstance(); - } - catch (InstantiationException ex) { - throw new IllegalArgumentException( - "Could not instantiate class [" + clazz.getName() + - "] for session attribute '" + name + "': " + ex.getMessage()); - } - catch (IllegalAccessException ex) { - throw new IllegalArgumentException( - "Could not access default constructor of class [" + clazz.getName() + - "] for session attribute '" + name + "': " + ex.getMessage()); - } - session.setAttribute(name, sessionObject); - } - return sessionObject; - } - - /** - * Return the best available mutex for the given session: - * that is, an object to synchronize on for the given session. - *

Returns the session mutex attribute if available; usually, - * this means that the HttpSessionMutexListener needs to be defined - * in {@code web.xml}. Falls back to the HttpSession itself - * if no mutex attribute found. - *

The session mutex is guaranteed to be the same object during - * the entire lifetime of the session, available under the key defined - * by the {@code SESSION_MUTEX_ATTRIBUTE} constant. It serves as a - * safe reference to synchronize on for locking on the current session. - *

In many cases, the HttpSession reference itself is a safe mutex - * as well, since it will always be the same object reference for the - * same active logical session. However, this is not guaranteed across - * different servlet containers; the only 100% safe way is a session mutex. - * @param session the HttpSession to find a mutex for - * @return the mutex object (never {@code null}) - * @see #SESSION_MUTEX_ATTRIBUTE - * @see HttpSessionMutexListener - */ - public static Object getSessionMutex(HttpSession session) { - Assert.notNull(session, "Session must not be null"); - Object mutex = session.getAttribute(SESSION_MUTEX_ATTRIBUTE); - if (mutex == null) { - mutex = session; - } - return mutex; - } - - - /** - * Return an appropriate request object of the specified type, if available, - * unwrapping the given request as far as necessary. - * @param request the servlet request to introspect - * @param requiredType the desired type of request object - * @return the matching request object, or {@code null} if none - * of that type is available - */ - @SuppressWarnings("unchecked") - public static T getNativeRequest(ServletRequest request, Class requiredType) { - if (requiredType != null) { - if (requiredType.isInstance(request)) { - return (T) request; - } - else if (request instanceof ServletRequestWrapper) { - return getNativeRequest(((ServletRequestWrapper) request).getRequest(), requiredType); - } - } - return null; - } - - /** - * Return an appropriate response object of the specified type, if available, - * unwrapping the given response as far as necessary. - * @param response the servlet response to introspect - * @param requiredType the desired type of response object - * @return the matching response object, or {@code null} if none - * of that type is available - */ - @SuppressWarnings("unchecked") - public static T getNativeResponse(ServletResponse response, Class requiredType) { - if (requiredType != null) { - if (requiredType.isInstance(response)) { - return (T) response; - } - else if (response instanceof ServletResponseWrapper) { - return getNativeResponse(((ServletResponseWrapper) response).getResponse(), requiredType); - } - } - return null; - } - - /** - * Determine whether the given request is an include request, - * that is, not a top-level HTTP request coming in from the outside. - *

Checks the presence of the "javax.servlet.include.request_uri" - * request attribute. Could check any request attribute that is only - * present in an include request. - * @param request current servlet request - * @return whether the given request is an include request - */ - public static boolean isIncludeRequest(ServletRequest request) { - return (request.getAttribute(INCLUDE_REQUEST_URI_ATTRIBUTE) != null); - } - - /** - * Expose the Servlet spec's error attributes as {@link javax.servlet.http.HttpServletRequest} - * attributes under the keys defined in the Servlet 2.3 specification, for error pages that - * are rendered directly rather than through the Servlet container's error page resolution: - * {@code javax.servlet.error.status_code}, - * {@code javax.servlet.error.exception_type}, - * {@code javax.servlet.error.message}, - * {@code javax.servlet.error.exception}, - * {@code javax.servlet.error.request_uri}, - * {@code javax.servlet.error.servlet_name}. - *

Does not override values if already present, to respect attribute values - * that have been exposed explicitly before. - *

Exposes status code 200 by default. Set the "javax.servlet.error.status_code" - * attribute explicitly (before or after) in order to expose a different status code. - * @param request current servlet request - * @param ex the exception encountered - * @param servletName the name of the offending servlet - */ - public static void exposeErrorRequestAttributes(HttpServletRequest request, Throwable ex, String servletName) { - exposeRequestAttributeIfNotPresent(request, ERROR_STATUS_CODE_ATTRIBUTE, HttpServletResponse.SC_OK); - exposeRequestAttributeIfNotPresent(request, ERROR_EXCEPTION_TYPE_ATTRIBUTE, ex.getClass()); - exposeRequestAttributeIfNotPresent(request, ERROR_MESSAGE_ATTRIBUTE, ex.getMessage()); - exposeRequestAttributeIfNotPresent(request, ERROR_EXCEPTION_ATTRIBUTE, ex); - exposeRequestAttributeIfNotPresent(request, ERROR_REQUEST_URI_ATTRIBUTE, request.getRequestURI()); - exposeRequestAttributeIfNotPresent(request, ERROR_SERVLET_NAME_ATTRIBUTE, servletName); - } - - /** - * Expose the specified request attribute if not already present. - * @param request current servlet request - * @param name the name of the attribute - * @param value the suggested value of the attribute - */ - private static void exposeRequestAttributeIfNotPresent(ServletRequest request, String name, Object value) { - if (request.getAttribute(name) == null) { - request.setAttribute(name, value); - } - } - - /** - * Clear the Servlet spec's error attributes as {@link javax.servlet.http.HttpServletRequest} - * attributes under the keys defined in the Servlet 2.3 specification: - * {@code javax.servlet.error.status_code}, - * {@code javax.servlet.error.exception_type}, - * {@code javax.servlet.error.message}, - * {@code javax.servlet.error.exception}, - * {@code javax.servlet.error.request_uri}, - * {@code javax.servlet.error.servlet_name}. - * @param request current servlet request - */ - public static void clearErrorRequestAttributes(HttpServletRequest request) { - request.removeAttribute(ERROR_STATUS_CODE_ATTRIBUTE); - request.removeAttribute(ERROR_EXCEPTION_TYPE_ATTRIBUTE); - request.removeAttribute(ERROR_MESSAGE_ATTRIBUTE); - request.removeAttribute(ERROR_EXCEPTION_ATTRIBUTE); - request.removeAttribute(ERROR_REQUEST_URI_ATTRIBUTE); - request.removeAttribute(ERROR_SERVLET_NAME_ATTRIBUTE); - } - - /** - * Expose the given Map as request attributes, using the keys as attribute names - * and the values as corresponding attribute values. Keys need to be Strings. - * @param request current HTTP request - * @param attributes the attributes Map - */ - public static void exposeRequestAttributes(ServletRequest request, Map attributes) { - Assert.notNull(request, "Request must not be null"); - Assert.notNull(attributes, "Attributes Map must not be null"); - for (Map.Entry entry : attributes.entrySet()) { - request.setAttribute(entry.getKey(), entry.getValue()); - } - } - - /** - * Retrieve the first cookie with the given name. Note that multiple - * cookies can have the same name but different paths or domains. - * @param request current servlet request - * @param name cookie name - * @return the first cookie with the given name, or {@code null} if none is found - */ - public static Cookie getCookie(HttpServletRequest request, String name) { - Assert.notNull(request, "Request must not be null"); - Cookie cookies[] = request.getCookies(); - if (cookies != null) { - for (Cookie cookie : cookies) { - if (name.equals(cookie.getName())) { - return cookie; - } - } - } - return null; - } - - /** - * Check if a specific input type="submit" parameter was sent in the request, - * either via a button (directly with name) or via an image (name + ".x" or - * name + ".y"). - * @param request current HTTP request - * @param name name of the parameter - * @return if the parameter was sent - * @see #SUBMIT_IMAGE_SUFFIXES - */ - public static boolean hasSubmitParameter(ServletRequest request, String name) { - Assert.notNull(request, "Request must not be null"); - if (request.getParameter(name) != null) { - return true; - } - for (String suffix : SUBMIT_IMAGE_SUFFIXES) { - if (request.getParameter(name + suffix) != null) { - return true; - } - } - return false; - } - - /** - * Obtain a named parameter from the given request parameters. - *

See {@link #findParameterValue(java.util.Map, String)} - * for a description of the lookup algorithm. - * @param request current HTTP request - * @param name the logical name of the request parameter - * @return the value of the parameter, or {@code null} - * if the parameter does not exist in given request - */ - public static String findParameterValue(ServletRequest request, String name) { - return findParameterValue(request.getParameterMap(), name); - } - - /** - * Obtain a named parameter from the given request parameters. - *

This method will try to obtain a parameter value using the - * following algorithm: - *

    - *
  1. Try to get the parameter value using just the given logical name. - * This handles parameters of the form logicalName = value. For normal - * parameters, e.g. submitted using a hidden HTML form field, this will return - * the requested value.
  2. - *
  3. Try to obtain the parameter value from the parameter name, where the - * parameter name in the request is of the form logicalName_value = xyz - * with "_" being the configured delimiter. This deals with parameter values - * submitted using an HTML form submit button.
  4. - *
  5. If the value obtained in the previous step has a ".x" or ".y" suffix, - * remove that. This handles cases where the value was submitted using an - * HTML form image button. In this case the parameter in the request would - * actually be of the form logicalName_value.x = 123.
  6. - *
- * @param parameters the available parameter map - * @param name the logical name of the request parameter - * @return the value of the parameter, or {@code null} - * if the parameter does not exist in given request - */ - public static String findParameterValue(Map parameters, String name) { - // First try to get it as a normal name=value parameter - Object value = parameters.get(name); - if (value instanceof String[]) { - String[] values = (String[]) value; - return (values.length > 0 ? values[0] : null); - } - else if (value != null) { - return value.toString(); - } - // If no value yet, try to get it as a name_value=xyz parameter - String prefix = name + "_"; - for (String paramName : parameters.keySet()) { - if (paramName.startsWith(prefix)) { - // Support images buttons, which would submit parameters as name_value.x=123 - for (String suffix : SUBMIT_IMAGE_SUFFIXES) { - if (paramName.endsWith(suffix)) { - return paramName.substring(prefix.length(), paramName.length() - suffix.length()); - } - } - return paramName.substring(prefix.length()); - } - } - // We couldn't find the parameter value... - return null; - } - - /** - * Return a map containing all parameters with the given prefix. - * Maps single values to String and multiple values to String array. - *

For example, with a prefix of "spring_", "spring_param1" and - * "spring_param2" result in a Map with "param1" and "param2" as keys. - * @param request HTTP request in which to look for parameters - * @param prefix the beginning of parameter names - * (if this is null or the empty string, all parameters will match) - * @return map containing request parameters without the prefix, - * containing either a String or a String array as values - * @see javax.servlet.ServletRequest#getParameterNames - * @see javax.servlet.ServletRequest#getParameterValues - * @see javax.servlet.ServletRequest#getParameterMap - */ - public static Map getParametersStartingWith(ServletRequest request, String prefix) { - Assert.notNull(request, "Request must not be null"); - Enumeration paramNames = request.getParameterNames(); - Map params = new TreeMap(); - if (prefix == null) { - prefix = ""; - } - while (paramNames != null && paramNames.hasMoreElements()) { - String paramName = paramNames.nextElement(); - if ("".equals(prefix) || paramName.startsWith(prefix)) { - String unprefixed = paramName.substring(prefix.length()); - String[] values = request.getParameterValues(paramName); - if (values == null || values.length == 0) { - // Do nothing, no values found at all. - } - else if (values.length > 1) { - params.put(unprefixed, values); - } - else { - params.put(unprefixed, values[0]); - } - } - } - return params; - } - - /** - * Return the target page specified in the request. - * @param request current servlet request - * @param paramPrefix the parameter prefix to check for - * (e.g. "_target" for parameters like "_target1" or "_target2") - * @param currentPage the current page, to be returned as fallback - * if no target page specified - * @return the page specified in the request, or current page if not found - */ - public static int getTargetPage(ServletRequest request, String paramPrefix, int currentPage) { - Enumeration paramNames = request.getParameterNames(); - while (paramNames.hasMoreElements()) { - String paramName = paramNames.nextElement(); - if (paramName.startsWith(paramPrefix)) { - for (int i = 0; i < WebUtils.SUBMIT_IMAGE_SUFFIXES.length; i++) { - String suffix = WebUtils.SUBMIT_IMAGE_SUFFIXES[i]; - if (paramName.endsWith(suffix)) { - paramName = paramName.substring(0, paramName.length() - suffix.length()); - } - } - return Integer.parseInt(paramName.substring(paramPrefix.length())); - } - } - return currentPage; - } - - - /** - * Extract the URL filename from the given request URL path. - * Correctly resolves nested paths such as "/products/view.html" as well. - * @param urlPath the request URL path (e.g. "/index.html") - * @return the extracted URI filename (e.g. "index") - */ - public static String extractFilenameFromUrlPath(String urlPath) { - String filename = extractFullFilenameFromUrlPath(urlPath); - int dotIndex = filename.lastIndexOf('.'); - if (dotIndex != -1) { - filename = filename.substring(0, dotIndex); - } - return filename; - } - - /** - * Extract the full URL filename (including file extension) from the given request URL path. - * Correctly resolves nested paths such as "/products/view.html" as well. - * @param urlPath the request URL path (e.g. "/products/index.html") - * @return the extracted URI filename (e.g. "index.html") - */ - public static String extractFullFilenameFromUrlPath(String urlPath) { - int end = urlPath.indexOf(';'); - if (end == -1) { - end = urlPath.indexOf('?'); - if (end == -1) { - end = urlPath.length(); - } - } - int begin = urlPath.lastIndexOf('/', end) + 1; - return urlPath.substring(begin, end); - } - - /** - * Parse the given string with matrix variables. An example string would look - * like this {@code "q1=a;q1=b;q2=a,b,c"}. The resulting map would contain - * keys {@code "q1"} and {@code "q2"} with values {@code ["a","b"]} and - * {@code ["a","b","c"]} respectively. - * - * @param matrixVariables the unparsed matrix variables string - * @return a map with matrix variable names and values, never {@code null} - */ - public static MultiValueMap parseMatrixVariables(String matrixVariables) { - MultiValueMap result = new LinkedMultiValueMap(); - if (!StringUtils.hasText(matrixVariables)) { - return result; - } - StringTokenizer pairs = new StringTokenizer(matrixVariables, ";"); - while (pairs.hasMoreTokens()) { - String pair = pairs.nextToken(); - int index = pair.indexOf('='); - if (index != -1) { - String name = pair.substring(0, index); - String rawValue = pair.substring(index + 1); - for (String value : StringUtils.commaDelimitedListToStringArray(rawValue)) { - result.add(name, value); - } - } - else { - result.add(pair, ""); - } - } - return result; - } -} - diff --git a/src/spec/java/org/jruby/rack/mock/fail/FailingHttpServletResponse.java b/src/spec/java/org/jruby/rack/mock/fail/FailingHttpServletResponse.java index 584d923b..1ac5b581 100644 --- a/src/spec/java/org/jruby/rack/mock/fail/FailingHttpServletResponse.java +++ b/src/spec/java/org/jruby/rack/mock/fail/FailingHttpServletResponse.java @@ -23,21 +23,20 @@ */ package org.jruby.rack.mock.fail; +import org.springframework.mock.web.MockHttpServletResponse; + +import javax.servlet.ServletOutputStream; import java.io.IOException; -import org.jruby.rack.mock.MockHttpServletResponse; /** * @author kares */ public class FailingHttpServletResponse extends MockHttpServletResponse { - private FailingServletOutputStream outputStream; + private FailingServletOutputStream outputStream = new FailingServletOutputStream(new IOException("Broken pipe")); @Override - public FailingServletOutputStream getOutputStream() { - if (outputStream == null) { - outputStream = new FailingServletOutputStream(new IOException("Broken pipe")); - } + public ServletOutputStream getOutputStream() { return outputStream; } @@ -46,7 +45,7 @@ public void setOutputStream(FailingServletOutputStream outputStream) { } public void setFailure(IOException failure) { - getOutputStream().setFailure(failure); + outputStream.setFailure(failure); } } diff --git a/src/spec/java/org/jruby/rack/mock/fail/FailingServletOutputStream.java b/src/spec/java/org/jruby/rack/mock/fail/FailingServletOutputStream.java index 5d47e0f0..008e44a1 100644 --- a/src/spec/java/org/jruby/rack/mock/fail/FailingServletOutputStream.java +++ b/src/spec/java/org/jruby/rack/mock/fail/FailingServletOutputStream.java @@ -23,9 +23,11 @@ */ package org.jruby.rack.mock.fail; +import org.springframework.mock.web.DelegatingServletOutputStream; + +import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; -import org.jruby.rack.mock.DelegatingServletOutputStream; /** * @author kares @@ -35,7 +37,7 @@ public class FailingServletOutputStream extends DelegatingServletOutputStream { private IOException failure; public FailingServletOutputStream(final IOException failure) { - super(null); + super(new ByteArrayOutputStream()); this.failure = failure; } diff --git a/src/spec/ruby/action_controller/session/java_servlet_store_spec.rb b/src/spec/ruby/action_controller/session/java_servlet_store_spec.rb index 8ef7bc31..444abf75 100644 --- a/src/spec/ruby/action_controller/session/java_servlet_store_spec.rb +++ b/src/spec/ruby/action_controller/session/java_servlet_store_spec.rb @@ -218,7 +218,7 @@ end it "should attempt to invalidate an invalid servlet session" do - session = double_http_session(nil); session.invalidate + session = double_http_session; session.invalidate @request.should_receive(:getSession).with(false).and_return session @app.should_receive(:call) do |env| @@ -265,25 +265,22 @@ end it "supports renewing a session" do - session = double_http_session sid = "EC72C9F8EC984052C6F13D08893121DF" + session = double_http_session @request.should_receive(:getSession).ordered.with(false).and_return(session) new_session = double_http_session @request.should_receive(:getSession).ordered.with(true).and_return(new_session) @app.should_receive(:call) do |env| - env['rack.session.options'] = { :id => sid, :renew => true, :defer => true } + env['rack.session.options'] = { :id => session.id, :renew => true, :defer => true } env['rack.session']['_csrf_token'] = 'v3PrzsdkWug9Q3xCthKkEzUMbZSzgQ9Bt+43lH0bEF8=' end @session_store.call(@env) expect( session.isInvalid ).to be true - attrs = session.send(:getAttributes) - expect( attrs['_csrf_token'] ).to be nil expect( new_session.isInvalid ).to be false - attrs = new_session.send(:getAttributes) - expect( attrs['_csrf_token'] ).to_not be nil + expect( new_session.send(:getAttribute, "_csrf_token") ).to_not be nil end it "handles the skip session option" do @@ -298,10 +295,8 @@ private - def double_http_session(id = false) - session = Java::OrgJrubyRackMock::MockHttpSession.new - session.send(:setId, id) if id != false - session + def double_http_session + Java::OrgSpringframeworkMockWeb::MockHttpSession.new end def new_session_hash(*args) diff --git a/src/spec/ruby/jruby/rack/integration_spec.rb b/src/spec/ruby/jruby/rack/integration_spec.rb index 38183c0c..9464ebbb 100644 --- a/src/spec/ruby/jruby/rack/integration_spec.rb +++ b/src/spec/ruby/jruby/rack/integration_spec.rb @@ -20,7 +20,7 @@ describe 'rack (lambda)' do before do - @servlet_context = org.jruby.rack.mock.MockServletContext.new "file://#{STUB_DIR}/rack" + @servlet_context = org.jruby.rack.mock.RackLoggingMockServletContext.new "file://#{STUB_DIR}/rack" @servlet_context.logger = raise_logger # make sure we always boot runtimes in the same mode as specs : set_compat_version @servlet_context @@ -56,7 +56,7 @@ end it "inits servlet" do - servlet_config = org.jruby.rack.mock.MockServletConfig.new @servlet_context + servlet_config = org.springframework.mock.web.MockServletConfig.new @servlet_context servlet = org.jruby.rack.RackServlet.new servlet.init(servlet_config) @@ -68,12 +68,12 @@ dispatcher = org.jruby.rack.DefaultRackDispatcher.new(@rack_context) servlet = org.jruby.rack.RackServlet.new(dispatcher, @rack_context) - request = org.jruby.rack.mock.MockHttpServletRequest.new(@servlet_context) + request = org.springframework.mock.web.MockHttpServletRequest.new(@servlet_context) request.setMethod("GET") request.setRequestURI("/") request.setContentType("text/html") request.setContent("".to_java.bytes) - response = org.jruby.rack.mock.MockHttpServletResponse.new + response = org.springframework.mock.web.MockHttpServletResponse.new servlet.service(request, response) @@ -441,7 +441,7 @@ def restore_rails end def new_servlet_context(base_path = nil) - servlet_context = org.jruby.rack.mock.MockServletContext.new base_path + servlet_context = org.jruby.rack.mock.RackLoggingMockServletContext.new base_path servlet_context.logger = raise_logger prepare_servlet_context servlet_context servlet_context diff --git a/src/spec/ruby/jruby/rack/logger_spec.rb b/src/spec/ruby/jruby/rack/logger_spec.rb index bc010c7c..2453307f 100644 --- a/src/spec/ruby/jruby/rack/logger_spec.rb +++ b/src/spec/ruby/jruby/rack/logger_spec.rb @@ -7,7 +7,7 @@ end let(:servlet_context) do - servlet_context = org.jruby.rack.mock.MockServletContext.new + servlet_context = org.jruby.rack.mock.RackLoggingMockServletContext.new servlet_context.logger = real_logger servlet_context end diff --git a/src/spec/ruby/jruby/rack/rails_booter_spec.rb b/src/spec/ruby/jruby/rack/rails_booter_spec.rb index e39e38ea..5d828e87 100644 --- a/src/spec/ruby/jruby/rack/rails_booter_spec.rb +++ b/src/spec/ruby/jruby/rack/rails_booter_spec.rb @@ -446,8 +446,8 @@ def booter.rails2?; false end let(:request) { double("request") } let(:response) { double("response") } - let(:servlet_request) { org.jruby.rack.mock.MockHttpServletRequest.new } - let(:servlet_response) { org.jruby.rack.mock.MockHttpServletResponse.new } + let(:servlet_request) { org.springframework.mock.web.MockHttpServletRequest.new } + let(:servlet_response) { org.springframework.mock.web.MockHttpServletResponse.new } before :each do request.stub(:env).and_return({ diff --git a/src/spec/ruby/jruby/rack/servlet_ext_spec.rb b/src/spec/ruby/jruby/rack/servlet_ext_spec.rb index d51f2c48..17dcae19 100644 --- a/src/spec/ruby/jruby/rack/servlet_ext_spec.rb +++ b/src/spec/ruby/jruby/rack/servlet_ext_spec.rb @@ -83,7 +83,7 @@ describe Java::JavaxServlet::ServletContext do let(:subject) do - context = org.jruby.rack.mock.MockServletContext.new + context = org.springframework.mock.web.MockServletContext.new context.removeAttribute("javax.servlet.context.tempdir") context end @@ -119,7 +119,7 @@ @request.keys.should == names end - let(:subject) { org.jruby.rack.mock.MockHttpServletRequest.new } + let(:subject) { org.springframework.mock.web.MockHttpServletRequest.new } it_behaves_like "hash" @@ -152,7 +152,7 @@ @session.keys.should == names end - let(:subject) { org.jruby.rack.mock.MockHttpSession.new } + let(:subject) { org.springframework.mock.web.MockHttpSession.new } it_behaves_like "hash" diff --git a/src/spec/ruby/rack/application_spec.rb b/src/spec/ruby/rack/application_spec.rb index 9c32a578..8d5fa895 100644 --- a/src/spec/ruby/rack/application_spec.rb +++ b/src/spec/ruby/rack/application_spec.rb @@ -33,11 +33,11 @@ end let(:servlet_request) do - org.jruby.rack.mock.MockHttpServletRequest.new(servlet_context) + org.springframework.mock.web.MockHttpServletRequest.new(servlet_context) end let(:servlet_response) do - org.jruby.rack.mock.MockHttpServletResponse.new + org.springframework.mock.web.MockHttpServletResponse.new end let(:rack_config) do diff --git a/src/spec/ruby/rack/handler/servlet_spec.rb b/src/spec/ruby/rack/handler/servlet_spec.rb index fba0d667..fa4bd04c 100644 --- a/src/spec/ruby/rack/handler/servlet_spec.rb +++ b/src/spec/ruby/rack/handler/servlet_spec.rb @@ -17,11 +17,11 @@ def _env; @_env end let(:servlet_context) { @servlet_context ||= mock_servlet_context } let(:servlet_request) do - org.jruby.rack.mock.MockHttpServletRequest.new(servlet_context) + org.springframework.mock.web.MockHttpServletRequest.new(servlet_context) end let(:servlet_response) do - org.jruby.rack.mock.MockHttpServletResponse.new + org.springframework.mock.web.MockHttpServletResponse.new end shared_examples "env" do @@ -189,7 +189,7 @@ def _env; @_env end @servlet_request.setRemoteHost('localhost') @servlet_request.setRemoteUser('admin') - { "Host" => "localhost", + { "Host" => "serverhost", "Accept" => "text/*", "Accept-Encoding" => "gzip"}.each do |name, value| @servlet_request.addHeader(name, value) @@ -198,7 +198,7 @@ def _env; @_env end env = servlet.create_env @servlet_env env["rack.version"].should == Rack::VERSION env["CONTENT_TYPE"].should == "text/html" - env["HTTP_HOST"].should == "localhost" + env["HTTP_HOST"].should == "serverhost" env["HTTP_ACCEPT"].should == "text/*" env["REQUEST_METHOD"].should == "GET" env["SCRIPT_NAME"].should == "/app" @@ -341,7 +341,7 @@ def _env; @_env end end it "retrieves hidden attribute" do - servlet_request_class = Class.new(org.jruby.rack.mock.MockHttpServletRequest) do + servlet_request_class = Class.new(org.springframework.mock.web.MockHttpServletRequest) do def getAttributeNames names = super.to_a.reject { |name| name.start_with?('org.apache') } @@ -501,8 +501,8 @@ def getAttributeNames shared_examples "(eager)rack-env" do before do - @servlet_request = org.jruby.rack.mock.MockHttpServletRequest.new(@servlet_context) - @servlet_response = org.jruby.rack.mock.MockHttpServletResponse.new + @servlet_request = org.springframework.mock.web.MockHttpServletRequest.new(@servlet_context) + @servlet_response = org.springframework.mock.web.MockHttpServletResponse.new @servlet_env = org.jruby.rack.servlet.ServletRackEnvironment.new( @servlet_request, @servlet_response, @rack_context ) @@ -888,9 +888,9 @@ def servlet.create_env(servlet_env) context "servlet" do before do - @servlet_context = org.jruby.rack.mock.MockServletContext.new - @servlet_request = org.jruby.rack.mock.MockHttpServletRequest.new(@servlet_context) - @servlet_response = org.jruby.rack.mock.MockHttpServletResponse.new + @servlet_context = org.springframework.mock.web.MockServletContext.new + @servlet_request = org.springframework.mock.web.MockHttpServletRequest.new(@servlet_context) + @servlet_response = org.springframework.mock.web.MockHttpServletResponse.new @servlet_env = org.jruby.rack.servlet.ServletRackEnvironment.new( @servlet_request, @servlet_response, @rack_context ) @@ -1039,7 +1039,7 @@ def servlet.create_env(servlet_env) end it "handles null values in parameter-map (Jetty)" do - org.jruby.rack.mock.MockHttpServletRequest.class_eval do + org.springframework.mock.web.MockHttpServletRequest.class_eval do field_reader :parameters end # reproducing https://github.com/jruby/jruby-rack/issues/154 diff --git a/src/spec/ruby/rack/servlet_context_listener_spec.rb b/src/spec/ruby/rack/servlet_context_listener_spec.rb index 9c2a57dc..4de971e7 100644 --- a/src/spec/ruby/rack/servlet_context_listener_spec.rb +++ b/src/spec/ruby/rack/servlet_context_listener_spec.rb @@ -42,7 +42,7 @@ end it "throws an error if initialization failed (and jruby.rack.error = false)" do - @servlet_context = org.jruby.rack.mock.MockServletContext.new + @servlet_context = org.springframework.mock.web.MockServletContext.new @servlet_context.add_init_parameter 'jruby.rack.error', 'false' @factory.should_receive(:init).and_raise org.jruby.rack.RackInitializationException.new("help") diff --git a/src/spec/ruby/spec_helper.rb b/src/spec/ruby/spec_helper.rb index 0cbac5b2..1a8d5504 100644 --- a/src/spec/ruby/spec_helper.rb +++ b/src/spec/ruby/spec_helper.rb @@ -204,10 +204,10 @@ def should_not_eval_as_nil(code, runtime = @runtime) # alias end -java_import org.jruby.rack.mock.MockServletConfig -java_import org.jruby.rack.mock.MockServletContext -java_import org.jruby.rack.mock.MockHttpServletRequest -java_import org.jruby.rack.mock.MockHttpServletResponse +java_import org.springframework.mock.web.MockServletConfig +java_import org.springframework.mock.web.MockServletContext +java_import org.springframework.mock.web.MockHttpServletRequest +java_import org.springframework.mock.web.MockHttpServletResponse class StubInputStream < java.io.InputStream From cb9e3845d806716f4243097f74a10460d9d6ce5d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 01:19:58 +0000 Subject: [PATCH 20/20] Bump rack in the ruby-deps group across 1 directory Bumps the ruby-deps group with 1 update in the / directory: [rack](https://github.com/rack/rack). Updates `rack` from 2.2.12 to 2.2.13 - [Release notes](https://github.com/rack/rack/releases) - [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md) - [Commits](https://github.com/rack/rack/compare/v2.2.12...v2.2.13) --- updated-dependencies: - dependency-name: rack dependency-type: direct:production update-type: version-update:semver-patch dependency-group: ruby-deps ... Signed-off-by: dependabot[bot] (cherry picked from commit 2b9cf71fad347d28def1794ddba5e1e81ed7df3a) --- Gemfile.lock | 2 +- History.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index b9659d12..d3651668 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,7 +6,7 @@ GEM rake thor (>= 0.14.0) diff-lcs (1.6.0) - rack (2.2.12) + rack (2.2.13) rake (13.2.1) rspec (3.13.0) rspec-core (~> 3.13.0) diff --git a/History.md b/History.md index 55e87700..6a302c9d 100644 --- a/History.md +++ b/History.md @@ -1,6 +1,6 @@ ## 1.2.3 -- update (bundled) rack to 2.2.12 +- update (bundled) rack to 2.2.13 - Corrects Rack 2.x compatibility when used with modern Rails, and requires Rack 2.x going forward - forward ports all 1.1.x fixes to the 1.2.x stream which were omitted in 1.2.2 release (#262) - fixes regression NoMethodError undefined method get_header (#259)