ittayd-buildr 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +915 -0
- data/DISCLAIMER +7 -0
- data/LICENSE +176 -0
- data/NOTICE +26 -0
- data/README.rdoc +146 -0
- data/Rakefile +64 -0
- data/_buildr +28 -0
- data/addon/buildr/antlr.rb +65 -0
- data/addon/buildr/cobertura.rb +22 -0
- data/addon/buildr/drb.rb +281 -0
- data/addon/buildr/emma.rb +22 -0
- data/addon/buildr/hibernate.rb +142 -0
- data/addon/buildr/javacc.rb +85 -0
- data/addon/buildr/jdepend.rb +60 -0
- data/addon/buildr/jetty.rb +248 -0
- data/addon/buildr/jibx.rb +86 -0
- data/addon/buildr/nailgun.rb +221 -0
- data/addon/buildr/openjpa.rb +90 -0
- data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
- data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
- data/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
- data/addon/buildr/path.rb +136 -0
- data/addon/buildr/xmlbeans.rb +93 -0
- data/bin/buildr +19 -0
- data/buildr.buildfile +53 -0
- data/buildr.gemspec +58 -0
- data/doc/css/default.css +228 -0
- data/doc/css/print.css +100 -0
- data/doc/css/syntax.css +52 -0
- data/doc/images/apache-incubator-logo.png +0 -0
- data/doc/images/buildr-hires.png +0 -0
- data/doc/images/buildr.png +0 -0
- data/doc/images/favicon.png +0 -0
- data/doc/images/growl-icon.tiff +0 -0
- data/doc/images/note.png +0 -0
- data/doc/images/project-structure.png +0 -0
- data/doc/images/tip.png +0 -0
- data/doc/images/zbuildr.tif +0 -0
- data/doc/pages/artifacts.textile +207 -0
- data/doc/pages/building.textile +240 -0
- data/doc/pages/contributing.textile +208 -0
- data/doc/pages/download.textile +62 -0
- data/doc/pages/extending.textile +175 -0
- data/doc/pages/getting_started.textile +273 -0
- data/doc/pages/index.textile +42 -0
- data/doc/pages/languages.textile +407 -0
- data/doc/pages/mailing_lists.textile +17 -0
- data/doc/pages/more_stuff.textile +314 -0
- data/doc/pages/packaging.textile +427 -0
- data/doc/pages/projects.textile +274 -0
- data/doc/pages/recipes.textile +103 -0
- data/doc/pages/settings_profiles.textile +274 -0
- data/doc/pages/testing.textile +212 -0
- data/doc/pages/troubleshooting.textile +103 -0
- data/doc/pages/whats_new.textile +323 -0
- data/doc/print.haml +51 -0
- data/doc/print.toc.yaml +29 -0
- data/doc/scripts/buildr-git.rb +412 -0
- data/doc/scripts/install-jruby.sh +44 -0
- data/doc/scripts/install-linux.sh +64 -0
- data/doc/scripts/install-osx.sh +52 -0
- data/doc/site.haml +56 -0
- data/doc/site.toc.yaml +47 -0
- data/etc/KEYS +151 -0
- data/etc/git-svn-authors +16 -0
- data/lib/buildr/core/application.rb +665 -0
- data/lib/buildr/core/build.rb +311 -0
- data/lib/buildr/core/checks.rb +254 -0
- data/lib/buildr/core/common.rb +150 -0
- data/lib/buildr/core/compile.rb +590 -0
- data/lib/buildr/core/environment.rb +117 -0
- data/lib/buildr/core/filter.rb +366 -0
- data/lib/buildr/core/generate.rb +195 -0
- data/lib/buildr/core/help.rb +119 -0
- data/lib/buildr/core/osx.rb +49 -0
- data/lib/buildr/core/progressbar.rb +156 -0
- data/lib/buildr/core/project.rb +923 -0
- data/lib/buildr/core/test.rb +715 -0
- data/lib/buildr/core/transports.rb +560 -0
- data/lib/buildr/core/util.rb +294 -0
- data/lib/buildr/core.rb +29 -0
- data/lib/buildr/groovy/bdd.rb +106 -0
- data/lib/buildr/groovy/compiler.rb +138 -0
- data/lib/buildr/groovy.rb +18 -0
- data/lib/buildr/ide/eclipse.rb +222 -0
- data/lib/buildr/ide/idea.ipr.template +300 -0
- data/lib/buildr/ide/idea.rb +190 -0
- data/lib/buildr/ide/idea7x.ipr.template +290 -0
- data/lib/buildr/ide/idea7x.rb +212 -0
- data/lib/buildr/ide.rb +19 -0
- data/lib/buildr/java/ant.rb +92 -0
- data/lib/buildr/java/bdd.rb +451 -0
- data/lib/buildr/java/cobertura.rb +236 -0
- data/lib/buildr/java/commands.rb +211 -0
- data/lib/buildr/java/compiler.rb +348 -0
- data/lib/buildr/java/deprecated.rb +141 -0
- data/lib/buildr/java/emma.rb +238 -0
- data/lib/buildr/java/jruby.rb +117 -0
- data/lib/buildr/java/jtestr_runner.rb.erb +116 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +119 -0
- data/lib/buildr/java/packaging.rb +717 -0
- data/lib/buildr/java/pom.rb +174 -0
- data/lib/buildr/java/rjb.rb +155 -0
- data/lib/buildr/java/test_result.rb +307 -0
- data/lib/buildr/java/tests.rb +329 -0
- data/lib/buildr/java/version_requirement.rb +172 -0
- data/lib/buildr/java.rb +23 -0
- data/lib/buildr/packaging/archive.rb +488 -0
- data/lib/buildr/packaging/artifact.rb +759 -0
- data/lib/buildr/packaging/artifact_namespace.rb +972 -0
- data/lib/buildr/packaging/artifact_search.rb +140 -0
- data/lib/buildr/packaging/gems.rb +102 -0
- data/lib/buildr/packaging/package.rb +233 -0
- data/lib/buildr/packaging/tar.rb +186 -0
- data/lib/buildr/packaging/version_requirement.rb +172 -0
- data/lib/buildr/packaging/zip.rb +64 -0
- data/lib/buildr/packaging/ziptask.rb +313 -0
- data/lib/buildr/packaging.rb +24 -0
- data/lib/buildr/resources/buildr.icns +0 -0
- data/lib/buildr/scala/compiler.rb +109 -0
- data/lib/buildr/scala/tests.rb +203 -0
- data/lib/buildr/scala.rb +19 -0
- data/lib/buildr.rb +33 -0
- data/rakelib/apache.rake +191 -0
- data/rakelib/changelog.rake +57 -0
- data/rakelib/doc.rake +103 -0
- data/rakelib/package.rake +76 -0
- data/rakelib/release.rake +65 -0
- data/rakelib/rspec.rake +83 -0
- data/rakelib/rubyforge.rake +56 -0
- data/rakelib/scm.rake +49 -0
- data/rakelib/setup.rake +81 -0
- data/rakelib/stage.rake +48 -0
- data/spec/addon/drb_spec.rb +328 -0
- data/spec/core/application_spec.rb +419 -0
- data/spec/core/build_spec.rb +423 -0
- data/spec/core/checks_spec.rb +519 -0
- data/spec/core/common_spec.rb +670 -0
- data/spec/core/compile_spec.rb +582 -0
- data/spec/core/generate_spec.rb +33 -0
- data/spec/core/project_spec.rb +776 -0
- data/spec/core/test_spec.rb +1098 -0
- data/spec/core/transport_spec.rb +500 -0
- data/spec/groovy/bdd_spec.rb +80 -0
- data/spec/groovy/compiler_spec.rb +239 -0
- data/spec/ide/eclipse_spec.rb +311 -0
- data/spec/java/ant.rb +33 -0
- data/spec/java/bdd_spec.rb +358 -0
- data/spec/java/cobertura_spec.rb +77 -0
- data/spec/java/compiler_spec.rb +446 -0
- data/spec/java/emma_spec.rb +120 -0
- data/spec/java/java_spec.rb +96 -0
- data/spec/java/packaging_spec.rb +1120 -0
- data/spec/java/test_coverage_spec.rb +255 -0
- data/spec/java/tests_spec.rb +471 -0
- data/spec/packaging/archive_spec.rb +503 -0
- data/spec/packaging/artifact_namespace_spec.rb +646 -0
- data/spec/packaging/artifact_spec.rb +795 -0
- data/spec/packaging/packaging_helper.rb +63 -0
- data/spec/packaging/packaging_spec.rb +589 -0
- data/spec/sandbox.rb +139 -0
- data/spec/scala/compiler_spec.rb +228 -0
- data/spec/scala/tests_spec.rb +215 -0
- data/spec/spec_helpers.rb +327 -0
- data/spec/version_requirement_spec.rb +123 -0
- metadata +377 -0
@@ -0,0 +1,358 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with this
|
3
|
+
# work for additional information regarding copyright ownership. The ASF
|
4
|
+
# licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
+
# "License"); 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, WITHOUT
|
12
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
+
# License for the specific language governing permissions and limitations under
|
14
|
+
# the License.
|
15
|
+
|
16
|
+
require File.join(File.dirname(__FILE__), '../spec_helpers')
|
17
|
+
|
18
|
+
describe Buildr::RSpec do
|
19
|
+
|
20
|
+
def foo(*args, &prc)
|
21
|
+
define('foo', *args) do
|
22
|
+
test.using :rspec, :output => false
|
23
|
+
if prc
|
24
|
+
instance_eval(&prc)
|
25
|
+
else
|
26
|
+
self
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should be selected by :rspec name' do
|
32
|
+
foo { test.framework.should eql(:rspec) }
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should run rspecs' do
|
36
|
+
success = File.expand_path('src/spec/ruby/success_spec.rb')
|
37
|
+
write(success, 'describe("success") { it("is true") { nil.should be_nil } }')
|
38
|
+
failure = File.expand_path('src/spec/ruby/failure_spec.rb')
|
39
|
+
write(failure, 'describe("failure") { it("is false") { true.should == false } }')
|
40
|
+
error = File.expand_path('src/spec/ruby/error_spec.rb')
|
41
|
+
write(error, 'describe("error") { it("raises") { lambda; } }')
|
42
|
+
foo do
|
43
|
+
lambda { test.invoke }.should raise_error(/Tests failed/)
|
44
|
+
test.tests.should include(success, failure, error)
|
45
|
+
test.failed_tests.should include(failure, error)
|
46
|
+
test.passed_tests.should include(success)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end if RUBY_PLATFORM =~ /java/ || ENV['JRUBY_HOME'] # RSpec
|
51
|
+
|
52
|
+
describe Buildr::JtestR do
|
53
|
+
|
54
|
+
def foo(*args, &prc)
|
55
|
+
define('foo', *args) do
|
56
|
+
test.using :jtestr, :output => false
|
57
|
+
if prc
|
58
|
+
instance_eval(&prc)
|
59
|
+
else
|
60
|
+
self
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'should be selected by :jtestr name' do
|
66
|
+
foo { test.framework.should eql(:jtestr) }
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'should apply to projects having test_unit sources' do
|
70
|
+
define('one', :base_dir => 'one') do
|
71
|
+
write _('src/spec/ruby/one_test.rb')
|
72
|
+
JtestR.applies_to?(self).should be_true
|
73
|
+
end
|
74
|
+
define('two', :base_dir => 'two') do
|
75
|
+
write _('src/spec/ruby/twoTest.rb')
|
76
|
+
JtestR.applies_to?(self).should be_true
|
77
|
+
end
|
78
|
+
define('three', :base_dir => 'three') do
|
79
|
+
write _('src/spec/ruby/tc_three.rb')
|
80
|
+
JtestR.applies_to?(self).should be_true
|
81
|
+
end
|
82
|
+
define('four', :base_dir => 'four') do
|
83
|
+
write _('src/spec/ruby/ts_four.rb')
|
84
|
+
JtestR.applies_to?(self).should be_true
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'should apply to projects having rspec sources' do
|
89
|
+
define('one', :base_dir => 'one') do
|
90
|
+
write _('src/spec/ruby/one_spec.rb')
|
91
|
+
JtestR.applies_to?(self).should be_true
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'should apply to projects having expectations sources' do
|
96
|
+
define('one', :base_dir => 'one') do
|
97
|
+
write _('src/spec/ruby/one_expect.rb')
|
98
|
+
JtestR.applies_to?(self).should be_true
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'should apply to projects having junit sources' do
|
103
|
+
define('one', :base_dir => 'one') do
|
104
|
+
write _('src/test/java/example/OneTest.java', <<-JAVA)
|
105
|
+
package example;
|
106
|
+
public class OneTest extends junit.framework.TestCase { }
|
107
|
+
JAVA
|
108
|
+
JtestR.applies_to?(self).should be_true
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'should apply to projects having testng sources' do
|
113
|
+
define('one', :base_dir => 'one') do
|
114
|
+
write _('src/test/java/example/OneTest.java', <<-JAVA)
|
115
|
+
package example;
|
116
|
+
public class OneTest {
|
117
|
+
@org.testng.annotations.Test
|
118
|
+
public void testNothing() {}
|
119
|
+
}
|
120
|
+
JAVA
|
121
|
+
JtestR.applies_to?(self).should be_true
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
it 'should use a java compiler if java sources found' do
|
126
|
+
foo do
|
127
|
+
write _('src/spec/java/Something.java'), 'public class Something {}'
|
128
|
+
test.compile.language.should eql(:java)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'should load user jtestr_config.rb' do
|
133
|
+
foo do
|
134
|
+
hello = _('hello')
|
135
|
+
write('src/spec/ruby/jtestr_config.rb', "File.open('#{hello}', 'w') { |f| f.write 'HELLO' }")
|
136
|
+
write('src/spec/ruby/some_spec.rb')
|
137
|
+
test.invoke
|
138
|
+
File.should be_exist(hello)
|
139
|
+
File.read(hello).should == 'HELLO'
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
it 'should run junit tests' do
|
144
|
+
write('src/test/java/example/SuccessTest.java', <<-JAVA)
|
145
|
+
package example;
|
146
|
+
public class SuccessTest extends junit.framework.TestCase {
|
147
|
+
public void testSuccess() { assertTrue(true); }
|
148
|
+
}
|
149
|
+
JAVA
|
150
|
+
write('src/test/java/example/FailureTest.java', <<-JAVA)
|
151
|
+
package example;
|
152
|
+
public class FailureTest extends junit.framework.TestCase {
|
153
|
+
public void testFailure() { assertTrue(false); }
|
154
|
+
}
|
155
|
+
JAVA
|
156
|
+
foo do
|
157
|
+
lambda { test.invoke }.should raise_error(/Tests failed/)
|
158
|
+
test.tests.should include('example.SuccessTest', 'example.FailureTest')
|
159
|
+
test.failed_tests.should include('example.FailureTest')
|
160
|
+
test.passed_tests.should include('example.SuccessTest')
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
it 'should run testng tests' do
|
165
|
+
write('src/test/java/example/Success.java', <<-JAVA)
|
166
|
+
package example;
|
167
|
+
public class Success {
|
168
|
+
@org.testng.annotations.Test
|
169
|
+
public void annotatedSuccess() { org.testng.Assert.assertTrue(true); }
|
170
|
+
}
|
171
|
+
JAVA
|
172
|
+
write('src/test/java/example/Failure.java', <<-JAVA)
|
173
|
+
package example;
|
174
|
+
public class Failure {
|
175
|
+
@org.testng.annotations.Test
|
176
|
+
public void annotatedFail() { org.testng.Assert.fail("FAIL"); }
|
177
|
+
}
|
178
|
+
JAVA
|
179
|
+
foo do
|
180
|
+
lambda { test.invoke }.should raise_error(/Tests failed/)
|
181
|
+
test.tests.should include('example.Success', 'example.Failure')
|
182
|
+
test.failed_tests.should include('example.Failure')
|
183
|
+
test.passed_tests.should include('example.Success')
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
it 'should run test_unit' do
|
188
|
+
success = File.expand_path('src/spec/ruby/success_test.rb')
|
189
|
+
write(success, <<-TESTUNIT)
|
190
|
+
require 'test/unit'
|
191
|
+
class TC_Success < Test::Unit::TestCase
|
192
|
+
def test_success
|
193
|
+
assert true
|
194
|
+
end
|
195
|
+
end
|
196
|
+
TESTUNIT
|
197
|
+
failure = File.expand_path('src/spec/ruby/failure_test.rb')
|
198
|
+
write(failure, <<-TESTUNIT)
|
199
|
+
require 'test/unit'
|
200
|
+
class TC_Failure < Test::Unit::TestCase
|
201
|
+
def test_failure
|
202
|
+
assert false
|
203
|
+
end
|
204
|
+
end
|
205
|
+
TESTUNIT
|
206
|
+
error = File.expand_path('src/spec/ruby/error_test.rb')
|
207
|
+
write(error, <<-TESTUNIT)
|
208
|
+
require 'test/unit'
|
209
|
+
class TC_Error < Test::Unit::TestCase
|
210
|
+
def test_error
|
211
|
+
lambda;
|
212
|
+
end
|
213
|
+
end
|
214
|
+
TESTUNIT
|
215
|
+
foo do
|
216
|
+
lambda { test.invoke }.should raise_error(/Tests failed/)
|
217
|
+
test.tests.should include(success, failure, error)
|
218
|
+
test.failed_tests.should include(failure, error)
|
219
|
+
test.passed_tests.should include(success)
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
it 'should run expectations' do
|
224
|
+
success = File.expand_path('src/spec/ruby/success_expect.rb')
|
225
|
+
write(success, 'Expectations { expect(true) { true } }')
|
226
|
+
failure = File.expand_path('src/spec/ruby/failure_expect.rb')
|
227
|
+
write(failure, 'Expectations { expect(true) { false } }')
|
228
|
+
error = File.expand_path('src/spec/ruby/error_expect.rb')
|
229
|
+
write(error, 'Expectations { expect(nil) { lambda; } }')
|
230
|
+
foo do
|
231
|
+
lambda { test.invoke }.should raise_error(/Tests failed/)
|
232
|
+
test.tests.should include(success, failure, error)
|
233
|
+
test.failed_tests.should include(failure, error)
|
234
|
+
test.passed_tests.should include(success)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
it 'should run rspecs' do
|
239
|
+
success = File.expand_path('src/spec/ruby/success_spec.rb')
|
240
|
+
write(success, 'describe("success") { it("is true") { nil.should be_nil } }')
|
241
|
+
failure = File.expand_path('src/spec/ruby/failure_spec.rb')
|
242
|
+
write(failure, 'describe("failure") { it("is false") { true.should == false } }')
|
243
|
+
error = File.expand_path('src/spec/ruby/error_spec.rb')
|
244
|
+
write(error, 'describe("error") { it("raises") { lambda; } }')
|
245
|
+
pending = File.expand_path('src/spec/ruby/pending_spec.rb')
|
246
|
+
write(pending, 'describe("peding") { it "is not implemented" }')
|
247
|
+
foo do
|
248
|
+
lambda { test.invoke }.should raise_error(/Tests failed/)
|
249
|
+
test.tests.should include(success, failure, error)
|
250
|
+
test.failed_tests.should include(failure, error)
|
251
|
+
test.passed_tests.should include(success)
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
|
256
|
+
end if RUBY_PLATFORM =~ /java/ || ENV['JRUBY_HOME'] # JtestR
|
257
|
+
|
258
|
+
describe Buildr::JBehave do
|
259
|
+
def foo(*args, &prc)
|
260
|
+
define('foo', *args) do
|
261
|
+
test.using :jbehave
|
262
|
+
if prc
|
263
|
+
instance_eval(&prc)
|
264
|
+
else
|
265
|
+
self
|
266
|
+
end
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
270
|
+
it 'should apply to projects having JBehave sources' do
|
271
|
+
define('one', :base_dir => 'one') do
|
272
|
+
write _('src/spec/java/SomeBehaviour.java'), 'public class SomeBehaviour {}'
|
273
|
+
JBehave.applies_to?(self).should be_true
|
274
|
+
end
|
275
|
+
define('two', :base_dir => 'two') do
|
276
|
+
write _('src/test/java/SomeBehaviour.java'), 'public class SomeBehaviour {}'
|
277
|
+
JBehave.applies_to?(self).should be_false
|
278
|
+
end
|
279
|
+
define('three', :base_dir => 'three') do
|
280
|
+
write _('src/spec/java/SomeBehavior.java'), 'public class SomeBehavior {}'
|
281
|
+
JBehave.applies_to?(self).should be_true
|
282
|
+
end
|
283
|
+
define('four', :base_dir => 'four') do
|
284
|
+
write _('src/test/java/SomeBehavior.java'), 'public class SomeBehavior {}'
|
285
|
+
JBehave.applies_to?(self).should be_false
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
it 'should be selected by :jbehave name' do
|
290
|
+
foo { test.framework.should eql(:jbehave) }
|
291
|
+
end
|
292
|
+
|
293
|
+
it 'should select a java compiler for its sources' do
|
294
|
+
write 'src/test/java/SomeBehavior.java', 'public class SomeBehavior {}'
|
295
|
+
foo do
|
296
|
+
test.compile.language.should eql(:java)
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
300
|
+
it 'should include JBehave dependencies' do
|
301
|
+
foo do
|
302
|
+
test.compile.dependencies.should include(artifact("org.jbehave:jbehave:jar::#{JBehave.version}"))
|
303
|
+
test.dependencies.should include(artifact("org.jbehave:jbehave:jar::#{JBehave.version}"))
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
it 'should include JMock dependencies' do
|
308
|
+
foo do
|
309
|
+
test.compile.dependencies.should include(artifact("jmock:jmock:jar:#{JMock.version}"))
|
310
|
+
test.dependencies.should include(artifact("jmock:jmock:jar:#{JMock.version}"))
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
it 'should include classes whose name ends with Behavior' do
|
315
|
+
write 'src/spec/java/some/FooBehavior.java', <<-JAVA
|
316
|
+
package some;
|
317
|
+
public class FooBehavior {
|
318
|
+
public void shouldFoo() { assert true; }
|
319
|
+
}
|
320
|
+
JAVA
|
321
|
+
write 'src/spec/java/some/NotATest.java', <<-JAVA
|
322
|
+
package some;
|
323
|
+
public class NotATest { }
|
324
|
+
JAVA
|
325
|
+
foo.tap do |project|
|
326
|
+
project.test.invoke
|
327
|
+
project.test.tests.should include('some.FooBehavior')
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
|
332
|
+
it 'should include classes implementing Behaviours' do
|
333
|
+
write 'src/spec/java/some/MyBehaviours.java', <<-JAVA
|
334
|
+
package some;
|
335
|
+
public class MyBehaviours implements
|
336
|
+
org.jbehave.core.behaviour.Behaviours {
|
337
|
+
public Class[] getBehaviours() {
|
338
|
+
return new Class[] { some.FooBehave.class };
|
339
|
+
}
|
340
|
+
}
|
341
|
+
JAVA
|
342
|
+
write 'src/spec/java/some/FooBehave.java', <<-JAVA
|
343
|
+
package some;
|
344
|
+
public class FooBehave {
|
345
|
+
public void shouldFoo() { assert true; }
|
346
|
+
}
|
347
|
+
JAVA
|
348
|
+
write 'src/spec/java/some/NotATest.java', <<-JAVA
|
349
|
+
package some;
|
350
|
+
public class NotATest { }
|
351
|
+
JAVA
|
352
|
+
foo.tap do |project|
|
353
|
+
project.test.invoke
|
354
|
+
project.test.tests.should include('some.MyBehaviours')
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
end # JBehave
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with this
|
3
|
+
# work for additional information regarding copyright ownership. The ASF
|
4
|
+
# licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
+
# "License"); 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, WITHOUT
|
12
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
+
# License for the specific language governing permissions and limitations under
|
14
|
+
# the License.
|
15
|
+
|
16
|
+
|
17
|
+
require File.join(File.dirname(__FILE__), 'test_coverage_spec')
|
18
|
+
Sandbox.require_optional_extension 'buildr/java/cobertura'
|
19
|
+
|
20
|
+
Buildr::Cobertura::requires
|
21
|
+
|
22
|
+
|
23
|
+
describe Buildr::Cobertura do
|
24
|
+
before do
|
25
|
+
# Reloading the extension because the sandbox removes all its actions
|
26
|
+
load File.expand_path('../lib/buildr/java/cobertura.rb')
|
27
|
+
@tool_module = Buildr::Cobertura
|
28
|
+
end
|
29
|
+
|
30
|
+
it_should_behave_like 'test coverage tool'
|
31
|
+
|
32
|
+
describe 'project-specific' do
|
33
|
+
|
34
|
+
describe 'data file' do
|
35
|
+
it 'should have a default value' do
|
36
|
+
define('foo').cobertura.data_file.should point_to_path('reports/cobertura.ser')
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should be overridable' do
|
40
|
+
define('foo') { cobertura.data_file = path_to('target/data.cobertura') }
|
41
|
+
project('foo').cobertura.data_file.should point_to_path('target/data.cobertura')
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should be created during instrumentation' do
|
45
|
+
write 'src/main/java/Foo.java', 'public class Foo {}'
|
46
|
+
define('foo')
|
47
|
+
task('foo:cobertura:instrument').invoke
|
48
|
+
file(project('foo').cobertura.data_file).should exist
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe 'instrumentation' do
|
53
|
+
before do
|
54
|
+
['Foo', 'Bar'].each { |cls| write File.join('src/main/java', "#{cls}.java"), "public class #{cls} {}" }
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should instrument only included classes' do
|
58
|
+
define('foo') { cobertura.include 'Foo' }
|
59
|
+
task("foo:cobertura:instrument").invoke
|
60
|
+
Dir.chdir('target/instrumented/classes') { Dir.glob('*').sort.should == ['Foo.class'] }
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'should not instrument excluded classes' do
|
64
|
+
define('foo') { cobertura.exclude 'Foo' }
|
65
|
+
task("foo:cobertura:instrument").invoke
|
66
|
+
Dir.chdir('target/instrumented/classes') { Dir.glob('*').sort.should == ['Bar.class'] }
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'should instrument classes that are included but not excluded' do
|
70
|
+
write 'src/main/java/Baz.java', 'public class Baz {}'
|
71
|
+
define('foo') { cobertura.include('Ba').exclude('ar') }
|
72
|
+
task("foo:cobertura:instrument").invoke
|
73
|
+
Dir.chdir('target/instrumented/classes') { Dir.glob('*').sort.should == ['Baz.class'] }
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|