ivy4r 0.9.12 → 0.9.13

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.
@@ -1,194 +1,196 @@
1
- $:.unshift File.join(File.dirname(__FILE__),'..','..','lib')
2
-
3
- require 'rubygems'
4
- require 'test/unit'
5
- require 'ivy4r'
6
- require 'antwrap'
7
- require 'fileutils'
8
-
9
- module Ivy
10
- class Ivy4rTest < Test::Unit::TestCase
11
-
12
- def setup
13
- @ivy4r = Ivy4r.new
14
- @ivy_test_xml = File.join(File.dirname(__FILE__), 'ivy', 'ivytest.xml')
15
- end
16
-
17
- def test_ant_returns_default_wrapper
18
- assert_not_nil @ivy4r.ant
19
- assert_kind_of ::Antwrap::AntProject, @ivy4r.ant
20
- assert_equal Dir.pwd, @ivy4r.ant.basedir
21
- assert_equal true, @ivy4r.ant.declarative
22
- end
23
-
24
- def test_ant_returns_always_same_instance
25
- first = @ivy4r.ant
26
- second = @ivy4r.ant
27
- assert_same first, second
28
- end
29
-
30
- def test_ant_returns_set_instance_if_provided
31
- provided = "bla"
32
- @ivy4r.ant = provided
33
- @ivy4r.instance_eval("@init_done = true")
34
- assert_equal provided, @ivy4r.ant
35
- end
36
-
37
- def test_cleancache_returns_nil
38
- result = @ivy4r.cleancache
39
-
40
- assert_nil result
41
- end
42
-
43
- def test_info_returns_values_for_file
44
- result = @ivy4r.info :file => @ivy_test_xml
45
-
46
- assert_not_nil result
47
- assert_equal 'blau', result['ivy.organisation']
48
- end
49
-
50
- def test_buildnumber_returns_infos
51
- result = @ivy4r.buildnumber :organisation => 'oro', :module => 'oro'
52
-
53
- assert_not_nil result
54
- assert_equal '2.0.8', result['ivy.revision']
55
- assert_equal '2.0.9', result['ivy.new.revision']
56
- assert_equal '8', result['ivy.build.number']
57
- assert_equal '9', result['ivy.new.build.number']
58
- end
59
-
60
- def test_settings_returns_nil
61
- result = @ivy4r.settings :file => File.join(File.dirname(__FILE__), 'ivy', 'ivysettings.xml')
62
-
63
- assert_nil result
64
- end
65
-
66
- def test_configure_returns_custom_properties
67
- result = @ivy4r.configure :file => File.join(File.dirname(__FILE__), 'ivy', 'ivysettings.xml')
68
-
69
- assert_not_nil result
70
- assert_equal 'myvalue', result['myparam.ivy.instance']
71
- end
72
-
73
- def test_property_setting_getting_to_from_ant
74
- # use a java hashmap for testing!!
75
- @ivy4r.instance_eval("def ant_properties;@ant_properties||=java.util.HashMap.new;end")
76
- name, value = 'name', 'value'
77
- @ivy4r.property[name] = value
78
-
79
- assert_equal value, @ivy4r.property[name]
80
- end
81
-
82
- def test_resolve_values_for_file
83
- result = @ivy4r.resolve :file => @ivy_test_xml
84
-
85
- assert_not_nil result
86
- assert_equal 'blau', result['ivy.organisation']
87
- assert_equal 4, result['ivy.resolved.configurations'].size, "has: #{result['ivy.resolved.configurations'].join(', ')}"
88
- end
89
-
90
- def test_cachepath_using_previous_resolve_contains_jar
91
- @ivy4r.resolve :organisation => "oro", :module => "oro", :revision => "2.0.8", :keep => true, :inline => true
92
- result = @ivy4r.cachepath :pathid => 'mytestpathid'
93
-
94
- assert_not_nil result
95
- assert result.any? {|a| a =~ /.*oro.*\.jar/ && a =~ /.*2\.0\.8*/ }
96
- end
97
-
98
- def test_cachepath_with_resolve_contains_jars
99
- result = @ivy4r.cachepath :organisation => "oro", :module => "oro", :revision => "2.0.8", :inline => true, :pathid => 'mytestpathid'
100
-
101
- assert_not_nil result
102
- assert result.any? {|a| a =~ /.*oro.*\.jar/ && a =~ /.*2\.0\.8*/ }
103
- end
104
-
105
- def test_findrevision_found_correct_version
106
- result = @ivy4r.findrevision :organisation => "oro", :module => "oro", :revision => "2.0.8"
107
-
108
- assert_equal '2.0.8', result
109
- end
110
-
111
- def test_findrevision_not_found_nil
112
- result = @ivy4r.findrevision :organisation => "oro", :module => "oro", :revision => "1unknown1"
113
-
114
- assert_nil result
115
- end
116
-
117
- def test_artifactproperty_deps_contained
118
- @ivy4r.resolve :file => @ivy_test_xml
119
- result = @ivy4r.artifactproperty :name => '[organisation]-[module]', :value => '[revision]'
120
-
121
- assert_not_nil result
122
- assert result.any? {|k,v| k == 'oro-oro' && v == '2.0.8' }
123
- end
124
-
125
- def test_artifactreport_xml_returned
126
- target = File.join(Dir.pwd, "temp_test#{Time.new.strftime('%Y%m%d%H%M%S')}")
127
- FileUtils.mkdir(target)
128
- @ivy4r.resolve :file => @ivy_test_xml
129
- result = @ivy4r.artifactreport :tofile => File.join(target, 'test.xml')
130
-
131
- assert_not_nil result
132
- assert result =~ /.*<module organisation="oro".*/
133
- ensure
134
- FileUtils.rm_rf target
135
- end
136
-
137
- def test_retrieve_created_dir_with_artifacts
138
- target = File.join(Dir.pwd, "temp_test#{Time.new.strftime('%Y%m%d%H%M%S')}")
139
- FileUtils.mkdir(target)
140
- @ivy4r.resolve :file => @ivy_test_xml
141
- result = @ivy4r.retrieve :pattern => "#{target}/[organisation]/[module].[ext]"
142
-
143
- assert_nil result
144
- assert Dir.glob(File.join(target, '**/oro.jar')).size > 0, "Contains the artifacts"
145
- ensure
146
- FileUtils.rm_rf target
147
- end
148
-
149
- def test_report_created_reports
150
- target = File.join(Dir.pwd, "temp_test#{Time.new.strftime('%Y%m%d%H%M%S')}")
151
- FileUtils.mkdir(target)
152
- @ivy4r.resolve :file => @ivy_test_xml
153
- result = @ivy4r.report :todir => target
154
-
155
- assert_nil result
156
- assert Dir.glob(File.join(target, '**/*')).size > 0, "Contains the reports"
157
- ensure
158
- FileUtils.rm_rf target
159
- end
160
-
161
- def test_buildlist_correct_list
162
- target = File.join(File.dirname(__FILE__), "buildlist")
163
- result = @ivy4r.buildlist :reference => 'testpath', :nested => {
164
- :fileset => [
165
- {:dir => File.join(target, "sub"), :includes => '**/buildfile'},
166
- {:dir => File.join(target, "p1"), :includes => 'buildfile'}
167
- ]
168
- }
169
-
170
- assert_equal 3, result.size
171
- result.map! { |file| File.expand_path(file) }
172
- assert_equal File.expand_path(File.join(target, "p1", "buildfile")), result[0]
173
- assert_equal File.expand_path(File.join(target, "sub", "p2", "buildfile")), result[1]
174
- assert_equal File.expand_path(File.join(target, "sub", "p3", "buildfile")), result[2]
175
- end
176
-
177
- def test_makepom_returns_content
178
- target = File.join(File.dirname(__FILE__), "testpom.xml")
179
- result = @ivy4r.makepom :ivyfile => @ivy_test_xml, :pomfile => target, :nested => {
180
- :mapping => {:conf => 'default', :scope => 'runtime' }
181
- }
182
-
183
- assert_equal IO.read(target), result
184
- ensure
185
- FileUtils.rm target
186
- end
187
-
188
- #def test_listmodules_lists_ivy_stuff
189
- # result = @antwrap.listmodules :organisation => '*apache*', :module => '*ivy*', :revision => '2.*',
190
- # :matcher => 'glob', :property => 'rums-[organisation][module]', :value => 'found'
191
- # assert result.find {|k,v| k =~ /rums-/ && v == 'found'}, "found: #{result.inspect}"
192
- #end
193
- end
194
- end
1
+ $:.unshift File.join(File.dirname(__FILE__),'..','..','lib')
2
+
3
+ require 'rubygems'
4
+ require 'test/unit'
5
+ require 'ivy4r'
6
+ require 'antwrap'
7
+ require 'fileutils'
8
+
9
+ module Ivy
10
+ class Ivy4rTest < Test::Unit::TestCase
11
+
12
+ def setup
13
+ @ivy4r = Ivy4r.new
14
+ @ivy_test_xml = File.join(File.dirname(__FILE__), 'ivy', 'ivytest.xml')
15
+ end
16
+
17
+ def test_ant_returns_default_wrapper
18
+ assert_not_nil @ivy4r.ant
19
+ assert_kind_of ::Antwrap::AntProject, @ivy4r.ant
20
+ assert_equal Dir.pwd, @ivy4r.ant.basedir
21
+ assert_equal true, @ivy4r.ant.declarative
22
+ end
23
+
24
+ def test_ant_returns_always_same_instance
25
+ first = @ivy4r.ant
26
+ second = @ivy4r.ant
27
+ assert_same first, second
28
+ end
29
+
30
+ def test_ant_returns_set_instance_if_provided
31
+ provided = "bla"
32
+ @ivy4r.ant = provided
33
+ @ivy4r.instance_eval("@init_done = true")
34
+ assert_equal provided, @ivy4r.ant
35
+ end
36
+
37
+ def test_cleancache_returns_nil
38
+ result = @ivy4r.cleancache
39
+
40
+ assert_nil result
41
+ end
42
+
43
+ def test_info_returns_values_for_file
44
+ result = @ivy4r.info :file => @ivy_test_xml
45
+
46
+ assert_not_nil result
47
+ assert_equal 'blau', result['ivy.organisation']
48
+ end
49
+
50
+ def test_buildnumber_returns_infos
51
+ result = @ivy4r.buildnumber :organisation => 'oro', :module => 'oro'
52
+
53
+ assert_not_nil result
54
+ assert_equal '2.0.8', result['ivy.revision']
55
+ assert_equal '2.0.9', result['ivy.new.revision']
56
+ assert_equal '8', result['ivy.build.number']
57
+ assert_equal '9', result['ivy.new.build.number']
58
+ end
59
+
60
+ def test_settings_returns_nil
61
+ result = @ivy4r.settings :file => File.join(File.dirname(__FILE__), 'ivy', 'ivysettings.xml')
62
+
63
+ assert_nil result
64
+ end
65
+
66
+ def test_configure_returns_custom_properties
67
+ result = @ivy4r.configure :file => File.join(File.dirname(__FILE__), 'ivy', 'ivysettings.xml')
68
+
69
+ assert_not_nil result
70
+ assert_equal 'myvalue', result['myparam.ivy.instance']
71
+ end
72
+
73
+ =begin
74
+ def test_property_setting_getting_to_from_ant
75
+ # use a java hashmap for testing!!
76
+ @ivy4r.instance_eval("def ant_properties;@ant_properties||=java.util.HashMap.new;end")
77
+ name, value = 'name', 'value'
78
+ @ivy4r.property[name] = value
79
+
80
+ assert_equal value, @ivy4r.property[name]
81
+ end
82
+
83
+ =end
84
+ def test_resolve_values_for_file
85
+ result = @ivy4r.resolve :file => @ivy_test_xml
86
+
87
+ assert_not_nil result
88
+ assert_equal 'blau', result['ivy.organisation']
89
+ assert_equal 4, result['ivy.resolved.configurations'].size, "has: #{result['ivy.resolved.configurations'].join(', ')}"
90
+ end
91
+
92
+ def test_cachepath_using_previous_resolve_contains_jar
93
+ @ivy4r.resolve :organisation => "oro", :module => "oro", :revision => "2.0.8", :keep => true, :inline => true
94
+ result = @ivy4r.cachepath :pathid => 'mytestpathid'
95
+
96
+ assert_not_nil result
97
+ assert result.any? {|a| a =~ /.*oro.*\.jar/ && a =~ /.*2\.0\.8*/ }
98
+ end
99
+
100
+ def test_cachepath_with_resolve_contains_jars
101
+ result = @ivy4r.cachepath :organisation => "oro", :module => "oro", :revision => "2.0.8", :inline => true, :pathid => 'mytestpathid'
102
+
103
+ assert_not_nil result
104
+ assert result.any? {|a| a =~ /.*oro.*\.jar/ && a =~ /.*2\.0\.8*/ }
105
+ end
106
+
107
+ def test_findrevision_found_correct_version
108
+ result = @ivy4r.findrevision :organisation => "oro", :module => "oro", :revision => "2.0.8"
109
+
110
+ assert_equal '2.0.8', result
111
+ end
112
+
113
+ def test_findrevision_not_found_nil
114
+ result = @ivy4r.findrevision :organisation => "oro", :module => "oro", :revision => "1unknown1"
115
+
116
+ assert_nil result
117
+ end
118
+
119
+ def test_artifactproperty_deps_contained
120
+ @ivy4r.resolve :file => @ivy_test_xml
121
+ result = @ivy4r.artifactproperty :name => '[organisation]-[module]', :value => '[revision]'
122
+
123
+ assert_not_nil result
124
+ assert result.any? {|k,v| k == 'oro-oro' && v == '2.0.8' }
125
+ end
126
+
127
+ def test_artifactreport_xml_returned
128
+ target = File.join(Dir.pwd, "temp_test#{Time.new.strftime('%Y%m%d%H%M%S')}")
129
+ FileUtils.mkdir(target)
130
+ @ivy4r.resolve :file => @ivy_test_xml
131
+ result = @ivy4r.artifactreport :tofile => File.join(target, 'test.xml')
132
+
133
+ assert_not_nil result
134
+ assert result =~ /.*<module organisation="oro".*/
135
+ ensure
136
+ FileUtils.rm_rf target
137
+ end
138
+
139
+ def test_retrieve_created_dir_with_artifacts
140
+ target = File.join(Dir.pwd, "temp_test#{Time.new.strftime('%Y%m%d%H%M%S')}")
141
+ FileUtils.mkdir(target)
142
+ @ivy4r.resolve :file => @ivy_test_xml
143
+ result = @ivy4r.retrieve :pattern => "#{target}/[organisation]/[module].[ext]"
144
+
145
+ assert_nil result
146
+ assert Dir.glob(File.join(target, '**/oro.jar')).size > 0, "Contains the artifacts"
147
+ ensure
148
+ FileUtils.rm_rf target
149
+ end
150
+
151
+ def test_report_created_reports
152
+ target = File.join(Dir.pwd, "temp_test#{Time.new.strftime('%Y%m%d%H%M%S')}")
153
+ FileUtils.mkdir(target)
154
+ @ivy4r.resolve :file => @ivy_test_xml
155
+ result = @ivy4r.report :todir => target
156
+
157
+ assert_nil result
158
+ assert Dir.glob(File.join(target, '**/*')).size > 0, "Contains the reports"
159
+ ensure
160
+ FileUtils.rm_rf target
161
+ end
162
+
163
+ def test_buildlist_correct_list
164
+ target = File.join(File.dirname(__FILE__), "buildlist")
165
+ result = @ivy4r.buildlist :reference => 'testpath', :nested => {
166
+ :fileset => [
167
+ {:dir => File.join(target, "sub"), :includes => '**/buildfile'},
168
+ {:dir => File.join(target, "p1"), :includes => 'buildfile'}
169
+ ]
170
+ }
171
+
172
+ assert_equal 3, result.size
173
+ result.map! { |file| File.expand_path(file) }
174
+ assert_equal File.expand_path(File.join(target, "p1", "buildfile")), result[0]
175
+ assert_equal File.expand_path(File.join(target, "sub", "p2", "buildfile")), result[1]
176
+ assert_equal File.expand_path(File.join(target, "sub", "p3", "buildfile")), result[2]
177
+ end
178
+
179
+ def test_makepom_returns_content
180
+ target = File.join(File.dirname(__FILE__), "testpom.xml")
181
+ result = @ivy4r.makepom :ivyfile => @ivy_test_xml, :pomfile => target, :nested => {
182
+ :mapping => {:conf => 'default', :scope => 'runtime' }
183
+ }
184
+
185
+ assert_equal IO.read(target), result
186
+ ensure
187
+ FileUtils.rm target
188
+ end
189
+
190
+ #def test_listmodules_lists_ivy_stuff
191
+ # result = @antwrap.listmodules :organisation => '*apache*', :module => '*ivy*', :revision => '2.*',
192
+ # :matcher => 'glob', :property => 'rums-[organisation][module]', :value => 'found'
193
+ # assert result.find {|k,v| k =~ /rums-/ && v == 'found'}, "found: #{result.inspect}"
194
+ #end
195
+ end
196
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ivy4r
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.12
4
+ version: 0.9.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Klaas Prause
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-21 00:00:00 +01:00
12
+ date: 2010-03-08 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency