├── .gitignore ├── .kitchen.yml ├── .rspec ├── Berksfile ├── CHANGELOG.md ├── Cheffile ├── Gemfile ├── LICENSE ├── README.md ├── Rakefile ├── Thorfile ├── attributes ├── default.rb ├── java.rb └── tomcat.rb ├── chefignore ├── metadata.rb ├── recipes ├── default.rb └── licenseserver.rb ├── templates └── default │ ├── ROOT.xml.erb │ └── modelContext.xml.erb └── test └── unit ├── recipes ├── default_spec.rb └── licenseserver_spec.rb └── spec_helper.rb /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *# 3 | .#* 4 | \#*# 5 | .*.sw[a-z] 6 | *.un~ 7 | pkg/ 8 | 9 | # Berkshelf 10 | .vagrant 11 | /cookbooks 12 | Berksfile.lock 13 | 14 | # Bundler 15 | Gemfile.lock 16 | bin/* 17 | .bundle/* 18 | 19 | .kitchen/ 20 | .kitchen.local.yml 21 | -------------------------------------------------------------------------------- /.kitchen.yml: -------------------------------------------------------------------------------- 1 | --- 2 | driver: 3 | name: vagrant 4 | network: 5 | - ["forwarded_port", {guest: 8080, host: 8080}] 6 | 7 | provisioner: 8 | name: chef_solo 9 | 10 | platforms: 11 | - name: ubuntu-14.04 12 | 13 | suites: 14 | - name: tomcat6 15 | run_list: 16 | - recipe[jetbrains_license_server::default] 17 | attributes: 18 | tomcat: 19 | base_version: 6 20 | - name: tomcat7 21 | run_list: 22 | - recipe[jetbrains_license_server::default] 23 | attributes: 24 | tomcat: 25 | base_version: 7 26 | - name: tomcat8 27 | run_list: 28 | - recipe[jetbrains_license_server::default] 29 | attributes: 30 | tomcat: 31 | base_version: 8 32 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --default-path test 3 | -------------------------------------------------------------------------------- /Berksfile: -------------------------------------------------------------------------------- 1 | source "https://supermarket.getchef.com" 2 | 3 | metadata 4 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 0.1.0 2 | 3 | Initial release of jetbrains_license_server 4 | 5 | * Enhancements 6 | * an enhancement 7 | 8 | * Bug Fixes 9 | * a bug fix 10 | -------------------------------------------------------------------------------- /Cheffile: -------------------------------------------------------------------------------- 1 | site 'http://community.opscode.com/api/v1' 2 | 3 | cookbook 'jetbrains_license_server', path: '.' 4 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'berkshelf' 4 | 5 | # Uncomment these lines if you want to live on the Edge: 6 | # 7 | # group :development do 8 | # gem "berkshelf", github: "berkshelf/berkshelf" 9 | # gem "vagrant", github: "mitchellh/vagrant", tag: "v1.5.2" 10 | # end 11 | # 12 | # group :plugins do 13 | # gem "vagrant-berkshelf", github: "berkshelf/vagrant-berkshelf" 14 | # gem "vagrant-omnibus", github: "schisamo/vagrant-omnibus" 15 | # end 16 | 17 | gem 'test-kitchen' 18 | gem 'kitchen-vagrant' 19 | gem 'chefspec' 20 | gem 'stove' 21 | gem 'rake' 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2014 Rapid7, LLC. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # jetbrains_license_server-cookbook 2 | [![Build Status](https://travis-ci.org/rapid7-cookbooks/jetbrains_license_server.svg)](https://travis-ci.org/rapid7-cookbooks/jetbrains_license_server) 3 | [![Cookbook Version](https://img.shields.io/cookbook/v/jetbrains_license_server.svg)](https://supermarket.chef.io/cookbooks/jetbrains_license_server) 4 | [![License](https://img.shields.io/badge/license-Apache_2-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0) 5 | 6 | 7 | Installs the JetBrains License Server 8 | 9 | ## Supported Platforms 10 | 11 | - Linux 12 | 13 | ## Attributes 14 | 15 | ### default 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 |
KeyTypeDescriptionDefault
['jetbrains_license_server']['version']IntegerVersion of the License Server to download and install374
['jetbrains_license_server']['download']['uri']StringBase URI for the License Server zip file'http://download-cf.jetbrains.com/lcsrv/'
['jetbrains_license_server']['download']['file_prefix']StringThe first part of the filename preceeding the version.'licenseServer-war'
['jetbrains_license_server']['download']['file_suffix']StringThe filename extension.'zip'
['jetbrains_license_server']['checksum']StringSHA-256 Checksum of the LicenseServer to download'a3935a2fdd644d780b30f05855c9d1b0b0582be1ad92919df40a0c3fd7ff33a1'
['jetbrains_license_server']['modelContext_path']StringPath to the modelContext.xml file exploded from the war file.'licenseServer/WEB-INF/classes/META-INF/modelContext.xml'
['jetbrains_license_server']['derby_dir']StringSubdirectory name where the database lives'derby'
['jetbrains_license_server']['root_context_action']SymbolConfigure the licenseServer application as the root application. Set the value to :remove to disable.:create
72 | 73 | ### java 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 |
KeyTypeDescriptionDefault
['java']['version']StringVersion of java to install'7'
88 | 89 | ### tomcat 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 |
KeyTypeDescriptionDefault
['tomcat']['base_version']IntegerVersion of tomcat to install7
104 | 105 | ## Usage 106 | 107 | ### jetbrains_license_server::default 108 | 109 | Include `jetbrains_license_server` in your node's `run_list`: 110 | 111 | ```json 112 | { 113 | "run_list": [ 114 | "recipe[jetbrains_license_server::default]" 115 | ] 116 | } 117 | ``` 118 | 119 | ## Contributing 120 | 121 | 1. Fork the repository on Github 122 | 2. Create a named feature branch (i.e. `add-new-recipe`) 123 | 3. Write your change 124 | 4. Write tests for your change (if applicable) 125 | 5. Run the tests, ensuring they all pass 126 | 6. Submit a Pull Request 127 | 128 | ## License and Authors 129 | 130 | Author:: Ryan Hass () 131 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | task :publish do 2 | require 'stove/rake_task' 3 | Stove::RakeTask.new 4 | end 5 | -------------------------------------------------------------------------------- /Thorfile: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | require 'bundler' 4 | require 'bundler/setup' 5 | require 'berkshelf/thor' 6 | 7 | begin 8 | require 'kitchen/thor_tasks' 9 | Kitchen::ThorTasks.new 10 | rescue LoadError 11 | puts ">>>>> Kitchen gem not loaded, omitting tasks" unless ENV['CI'] 12 | end 13 | -------------------------------------------------------------------------------- /attributes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2014 Rapid7, LLC 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | default['jetbrains_license_server']['version'] = 374 18 | default['jetbrains_license_server']['download']['uri'] = 'http://download-cf.jetbrains.com/lcsrv/' 19 | default['jetbrains_license_server']['download']['file_prefix'] = 'licenseServer-war' 20 | default['jetbrains_license_server']['download']['file_suffix'] = 'zip' 21 | default['jetbrains_license_server']['checksum'] = 'a3935a2fdd644d780b30f05855c9d1b0b0582be1ad92919df40a0c3fd7ff33a1' 22 | default['jetbrains_license_server']['modelContext_path'] = 'licenseServer/WEB-INF/classes/META-INF/modelContext.xml' 23 | default['jetbrains_license_server']['derby_dir'] = 'derby' 24 | default['jetbrains_license_server']['root_context_action'] = :create 25 | -------------------------------------------------------------------------------- /attributes/java.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2014 Rapid7, LLC 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | force_default['java']['jdk_version'] = '7' 18 | -------------------------------------------------------------------------------- /attributes/tomcat.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2014 Rapid7, LLC 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | force_default['tomcat']['base_version'] = 7 18 | 19 | # Force reload of the tomcat cookbook attributes file since other 20 | # attributes reference the base_version attribute. 21 | # SEE: http://tickets.opscode.com/browse/CHEF-4234 22 | node.from_file(run_context.resolve_attribute(*parse_attribute_file_spec('tomcat'))) 23 | -------------------------------------------------------------------------------- /chefignore: -------------------------------------------------------------------------------- 1 | # Put files/directories that should be ignored in this file when uploading 2 | # or sharing to the community site. 3 | # Lines that start with '# ' are comments. 4 | 5 | # OS generated files # 6 | ###################### 7 | .DS_Store 8 | Icon? 9 | nohup.out 10 | ehthumbs.db 11 | Thumbs.db 12 | 13 | # SASS # 14 | ######## 15 | .sass-cache 16 | 17 | # EDITORS # 18 | ########### 19 | \#* 20 | .#* 21 | *~ 22 | *.sw[a-z] 23 | *.bak 24 | REVISION 25 | TAGS* 26 | tmtags 27 | *_flymake.* 28 | *_flymake 29 | *.tmproj 30 | .project 31 | .settings 32 | mkmf.log 33 | 34 | ## COMPILED ## 35 | ############## 36 | a.out 37 | *.o 38 | *.pyc 39 | *.so 40 | *.com 41 | *.class 42 | *.dll 43 | *.exe 44 | */rdoc/ 45 | 46 | # Testing # 47 | ########### 48 | .watchr 49 | .rspec 50 | spec/* 51 | spec/fixtures/* 52 | test/* 53 | features/* 54 | Guardfile 55 | Procfile 56 | 57 | # SCM # 58 | ####### 59 | .git 60 | */.git 61 | .gitignore 62 | .gitmodules 63 | .gitconfig 64 | .gitattributes 65 | .svn 66 | */.bzr/* 67 | */.hg/* 68 | */.svn/* 69 | 70 | # Berkshelf # 71 | ############# 72 | cookbooks/* 73 | tmp 74 | 75 | # Cookbooks # 76 | ############# 77 | CONTRIBUTING 78 | CHANGELOG* 79 | 80 | # Strainer # 81 | ############ 82 | Colanderfile 83 | Strainerfile 84 | .colander 85 | .strainer 86 | 87 | # Vagrant # 88 | ########### 89 | .vagrant 90 | Vagrantfile 91 | 92 | # Travis # 93 | ########## 94 | .travis.yml 95 | -------------------------------------------------------------------------------- /metadata.rb: -------------------------------------------------------------------------------- 1 | name 'jetbrains_license_server' 2 | maintainer 'Ryan Hass' 3 | maintainer_email 'ryan_hass@rapid7.com' 4 | license 'Apache 2.0' 5 | description 'Installs/Configures jetbrains_license_server' 6 | long_description 'Installs/Configures jetbrains_license_server' 7 | version '0.1.2' 8 | 9 | depends 'apt', '>= 2.6.0' 10 | depends 'java', '>= 1.29.0' 11 | depends 'tomcat', '>= 0.16.2' 12 | -------------------------------------------------------------------------------- /recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: jetbrains_license_server 3 | # Recipe:: default 4 | # 5 | # Copyright (C) 2014 Rapid7, LLC 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | 20 | include_recipe 'java::default' 21 | include_recipe 'tomcat::default' 22 | include_recipe 'jetbrains_license_server::licenseserver' 23 | -------------------------------------------------------------------------------- /recipes/licenseserver.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: jetbrains_license_server 3 | # Recipe:: licenseserver 4 | # 5 | # Copyright (C) 2014 Rapid7, LLC 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | 20 | require 'uri' 21 | 22 | licserv_war = "#{node['jetbrains_license_server']['download']['file_prefix']}-#{node['jetbrains_license_server']['version']}.#{node['jetbrains_license_server']['download']['file_suffix']}" 23 | 24 | package 'unzip' 25 | 26 | # Re-register tomcat as a service as the current upstream cookbook has a bug 27 | # in which the service is not identifiable from a wrapper cookbook. 28 | service "tomcat#{node['tomcat']['base_version']}" do 29 | action :nothing 30 | end 31 | 32 | directory ::File.join(node['tomcat']['home'], node['jetbrains_license_server']['derby_dir']) do 33 | owner node['tomcat']['user'] 34 | group node['tomcat']['group'] 35 | mode 0755 36 | end 37 | 38 | remote_file ::File.join(Chef::Config[:file_cache_path], licserv_war) do 39 | source ::URI.join(node['jetbrains_license_server']['download']['uri'], licserv_war).to_s 40 | checksum node['jetbrains_license_server']['checksum'] 41 | notifies :run, 'execute[unzip_licserv]' 42 | end 43 | 44 | execute 'unzip_licserv' do 45 | command "unzip -o #{::File.join(Chef::Config[:file_cache_path], licserv_war)} -d #{node['tomcat']['webapp_dir']}" 46 | action :nothing 47 | notifies :restart, "service[tomcat#{node['tomcat']['base_version']}]", :delayed 48 | end 49 | 50 | template ::File.join(node['tomcat']['webapp_dir'], node['jetbrains_license_server']['modelContext_path']) do 51 | source 'modelContext.xml.erb' 52 | owner node['tomcat']['user'] 53 | group node['tomcat']['group'] 54 | mode 0644 55 | variables ({ :derby_dir => node['jetbrains_license_server']['derby_dir'].to_s }) 56 | subscribes :create, 'execute[unzip_licserv]' 57 | notifies :restart, "service[tomcat#{node['tomcat']['base_version']}]", :immediately 58 | action :nothing 59 | end 60 | 61 | template ::File.join(node['tomcat']['context_dir'], 'ROOT.xml') do 62 | source 'ROOT.xml.erb' 63 | owner node['tomcat']['user'] 64 | group node['tomcat']['group'] 65 | mode 0644 66 | variables ({ :cbname => cookbook_name, :rname => recipe_name }) 67 | notifies :restart, "service[tomcat#{node['tomcat']['base_version']}]", :delayed 68 | action node['jetbrains_license_server']['root_context_action'] 69 | end 70 | -------------------------------------------------------------------------------- /templates/default/ROOT.xml.erb: -------------------------------------------------------------------------------- 1 | 6 | 7 | -------------------------------------------------------------------------------- /templates/default/modelContext.xml.erb: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 25 | 26 | 27 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 120 | 121 | 122 | 123 | 125 | 128 | 129 | 130 | 132 | 135 | 136 | 137 | 139 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | -------------------------------------------------------------------------------- /test/unit/recipes/default_spec.rb: -------------------------------------------------------------------------------- 1 | require_relative '../spec_helper' 2 | 3 | describe 'jetbrains_license_server::default' do 4 | let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) } 5 | 6 | before do 7 | stub_data_bag("users").and_return([]) 8 | end 9 | 10 | it 'includes the tomcat default recipe' do 11 | expect(chef_run).to include_recipe('tomcat::default') 12 | end 13 | 14 | it 'includes the licenseserver recipe' do 15 | expect(chef_run).to include_recipe('jetbrains_license_server::licenseserver') 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /test/unit/recipes/licenseserver_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2014, Rapid7, LLC. 2 | # License:: Apache License, Version 2.0 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | describe 'jetbrains_license_server::licenseserver' do 18 | tomcat_versions = [ 6, 7, 8 ] 19 | 20 | tomcat_versions.each do |version| 21 | context "on tomcat#{version}" do 22 | cached(:chef_run) { 23 | ChefSpec::SoloRunner.new do |node| 24 | node.set['tomcat']['base_version'] = version 25 | end.converge(described_recipe) } 26 | 27 | let(:licserv_war) { "#{chef_run.node['jetbrains_license_server']['download']['file_prefix']}-#{chef_run.node['jetbrains_license_server']['version']}.#{chef_run.node['jetbrains_license_server']['download']['file_suffix']}" } 28 | let(:zip_file) { ::File.join(Chef::Config[:file_cache_path], licserv_war) } 29 | let(:tomcat_ver) { "tomcat#{chef_run.node['tomcat']['base_version']}"} 30 | 31 | let(:remote_zip) { chef_run.remote_file(zip_file) } 32 | let(:unzip_command) { chef_run.execute('unzip_licserv') } 33 | let(:mc_template) { chef_run.template(::File.join(chef_run.node['tomcat']['webapp_dir'], chef_run.node['jetbrains_license_server']['modelContext_path'])) } 34 | let(:tomcat_svc) { chef_run.service(tomcat_ver) } 35 | let(:rc_template) { chef_run.template(::File.join(node['tomcat']['context_dir'], 'ROOT.xml')) } 36 | 37 | it 'installs unzip' do 38 | expect(chef_run).to install_package('unzip') 39 | end 40 | 41 | it 're-registers the tomcat service with no action' do 42 | expect(tomcat_svc).to do_nothing 43 | end 44 | 45 | it 'creates a directory where the license server/tomcat can create and write to the db' do 46 | expect(chef_run).to create_directory(::File.join(chef_run.node['tomcat']['home'], 47 | chef_run.node['jetbrains_license_server']['derby_dir']) 48 | ).with( 49 | user: chef_run.node['tomcat']['user'], 50 | group: chef_run.node['tomcat']['group'], 51 | mode: 0755 52 | ) 53 | 54 | end 55 | 56 | it 'downloads the license server' do 57 | expect(chef_run).to create_remote_file(zip_file) 58 | 59 | expect(remote_zip).to notify('execute[unzip_licserv]').to(:run) 60 | end 61 | 62 | it 'unzips the war file when a new zip file is downloaded' do 63 | expect(unzip_command).to do_nothing 64 | expect(unzip_command).to notify("service[#{tomcat_ver}]").to(:restart).delayed 65 | end 66 | 67 | it 'deploys the template when a new zip file is exploded' do 68 | expect(mc_template).to do_nothing 69 | expect(mc_template).to subscribe_to('execute[unzip_licserv]') 70 | end 71 | 72 | it 'notifies tomcat to restart when the template is deployed' do 73 | expect(mc_template).to notify("service[#{tomcat_ver}]").to(:restart).immediately 74 | end 75 | 76 | it 'configures the licenseServer as the root context' do 77 | expect(chef_run).to create_template(::File.join(chef_run.node['tomcat']['context_dir'], 'ROOT.xml')) 78 | end 79 | 80 | end 81 | end 82 | end 83 | -------------------------------------------------------------------------------- /test/unit/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2013-2014, Rapid7, LLC. 2 | # License:: Apache License, Version 2.0 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | require 'chefspec' 18 | require 'chefspec/berkshelf' 19 | --------------------------------------------------------------------------------