Project

General

Profile

Actions

Patch #5404

closed

Fix Redmine tests for JRuby 1.4.x and 1.5.0

Added by Gregor Schmidt almost 14 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Ruby support
Target version:
-
Start date:
2010-04-29
Due date:
% Done:

0%

Estimated time:

Description

The attached patch will fix all test failures and error for JRuby 1.4.x and the current JRuby 1.5.1.RC1 and RC2. Compatibility with Ruby 1.8.7 is preserved.

The patches are apply to r3695 (trunk) and r3662 (0.9-stable).

Please also have a look at the git branches at


Files

5404_fix_redmine_on_jruby_stable.diff (8.39 KB) 5404_fix_redmine_on_jruby_stable.diff Gregor Schmidt, 2010-04-29 20:21
5404_fix_redmine_on_jruby_trunk.diff (8.54 KB) 5404_fix_redmine_on_jruby_trunk.diff Gregor Schmidt, 2010-04-29 20:21
git_adapter.rb.diff (397 Bytes) git_adapter.rb.diff Fix Git adapter on JRuby and Windows Babar O'Cap, 2010-06-23 10:35

Related issues

Related to Redmine - Defect #632: Theme discovery doesn't work under JRuby on Rails war structureClosed2008-02-12

Actions
Related to Redmine - Defect #4494: Mercurial access not working in jrubyClosed2009-12-28

Actions
Related to Redmine - Defect #8510: JRuby: Can't open administrator panel if scm command is not availableClosedToshi MARUYAMA2011-06-03

Actions
Actions #2

Updated by Gregor Schmidt almost 14 years ago

this should also fix #4494 and #632

Actions #3

Updated by Eric Davis almost 14 years ago

Anyone with experience with jruby want to test these? It would be nice to fully support jruby in Redmine 1.0.

Actions #4

Updated by Jean-Philippe Lang almost 14 years ago

I have made a few tests with JRuby1.4.0 / Win32 with Mysql and SQLite3. I'm still getting a bunch of failures with Mysql. It's much better with Sqlite3 (after fixing a few errors in r3700 and r3701). What's your testing platform? Also, it looks like Bazaar tests all failed.

Your patch includes a few patches to JDBC postgres and sqlite3 adapters. Where do this patches come from? I'd really like that the adapters get fixed rather than including these patches in the Redmine code.

>java -version
java version "1.6.0_17" 
Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
Java HotSpot(TM) Client VM (build 14.3-b01, mixed mode, sharing)

>jruby -v
jruby 1.4.0 (ruby 1.8.7 patchlevel 174) (2009-11-02 69fbfa3) (Java HotSpot(TM) Client VM 1.6.0_17) [x86-java]
Actions #5

Updated by Gregor Schmidt almost 14 years ago

Thank you for having a look at the patch.

I was testing on Mac OS X using the JVM shipped with 10.5.

$ ruby -v
jruby 1.4.1 (ruby 1.8.7 patchlevel 174) (2010-04-26 ea6db6a) (Java HotSpot(TM) Server VM 1.5.0_22) [i386-java]

$ ruby -v
jruby 1.5.0.RC2 (ruby 1.8.7 patchlevel 249) (2010-04-28 7c245f3) (Java HotSpot(TM) Server VM 1.5.0_22) [i386-java]

$ java -version
java version "1.5.0_22" 
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03-333-9M3125)

I forgot to mention, that the SQLite test do not work on my machine either. It seems, that activerecord-jdcbsqlite3-adapter and jdbc-sqlite3 are way behind the sqlite3-ruby gem. Both show very different behaviour on my machine. MySQL (5.1.45) and PostgreSQL (8.3.4) on the other hand work without problems.

Concerning the patches to activerecord-jdbc*-adapter

The patch to the Postgres adapter is filed as Bug on AR-JDBC-104 and I wrote a mail to the jruby list. Unfortunately, I did not get any feedback.

I'm not sure about the Patches to the SQLite3 adapter. I wrote another mail to the JRuby Mailing list, concerning my problems, I had with SQLite and also added a simple test case. Unfortunately I did not get any feedback here, either.

Therefore, I've added the patches into a single file, such that we are able to keep an eye on them. I totally get your argument about getting the adapters fixed instead of fixing them in redmine, but I wanted to get the test running and a working Redmine. I will keep bullying the AR-JDBC guys to get their libraries fixed.

Repository Adapters

Sorry, I was a bit hastily. I've only tested file system, mercurial, subversion and git. I simply forgot the others. I could have a look at bazaar, cvs and darcs, if you like.

Actions #6

Updated by Jean-Philippe Lang almost 14 years ago

The patch to Engines to make use of Rails.public_path does not seem to have any effect when deploying a WAR.

When Engines gets loaded, Rails.public_path points to WEB-INF/public and thus assets are mirrored to WEB-INF/public. After the application started Rails.public_path points to the root of the webapp but it's too late... I really don't know how to fix it.

Actions #7

Updated by Gregor Schmidt almost 14 years ago

Jean-Philippe Lang wrote:

The patch to Engines to make use of Rails.public_path does not seem to have any effect when deploying a WAR.

When Engines gets loaded, Rails.public_path points to WEB-INF/public and thus assets are mirrored to WEB-INF/public. After the application started Rails.public_path points to the root of the webapp but it's too late... I really don't know how to fix it.

You are totally right. When I fixed the theme loading mechanism, I grepped for other occurances of RAILS_ROOT + '/public' and replaced them with Rails.public_path with further testing. But after the change, its a bug in JRuby-Rack. Beforehand it was one in Redmine. Therefore the change has a certain value, somehow.

I will try to debug the issue in the context of JRuby-Rack and give feedback, once I have made some progress on that.

Actions #8

Updated by Jean-Philippe Lang almost 14 years ago

The only way I found to fix it is the following patch:

Index: config/environment.rb
===================================================================
--- config/environment.rb    (revision 3701)
+++ config/environment.rb    (working copy)
@@ -13,6 +13,11 @@
 # Load Engine plugin if available
 begin
   require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')
+  module Engines
+    def self.public_directory
+      File.join(Rails.public_path, 'plugin_assets')
+    end
+  end
 rescue LoadError
   # Not available
 end

It works because Rails.public_path is properly set when assets get actually mirrored.

Actions #9

Updated by Gregor Schmidt almost 14 years ago

Your fix works for me, but I still think, that this would be a bug in JRuby-Rack, which is responsible for setting the correct public_path.

Currently it's no problem for me, that it does not work correctly, since the plugin assets are already copied when 'environment' is loaded during my warbling.

Actions #10

Updated by Jean-Philippe Lang almost 14 years ago

Gregor Schmidt wrote:

Currently it's no problem for me, that it does not work correctly, since the plugin assets are already copied when 'environment' is loaded during my warbling.

I wasn't aware of that. Then I think we can live without this patch.

Actions #11

Updated by Jean-Philippe Lang almost 14 years ago

Mercurial and Bazaar adapters are now fixed for JRuby.

r3724 passes all tests with JRuby 1.5.0 RC2 and MySQL for me. But it looks like something still goes wrong at finn.de:
http://ci.finn.de/builds/jruby_redmine-trunk_mysql/3724

Actions #12

Updated by Jean-Philippe Lang almost 14 years ago

With your jruby_compat initializer:
  • PostgreSQL: all tests pass
  • SQLite3: the patches almost fix it, but there's still a failure (leaving the due date field empty when creating an issue leads to "Due date must be greater than start date")
Actions #13

Updated by Gregor Schmidt almost 14 years ago

Concerning the failures on ci.finn.de. rake db:schema:dump produces a faulty db/schema.rb. All tests pass, when using config.active_record.schema_format = :sql. I will try to build a simple failing test case for AR-JDBC, as I think it is their fault.

Concerning the jruby_compat initializer. As long as they are not fixed in AR-JDBC itself, are you willing to provide these patches in Redmine itself or should be publish them via plugin for everybody interested?

Actions #14

Updated by Gregor Schmidt almost 14 years ago

Furthermore I would like to thank you for your fast feedback and integration of the patches.

Actions #15

Updated by Gregor Schmidt almost 14 years ago

The db:schema:dump bug is now known as ACTIVERECORD_JDBC-112. Let's that this will be fixed soon.

Actions #16

Updated by Babar O'Cap almost 14 years ago

I've a bug with JRuby 1.5.1 in Git repositories on Windows.

Redmine::Scm::Adapters::GitAdapter#last_rev source:trunk/lib/redmine/scm/adapters/git_adapter.rb#L87 doesn't work properly.

Here a patch to fix this issue.

NB: I didn't test on an other platform.

Actions #17

Updated by Toshi MARUYAMA over 13 years ago

Babar O'Cap wrote:

I've a bug with JRuby 1.5.1 in Git repositories on Windows.

Redmine::Scm::Adapters::GitAdapter#last_rev source:trunk/lib/redmine/scm/adapters/git_adapter.rb#L87 doesn't work properly.

Here a patch to fix this issue.

It seems io.gets() problem of git adapter.
I posted git-io-gets.diff to fix it at note-11 of #5096.

Actions #18

Updated by Toshi MARUYAMA about 13 years ago

  • Category set to Ruby support
Actions #19

Updated by Jean-Philippe Lang over 11 years ago

  • Status changed from New to Closed

Closing it, the test suite is running fine with JRuby 1.6.7 now.

Actions

Also available in: Atom PDF