TOTD # 74: JRuby and GlassFish Integration Test #5: JRuby 1.2.0 RC2 + Rails 2.x.x + GlassFish + Redmine


TOTD #70, #71, #72, #73 shows four integration tests that can ensure that the latest JRuby and GlassFish versions work nicely with each other.

#70 showed how to create a trivial Rails application and run it using GlassFish Gem#71 showed how the same application can be deployed on GlassFish v3 Prelude#72 showed how to deploy the same application on GlassFish v3. #73 showed how to deploy a Rails application as WAR file and use the JDBC connection pooling framework available in GlassFish.

The next set of tests ensure that some commonly used open source Rails applications can be easily run using this setup. The first one is Redmine - 0.8 is the stable release now. Redmine was first tried on GlassFish a few months ago. The steps have simplified since then :)

Lets begin integration test #5.
  1. Download Redmine 0.8 ...

    /samples/jruby/redmine >svn co http://redmine.rubyforge.org/svn/branches/0.8-stable redmine-0.8
    A    redmine-0.8/test
    A    redmine-0.8/test/unit
    A    redmine-0.8/test/unit/document_test.rb
    A    redmine-0.8/test/unit/token_test.rb
    . . .
    A    redmine-0.8/public/stylesheets/scm.css
    A    redmine-0.8/public/stylesheets/application.css
    A    redmine-0.8/public/favicon.ico
     U   redmine-0.8
    Checked out revision 2580.
  2. Copy "config/database.yml.example" to "config/database.yml" and then generate/migrate the database:

    ~/samples/jruby/redmine/redmine-0.8 >../jruby-1.2.0RC2/bin/jruby -S rake db:create
    (in /Users/arungupta/samples/jruby/redmine/redmine-0.8)
    ~/samples/jruby/redmine/redmine-0.8 >../jruby-1.2.0RC2/bin/jruby -S rake db:migrate
    (in /Users/arungupta/samples/jruby/redmine/redmine-0.8)
    == 1 Setup: migrating =========================================================
    -- create_table("attachments", {:force=>true})
       -> 0.0880s
    -- create_table("auth_sources", {:force=>true})
       -> 0.1430s
    . . .
    == 100 AddChangesetsUserId: migrating =========================================
    -- add_column(:changesets, :user_id, :integer, {:default=>nil})
       -> 0.0980s
    == 100 AddChangesetsUserId: migrated (0.0990s) ================================

    == 101 PopulateChangesetsUserId: migrating ====================================
    == 101 PopulateChangesetsUserId: migrated (0.0030s) ===========================

  3. Redmine is a Rails 2.1.x application so install Rails 2.1.x using JRuby 1.2 and run the application as:

    ~/samples/jruby/redmine/redmine-0.8 >../jruby-1.2.0RC2/bin/jruby -S glassfish
    Mar 13, 2009 11:14:59 AM com.sun.enterprise.glassfish.bootstrap.ASMainStatic findDerbyClient
    INFO: Cannot find javadb client jar file, jdbc driver not available
    Mar 13, 2009 11:14:59 AM APIClassLoaderService createAPIClassLoader
    INFO: APIClassLoader = java.net.URLClassLoader@59fb8de1
    . . .
    Mar 13, 2009 11:15:10 AM com.sun.grizzly.pool.DynamicPool$1 run
    INFO: New instance created in 10,175 milliseconds
    Mar 13, 2009 11:15:10 AM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: GlassFish v3  startup time : Static(356ms) startup services(11456ms) total(11812ms)

    Very simple and seamless!
The application is now accessible at "http://locahost:3000". The following screen dumps are captured by traversing through different parts of the application:















The next blog will show the last test in this series. The current set of tests are available using the tags rubyonrails+glassfish+integrationtest.

Please leave suggestions on other TOTD (Tip Of The Day) that you'd like to see. A complete archive of all tips is available here.

Technorati: totd rubyonrails glassfish v3 gem jruby sampleapp redmine integrationtest
Comments:

Post a Comment:
Comments are closed for this entry.
About

profile image
Arun Gupta is a technology enthusiast, a passionate runner, author, and a community guy who works for Oracle Corp.


Java EE 7 Samples

Stay Connected

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today