add two facts: java_libjvm_path java_default_home

* dirname containing base directory of java
* e.g. java binary is `${::java_default_home}/jre/bin/java`

* dirname containing `libjvm.so`
* Most people will use this for LD_LIBRARY_PATH
This commit is contained in:
Fabien Wernli
2015-05-05 15:17:39 +02:00
parent 4f0ee5a759
commit 9c154890a3
5 changed files with 98 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
require "spec_helper"
describe Facter::Util::Fact do
before {
Facter.clear
Facter.fact(:kernel).stubs(:value).returns('Linux')
java_default_home = '/usr/lib/jvm/java-8-openjdk-amd64'
Facter.fact(:java_default_home).stubs(:value).returns(java_default_home)
Dir.stubs(:glob).with("#{java_default_home}/jre/lib/**/libjvm.so").returns( ['/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/libjvm.so'])
}
describe "java_libjvm_path" do
context 'returns libjvm path' do
context 'on Linux' do
it do
Facter.value(:java_libjvm_path).should == "/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server"
end
end
end
end
end