Skip to content

Commit

Permalink
Merge pull request #148 from davidmc24/feature/java8
Browse files Browse the repository at this point in the history
Add support for Oracle JDK 1.8.0 (closes #147)
  • Loading branch information
carmstrong committed Mar 19, 2014
2 parents e0c858f + 6cf36d0 commit f03896a
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 3 deletions.
9 changes: 9 additions & 0 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ suites:
oracle:
accept_oracle_download_terms: true
install_flavor: oracle
- name: oracle-8
run_list:
- recipe[java::default]
attributes:
java:
jdk_version: "8"
oracle:
accept_oracle_download_terms: true
install_flavor: oracle
- name: oracle-direct
run_list:
- recipe[java::oracle]
Expand Down
20 changes: 20 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,23 @@
# i586
default['java']['jdk']['7']['i586']['url'] = 'http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.tar.gz'
default['java']['jdk']['7']['i586']['checksum'] = '909d353c1caf6b3b54cc20767a7778ef'

# jdk8 attributes

default['java']['jdk']['8']['bin_cmds'] = [ "appletviewer", "apt", "ControlPanel", "extcheck", "idlj", "jar", "jarsigner", "java", "javac",
"javadoc", "javafxpackager", "javah", "javap", "javaws", "jcmd", "jconsole", "jcontrol", "jdb",
"jdeps", "jhat", "jinfo", "jjs", "jmap", "jmc", "jps", "jrunscript", "jsadebugd", "jstack",
"jstat", "jstatd", "jvisualvm", "keytool", "native2ascii", "orbd", "pack200", "policytool",
"rmic", "rmid", "rmiregistry", "schemagen", "serialver", "servertool", "tnameserv",
"unpack200", "wsgen", "wsimport", "xjc" ]

# Oracle doesn't seem to publish SHA256 checksums for Java releases, so we use MD5 instead.
# Official checksums for the latest release can be found at http://www.oracle.com/technetwork/java/javase/downloads/javase8-binaries-checksum-2133161.html

# x86_64
default['java']['jdk']['8']['x86_64']['url'] = 'http://download.oracle.com/otn-pub/java/jdk/8-b132/jdk-8-linux-x64.tar.gz'
default['java']['jdk']['8']['x86_64']['checksum'] = '7e9e5e5229c6603a4d8476050bbd98b1'

# i586
default['java']['jdk']['8']['i586']['url'] = 'http://download.oracle.com/otn-pub/java/jdk/8-b132/jdk-8-linux-i586.tar.gz'
default['java']['jdk']['8']['i586']['checksum'] = '45556e463a561b470bd9d0c07a73effb'
10 changes: 7 additions & 3 deletions providers/ark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,18 @@ def parse_app_dir_name url
# for jdk1.6
if file_name =~ /^(jre|jdk).*$/
major_num = file_name.scan(/\d/)[0]
update_num = file_name.scan(/\d+/)[1]
update_token = file_name.scan(/u(\d+)/)[0]
update_num = update_token ? update_token[0] : "0"
# pad a single digit number with a zero
if update_num.length < 2
update_num = "0" + update_num
end
package_name = file_name.scan(/[a-z]+/)[0]
app_dir_name = "#{package_name}1.#{major_num}.0_#{update_num}"
if update_num == "00"
app_dir_name = "#{package_name}1.#{major_num}.0"
else
app_dir_name = "#{package_name}1.#{major_num}.0_#{update_num}"
end
else
app_dir_name = file_name.split(/(.tgz|.tar.gz|.zip)/)[0]
app_dir_name = app_dir_name.split("-bin")[0]
Expand All @@ -61,7 +66,6 @@ def oracle_downloaded?(download_path, new_resource)

def download_direct_from_oracle(tarball_name, new_resource)
download_path = "#{Chef::Config[:file_cache_path]}/#{tarball_name}"
jdk_id = new_resource.url.scan(/\/([6789]u[0-9][0-9]?-b[0-9][0-9])\//)[0][0]
cookie = "oraclelicense=accept-securebackup-cookie"
if node['java']['oracle']['accept_oracle_download_terms']
# install the curl package
Expand Down
4 changes: 4 additions & 0 deletions recipes/oracle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
tarball_url = node['java']['jdk']['7'][arch]['url']
tarball_checksum = node['java']['jdk']['7'][arch]['checksum']
bin_cmds = node['java']['jdk']['7']['bin_cmds']
when "8"
tarball_url = node['java']['jdk']['8'][arch]['url']
tarball_checksum = node['java']['jdk']['8'][arch]['checksum']
bin_cmds = node['java']['jdk']['8']['bin_cmds']
end

if tarball_url =~ /example.com/
Expand Down
4 changes: 4 additions & 0 deletions recipes/oracle_i386.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
tarball_url = node['java']['jdk']['7']['i586']['url']
tarball_checksum = node['java']['jdk']['7']['i586']['checksum']
bin_cmds = node['java']['jdk']['7']['bin_cmds']
when "8"
tarball_url = node['java']['jdk']['8']['i586']['url']
tarball_checksum = node['java']['jdk']['8']['i586']['checksum']
bin_cmds = node['java']['jdk']['8']['bin_cmds']
end

include_recipe "java::set_java_home"
Expand Down
14 changes: 14 additions & 0 deletions test/integration/oracle-8/bats/verify_oracle-8.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@test "installs the correct version of the jdk" {
java -version 2>&1 | grep 1.8
}

@test "properly sets JAVA_HOME environment variable" {
source /etc/profile.d/jdk.sh
run test -d $JAVA_HOME
[ "$status" -eq 0 ]
}

@test "properly links jar" {
run test -L /usr/bin/jar
[ "$status" -eq 0 ]
}

0 comments on commit f03896a

Please sign in to comment.