From nobody at rubyforge.org Sun Sep 2 19:22:53 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Sun, 2 Sep 2007 19:22:53 -0400 (EDT) Subject: [Jruby-extras-devel] [731] trunk/rails-integration/plugins/goldspike-snapshot/lib: Merge DSL and Configuration class Message-ID: <20070902232254.10F215240848@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070902/65d15d68/attachment-0001.html From nobody at rubyforge.org Sun Sep 2 19:49:25 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Sun, 2 Sep 2007 19:49:25 -0400 (EDT) Subject: [Jruby-extras-devel] [732] trunk/rails-integration/plugins/goldspike-snapshot/lib/war_config.rb: Tweaks for syntax Message-ID: <20070902234925.3302E5240CB6@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070902/0df3b13d/attachment.html From nobody at rubyforge.org Sun Sep 2 20:27:16 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Sun, 2 Sep 2007 20:27:16 -0400 (EDT) Subject: [Jruby-extras-devel] [733] trunk/rails-integration/plugins/goldspike-snapshot/lib: Tidied up custom tasks Message-ID: <20070903002716.AA9045240E77@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070902/5992f066/attachment.html From nobody at rubyforge.org Sun Sep 2 20:36:41 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Sun, 2 Sep 2007 20:36:41 -0400 (EDT) Subject: [Jruby-extras-devel] [734] trunk/rails-integration/plugins/goldspike-snapshot/lib: Tidy up output messages Message-ID: <20070903003641.B4BDE5240E7F@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070902/463229ef/attachment.html From lehuy_cse at yahoo.com Mon Sep 3 05:44:47 2007 From: lehuy_cse at yahoo.com (Le Huy) Date: Mon, 3 Sep 2007 02:44:47 -0700 (PDT) Subject: [Jruby-extras-devel] ActiveRecord-JDBC 0.5 can not insert object with pre-assigned Id into Oracle Database Message-ID: <777864.70807.qm@web52604.mail.re2.yahoo.com> I have tried ActiveRecord-JDBC 0.5 with Oracle JDBC driver taken from version 10.2.0.3, the only version that supports retrieving auto-generated keys. I encountered error "Invalid column type: getLong not implemented for class oracle.jdbc.driver.T4CRowidAccessor: INSERT INTO emp (empno, comm, hiredate, mgr, deptno, ename, job, sal" inside JdbcAdapterInternalService.execute_insert I end-up with a simple solution that modified ruby code of ActiveRecord-JDBC to avoid using JdbcAdapterInternalService.execute_insert as follows module ActiveRecord class Base def attributes_with_quotes(include_primary_key =true) #:nodoc: aq = attributes_with_quotes_pre_oracle(include_primary_key) if connection.class ==ConnectionAdapters::JdbcAdapter && connection.is_a?(JdbcSpec::Mimer) aq[self.class.primary_key] = "?" if include_primary_key && aq[self.class.primary_key].nil? end if connection.class ==ConnectionAdapters::JdbcAdapter && connection.is_a?(JdbcSpec::Oracle) aq[self.class.primary_key] = "?" if include_primary_key end aq end end end module ::JdbcSpec module Oracle def insert(sql, name = nil, pk = nil, id_value =nil, sequence_name = nil) #:nodoc: if pk.nil? # Who called us? What does the sql look like? No idea! execute sql, name else # Assume the sql contains a bind-variable for the id id_value = select_one("select #{sequence_name}.nextval id from dual")['id'].to_i unless id_value log(sql, name) { @connection.execute_id_insert(sql,id_value) } end id_value end end end Verification code is below require 'rubygems' gem 'ActiveRecord-JDBC','0.5' require 'jdbc_adapter' require 'active_record' ActiveRecord::Base.establish_connection( :adapter => 'jdbc', :driver => 'oracle.jdbc.driver.OracleDriver', :url => 'jdbc:oracle:thin:@localhost:1521:DEV', :username => "scott", :password => "tiger", ) class Emp < ActiveRecord::Base set_table_name 'emp' set_primary_key 'empno' end emp = Emp.new emp.id = 9999 emp.save ____________________________________________________________________________________ Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. http://smallbusiness.yahoo.com/webhosting From nobody at rubyforge.org Tue Sep 4 11:18:44 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Tue, 4 Sep 2007 11:18:44 -0400 (EDT) Subject: [Jruby-extras-devel] [735] trunk/activerecord-jdbc/lib/active_record/connection_adapters/jdbc_adapter.rb: reverted changes made in r728, the commit caused more then 200+ failures Message-ID: <20070904151844.68CD65240D18@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070904/92b2f122/attachment.html From nobody at rubyforge.org Sun Sep 9 19:39:58 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Sun, 9 Sep 2007 19:39:58 -0400 (EDT) Subject: [Jruby-extras-devel] [736] trunk/jparsetree/lib: fixed dumb bug for parse_tree_for_method (arguments were dropped, wrapping scope/body lists were omitted); Message-ID: <20070909233958.20804A970006@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070909/e65db41c/attachment.html From nobody at rubyforge.org Tue Sep 11 01:52:52 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Tue, 11 Sep 2007 01:52:52 -0400 (EDT) Subject: [Jruby-extras-devel] [737] trunk/activerecord-jdbc: - Import drivers for derby, hsqldb, mysql, and postgres Message-ID: <20070911055252.DEDCDA970003@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070911/1297ef7e/attachment-0001.html From nobody at rubyforge.org Tue Sep 11 02:02:59 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Tue, 11 Sep 2007 02:02:59 -0400 (EDT) Subject: [Jruby-extras-devel] [738] trunk/activerecord-jdbc: - Postgres fix: handle schemas (schema.table) in table name Message-ID: <20070911060259.D27DC5240D91@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070911/0dc30944/attachment.html From nobody at rubyforge.org Tue Sep 11 02:08:00 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Tue, 11 Sep 2007 02:08:00 -0400 (EDT) Subject: [Jruby-extras-devel] [739] trunk/activerecord-jdbc/lib/active_record/connection_adapters/jdbc_adapter.rb: Allow JNDI to fall back to JDBC, so that you can use Message-ID: <20070911060800.7302F5240D97@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070911/39f11606/attachment.html From nobody at rubyforge.org Tue Sep 11 02:35:49 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Tue, 11 Sep 2007 02:35:49 -0400 (EDT) Subject: [Jruby-extras-devel] [740] trunk/activerecord-jdbc/drivers/mysql: Add mysql gem packaging Message-ID: <20070911063549.A10EC5240D9A@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070911/2cad823d/attachment-0001.html From nobody at rubyforge.org Sat Sep 15 18:18:05 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Sat, 15 Sep 2007 18:18:05 -0400 (EDT) Subject: [Jruby-extras-devel] [741] trunk/rails-integration/plugins/goldspike/lib: #13963 Fix include_library, patch from Daniel Einspanjer Message-ID: <20070915221805.8EBE25240C04@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070915/ee68d37e/attachment.html From jk at jkraemer.net Thu Sep 20 13:33:57 2007 From: jk at jkraemer.net (Jens Kraemer) Date: Thu, 20 Sep 2007 19:33:57 +0200 Subject: [Jruby-extras-devel] Problem with JBoss: [CachedConnectionManager] Closing a connection for you Message-ID: <20070920173357.GL12727@thunder.jkraemer.net> Hi, I'm using ActiveRecord-JDBC-0.5 in a JRuby/Rails app I'd like to deploy on JBoss (tried with 4.2.1, JDK 1.5). I configured a jndi datasource pointing to an Oracle DB in JBoss which I'm using from my Rails app. Everything appears to work, however JBoss spits out the following error on every request: INFO [CachedConnectionManager] Closing a connection for you. Please close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection at 1d529be java.lang.Throwable: STACKTRACE at org.jboss.resource.connectionmanager.CachedConnectionManager.registerConnection(CachedConnectionManager.java:290) at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:417) at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842) at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) is this a known issue (or is it an issue at all), and how could I close the connection as JBoss tells me? Thanks for any help, Jens -- Jens Kr?mer http://www.jkraemer.net/ - Blog http://www.omdb.org/ - The new free film database From jk at jkraemer.net Thu Sep 20 17:23:09 2007 From: jk at jkraemer.net (Jens Kraemer) Date: Thu, 20 Sep 2007 23:23:09 +0200 Subject: [Jruby-extras-devel] Problem with JBoss: [CachedConnectionManager] Closing a connection for you Message-ID: <20070920212309.GT12727@thunder.jkraemer.net> Hi, I'm using ActiveRecord-JDBC-0.5 in a JRuby/Rails app I'd like to deploy on JBoss (tried with 4.2.1, JDK 1.5). I configured a jndi datasource pointing to an Oracle DB in JBoss which I'm using from my Rails app. Everything appears to work, however JBoss spits out the following error on every request: INFO [CachedConnectionManager] Closing a connection for you. Please close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection at 1d529be java.lang.Throwable: STACKTRACE at org.jboss.resource.connectionmanager.CachedConnectionManager.registerConnection(CachedConnectionManager.java:290) at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:417) at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842) at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) is this a known issue (or is it an issue at all), and how could I close the connection as JBoss tells me? Thanks for any help, Jens -- Jens Kr?mer http://www.jkraemer.net/ - Blog http://www.omdb.org/ - The new free film database From charles.nutter at sun.com Fri Sep 21 01:02:45 2007 From: charles.nutter at sun.com (Charles Oliver Nutter) Date: Fri, 21 Sep 2007 07:02:45 +0200 Subject: [Jruby-extras-devel] Problem with JBoss: [CachedConnectionManager] Closing a connection for you In-Reply-To: <20070920212309.GT12727@thunder.jkraemer.net> References: <20070920212309.GT12727@thunder.jkraemer.net> Message-ID: <46F35075.5070605@sun.com> Jens Kraemer wrote: > Hi, > > I'm using ActiveRecord-JDBC-0.5 in a JRuby/Rails app I'd like to deploy > on JBoss (tried with 4.2.1, JDK 1.5). > > I configured a jndi datasource pointing to an Oracle DB in JBoss which > I'm using from my Rails app. Everything appears to work, however JBoss > spits out the following error on every request: > > INFO [CachedConnectionManager] Closing a connection for you. Please close them yourself: > org.jboss.resource.adapter.jdbc.WrappedConnection at 1d529be > java.lang.Throwable: STACKTRACE > at org.jboss.resource.connectionmanager.CachedConnectionManager.registerConnection(CachedConnectionManager.java:290) > at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:417) > at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842) > at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > is this a known issue (or is it an issue at all), and how could I close > the connection as JBoss tells me? That's unusual...why would it want the connections to be closed after each request anyway? They're supposed to be cached after all. - Charlie From noreply at rubyforge.org Thu Sep 20 14:25:21 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Thu, 20 Sep 2007 14:25:21 -0400 (EDT) Subject: [Jruby-extras-devel] [ jruby-extras-Bugs-14114 ] VerifyError when starting Tomcat Message-ID: <20070920182521.7062B5240DD0@rubyforge.org> Bugs item #14114, was opened at 2007-09-20 20:25 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=7857&aid=14114&group_id=2014 Category: None Group: None Status: Open Resolution: None Priority: 3 Submitted By: Uwe Kubosch (donv) Assigned to: Nobody (None) Summary: VerifyError when starting Tomcat Initial Comment: Hi! I am trying to run my Rails application using JRuby 1.0.1, goldspike and Tomcat 6.0.14 I have generated a war file that is expended in Tomcat, but when tomcat tries to start the app, I get the following error: Exception in thread "ObjectPoolManager" java.lang.VerifyError: (class: org/jruby/ext/openssl/ASN1$ASN1Data, method: toASN1 signature: ()Lorg/bouncycastle/asn1/ASN1Encodable;) Wrong return type in function A full stack trace is attached. Do you have any idea what I can do to fix this? With kind regards, Uwe Kubosch Norway ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=7857&aid=14114&group_id=2014 From noreply at rubyforge.org Thu Sep 20 14:29:34 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Thu, 20 Sep 2007 14:29:34 -0400 (EDT) Subject: [Jruby-extras-devel] [ jruby-extras-Bugs-14114 ] VerifyError when starting Tomcat Message-ID: <20070920182934.6E7725240B59@rubyforge.org> Bugs item #14114, was opened at 2007-09-20 20:25 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=7857&aid=14114&group_id=2014 Category: None Group: None Status: Open Resolution: None Priority: 3 Submitted By: Uwe Kubosch (donv) Assigned to: Nobody (None) Summary: VerifyError when starting Tomcat Initial Comment: Hi! I am trying to run my Rails application using JRuby 1.0.1, goldspike and Tomcat 6.0.14 I have generated a war file that is expended in Tomcat, but when tomcat tries to start the app, I get the following error: Exception in thread "ObjectPoolManager" java.lang.VerifyError: (class: org/jruby/ext/openssl/ASN1$ASN1Data, method: toASN1 signature: ()Lorg/bouncycastle/asn1/ASN1Encodable;) Wrong return type in function A full stack trace is attached. Do you have any idea what I can do to fix this? With kind regards, Uwe Kubosch Norway ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=7857&aid=14114&group_id=2014 From noreply at rubyforge.org Fri Sep 21 01:09:48 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Fri, 21 Sep 2007 01:09:48 -0400 (EDT) Subject: [Jruby-extras-devel] [ jruby-extras-Bugs-14114 ] VerifyError when starting Tomcat Message-ID: <20070921050948.888725240DD0@rubyforge.org> Bugs item #14114, was opened at 2007-09-21 06:25 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=7857&aid=14114&group_id=2014 Category: None Group: None Status: Open Resolution: None Priority: 3 Submitted By: Uwe Kubosch (donv) Assigned to: Nobody (None) Summary: VerifyError when starting Tomcat Initial Comment: Hi! I am trying to run my Rails application using JRuby 1.0.1, goldspike and Tomcat 6.0.14 I have generated a war file that is expended in Tomcat, but when tomcat tries to start the app, I get the following error: Exception in thread "ObjectPoolManager" java.lang.VerifyError: (class: org/jruby/ext/openssl/ASN1$ASN1Data, method: toASN1 signature: ()Lorg/bouncycastle/asn1/ASN1Encodable;) Wrong return type in function A full stack trace is attached. Do you have any idea what I can do to fix this? With kind regards, Uwe Kubosch Norway ---------------------------------------------------------------------- >Comment By: Robert Egglestone (tantalon) Date: 2007-09-21 17:09 Message: It sounds like multiple versions of BouncyCastle are floating around. I'd suggest removing WEB-INF/lib/bc* from the webapp war. I believe the latest snapshot version of the goldspike plugin doesn't add bouncycastle, to avoid this problem. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=7857&aid=14114&group_id=2014 From jk at jkraemer.net Fri Sep 21 04:37:31 2007 From: jk at jkraemer.net (Jens Kraemer) Date: Fri, 21 Sep 2007 10:37:31 +0200 Subject: [Jruby-extras-devel] Problem with JBoss: [CachedConnectionManager] Closing a connection for you In-Reply-To: <46F35075.5070605@sun.com> References: <20070920212309.GT12727@thunder.jkraemer.net> <46F35075.5070605@sun.com> Message-ID: <20070921083731.GW12727@thunder.jkraemer.net> On Fri, Sep 21, 2007 at 07:02:45AM +0200, Charles Oliver Nutter wrote: > Jens Kraemer wrote: > > Hi, > > > > I'm using ActiveRecord-JDBC-0.5 in a JRuby/Rails app I'd like to deploy > > on JBoss (tried with 4.2.1, JDK 1.5). > > > > I configured a jndi datasource pointing to an Oracle DB in JBoss which > > I'm using from my Rails app. Everything appears to work, however JBoss > > spits out the following error on every request: > > > > INFO [CachedConnectionManager] Closing a connection for you. Please close them yourself: > > org.jboss.resource.adapter.jdbc.WrappedConnection at 1d529be > > java.lang.Throwable: STACKTRACE > > at org.jboss.resource.connectionmanager.CachedConnectionManager.registerConnection(CachedConnectionManager.java:290) > > at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:417) > > at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842) > > at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > > > is this a known issue (or is it an issue at all), and how could I close > > the connection as JBoss tells me? > > That's unusual...why would it want the connections to be closed after > each request anyway? They're supposed to be cached after all. yeah, that's what I thought, too. I'll set the debug property of this CachedConnectionManager to false (as that is what causes this connection checking to happen) and see how it works out. cheers, Jens PS: sorry for the double-posting, thought my first message didn't make it through... -- Jens Kr?mer http://www.jkraemer.net/ - Blog http://www.omdb.org/ - The new free film database From matt at harpstar.com Fri Sep 21 10:09:04 2007 From: matt at harpstar.com (Matthew K. Williams) Date: Fri, 21 Sep 2007 10:09:04 -0400 Subject: [Jruby-extras-devel] Problem with JBoss: [CachedConnectionManager] Closing a connection for you In-Reply-To: <46F35075.5070605@sun.com> References: <20070920212309.GT12727@thunder.jkraemer.net> <46F35075.5070605@sun.com> Message-ID: <1190383744.6580.8.camel@hunin.lorelied.org> On Fri, 2007-09-21 at 07:02 +0200, Charles Oliver Nutter wrote: > Jens Kraemer wrote: > > Hi, > > > > I'm using ActiveRecord-JDBC-0.5 in a JRuby/Rails app I'd like to deploy > > on JBoss (tried with 4.2.1, JDK 1.5). > > > > I configured a jndi datasource pointing to an Oracle DB in JBoss which > > I'm using from my Rails app. Everything appears to work, however JBoss > > spits out the following error on every request: > > > > INFO [CachedConnectionManager] Closing a connection for you. Please close them yourself: > > org.jboss.resource.adapter.jdbc.WrappedConnection at 1d529be > > java.lang.Throwable: STACKTRACE > > at org.jboss.resource.connectionmanager.CachedConnectionManager.registerConnection(CachedConnectionManager.java:290) > > at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:417) > > at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842) > > at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > > > is this a known issue (or is it an issue at all), and how could I close > > the connection as JBoss tells me? > > That's unusual...why would it want the connections to be closed after > each request anyway? They're supposed to be cached after all. I get the same thing with derby; I've not had too much chance to look at it yet -- I'm guessing it's endemic to the datasources. I'm thinking that the connection is getting returned to the pool, but if it's supposed to be cached, then that would be a bug. JBoss does have a flag in their datasource definition to check that statements are closed when returned to the pool -- I've got it turned off and am still seeing these messages. That may be what is causing the issue; it's expecting the statements to be closed and they're not. (just did a quick gander of JdbcAdapterInternalService.java and at first glance, it looks as though the statements are closed) One thing which may be another "side-effect" would be that JBoss does close unused connections after 5 minutes, but that seems to be for shrinking the connection pool. From nobody at rubyforge.org Fri Sep 21 15:29:39 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Fri, 21 Sep 2007 15:29:39 -0400 (EDT) Subject: [Jruby-extras-devel] [742] trunk/activerecord-jdbc: Work-in-progress: adapters and drivers Message-ID: <20070921192940.417205240BB0@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070921/3c3e9cde/attachment-0001.html From nobody at rubyforge.org Tue Sep 25 03:40:31 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Tue, 25 Sep 2007 03:40:31 -0400 (EDT) Subject: [Jruby-extras-devel] [743] trunk/rails-integration/src/main/java/org/jruby/webapp: Extracted servlet to run periodical background tasks from Mingle. Message-ID: <20070925074031.9A20B5240F6C@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070925/1e1d8f60/attachment.html From nobody at rubyforge.org Tue Sep 25 11:19:21 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Tue, 25 Sep 2007 11:19:21 -0400 (EDT) Subject: [Jruby-extras-devel] [744] trunk/activerecord-jdbc/lib/jdbc_adapter/jdbc_oracle.rb: Fix several Oracle bugs Message-ID: <20070925151921.AA4155240C6C@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070925/3fb3e719/attachment.html From rvalyi at gmail.com Tue Sep 25 16:28:32 2007 From: rvalyi at gmail.com (=?ISO-8859-1?Q?Rapha=EBl_Valyi?=) Date: Tue, 25 Sep 2007 22:28:32 +0200 Subject: [Jruby-extras-devel] anyone having rspec running completely with JRuby and AR-JDBC (with Rake) ? Message-ID: <806313f00709251328t78d444a2m34e42ee27ed38023@mail.gmail.com> Hi, After installing the rspec Rails plugin, I can run rspec on a specific test file, this runs fine. But I'm unnable to run the rake rspec file: Indeed, if I do: rake rspec, I get: Task not supported by 'jdbc' /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/databases.rake:146:in `raise' /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/rails.rb:4:in `call' /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `execute' /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:362:in `each' ... Looking at gems/rails-1.2.3/lib/tasks/databases.rake, this doesn't surprise me: in the purge task, there is a case abcs[Rcase abcs[RAILS_ENV]["adapter"]AILS_ENV]["adapter"] that test the adapter delared in the database.yml config file. it can match "mysql", "oracle" and others but it will never match "jdbc" which is the adapter you should writte in database.yml to use AR-JDBC. So what can we do? Which one should we patch? I mean, yes I can patch my case abcs[RAILS_ENV]["adapter"], but this is totally hugly. Is that really sustainable to declare a 'jdbc' adapter? If ever I patch those lines to go further I still get a bug later on: NativeException: java.sql.SQLException: Incorrect database name '': DROP DATABASE IF EXISTS `` /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/ActiveRecord-JDBC-0.5/lib/active_record/connection_adapters/jdbc_adapter.rb:550:in `log_no_bench' /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/ActiveRecord-JDBC-0.5/lib/active_record/connection_adapters/jdbc_adapter.rb:471:in `execute' /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/ActiveRecord-JDBC-0.5/lib/jdbc_adapter/jdbc_mysql.rb:115:in `drop_database' /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/ActiveRecord-JDBC-0.5/lib/jdbc_adapter/jdbc_mysql.rb:106:in `recreate_database' /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/databases.rake:120:in `recreate_database' /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/rails.rb:4:in `call' /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `execute' Again I suspect the database.yml is not anymore what is expected (I'm using MySQL, SQL should pass). But I could be wrong on that last one. So anybody having rspec running without problem with JRuby, any hint? Many thanks, Rapha?l Valyi PS: to test rspec I installed things as described here: http://www.railsforum.com/viewtopic.php?pid=35774 in the third post. I'm on JRuby trunk but I think it's unrelated to JRuby (more likely to AR-JDBC integration). -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070925/9c960fc8/attachment.html From nicksieger at gmail.com Tue Sep 25 17:18:51 2007 From: nicksieger at gmail.com (Nick Sieger) Date: Tue, 25 Sep 2007 16:18:51 -0500 Subject: [Jruby-extras-devel] anyone having rspec running completely with JRuby and AR-JDBC (with Rake) ? In-Reply-To: <806313f00709251328t78d444a2m34e42ee27ed38023@mail.gmail.com> References: <806313f00709251328t78d444a2m34e42ee27ed38023@mail.gmail.com> Message-ID: Try copying this [1] into your lib/tasks directory. It switches the db:test:prepare to use migrations to create the test database. [1]: http://svn.caldersphere.net/svn/main/plugins/migrate_testdb/tasks/migrate_testdb.rake /Nick On 9/25/07, Rapha?l Valyi wrote: > Hi, > > After installing the rspec Rails plugin, I can run rspec on a specific test > file, this runs fine. > But I'm unnable to run the rake rspec file: > Indeed, if I do: > rake rspec, I get: > Task not supported by 'jdbc' > /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/databases.rake:146:in > `raise' > /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/rails.rb:4:in > `call' > /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/rake- > 0.7.3/lib/rake.rb:392:in `execute' > /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:362:in > `each' > ... > > > Looking at gems/rails-1.2.3/lib/tasks/databases.rake, this doesn't surprise > me: in the purge task, there is a > case abcs[Rcase > abcs[RAILS_ENV]["adapter"]AILS_ENV]["adapter"] > that test the adapter delared in the database.yml config file. > it can match "mysql", "oracle" and others but it will never match "jdbc" > which is the adapter you should writte in database.yml to use AR-JDBC. > > So what can we do? Which one should we patch? I mean, yes I can patch my > case abcs[RAILS_ENV]["adapter"], but this is totally hugly. Is that really > sustainable to declare a 'jdbc' adapter? > > If ever I patch those lines to go further I still get a bug later on: > NativeException: java.sql.SQLException: Incorrect database name '': DROP > DATABASE IF EXISTS `` > /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/ActiveRecord- > JDBC-0.5/lib/active_record/connection_adapters/jdbc_adapter.rb:550:in > `log_no_bench' > /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/ActiveRecord-JDBC-0.5/lib/active_record/connection_adapters/jdbc_adapter.rb:471:in > `execute' > /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/ActiveRecord-JDBC-0.5/lib/jdbc_adapter/jdbc_mysql.rb:115:in > `drop_database' > /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/ActiveRecord-JDBC-0.5/lib/jdbc_adapter/jdbc_mysql.rb:106:in > `recreate_database' > /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/databases.rake:120:in > `recreate_database' > /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/rails.rb:4:in > `call' > /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/rake- > 0.7.3/lib/rake.rb:392:in `execute' > > Again I suspect the database.yml is not anymore what is expected (I'm using > MySQL, SQL should pass). But I could be wrong on that last one. > So anybody having rspec running without problem with JRuby, any hint? > > Many thanks, > > Rapha?l Valyi > > > PS: to test rspec I installed things as described here: > http://www.railsforum.com/viewtopic.php?pid=35774 in > the third post. > I'm on JRuby trunk but I think it's unrelated to JRuby (more likely to > AR-JDBC integration). > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > From robert at cs.auckland.ac.nz Tue Sep 25 17:27:16 2007 From: robert at cs.auckland.ac.nz (Robert Egglestone) Date: Wed, 26 Sep 2007 09:27:16 +1200 Subject: [Jruby-extras-devel] [743] trunk/rails-integration/src/main/java/org/jruby/webapp: Extracted servlet to run periodical background tasks from Mingle. In-Reply-To: <20070925074031.9A20B5240F6C@rubyforge.org> References: <20070925074031.9A20B5240F6C@rubyforge.org> Message-ID: <46F97D34.90302@cs.auckland.ac.nz> This looks like it would be better as a ServletContextListener, since it doesn't process any servlet requests. Cheers, Robert nobody at rubyforge.org wrote: > > Revision > 743 > Author > tirsen > Date > 2007-09-25 03:40:30 -0400 (Tue, 25 Sep 2007) > > > Log Message > > Extracted servlet to run periodical background tasks from Mingle. Removed the require of rubygems (Mingle does not include rubygems) > > > Modified Paths > > * trunk/rails-integration/src/main/java/org/jruby/webapp/RailsFactory.java > <#trunkrailsintegrationsrcmainjavaorgjrubywebappRailsFactoryjava> > > > Added Paths > > * trunk/rails-integration/src/main/java/org/jruby/webapp/RailsPeriodicalTaskServlet.java > <#trunkrailsintegrationsrcmainjavaorgjrubywebappRailsPeriodicalTaskServletjava> > > > Diff > > > Modified: > trunk/rails-integration/src/main/java/org/jruby/webapp/RailsFactory.java > (742 => 743) > > > --- trunk/rails-integration/src/main/java/org/jruby/webapp/RailsFactory.java 2007-09-21 19:29:39 UTC (rev 742) > +++ trunk/rails-integration/src/main/java/org/jruby/webapp/RailsFactory.java 2007-09-25 07:40:30 UTC (rev 743) > @@ -118,14 +118,6 @@ > // This is done in CustomObjectPool by forcing all object creation though a single thread. > runtime.defineReadonlyVariable("$servlet_context", JavaEmbedUtils.javaToRuby(runtime, context)); > > - // test Gems > - try { > - runtime.getLoadService().require("rubygems"); > - } catch (RaiseException e) { > - logRubyException("Failed to load rubygems", e); > - throw new ServletException("Failed to load rubygems. See the logs for more details."); > - } > - > // start Rails > try { > long startTime = System.currentTimeMillis(); > > > Added: > trunk/rails-integration/src/main/java/org/jruby/webapp/RailsPeriodicalTaskServlet.java > (0 => 743) > > > --- trunk/rails-integration/src/main/java/org/jruby/webapp/RailsPeriodicalTaskServlet.java (rev 0) > +++ trunk/rails-integration/src/main/java/org/jruby/webapp/RailsPeriodicalTaskServlet.java 2007-09-25 07:40:30 UTC (rev 743) > @@ -0,0 +1,97 @@ > +package org.jruby.webapp; > + > +import org.jruby.Ruby; > +import org.jruby.webapp.RailsServlet; > + > +import javax.servlet.ServletConfig; > +import javax.servlet.ServletException; > +import javax.servlet.http.HttpServletRequest; > +import javax.servlet.http.HttpServletResponse; > +import java.io.IOException; > + > +public class RailsPeriodicalTaskServlet extends RailsServlet { > + private String command; > + private int waitBeforeStartSeconds = 30; // wait 30 seconds > + private boolean stop = false; // wait 30 seconds > + private Thread thread = null; > + private int interval = 60; > + private int minIdle = 0; > + private static final int FIFTEEN_MINUTES_IN_MILLIS = 1000 * 60 * 15; > + > + public void init(final ServletConfig servletConfig) throws ServletException { > + super.init(servletConfig); > + > + command = servletConfig.getInitParameter("command"); > + String waitBeforeStartSecondsString = servletConfig.getInitParameter("waitBeforeStartSeconds"); > + if (waitBeforeStartSecondsString != null) { > + waitBeforeStartSeconds = Integer.parseInt(waitBeforeStartSecondsString); > + } > + String minIdleString = servletConfig.getInitParameter("minIdle"); > + if (minIdleString != null) { > + minIdle = Integer.parseInt(minIdleString); > + } > + String intervalSecondsString = servletConfig.getInitParameter("interval"); > + if (intervalSecondsString != null) { > + interval = Integer.parseInt(intervalSecondsString); > + } > + > + thread = new Thread(new Runnable() { > + public void run() { > + try { > + // wait for a little while before starting the task > + // this allow the app server to start serving requests before initializing all tasks > + Thread.sleep(waitBeforeStartSeconds * 1000); > + > + while (!stop) { > + runOnce(); > + Thread.sleep(interval * 1000); // wait for interval > + } > + } catch (InterruptedException e) { > + // break out of loop > + } catch (Exception e) { > + servletConfig.getServletContext().log("Could not start " + command, e); > + } > + } > + }); > + thread.start(); > + } > + > + private void runOnce() throws Exception { > + // run task only if idles are more than required > + // default is 0 which means it will always run > + // (potentially causing another instance to get started) > + if (getRuntimePool().getNumIdle() <= minIdle) { > + return; > + } > + Ruby runtime = null; > + try { > + runtime = (Ruby) getRuntimePool().borrowObject(); > + runtime.evalScript(command); > + getRuntimePool().returnObject(runtime); > + } catch (Exception e) { > + getServletContext().log("Could not execute: " + command, e); > + getRuntimePool().invalidateObject(runtime); > + getServletContext().log(command + " returning JRuby runtime to pool and will restart in 15 minutes."); > + try { > + Thread.sleep(FIFTEEN_MINUTES_IN_MILLIS); > + } catch (InterruptedException ex) { > + // can't do much here ... > + } > + } > + } > + > + public void destroy() { > + stop = true; > + thread.interrupt(); > + try { > + thread.join(); > + } catch (InterruptedException e) { > + } > + > + super.destroy(); > + } > + > + protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { > + throw new ServletException("Not supported"); > + } > +} > ------------------------------------------------------------------------ > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070926/cd6a78e4/attachment.html From rvalyi at gmail.com Tue Sep 25 17:36:49 2007 From: rvalyi at gmail.com (=?ISO-8859-1?Q?Rapha=EBl_Valyi?=) Date: Tue, 25 Sep 2007 23:36:49 +0200 Subject: [Jruby-extras-devel] anyone having rspec running completely with JRuby and AR-JDBC (with Rake) ? In-Reply-To: References: <806313f00709251328t78d444a2m34e42ee27ed38023@mail.gmail.com> Message-ID: <806313f00709251436m2e0816e5x561a8ac5ced79396@mail.gmail.com> fantastic Nick, your task works! Many thanks. I still have troubles with autotest (see jruby -s option), but I think rspec is OK for me now. Rapha?l Valyi. On 9/25/07, Nick Sieger wrote: > > Try copying this [1] into your lib/tasks directory. It switches the > db:test:prepare to use migrations to create the test database. > > [1]: > http://svn.caldersphere.net/svn/main/plugins/migrate_testdb/tasks/migrate_testdb.rake > > /Nick > > On 9/25/07, Rapha?l Valyi wrote: > > Hi, > > > > After installing the rspec Rails plugin, I can run rspec on a specific > test > > file, this runs fine. > > But I'm unnable to run the rake rspec file: > > Indeed, if I do: > > rake rspec, I get: > > Task not supported by 'jdbc' > > /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/rails-1.2.3 > /lib/tasks/databases.rake:146:in > > `raise' > > /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/rails-1.2.3 > /lib/tasks/rails.rb:4:in > > `call' > > /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/rake- > > 0.7.3/lib/rake.rb:392:in `execute' > > /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/rake-0.7.3 > /lib/rake.rb:362:in > > `each' > > ... > > > > > > Looking at gems/rails-1.2.3/lib/tasks/databases.rake, this doesn't > surprise > > me: in the purge task, there is a > > case abcs[Rcase > > abcs[RAILS_ENV]["adapter"]AILS_ENV]["adapter"] > > that test the adapter delared in the database.yml config file. > > it can match "mysql", "oracle" and others but it will never match "jdbc" > > which is the adapter you should writte in database.yml to use AR-JDBC. > > > > So what can we do? Which one should we patch? I mean, yes I can patch my > > case abcs[RAILS_ENV]["adapter"], but this is totally hugly. Is that > really > > sustainable to declare a 'jdbc' adapter? > > > > If ever I patch those lines to go further I still get a bug later on: > > NativeException: java.sql.SQLException: Incorrect database name '': DROP > > DATABASE IF EXISTS `` > > /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/ActiveRecord- > > JDBC-0.5/lib/active_record/connection_adapters/jdbc_adapter.rb:550:in > > `log_no_bench' > > /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/ActiveRecord-JDBC-0.5 > /lib/active_record/connection_adapters/jdbc_adapter.rb:471:in > > `execute' > > /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/ActiveRecord-JDBC-0.5 > /lib/jdbc_adapter/jdbc_mysql.rb:115:in > > `drop_database' > > /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/ActiveRecord-JDBC-0.5 > /lib/jdbc_adapter/jdbc_mysql.rb:106:in > > `recreate_database' > > /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/rails-1.2.3 > /lib/tasks/databases.rake:120:in > > `recreate_database' > > /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/rails-1.2.3 > /lib/tasks/rails.rb:4:in > > `call' > > /home/rvalyi/DEV/jruby/lib/ruby/gems/1.8/gems/rake- > > 0.7.3/lib/rake.rb:392:in `execute' > > > > Again I suspect the database.yml is not anymore what is expected (I'm > using > > MySQL, SQL should pass). But I could be wrong on that last one. > > So anybody having rspec running without problem with JRuby, any hint? > > > > Many thanks, > > > > Rapha?l Valyi > > > > > > PS: to test rspec I installed things as described here: > > http://www.railsforum.com/viewtopic.php?pid=35774 in > > the third post. > > I'm on JRuby trunk but I think it's unrelated to JRuby (more likely to > > AR-JDBC integration). > > > > _______________________________________________ > > Jruby-extras-devel mailing list > > Jruby-extras-devel at rubyforge.org > > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070925/5e598e25/attachment.html From jon at tirsen.com Tue Sep 25 19:45:29 2007 From: jon at tirsen.com (Jon Tirsen) Date: Wed, 26 Sep 2007 09:45:29 +1000 Subject: [Jruby-extras-devel] [743] trunk/rails-integration/src/main/java/org/jruby/webapp: Extracted servlet to run periodical background tasks from Mingle. In-Reply-To: <46F97D34.90302@cs.auckland.ac.nz> References: <20070925074031.9A20B5240F6C@rubyforge.org> <46F97D34.90302@cs.auckland.ac.nz> Message-ID: <9260c1550709251645m69d6602oedb0144f9de54da4@mail.gmail.com> Yeah, good point. Both this and the RailsTaskServlet could probably be refactored into context listeners. I'll see if I have time to do that. On 9/26/07, Robert Egglestone wrote: > > This looks like it would be better as a ServletContextListener, since it > doesn't process any servlet requests. > > Cheers, > Robert > > > nobody at rubyforge.org wrote: > > Revision 743 Author tirsen Date 2007-09-25 03:40:30 -0400 (Tue, 25 Sep > 2007) > Log Message Extracted servlet to run periodical background tasks from > Mingle. Removed the require of rubygems (Mingle does not include rubygems) > > Modified Paths > > trunk/rails-integration/src/main/java/org/jruby/webapp/RailsFactory.java > Added Paths > > trunk/rails-integration/src/main/java/org/jruby/webapp/RailsPeriodicalTaskServlet.java > > Diff > > Modified: > trunk/rails-integration/src/main/java/org/jruby/webapp/RailsFactory.java > (742 => 743) > --- > trunk/rails-integration/src/main/java/org/jruby/webapp/RailsFactory.java > 2007-09-21 19:29:39 UTC (rev 742) > +++ > trunk/rails-integration/src/main/java/org/jruby/webapp/RailsFactory.java > 2007-09-25 07:40:30 UTC (rev 743) > @@ -118,14 +118,6 @@ > // This is done in CustomObjectPool by forcing all object creation though a > single thread. > runtime.defineReadonlyVariable("$servlet_context", > JavaEmbedUtils.javaToRuby(runtime, context)); > > - // test Gems > - try { > - runtime.getLoadService().require("rubygems"); > - } catch (RaiseException e) { > - logRubyException("Failed to load rubygems", e); > - throw new ServletException("Failed to load rubygems. See the logs for more > details."); > - } > - > // start Rails > try { > long startTime = System.currentTimeMillis(); > > > > Added: > trunk/rails-integration/src/main/java/org/jruby/webapp/RailsPeriodicalTaskServlet.java > (0 => 743) > --- > trunk/rails-integration/src/main/java/org/jruby/webapp/RailsPeriodicalTaskServlet.java > (rev 0) > +++ > trunk/rails-integration/src/main/java/org/jruby/webapp/RailsPeriodicalTaskServlet.java > 2007-09-25 07:40:30 UTC (rev 743) > @@ -0,0 +1,97 @@ > +package org.jruby.webapp; > + > +import org.jruby.Ruby; > +import org.jruby.webapp.RailsServlet; > + > +import javax.servlet.ServletConfig; > +import javax.servlet.ServletException; > +import javax.servlet.http.HttpServletRequest; > +import javax.servlet.http.HttpServletResponse; > +import java.io.IOException; > + > +public class RailsPeriodicalTaskServlet extends RailsServlet { > + private String command; > + private int waitBeforeStartSeconds = 30; // wait 30 seconds > + private boolean stop = false; // wait 30 seconds > + private Thread thread = null; > + private int interval = 60; > + private int minIdle = 0; > + private static final int FIFTEEN_MINUTES_IN_MILLIS = 1000 * 60 * 15; > + > + public void init(final ServletConfig servletConfig) throws > ServletException { > + super.init(servletConfig); > + > + command = servletConfig.getInitParameter("command"); > + String waitBeforeStartSecondsString = > servletConfig.getInitParameter("waitBeforeStartSeconds"); > + if (waitBeforeStartSecondsString != null) { > + waitBeforeStartSeconds = Integer.parseInt(waitBeforeStartSecondsString); > + } > + String minIdleString = servletConfig.getInitParameter("minIdle"); > + if (minIdleString != null) { > + minIdle = Integer.parseInt(minIdleString); > + } > + String intervalSecondsString = servletConfig.getInitParameter("interval"); > + if (intervalSecondsString != null) { > + interval = Integer.parseInt(intervalSecondsString); > + } > + > + thread = new Thread(new Runnable() { > + public void run() { > + try { > + // wait for a little while before starting the task > + // this allow the app server to start serving requests before initializing > all tasks > + Thread.sleep(waitBeforeStartSeconds * 1000); > + > + while (!stop) { > + runOnce(); > + Thread.sleep(interval * 1000); // wait for interval > + } > + } catch (InterruptedException e) { > + // break out of loop > + } catch (Exception e) { > + servletConfig.getServletContext().log("Could not start " + command, e); > + } > + } > + }); > + thread.start(); > + } > + > + private void runOnce() throws Exception { > + // run task only if idles are more than required > + // default is 0 which means it will always run > + // (potentially causing another instance to get started) > + if (getRuntimePool().getNumIdle() <= minIdle) { > + return; > + } > + Ruby runtime = null; > + try { > + runtime = (Ruby) getRuntimePool().borrowObject(); > + runtime.evalScript(command); > + getRuntimePool().returnObject(runtime); > + } catch (Exception e) { > + getServletContext().log("Could not execute: " + command, e); > + getRuntimePool().invalidateObject(runtime); > + getServletContext().log(command + " returning JRuby runtime to pool and > will restart in 15 minutes."); > + try { > + Thread.sleep(FIFTEEN_MINUTES_IN_MILLIS); > + } catch (InterruptedException ex) { > + // can't do much here ... > + } > + } > + } > + > + public void destroy() { > + stop = true; > + thread.interrupt(); > + try { > + thread.join(); > + } catch (InterruptedException e) { > + } > + > + super.destroy(); > + } > + > + protected void service(HttpServletRequest request, HttpServletResponse > response) throws ServletException, IOException { > + throw new ServletException("Not supported"); > + } > +} > > ________________________________ > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > From jon at tirsen.com Tue Sep 25 19:46:06 2007 From: jon at tirsen.com (Jon Tirsen) Date: Wed, 26 Sep 2007 09:46:06 +1000 Subject: [Jruby-extras-devel] [743] trunk/rails-integration/src/main/java/org/jruby/webapp: Extracted servlet to run periodical background tasks from Mingle. In-Reply-To: <9260c1550709251645m69d6602oedb0144f9de54da4@mail.gmail.com> References: <20070925074031.9A20B5240F6C@rubyforge.org> <46F97D34.90302@cs.auckland.ac.nz> <9260c1550709251645m69d6602oedb0144f9de54da4@mail.gmail.com> Message-ID: <9260c1550709251646i7ddef81ap390f891191b5859d@mail.gmail.com> Hmm... Actually the biggest problem is init-params. Can context listeners accept init-params these days? On 9/26/07, Jon Tirsen wrote: > Yeah, good point. Both this and the RailsTaskServlet could probably be > refactored into context listeners. I'll see if I have time to do that. > > On 9/26/07, Robert Egglestone wrote: > > > > This looks like it would be better as a ServletContextListener, since it > > doesn't process any servlet requests. > > > > Cheers, > > Robert > > > > > > nobody at rubyforge.org wrote: > > > > Revision 743 Author tirsen Date 2007-09-25 03:40:30 -0400 (Tue, 25 Sep > > 2007) > > Log Message Extracted servlet to run periodical background tasks from > > Mingle. Removed the require of rubygems (Mingle does not include rubygems) > > > > Modified Paths > > > > trunk/rails-integration/src/main/java/org/jruby/webapp/RailsFactory.java > > Added Paths > > > > trunk/rails-integration/src/main/java/org/jruby/webapp/RailsPeriodicalTaskServlet.java > > > > Diff > > > > Modified: > > trunk/rails-integration/src/main/java/org/jruby/webapp/RailsFactory.java > > (742 => 743) > > --- > > trunk/rails-integration/src/main/java/org/jruby/webapp/RailsFactory.java > > 2007-09-21 19:29:39 UTC (rev 742) > > +++ > > trunk/rails-integration/src/main/java/org/jruby/webapp/RailsFactory.java > > 2007-09-25 07:40:30 UTC (rev 743) > > @@ -118,14 +118,6 @@ > > // This is done in CustomObjectPool by forcing all object creation though a > > single thread. > > runtime.defineReadonlyVariable("$servlet_context", > > JavaEmbedUtils.javaToRuby(runtime, context)); > > > > - // test Gems > > - try { > > - runtime.getLoadService().require("rubygems"); > > - } catch (RaiseException e) { > > - logRubyException("Failed to load rubygems", e); > > - throw new ServletException("Failed to load rubygems. See the logs for more > > details."); > > - } > > - > > // start Rails > > try { > > long startTime = System.currentTimeMillis(); > > > > > > > > Added: > > trunk/rails-integration/src/main/java/org/jruby/webapp/RailsPeriodicalTaskServlet.java > > (0 => 743) > > --- > > trunk/rails-integration/src/main/java/org/jruby/webapp/RailsPeriodicalTaskServlet.java > > (rev 0) > > +++ > > trunk/rails-integration/src/main/java/org/jruby/webapp/RailsPeriodicalTaskServlet.java > > 2007-09-25 07:40:30 UTC (rev 743) > > @@ -0,0 +1,97 @@ > > +package org.jruby.webapp; > > + > > +import org.jruby.Ruby; > > +import org.jruby.webapp.RailsServlet; > > + > > +import javax.servlet.ServletConfig; > > +import javax.servlet.ServletException; > > +import javax.servlet.http.HttpServletRequest; > > +import javax.servlet.http.HttpServletResponse; > > +import java.io.IOException; > > + > > +public class RailsPeriodicalTaskServlet extends RailsServlet { > > + private String command; > > + private int waitBeforeStartSeconds = 30; // wait 30 seconds > > + private boolean stop = false; // wait 30 seconds > > + private Thread thread = null; > > + private int interval = 60; > > + private int minIdle = 0; > > + private static final int FIFTEEN_MINUTES_IN_MILLIS = 1000 * 60 * 15; > > + > > + public void init(final ServletConfig servletConfig) throws > > ServletException { > > + super.init(servletConfig); > > + > > + command = servletConfig.getInitParameter("command"); > > + String waitBeforeStartSecondsString = > > servletConfig.getInitParameter("waitBeforeStartSeconds"); > > + if (waitBeforeStartSecondsString != null) { > > + waitBeforeStartSeconds = Integer.parseInt(waitBeforeStartSecondsString); > > + } > > + String minIdleString = servletConfig.getInitParameter("minIdle"); > > + if (minIdleString != null) { > > + minIdle = Integer.parseInt(minIdleString); > > + } > > + String intervalSecondsString = servletConfig.getInitParameter("interval"); > > + if (intervalSecondsString != null) { > > + interval = Integer.parseInt(intervalSecondsString); > > + } > > + > > + thread = new Thread(new Runnable() { > > + public void run() { > > + try { > > + // wait for a little while before starting the task > > + // this allow the app server to start serving requests before initializing > > all tasks > > + Thread.sleep(waitBeforeStartSeconds * 1000); > > + > > + while (!stop) { > > + runOnce(); > > + Thread.sleep(interval * 1000); // wait for interval > > + } > > + } catch (InterruptedException e) { > > + // break out of loop > > + } catch (Exception e) { > > + servletConfig.getServletContext().log("Could not start " + command, e); > > + } > > + } > > + }); > > + thread.start(); > > + } > > + > > + private void runOnce() throws Exception { > > + // run task only if idles are more than required > > + // default is 0 which means it will always run > > + // (potentially causing another instance to get started) > > + if (getRuntimePool().getNumIdle() <= minIdle) { > > + return; > > + } > > + Ruby runtime = null; > > + try { > > + runtime = (Ruby) getRuntimePool().borrowObject(); > > + runtime.evalScript(command); > > + getRuntimePool().returnObject(runtime); > > + } catch (Exception e) { > > + getServletContext().log("Could not execute: " + command, e); > > + getRuntimePool().invalidateObject(runtime); > > + getServletContext().log(command + " returning JRuby runtime to pool and > > will restart in 15 minutes."); > > + try { > > + Thread.sleep(FIFTEEN_MINUTES_IN_MILLIS); > > + } catch (InterruptedException ex) { > > + // can't do much here ... > > + } > > + } > > + } > > + > > + public void destroy() { > > + stop = true; > > + thread.interrupt(); > > + try { > > + thread.join(); > > + } catch (InterruptedException e) { > > + } > > + > > + super.destroy(); > > + } > > + > > + protected void service(HttpServletRequest request, HttpServletResponse > > response) throws ServletException, IOException { > > + throw new ServletException("Not supported"); > > + } > > +} > > > > ________________________________ > > > > _______________________________________________ > > Jruby-extras-devel mailing list > > Jruby-extras-devel at rubyforge.org > > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > > _______________________________________________ > > Jruby-extras-devel mailing list > > Jruby-extras-devel at rubyforge.org > > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > > > From robert at cs.auckland.ac.nz Tue Sep 25 19:56:23 2007 From: robert at cs.auckland.ac.nz (Robert Egglestone) Date: Wed, 26 Sep 2007 11:56:23 +1200 Subject: [Jruby-extras-devel] [743] trunk/rails-integration/src/main/java/org/jruby/webapp: Extracted servlet to run periodical background tasks from Mingle. In-Reply-To: <9260c1550709251646i7ddef81ap390f891191b5859d@mail.gmail.com> References: <20070925074031.9A20B5240F6C@rubyforge.org> <46F97D34.90302@cs.auckland.ac.nz> <9260c1550709251645m69d6602oedb0144f9de54da4@mail.gmail.com> <9260c1550709251646i7ddef81ap390f891191b5859d@mail.gmail.com> Message-ID: <46F9A027.9040208@cs.auckland.ac.nz> They can get per-webapp context-params from web.xml, but I can't see any type of per-listener parameter. Jon Tirsen wrote: > Hmm... Actually the biggest problem is init-params. Can context > listeners accept init-params these days? > > On 9/26/07, Jon Tirsen wrote: > >> Yeah, good point. Both this and the RailsTaskServlet could probably be >> refactored into context listeners. I'll see if I have time to do that. >> >> On 9/26/07, Robert Egglestone wrote: >> >>> This looks like it would be better as a ServletContextListener, since it >>> doesn't process any servlet requests. >>> >>> Cheers, >>> Robert >>> >>> >>> nobody at rubyforge.org wrote: >>> >>> Revision 743 Author tirsen Date 2007-09-25 03:40:30 -0400 (Tue, 25 Sep >>> 2007) >>> Log Message Extracted servlet to run periodical background tasks from >>> Mingle. Removed the require of rubygems (Mingle does not include rubygems) >>> >>> Modified Paths >>> >>> trunk/rails-integration/src/main/java/org/jruby/webapp/RailsFactory.java >>> Added Paths >>> >>> trunk/rails-integration/src/main/java/org/jruby/webapp/RailsPeriodicalTaskServlet.java >>> >>> Diff >>> >>> Modified: >>> trunk/rails-integration/src/main/java/org/jruby/webapp/RailsFactory.java >>> (742 => 743) >>> --- >>> trunk/rails-integration/src/main/java/org/jruby/webapp/RailsFactory.java >>> 2007-09-21 19:29:39 UTC (rev 742) >>> +++ >>> trunk/rails-integration/src/main/java/org/jruby/webapp/RailsFactory.java >>> 2007-09-25 07:40:30 UTC (rev 743) >>> @@ -118,14 +118,6 @@ >>> // This is done in CustomObjectPool by forcing all object creation though a >>> single thread. >>> runtime.defineReadonlyVariable("$servlet_context", >>> JavaEmbedUtils.javaToRuby(runtime, context)); >>> >>> - // test Gems >>> - try { >>> - runtime.getLoadService().require("rubygems"); >>> - } catch (RaiseException e) { >>> - logRubyException("Failed to load rubygems", e); >>> - throw new ServletException("Failed to load rubygems. See the logs for more >>> details."); >>> - } >>> - >>> // start Rails >>> try { >>> long startTime = System.currentTimeMillis(); >>> >>> >>> >>> Added: >>> trunk/rails-integration/src/main/java/org/jruby/webapp/RailsPeriodicalTaskServlet.java >>> (0 => 743) >>> --- >>> trunk/rails-integration/src/main/java/org/jruby/webapp/RailsPeriodicalTaskServlet.java >>> (rev 0) >>> +++ >>> trunk/rails-integration/src/main/java/org/jruby/webapp/RailsPeriodicalTaskServlet.java >>> 2007-09-25 07:40:30 UTC (rev 743) >>> @@ -0,0 +1,97 @@ >>> +package org.jruby.webapp; >>> + >>> +import org.jruby.Ruby; >>> +import org.jruby.webapp.RailsServlet; >>> + >>> +import javax.servlet.ServletConfig; >>> +import javax.servlet.ServletException; >>> +import javax.servlet.http.HttpServletRequest; >>> +import javax.servlet.http.HttpServletResponse; >>> +import java.io.IOException; >>> + >>> +public class RailsPeriodicalTaskServlet extends RailsServlet { >>> + private String command; >>> + private int waitBeforeStartSeconds = 30; // wait 30 seconds >>> + private boolean stop = false; // wait 30 seconds >>> + private Thread thread = null; >>> + private int interval = 60; >>> + private int minIdle = 0; >>> + private static final int FIFTEEN_MINUTES_IN_MILLIS = 1000 * 60 * 15; >>> + >>> + public void init(final ServletConfig servletConfig) throws >>> ServletException { >>> + super.init(servletConfig); >>> + >>> + command = servletConfig.getInitParameter("command"); >>> + String waitBeforeStartSecondsString = >>> servletConfig.getInitParameter("waitBeforeStartSeconds"); >>> + if (waitBeforeStartSecondsString != null) { >>> + waitBeforeStartSeconds = Integer.parseInt(waitBeforeStartSecondsString); >>> + } >>> + String minIdleString = servletConfig.getInitParameter("minIdle"); >>> + if (minIdleString != null) { >>> + minIdle = Integer.parseInt(minIdleString); >>> + } >>> + String intervalSecondsString = servletConfig.getInitParameter("interval"); >>> + if (intervalSecondsString != null) { >>> + interval = Integer.parseInt(intervalSecondsString); >>> + } >>> + >>> + thread = new Thread(new Runnable() { >>> + public void run() { >>> + try { >>> + // wait for a little while before starting the task >>> + // this allow the app server to start serving requests before initializing >>> all tasks >>> + Thread.sleep(waitBeforeStartSeconds * 1000); >>> + >>> + while (!stop) { >>> + runOnce(); >>> + Thread.sleep(interval * 1000); // wait for interval >>> + } >>> + } catch (InterruptedException e) { >>> + // break out of loop >>> + } catch (Exception e) { >>> + servletConfig.getServletContext().log("Could not start " + command, e); >>> + } >>> + } >>> + }); >>> + thread.start(); >>> + } >>> + >>> + private void runOnce() throws Exception { >>> + // run task only if idles are more than required >>> + // default is 0 which means it will always run >>> + // (potentially causing another instance to get started) >>> + if (getRuntimePool().getNumIdle() <= minIdle) { >>> + return; >>> + } >>> + Ruby runtime = null; >>> + try { >>> + runtime = (Ruby) getRuntimePool().borrowObject(); >>> + runtime.evalScript(command); >>> + getRuntimePool().returnObject(runtime); >>> + } catch (Exception e) { >>> + getServletContext().log("Could not execute: " + command, e); >>> + getRuntimePool().invalidateObject(runtime); >>> + getServletContext().log(command + " returning JRuby runtime to pool and >>> will restart in 15 minutes."); >>> + try { >>> + Thread.sleep(FIFTEEN_MINUTES_IN_MILLIS); >>> + } catch (InterruptedException ex) { >>> + // can't do much here ... >>> + } >>> + } >>> + } >>> + >>> + public void destroy() { >>> + stop = true; >>> + thread.interrupt(); >>> + try { >>> + thread.join(); >>> + } catch (InterruptedException e) { >>> + } >>> + >>> + super.destroy(); >>> + } >>> + >>> + protected void service(HttpServletRequest request, HttpServletResponse >>> response) throws ServletException, IOException { >>> + throw new ServletException("Not supported"); >>> + } >>> +} >>> >>> ________________________________ >>> >>> _______________________________________________ >>> Jruby-extras-devel mailing list >>> Jruby-extras-devel at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>> >>> _______________________________________________ >>> Jruby-extras-devel mailing list >>> Jruby-extras-devel at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/jruby-extras-devel >>> >>> > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070926/092a1d6f/attachment.html From nobody at rubyforge.org Wed Sep 26 08:01:31 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Wed, 26 Sep 2007 08:01:31 -0400 (EDT) Subject: [Jruby-extras-devel] [745] trunk/activerecord-jdbc: Fix several small issues with Oracle. Message-ID: <20070926120131.D54505240B73@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070926/bf715298/attachment-0001.html From nobody at rubyforge.org Wed Sep 26 08:43:55 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Wed, 26 Sep 2007 08:43:55 -0400 (EDT) Subject: [Jruby-extras-devel] [746] trunk/activerecord-jdbc/lib/jdbc_adapter/jdbc_oracle.rb: Fix several more Oracle problems, bringing us down to 12F7E Message-ID: <20070926124355.336C95240A6C@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070926/af348465/attachment.html From nobody at rubyforge.org Wed Sep 26 09:27:54 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Wed, 26 Sep 2007 09:27:54 -0400 (EDT) Subject: [Jruby-extras-devel] [747] trunk/activerecord-jdbc/src/java/JdbcAdapterInternalService.java: Handle Oracle's new, stupid recyclebin feature, that in some broken JDBC drivers is returned when getting tables. Message-ID: <20070926132754.A33085240AC1@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070926/12460d9e/attachment.html From nobody at rubyforge.org Wed Sep 26 10:51:33 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Wed, 26 Sep 2007 10:51:33 -0400 (EDT) Subject: [Jruby-extras-devel] [748] trunk/jopenssl/src/java/org/jruby/ext/openssl/SSLSocket.java: JRUBY-1310: file descriptor leak (by T Meyarivan) Message-ID: <20070926145133.AA3AD5240B37@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070926/91b14af2/attachment.html From nobody at rubyforge.org Wed Sep 26 11:39:33 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Wed, 26 Sep 2007 11:39:33 -0400 (EDT) Subject: [Jruby-extras-devel] [749] trunk/activerecord-jdbc/lib/jdbc_adapter/jdbc_oracle.rb: Some small fixes for Oracle with regard to binary types Message-ID: <20070926153934.03D615240B51@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070926/26399bbc/attachment.html From nobody at rubyforge.org Wed Sep 26 11:51:37 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Wed, 26 Sep 2007 11:51:37 -0400 (EDT) Subject: [Jruby-extras-devel] [750] trunk/activerecord-jdbc/lib/jdbc_adapter: Fix so that adapters handle quoted_id correctly. Message-ID: <20070926155138.05D395240B51@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070926/557ac4bf/attachment-0001.html From nobody at rubyforge.org Wed Sep 26 12:31:58 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Wed, 26 Sep 2007 12:31:58 -0400 (EDT) Subject: [Jruby-extras-devel] [751] trunk/activerecord-jdbc/lib/jdbc_adapter/jdbc_oracle.rb: Handle a test sending in a symbol as column name correctly in Oracle Message-ID: <20070926163158.DB0895240B12@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070926/776359eb/attachment.html From nobody at rubyforge.org Wed Sep 26 13:03:58 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Wed, 26 Sep 2007 13:03:58 -0400 (EDT) Subject: [Jruby-extras-devel] [752] trunk/activerecord-jdbc/src/java/JdbcAdapterInternalService.java: Fixing stupid handling of Rails dates (probably based on MySQL handling...). Message-ID: <20070926170358.4A52E5240B65@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070926/aa921227/attachment.html From nobody at rubyforge.org Wed Sep 26 14:22:46 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Wed, 26 Sep 2007 14:22:46 -0400 (EDT) Subject: [Jruby-extras-devel] [753] trunk/activerecord-jdbc/src/java/JdbcAdapterInternalService.java: Fix the last Oracle issues Message-ID: <20070926182246.E7C2B5240BB4@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070926/b4e839a7/attachment.html From ola.bini at gmail.com Wed Sep 26 14:33:23 2007 From: ola.bini at gmail.com (Ola Bini) Date: Wed, 26 Sep 2007 19:33:23 +0100 Subject: [Jruby-extras-devel] Oracle passes all tests Message-ID: <46FAA5F3.60603@gmail.com> Hi guys, After two grueling days I've made Oracle pass ALL ActiveRecord tests. (For stable) As you may know, this involves some changes to the tests to make them more friendly for AR-JDBC. The patch attached will let you achieve the same thing. It's attuned for MySQL and Oracle specifically. In most cases the changes are to handle hash-order-dependent tests. In a few cases I've changed the logic to check for our versions of the adapters instead of the AR standard adapters. This can mostly be found in the current_adapter? method in abstract_test.rb No changes in logic have been needed. You will notice that the binary fixtures tests is commented out for Oracle. This is because it's actually broken with MRI too on stable. Cheers -- Ola Bini (http://ola-bini.blogspot.com) JRuby Core Developer Developer, ThoughtWorks Studios (http://studios.thoughtworks.com) Practical JRuby on Rails (http://apress.com/book/view/9781590598818) "Yields falsehood when quined" yields falsehood when quined. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: activerecord_modifications_to_pass_jdbc.patch Url: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070926/cd39cae3/attachment.pl From nicksieger at gmail.com Wed Sep 26 22:33:45 2007 From: nicksieger at gmail.com (Nick Sieger) Date: Wed, 26 Sep 2007 21:33:45 -0500 Subject: [Jruby-extras-devel] Oracle passes all tests In-Reply-To: <46FAA5F3.60603@gmail.com> References: <46FAA5F3.60603@gmail.com> Message-ID: This AR test patch worth posting to Rails trac? I'll +1 it if you do. /Nick On 9/26/07, Ola Bini wrote: > Hi guys, > > After two grueling days I've made Oracle pass ALL ActiveRecord tests. > (For stable) > > As you may know, this involves some changes to the tests to make them > more friendly for AR-JDBC. The patch attached will let you achieve the > same thing. It's attuned for MySQL and Oracle specifically. > > In most cases the changes are to handle hash-order-dependent tests. In a > few cases I've changed the logic to check for our versions of the > adapters instead of the AR standard adapters. This can mostly be found > in the current_adapter? method in abstract_test.rb > > > No changes in logic have been needed. You will notice that the binary > fixtures tests is commented out for Oracle. This is because it's > actually broken with MRI too on stable. > > Cheers > > -- > Ola Bini (http://ola-bini.blogspot.com) > JRuby Core Developer > Developer, ThoughtWorks Studios (http://studios.thoughtworks.com) > Practical JRuby on Rails (http://apress.com/book/view/9781590598818) > > "Yields falsehood when quined" yields falsehood when quined. > > > > Index: test/associations_test.rb > =================================================================== > --- test/associations_test.rb (revision 7628) > +++ test/associations_test.rb (working copy) > @@ -1154,7 +1154,7 @@ > assert_nil c.firm_with_basic_id > > c.firm_id = 1 > - assert_equal Firm.find(:first), c.firm_with_basic_id > + assert_equal Firm.find(1), c.firm_with_basic_id > end > > def test_field_name_same_as_foreign_key > @@ -1487,6 +1487,7 @@ > assert_equal 2, ken.projects(true).size > > kenReloaded = Developer.find_by_name 'Ken' > + > kenReloaded.projects.each {|prj| assert_date_from_db(now, prj.joined_on)} > end > > Index: test/fixtures_test.rb > =================================================================== > --- test/fixtures_test.rb (revision 7628) > +++ test/fixtures_test.rb (working copy) > @@ -1,4 +1,5 @@ > require 'abstract_unit' > +require 'fixtures/binary' > require 'fixtures/topic' > require 'fixtures/developer' > require 'fixtures/company' > @@ -185,10 +186,12 @@ > assert_equal(categories(:sub_special_3).class, SpecialCategory) > end > > - def test_binary_in_fixtures > - assert_equal 1, @binaries.size > - data = File.read(BINARY_FIXTURE_PATH).freeze > - assert_equal data, @flowers.data > + unless current_adapter? :OracleAdapter > + def test_binary_in_fixtures > + assert_equal 1, @binaries.size > + data = File.read(BINARY_FIXTURE_PATH).freeze > + assert_equal data, @flowers.data > + end > end > end > > Index: test/base_test.rb > =================================================================== > --- test/base_test.rb (revision 7628) > +++ test/base_test.rb (working copy) > @@ -1455,7 +1455,7 @@ > assert xml.include?(%(Have a nice day)) > assert xml.include?(%(david at loudthinking.com)) > assert xml.match(%()) > - if current_adapter?(:SybaseAdapter, :SQLServerAdapter, :OracleAdapter) > + if current_adapter?(:SybaseAdapter, :SQLServerAdapter, :OracleAdapter) > assert xml.include?(%(#{last_read_in_current_timezone})) > else > assert xml.include?(%(2004-04-15)) > @@ -1543,19 +1543,19 @@ > > def test_except_attributes > assert_equal( > - %w( author_name type id approved replies_count bonus_time written_on content author_email_address parent_id last_read), > - topics(:first).attributes(:except => :title).keys > + %w(author_name type id approved replies_count bonus_time written_on content author_email_address parent_id last_read).sort, > + topics(:first).attributes(:except => :title).keys.sort > ) > > assert_equal( > - %w( replies_count bonus_time written_on content author_email_address parent_id last_read), > - topics(:first).attributes(:except => [ :title, :id, :type, :approved, :author_name ]).keys > + %w( replies_count bonus_time written_on content author_email_address parent_id last_read).sort, > + topics(:first).attributes(:except => [ :title, :id, :type, :approved, :author_name ]).keys.sort > ) > end > > def test_include_attributes > assert_equal(%w( title ), topics(:first).attributes(:only => :title).keys) > - assert_equal(%w( title author_name type id approved ), topics(:first).attributes(:only => [ :title, :id, :type, :approved, :author_name ]).keys) > + assert_equal(%w( title author_name type id approved ).sort, topics(:first).attributes(:only => [ :title, :id, :type, :approved, :author_name ]).keys.sort) > end > > def test_type_name_with_module_should_handle_beginning > Index: test/active_schema_test_mysql.rb > =================================================================== > --- test/active_schema_test_mysql.rb (revision 7628) > +++ test/active_schema_test_mysql.rb (working copy) > @@ -2,14 +2,14 @@ > > class ActiveSchemaTest < Test::Unit::TestCase > def setup > - ActiveRecord::ConnectionAdapters::MysqlAdapter.class_eval do > + ActiveRecord::Base.connection.class.class_eval do > alias_method :real_execute, :execute > def execute(sql, name = nil) return sql end > end > end > > def teardown > - ActiveRecord::ConnectionAdapters::MysqlAdapter.send(:alias_method, :execute, :real_execute) > + ActiveRecord::Base.connection.class.send(:alias_method, :execute, :real_execute) > end > > def test_drop_table > @@ -28,4 +28,4 @@ > def method_missing(method_symbol, *arguments) > ActiveRecord::Base.connection.send(method_symbol, *arguments) > end > -end > \ No newline at end of file > +end > Index: test/abstract_unit.rb > =================================================================== > --- test/abstract_unit.rb (revision 7628) > +++ test/abstract_unit.rb (working copy) > @@ -55,8 +55,15 @@ > > def current_adapter?(*types) > types.any? do |type| > - ActiveRecord::ConnectionAdapters.const_defined?(type) && > - ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters.const_get(type)) > + if defined?(JRUBY_VERSION) > + case type > + when :OracleAdapter: ActiveRecord::Base.connection.is_a?(JdbcSpec::Oracle) > + when :MysqlAdapter: ActiveRecord::Base.connection.is_a?(JdbcSpec::MySQL) > + end > + else > + ActiveRecord::ConnectionAdapters.const_defined?(type) && > + ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters.const_get(type)) > + end > end > end > > @@ -65,7 +72,7 @@ > > # Array of regexes of queries that are not counted against query_count > @@ignore_list = [/^SELECT currval/, /^SELECT CAST/, /^SELECT @@IDENTITY/] > - > + > alias_method :execute_without_query_counting, :execute > def execute_with_query_counting(sql, name = nil, &block) > self.query_count += 1 unless @@ignore_list.any? { |r| sql =~ r } > Index: test/finder_test.rb > =================================================================== > --- test/finder_test.rb (revision 7628) > +++ test/finder_test.rb (working copy) > @@ -1,4 +1,5 @@ > require 'abstract_unit' > +require 'fixtures/comment' > require 'fixtures/company' > require 'fixtures/topic' > require 'fixtures/reply' > @@ -232,18 +233,18 @@ > end > > def test_bind_enumerable > - assert_equal '1,2,3', bind('?', [1, 2, 3]) > - assert_equal %('a','b','c'), bind('?', %w(a b c)) > + assert_equal '1,2,3', bind('?', [1, 2, 3]).split(',').sort.join(',') > + assert_equal %('a','b','c'), bind('?', %w(a b c)).split(',').sort.join(',') > > - assert_equal '1,2,3', bind(':a', :a => [1, 2, 3]) > - assert_equal %('a','b','c'), bind(':a', :a => %w(a b c)) # ' > + assert_equal '1,2,3', bind(':a', :a => [1, 2, 3]).split(',').sort.join(',') > + assert_equal %('a','b','c'), bind(':a', :a => %w(a b c)).split(',').sort.join(',') # ' > > require 'set' > - assert_equal '1,2,3', bind('?', Set.new([1, 2, 3])) > - assert_equal %('a','b','c'), bind('?', Set.new(%w(a b c))) > + assert_equal '1,2,3', bind('?', Set.new([1, 2, 3])).split(',').sort.join(',') > + assert_equal %('a','b','c'), bind('?', Set.new(%w(a b c))).split(',').sort.join(',') > > - assert_equal '1,2,3', bind(':a', :a => Set.new([1, 2, 3])) > - assert_equal %('a','b','c'), bind(':a', :a => Set.new(%w(a b c))) # ' > + assert_equal '1,2,3', bind(':a', :a => Set.new([1, 2, 3])).split(',').sort.join(',') > + assert_equal %('a','b','c'), bind(':a', :a => Set.new(%w(a b c))).split(',').sort.join(',') > end > > def test_bind_empty_enumerable > Index: Rakefile > =================================================================== > --- Rakefile (revision 7628) > +++ Rakefile (working copy) > @@ -27,7 +27,7 @@ > > # Run the unit tests > > -for adapter in %w( mysql postgresql sqlite sqlite3 firebird sqlserver sqlserver_odbc db2 oracle sybase openbase frontbase ) > +for adapter in %w( mysql postgresql sqlite sqlite3 firebird sqlserver sqlserver_odbc db2 oracle sybase openbase frontbase derby_jdbc postgresql_jdbc oracle_jdbc sqlserver_jdbc) > Rake::TestTask.new("test_#{adapter}") { |t| > t.libs << "test" << "test/connections/native_#{adapter}" > if adapter =~ /^sqlserver/ > @@ -39,6 +39,15 @@ > } > end > > +task "setup_oracle_jdbc" do > + rm_f "test/fixtures/db_definitions/jdbc*.sql" > + puts Dir.pwd > + Dir.chdir("test/fixtures/db_definitions") do > + %w(.sql .drop.sql 2.sql 2.drop.sql).each {|x| cp "oracle_jdbc#{x}", "jdbc#{x}"} > + end > +end > + > + > SCHEMA_PATH = File.join(File.dirname(__FILE__), *%w(test fixtures db_definitions)) > > desc 'Build the MySQL test databases' > @@ -223,4 +232,4 @@ > rubyforge = RubyForge.new > rubyforge.login > rubyforge.add_release(PKG_NAME, PKG_NAME, "REL #{PKG_VERSION}", *packages) > -end > \ No newline at end of file > +end > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > From nobody at rubyforge.org Thu Sep 27 05:25:18 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Thu, 27 Sep 2007 05:25:18 -0400 (EDT) Subject: [Jruby-extras-devel] [754] trunk/activerecord-jdbc/src/java/JdbcAdapterInternalService.java: Managed to break SQL Server with some of my changes yesterday - bad Ola Message-ID: <20070927092519.4124F52409BB@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070927/2374e8a7/attachment.html From nobody at rubyforge.org Thu Sep 27 06:49:07 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Thu, 27 Sep 2007 06:49:07 -0400 (EDT) Subject: [Jruby-extras-devel] [755] trunk/activerecord-jdbc/lib/jdbc_adapter/jdbc_mssql.rb: Improve MsSQL by fixing some of the migration stuff Message-ID: <20070927104907.4AF595240A03@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070927/4fe2dc1d/attachment.html From nobody at rubyforge.org Thu Sep 27 07:02:00 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Thu, 27 Sep 2007 07:02:00 -0400 (EDT) Subject: [Jruby-extras-devel] [756] trunk/activerecord-jdbc/src/java/JdbcAdapterInternalService.java: Fix tables for SQL Server Message-ID: <20070927110200.EDEC452409A7@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070927/47b972cd/attachment.html From nobody at rubyforge.org Thu Sep 27 07:18:23 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Thu, 27 Sep 2007 07:18:23 -0400 (EDT) Subject: [Jruby-extras-devel] [757] trunk/activerecord-jdbc/src/java/JdbcAdapterInternalService.java: I'm really starting to hate all databases. Message-ID: <20070927111824.25CC95240A03@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070927/279c46f7/attachment.html From nobody at rubyforge.org Thu Sep 27 08:41:45 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Thu, 27 Sep 2007 08:41:45 -0400 (EDT) Subject: [Jruby-extras-devel] [758] trunk/activerecord-jdbc/lib/jdbc_adapter/jdbc_mssql.rb: fix the final MsSQL problems Message-ID: <20070927124145.CC3CEA970003@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070927/d305db4c/attachment-0001.html From ola.bini at gmail.com Thu Sep 27 08:45:54 2007 From: ola.bini at gmail.com (Ola Bini) Date: Thu, 27 Sep 2007 13:45:54 +0100 Subject: [Jruby-extras-devel] SQLServer passes all tests Message-ID: <46FBA602.6030709@gmail.com> Hi guys, SQLServer now passes all tests in AR stables. I had to add some more fixes in the same manner as yesterday, since some things seems broken for Rails on trunk with MRI SQLServer too. Cheers -- Ola Bini (http://ola-bini.blogspot.com) JRuby Core Developer Developer, ThoughtWorks Studios (http://studios.thoughtworks.com) Practical JRuby on Rails (http://apress.com/book/view/9781590598818) "Yields falsehood when quined" yields falsehood when quined. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: jdbc_oracle_mssql_postgres_mysql_fixes.patch Url: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070927/4bf473eb/attachment.pl From ricardo.trindade at emation.pt Mon Sep 24 08:14:41 2007 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 24 Sep 2007 13:14:41 +0100 Subject: [Jruby-extras-devel] irb and to_s Message-ID: <46F7AA31.6040108@emation.pt> Hi, Is there a way to persuade irb to use to_s to print objects in the console instead of inspect ? We're working with some objects that have thousands of other objects inside them, so evaluating them on jirb takes minutes, because of the time it takes to print. thanks, Ricardo From peter at oaktop.com Fri Sep 28 10:50:56 2007 From: peter at oaktop.com (Peter K Chan) Date: Fri, 28 Sep 2007 09:50:56 -0500 Subject: [Jruby-extras-devel] irb and to_s In-Reply-To: <46F7AA31.6040108@emation.pt> References: <46F7AA31.6040108@emation.pt> Message-ID: <000001c801de$fa60bb30$ef223190$@com> I don't know enough about IRB's internal, but can you redefine the inspect method on those objects to print only a summary? That's what I did to my objects that have huge object graph attached. Another possibility is to always suffix your command with ";nil", such as "big.call; nil", to hide the return value. Peter -----Original Message----- From: jruby-extras-devel-bounces at rubyforge.org [mailto:jruby-extras-devel-bounces at rubyforge.org] On Behalf Of Ricardo Trindade Sent: Monday, September 24, 2007 7:15 AM To: jruby-extras-devel at rubyforge.org Subject: [Jruby-extras-devel] irb and to_s Hi, Is there a way to persuade irb to use to_s to print objects in the console instead of inspect ? We're working with some objects that have thousands of other objects inside them, so evaluating them on jirb takes minutes, because of the time it takes to print. thanks, Ricardo _______________________________________________ Jruby-extras-devel mailing list Jruby-extras-devel at rubyforge.org http://rubyforge.org/mailman/listinfo/jruby-extras-devel From me at christophernelsonconsulting.com Fri Sep 28 11:07:41 2007 From: me at christophernelsonconsulting.com (Chris Nelson) Date: Fri, 28 Sep 2007 11:07:41 -0400 Subject: [Jruby-extras-devel] irb and to_s In-Reply-To: <46F7AA31.6040108@emation.pt> References: <46F7AA31.6040108@emation.pt> Message-ID: on (j)irb prompt, do IRB.CurrentContext.echo = false. This will turn off echoing for you. On 9/24/07, Ricardo Trindade wrote: > > Hi, > > Is there a way to persuade irb to use to_s to print objects in the > console instead of inspect ? > > We're working with some objects that have thousands of other objects > inside them, so evaluating them on jirb takes minutes, because of the > time it takes to print. > > thanks, > Ricardo > > _______________________________________________ > Jruby-extras-devel mailing list > Jruby-extras-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/jruby-extras-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070928/96152ee1/attachment.html From Bernardo.Telles at dep.state.fl.us Fri Sep 28 20:59:00 2007 From: Bernardo.Telles at dep.state.fl.us (Telles, Bernardo) Date: Fri, 28 Sep 2007 20:59:00 -0400 Subject: [Jruby-extras-devel] Darn! Oracle fix had minor problem Message-ID: <38D3EC9D70505046B6CFCC63FFC8C915991B15@tlhexsmb4.floridadep.net> Hi there, So that last patch didn't work perfectly. Here's one that takes into account a table without a schema name: def columns(table_name, name=nil) if table_name =~ /\./ parts = table_name.split(/\./) table_name = parts.pop schema_name = parts.join(".") @connection.columns_internal(table_name, name, schema_name) else @connection.columns_internal(table_name, name) end end Regards, Bernie Telles Web Administration and Design Team PH: 850-245-8000 x 1703 Email: Bernardo.Telles at dep.state.fl.us Florida Dept. of Environmental Protection -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070928/1eb33046/attachment-0001.html From Bernardo.Telles at dep.state.fl.us Fri Sep 28 20:50:23 2007 From: Bernardo.Telles at dep.state.fl.us (Telles, Bernardo) Date: Fri, 28 Sep 2007 20:50:23 -0400 Subject: [Jruby-extras-devel] Oracle fix: handle schemas (schema.table) in table name Message-ID: <38D3EC9D70505046B6CFCC63FFC8C9152678A8@tlhexsmb4.floridadep.net> Hi there, SVN commit #738 implements a schema.table fix for Postgres, so I tried the same fix for the oracle adapter and it worked. Just override the columns method as in Postgres fix #738 with the following: def columns(table_name, name=nil) schema_name = "public" if table_name =~ /\./ parts = table_name.split(/\./) table_name = parts.pop schema_name = parts.join(".") end @connection.columns_internal(table_name, name, schema_name) end P.S. This is the first patch I've submitted ever, to ANY project EVER, sooo all I know is that it worked for me :-). Didn't test it on a 'test environment' or anything. Regards, Bernie Telles Web Administration and Design Team -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/jruby-extras-devel/attachments/20070928/7e4ca9cd/attachment.html