buildr 1.3.5-x86-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +998 -0
- data/LICENSE +176 -0
- data/NOTICE +26 -0
- data/README.rdoc +134 -0
- data/Rakefile +45 -0
- data/_buildr +29 -0
- data/_jbuildr +29 -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/xmlbeans.rb +93 -0
- data/bin/buildr +19 -0
- data/buildr.buildfile +58 -0
- data/buildr.gemspec +65 -0
- data/doc/_config.yml +1 -0
- data/doc/_layouts/default.html +88 -0
- data/doc/_layouts/preface.html +22 -0
- data/doc/artifacts.textile +211 -0
- data/doc/building.textile +244 -0
- data/doc/contributing.textile +252 -0
- data/doc/css/default.css +236 -0
- data/doc/css/print.css +101 -0
- data/doc/css/syntax.css +23 -0
- data/doc/download.textile +79 -0
- data/doc/extending.textile +186 -0
- data/doc/images/1442160941-frontcover.jpg +0 -0
- data/doc/images/asf-logo.gif +0 -0
- data/doc/images/asf-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.png +0 -0
- data/doc/images/zbuildr.tif +0 -0
- data/doc/index.textile +69 -0
- data/doc/installing.textile +266 -0
- data/doc/languages.textile +459 -0
- data/doc/mailing_lists.textile +25 -0
- data/doc/more_stuff.textile +457 -0
- data/doc/packaging.textile +430 -0
- data/doc/preface.textile +54 -0
- data/doc/projects.textile +271 -0
- data/doc/quick_start.textile +210 -0
- data/doc/scripts/buildr-git.rb +512 -0
- data/doc/scripts/gitflow.rb +296 -0
- data/doc/scripts/install-jruby.sh +44 -0
- data/doc/scripts/install-linux.sh +72 -0
- data/doc/scripts/install-osx.sh +52 -0
- data/doc/settings_profiles.textile +280 -0
- data/doc/testing.textile +222 -0
- data/etc/KEYS +151 -0
- data/lib/buildr.rb +36 -0
- data/lib/buildr/core.rb +35 -0
- data/lib/buildr/core/application.rb +656 -0
- data/lib/buildr/core/build.rb +452 -0
- data/lib/buildr/core/checks.rb +254 -0
- data/lib/buildr/core/common.rb +150 -0
- data/lib/buildr/core/compile.rb +608 -0
- data/lib/buildr/core/environment.rb +129 -0
- data/lib/buildr/core/filter.rb +362 -0
- data/lib/buildr/core/generate.rb +195 -0
- data/lib/buildr/core/help.rb +119 -0
- data/lib/buildr/core/osx.rb +46 -0
- data/lib/buildr/core/progressbar.rb +156 -0
- data/lib/buildr/core/project.rb +866 -0
- data/lib/buildr/core/shell.rb +198 -0
- data/lib/buildr/core/test.rb +723 -0
- data/lib/buildr/core/transports.rb +559 -0
- data/lib/buildr/core/util.rb +449 -0
- data/lib/buildr/groovy.rb +19 -0
- data/lib/buildr/groovy/bdd.rb +106 -0
- data/lib/buildr/groovy/compiler.rb +138 -0
- data/lib/buildr/groovy/shell.rb +48 -0
- data/lib/buildr/ide.rb +19 -0
- data/lib/buildr/ide/eclipse.rb +334 -0
- data/lib/buildr/ide/eclipse/java.rb +53 -0
- data/lib/buildr/ide/eclipse/plugin.rb +68 -0
- data/lib/buildr/ide/eclipse/scala.rb +66 -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/java.rb +23 -0
- data/lib/buildr/java/ant.rb +94 -0
- data/lib/buildr/java/bdd.rb +459 -0
- data/lib/buildr/java/cobertura.rb +274 -0
- data/lib/buildr/java/commands.rb +213 -0
- data/lib/buildr/java/compiler.rb +349 -0
- data/lib/buildr/java/deprecated.rb +141 -0
- data/lib/buildr/java/emma.rb +244 -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 +137 -0
- data/lib/buildr/java/packaging.rb +716 -0
- data/lib/buildr/java/pom.rb +174 -0
- data/lib/buildr/java/rjb.rb +155 -0
- data/lib/buildr/java/test_result.rb +353 -0
- data/lib/buildr/java/tests.rb +333 -0
- data/lib/buildr/java/version_requirement.rb +172 -0
- data/lib/buildr/packaging.rb +24 -0
- data/lib/buildr/packaging/archive.rb +488 -0
- data/lib/buildr/packaging/artifact.rb +749 -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 +238 -0
- data/lib/buildr/packaging/tar.rb +186 -0
- data/lib/buildr/packaging/version_requirement.rb +172 -0
- data/lib/buildr/packaging/zip.rb +73 -0
- data/lib/buildr/packaging/ziptask.rb +316 -0
- data/lib/buildr/resources/buildr.icns +0 -0
- data/lib/buildr/scala.rb +25 -0
- data/lib/buildr/scala/bdd.rb +109 -0
- data/lib/buildr/scala/compiler.rb +195 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +35 -0
- data/lib/buildr/scala/shell.rb +55 -0
- data/lib/buildr/scala/tests.rb +157 -0
- data/lib/buildr/shell.rb +180 -0
- data/rakelib/checks.rake +57 -0
- data/rakelib/doc.rake +92 -0
- data/rakelib/jekylltask.rb +120 -0
- data/rakelib/package.rake +73 -0
- data/rakelib/release.rake +149 -0
- data/rakelib/rspec.rake +73 -0
- data/rakelib/setup.rake +54 -0
- data/rakelib/stage.rake +213 -0
- data/rakelib/stage.rake~ +213 -0
- data/spec/addon/drb_spec.rb +328 -0
- data/spec/core/application_spec.rb +502 -0
- data/spec/core/build_spec.rb +677 -0
- data/spec/core/checks_spec.rb +519 -0
- data/spec/core/common_spec.rb +670 -0
- data/spec/core/compile_spec.rb +583 -0
- data/spec/core/extension_spec.rb +93 -0
- data/spec/core/generate_spec.rb +33 -0
- data/spec/core/project_spec.rb +762 -0
- data/spec/core/test_spec.rb +1098 -0
- data/spec/core/transport_spec.rb +537 -0
- data/spec/core/util_spec.rb +67 -0
- data/spec/groovy/bdd_spec.rb +80 -0
- data/spec/groovy/compiler_spec.rb +240 -0
- data/spec/ide/eclipse_spec.rb +501 -0
- data/spec/ide/idea7x_spec.rb +84 -0
- data/spec/java/ant_spec.rb +33 -0
- data/spec/java/bdd_spec.rb +382 -0
- data/spec/java/cobertura_spec.rb +85 -0
- data/spec/java/compiler_spec.rb +446 -0
- data/spec/java/emma_spec.rb +119 -0
- data/spec/java/java_spec.rb +124 -0
- data/spec/java/packaging_spec.rb +1134 -0
- data/spec/java/test_coverage_helper.rb +257 -0
- data/spec/java/tests_spec.rb +493 -0
- data/spec/packaging/archive_spec.rb +527 -0
- data/spec/packaging/artifact_namespace_spec.rb +654 -0
- data/spec/packaging/artifact_spec.rb +795 -0
- data/spec/packaging/packaging_helper.rb +63 -0
- data/spec/packaging/packaging_spec.rb +684 -0
- data/spec/sandbox.rb +142 -0
- data/spec/scala/bdd_spec.rb +119 -0
- data/spec/scala/compiler_spec.rb +284 -0
- data/spec/scala/scala.rb +38 -0
- data/spec/scala/tests_spec.rb +261 -0
- data/spec/spec_helpers.rb +340 -0
- data/spec/version_requirement_spec.rb +129 -0
- metadata +383 -0
@@ -0,0 +1,84 @@
|
|
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__), '../spec_helpers')
|
18
|
+
|
19
|
+
|
20
|
+
module Idea7xHelper
|
21
|
+
def ipr_xml_elements
|
22
|
+
task('idea7x').invoke
|
23
|
+
REXML::Document.new(File.read("#{@project_name}-7x.ipr")).root.elements
|
24
|
+
end
|
25
|
+
|
26
|
+
def ipr_module_elements
|
27
|
+
ipr_xml_elements.to_a("//component[@name='ProjectModuleManager']/modules/module")
|
28
|
+
end
|
29
|
+
|
30
|
+
def ipr_module_filepaths
|
31
|
+
ipr_module_elements.collect { |m| m.attributes['filepath'] }
|
32
|
+
end
|
33
|
+
|
34
|
+
def ipr_module_fileurls
|
35
|
+
ipr_module_elements.collect { |m| m.attributes['fileurl'] }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
describe Idea7x do
|
41
|
+
include Idea7xHelper
|
42
|
+
|
43
|
+
describe "the project file" do
|
44
|
+
before do
|
45
|
+
@project_name = 'alphabet'
|
46
|
+
end
|
47
|
+
|
48
|
+
it "includes a module for the root project" do
|
49
|
+
# Current behavior is to only generate IMLs for packaged projects
|
50
|
+
define(@project_name) { project.version = '0.0.0'; package(:jar) }
|
51
|
+
ipr_module_elements.should have(1).element
|
52
|
+
ipr_module_filepaths.should == ["$PROJECT_DIR$/alphabet-7x.iml"]
|
53
|
+
ipr_module_fileurls.should == ["file://$PROJECT_DIR$/alphabet-7x.iml"]
|
54
|
+
end
|
55
|
+
|
56
|
+
it "includes an IML for a subproject" do
|
57
|
+
mkpath 'h'
|
58
|
+
define(@project_name) do
|
59
|
+
project.version = '0.0.0'; package(:jar)
|
60
|
+
define('h') do
|
61
|
+
package(:jar)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
ipr_module_elements.should have(2).elements
|
66
|
+
ipr_module_filepaths.should include("$PROJECT_DIR$/h/alphabet-h-7x.iml")
|
67
|
+
ipr_module_fileurls.should include("file://$PROJECT_DIR$/h/alphabet-h-7x.iml")
|
68
|
+
end
|
69
|
+
|
70
|
+
it "pays attention to the base_dir for a subproject" do
|
71
|
+
mkpath 'aitch'
|
72
|
+
define(@project_name) do
|
73
|
+
project.version = '0.0.0'; package(:jar)
|
74
|
+
define('h', :base_dir => 'aitch') do
|
75
|
+
package(:jar)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
ipr_module_elements.should have(2).elements
|
80
|
+
ipr_module_filepaths.should include("$PROJECT_DIR$/aitch/alphabet-h-7x.iml")
|
81
|
+
ipr_module_fileurls.should include("file://$PROJECT_DIR$/aitch/alphabet-h-7x.iml")
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,33 @@
|
|
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__), '../spec_helpers')
|
18
|
+
|
19
|
+
|
20
|
+
describe Buildr::Ant do
|
21
|
+
|
22
|
+
it 'should pick Ant version from ant build settings' do
|
23
|
+
Buildr::Ant.instance_eval { @dependencies = nil }
|
24
|
+
write 'build.yaml', 'ant: 1.2.3'
|
25
|
+
Buildr::Ant.dependencies.should include("org.apache.ant:ant:jar:1.2.3")
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should have REQUIRES up to version 1.5 since it was deprecated in version 1.3.3' do
|
29
|
+
Buildr::VERSION.should < '1.5'
|
30
|
+
lambda { Ant::REQUIRES }.should_not raise_error
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,382 @@
|
|
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 read passed specs from result yaml' 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
|
+
foo do
|
39
|
+
test.invoke
|
40
|
+
test.passed_tests.should eql([success])
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should read result yaml to obtain the list of failed specs' do
|
45
|
+
success = File.expand_path('src/spec/ruby/success_spec.rb')
|
46
|
+
write(success, 'describe("success") { it("is true") { nil.should be_nil } }')
|
47
|
+
failure = File.expand_path('src/spec/ruby/failure_spec.rb')
|
48
|
+
write(failure, 'describe("failure") { it("is false") { true.should == false } }')
|
49
|
+
error = File.expand_path('src/spec/ruby/error_spec.rb')
|
50
|
+
write(error, 'describe("error") { it("raises") { lambda; } }')
|
51
|
+
foo do
|
52
|
+
lambda { test.invoke }.should raise_error(/Tests failed/)
|
53
|
+
test.tests.should include(success, failure, error)
|
54
|
+
test.failed_tests.sort.should eql([failure, error].sort)
|
55
|
+
test.passed_tests.should eql([success])
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end if RUBY_PLATFORM =~ /java/ || ENV['JRUBY_HOME'] # RSpec
|
60
|
+
|
61
|
+
describe Buildr::JtestR do
|
62
|
+
|
63
|
+
before do
|
64
|
+
# JtestR currently requires JUnit 4.4
|
65
|
+
Buildr.settings.build['junit'] = '4.4'
|
66
|
+
|
67
|
+
# clear cached dependencies
|
68
|
+
Buildr::JUnit.instance_eval { @dependencies = nil }
|
69
|
+
Buildr::JtestR.instance_eval { @dependencies = nil }
|
70
|
+
end
|
71
|
+
|
72
|
+
def foo(*args, &prc)
|
73
|
+
define('foo', *args) do
|
74
|
+
test.using :jtestr, :output => false
|
75
|
+
if prc
|
76
|
+
instance_eval(&prc)
|
77
|
+
else
|
78
|
+
self
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'should be selected by :jtestr name' do
|
84
|
+
foo { test.framework.should eql(:jtestr) }
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'should apply to projects having test_unit sources' do
|
88
|
+
define('one', :base_dir => 'one') do
|
89
|
+
write _('src/spec/ruby/one_test.rb')
|
90
|
+
JtestR.applies_to?(self).should be_true
|
91
|
+
end
|
92
|
+
define('two', :base_dir => 'two') do
|
93
|
+
write _('src/spec/ruby/twoTest.rb')
|
94
|
+
JtestR.applies_to?(self).should be_true
|
95
|
+
end
|
96
|
+
define('three', :base_dir => 'three') do
|
97
|
+
write _('src/spec/ruby/tc_three.rb')
|
98
|
+
JtestR.applies_to?(self).should be_true
|
99
|
+
end
|
100
|
+
define('four', :base_dir => 'four') do
|
101
|
+
write _('src/spec/ruby/ts_four.rb')
|
102
|
+
JtestR.applies_to?(self).should be_true
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'should apply to projects having rspec sources' do
|
107
|
+
define('one', :base_dir => 'one') do
|
108
|
+
write _('src/spec/ruby/one_spec.rb')
|
109
|
+
JtestR.applies_to?(self).should be_true
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'should apply to projects having expectations sources' do
|
114
|
+
define('one', :base_dir => 'one') do
|
115
|
+
write _('src/spec/ruby/one_expect.rb')
|
116
|
+
JtestR.applies_to?(self).should be_true
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'should apply to projects having junit sources' do
|
121
|
+
define('one', :base_dir => 'one') do
|
122
|
+
write _('src/test/java/example/OneTest.java', <<-JAVA)
|
123
|
+
package example;
|
124
|
+
public class OneTest extends junit.framework.TestCase { }
|
125
|
+
JAVA
|
126
|
+
JtestR.applies_to?(self).should be_true
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
it 'should apply to projects having testng sources' do
|
131
|
+
define('one', :base_dir => 'one') do
|
132
|
+
write _('src/test/java/example/OneTest.java', <<-JAVA)
|
133
|
+
package example;
|
134
|
+
public class OneTest {
|
135
|
+
@org.testng.annotations.Test
|
136
|
+
public void testNothing() {}
|
137
|
+
}
|
138
|
+
JAVA
|
139
|
+
JtestR.applies_to?(self).should be_true
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
it 'should use a java compiler if java sources found' do
|
144
|
+
foo do
|
145
|
+
write _('src/spec/java/Something.java'), 'public class Something {}'
|
146
|
+
test.compile.language.should eql(:java)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
it 'should load user jtestr_config.rb' do
|
151
|
+
foo do
|
152
|
+
hello = _('hello')
|
153
|
+
write('src/spec/ruby/jtestr_config.rb', "File.open('#{hello}', 'w') { |f| f.write 'HELLO' }")
|
154
|
+
write('src/spec/ruby/some_spec.rb')
|
155
|
+
test.invoke
|
156
|
+
File.should be_exist(hello)
|
157
|
+
File.read(hello).should == 'HELLO'
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
it 'should run junit tests' do
|
162
|
+
write('src/test/java/example/SuccessTest.java', <<-JAVA)
|
163
|
+
package example;
|
164
|
+
public class SuccessTest extends junit.framework.TestCase {
|
165
|
+
public void testSuccess() { assertTrue(true); }
|
166
|
+
}
|
167
|
+
JAVA
|
168
|
+
write('src/test/java/example/FailureTest.java', <<-JAVA)
|
169
|
+
package example;
|
170
|
+
public class FailureTest extends junit.framework.TestCase {
|
171
|
+
public void testFailure() { assertTrue(false); }
|
172
|
+
}
|
173
|
+
JAVA
|
174
|
+
foo do
|
175
|
+
lambda { test.invoke }.should raise_error(/Tests failed/)
|
176
|
+
test.tests.should include('example.SuccessTest', 'example.FailureTest')
|
177
|
+
test.failed_tests.should include('example.FailureTest')
|
178
|
+
test.passed_tests.should include('example.SuccessTest')
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
it 'should run testng tests' do
|
183
|
+
write('src/test/java/example/Success.java', <<-JAVA)
|
184
|
+
package example;
|
185
|
+
public class Success {
|
186
|
+
@org.testng.annotations.Test
|
187
|
+
public void annotatedSuccess() { org.testng.Assert.assertTrue(true); }
|
188
|
+
}
|
189
|
+
JAVA
|
190
|
+
write('src/test/java/example/Failure.java', <<-JAVA)
|
191
|
+
package example;
|
192
|
+
public class Failure {
|
193
|
+
@org.testng.annotations.Test
|
194
|
+
public void annotatedFail() { org.testng.Assert.fail("FAIL"); }
|
195
|
+
}
|
196
|
+
JAVA
|
197
|
+
foo do
|
198
|
+
lambda { test.invoke }.should raise_error(/Tests failed/)
|
199
|
+
test.tests.should include('example.Success', 'example.Failure')
|
200
|
+
test.failed_tests.should include('example.Failure')
|
201
|
+
test.passed_tests.should include('example.Success')
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
it 'should run test_unit' do
|
206
|
+
success = File.expand_path('src/spec/ruby/success_test.rb')
|
207
|
+
write(success, <<-TESTUNIT)
|
208
|
+
require 'test/unit'
|
209
|
+
class TC_Success < Test::Unit::TestCase
|
210
|
+
def test_success
|
211
|
+
assert true
|
212
|
+
end
|
213
|
+
end
|
214
|
+
TESTUNIT
|
215
|
+
failure = File.expand_path('src/spec/ruby/failure_test.rb')
|
216
|
+
write(failure, <<-TESTUNIT)
|
217
|
+
require 'test/unit'
|
218
|
+
class TC_Failure < Test::Unit::TestCase
|
219
|
+
def test_failure
|
220
|
+
assert false
|
221
|
+
end
|
222
|
+
end
|
223
|
+
TESTUNIT
|
224
|
+
error = File.expand_path('src/spec/ruby/error_test.rb')
|
225
|
+
write(error, <<-TESTUNIT)
|
226
|
+
require 'test/unit'
|
227
|
+
class TC_Error < Test::Unit::TestCase
|
228
|
+
def test_error
|
229
|
+
lambda;
|
230
|
+
end
|
231
|
+
end
|
232
|
+
TESTUNIT
|
233
|
+
foo do
|
234
|
+
lambda { test.invoke }.should raise_error(/Tests failed/)
|
235
|
+
test.tests.should include(success, failure, error)
|
236
|
+
test.failed_tests.should include(failure, error)
|
237
|
+
test.passed_tests.should include(success)
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
it 'should run expectations' do
|
242
|
+
success = File.expand_path('src/spec/ruby/success_expect.rb')
|
243
|
+
write(success, 'Expectations { expect(true) { true } }')
|
244
|
+
failure = File.expand_path('src/spec/ruby/failure_expect.rb')
|
245
|
+
write(failure, 'Expectations { expect(true) { false } }')
|
246
|
+
error = File.expand_path('src/spec/ruby/error_expect.rb')
|
247
|
+
write(error, 'Expectations { expect(nil) { lambda; } }')
|
248
|
+
foo do
|
249
|
+
lambda { test.invoke }.should raise_error(/Tests failed/)
|
250
|
+
test.tests.should include(success, failure, error)
|
251
|
+
test.failed_tests.should include(failure, error)
|
252
|
+
test.passed_tests.should include(success)
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
it 'should run rspecs' do
|
257
|
+
success = File.expand_path('src/spec/ruby/success_spec.rb')
|
258
|
+
write(success, 'describe("success") { it("is true") { nil.should be_nil } }')
|
259
|
+
failure = File.expand_path('src/spec/ruby/failure_spec.rb')
|
260
|
+
write(failure, 'describe("failure") { it("is false") { true.should == false } }')
|
261
|
+
error = File.expand_path('src/spec/ruby/error_spec.rb')
|
262
|
+
write(error, 'describe("error") { it("raises") { lambda; } }')
|
263
|
+
pending = File.expand_path('src/spec/ruby/pending_spec.rb')
|
264
|
+
write(pending, 'describe("peding") { it "is not implemented" }')
|
265
|
+
foo do
|
266
|
+
lambda { test.invoke }.should raise_error(/Tests failed/)
|
267
|
+
test.tests.should include(success, failure, error)
|
268
|
+
test.failed_tests.should include(failure, error)
|
269
|
+
test.passed_tests.should include(success)
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
after do
|
274
|
+
# reset to default
|
275
|
+
Buildr.settings.build['junit'] = nil
|
276
|
+
Buildr::JUnit.instance_eval { @dependencies = nil }
|
277
|
+
Buildr::JtestR.instance_eval { @dependencies = nil }
|
278
|
+
end
|
279
|
+
|
280
|
+
end if RUBY_PLATFORM =~ /java/ || ENV['JRUBY_HOME'] # JtestR
|
281
|
+
|
282
|
+
describe Buildr::JBehave do
|
283
|
+
def foo(*args, &prc)
|
284
|
+
define('foo', *args) do
|
285
|
+
test.using :jbehave
|
286
|
+
if prc
|
287
|
+
instance_eval(&prc)
|
288
|
+
else
|
289
|
+
self
|
290
|
+
end
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
it 'should apply to projects having JBehave sources' do
|
295
|
+
define('one', :base_dir => 'one') do
|
296
|
+
write _('src/spec/java/SomeBehaviour.java'), 'public class SomeBehaviour {}'
|
297
|
+
JBehave.applies_to?(self).should be_true
|
298
|
+
end
|
299
|
+
define('two', :base_dir => 'two') do
|
300
|
+
write _('src/test/java/SomeBehaviour.java'), 'public class SomeBehaviour {}'
|
301
|
+
JBehave.applies_to?(self).should be_false
|
302
|
+
end
|
303
|
+
define('three', :base_dir => 'three') do
|
304
|
+
write _('src/spec/java/SomeBehavior.java'), 'public class SomeBehavior {}'
|
305
|
+
JBehave.applies_to?(self).should be_true
|
306
|
+
end
|
307
|
+
define('four', :base_dir => 'four') do
|
308
|
+
write _('src/test/java/SomeBehavior.java'), 'public class SomeBehavior {}'
|
309
|
+
JBehave.applies_to?(self).should be_false
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
it 'should be selected by :jbehave name' do
|
314
|
+
foo { test.framework.should eql(:jbehave) }
|
315
|
+
end
|
316
|
+
|
317
|
+
it 'should select a java compiler for its sources' do
|
318
|
+
write 'src/test/java/SomeBehavior.java', 'public class SomeBehavior {}'
|
319
|
+
foo do
|
320
|
+
test.compile.language.should eql(:java)
|
321
|
+
end
|
322
|
+
end
|
323
|
+
|
324
|
+
it 'should include JBehave dependencies' do
|
325
|
+
foo do
|
326
|
+
test.compile.dependencies.should include(artifact("org.jbehave:jbehave:jar::#{JBehave.version}"))
|
327
|
+
test.dependencies.should include(artifact("org.jbehave:jbehave:jar::#{JBehave.version}"))
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
it 'should include JMock dependencies' do
|
332
|
+
foo do
|
333
|
+
test.compile.dependencies.should include(artifact("jmock:jmock:jar:#{JMock.version}"))
|
334
|
+
test.dependencies.should include(artifact("jmock:jmock:jar:#{JMock.version}"))
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
it 'should include classes whose name ends with Behavior' do
|
339
|
+
write 'src/spec/java/some/FooBehavior.java', <<-JAVA
|
340
|
+
package some;
|
341
|
+
public class FooBehavior {
|
342
|
+
public void shouldFoo() { assert true; }
|
343
|
+
}
|
344
|
+
JAVA
|
345
|
+
write 'src/spec/java/some/NotATest.java', <<-JAVA
|
346
|
+
package some;
|
347
|
+
public class NotATest { }
|
348
|
+
JAVA
|
349
|
+
foo.tap do |project|
|
350
|
+
project.test.invoke
|
351
|
+
project.test.tests.should include('some.FooBehavior')
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
355
|
+
|
356
|
+
it 'should include classes implementing Behaviours' do
|
357
|
+
write 'src/spec/java/some/MyBehaviours.java', <<-JAVA
|
358
|
+
package some;
|
359
|
+
public class MyBehaviours implements
|
360
|
+
org.jbehave.core.behaviour.Behaviours {
|
361
|
+
public Class[] getBehaviours() {
|
362
|
+
return new Class[] { some.FooBehave.class };
|
363
|
+
}
|
364
|
+
}
|
365
|
+
JAVA
|
366
|
+
write 'src/spec/java/some/FooBehave.java', <<-JAVA
|
367
|
+
package some;
|
368
|
+
public class FooBehave {
|
369
|
+
public void shouldFoo() { assert true; }
|
370
|
+
}
|
371
|
+
JAVA
|
372
|
+
write 'src/spec/java/some/NotATest.java', <<-JAVA
|
373
|
+
package some;
|
374
|
+
public class NotATest { }
|
375
|
+
JAVA
|
376
|
+
foo.tap do |project|
|
377
|
+
project.test.invoke
|
378
|
+
project.test.tests.should include('some.MyBehaviours')
|
379
|
+
end
|
380
|
+
end
|
381
|
+
|
382
|
+
end # JBehave
|