deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject git commit: Couple fixes to make Sequel run stable on jRuby
Date Mon, 21 Jan 2013 10:13:57 GMT
Updated Branches:
  refs/heads/master 0df936b95 -> 63081221c


Couple fixes to make Sequel run stable on jRuby

- Fixed tests to work with JDBC sqlite memory db


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/63081221
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/63081221
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/63081221

Branch: refs/heads/master
Commit: 63081221c15720623c41d528741c4995b3614ae7
Parents: 0df936b
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Mon Jan 21 11:13:06 2013 +0100
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Mon Jan 21 11:13:06 2013 +0100

----------------------------------------------------------------------
 server/deltacloud-core.gemspec    |    9 +++++++--
 server/lib/db.rb                  |    9 +++++++--
 server/tests/cimi/db/db_helper.rb |    8 +++++++-
 3 files changed, 21 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/63081221/server/deltacloud-core.gemspec
----------------------------------------------------------------------
diff --git a/server/deltacloud-core.gemspec b/server/deltacloud-core.gemspec
index 977cc26..70cd576 100644
--- a/server/deltacloud-core.gemspec
+++ b/server/deltacloud-core.gemspec
@@ -74,12 +74,17 @@ Gem::Specification.new do |s|
   s.add_dependency('rack-accept')
   s.add_dependency('json', '>= 1.1.9')
   s.add_dependency('net-ssh', '>= 2.0.0')
-  s.add_dependency('thin', '>= 1.2.5') unless RUBY_PLATFORM == 'java'
   s.add_dependency('nokogiri', '>= 1.4.3')
   s.add_dependency('require_relative') if RUBY_VERSION < '1.9'
 
   s.add_dependency('sequel', '<= 3.42.0')
-  s.add_dependency('sqlite3')
+
+  if RUBY_PLATFORM == 'java'
+    s.add_dependency('jdbc-sqlite3')
+  else
+    s.add_dependency('sqlite3')
+    s.add_dependency('thin', '>= 1.2.5')
+  end
 
   # dependencies for various cloud providers:
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/63081221/server/lib/db.rb
----------------------------------------------------------------------
diff --git a/server/lib/db.rb b/server/lib/db.rb
index 6dc32c3..694450d 100644
--- a/server/lib/db.rb
+++ b/server/lib/db.rb
@@ -10,8 +10,13 @@ module Deltacloud
     Sequel::Model.plugin :validation_class_methods
   end
 
-  DATABASE_LOCATION = ENV['DATABASE_LOCATION'] ||
-    'sqlite://'+File.join('/', 'var', 'tmp', "deltacloud-mock-#{ENV['USER']}", 'db.sqlite')
+  if RUBY_PLATFORM == 'java'
+    DATABASE_LOCATION = ENV['DATABASE_LOCATION'] ||
+      'jdbc:sqlite:'+File.join('/', 'var', 'tmp', "deltacloud-mock-#{ENV['USER']}", 'db.sqlite')
+  else
+    DATABASE_LOCATION = ENV['DATABASE_LOCATION'] ||
+      'sqlite://'+File.join('/', 'var', 'tmp', "deltacloud-mock-#{ENV['USER']}", 'db.sqlite')
+  end
 
   def self.database(opts={})
     opts[:logger] = ::Logger.new($stdout) if ENV['API_VERBOSE']

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/63081221/server/tests/cimi/db/db_helper.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/db/db_helper.rb b/server/tests/cimi/db/db_helper.rb
index 9bbdf30..48a4cef 100644
--- a/server/tests/cimi/db/db_helper.rb
+++ b/server/tests/cimi/db/db_helper.rb
@@ -1,5 +1,11 @@
 # Memory database
-ENV['DATABASE_LOCATION'] = 'sqlite:/'
+if RUBY_PLATFORM == 'java'
+  ENV['DATABASE_LOCATION'] = 'jdbc:sqlite::memory:'
+else
+  ENV['DATABASE_LOCATION'] = 'sqlite:/'
+end
+
+require_relative '../../../lib/db'
 
 module Deltacloud
   module DatabaseTestHelper


Mime
View raw message