mguymon-buildr 1.4.5-java
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.
- data/CHANGELOG +1291 -0
- data/LICENSE +176 -0
- data/NOTICE +26 -0
- data/README.rdoc +134 -0
- data/Rakefile +44 -0
- data/_buildr +35 -0
- data/_jbuildr +35 -0
- data/addon/buildr/antlr.rb +65 -0
- data/addon/buildr/bnd.rb +147 -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 +149 -0
- data/addon/buildr/javacc.rb +85 -0
- data/addon/buildr/jaxb_xjc.rb +72 -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 +88 -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/protobuf.rb +88 -0
- data/addon/buildr/xmlbeans.rb +93 -0
- data/bin/buildr +19 -0
- data/buildr.buildfile +58 -0
- data/buildr.gemspec +78 -0
- data/doc/_config.yml +1 -0
- data/doc/_layouts/default.html +90 -0
- data/doc/_layouts/preface.html +22 -0
- data/doc/artifacts.textile +217 -0
- data/doc/building.textile +276 -0
- data/doc/contributing.textile +268 -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 +151 -0
- data/doc/extending.textile +212 -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 +109 -0
- data/doc/installing.textile +284 -0
- data/doc/languages.textile +599 -0
- data/doc/mailing_lists.textile +29 -0
- data/doc/more_stuff.textile +845 -0
- data/doc/packaging.textile +618 -0
- data/doc/preface.textile +54 -0
- data/doc/projects.textile +276 -0
- data/doc/quick_start.textile +210 -0
- data/doc/releasing.textile +117 -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 +73 -0
- data/doc/scripts/install-osx.sh +52 -0
- data/doc/settings_profiles.textile +287 -0
- data/doc/testing.textile +247 -0
- data/etc/KEYS +189 -0
- data/lib/buildr.rb +44 -0
- data/lib/buildr/clojure.rb +34 -0
- data/lib/buildr/clojure/shell.rb +52 -0
- data/lib/buildr/core.rb +34 -0
- data/lib/buildr/core/application.rb +700 -0
- data/lib/buildr/core/build.rb +516 -0
- data/lib/buildr/core/cc.rb +166 -0
- data/lib/buildr/core/checks.rb +253 -0
- data/lib/buildr/core/common.rb +151 -0
- data/lib/buildr/core/compile.rb +622 -0
- data/lib/buildr/core/doc.rb +276 -0
- data/lib/buildr/core/environment.rb +129 -0
- data/lib/buildr/core/filter.rb +404 -0
- data/lib/buildr/core/generate.rb +197 -0
- data/lib/buildr/core/help.rb +119 -0
- data/lib/buildr/core/jrebel.rb +42 -0
- data/lib/buildr/core/linux.rb +30 -0
- data/lib/buildr/core/osx.rb +46 -0
- data/lib/buildr/core/progressbar.rb +161 -0
- data/lib/buildr/core/project.rb +975 -0
- data/lib/buildr/core/run.rb +43 -0
- data/lib/buildr/core/shell.rb +137 -0
- data/lib/buildr/core/test.rb +843 -0
- data/lib/buildr/core/transports.rb +575 -0
- data/lib/buildr/core/util.rb +537 -0
- data/lib/buildr/groovy.rb +20 -0
- data/lib/buildr/groovy/bdd.rb +106 -0
- data/lib/buildr/groovy/compiler.rb +153 -0
- data/lib/buildr/groovy/doc.rb +76 -0
- data/lib/buildr/groovy/shell.rb +57 -0
- data/lib/buildr/ide.rb +19 -0
- data/lib/buildr/ide/eclipse.rb +427 -0
- data/lib/buildr/ide/eclipse/java.rb +53 -0
- data/lib/buildr/ide/eclipse/plugin.rb +71 -0
- data/lib/buildr/ide/eclipse/scala.rb +68 -0
- data/lib/buildr/ide/idea.rb +576 -0
- data/lib/buildr/java.rb +25 -0
- data/lib/buildr/java/ant.rb +94 -0
- data/lib/buildr/java/bdd.rb +460 -0
- data/lib/buildr/java/cobertura.rb +297 -0
- data/lib/buildr/java/commands.rb +223 -0
- data/lib/buildr/java/compiler.rb +135 -0
- data/lib/buildr/java/deprecated.rb +141 -0
- data/lib/buildr/java/doc.rb +86 -0
- data/lib/buildr/java/ecj.rb +69 -0
- data/lib/buildr/java/emma.rb +244 -0
- data/lib/buildr/java/external.rb +73 -0
- data/lib/buildr/java/jruby.rb +122 -0
- data/lib/buildr/java/jtestr_result.rb +295 -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 +142 -0
- data/lib/buildr/java/packaging.rb +734 -0
- data/lib/buildr/java/pom.rb +178 -0
- data/lib/buildr/java/rjb.rb +154 -0
- data/lib/buildr/java/test_result.rb +101 -0
- data/lib/buildr/java/tests.rb +362 -0
- data/lib/buildr/java/version_requirement.rb +172 -0
- data/lib/buildr/packaging.rb +25 -0
- data/lib/buildr/packaging/archive.rb +535 -0
- data/lib/buildr/packaging/artifact.rb +904 -0
- data/lib/buildr/packaging/artifact_namespace.rb +984 -0
- data/lib/buildr/packaging/artifact_search.rb +140 -0
- data/lib/buildr/packaging/gems.rb +105 -0
- data/lib/buildr/packaging/package.rb +249 -0
- data/lib/buildr/packaging/repository_array.rb +108 -0
- data/lib/buildr/packaging/tar.rb +189 -0
- data/lib/buildr/packaging/version_requirement.rb +192 -0
- data/lib/buildr/packaging/zip.rb +178 -0
- data/lib/buildr/packaging/ziptask.rb +356 -0
- data/lib/buildr/resources/buildr.icns +0 -0
- data/lib/buildr/resources/completed.png +0 -0
- data/lib/buildr/resources/failed.png +0 -0
- data/lib/buildr/resources/icons-license.txt +17 -0
- data/lib/buildr/run.rb +195 -0
- data/lib/buildr/scala.rb +26 -0
- data/lib/buildr/scala/bdd.rb +118 -0
- data/lib/buildr/scala/compiler.rb +242 -0
- data/lib/buildr/scala/doc.rb +142 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
- data/lib/buildr/scala/shell.rb +52 -0
- data/lib/buildr/scala/tests.rb +171 -0
- data/lib/buildr/shell.rb +185 -0
- data/lib/buildr/version.rb +18 -0
- data/rakelib/all-in-one.rake +113 -0
- data/rakelib/checks.rake +57 -0
- data/rakelib/doc.rake +137 -0
- data/rakelib/metrics.rake +39 -0
- data/rakelib/package.rake +73 -0
- data/rakelib/release.rake +160 -0
- data/rakelib/rspec.rake +91 -0
- data/rakelib/setup.rake +66 -0
- data/rakelib/stage.rake +220 -0
- data/spec/addon/bnd_spec.rb +330 -0
- data/spec/addon/drb_spec.rb +328 -0
- data/spec/addon/jaxb_xjc_spec.rb +125 -0
- data/spec/core/application_spec.rb +631 -0
- data/spec/core/build_spec.rb +837 -0
- data/spec/core/cc_spec.rb +224 -0
- data/spec/core/checks_spec.rb +519 -0
- data/spec/core/common_spec.rb +725 -0
- data/spec/core/compile_spec.rb +658 -0
- data/spec/core/doc_spec.rb +195 -0
- data/spec/core/extension_spec.rb +201 -0
- data/spec/core/generate_spec.rb +33 -0
- data/spec/core/project_spec.rb +772 -0
- data/spec/core/run_spec.rb +93 -0
- data/spec/core/shell_spec.rb +146 -0
- data/spec/core/test_spec.rb +1320 -0
- data/spec/core/transport_spec.rb +544 -0
- data/spec/core/util_spec.rb +141 -0
- data/spec/groovy/bdd_spec.rb +80 -0
- data/spec/groovy/compiler_spec.rb +251 -0
- data/spec/groovy/doc_spec.rb +65 -0
- data/spec/ide/eclipse_spec.rb +739 -0
- data/spec/ide/idea_spec.rb +1145 -0
- data/spec/java/ant_spec.rb +37 -0
- data/spec/java/bdd_spec.rb +374 -0
- data/spec/java/cobertura_spec.rb +112 -0
- data/spec/java/commands_spec.rb +93 -0
- data/spec/java/compiler_spec.rb +252 -0
- data/spec/java/doc_spec.rb +56 -0
- data/spec/java/ecj_spec.rb +115 -0
- data/spec/java/emma_spec.rb +121 -0
- data/spec/java/external_spec.rb +56 -0
- data/spec/java/java_spec.rb +132 -0
- data/spec/java/packaging_spec.rb +1266 -0
- data/spec/java/run_spec.rb +78 -0
- data/spec/java/test_coverage_helper.rb +257 -0
- data/spec/java/tests_spec.rb +497 -0
- data/spec/packaging/archive_spec.rb +775 -0
- data/spec/packaging/artifact_namespace_spec.rb +743 -0
- data/spec/packaging/artifact_spec.rb +1074 -0
- data/spec/packaging/packaging_helper.rb +63 -0
- data/spec/packaging/packaging_spec.rb +719 -0
- data/spec/packaging/repository_array_spec.rb +109 -0
- data/spec/sandbox.rb +165 -0
- data/spec/scala/bdd_spec.rb +124 -0
- data/spec/scala/compiler_spec.rb +289 -0
- data/spec/scala/doc_spec.rb +88 -0
- data/spec/scala/scala.rb +38 -0
- data/spec/scala/tests_spec.rb +283 -0
- data/spec/spec_helpers.rb +369 -0
- data/spec/version_requirement_spec.rb +143 -0
- data/spec/xpath_matchers.rb +121 -0
- metadata +600 -0
|
@@ -0,0 +1,328 @@
|
|
|
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.expand_path('../spec_helpers', File.dirname(__FILE__))
|
|
18
|
+
require 'stringio'
|
|
19
|
+
Sandbox.require_optional_extension 'buildr/drb'
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
describe Buildr::DRbApplication do
|
|
23
|
+
|
|
24
|
+
module DRbHelper
|
|
25
|
+
attr_accessor :app, :drb, :cfg
|
|
26
|
+
|
|
27
|
+
def use_stdio(stdin = nil, stdout = nil, stderr = nil)
|
|
28
|
+
stdin ||= StringIO.new
|
|
29
|
+
stdout ||= StringIO.new
|
|
30
|
+
stderr ||= StringIO.new
|
|
31
|
+
cfg.update :in => stdin, :out => stdout, :err => stderr
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def remote_run(*argv)
|
|
35
|
+
cfg.update :argv => argv
|
|
36
|
+
drb.remote_run(cfg)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def output
|
|
40
|
+
cfg[:out].string
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def write_buildfile(content = nil)
|
|
44
|
+
write 'buildfile', content || %q{
|
|
45
|
+
define('foo') do
|
|
46
|
+
|
|
47
|
+
rule '.rbc' => '.rb' do |t|
|
|
48
|
+
$stdout.puts "#{t.name} from #{t.source}"
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
task('hello') do
|
|
52
|
+
$stdout.puts 'hi'
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
task('empty')
|
|
56
|
+
|
|
57
|
+
task('no') do
|
|
58
|
+
task('empty').enhance ['delete_me']
|
|
59
|
+
task('empty') { $stdout.puts 'no' }
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
task('delete_me')
|
|
63
|
+
|
|
64
|
+
task('create') do
|
|
65
|
+
Rake::Task.define_task('created')
|
|
66
|
+
rule '.rbc' => '.rb' do |t|
|
|
67
|
+
$stdout.puts "#{t.name} from #{t.source}"
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
task('exists') do
|
|
72
|
+
$stdout.puts !!Buildr.application.lookup('created')
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
task('setopt', :name, :value) do |task, args|
|
|
76
|
+
Buildr.application.options.send("#{args[:name]}=", args[:value])
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
}
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
include DRbHelper
|
|
84
|
+
|
|
85
|
+
before(:each) do
|
|
86
|
+
@in, @out, @err = $stdin, $stdout, $stderr
|
|
87
|
+
@cfg = {
|
|
88
|
+
:dir => Dir.pwd, :argv => [],
|
|
89
|
+
:in => @in, :out => @out, :err => @err
|
|
90
|
+
}
|
|
91
|
+
@drb = Buildr::DRbApplication.clone
|
|
92
|
+
@drb.send :setup
|
|
93
|
+
@app = Buildr.application
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
after(:each) do
|
|
97
|
+
$stdin, $stdout, $stderr = @in, @out, @err
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
describe '.run' do
|
|
101
|
+
it 'starts server if no server is running' do
|
|
102
|
+
drb.should_receive(:connect).and_raise DRb::DRbConnError
|
|
103
|
+
drb.should_receive(:run_server!)
|
|
104
|
+
drb.should_not_receive(:run_client)
|
|
105
|
+
drb.run
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
it 'connects to an already started server' do
|
|
109
|
+
drb.should_receive(:connect).and_return "client"
|
|
110
|
+
drb.should_receive(:run_client).with "client"
|
|
111
|
+
drb.should_not_receive(:run_server!)
|
|
112
|
+
drb.run
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
describe '.remote_run' do
|
|
117
|
+
|
|
118
|
+
describe 'stdout' do
|
|
119
|
+
it 'is redirected to client' do
|
|
120
|
+
use_stdio
|
|
121
|
+
Buildr.application.should_receive(:remote_run) do
|
|
122
|
+
$stdout.puts "HELLO"
|
|
123
|
+
end
|
|
124
|
+
remote_run
|
|
125
|
+
output.should eql("HELLO\n")
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
describe 'stderr' do
|
|
130
|
+
it 'is redirected to client' do
|
|
131
|
+
use_stdio
|
|
132
|
+
Buildr.application.should_receive(:remote_run) do
|
|
133
|
+
$stderr.puts "HELLO"
|
|
134
|
+
end
|
|
135
|
+
remote_run
|
|
136
|
+
cfg[:err].string.should eql("HELLO\n")
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
describe 'stdin' do
|
|
141
|
+
it 'is redirected to client' do
|
|
142
|
+
use_stdio
|
|
143
|
+
cfg[:in].should_receive(:gets).and_return("HELLO\n")
|
|
144
|
+
result = nil
|
|
145
|
+
Buildr.application.should_receive(:remote_run) do
|
|
146
|
+
result = $stdin.gets
|
|
147
|
+
end
|
|
148
|
+
remote_run
|
|
149
|
+
result.should eql("HELLO\n")
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
describe 'server ARGV' do
|
|
154
|
+
it 'is replaced with client argv' do
|
|
155
|
+
Buildr.application.should_receive(:remote_run) do
|
|
156
|
+
ARGV.should eql(['hello'])
|
|
157
|
+
end
|
|
158
|
+
remote_run 'hello'
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
describe 'without buildfile loaded' do
|
|
163
|
+
before(:each) do
|
|
164
|
+
app.instance_eval { @rakefile = nil }
|
|
165
|
+
write_buildfile
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
it 'should load the buildfile' do
|
|
169
|
+
app.should_receive(:top_level)
|
|
170
|
+
lambda { remote_run }.should run_task('foo')
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
describe 'with unmodified buildfile' do
|
|
175
|
+
|
|
176
|
+
before(:each) do
|
|
177
|
+
write_buildfile
|
|
178
|
+
app.options.rakelib = []
|
|
179
|
+
app.send :load_buildfile
|
|
180
|
+
drb.save_snapshot(app)
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
it 'should not reload the buildfile' do
|
|
184
|
+
app.should_not_receive(:reload_buildfile)
|
|
185
|
+
app.should_receive(:top_level)
|
|
186
|
+
remote_run
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
it 'should not define projects again' do
|
|
190
|
+
use_stdio
|
|
191
|
+
lambda { 2.times { remote_run 'foo:hello' } }.should_not run_task('foo')
|
|
192
|
+
output.should eql("hi\nhi\n")
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
it 'should restore task actions' do
|
|
196
|
+
use_stdio
|
|
197
|
+
remote_run 'foo:empty'
|
|
198
|
+
output.should be_empty
|
|
199
|
+
2.times { remote_run 'foo:no' }
|
|
200
|
+
remote_run 'foo:empty'
|
|
201
|
+
actions = app.lookup('foo:empty').instance_eval { @actions }
|
|
202
|
+
actions.should be_empty # as originally defined
|
|
203
|
+
output.should be_empty
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
it 'should restore task prerequisites' do
|
|
207
|
+
use_stdio
|
|
208
|
+
remote_run 'foo:empty'
|
|
209
|
+
output.should be_empty
|
|
210
|
+
2.times { remote_run 'foo:no' }
|
|
211
|
+
remote_run 'foo:empty'
|
|
212
|
+
pres = app.lookup('foo:empty').send(:prerequisites).map(&:to_s)
|
|
213
|
+
pres.should be_empty # as originally defined
|
|
214
|
+
output.should be_empty
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
it 'should drop runtime created tasks' do
|
|
218
|
+
remote_run 'foo:create'
|
|
219
|
+
app.lookup('created').should_not be_nil
|
|
220
|
+
remote_run 'foo:empty'
|
|
221
|
+
app.lookup('created').should be_nil
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
it 'should restore options' do
|
|
225
|
+
remote_run 'foo:setopt[bar,baz]'
|
|
226
|
+
app.options.bar.should eql("baz")
|
|
227
|
+
remote_run 'foo:empty'
|
|
228
|
+
app.options.bar.should be_nil
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
it 'should restore rules' do
|
|
232
|
+
orig = app.instance_eval { @rules.size }
|
|
233
|
+
remote_run 'foo:create'
|
|
234
|
+
app.instance_eval { @rules.size }.should eql(orig + 1)
|
|
235
|
+
remote_run 'foo:empty'
|
|
236
|
+
app.instance_eval { @rules.size }.should eql(orig)
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
describe 'with modified buildfile' do
|
|
242
|
+
|
|
243
|
+
before(:each) do
|
|
244
|
+
write_buildfile
|
|
245
|
+
app.options.rakelib = []
|
|
246
|
+
app.send :load_buildfile
|
|
247
|
+
drb.save_snapshot(app)
|
|
248
|
+
app.instance_eval { @last_loaded = Time.now - 10 }
|
|
249
|
+
write_buildfile %q{
|
|
250
|
+
rule '.rbc' => '.rb' do |t|
|
|
251
|
+
$stdout.puts "#{t.name} from #{t.source}"
|
|
252
|
+
end
|
|
253
|
+
define('foo') do
|
|
254
|
+
task('hello') do
|
|
255
|
+
$stdout.puts 'bye'
|
|
256
|
+
end
|
|
257
|
+
task('empty')
|
|
258
|
+
define('bar') do
|
|
259
|
+
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
}
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
it 'should reload the buildfile' do
|
|
266
|
+
app.should_receive(:reload_buildfile)
|
|
267
|
+
app.should_receive(:top_level)
|
|
268
|
+
remote_run
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
it 'should redefine projects' do
|
|
272
|
+
lambda { remote_run }.should run_tasks('foo', 'foo:bar')
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
it 'should remove tasks deleted from buildfile' do
|
|
276
|
+
app.lookup('foo:delete_me').should_not be_nil
|
|
277
|
+
remote_run
|
|
278
|
+
app.lookup('foo:delete_me').should be_nil
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
it 'should redefine tasks actions' do
|
|
282
|
+
actions = app.lookup('foo:empty').instance_eval { @actions }
|
|
283
|
+
actions.should be_empty # no action
|
|
284
|
+
app.lookup('foo:no').invoke # enhance the empty task
|
|
285
|
+
actions = app.lookup('foo:empty').instance_eval { @actions }
|
|
286
|
+
actions.should_not be_empty
|
|
287
|
+
remote_run # cause to reload the buildfile
|
|
288
|
+
actions = app.lookup('foo:empty').instance_eval { @actions }
|
|
289
|
+
actions.should be_empty # as defined on the new buildfile
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
it 'should redefine task prerequisites' do
|
|
293
|
+
pres = app.lookup('foo:empty').send(:prerequisites).map(&:to_s)
|
|
294
|
+
pres.should be_empty # no action
|
|
295
|
+
app.lookup('foo:no').invoke # enhance the empty task
|
|
296
|
+
pres = app.lookup('foo:empty').send(:prerequisites).map(&:to_s)
|
|
297
|
+
pres.should_not be_empty
|
|
298
|
+
remote_run # cause to reload the buildfile
|
|
299
|
+
pres = app.lookup('foo:empty').send(:prerequisites).map(&:to_s)
|
|
300
|
+
pres.should be_empty # as defined on the new buildfile
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
it 'should drop runtime created tasks' do
|
|
304
|
+
app.lookup('foo:create').invoke
|
|
305
|
+
app.lookup('created').should_not be_nil
|
|
306
|
+
remote_run 'foo:empty'
|
|
307
|
+
app.lookup('created').should be_nil
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
it 'should restore options' do
|
|
311
|
+
app.options.bar = 'baz'
|
|
312
|
+
remote_run 'foo:empty'
|
|
313
|
+
app.options.bar.should be_nil
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
it 'should redefine rules' do
|
|
317
|
+
orig = app.instance_eval { @rules.size }
|
|
318
|
+
app.lookup('foo:create').invoke
|
|
319
|
+
app.instance_eval { @rules.size }.should eql(orig + 1)
|
|
320
|
+
remote_run 'foo:empty'
|
|
321
|
+
app.instance_eval { @rules.size }.should eql(orig)
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
end
|
|
327
|
+
end
|
|
328
|
+
|
|
@@ -0,0 +1,125 @@
|
|
|
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.expand_path('../spec_helpers', File.dirname(__FILE__))
|
|
18
|
+
Sandbox.require_optional_extension 'buildr/jaxb_xjc'
|
|
19
|
+
|
|
20
|
+
XSD_CONTENT = <<XSD
|
|
21
|
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
|
|
22
|
+
|
|
23
|
+
<xsd:simpleType name="agency">
|
|
24
|
+
<xsd:restriction base="xsd:string">
|
|
25
|
+
<xsd:enumeration value="DSE"/>
|
|
26
|
+
<xsd:enumeration value="PV"/>
|
|
27
|
+
<xsd:enumeration value="CFA"/>
|
|
28
|
+
<xsd:enumeration value="DPI"/>
|
|
29
|
+
<xsd:enumeration value="VF"/>
|
|
30
|
+
<xsd:enumeration value="Unknown"/>
|
|
31
|
+
</xsd:restriction>
|
|
32
|
+
</xsd:simpleType>
|
|
33
|
+
|
|
34
|
+
<xsd:complexType name="latLongCoordinate">
|
|
35
|
+
<xsd:all>
|
|
36
|
+
<xsd:element name="latitude" type="xsd:float"/>
|
|
37
|
+
<xsd:element name="longitude" type="xsd:float"/>
|
|
38
|
+
</xsd:all>
|
|
39
|
+
</xsd:complexType>
|
|
40
|
+
|
|
41
|
+
<xsd:element name="wildfire">
|
|
42
|
+
<xsd:complexType>
|
|
43
|
+
<xsd:sequence>
|
|
44
|
+
<xsd:element name="name" type="xsd:string"/>
|
|
45
|
+
<xsd:element name="district" type="xsd:string">
|
|
46
|
+
<xsd:annotation>
|
|
47
|
+
<xsd:documentation xml:lang="en">
|
|
48
|
+
The name of the district WITHOUT the "FIRE DISTRICT" suffix.
|
|
49
|
+
</xsd:documentation>
|
|
50
|
+
</xsd:annotation>
|
|
51
|
+
</xsd:element>
|
|
52
|
+
<xsd:element name="status">
|
|
53
|
+
<xsd:simpleType>
|
|
54
|
+
<xsd:restriction base="xsd:string">
|
|
55
|
+
<xsd:enumeration value="GOING"/>
|
|
56
|
+
<xsd:enumeration value="CONTAINED"/>
|
|
57
|
+
<xsd:enumeration value="UNDER CONTROL - 1"/>
|
|
58
|
+
<xsd:enumeration value="UNDER CONTROL - 2"/>
|
|
59
|
+
<xsd:enumeration value="SAFE"/>
|
|
60
|
+
<xsd:enumeration value="SAFE - OVERRUN"/>
|
|
61
|
+
<xsd:enumeration value="SAFE - NOT FOUND"/>
|
|
62
|
+
<xsd:enumeration value="SAFE - FALSE ALARM"/>
|
|
63
|
+
<xsd:enumeration value="NOT FOUND"/>
|
|
64
|
+
<xsd:enumeration value="UNKNOWN"/>
|
|
65
|
+
</xsd:restriction>
|
|
66
|
+
</xsd:simpleType>
|
|
67
|
+
</xsd:element>
|
|
68
|
+
<xsd:element name="reported-at" type="xsd:dateTime"/>
|
|
69
|
+
<xsd:element name="lead-agency" type="xsd:string"/>
|
|
70
|
+
<xsd:element name="origin" type="latLongCoordinate" minOccurs="0">
|
|
71
|
+
<xsd:annotation>
|
|
72
|
+
<xsd:documentation xml:lang="en">
|
|
73
|
+
This is a grid reference in lat/long format.
|
|
74
|
+
</xsd:documentation>
|
|
75
|
+
</xsd:annotation>
|
|
76
|
+
</xsd:element>
|
|
77
|
+
<xsd:element name="area" type="xsd:decimal" minOccurs="0"/>
|
|
78
|
+
<xsd:element name="number">
|
|
79
|
+
<xsd:simpleType>
|
|
80
|
+
<xsd:restriction base="xsd:integer">
|
|
81
|
+
<xsd:minInclusive value="0"/>
|
|
82
|
+
</xsd:restriction>
|
|
83
|
+
</xsd:simpleType>
|
|
84
|
+
</xsd:element>
|
|
85
|
+
<xsd:element name="global-id">
|
|
86
|
+
<xsd:simpleType>
|
|
87
|
+
<xsd:restriction base="xsd:integer">
|
|
88
|
+
<xsd:minInclusive value="0"/>
|
|
89
|
+
</xsd:restriction>
|
|
90
|
+
</xsd:simpleType>
|
|
91
|
+
</xsd:element>
|
|
92
|
+
<xsd:element name="data-source" type="xsd:string"/>
|
|
93
|
+
</xsd:sequence>
|
|
94
|
+
</xsd:complexType>
|
|
95
|
+
</xsd:element>
|
|
96
|
+
</xsd:schema>
|
|
97
|
+
XSD
|
|
98
|
+
|
|
99
|
+
describe Buildr::JaxbXjc do
|
|
100
|
+
describe "compiled with specified xsd" do
|
|
101
|
+
before do
|
|
102
|
+
write "src/main/xsd/wildfire-1.3.xsd", XSD_CONTENT
|
|
103
|
+
@foo = define "foo" do
|
|
104
|
+
project.version = "2.1.3"
|
|
105
|
+
compile.from compile_jaxb("src/main/xsd/wildfire-1.3.xsd", "-quiet", :package => "org.foo.api")
|
|
106
|
+
package :jar
|
|
107
|
+
end
|
|
108
|
+
task('compile').invoke
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
it "produce .java files in the correct location" do
|
|
112
|
+
File.should be_exist(@foo._("target/generated/jaxb/org/foo/api/Agency.java"))
|
|
113
|
+
File.should be_exist(@foo._("target/generated/jaxb/org/foo/api/LatLongCoordinate.java"))
|
|
114
|
+
File.should be_exist(@foo._("target/generated/jaxb/org/foo/api/ObjectFactory.java"))
|
|
115
|
+
File.should be_exist(@foo._("target/generated/jaxb/org/foo/api/Wildfire.java"))
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
it "produce .class files in the correct location" do
|
|
119
|
+
File.should be_exist(@foo._("target/classes/org/foo/api/Agency.class"))
|
|
120
|
+
File.should be_exist(@foo._("target/classes/org/foo/api/LatLongCoordinate.class"))
|
|
121
|
+
File.should be_exist(@foo._("target/classes/org/foo/api/ObjectFactory.class"))
|
|
122
|
+
File.should be_exist(@foo._("target/classes/org/foo/api/Wildfire.class"))
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|