kpm 0.7.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +66 -0
- data/Gemfile +2 -0
- data/README.adoc +111 -109
- data/Rakefile +2 -1
- data/bin/kpm +4 -2
- data/kpm.gemspec +8 -6
- data/lib/kpm.rb +3 -0
- data/lib/kpm/account.rb +267 -338
- data/lib/kpm/base_artifact.rb +33 -39
- data/lib/kpm/base_installer.rb +69 -83
- data/lib/kpm/blob.rb +29 -0
- data/lib/kpm/cli.rb +3 -1
- data/lib/kpm/coordinates.rb +6 -9
- data/lib/kpm/database.rb +90 -114
- data/lib/kpm/diagnostic_file.rb +126 -147
- data/lib/kpm/formatter.rb +74 -46
- data/lib/kpm/inspector.rb +22 -32
- data/lib/kpm/installer.rb +53 -46
- data/lib/kpm/kaui_artifact.rb +4 -3
- data/lib/kpm/killbill_plugin_artifact.rb +10 -7
- data/lib/kpm/killbill_server_artifact.rb +13 -12
- data/lib/kpm/migrations.rb +8 -7
- data/lib/kpm/nexus_helper/actions.rb +47 -8
- data/lib/kpm/nexus_helper/nexus_api_calls_v2.rb +87 -94
- data/lib/kpm/nexus_helper/nexus_facade.rb +5 -3
- data/lib/kpm/plugins_directory.rb +9 -8
- data/lib/kpm/plugins_directory.yml +8 -175
- data/lib/kpm/plugins_manager.rb +29 -24
- data/lib/kpm/sha1_checker.rb +31 -18
- data/lib/kpm/system.rb +105 -136
- data/lib/kpm/system_helpers/cpu_information.rb +56 -55
- data/lib/kpm/system_helpers/disk_space_information.rb +60 -63
- data/lib/kpm/system_helpers/entropy_available.rb +37 -39
- data/lib/kpm/system_helpers/memory_information.rb +52 -51
- data/lib/kpm/system_helpers/os_information.rb +45 -47
- data/lib/kpm/system_helpers/system_proxy.rb +10 -10
- data/lib/kpm/tasks.rb +364 -437
- data/lib/kpm/tenant_config.rb +68 -83
- data/lib/kpm/tomcat_manager.rb +9 -8
- data/lib/kpm/trace_logger.rb +18 -16
- data/lib/kpm/uninstaller.rb +81 -14
- data/lib/kpm/utils.rb +13 -14
- data/lib/kpm/version.rb +3 -1
- data/packaging/Gemfile +2 -0
- data/pom.xml +1 -1
- data/spec/kpm/remote/base_artifact_spec.rb +13 -15
- data/spec/kpm/remote/base_installer_spec.rb +30 -29
- data/spec/kpm/remote/installer_spec.rb +73 -73
- data/spec/kpm/remote/kaui_artifact_spec.rb +7 -6
- data/spec/kpm/remote/killbill_plugin_artifact_spec.rb +19 -24
- data/spec/kpm/remote/killbill_server_artifact_spec.rb +17 -16
- data/spec/kpm/remote/migrations_spec.rb +12 -11
- data/spec/kpm/remote/nexus_facade_spec.rb +30 -26
- data/spec/kpm/remote/tenant_config_spec.rb +27 -26
- data/spec/kpm/remote/tomcat_manager_spec.rb +2 -1
- data/spec/kpm/unit/actions_spec.rb +52 -0
- data/spec/kpm/unit/base_artifact_spec.rb +17 -16
- data/spec/kpm/unit/cpu_information_spec.rb +67 -0
- data/spec/kpm/unit/disk_space_information_spec.rb +47 -0
- data/spec/kpm/unit/entropy_information_spec.rb +36 -0
- data/spec/kpm/unit/formatter_spec.rb +163 -0
- data/spec/kpm/unit/inspector_spec.rb +34 -42
- data/spec/kpm/unit/installer_spec.rb +5 -4
- data/spec/kpm/unit/memory_information_spec.rb +102 -0
- data/spec/kpm/unit/os_information_spec.rb +38 -0
- data/spec/kpm/unit/plugins_directory_spec.rb +34 -18
- data/spec/kpm/unit/plugins_manager_spec.rb +61 -65
- data/spec/kpm/unit/sha1_checker_spec.rb +107 -60
- data/spec/kpm/unit/uninstaller_spec.rb +107 -61
- data/spec/kpm/unit_mysql/account_spec.rb +120 -135
- data/spec/spec_helper.rb +19 -17
- data/tasks/package.rake +18 -18
- metadata +17 -8
data/lib/kpm/utils.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'pathname'
|
2
4
|
require 'rubygems/package'
|
3
5
|
require 'zlib'
|
@@ -7,7 +9,7 @@ module KPM
|
|
7
9
|
class << self
|
8
10
|
TAR_LONGLINK = '././@LongLink'
|
9
11
|
|
10
|
-
def unpack_tgz(tar_gz_archive, destination, skip_top_dir=false)
|
12
|
+
def unpack_tgz(tar_gz_archive, destination, skip_top_dir = false)
|
11
13
|
top_dir = nil
|
12
14
|
Gem::Package::TarReader.new(Zlib::GzipReader.open(tar_gz_archive)) do |tar|
|
13
15
|
dest = nil
|
@@ -20,17 +22,17 @@ module KPM
|
|
20
22
|
|
21
23
|
if entry.directory?
|
22
24
|
File.delete dest if File.file? dest
|
23
|
-
FileUtils.mkdir_p dest, :
|
25
|
+
FileUtils.mkdir_p dest, mode: entry.header.mode, verbose: false
|
24
26
|
elsif entry.file?
|
25
27
|
FileUtils.rm_rf dest if File.directory? dest
|
26
|
-
FileUtils.mkdir_p File.dirname(dest), :
|
27
|
-
File.open dest,
|
28
|
+
FileUtils.mkdir_p File.dirname(dest), verbose: false
|
29
|
+
File.open dest, 'wb' do |f|
|
28
30
|
f.print entry.read
|
29
31
|
end
|
30
|
-
FileUtils.chmod entry.header.mode, dest, :
|
32
|
+
FileUtils.chmod entry.header.mode, dest, verbose: false
|
31
33
|
current_dir = File.dirname(dest)
|
32
34
|
# In case there are two top dirs, keep the last one by convention
|
33
|
-
top_dir = current_dir if
|
35
|
+
top_dir = current_dir if top_dir.nil? || top_dir.size >= current_dir.size
|
34
36
|
elsif entry.header.typeflag == '2' # Symlink
|
35
37
|
File.symlink entry.header.linkname, dest
|
36
38
|
end
|
@@ -48,9 +50,7 @@ module KPM
|
|
48
50
|
file_names = []
|
49
51
|
Gem::Package::TarReader.new(Zlib::GzipReader.open(tar_gz_archive)) do |tar|
|
50
52
|
tar.each do |entry|
|
51
|
-
if entry.file?
|
52
|
-
file_names.push entry.full_name
|
53
|
-
end
|
53
|
+
file_names.push entry.full_name if entry.file?
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -62,17 +62,17 @@ module KPM
|
|
62
62
|
ver = get_version_from_file_path(file_path)
|
63
63
|
ext = File.extname(base)
|
64
64
|
|
65
|
-
name = base.gsub(ext,'')
|
65
|
+
name = base.gsub(ext, '')
|
66
66
|
if ver.nil?
|
67
67
|
# this will remove SNAPSHOT and any dash that appear before it (ex --SNAPSHOT).
|
68
|
-
name = name.gsub(/((-+){,1}SNAPSHOT){,1}/,'')
|
68
|
+
name = name.gsub(/((-+){,1}SNAPSHOT){,1}/, '')
|
69
69
|
last_dash = name.rindex('-')
|
70
70
|
name = name[0..last_dash] unless last_dash.nil?
|
71
71
|
else
|
72
|
-
name = name.gsub(ver,'')
|
72
|
+
name = name.gsub(ver, '')
|
73
73
|
end
|
74
74
|
|
75
|
-
name = name[0..name.length-2] if name[-1].match(/[a-zA-z]/).nil?
|
75
|
+
name = name[0..name.length - 2] if name[-1].match(/[a-zA-z]/).nil?
|
76
76
|
name
|
77
77
|
end
|
78
78
|
|
@@ -84,7 +84,6 @@ module KPM
|
|
84
84
|
|
85
85
|
ver[0]
|
86
86
|
end
|
87
|
-
|
88
87
|
end
|
89
88
|
end
|
90
89
|
end
|
data/lib/kpm/version.rb
CHANGED
data/packaging/Gemfile
CHANGED
data/pom.xml
CHANGED
@@ -26,7 +26,7 @@
|
|
26
26
|
<groupId>org.kill-bill.billing.installer</groupId>
|
27
27
|
<artifactId>kpm</artifactId>
|
28
28
|
<packaging>pom</packaging>
|
29
|
-
<version>0.
|
29
|
+
<version>0.8.0</version>
|
30
30
|
<name>KPM</name>
|
31
31
|
<url>http://github.com/killbill/killbill-cloud</url>
|
32
32
|
<description>KPM: the Kill Bill Package Manager</description>
|
@@ -1,7 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe KPM::BaseArtifact do
|
4
|
-
|
5
6
|
before(:all) do
|
6
7
|
@logger = Logger.new(STDOUT)
|
7
8
|
@logger.level = Logger::INFO
|
@@ -26,7 +27,7 @@ describe KPM::BaseArtifact do
|
|
26
27
|
end
|
27
28
|
|
28
29
|
it 'should be able to handle download errors' do
|
29
|
-
nexus_down = {:
|
30
|
+
nexus_down = { url: 'https://does.not.exist' }
|
30
31
|
Dir.mktmpdir do |dir|
|
31
32
|
sha1_file = "#{dir}/sha1.yml"
|
32
33
|
test_download dir, 'foo-oss.pom.xml', false, false, sha1_file
|
@@ -35,10 +36,10 @@ describe KPM::BaseArtifact do
|
|
35
36
|
# Verify the download is skipped gracefully when Nexus isn't reachable
|
36
37
|
test_download dir, 'foo-oss.pom.xml', true, false, sha1_file, nexus_down
|
37
38
|
# Verify the download fails when Nexus isn't reachable and force_download is set
|
38
|
-
expect { test_download dir, 'foo-oss.pom.xml', nil, true, sha1_file, nexus_down }.to raise_error
|
39
|
+
expect { test_download dir, 'foo-oss.pom.xml', nil, true, sha1_file, nexus_down }.to raise_error
|
39
40
|
# Verify the download fails when Nexus isn't reachable and the Nexus cache is empty
|
40
|
-
KPM::Sha1Checker.from_file(sha1_file).cache_artifact_info('org.kill-bill.billing:killbill-oss-parent:pom:
|
41
|
-
expect { test_download dir, 'foo-oss.pom.xml', nil, false, sha1_file, nexus_down }.to raise_error
|
41
|
+
KPM::Sha1Checker.from_file(sha1_file).cache_artifact_info('org.kill-bill.billing:killbill-oss-parent:pom:0.143.33', nil)
|
42
|
+
expect { test_download dir, 'foo-oss.pom.xml', nil, false, sha1_file, nexus_down }.to raise_error
|
42
43
|
end
|
43
44
|
end
|
44
45
|
|
@@ -55,11 +56,11 @@ describe KPM::BaseArtifact do
|
|
55
56
|
info[:file_name].should be_nil
|
56
57
|
|
57
58
|
files_in_dir = Dir[info[:file_path] + '/*']
|
58
|
-
files_in_dir.size.should
|
59
|
+
files_in_dir.size.should eq 20
|
59
60
|
|
60
61
|
File.file?(info[:file_path] + '/killbill-osgi-bundles-jruby-0.11.3.jar').should be_true
|
61
62
|
|
62
|
-
info[:bundle_dir].should
|
63
|
+
info[:bundle_dir].should eq info[:file_path]
|
63
64
|
end
|
64
65
|
end
|
65
66
|
|
@@ -79,18 +80,15 @@ describe KPM::BaseArtifact do
|
|
79
80
|
second_take = KPM::BaseArtifact.pull(@logger, group_id, artifact_id, packaging, classifier, second_bundle_version, dir)
|
80
81
|
File.file?(first_take[:file_path] + '/killbill-platform-osgi-bundles-jruby-0.36.2.jar').should be_false
|
81
82
|
File.file?(second_take[:file_path] + '/killbill-platform-osgi-bundles-jruby-0.36.10.jar').should be_true
|
82
|
-
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
|
-
def test_download(dir, filename=nil, verify_is_skipped=false, force_download=false, sha1_file=nil, overrides={})
|
86
|
+
def test_download(dir, filename = nil, verify_is_skipped = false, force_download = false, sha1_file = nil, overrides = {})
|
87
87
|
path = filename.nil? ? dir : dir + '/' + filename
|
88
88
|
|
89
|
-
info = KPM::BaseArtifact.pull(@logger, 'org.kill-bill.billing', 'killbill-oss-parent', 'pom', nil, '
|
90
|
-
info[:file_name].should
|
91
|
-
info[:skipped].should
|
92
|
-
|
93
|
-
info[:size].should == File.size(info[:file_path])
|
94
|
-
end
|
89
|
+
info = KPM::BaseArtifact.pull(@logger, 'org.kill-bill.billing', 'killbill-oss-parent', 'pom', nil, '0.143.33', path, sha1_file, force_download, true, overrides, true)
|
90
|
+
info[:file_name].should eq(filename.nil? ? "killbill-oss-parent-#{info[:version]}.pom" : filename)
|
91
|
+
info[:skipped].should eq verify_is_skipped
|
92
|
+
info[:size].should eq File.size(info[:file_path]) unless info[:skipped]
|
95
93
|
end
|
96
94
|
end
|
@@ -1,8 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
require 'json'
|
3
5
|
|
4
6
|
describe KPM::BaseInstaller do
|
5
|
-
|
6
7
|
before(:all) do
|
7
8
|
@logger = Logger.new(STDOUT)
|
8
9
|
@logger.level = Logger::INFO
|
@@ -13,7 +14,7 @@ describe KPM::BaseInstaller do
|
|
13
14
|
bundles_dir = dir + '/bundles'
|
14
15
|
installer = KPM::BaseInstaller.new(@logger)
|
15
16
|
|
16
|
-
|
17
|
+
installer.install_plugin('analytics', nil, nil, nil, nil, nil, '0.7.1', bundles_dir)
|
17
18
|
|
18
19
|
check_installation(bundles_dir)
|
19
20
|
|
@@ -46,23 +47,23 @@ describe KPM::BaseInstaller do
|
|
46
47
|
|
47
48
|
begin
|
48
49
|
installer.install_plugin('invalid', nil, nil, nil, nil, nil, '1.2.3', bundles_dir)
|
49
|
-
|
50
|
-
rescue ArgumentError
|
50
|
+
raise 'Should not succeed to install invalid plugin'
|
51
|
+
rescue ArgumentError
|
52
|
+
# Expected
|
51
53
|
end
|
52
54
|
end
|
53
55
|
end
|
54
56
|
|
55
57
|
it 'should extract plugin name from file path' do
|
56
|
-
|
57
58
|
[
|
58
|
-
{:
|
59
|
-
{:
|
60
|
-
{:
|
61
|
-
{:
|
62
|
-
{:
|
63
|
-
{:
|
64
|
-
{:
|
65
|
-
{:
|
59
|
+
{ file_path: '/Somewhere/xxx-foo/target/xxx-1.0.0.jar', expected: 'xxx' },
|
60
|
+
{ file_path: '/Somewhere/xxx-foo/target/xxx-foo-bar-1.0.0.jar', expected: 'xxx-foo-bar' },
|
61
|
+
{ file_path: '/Somewhere/xxx-foo/target/xxx-foo-1.0.0.jar', expected: 'xxx-foo' },
|
62
|
+
{ file_path: '/Somewhere/xxx-foo/target/xxx-foo-1.0.0-SNAPSHOT.jar', expected: 'xxx-foo' },
|
63
|
+
{ file_path: '/Somewhere/xxx-foo/target/xxx-foo-1.0.jar', expected: 'xxx-foo' },
|
64
|
+
{ file_path: '/Somewhere/xxx-foo/target/xxx-foo-1.jar', expected: 'xxx-foo' },
|
65
|
+
{ file_path: '/Somewhere/xxx-foo/target/xxx-foo-abc-SNAPSHOT.jar', expected: 'xxx-foo' },
|
66
|
+
{ file_path: '/Somewhere/xxx-foo/target/xxx-foo-abc.jar', expected: 'xxx-foo' }
|
66
67
|
].each do |test|
|
67
68
|
KPM::Utils.get_plugin_name_from_file_path(test[:file_path]).should eq test[:expected]
|
68
69
|
end
|
@@ -75,14 +76,14 @@ describe KPM::BaseInstaller do
|
|
75
76
|
|
76
77
|
plugin_identifiers = read_plugin_identifiers(plugins_dir)
|
77
78
|
|
78
|
-
plugin_identifiers.size.should
|
79
|
+
plugin_identifiers.size.should eq 1
|
79
80
|
|
80
|
-
plugin_identifiers['analytics']['plugin_name'].should
|
81
|
-
plugin_identifiers['analytics']['group_id'].should
|
82
|
-
plugin_identifiers['analytics']['artifact_id'].should
|
83
|
-
plugin_identifiers['analytics']['packaging'].should
|
84
|
-
plugin_identifiers['analytics']['version'].should
|
85
|
-
plugin_identifiers['analytics']['language'].should
|
81
|
+
plugin_identifiers['analytics']['plugin_name'].should eq 'analytics-plugin'
|
82
|
+
plugin_identifiers['analytics']['group_id'].should eq 'org.kill-bill.billing.plugin.java'
|
83
|
+
plugin_identifiers['analytics']['artifact_id'].should eq 'analytics-plugin'
|
84
|
+
plugin_identifiers['analytics']['packaging'].should eq 'jar'
|
85
|
+
plugin_identifiers['analytics']['version'].should eq '0.7.1'
|
86
|
+
plugin_identifiers['analytics']['language'].should eq 'java'
|
86
87
|
|
87
88
|
File.file?(plugins_dir + '/plugins/java/analytics-plugin/0.7.1/tmp/disabled.txt').should be_false
|
88
89
|
end
|
@@ -92,26 +93,26 @@ describe KPM::BaseInstaller do
|
|
92
93
|
|
93
94
|
plugin_identifiers = read_plugin_identifiers(plugins_dir)
|
94
95
|
|
95
|
-
plugin_identifiers.size.should
|
96
|
+
plugin_identifiers.size.should eq 0
|
96
97
|
|
97
98
|
File.file?(plugins_dir + '/plugins/java/analytics-plugin/0.7.1/tmp/disabled.txt').should be_true
|
98
99
|
end
|
99
100
|
|
100
101
|
def common_checks(plugins_dir)
|
101
102
|
[
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
103
|
+
plugins_dir,
|
104
|
+
plugins_dir + '/plugins',
|
105
|
+
plugins_dir + '/plugins/java',
|
106
|
+
plugins_dir + '/plugins/java/analytics-plugin',
|
107
|
+
plugins_dir + '/plugins/java/analytics-plugin/0.7.1',
|
108
|
+
plugins_dir + '/plugins/java/analytics-plugin/0.7.1/tmp'
|
108
109
|
].each do |dir|
|
109
110
|
File.directory?(dir).should be_true
|
110
111
|
end
|
111
112
|
|
112
113
|
[
|
113
|
-
|
114
|
-
|
114
|
+
plugins_dir + '/plugins/plugin_identifiers.json',
|
115
|
+
plugins_dir + '/plugins/java/analytics-plugin/0.7.1/analytics-plugin-0.7.1.jar'
|
115
116
|
].each do |file|
|
116
117
|
File.file?(file).should be_true
|
117
118
|
end
|
@@ -1,8 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
require 'json'
|
3
5
|
|
4
6
|
describe KPM::Installer do
|
5
|
-
|
6
7
|
before(:all) do
|
7
8
|
@logger = Logger.new(STDOUT)
|
8
9
|
@logger.level = Logger::INFO
|
@@ -12,15 +13,15 @@ describe KPM::Installer do
|
|
12
13
|
Dir.mktmpdir do |dir|
|
13
14
|
kb_webapp_path = dir + '/KB_ROOT.war'
|
14
15
|
installer = KPM::Installer.new({
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
'killbill' => {
|
17
|
+
'webapp_path' => kb_webapp_path
|
18
|
+
}
|
18
19
|
},
|
19
20
|
@logger)
|
20
21
|
|
21
22
|
# No exception
|
22
23
|
response = nil
|
23
|
-
expect{ response = installer.install }.to_not raise_exception
|
24
|
+
expect { response = installer.install }.to_not raise_exception
|
24
25
|
response = JSON[response]
|
25
26
|
response['help'].should be_nil
|
26
27
|
response['killbill']['status'].should eq 'INSTALLED'
|
@@ -31,15 +32,15 @@ describe KPM::Installer do
|
|
31
32
|
Dir.mktmpdir do |dir|
|
32
33
|
kaui_webapp_path = dir + '/KAUI_ROOT.war'
|
33
34
|
installer = KPM::Installer.new({
|
34
|
-
|
35
|
-
|
36
|
-
|
35
|
+
'kaui' => {
|
36
|
+
'webapp_path' => kaui_webapp_path
|
37
|
+
}
|
37
38
|
},
|
38
39
|
@logger)
|
39
40
|
|
40
41
|
# No exception
|
41
42
|
response = nil
|
42
|
-
expect{ response = installer.install }.to_not raise_exception
|
43
|
+
expect { response = installer.install }.to_not raise_exception
|
43
44
|
response = JSON[response]
|
44
45
|
response['help'].should be_nil
|
45
46
|
response['kaui']['status'].should eq 'INSTALLED'
|
@@ -52,29 +53,29 @@ describe KPM::Installer do
|
|
52
53
|
kaui_webapp_path = dir + '/KAUI_ROOT.war'
|
53
54
|
plugins_dir = dir + '/bundles'
|
54
55
|
installer = KPM::Installer.new({
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
}
|
74
|
-
},
|
75
|
-
'kaui' => {
|
76
|
-
'webapp_path' => kaui_webapp_path
|
56
|
+
'killbill' => {
|
57
|
+
'webapp_path' => kb_webapp_path,
|
58
|
+
'plugins_dir' => plugins_dir,
|
59
|
+
'plugins' => {
|
60
|
+
'java' => [{
|
61
|
+
'name' => 'analytics',
|
62
|
+
'version' => '0.7.1'
|
63
|
+
}],
|
64
|
+
'ruby' => [{
|
65
|
+
'name' => 'payment-test-plugin',
|
66
|
+
'artifact_id' => 'payment-test-plugin',
|
67
|
+
'group_id' => 'org.kill-bill.billing.plugin.ruby',
|
68
|
+
'version' => '1.8.7'
|
69
|
+
},
|
70
|
+
{
|
71
|
+
'name' => 'stripe',
|
72
|
+
'version' => '3.0.3'
|
73
|
+
}]
|
77
74
|
}
|
75
|
+
},
|
76
|
+
'kaui' => {
|
77
|
+
'webapp_path' => kaui_webapp_path
|
78
|
+
}
|
78
79
|
},
|
79
80
|
@logger)
|
80
81
|
|
@@ -87,11 +88,10 @@ describe KPM::Installer do
|
|
87
88
|
|
88
89
|
# Finally verify that for both (well behaved) ruby and java plugin, skipping the install will still correctly return the `:bundle_dir`
|
89
90
|
info = installer.install_plugin('payment-test-plugin', nil, 'org.kill-bill.billing.plugin.ruby', 'payment-test-plugin', nil, nil, '1.8.7', plugins_dir)
|
90
|
-
info[:bundle_dir].should
|
91
|
-
|
91
|
+
info[:bundle_dir].should eq plugins_dir + '/plugins/ruby/killbill-payment-test/1.8.7'
|
92
92
|
|
93
|
-
info = installer.install_plugin('analytics', nil, nil, nil,
|
94
|
-
info[:bundle_dir].should
|
93
|
+
info = installer.install_plugin('analytics', nil, nil, nil, nil, nil, '0.7.1', plugins_dir)
|
94
|
+
info[:bundle_dir].should eq plugins_dir + '/plugins/java/analytics-plugin/0.7.1'
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
@@ -99,27 +99,27 @@ describe KPM::Installer do
|
|
99
99
|
|
100
100
|
def check_installation(plugins_dir, kb_webapp_path, kaui_webapp_path)
|
101
101
|
[
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
102
|
+
plugins_dir,
|
103
|
+
plugins_dir + '/platform',
|
104
|
+
plugins_dir + '/plugins',
|
105
|
+
plugins_dir + '/plugins/java',
|
106
|
+
plugins_dir + '/plugins/java/analytics-plugin',
|
107
|
+
plugins_dir + '/plugins/java/analytics-plugin/0.7.1',
|
108
|
+
plugins_dir + '/plugins/ruby',
|
109
|
+
plugins_dir + '/plugins/ruby/killbill-payment-test',
|
110
|
+
plugins_dir + '/plugins/ruby/killbill-payment-test/1.8.7',
|
111
|
+
plugins_dir + '/plugins/ruby/killbill-stripe'
|
112
112
|
].each do |dir|
|
113
113
|
File.directory?(dir).should be_true
|
114
114
|
end
|
115
115
|
|
116
116
|
[
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
117
|
+
kb_webapp_path,
|
118
|
+
kaui_webapp_path,
|
119
|
+
plugins_dir + '/platform/jruby.jar',
|
120
|
+
plugins_dir + '/plugins/plugin_identifiers.json',
|
121
|
+
plugins_dir + '/plugins/java/analytics-plugin/0.7.1/analytics-plugin-0.7.1.jar',
|
122
|
+
plugins_dir + '/plugins/ruby/killbill-payment-test/1.8.7/killbill.properties'
|
123
123
|
].each do |file|
|
124
124
|
File.file?(file).should be_true
|
125
125
|
end
|
@@ -128,27 +128,27 @@ describe KPM::Installer do
|
|
128
128
|
JSON.parse(f.read)
|
129
129
|
end
|
130
130
|
|
131
|
-
plugin_identifiers.size.should
|
132
|
-
|
133
|
-
plugin_identifiers['analytics']['plugin_name'].should
|
134
|
-
plugin_identifiers['analytics']['group_id'].should
|
135
|
-
plugin_identifiers['analytics']['artifact_id'].should
|
136
|
-
plugin_identifiers['analytics']['packaging'].should
|
137
|
-
plugin_identifiers['analytics']['version'].should
|
138
|
-
plugin_identifiers['analytics']['language'].should
|
139
|
-
|
140
|
-
plugin_identifiers['payment-test-plugin']['plugin_name'].should
|
141
|
-
plugin_identifiers['payment-test-plugin']['group_id'].should
|
142
|
-
plugin_identifiers['payment-test-plugin']['artifact_id'].should
|
143
|
-
plugin_identifiers['payment-test-plugin']['packaging'].should
|
144
|
-
plugin_identifiers['payment-test-plugin']['version'].should
|
145
|
-
plugin_identifiers['payment-test-plugin']['language'].should
|
146
|
-
|
147
|
-
plugin_identifiers['stripe']['plugin_name'].should
|
148
|
-
plugin_identifiers['stripe']['group_id'].should
|
149
|
-
plugin_identifiers['stripe']['artifact_id'].should
|
150
|
-
plugin_identifiers['stripe']['packaging'].should
|
151
|
-
plugin_identifiers['stripe']['version'].should
|
152
|
-
plugin_identifiers['stripe']['language'].should
|
131
|
+
plugin_identifiers.size.should eq 3
|
132
|
+
|
133
|
+
plugin_identifiers['analytics']['plugin_name'].should eq 'analytics-plugin'
|
134
|
+
plugin_identifiers['analytics']['group_id'].should eq 'org.kill-bill.billing.plugin.java'
|
135
|
+
plugin_identifiers['analytics']['artifact_id'].should eq 'analytics-plugin'
|
136
|
+
plugin_identifiers['analytics']['packaging'].should eq 'jar'
|
137
|
+
plugin_identifiers['analytics']['version'].should eq '0.7.1'
|
138
|
+
plugin_identifiers['analytics']['language'].should eq 'java'
|
139
|
+
|
140
|
+
plugin_identifiers['payment-test-plugin']['plugin_name'].should eq 'killbill-payment-test'
|
141
|
+
plugin_identifiers['payment-test-plugin']['group_id'].should eq 'org.kill-bill.billing.plugin.ruby'
|
142
|
+
plugin_identifiers['payment-test-plugin']['artifact_id'].should eq 'payment-test-plugin'
|
143
|
+
plugin_identifiers['payment-test-plugin']['packaging'].should eq 'tar.gz'
|
144
|
+
plugin_identifiers['payment-test-plugin']['version'].should eq '1.8.7'
|
145
|
+
plugin_identifiers['payment-test-plugin']['language'].should eq 'ruby'
|
146
|
+
|
147
|
+
plugin_identifiers['stripe']['plugin_name'].should eq 'killbill-stripe'
|
148
|
+
plugin_identifiers['stripe']['group_id'].should eq 'org.kill-bill.billing.plugin.ruby'
|
149
|
+
plugin_identifiers['stripe']['artifact_id'].should eq 'stripe-plugin'
|
150
|
+
plugin_identifiers['stripe']['packaging'].should eq 'tar.gz'
|
151
|
+
plugin_identifiers['stripe']['version'].should eq '3.0.3'
|
152
|
+
plugin_identifiers['stripe']['language'].should eq 'ruby'
|
153
153
|
end
|
154
154
|
end
|