Merge pull request #106 from petems/improve_java_version_fact_with_args

(MODULES-1749) Update java_version fact with maximum memory size
This commit is contained in:
Morgan Haskel
2015-02-06 16:24:51 +01:00
2 changed files with 3 additions and 3 deletions

View File

@@ -14,7 +14,7 @@
if Facter::Util::Resolution.which('java')
Facter.add(:java_version) do
setcode do
Facter::Util::Resolution.exec('java -version 2>&1').lines.first.split(/"/)[1].strip
Facter::Util::Resolution.exec('java -Xmx8m -version 2>&1').lines.first.split(/"/)[1].strip
end
end
end

View File

@@ -14,7 +14,7 @@ Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
EOS
Facter::Util::Resolution.expects(:which).with("java").returns(true)
Facter::Util::Resolution.expects(:exec).with("java -version 2>&1").returns(java_version_output)
Facter::Util::Resolution.expects(:exec).with("java -Xmx8m -version 2>&1").returns(java_version_output)
Facter.fact(:java_version).value.should == "1.7.0_71"
end
end