Skip to content
Browse files

Merge commit 'af8b463c0474b79553536bcf71e24eb0790d2b5e' into dup

Change-Id: Iec2622b91438d95e1b32f3a397c9072086f169f2
  • Loading branch information...
2 parents fc3103b + af8b463 commit bf844260f79f5d82d1e23f9a9ac9a2b99a5df51f @mariash mariash committed
Showing with 33 additions and 5 deletions.
  1. +10 −5 lib/vcap/staging/plugin/java_database_support.rb
  2. +23 −0 spec/unit/java_web_spec.rb
View
15 lib/vcap/staging/plugin/java_database_support.rb
@@ -1,16 +1,21 @@
module JavaDatabaseSupport
SERVICE_DRIVER_HASH = {
- "mysql-5.1" => '*mysql-connector-java-*.jar',
- "postgresql-9.0" => '*postgresql-*.jdbc*.jar'
+ "mysql" => '*mysql-connector-java-*.jar',
+ "postgresql" => '*postgresql-*.jdbc*.jar'
}
def copy_service_drivers(driver_dest,services)
return if services == nil
- drivers = services.select { |svc|
- SERVICE_DRIVER_HASH.has_key?(svc[:label])
+ drivers = []
+ services.each { |svc|
+ db_label = svc[:label]
+ db_key = db_label.index('-') ? db_label.slice(0, db_label.index('-')) : db_label
+ if SERVICE_DRIVER_HASH.has_key?(db_key)
+ drivers << db_key
+ end
}
drivers.each { |driver|
- copy_jar SERVICE_DRIVER_HASH[driver[:label]], driver_dest
+ copy_jar SERVICE_DRIVER_HASH[driver], driver_dest
} if drivers
end
View
23 spec/unit/java_web_spec.rb
@@ -102,6 +102,29 @@
end
+describe "A Java web application being staged with updated versions of MySql and PostgreSql services bound to it" do
+ before(:all) do
+ app_fixture :java_web
+ @services = [
+ {:label=>"mysql-5.5", :tags=>["mysql", "mysql-5.5", "relational"], :name=>"mysql-9db41", :credentials=>{:name=>"d1b5ec5b179dc439d9c657dcc0ab9131c", :hostname=>"127.0.0.1", :host=>"127.0.0.1", :port=>3306, :user=>"upRQ0PsA7oEJD", :username=>"upRQ0PsA7oEJD", :password=>"pibhMxdwYZqy5"}, :options=>{}, :plan=>"free", :plan_option=>nil},
+ {:label=>"postgresql-9.1", :tags=>["postgresql", "postgresql-9.1", "relational"], :name=>"postgresql-9db41", :credentials=>{:name=>"d5cb067dbd29a4f37b4a17d8e9890b3db", :hostname=>"172.30.48.125", :host=>"172.30.48.125", :port=>5432, :user=>"upRQ0PsA7oEJD", :username=>"upRQ0PsA7oEJD", :password=>"pibhMxdwYZqy5"}, :options=>{}, :plan=>"free", :plan_option=>nil}
+ ]
+ end
+
+ it "should have the MySql driver in the Tomcat library" do
+ stage(java_web_staging_env(@services)) do |staged_dir, source_dir|
+ jar_present?(staged_dir, "tomcat/lib/#{MYSQL_DRIVER_JAR}").should == true
+ end
+ end
+
+ it "should have the PostgreSql driver in the Tomcat library" do
+ stage(java_web_staging_env(@services)) do |staged_dir, source_dir|
+ jar_present?(staged_dir, "tomcat/lib/#{POSTGRESQL_DRIVER_JAR}").should == true
+ end
+ end
+
+end
+
describe "A Java web application being staged without a MySql or a PostgreSql service bound to it" do
before(:all) do
app_fixture :java_web

0 comments on commit bf84426

Please sign in to comment.
Something went wrong with that request. Please try again.