Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
fixtures:
repositories:
"puppi": "git://github.com/example42/puppi.git"
"monitor": "git://github.com/example42/puppet-monitor.git"
"firewall": "git://github.com/example42/puppet-firewall.git"
"iptables": "git://github.com/example42/puppet-iptables.git"
"concat": "git://github.com/example42/puppet-concat.git"
stdlib:
repo: 'https://github.com/puppetlabs/puppetlabs-stdlib.git'
ref: '4.6.0'
common:
repo: 'https://github.com/ghoneycutt/puppet-module-common.git'
ref: 'v1.4.1'
firewall:
repo: 'https://github.com/puppetlabs/puppetlabs-firewall.git'
ref: '0.2.1'
symlinks:
"java": "#{source_dir}"

java: "#{source_dir}"
38 changes: 25 additions & 13 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
source 'https://rubygems.org'

puppetversion = ENV['PUPPET_VERSION']

is_ruby18 = RUBY_VERSION.start_with? '1.8'

if is_ruby18
gem 'rspec', "~> 3.1.0", :require => false
gem 'rake', '~> 10.5.0', :require => false
if puppetversion = ENV['PUPPET_GEM_VERSION']
gem 'puppet', puppetversion, :require => false
else
gem 'puppet', :require => false
end
gem 'puppet', puppetversion, :require => false
gem 'puppet-lint'
gem 'puppetlabs_spec_helper', '>= 0.1.0'
gem 'rspec-puppet'

gem 'metadata-json-lint'
gem 'puppetlabs_spec_helper', '>= 1.1.1'
gem 'facter', '>= 1.7.0'
gem 'rspec-puppet'
gem 'puppet-lint', :git => 'https://github.com/rodjek/puppet-lint.git'
gem 'puppet-lint-absolute_classname-check'
gem 'puppet-lint-alias-check'
gem 'puppet-lint-empty_string-check'
gem 'puppet-lint-file_ensure-check'
gem 'puppet-lint-file_source_rights-check'
gem 'puppet-lint-leading_zero-check'
gem 'puppet-lint-spaceship_operator_without_tag-check'
gem 'puppet-lint-trailing_comma-check'
gem 'puppet-lint-unquoted_string-check'
gem 'puppet-lint-variable_contains_upcase'

group :development do
gem 'puppet-blacksmith'
# rspec must be v2 for ruby 1.8.7
if RUBY_VERSION >= '1.8.7' and RUBY_VERSION < '1.9'
# rake >=11 does not support ruby 1.8.7
gem 'rspec', '~> 2.0'
gem 'rake', '~> 10.0'
end

2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
default => 'present',
}

validate_absolute_path($java_home_base)

$headless_suffix = $java::bool_headless ? {
true => '-headless',
default => '',
Expand Down
55 changes: 55 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
require 'spec_helper'

describe 'java' do
let(:facts) do
{ :osfamily => 'Debian',
:operatingsystemmajrelease => '6',
}
end

context 'with defaults for all parameters' do
it { should contain_class('java') }

it { should compile.with_all_deps }
end

let(:validation_params) do
{
#:param => 'value',
}
end

validations = {
'base_path' => {
:name => ['java_home_base'],
:valid => ['/usr/lib/jvm'],
:invalid => ['invalid',3,2.42,['array'],a={'ha'=>'sh'},'/etc'],
:message => 'is an invalid path',
},
}

validations.sort.each do |type, var|
var[:name].each do |var_name|
var[:valid].each do |valid|
context "with #{var_name} (#{type}) set to valid #{valid} (as #{valid.class})" do
let(:params) { validation_params.merge({ :"#{var_name}" => valid, }) }
it { should compile }
end
end

var[:invalid].each do |invalid|
context "with #{var_name} (#{type}) set to invalid #{invalid} (as #{invalid.class})" do
let(:params) { validation_params.merge({ :"#{var_name}" => invalid, }) }
it 'should fail' do
expect do
should contain_class(subject)
end.to raise_error(Puppet::Error, /#{var[:message]}/)
end
end
end
end # var[:name].each
end # validations.sort.each
end # describe
#end