spec/kpm/remote/installer_spec.rb in kpm-0.1.0 vs spec/kpm/remote/installer_spec.rb in kpm-0.1.1

- old
+ new

@@ -1,6 +1,7 @@ require 'spec_helper' +require 'json' describe KPM::Installer do before(:all) do @logger = Logger.new(STDOUT) @@ -14,25 +15,38 @@ plugins_dir = dir + '/bundles' installer = KPM::Installer.new({ 'killbill' => { 'webapp_path' => kb_webapp_path, 'plugins_dir' => plugins_dir, - 'plugins' => { + 'plugins' => { 'java' => [{ - 'name' => 'analytics-plugin', + 'name' => 'analytics', 'version' => '0.7.1' + }, + # Re-add a second time the same plugin to validate the idempotency of installation + { + 'name' => 'analytics', + 'version' => '0.7.1' }], 'ruby' => [{ - 'name' => 'payment-test-plugin', + 'name' => 'killbill:payment-test-plugin', + 'artifact_id' => 'payment-test-plugin', 'version' => '1.8.7' }, { - 'name' => 'stripe' - }] + 'name' => 'stripe' + }, + # Re-add a second time the same plugin to validate the idempotency of installation + { + 'name' => 'killbill:payment-test-plugin', + 'artifact_id' => 'payment-test-plugin', + 'version' => '1.8.7' + } + ] }, }, - 'kaui' => { + 'kaui' => { 'webapp_path' => kaui_webapp_path } }, @logger) @@ -47,10 +61,11 @@ end private def check_installation(plugins_dir, kb_webapp_path, kaui_webapp_path) + [ plugins_dir, plugins_dir + '/platform', plugins_dir + '/plugins', plugins_dir + '/plugins/java', @@ -66,12 +81,23 @@ [ kb_webapp_path, kaui_webapp_path, plugins_dir + '/platform/jruby.jar', + plugins_dir + '/plugins/plugin_identifiers.json', plugins_dir + '/plugins/java/analytics-plugin/0.7.1/analytics-plugin-0.7.1.jar', plugins_dir + '/plugins/ruby/killbill-payment-test/1.8.7/killbill.properties' ].each do |file| File.file?(file).should be_true end + + plugin_identifiers = File.open(plugins_dir + '/plugins/plugin_identifiers.json', 'r') do |f| + JSON.parse(f.read) + end + + plugin_identifiers.size.should == 3 + plugin_identifiers['killbill:payment-test-plugin'].should == 'killbill-payment-test' + plugin_identifiers['stripe'].should == 'killbill-stripe' + plugin_identifiers['analytics'].should == 'analytics-plugin' + end end