Skip to main content

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

Posted by arungupta on March 16, 2009 at 12:52 PM PDT



href="http://blogs.sun.com/arungupta/entry/totd_70_jruby_and_glassfish">TOTD
#70, href="http://blogs.sun.com/arungupta/entry/totd_71_jruby_and_glassfish">#71,
href="http://blogs.sun.com/arungupta/entry/totd_72_jruby_and_glassfish">#72,
href="http://blogs.sun.com/arungupta/entry/totd_73_jruby_and_glassfish">#73
shows four integration tests that can ensure
that the
latest JRuby and GlassFish versions work nicely with each other.



href="http://blogs.sun.com/arungupta/entry/totd_70_jruby_and_glassfish">#70
showed how to create a trivial Rails application and run it using href="http://rubyforge.org/projects/glassfishgem/">GlassFish
Gem.  href="http://blogs.sun.com/arungupta/entry/totd_71_jruby_and_glassfish">#71
showed how the same application can be deployed on href="https://glassfish.dev.java.net/downloads/v3-prelude.html">GlassFish
v3 Prelude.  href="http://blogs.sun.com/arungupta/entry/totd_72_jruby_and_glassfish">#72
showed how to deploy the same application on GlassFish v3. href="http://blogs.sun.com/arungupta/entry/totd_73_jruby_and_glassfish">#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 href="http://blogs.sun.com/arungupta/entry/redmine_on_glassfish_ruby_on">a
few months ago. The steps have simplified since then :)



Lets begin integration test #5.

  1. Download Redmine 0.8 ...


    style="text-align: left; background-color: rgb(204, 204, 255); width: 100%;"
    cellpadding="2" cellspacing="2">
    /samples/jruby/redmine > style="font-weight: bold;">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:


    style="text-align: left; background-color: rgb(204, 204, 255); width: 100%;"
    cellpadding="2" cellspacing="2">
    ~/samples/jruby/redmine/redmine-0.8 > style="font-weight: bold;">../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 > style="font-weight: bold;">../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:


    style="text-align: left; background-color: rgb(204, 204, 255); width: 100%;"
    cellpadding="2" cellspacing="2">
    ~/samples/jruby/redmine/redmine-0.8 > style="font-weight: bold;">../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:



alt=""
src="http://blogs.sun.com/arungupta/resource/ror/redmine0.8-jruby1.2rc2-gem0.92-main-page.png">



alt=""
src="http://blogs.sun.com/arungupta/resource/ror/redmine0.8-jruby1.2rc2-gem0.92-login.png">



alt=""
src="http://blogs.sun.com/arungupta/resource/ror/redmine0.8-jruby1.2rc2-gem0.92-my-page.png">



alt=""
src="http://blogs.sun.com/arungupta/resource/ror/redmine0.8-jruby1.2rc2-gem0.92-calendar.png">



alt=""
src="http://blogs.sun.com/arungupta/resource/ror/redmine0.8-jruby1.2rc2-gem0.92-add-project.png">



alt=""
src="http://blogs.sun.com/arungupta/resource/ror/redmine0.8-jruby1.2rc2-gem0.92-projects.png">



alt=""
src="http://blogs.sun.com/arungupta/resource/ror/redmine0.8-jruby1.2rc2-gem0.92-admin.png">



The next blog will show the last test in href="http://blogs.sun.com/arungupta/tags/jruby+glassfish+integrationtest">this
series. The current set of tests
are available using the tags href="http://blogs.sun.com/arungupta/tags/jruby+glassfish+integrationtest">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 href="http://blogs.sun.com/arungupta/tags/totd">here.




Technorati: totd
rubyonrails
glassfish
v3 href="http://technorati.com/tags/gem">gem href="http://technorati.com/tag/jruby">jruby href="http://technorati.com/tags/sampleapp">sampleapp
redmine
integrationtest

Related Topics >>

Comments

Hi Aron, i've been reading your posts about redmine on glassfish. I have a question: How can I set the rails environment in glassfish v3 preview? I had to set my development DB with production settings in order to get redmine running, as it always starts in Environment: development. Thanks!