buildr 1.4.16-x86-mswin32 → 1.4.17-x86-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG +20 -0
- data/addon/buildr/bnd.rb +158 -158
- data/addon/buildr/checkstyle-report.xsl +87 -0
- data/addon/buildr/checkstyle.rb +213 -205
- data/addon/buildr/css_lint-report.xsl +83 -0
- data/addon/buildr/css_lint.rake +196 -0
- data/addon/buildr/custom_pom.rb +282 -0
- data/addon/buildr/drb.rb +0 -1
- data/addon/buildr/git_auto_version.rb +34 -34
- data/addon/buildr/gwt.rb +171 -171
- data/addon/buildr/hibernate.rb +8 -8
- data/addon/buildr/javancss.rb +155 -155
- data/addon/buildr/jaxb_xjc.rb +74 -74
- data/addon/buildr/jibx.rb +0 -1
- data/addon/buildr/org/apache/buildr/BuildrNail.java +2 -2
- data/addon/buildr/org/apache/buildr/JettyWrapper.java +3 -3
- data/addon/buildr/package_as_nsis.rb +2 -2
- data/addon/buildr/pmd.rb +166 -166
- data/addon/buildr/scss_lint-report.xsl +79 -0
- data/addon/buildr/scss_lint.rb +199 -0
- data/addon/buildr/wsgen.rb +4 -0
- data/doc/building.textile +3 -3
- data/doc/css/default.css +3 -3
- data/doc/css/print.css +1 -1
- data/doc/download.textile +18 -7
- data/doc/index.textile +8 -1
- data/doc/installing.textile +3 -3
- data/doc/languages.textile +0 -1
- data/doc/mailing_lists.textile +0 -4
- data/doc/more_stuff.textile +127 -3
- data/doc/preface.textile +1 -1
- data/doc/projects.textile +6 -6
- data/doc/releasing.textile +0 -1
- data/lib/buildr/clojure/shell.rb +0 -1
- data/lib/buildr/core/build.rb +16 -16
- data/lib/buildr/core/filter.rb +3 -3
- data/lib/buildr/core/jrebel.rb +0 -1
- data/lib/buildr/core/linux.rb +0 -1
- data/lib/buildr/core/run.rb +0 -1
- data/lib/buildr/core/shell.rb +0 -1
- data/lib/buildr/groovy/doc.rb +0 -1
- data/lib/buildr/ide/eclipse.rb +0 -2
- data/lib/buildr/ide/idea.rb +44 -8
- data/lib/buildr/java/bdd.rb +0 -1
- data/lib/buildr/java/commands.rb +2 -3
- data/lib/buildr/java/jruby.rb +2 -2
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +5 -5
- data/lib/buildr/java/tests.rb +0 -1
- data/lib/buildr/packaging/artifact_namespace.rb +0 -2
- data/lib/buildr/resources/icons-license.txt +14 -17
- data/lib/buildr/scala/bdd.rb +0 -1
- data/lib/buildr/scala/compiler.rb +0 -1
- data/lib/buildr/scala/org/apache/buildr/Specs2Runner.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/Specs2Runner.java +0 -2
- data/lib/buildr/version.rb +1 -1
- data/rakelib/metrics.rake +3 -3
- data/rakelib/release.rake +8 -2
- data/spec/addon/bnd_spec.rb +383 -383
- data/spec/addon/custom_pom_spec.rb +149 -0
- data/spec/addon/drb_spec.rb +0 -1
- data/spec/addon/jaxb_xjc_spec.rb +130 -130
- data/spec/core/application_spec.rb +0 -1
- data/spec/core/build_spec.rb +1 -1
- data/spec/core/console_spec.rb +0 -1
- data/spec/core/doc_spec.rb +0 -1
- data/spec/core/extension_spec.rb +0 -1
- data/spec/core/generate_from_eclipse_spec.rb +9 -9
- data/spec/core/run_spec.rb +2 -3
- data/spec/core/shell_spec.rb +0 -1
- data/spec/ide/idea_spec.rb +1979 -1941
- data/spec/java/cobertura_spec.rb +6 -6
- data/spec/java/commands_spec.rb +11 -11
- data/spec/java/compiler_spec.rb +0 -1
- data/spec/java/doc_spec.rb +0 -1
- data/spec/java/ecj_spec.rb +1 -3
- data/spec/java/external_spec.rb +0 -2
- data/spec/java/java_spec.rb +3 -3
- data/spec/java/run_spec.rb +0 -1
- data/spec/java/tests_spec.rb +15 -0
- data/spec/xpath_matchers.rb +121 -120
- metadata +10 -2
@@ -16,7 +16,7 @@
|
|
16
16
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers'))
|
17
17
|
|
18
18
|
module EclipseHelper
|
19
|
-
|
19
|
+
|
20
20
|
def setupExample(group, projectName, options = {})
|
21
21
|
options[:symName] ? symName = options[:symName] :symName = File.basename(projectName)
|
22
22
|
requiredPlugins = nil
|
@@ -102,12 +102,12 @@ describe Buildr::Generate do
|
|
102
102
|
include EclipseHelper
|
103
103
|
describe 'it should find a single eclipse project' do
|
104
104
|
top = "top_#{__LINE__}"
|
105
|
-
|
105
|
+
|
106
106
|
before do
|
107
107
|
setupExample(top, 'single')
|
108
108
|
File.open(File.join(top, 'buildfile'), 'w') { |file| file.write Generate.from_eclipse(File.join(Dir.pwd, top)).join("\n") }
|
109
109
|
end
|
110
|
-
|
110
|
+
|
111
111
|
it 'should create a valid buildfile' do
|
112
112
|
define('first')
|
113
113
|
File.exists?(File.join(top, 'single', '.project')).should be_true
|
@@ -149,7 +149,7 @@ describe Buildr::Generate do
|
|
149
149
|
file(buildFile).should contain('layout[:source, :main, :scala]')
|
150
150
|
lambda { Buildr.application.run }.should_not raise_error
|
151
151
|
end
|
152
|
-
|
152
|
+
|
153
153
|
it "should pass output in build.properties to layout[:target, :main], etc" do
|
154
154
|
define('layout_target')
|
155
155
|
buildFile = File.join(top, 'buildfile')
|
@@ -161,7 +161,7 @@ describe Buildr::Generate do
|
|
161
161
|
file(buildFile).should contain('layout[:target, :main, :scala]')
|
162
162
|
lambda { Buildr.application.run }.should_not raise_error
|
163
163
|
end
|
164
|
-
|
164
|
+
|
165
165
|
it "should package an eclipse plugin" do
|
166
166
|
define('layout_target')
|
167
167
|
buildFile = File.join(top, 'buildfile')
|
@@ -186,14 +186,14 @@ describe Buildr::Generate do
|
|
186
186
|
lambda { Buildr.application.run }.should_not raise_error
|
187
187
|
end
|
188
188
|
end
|
189
|
-
|
189
|
+
|
190
190
|
describe 'it should accecpt singleton SymbolicName in MANIFEST.MF' do
|
191
191
|
top = "top_#{__LINE__}"
|
192
192
|
before do
|
193
193
|
setupExample(top, 'single', { :symName => 'singleSymbolicName;singleton:=true'})
|
194
194
|
File.open(File.join(top, 'buildfile'), 'w') { |file| file.write Generate.from_eclipse(File.join(Dir.pwd, top)).join("\n") }
|
195
195
|
end
|
196
|
-
|
196
|
+
|
197
197
|
it "should not get confused if SymbolicName in MANIFEST.MF is a singleton:=true" do
|
198
198
|
buildFile = File.join(top, 'buildfile')
|
199
199
|
file(buildFile).should exist
|
@@ -220,7 +220,7 @@ describe Buildr::Generate do
|
|
220
220
|
file(buildFile).should contain('define "single"')
|
221
221
|
lambda { Buildr.application.run }.should_not raise_error
|
222
222
|
end
|
223
|
-
|
223
|
+
|
224
224
|
it "should correct the path for a nested plugin" do
|
225
225
|
define('base_dir')
|
226
226
|
buildFile = File.join(top, 'buildfile')
|
@@ -264,7 +264,7 @@ describe Buildr::Generate do
|
|
264
264
|
file(buildFile).should contain(/define "second".*do.*dependencies << projects\("first"\).* end/m)
|
265
265
|
lambda { Buildr.application.run }.should_not raise_error
|
266
266
|
end
|
267
|
-
|
267
|
+
|
268
268
|
# Fragments are only supported with buildr4osi which is not (yet?) part of buildr
|
269
269
|
it 'should skip fragments.' do
|
270
270
|
define('base_dir')
|
data/spec/core/run_spec.rb
CHANGED
@@ -34,7 +34,7 @@ describe Project, :run do
|
|
34
34
|
end
|
35
35
|
project('foo').run.classpath.should include(artifact('group:compile:jar:1.0'))
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
it 'should not include test dependencies' do
|
39
39
|
define('foo') do
|
40
40
|
compile.using(:javac).with 'group:compile:jar:1.0'
|
@@ -70,7 +70,7 @@ describe Project, :run do
|
|
70
70
|
end
|
71
71
|
project('foo').run.runner.should be_a(Run::JavaRunner)
|
72
72
|
end
|
73
|
-
|
73
|
+
|
74
74
|
it "should run with the project resources" do
|
75
75
|
write 'src/main/java/Test.java', 'class Test {}'
|
76
76
|
write 'src/main/resources/test.properties', ''
|
@@ -103,4 +103,3 @@ describe Project, :run do
|
|
103
103
|
end
|
104
104
|
|
105
105
|
end
|
106
|
-
|
data/spec/core/shell_spec.rb
CHANGED
data/spec/ide/idea_spec.rb
CHANGED
@@ -1,1941 +1,1979 @@
|
|
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(File.join(File.dirname(__FILE__), '..', 'spec_helpers'))
|
18
|
-
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'xpath_matchers'))
|
19
|
-
|
20
|
-
def ensure_facet_xpath(doc, type, name)
|
21
|
-
facet_xpath = "/module/component[@name='FacetManager']/facet"
|
22
|
-
doc.should have_xpath(facet_xpath)
|
23
|
-
web_facet_xpath = "#{facet_xpath}[@type='#{type}'
|
24
|
-
doc.should have_xpath(web_facet_xpath)
|
25
|
-
web_facet_xpath
|
26
|
-
end
|
27
|
-
|
28
|
-
describe Buildr::IntellijIdea do
|
29
|
-
|
30
|
-
def invoke_generate_task
|
31
|
-
task('idea').invoke
|
32
|
-
end
|
33
|
-
|
34
|
-
def invoke_clean_task
|
35
|
-
task('idea:clean').invoke
|
36
|
-
end
|
37
|
-
|
38
|
-
def root_project_filename(project)
|
39
|
-
project._("#{project.name}#{Buildr::IntellijIdea::IdeaFile::DEFAULT_SUFFIX}.ipr")
|
40
|
-
end
|
41
|
-
|
42
|
-
def root_project_xml(project)
|
43
|
-
xml_document(root_project_filename(project))
|
44
|
-
end
|
45
|
-
|
46
|
-
def root_module_filename(project)
|
47
|
-
project._("#{project.name}#{Buildr::IntellijIdea::IdeaFile::DEFAULT_SUFFIX}.iml")
|
48
|
-
end
|
49
|
-
|
50
|
-
def root_module_xml(project)
|
51
|
-
xml_document(root_module_filename(project))
|
52
|
-
end
|
53
|
-
|
54
|
-
def subproject_module_filename(project, sub_project_name)
|
55
|
-
project._("#{sub_project_name}/#{sub_project_name}#{Buildr::IntellijIdea::IdeaFile::DEFAULT_SUFFIX}.iml")
|
56
|
-
end
|
57
|
-
|
58
|
-
def subproject_module_xml(project, sub_project_name)
|
59
|
-
xml_document(subproject_module_filename(project, sub_project_name))
|
60
|
-
end
|
61
|
-
|
62
|
-
def xml_document(filename)
|
63
|
-
File.should be_exist(filename)
|
64
|
-
REXML::Document.new(File.read(filename))
|
65
|
-
end
|
66
|
-
|
67
|
-
def xpath_to_module
|
68
|
-
"/project/component[@name='ProjectModuleManager']/modules/module"
|
69
|
-
end
|
70
|
-
|
71
|
-
describe "idea:clean" do
|
72
|
-
before do
|
73
|
-
write "foo.ipr"
|
74
|
-
write "foo.iml"
|
75
|
-
write "other.ipr"
|
76
|
-
write "other.iml"
|
77
|
-
mkdir_p 'bar'
|
78
|
-
write "bar/bar.iml"
|
79
|
-
write "bar/other.ipr"
|
80
|
-
write "bar/other.iml"
|
81
|
-
|
82
|
-
@foo = define "foo" do
|
83
|
-
define "bar"
|
84
|
-
end
|
85
|
-
invoke_clean_task
|
86
|
-
end
|
87
|
-
|
88
|
-
it "should remove the ipr file" do
|
89
|
-
File.exists?("foo.ipr").should be_false
|
90
|
-
end
|
91
|
-
|
92
|
-
it "should remove the project iml file" do
|
93
|
-
File.exists?("foo.iml").should be_false
|
94
|
-
end
|
95
|
-
|
96
|
-
it "should remove the subproject iml file" do
|
97
|
-
File.exists?("foo.iml").should be_false
|
98
|
-
end
|
99
|
-
|
100
|
-
it "should not remove other iml and ipr files" do
|
101
|
-
File.exists?("other.ipr").should be_true
|
102
|
-
File.exists?("other.iml").should be_true
|
103
|
-
File.exists?("bar/other.ipr").should be_true
|
104
|
-
File.exists?("bar/other.iml").should be_true
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
describe "idea task" do
|
109
|
-
|
110
|
-
def order_entry_xpath
|
111
|
-
"/module/component[@name='NewModuleRootManager']/orderEntry"
|
112
|
-
end
|
113
|
-
|
114
|
-
describe "with a single dependency" do
|
115
|
-
describe "of type compile" do
|
116
|
-
before do
|
117
|
-
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
118
|
-
@foo = define "foo" do
|
119
|
-
compile.with 'group:id:jar:1.0'
|
120
|
-
end
|
121
|
-
invoke_generate_task
|
122
|
-
end
|
123
|
-
|
124
|
-
it "generates one exported 'module-library' orderEntry in IML" do
|
125
|
-
root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library'
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
describe "with iml.main_dependencies override" do
|
130
|
-
before do
|
131
|
-
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
132
|
-
@foo = define "foo" do
|
133
|
-
iml.main_dependencies << 'group:id:jar:1.0'
|
134
|
-
end
|
135
|
-
invoke_generate_task
|
136
|
-
end
|
137
|
-
|
138
|
-
it "generates one exported 'module-library' orderEntry in IML" do
|
139
|
-
root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library'
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
describe "of type test" do
|
144
|
-
before do
|
145
|
-
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
146
|
-
@foo = define "foo" do
|
147
|
-
test.with 'group:id:jar:1.0'
|
148
|
-
end
|
149
|
-
invoke_generate_task
|
150
|
-
end
|
151
|
-
|
152
|
-
it "generates one non-exported test scope 'module-library' orderEntry in IML" do
|
153
|
-
root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library' and @exported]/library/CLASSES/root", 0)
|
154
|
-
root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library' and @scope='TEST']/library/CLASSES/root", 1)
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
describe "with iml.test_dependencies override" do
|
159
|
-
before do
|
160
|
-
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
161
|
-
@foo = define "foo" do
|
162
|
-
iml.test_dependencies << 'group:id:jar:1.0'
|
163
|
-
end
|
164
|
-
invoke_generate_task
|
165
|
-
end
|
166
|
-
|
167
|
-
it "generates one non-exported 'module-library' orderEntry in IML" do
|
168
|
-
root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library' and @exported]/library/CLASSES/root", 0)
|
169
|
-
root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library']/library/CLASSES/root", 1)
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
173
|
-
describe "with sources artifact present" do
|
174
|
-
before do
|
175
|
-
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
176
|
-
artifact('group:id:jar:sources:1.0') { |t| write t.to_s }
|
177
|
-
@foo = define "foo" do
|
178
|
-
compile.with 'group:id:jar:1.0'
|
179
|
-
end
|
180
|
-
invoke_generate_task
|
181
|
-
end
|
182
|
-
|
183
|
-
it "generates 'module-library' orderEntry in IML with SOURCES specified" do
|
184
|
-
root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library'
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
describe "with local_repository_env_override set to nil" do
|
189
|
-
before do
|
190
|
-
Buildr.repositories.instance_eval do
|
191
|
-
@local = @remote = @release_to = nil
|
192
|
-
end
|
193
|
-
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
194
|
-
@foo = define "foo" do
|
195
|
-
iml.local_repository_env_override = nil
|
196
|
-
compile.with 'group:id:jar:1.0'
|
197
|
-
end
|
198
|
-
invoke_generate_task
|
199
|
-
end
|
200
|
-
|
201
|
-
it "generates orderEntry with absolute path for classes jar" do
|
202
|
-
root_module_xml(@foo).should match_xpath("#{order_entry_xpath}/library/CLASSES/root/@url",
|
203
|
-
"jar://$MODULE_DIR$/home/.m2/repository/group/id/1.0/id-1.0.jar!/")
|
204
|
-
end
|
205
|
-
end
|
206
|
-
describe "with local_repository_env_override set to MAVEN_REPOSITORY" do
|
207
|
-
before do
|
208
|
-
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
209
|
-
@foo = define "foo" do
|
210
|
-
iml.local_repository_env_override = 'MAVEN_REPOSITORY'
|
211
|
-
compile.with 'group:id:jar:1.0'
|
212
|
-
end
|
213
|
-
invoke_generate_task
|
214
|
-
end
|
215
|
-
|
216
|
-
it "generates orderEntry with absolute path for classes jar" do
|
217
|
-
root_module_xml(@foo).should match_xpath("#{order_entry_xpath}/library/CLASSES/root/@url",
|
218
|
-
"jar://$MAVEN_REPOSITORY$/group/id/1.0/id-1.0.jar!/")
|
219
|
-
end
|
220
|
-
end
|
221
|
-
end
|
222
|
-
|
223
|
-
describe "with multiple dependencies" do
|
224
|
-
before do
|
225
|
-
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
226
|
-
artifact('group:id2:jar:1.0') { |t| write t.to_s }
|
227
|
-
@foo = define "foo" do
|
228
|
-
compile.with 'group:id:jar:1.0', 'group:id2:jar:1.0'
|
229
|
-
end
|
230
|
-
invoke_generate_task
|
231
|
-
end
|
232
|
-
|
233
|
-
it "generates multiple 'module-library' orderEntry in IML" do
|
234
|
-
root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library']", 2)
|
235
|
-
end
|
236
|
-
end
|
237
|
-
|
238
|
-
describe "with a single non artifact dependency" do
|
239
|
-
before do
|
240
|
-
@foo = define "foo" do
|
241
|
-
filename = _("foo-dep.jar")
|
242
|
-
File.open(filename, "wb") { |t| write "Hello" }
|
243
|
-
compile.with filename
|
244
|
-
end
|
245
|
-
invoke_generate_task
|
246
|
-
end
|
247
|
-
|
248
|
-
it "generates one exported 'module-library' orderEntry in IML" do
|
249
|
-
root_module_xml(@foo).should match_xpath("#{order_entry_xpath}/library/CLASSES/root/@url",
|
250
|
-
"jar://$MODULE_DIR$/foo-dep.jar!/")
|
251
|
-
end
|
252
|
-
end
|
253
|
-
|
254
|
-
describe "with extra_modules specified" do
|
255
|
-
before do
|
256
|
-
@foo = define "foo" do
|
257
|
-
ipr.extra_modules << 'other.iml'
|
258
|
-
ipr.extra_modules << 'other_other.iml'
|
259
|
-
end
|
260
|
-
invoke_generate_task
|
261
|
-
end
|
262
|
-
|
263
|
-
it "generate an IPR with extra modules specified" do
|
264
|
-
doc = xml_document(@foo._("foo.ipr"))
|
265
|
-
doc.should have_nodes("#{xpath_to_module}", 3)
|
266
|
-
module_ref = "$PROJECT_DIR$/foo.iml"
|
267
|
-
doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}'
|
268
|
-
module_ref = "$PROJECT_DIR$/other.iml"
|
269
|
-
doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}'
|
270
|
-
module_ref = "$PROJECT_DIR$/other_other.iml"
|
271
|
-
doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}'
|
272
|
-
end
|
273
|
-
end
|
274
|
-
|
275
|
-
describe "with web and webservice facet added to root project" do
|
276
|
-
before do
|
277
|
-
@foo = define "foo" do
|
278
|
-
iml.add_facet("Web", "web") do |facet|
|
279
|
-
facet.configuration do |conf|
|
280
|
-
conf.descriptors do |desc|
|
281
|
-
desc.deploymentDescriptor :name => 'web.xml',
|
282
|
-
:url => "file://$MODULE_DIR$/src/main/webapp/WEB-INF/web.xml",
|
283
|
-
:optional => "false", :version => "2.4"
|
284
|
-
end
|
285
|
-
conf.webroots do |webroots|
|
286
|
-
webroots.root :url => "file://$MODULE_DIR$/src/main/webapp", :relative => "/"
|
287
|
-
end
|
288
|
-
end
|
289
|
-
end
|
290
|
-
iml.add_facet("WebServices Client", "WebServicesClient") do |facet|
|
291
|
-
facet.configuration "ws.engine" => "Glassfish / JAX-WS 2.X RI / Metro 1.X / JWSDP 2.0"
|
292
|
-
end
|
293
|
-
define 'bar'
|
294
|
-
end
|
295
|
-
invoke_generate_task
|
296
|
-
end
|
297
|
-
|
298
|
-
it "generates an IML for root project with a web and webservice facet" do
|
299
|
-
doc = xml_document(@foo._("foo.iml"))
|
300
|
-
ensure_facet_xpath(doc, 'web', 'Web')
|
301
|
-
ensure_facet_xpath(doc, 'WebServicesClient', 'WebServices Client')
|
302
|
-
end
|
303
|
-
end
|
304
|
-
|
305
|
-
describe "using add_gwt_facet" do
|
306
|
-
before do
|
307
|
-
@foo = define "foo" do
|
308
|
-
iml.add_gwt_facet("com.biz.MyModule" => true, "com.biz.MyOtherModule" => false)
|
309
|
-
end
|
310
|
-
invoke_generate_task
|
311
|
-
end
|
312
|
-
|
313
|
-
it "generates a gwt facet with default settings" do
|
314
|
-
doc = xml_document(@foo._("foo.iml"))
|
315
|
-
facet_xpath = ensure_facet_xpath(doc, 'gwt', 'GWT')
|
316
|
-
setting_xpath = "#{facet_xpath}/configuration/setting"
|
317
|
-
doc.should have_xpath("#{setting_xpath}[@name='gwtSdkUrl', value='file://$GWT_TOOLS$']")
|
318
|
-
doc.should have_xpath("#{setting_xpath}[@name='gwtScriptOutputStyle', value='PRETTY']")
|
319
|
-
doc.should have_xpath("#{setting_xpath}[@name='compilerParameters', value='-draftCompile -localWorkers 2 -strict']")
|
320
|
-
doc.should have_xpath("#{setting_xpath}[@name='compilerParameters', value='-draftCompile -localWorkers 2 -strict']")
|
321
|
-
doc.should have_xpath("#{setting_xpath}[@name='compilerMaxHeapSize', value='512']")
|
322
|
-
doc.should have_xpath("#{setting_xpath}[@name='webFacet', value='Web']")
|
323
|
-
end
|
324
|
-
|
325
|
-
it "generates a gwt facet with specified modules" do
|
326
|
-
doc = xml_document(@foo._("foo.iml"))
|
327
|
-
facet_xpath = ensure_facet_xpath(doc, 'gwt', 'GWT')
|
328
|
-
prefix = "#{facet_xpath}/configuration/packaging/module"
|
329
|
-
doc.should have_xpath("#{prefix}[@name='com.biz.MyModule'
|
330
|
-
doc.should have_xpath("#{prefix}[@name='com.biz.MyOtherModule'
|
331
|
-
end
|
332
|
-
end
|
333
|
-
|
334
|
-
describe "using add_gwt_facet that detects gwt sdk" do
|
335
|
-
before do
|
336
|
-
artifact('com.google.gwt:gwt-dev:jar:2.5.1-not-a-release') { |task| write task.name }
|
337
|
-
@foo = define "foo" do
|
338
|
-
compile.with 'com.google.gwt:gwt-dev:jar:2.5.1-not-a-release'
|
339
|
-
iml.add_gwt_facet("com.biz.MyModule" => true)
|
340
|
-
end
|
341
|
-
invoke_generate_task
|
342
|
-
end
|
343
|
-
|
344
|
-
it "generates a gwt facet with detected gwt sdk settings" do
|
345
|
-
doc = xml_document(@foo._("foo.iml"))
|
346
|
-
facet_xpath = ensure_facet_xpath(doc, 'gwt', 'GWT')
|
347
|
-
setting_xpath = "#{facet_xpath}/configuration/setting"
|
348
|
-
doc.should have_xpath("#{setting_xpath}[@name='gwtSdkType', value='maven']")
|
349
|
-
doc.should have_xpath("#{setting_xpath}[@name='gwtSdkUrl', value='$MAVEN_REPOSITORY$/com/google/gwt/gwt-dev/2.5.1-not-a-release']")
|
350
|
-
end
|
351
|
-
end
|
352
|
-
|
353
|
-
describe "using add_gwt_facet that specifies gwt sdk" do
|
354
|
-
before do
|
355
|
-
artifact('com.example:library:jar:2.0') { |task| write task.name }
|
356
|
-
@foo = define "foo" do
|
357
|
-
iml.add_gwt_facet({"com.biz.MyModule" => true},:gwt_dev_artifact => 'com.example:library:jar:2.0')
|
358
|
-
end
|
359
|
-
invoke_generate_task
|
360
|
-
end
|
361
|
-
|
362
|
-
it "generates a gwt facet with detected gwt sdk settings" do
|
363
|
-
doc = xml_document(@foo._("foo.iml"))
|
364
|
-
facet_xpath = ensure_facet_xpath(doc, 'gwt', 'GWT')
|
365
|
-
setting_xpath = "#{facet_xpath}/configuration/setting"
|
366
|
-
doc.should have_xpath("#{setting_xpath}[@name='gwtSdkType', value='maven']")
|
367
|
-
doc.should have_xpath("#{setting_xpath}[@name='gwtSdkUrl', value='$MAVEN_REPOSITORY$/com/google/gwt/gwt-dev/2.5.1']")
|
368
|
-
end
|
369
|
-
end
|
370
|
-
|
371
|
-
describe "using add_gwt_facet that specifies settings" do
|
372
|
-
before do
|
373
|
-
@foo = define "foo" do
|
374
|
-
iml.add_gwt_facet({"com.biz.MyModule" => true, "com.biz.MyOtherModule" => false},
|
375
|
-
:settings => {:gwtScriptOutputStyle => 'OTHER', :compilerMaxHeapSize => 1024, :zang => 'zang'})
|
376
|
-
end
|
377
|
-
invoke_generate_task
|
378
|
-
end
|
379
|
-
|
380
|
-
it "generates a gwt facet with specified settings" do
|
381
|
-
doc = xml_document(@foo._("foo.iml"))
|
382
|
-
facet_xpath = ensure_facet_xpath(doc, 'gwt', 'GWT')
|
383
|
-
setting_xpath = "#{facet_xpath}/configuration/setting"
|
384
|
-
doc.should have_xpath("#{setting_xpath}[@name='zang', value='zang']")
|
385
|
-
doc.should have_xpath("#{setting_xpath}[@name='gwtScriptOutputStyle', value='OTHER']")
|
386
|
-
doc.should have_xpath("#{setting_xpath}[@name='compilerMaxHeapSize', value='1024']")
|
387
|
-
end
|
388
|
-
end
|
389
|
-
|
390
|
-
describe "using add_web_facet with jsf and idea version 12" do
|
391
|
-
before do
|
392
|
-
write "src/main/webapp/WEB-INF/web.xml"
|
393
|
-
write "src/main/webapp/WEB-INF/faces-config.xml"
|
394
|
-
|
395
|
-
@foo = define "foo" do
|
396
|
-
ipr.version = "12"
|
397
|
-
iml.add_web_facet
|
398
|
-
end
|
399
|
-
invoke_generate_task
|
400
|
-
end
|
401
|
-
|
402
|
-
it "generates a web facet with jsf facet auto-detected" do
|
403
|
-
doc = xml_document(@foo._("foo.iml"))
|
404
|
-
web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
|
405
|
-
doc.should have_xpath("#{web_facet_xpath}/facet[@type='jsf'
|
406
|
-
end
|
407
|
-
end
|
408
|
-
|
409
|
-
describe "using add_web_facet should default to no jsf" do
|
410
|
-
before do
|
411
|
-
write "src/main/webapp/WEB-INF/web.xml"
|
412
|
-
|
413
|
-
@foo = define "foo" do
|
414
|
-
iml.add_web_facet
|
415
|
-
end
|
416
|
-
invoke_generate_task
|
417
|
-
end
|
418
|
-
|
419
|
-
it "does not generate a web facet with jsf facet" do
|
420
|
-
doc = xml_document(@foo._("foo.iml"))
|
421
|
-
web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
|
422
|
-
doc.should_not have_xpath("#{web_facet_xpath}/facet[@type='jsf'
|
423
|
-
end
|
424
|
-
end
|
425
|
-
|
426
|
-
describe "using add_web_facet with jsf and idea version 13" do
|
427
|
-
before do
|
428
|
-
write "src/main/webapp/WEB-INF/web.xml"
|
429
|
-
write "src/main/webapp/WEB-INF/faces-config.xml"
|
430
|
-
|
431
|
-
@foo = define "foo" do
|
432
|
-
ipr.version = "13"
|
433
|
-
iml.add_web_facet
|
434
|
-
end
|
435
|
-
invoke_generate_task
|
436
|
-
end
|
437
|
-
|
438
|
-
it "does not generate a web facet with jsf facet" do
|
439
|
-
doc = xml_document(@foo._("foo.iml"))
|
440
|
-
web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
|
441
|
-
doc.should_not have_xpath("#{web_facet_xpath}/facet[@type='jsf'
|
442
|
-
end
|
443
|
-
end
|
444
|
-
|
445
|
-
describe "using add_web_facet with jsf and idea version 13 and jsf 'enabled'" do
|
446
|
-
before do
|
447
|
-
write "src/main/webapp/WEB-INF/web.xml"
|
448
|
-
write "src/main/webapp/WEB-INF/faces-config.xml"
|
449
|
-
|
450
|
-
@foo = define "foo" do
|
451
|
-
ipr.version = "13"
|
452
|
-
iml.add_web_facet(:enable_jsf => true)
|
453
|
-
end
|
454
|
-
invoke_generate_task
|
455
|
-
end
|
456
|
-
|
457
|
-
it "does not generate a web facet with jsf facet" do
|
458
|
-
doc = xml_document(@foo._("foo.iml"))
|
459
|
-
web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
|
460
|
-
doc.should_not have_xpath("#{web_facet_xpath}/facet[@type='jsf'
|
461
|
-
end
|
462
|
-
end
|
463
|
-
|
464
|
-
describe "using add_web_facet" do
|
465
|
-
before do
|
466
|
-
write "src/main/webapp/WEB-INF/web.xml"
|
467
|
-
write "src/main/webapp/WEB-INF/glassfish-web.xml"
|
468
|
-
write "src/main/webapp/WEB-INF/context.xml"
|
469
|
-
|
470
|
-
@foo = define "foo" do
|
471
|
-
iml.add_web_facet
|
472
|
-
end
|
473
|
-
invoke_generate_task
|
474
|
-
end
|
475
|
-
|
476
|
-
it "generates a web facet with appropriate deployment descriptors" do
|
477
|
-
doc = xml_document(@foo._("foo.iml"))
|
478
|
-
web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
|
479
|
-
deployment_descriptor_xpath = "#{web_facet_xpath}/configuration/descriptors/deploymentDescriptor"
|
480
|
-
doc.should have_xpath("#{deployment_descriptor_xpath}[@name='web.xml', url='file://$MODULE_DIR$/src/main/webapp/WEB-INF/web.xml']")
|
481
|
-
doc.should have_xpath("#{deployment_descriptor_xpath}[@name='glassfish-web.xml', url='file://$MODULE_DIR$/src/main/webapp/WEB-INF/glassfish-web.xml']")
|
482
|
-
end
|
483
|
-
|
484
|
-
it "generates a web facet with derived webroots" do
|
485
|
-
doc = xml_document(@foo._("foo.iml"))
|
486
|
-
web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
|
487
|
-
doc.should have_xpath("#{web_facet_xpath}/configuration/webroots/root[@url='file://$MODULE_DIR$/src/main/webapp'
|
488
|
-
end
|
489
|
-
end
|
490
|
-
|
491
|
-
describe "using add_web_facet with specified parameters" do
|
492
|
-
before do
|
493
|
-
@foo = define "foo" do
|
494
|
-
iml.add_web_facet(:deployment_descriptors => ["src/main/webapp2/WEB-INF/web.xml"],
|
495
|
-
:webroots => {"src/main/webapp2" => "/", "src/main/css" => "/css"})
|
496
|
-
end
|
497
|
-
invoke_generate_task
|
498
|
-
end
|
499
|
-
|
500
|
-
it "generates a web facet with appropriate deployment descriptors" do
|
501
|
-
doc = xml_document(@foo._("foo.iml"))
|
502
|
-
web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
|
503
|
-
deployment_descriptor_xpath = "#{web_facet_xpath}/configuration/descriptors/deploymentDescriptor"
|
504
|
-
doc.should have_xpath("#{deployment_descriptor_xpath}[@name='web.xml', url='file://$MODULE_DIR$/src/main/webapp2/WEB-INF/web.xml']")
|
505
|
-
end
|
506
|
-
|
507
|
-
it "generates a web facet with specified webroots" do
|
508
|
-
doc = xml_document(@foo._("foo.iml"))
|
509
|
-
web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
|
510
|
-
doc.should have_xpath("#{web_facet_xpath}/configuration/webroots/root[@url='file://$MODULE_DIR$/src/main/webapp2'
|
511
|
-
doc.should have_xpath("#{web_facet_xpath}/configuration/webroots/root[@url='file://$MODULE_DIR$/src/main/css'
|
512
|
-
end
|
513
|
-
end
|
514
|
-
|
515
|
-
describe "using add_jpa_facet" do
|
516
|
-
before do
|
517
|
-
write "src/main/resources/META-INF/persistence.xml", "org.hibernate.ejb.HibernatePersistence"
|
518
|
-
write "src/main/resources/META-INF/orm.xml"
|
519
|
-
|
520
|
-
@foo = define "foo" do
|
521
|
-
iml.add_jpa_facet
|
522
|
-
end
|
523
|
-
invoke_generate_task
|
524
|
-
end
|
525
|
-
|
526
|
-
it "generates a jpa facet with appropriate deployment descriptors" do
|
527
|
-
doc = xml_document(@foo._("foo.iml"))
|
528
|
-
facet_xpath = ensure_facet_xpath(doc, 'jpa', 'JPA')
|
529
|
-
deployment_descriptor_xpath = "#{facet_xpath}/configuration/deploymentDescriptor"
|
530
|
-
doc.should have_xpath("#{deployment_descriptor_xpath}[@name='persistence.xml', url='file://$MODULE_DIR$/src/main/resources/META-INF/persistence.xml']")
|
531
|
-
doc.should have_xpath("#{deployment_descriptor_xpath}[@name='orm.xml', url='file://$MODULE_DIR$/src/main/resources/META-INF/orm.xml']")
|
532
|
-
end
|
533
|
-
|
534
|
-
it "generates a jpa facet with default settings" do
|
535
|
-
doc = xml_document(@foo._("foo.iml"))
|
536
|
-
facet_xpath = ensure_facet_xpath(doc, 'jpa', 'JPA')
|
537
|
-
doc.should have_xpath("#{facet_xpath}/configuration/setting[@name='validation-enabled'
|
538
|
-
doc.should have_xpath("#{facet_xpath}/configuration/setting[@name='provider-name'
|
539
|
-
end
|
540
|
-
end
|
541
|
-
|
542
|
-
describe "using add_jpa_facet specifying parameters" do
|
543
|
-
before do
|
544
|
-
write "src/main/resources2/META-INF/persistence.xml"
|
545
|
-
write "src/main/resources2/META-INF/orm.xml"
|
546
|
-
|
547
|
-
@foo = define "foo" do
|
548
|
-
iml.add_jpa_facet(:provider_enabled => 'Hibernate',
|
549
|
-
:deployment_descriptors => ["src/main/resources2/META-INF/persistence.xml",
|
550
|
-
"src/main/resources2/META-INF/orm.xml"])
|
551
|
-
end
|
552
|
-
invoke_generate_task
|
553
|
-
end
|
554
|
-
|
555
|
-
it "generates a jpa facet with appropriate deployment descriptors" do
|
556
|
-
doc = xml_document(@foo._("foo.iml"))
|
557
|
-
facet_xpath = ensure_facet_xpath(doc, 'jpa', 'JPA')
|
558
|
-
deployment_descriptor_xpath = "#{facet_xpath}/configuration/deploymentDescriptor"
|
559
|
-
doc.should have_xpath("#{deployment_descriptor_xpath}[@name='persistence.xml', url='file://$MODULE_DIR$/src/main/resources2/META-INF/persistence.xml']")
|
560
|
-
doc.should have_xpath("#{deployment_descriptor_xpath}[@name='orm.xml', url='file://$MODULE_DIR$/src/main/resources2/META-INF/orm.xml']")
|
561
|
-
end
|
562
|
-
|
563
|
-
it "generates a jpa facet with default settings" do
|
564
|
-
doc = xml_document(@foo._("foo.iml"))
|
565
|
-
facet_xpath = ensure_facet_xpath(doc, 'jpa', 'JPA')
|
566
|
-
doc.should have_xpath("#{facet_xpath}/configuration/setting[@name='validation-enabled'
|
567
|
-
doc.should have_xpath("#{facet_xpath}/configuration/setting[@name='provider-name'
|
568
|
-
end
|
569
|
-
end
|
570
|
-
|
571
|
-
describe "using add_jpa_facet derived from main_source_directories" do
|
572
|
-
before do
|
573
|
-
write "src/main/resources2/META-INF/persistence.xml"
|
574
|
-
write "src/main/resources2/META-INF/orm.xml"
|
575
|
-
|
576
|
-
@foo = define "foo" do
|
577
|
-
iml.main_source_directories << "src/main/resources2"
|
578
|
-
iml.add_jpa_facet
|
579
|
-
|
580
|
-
end
|
581
|
-
invoke_generate_task
|
582
|
-
end
|
583
|
-
|
584
|
-
it "generates a jpa facet with appropriate deployment descriptors" do
|
585
|
-
doc = xml_document(@foo._("foo.iml"))
|
586
|
-
facet_xpath = ensure_facet_xpath(doc, 'jpa', 'JPA')
|
587
|
-
deployment_descriptor_xpath = "#{facet_xpath}/configuration/deploymentDescriptor"
|
588
|
-
doc.should have_xpath("#{deployment_descriptor_xpath}[@name='persistence.xml', url='file://$MODULE_DIR$/src/main/resources2/META-INF/persistence.xml']")
|
589
|
-
doc.should have_xpath("#{deployment_descriptor_xpath}[@name='orm.xml', url='file://$MODULE_DIR$/src/main/resources2/META-INF/orm.xml']")
|
590
|
-
end
|
591
|
-
end
|
592
|
-
|
593
|
-
describe "using add_jpa_facet with hibernate configured in persistence.xml" do
|
594
|
-
before do
|
595
|
-
write "src/main/resources/META-INF/persistence.xml", "org.hibernate.ejb.HibernatePersistence"
|
596
|
-
write "src/main/resources/META-INF/orm.xml"
|
597
|
-
|
598
|
-
@foo = define "foo" do
|
599
|
-
iml.add_jpa_facet
|
600
|
-
end
|
601
|
-
invoke_generate_task
|
602
|
-
end
|
603
|
-
|
604
|
-
it "generates a jpa facet with default settings" do
|
605
|
-
doc = xml_document(@foo._("foo.iml"))
|
606
|
-
facet_xpath = ensure_facet_xpath(doc, 'jpa', 'JPA')
|
607
|
-
doc.should have_xpath("#{facet_xpath}/configuration/setting[@name='validation-enabled'
|
608
|
-
doc.should have_xpath("#{facet_xpath}/configuration/setting[@name='provider-name'
|
609
|
-
end
|
610
|
-
end
|
611
|
-
|
612
|
-
describe "using add_jpa_facet with eclipselink configured in persistence.xml" do
|
613
|
-
before do
|
614
|
-
write "src/main/resources/META-INF/persistence.xml", "org.eclipse.persistence.jpa.PersistenceProvider"
|
615
|
-
write "src/main/resources/META-INF/orm.xml"
|
616
|
-
|
617
|
-
@foo = define "foo" do
|
618
|
-
iml.add_jpa_facet
|
619
|
-
end
|
620
|
-
invoke_generate_task
|
621
|
-
end
|
622
|
-
|
623
|
-
it "generates a jpa facet with default settings" do
|
624
|
-
doc = xml_document(@foo._("foo.iml"))
|
625
|
-
facet_xpath = ensure_facet_xpath(doc, 'jpa', 'JPA')
|
626
|
-
doc.should have_xpath("#{facet_xpath}/configuration/setting[@name='validation-enabled'
|
627
|
-
doc.should have_xpath("#{facet_xpath}/configuration/setting[@name='provider-name'
|
628
|
-
end
|
629
|
-
end
|
630
|
-
|
631
|
-
describe "using add_ejb_facet" do
|
632
|
-
before do
|
633
|
-
write "src/main/java/com/bin/foo.java"
|
634
|
-
write "src/main/resources/WEB-INF/ejb-jar.xml"
|
635
|
-
|
636
|
-
@foo = define "foo" do
|
637
|
-
iml.add_ejb_facet
|
638
|
-
end
|
639
|
-
invoke_generate_task
|
640
|
-
end
|
641
|
-
|
642
|
-
it "generates an ejb facet with appropriate deployment descriptors" do
|
643
|
-
doc = xml_document(@foo._("foo.iml"))
|
644
|
-
ejb_facet_xpath = ensure_facet_xpath(doc, 'ejb', 'EJB')
|
645
|
-
deployment_descriptor_xpath = "#{ejb_facet_xpath}/configuration/descriptors/deploymentDescriptor"
|
646
|
-
doc.should have_xpath("#{deployment_descriptor_xpath}[@name='ejb-jar.xml', url='file://$MODULE_DIR$/src/main/resources/WEB-INF/ejb-jar.xml']")
|
647
|
-
end
|
648
|
-
|
649
|
-
it "generates an ejb facet with derived ejbRoots" do
|
650
|
-
doc = xml_document(@foo._("foo.iml"))
|
651
|
-
ejb_facet_xpath = ensure_facet_xpath(doc, 'ejb', 'EJB')
|
652
|
-
doc.should have_xpath("#{ejb_facet_xpath}/configuration/ejbRoots/root[@url='file://$MODULE_DIR$/src/main/java']")
|
653
|
-
doc.should have_xpath("#{ejb_facet_xpath}/configuration/ejbRoots/root[@url='file://$MODULE_DIR$/src/main/resources']")
|
654
|
-
end
|
655
|
-
end
|
656
|
-
|
657
|
-
describe "using add_ejb_facet specifying parameters" do
|
658
|
-
before do
|
659
|
-
@foo = define "foo" do
|
660
|
-
iml.add_ejb_facet(:ejb_roots => ["generated/main/java","generated/main/resources"],
|
661
|
-
:deployment_descriptors => ["generated/main/resources/WEB-INF/ejb-jar.xml"])
|
662
|
-
end
|
663
|
-
invoke_generate_task
|
664
|
-
end
|
665
|
-
|
666
|
-
it "generates an ejb facet with appropriate deployment descriptors" do
|
667
|
-
doc = xml_document(@foo._("foo.iml"))
|
668
|
-
ejb_facet_xpath = ensure_facet_xpath(doc, 'ejb', 'EJB')
|
669
|
-
deployment_descriptor_xpath = "#{ejb_facet_xpath}/configuration/descriptors/deploymentDescriptor"
|
670
|
-
doc.should have_xpath("#{deployment_descriptor_xpath}[@name='ejb-jar.xml', url='file://$MODULE_DIR$/generated/main/resources/WEB-INF/ejb-jar.xml']")
|
671
|
-
end
|
672
|
-
|
673
|
-
it "generates an ejb facet with derived ejbRoots" do
|
674
|
-
doc = xml_document(@foo._("foo.iml"))
|
675
|
-
ejb_facet_xpath = ensure_facet_xpath(doc, 'ejb', 'EJB')
|
676
|
-
doc.should have_xpath("#{ejb_facet_xpath}/configuration/ejbRoots/root[@url='file://$MODULE_DIR$/generated/main/java']")
|
677
|
-
doc.should have_xpath("#{ejb_facet_xpath}/configuration/ejbRoots/root[@url='file://$MODULE_DIR$/generated/main/resources']")
|
678
|
-
end
|
679
|
-
end
|
680
|
-
|
681
|
-
describe "using add_ejb_facet derived from main_source_directories" do
|
682
|
-
before do
|
683
|
-
write "src/main/resources2/WEB-INF/ejb-jar.xml"
|
684
|
-
@foo = define "foo" do
|
685
|
-
iml.main_source_directories << "src/main/resources2"
|
686
|
-
iml.add_ejb_facet
|
687
|
-
end
|
688
|
-
invoke_generate_task
|
689
|
-
end
|
690
|
-
|
691
|
-
it "generates an ejb facet with appropriate deployment descriptors" do
|
692
|
-
doc = xml_document(@foo._("foo.iml"))
|
693
|
-
ejb_facet_xpath = ensure_facet_xpath(doc, 'ejb', 'EJB')
|
694
|
-
deployment_descriptor_xpath = "#{ejb_facet_xpath}/configuration/descriptors/deploymentDescriptor"
|
695
|
-
doc.should have_xpath("#{deployment_descriptor_xpath}[@name='ejb-jar.xml', url='file://$MODULE_DIR$/src/main/resources2/WEB-INF/ejb-jar.xml']")
|
696
|
-
end
|
697
|
-
end
|
698
|
-
|
699
|
-
describe "using add_jruby_facet" do
|
700
|
-
before do
|
701
|
-
|
702
|
-
@foo = define "foo" do
|
703
|
-
iml.add_jruby_facet
|
704
|
-
end
|
705
|
-
invoke_generate_task
|
706
|
-
end
|
707
|
-
|
708
|
-
it "generates a jruby facet with appropriate sdk" do
|
709
|
-
doc = xml_document(@foo._("foo.iml"))
|
710
|
-
jruby_facet_xpath = ensure_facet_xpath(doc, 'JRUBY', 'JRuby')
|
711
|
-
doc.should have_xpath("#{jruby_facet_xpath}/configuration/JRUBY_FACET_CONFIG_ID[@NAME='JRUBY_SDK_NAME', VALUE='jruby-1.6.7.2']")
|
712
|
-
end
|
713
|
-
|
714
|
-
it "generates a jruby facet with appropriate paths" do
|
715
|
-
doc = xml_document(@foo._("foo.iml"))
|
716
|
-
jruby_facet_xpath = ensure_facet_xpath(doc, 'JRUBY', 'JRuby')
|
717
|
-
prefix = "#{jruby_facet_xpath}/configuration"
|
718
|
-
doc.should have_xpath("#{prefix}/LOAD_PATH[@number='0']")
|
719
|
-
doc.should have_xpath("#{prefix}/I18N_FOLDERS[@number='0']")
|
720
|
-
end
|
721
|
-
end
|
722
|
-
|
723
|
-
describe "using add_jruby_facet with .ruby-version specified" do
|
724
|
-
before do
|
725
|
-
|
726
|
-
write ".ruby-version", "jruby-1.7.2"
|
727
|
-
|
728
|
-
@foo = define "foo" do
|
729
|
-
iml.add_jruby_facet
|
730
|
-
end
|
731
|
-
invoke_generate_task
|
732
|
-
end
|
733
|
-
|
734
|
-
it "generates a jruby facet with appropriate sdk" do
|
735
|
-
doc = xml_document(@foo._("foo.iml"))
|
736
|
-
jruby_facet_xpath = ensure_facet_xpath(doc, 'JRUBY', 'JRuby')
|
737
|
-
doc.should have_xpath("#{jruby_facet_xpath}/configuration/JRUBY_FACET_CONFIG_ID[@NAME='JRUBY_SDK_NAME', VALUE='rbenv: jruby-1.7.2']")
|
738
|
-
end
|
739
|
-
|
740
|
-
it "generates a jruby facet with appropriate paths" do
|
741
|
-
doc = xml_document(@foo._("foo.iml"))
|
742
|
-
jruby_facet_xpath = ensure_facet_xpath(doc, 'JRUBY', 'JRuby')
|
743
|
-
prefix = "#{jruby_facet_xpath}/configuration"
|
744
|
-
doc.should have_xpath("#{prefix}/LOAD_PATH[@number='0']")
|
745
|
-
doc.should have_xpath("#{prefix}/I18N_FOLDERS[@number='0']")
|
746
|
-
end
|
747
|
-
end
|
748
|
-
|
749
|
-
describe "with add_data_source" do
|
750
|
-
before do
|
751
|
-
artifact("org.postgresql:postgresql:jar:9.not-a-version") { |task| write task.name }
|
752
|
-
@foo = define "foo" do
|
753
|
-
ipr.add_data_source("Postgres",
|
754
|
-
:driver => 'org.postgresql.Driver',
|
755
|
-
:url => "jdbc:postgresql://127.0.0.1:5432/MyDb",
|
756
|
-
:username => "MyDBUser",
|
757
|
-
:password => "secreto",
|
758
|
-
:dialect => "PostgreSQL",
|
759
|
-
:classpath => ["org.postgresql:postgresql:jar:9.not-a-version"])
|
760
|
-
end
|
761
|
-
invoke_generate_task
|
762
|
-
end
|
763
|
-
|
764
|
-
it "generates a data source manager with specified data source" do
|
765
|
-
doc = xml_document(@foo._("foo.ipr"))
|
766
|
-
prefix_xpath = "/project/component[@name='DataSourceManagerImpl'
|
767
|
-
doc.should have_nodes(prefix_xpath, 1)
|
768
|
-
ds_path = "#{prefix_xpath}[@source='LOCAL'
|
769
|
-
doc.should have_xpath(ds_path)
|
770
|
-
doc.should have_xpath("#{ds_path}/synchronize/text() = 'true'")
|
771
|
-
doc.should have_xpath("#{ds_path}/jdbc-driver/text() = 'org.postgresql.Driver'")
|
772
|
-
doc.should have_xpath("#{ds_path}/jdbc-url/text() = 'jdbc:postgresql://127.0.0.1:5432/MyDb'")
|
773
|
-
doc.should have_xpath("#{ds_path}/user-name/text() = 'MyDBUser'")
|
774
|
-
doc.should have_xpath("#{ds_path}/user-password/text() = 'dfd9dfcfdfc9dfd8dfcfdfdedfc5'")
|
775
|
-
doc.should have_xpath("#{ds_path}/default-dialect/text() = 'PostgreSQL'")
|
776
|
-
doc.should have_xpath("#{ds_path}/libraries/library/url/text() = '$MAVEN_REPOSITORY$/org/postgresql/postgresql/9.not-a-version/postgresql-9.not-a-version.jar'")
|
777
|
-
end
|
778
|
-
end
|
779
|
-
|
780
|
-
describe "with add_postgres_data_source" do
|
781
|
-
before do
|
782
|
-
ENV["USER"] = "Bob"
|
783
|
-
artifact("org.postgresql:postgresql:jar:9.2-1003-jdbc4") { |task| write task.name }
|
784
|
-
@foo = define "foo" do
|
785
|
-
ipr.add_postgres_data_source("Postgres", :database => 'MyDb')
|
786
|
-
end
|
787
|
-
invoke_generate_task
|
788
|
-
end
|
789
|
-
|
790
|
-
it "generates a data source manager with specified data source" do
|
791
|
-
doc = xml_document(@foo._("foo.ipr"))
|
792
|
-
prefix_xpath = "/project/component[@name='DataSourceManagerImpl'
|
793
|
-
doc.should have_nodes(prefix_xpath, 1)
|
794
|
-
ds_path = "#{prefix_xpath}[@source='LOCAL'
|
795
|
-
doc.should have_xpath(ds_path)
|
796
|
-
doc.should have_xpath("#{ds_path}/synchronize/text() = 'true'")
|
797
|
-
doc.should have_xpath("#{ds_path}/jdbc-driver/text() = 'org.postgresql.Driver'")
|
798
|
-
doc.should have_xpath("#{ds_path}/jdbc-url/text() = 'jdbc:postgresql://127.0.0.1:5432/MyDb'")
|
799
|
-
doc.should have_xpath("#{ds_path}/user-name/text() = 'Bob'")
|
800
|
-
doc.should have_xpath("#{ds_path}/default-dialect/text() = 'PostgreSQL'")
|
801
|
-
doc.should have_xpath("#{ds_path}/libraries/library/url/text() = '$MAVEN_REPOSITORY$/org/postgresql/postgresql/9.2-1003-jdbc4/postgresql-9.2-1003-jdbc4.jar'")
|
802
|
-
end
|
803
|
-
end
|
804
|
-
|
805
|
-
describe "with add_sql_server_data_source" do
|
806
|
-
before do
|
807
|
-
ENV["USER"] = "Bob"
|
808
|
-
artifact('net.sourceforge.jtds:jtds:jar:1.2.7') { |task| write task.name }
|
809
|
-
@foo = define "foo" do
|
810
|
-
ipr.add_sql_server_data_source("SqlServer", :database => 'MyDb')
|
811
|
-
end
|
812
|
-
invoke_generate_task
|
813
|
-
end
|
814
|
-
|
815
|
-
it "generates a data source manager with specified data source" do
|
816
|
-
doc = xml_document(@foo._("foo.ipr"))
|
817
|
-
prefix_xpath = "/project/component[@name='DataSourceManagerImpl'
|
818
|
-
doc.should have_nodes(prefix_xpath, 1)
|
819
|
-
ds_path = "#{prefix_xpath}[@source='LOCAL'
|
820
|
-
doc.should have_xpath(ds_path)
|
821
|
-
|
822
|
-
doc.should have_xpath("#{ds_path}/synchronize/text() = 'true'")
|
823
|
-
doc.should have_xpath("#{ds_path}/jdbc-driver/text() = 'net.sourceforge.jtds.jdbc.Driver'")
|
824
|
-
doc.should have_xpath("#{ds_path}/jdbc-url/text() = 'jdbc:jtds:sqlserver://127.0.0.1:1433/MyDb'")
|
825
|
-
doc.should have_xpath("#{ds_path}/user-name/text() = 'Bob'")
|
826
|
-
doc.should have_xpath("#{ds_path}/default-dialect/text() = 'TSQL'")
|
827
|
-
doc.should have_xpath("#{ds_path}/libraries/library/url/text() = '$MAVEN_REPOSITORY$/net/sourceforge/jtds/1.2.7/jtds-1.2.7.jar'")
|
828
|
-
end
|
829
|
-
end
|
830
|
-
|
831
|
-
describe "with artifacts added to root project" do
|
832
|
-
before do
|
833
|
-
@foo = define "foo" do
|
834
|
-
ipr.add_artifact("MyFancy.jar", "jar") do |xml|
|
835
|
-
xml.tag!('output-path', project._(:artifacts, "MyFancy.jar"))
|
836
|
-
xml.element :id => "module-output", :name => "foo"
|
837
|
-
end
|
838
|
-
ipr.add_artifact("MyOtherFancy.jar", "jar") do |xml|
|
839
|
-
xml.tag!('output-path', project._(:artifacts, "MyOtherFancy.jar"))
|
840
|
-
xml.element :id => "module-output", :name => "foo"
|
841
|
-
end
|
842
|
-
end
|
843
|
-
invoke_generate_task
|
844
|
-
end
|
845
|
-
|
846
|
-
it "generates an IPR with multiple jar artifacts" do
|
847
|
-
doc = xml_document(@foo._("foo.ipr"))
|
848
|
-
facet_xpath = "/project/component[@name='ArtifactManager']/artifact"
|
849
|
-
doc.should have_nodes(facet_xpath, 2)
|
850
|
-
doc.should have_xpath("#{facet_xpath}[@type='jar'
|
851
|
-
doc.should have_xpath("#{facet_xpath}[@type='jar'
|
852
|
-
end
|
853
|
-
end
|
854
|
-
|
855
|
-
describe "that uses add_jar_artifact with no overrides" do
|
856
|
-
before do
|
857
|
-
write 'foo/bar/src/main/java/foo/Foo.java' # needed so that buildr will treat as a java project
|
858
|
-
artifact('net.sourceforge.jtds:jtds:jar:1.2.7.XX') { |task| write task.name }
|
859
|
-
|
860
|
-
@foo = define "foo" do
|
861
|
-
project.version = '1.0'
|
862
|
-
define "bar" do
|
863
|
-
compile.with 'net.sourceforge.jtds:jtds:jar:1.2.7.XX'
|
864
|
-
package :war
|
865
|
-
end
|
866
|
-
ipr.add_jar_artifact(project("bar"))
|
867
|
-
end
|
868
|
-
invoke_generate_task
|
869
|
-
end
|
870
|
-
|
871
|
-
it "generates an IPR with a jar artifact" do
|
872
|
-
doc = xml_document(@foo._("foo.ipr"))
|
873
|
-
base_xpath = "/project/component[@name='ArtifactManager']/artifact"
|
874
|
-
facet_xpath = "#{base_xpath}[@type='jar' and @name='bar.jar' and @build-on-make='false']"
|
875
|
-
doc.should have_xpath(facet_xpath)
|
876
|
-
|
877
|
-
doc.should have_xpath("#{facet_xpath}/output-path/text() = $PROJECT_DIR$/artifacts/bar")
|
878
|
-
doc.should have_xpath("#{facet_xpath}/root[@id='archive' and @name='bar.jar']/element[@id='module-output' and @name='bar']")
|
879
|
-
end
|
880
|
-
end
|
881
|
-
|
882
|
-
describe "that uses add_jar_artifact with overrides" do
|
883
|
-
before do
|
884
|
-
write 'foo/bar/src/main/java/foo/Foo.java' # needed so that buildr will treat as a java project
|
885
|
-
artifact('net.sourceforge.jtds:jtds:jar:1.2.7.XX') { |task| write task.name }
|
886
|
-
|
887
|
-
@foo = define "foo" do
|
888
|
-
project.version = '1.0'
|
889
|
-
define "bar" do
|
890
|
-
compile.with 'net.sourceforge.jtds:jtds:jar:1.2.7.XX'
|
891
|
-
package :war
|
892
|
-
end
|
893
|
-
ipr.add_jar_artifact(project,
|
894
|
-
:name => 'bar',
|
895
|
-
:output_dir => _('bink'),
|
896
|
-
:build_on_make => true,
|
897
|
-
:ejb_module_names => ['x'],
|
898
|
-
:jpa_module_names => ['p'],
|
899
|
-
:dependencies => [project('bar')])
|
900
|
-
end
|
901
|
-
invoke_generate_task
|
902
|
-
end
|
903
|
-
|
904
|
-
it "generates an IPR with a jar artifact" do
|
905
|
-
doc = xml_document(@foo._("foo.ipr"))
|
906
|
-
base_xpath = "/project/component[@name='ArtifactManager']/artifact"
|
907
|
-
facet_xpath = "#{base_xpath}[@type='jar' and @name='bar.jar' and @build-on-make='true']"
|
908
|
-
doc.should have_xpath(facet_xpath)
|
909
|
-
|
910
|
-
doc.should have_xpath("#{facet_xpath}/output-path/text() = $PROJECT_DIR$/bink")
|
911
|
-
doc.should have_xpath("#{facet_xpath}/root[@id='archive' and @name='bar.jar']/element[@id='module-output' and @name='bar']")
|
912
|
-
doc.should have_xpath("#{facet_xpath}/root[@id='archive' and @name='bar.jar']/element[@id='jpa-descriptors' and @facet='p/jpa/JPA']")
|
913
|
-
doc.should have_xpath("#{facet_xpath}/root[@id='archive' and @name='bar.jar']/element[@id='javaee-facet-resources' and @facet='x/ejb/EJB']")
|
914
|
-
end
|
915
|
-
end
|
916
|
-
|
917
|
-
describe "that uses add_exploded_ejb_artifact with overrides" do
|
918
|
-
before do
|
919
|
-
write 'foo/bar/src/main/java/foo/Foo.java' # needed so that buildr will treat as a java project
|
920
|
-
artifact('net.sourceforge.jtds:jtds:jar:1.2.7.XX') { |task| write task.name }
|
921
|
-
|
922
|
-
@foo = define "foo" do
|
923
|
-
project.version = '1.0'
|
924
|
-
define "bar" do
|
925
|
-
compile.with 'net.sourceforge.jtds:jtds:jar:1.2.7.XX'
|
926
|
-
package :jar
|
927
|
-
end
|
928
|
-
ipr.add_exploded_ejb_artifact(project("bar"),
|
929
|
-
:ejb_module_names => ['x'],
|
930
|
-
:jpa_module_names => ['p'])
|
931
|
-
end
|
932
|
-
invoke_generate_task
|
933
|
-
end
|
934
|
-
|
935
|
-
it "generates an IPR with an ejb artifact" do
|
936
|
-
doc = xml_document(@foo._("foo.ipr"))
|
937
|
-
base_xpath = "/project/component[@name='ArtifactManager']/artifact"
|
938
|
-
facet_xpath = "#{base_xpath}[@type='exploded-ejb' and @name='bar' and @build-on-make='false']"
|
939
|
-
doc.should have_xpath(facet_xpath)
|
940
|
-
doc.should have_xpath("#{facet_xpath}/output-path/text() = $PROJECT_DIR$/artifacts/bar")
|
941
|
-
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='module-output' and @name='bar']")
|
942
|
-
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='jpa-descriptors' and @facet='p/jpa/JPA']")
|
943
|
-
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='javaee-facet-resources' and @facet='x/ejb/EJB']")
|
944
|
-
end
|
945
|
-
end
|
946
|
-
|
947
|
-
describe "that uses add_exploded_ejb_artifact with no overrides" do
|
948
|
-
before do
|
949
|
-
write 'foo/bar/src/main/java/foo/Foo.java' # needed so that buildr will treat as a java project
|
950
|
-
artifact('net.sourceforge.jtds:jtds:jar:1.2.7.XX') { |task| write task.name }
|
951
|
-
|
952
|
-
@foo = define "foo" do
|
953
|
-
project.version = '1.0'
|
954
|
-
define "bar" do
|
955
|
-
compile.with 'net.sourceforge.jtds:jtds:jar:1.2.7.XX'
|
956
|
-
package :war
|
957
|
-
end
|
958
|
-
ipr.add_exploded_ejb_artifact(project("bar"))
|
959
|
-
end
|
960
|
-
invoke_generate_task
|
961
|
-
end
|
962
|
-
|
963
|
-
it "generates an IPR with an ejb artifact" do
|
964
|
-
doc = xml_document(@foo._("foo.ipr"))
|
965
|
-
base_xpath = "/project/component[@name='ArtifactManager']/artifact"
|
966
|
-
facet_xpath = "#{base_xpath}[@type='exploded-ejb' and @name='bar' and @build-on-make='false']"
|
967
|
-
doc.should have_xpath(facet_xpath)
|
968
|
-
|
969
|
-
doc.should have_xpath("#{facet_xpath}/output-path/text() = $PROJECT_DIR$/artifacts/bar")
|
970
|
-
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='module-output' and @name='bar']")
|
971
|
-
end
|
972
|
-
end
|
973
|
-
|
974
|
-
|
975
|
-
describe "that uses add_exploded_war_artifact with no overrides" do
|
976
|
-
before do
|
977
|
-
write 'foo/bar/src/main/java/foo/Foo.java' # needed so that buildr will treat as a java project
|
978
|
-
artifact('net.sourceforge.jtds:jtds:jar:1.2.7.XX') { |task| write task.name }
|
979
|
-
|
980
|
-
@foo = define "foo" do
|
981
|
-
project.version = '1.0'
|
982
|
-
define "bar" do
|
983
|
-
compile.with 'net.sourceforge.jtds:jtds:jar:1.2.7.XX'
|
984
|
-
package :war
|
985
|
-
end
|
986
|
-
ipr.add_exploded_war_artifact(project("bar"))
|
987
|
-
end
|
988
|
-
invoke_generate_task
|
989
|
-
end
|
990
|
-
|
991
|
-
it "generates an IPR with a war artifact" do
|
992
|
-
doc = xml_document(@foo._("foo.ipr"))
|
993
|
-
base_xpath = "/project/component[@name='ArtifactManager']/artifact"
|
994
|
-
facet_xpath = "#{base_xpath}[@type='exploded-war' and @name='bar' and @build-on-make='false']"
|
995
|
-
doc.should have_xpath(facet_xpath)
|
996
|
-
|
997
|
-
doc.should have_xpath("#{facet_xpath}/output-path/text() = $PROJECT_DIR$/artifacts/bar")
|
998
|
-
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='directory' and @name='WEB-INF']/element[@id='directory'
|
999
|
-
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='directory' and @name='WEB-INF']/element[@id='directory'
|
1000
|
-
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='javaee-facet-resources' and @facet='bar/web/Web']")
|
1001
|
-
end
|
1002
|
-
end
|
1003
|
-
|
1004
|
-
describe "that uses add_exploded_war_artifact with overrides" do
|
1005
|
-
before do
|
1006
|
-
write 'foo/bar/src/main/java/foo/Foo.java' # needed so that buildr will treat as a java project
|
1007
|
-
artifact('net.sourceforge.jtds:jtds:jar:1.2.7.XX') { |task| write task.name }
|
1008
|
-
|
1009
|
-
@foo = define "foo" do
|
1010
|
-
project.version = '1.0'
|
1011
|
-
define "bar" do
|
1012
|
-
compile.with 'net.sourceforge.jtds:jtds:jar:1.2.7.XX'
|
1013
|
-
package :war
|
1014
|
-
end
|
1015
|
-
ipr.add_exploded_war_artifact(project,
|
1016
|
-
:name => 'gar',
|
1017
|
-
:war_module_names => ['x','y'],
|
1018
|
-
:gwt_module_names => ['p','q'],
|
1019
|
-
:artifacts => ['baz','biz'],
|
1020
|
-
:dependencies => ['net.sourceforge.jtds:jtds:jar:1.2.7.XX', project('bar')])
|
1021
|
-
end
|
1022
|
-
invoke_generate_task
|
1023
|
-
end
|
1024
|
-
|
1025
|
-
it "generates an IPR with a war artifact" do
|
1026
|
-
doc = xml_document(@foo._("foo.ipr"))
|
1027
|
-
base_xpath = "/project/component[@name='ArtifactManager']/artifact"
|
1028
|
-
facet_xpath = "#{base_xpath}[@type='exploded-war' @name='MyFancy.jar'
|
1029
|
-
doc.should have_xpath(facet_xpath)
|
1030
|
-
|
1031
|
-
doc.should have_xpath("#{facet_xpath}/output-path/text() = $PROJECT_DIR$/artifacts/gar")
|
1032
|
-
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='directory' and @name='WEB-INF']/element[@id='directory'
|
1033
|
-
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='directory' and @name='WEB-INF']/element[@id='directory'
|
1034
|
-
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='javaee-facet-resources' and @facet='x/web/Web']")
|
1035
|
-
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='javaee-facet-resources' and @facet='y/web/Web']")
|
1036
|
-
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='gwt-compiler-output' and @facet='p/gwt/GWT']")
|
1037
|
-
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='gwt-compiler-output' and @facet='q/gwt/GWT']")
|
1038
|
-
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='directory' and @name='WEB-INF']/element[@id='directory'
|
1039
|
-
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='directory' and @name='WEB-INF']/element[@id='directory'
|
1040
|
-
end
|
1041
|
-
end
|
1042
|
-
|
1043
|
-
describe "with configurations added to root project" do
|
1044
|
-
before do
|
1045
|
-
@foo = define "foo" do
|
1046
|
-
ipr.add_configuration("Run Contacts.html", "GWT.ConfigurationType", "GWT Configuration") do |xml|
|
1047
|
-
xml.module(:name => project.iml.id)
|
1048
|
-
xml.option(:name => "RUN_PAGE", :value => "Contacts.html")
|
1049
|
-
xml.option(:name => "compilerParameters", :value => "-draftCompile -localWorkers 2")
|
1050
|
-
xml.option(:name => "compilerMaxHeapSize", :value => "512")
|
1051
|
-
|
1052
|
-
xml.RunnerSettings(:RunnerId => "Run")
|
1053
|
-
xml.ConfigurationWrapper(:RunnerId => "Run")
|
1054
|
-
xml.tag! :method
|
1055
|
-
end
|
1056
|
-
ipr.add_configuration("Run Planner.html", "GWT.ConfigurationType", "GWT Configuration") do |xml|
|
1057
|
-
xml.module(:name => project.iml.id)
|
1058
|
-
xml.option(:name => "RUN_PAGE", :value => "Planner.html")
|
1059
|
-
xml.option(:name => "compilerParameters", :value => "-draftCompile -localWorkers 2")
|
1060
|
-
xml.option(:name => "compilerMaxHeapSize", :value => "512")
|
1061
|
-
|
1062
|
-
xml.RunnerSettings(:RunnerId => "Run")
|
1063
|
-
xml.ConfigurationWrapper(:RunnerId => "Run")
|
1064
|
-
xml.tag! :method
|
1065
|
-
end
|
1066
|
-
end
|
1067
|
-
invoke_generate_task
|
1068
|
-
end
|
1069
|
-
|
1070
|
-
it "generates an IPR with multiple configurations" do
|
1071
|
-
doc = xml_document(@foo._("foo.ipr"))
|
1072
|
-
facet_xpath = "/project/component[@name='ProjectRunConfigurationManager']/configuration"
|
1073
|
-
doc.should have_nodes(facet_xpath, 2)
|
1074
|
-
doc.should have_xpath("#{facet_xpath}[@type='GWT.ConfigurationType'
|
1075
|
-
doc.should have_xpath("#{facet_xpath}[@type='GWT.ConfigurationType'
|
1076
|
-
end
|
1077
|
-
end
|
1078
|
-
|
1079
|
-
describe "with default configuration added to root project" do
|
1080
|
-
before do
|
1081
|
-
@foo = define "foo" do
|
1082
|
-
ipr.add_default_configuration("GWT.ConfigurationType", "GWT Configuration") do |xml|
|
1083
|
-
xml.module(:name => project.iml.id)
|
1084
|
-
xml.option(:name => "RUN_PAGE", :value => "Planner.html")
|
1085
|
-
xml.option(:name => "compilerParameters", :value => "-draftCompile -localWorkers 2")
|
1086
|
-
xml.option(:name => "compilerMaxHeapSize", :value => "512")
|
1087
|
-
|
1088
|
-
xml.RunnerSettings(:RunnerId => "Run")
|
1089
|
-
xml.ConfigurationWrapper(:RunnerId => "Run")
|
1090
|
-
xml.tag! :method
|
1091
|
-
end
|
1092
|
-
end
|
1093
|
-
invoke_generate_task
|
1094
|
-
end
|
1095
|
-
|
1096
|
-
it "generates an IPR with default configuration" do
|
1097
|
-
doc = xml_document(@foo._("foo.ipr"))
|
1098
|
-
facet_xpath = "/project/component[@name='ProjectRunConfigurationManager']/configuration"
|
1099
|
-
doc.should have_nodes(facet_xpath, 1)
|
1100
|
-
doc.should have_xpath("#{facet_xpath}[@type='GWT.ConfigurationType'
|
1101
|
-
end
|
1102
|
-
end
|
1103
|
-
|
1104
|
-
describe "with
|
1105
|
-
before do
|
1106
|
-
@foo = define "foo" do
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
end
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
end
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
@foo
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
doc
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
end
|
1323
|
-
end
|
1324
|
-
|
1325
|
-
describe "with
|
1326
|
-
before do
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
end
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
@
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1497
|
-
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
|
1515
|
-
|
1516
|
-
end
|
1517
|
-
|
1518
|
-
it "
|
1519
|
-
|
1520
|
-
end
|
1521
|
-
|
1522
|
-
it "generates
|
1523
|
-
|
1524
|
-
end
|
1525
|
-
end
|
1526
|
-
|
1527
|
-
describe "with
|
1528
|
-
before do
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
end
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1583
|
-
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
1587
|
-
def
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1591
|
-
|
1592
|
-
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
<
|
1603
|
-
|
1604
|
-
|
1605
|
-
|
1606
|
-
|
1607
|
-
|
1608
|
-
|
1609
|
-
|
1610
|
-
|
1611
|
-
|
1612
|
-
|
1613
|
-
|
1614
|
-
|
1615
|
-
|
1616
|
-
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
1622
|
-
|
1623
|
-
|
1624
|
-
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
1628
|
-
|
1629
|
-
|
1630
|
-
|
1631
|
-
end
|
1632
|
-
|
1633
|
-
def
|
1634
|
-
"/
|
1635
|
-
end
|
1636
|
-
|
1637
|
-
def
|
1638
|
-
|
1639
|
-
|
1640
|
-
|
1641
|
-
|
1642
|
-
|
1643
|
-
|
1644
|
-
|
1645
|
-
|
1646
|
-
|
1647
|
-
|
1648
|
-
|
1649
|
-
|
1650
|
-
|
1651
|
-
|
1652
|
-
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1665
|
-
|
1666
|
-
|
1667
|
-
|
1668
|
-
|
1669
|
-
|
1670
|
-
|
1671
|
-
|
1672
|
-
|
1673
|
-
|
1674
|
-
|
1675
|
-
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1687
|
-
|
1688
|
-
|
1689
|
-
|
1690
|
-
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1694
|
-
|
1695
|
-
|
1696
|
-
|
1697
|
-
|
1698
|
-
|
1699
|
-
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
xml_document(@foo._("foo.
|
1707
|
-
end
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
1724
|
-
|
1725
|
-
|
1726
|
-
|
1727
|
-
|
1728
|
-
|
1729
|
-
|
1730
|
-
|
1731
|
-
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
1735
|
-
|
1736
|
-
|
1737
|
-
|
1738
|
-
|
1739
|
-
|
1740
|
-
|
1741
|
-
|
1742
|
-
|
1743
|
-
|
1744
|
-
|
1745
|
-
|
1746
|
-
|
1747
|
-
|
1748
|
-
|
1749
|
-
|
1750
|
-
|
1751
|
-
|
1752
|
-
|
1753
|
-
|
1754
|
-
|
1755
|
-
|
1756
|
-
|
1757
|
-
|
1758
|
-
|
1759
|
-
|
1760
|
-
|
1761
|
-
|
1762
|
-
|
1763
|
-
|
1764
|
-
|
1765
|
-
|
1766
|
-
|
1767
|
-
|
1768
|
-
|
1769
|
-
|
1770
|
-
|
1771
|
-
|
1772
|
-
|
1773
|
-
|
1774
|
-
|
1775
|
-
|
1776
|
-
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1780
|
-
|
1781
|
-
|
1782
|
-
|
1783
|
-
|
1784
|
-
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
|
1789
|
-
|
1790
|
-
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1795
|
-
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1799
|
-
|
1800
|
-
|
1801
|
-
|
1802
|
-
|
1803
|
-
|
1804
|
-
|
1805
|
-
|
1806
|
-
|
1807
|
-
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
1817
|
-
|
1818
|
-
|
1819
|
-
|
1820
|
-
|
1821
|
-
|
1822
|
-
|
1823
|
-
|
1824
|
-
|
1825
|
-
|
1826
|
-
|
1827
|
-
|
1828
|
-
|
1829
|
-
describe "with
|
1830
|
-
|
1831
|
-
|
1832
|
-
|
1833
|
-
|
1834
|
-
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
1841
|
-
|
1842
|
-
|
1843
|
-
|
1844
|
-
|
1845
|
-
|
1846
|
-
|
1847
|
-
|
1848
|
-
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1863
|
-
|
1864
|
-
|
1865
|
-
end
|
1866
|
-
|
1867
|
-
|
1868
|
-
|
1869
|
-
|
1870
|
-
|
1871
|
-
|
1872
|
-
|
1873
|
-
|
1874
|
-
|
1875
|
-
|
1876
|
-
|
1877
|
-
|
1878
|
-
|
1879
|
-
end
|
1880
|
-
|
1881
|
-
|
1882
|
-
|
1883
|
-
|
1884
|
-
|
1885
|
-
|
1886
|
-
|
1887
|
-
|
1888
|
-
|
1889
|
-
|
1890
|
-
|
1891
|
-
|
1892
|
-
|
1893
|
-
|
1894
|
-
|
1895
|
-
|
1896
|
-
|
1897
|
-
|
1898
|
-
|
1899
|
-
|
1900
|
-
|
1901
|
-
|
1902
|
-
|
1903
|
-
|
1904
|
-
|
1905
|
-
|
1906
|
-
|
1907
|
-
|
1908
|
-
|
1909
|
-
|
1910
|
-
|
1911
|
-
|
1912
|
-
|
1913
|
-
|
1914
|
-
|
1915
|
-
|
1916
|
-
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1920
|
-
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1929
|
-
|
1930
|
-
|
1931
|
-
|
1932
|
-
|
1933
|
-
|
1934
|
-
|
1935
|
-
|
1936
|
-
|
1937
|
-
|
1938
|
-
|
1939
|
-
|
1940
|
-
|
1941
|
-
|
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(File.join(File.dirname(__FILE__), '..', 'spec_helpers'))
|
18
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'xpath_matchers'))
|
19
|
+
|
20
|
+
def ensure_facet_xpath(doc, type, name)
|
21
|
+
facet_xpath = "/module/component[@name='FacetManager']/facet"
|
22
|
+
doc.should have_xpath(facet_xpath)
|
23
|
+
web_facet_xpath = "#{facet_xpath}[@type='#{type}' and @name='#{name}']"
|
24
|
+
doc.should have_xpath(web_facet_xpath)
|
25
|
+
web_facet_xpath
|
26
|
+
end
|
27
|
+
|
28
|
+
describe Buildr::IntellijIdea do
|
29
|
+
|
30
|
+
def invoke_generate_task
|
31
|
+
task('idea').invoke
|
32
|
+
end
|
33
|
+
|
34
|
+
def invoke_clean_task
|
35
|
+
task('idea:clean').invoke
|
36
|
+
end
|
37
|
+
|
38
|
+
def root_project_filename(project)
|
39
|
+
project._("#{project.name}#{Buildr::IntellijIdea::IdeaFile::DEFAULT_SUFFIX}.ipr")
|
40
|
+
end
|
41
|
+
|
42
|
+
def root_project_xml(project)
|
43
|
+
xml_document(root_project_filename(project))
|
44
|
+
end
|
45
|
+
|
46
|
+
def root_module_filename(project)
|
47
|
+
project._("#{project.name}#{Buildr::IntellijIdea::IdeaFile::DEFAULT_SUFFIX}.iml")
|
48
|
+
end
|
49
|
+
|
50
|
+
def root_module_xml(project)
|
51
|
+
xml_document(root_module_filename(project))
|
52
|
+
end
|
53
|
+
|
54
|
+
def subproject_module_filename(project, sub_project_name)
|
55
|
+
project._("#{sub_project_name}/#{sub_project_name}#{Buildr::IntellijIdea::IdeaFile::DEFAULT_SUFFIX}.iml")
|
56
|
+
end
|
57
|
+
|
58
|
+
def subproject_module_xml(project, sub_project_name)
|
59
|
+
xml_document(subproject_module_filename(project, sub_project_name))
|
60
|
+
end
|
61
|
+
|
62
|
+
def xml_document(filename)
|
63
|
+
File.should be_exist(filename)
|
64
|
+
REXML::Document.new(File.read(filename))
|
65
|
+
end
|
66
|
+
|
67
|
+
def xpath_to_module
|
68
|
+
"/project/component[@name='ProjectModuleManager']/modules/module"
|
69
|
+
end
|
70
|
+
|
71
|
+
describe "idea:clean" do
|
72
|
+
before do
|
73
|
+
write "foo.ipr"
|
74
|
+
write "foo.iml"
|
75
|
+
write "other.ipr"
|
76
|
+
write "other.iml"
|
77
|
+
mkdir_p 'bar'
|
78
|
+
write "bar/bar.iml"
|
79
|
+
write "bar/other.ipr"
|
80
|
+
write "bar/other.iml"
|
81
|
+
|
82
|
+
@foo = define "foo" do
|
83
|
+
define "bar"
|
84
|
+
end
|
85
|
+
invoke_clean_task
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should remove the ipr file" do
|
89
|
+
File.exists?("foo.ipr").should be_false
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should remove the project iml file" do
|
93
|
+
File.exists?("foo.iml").should be_false
|
94
|
+
end
|
95
|
+
|
96
|
+
it "should remove the subproject iml file" do
|
97
|
+
File.exists?("foo.iml").should be_false
|
98
|
+
end
|
99
|
+
|
100
|
+
it "should not remove other iml and ipr files" do
|
101
|
+
File.exists?("other.ipr").should be_true
|
102
|
+
File.exists?("other.iml").should be_true
|
103
|
+
File.exists?("bar/other.ipr").should be_true
|
104
|
+
File.exists?("bar/other.iml").should be_true
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe "idea task" do
|
109
|
+
|
110
|
+
def order_entry_xpath
|
111
|
+
"/module/component[@name='NewModuleRootManager']/orderEntry"
|
112
|
+
end
|
113
|
+
|
114
|
+
describe "with a single dependency" do
|
115
|
+
describe "of type compile" do
|
116
|
+
before do
|
117
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
118
|
+
@foo = define "foo" do
|
119
|
+
compile.with 'group:id:jar:1.0'
|
120
|
+
end
|
121
|
+
invoke_generate_task
|
122
|
+
end
|
123
|
+
|
124
|
+
it "generates one exported 'module-library' orderEntry in IML" do
|
125
|
+
root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library' and @exported='']/library/CLASSES/root", 1)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
describe "with iml.main_dependencies override" do
|
130
|
+
before do
|
131
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
132
|
+
@foo = define "foo" do
|
133
|
+
iml.main_dependencies << 'group:id:jar:1.0'
|
134
|
+
end
|
135
|
+
invoke_generate_task
|
136
|
+
end
|
137
|
+
|
138
|
+
it "generates one exported 'module-library' orderEntry in IML" do
|
139
|
+
root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library' and @scope='TEST']/library/CLASSES/root", 1)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
describe "of type test" do
|
144
|
+
before do
|
145
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
146
|
+
@foo = define "foo" do
|
147
|
+
test.with 'group:id:jar:1.0'
|
148
|
+
end
|
149
|
+
invoke_generate_task
|
150
|
+
end
|
151
|
+
|
152
|
+
it "generates one non-exported test scope 'module-library' orderEntry in IML" do
|
153
|
+
root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library' and @exported]/library/CLASSES/root", 0)
|
154
|
+
root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library' and @scope='TEST']/library/CLASSES/root", 1)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
describe "with iml.test_dependencies override" do
|
159
|
+
before do
|
160
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
161
|
+
@foo = define "foo" do
|
162
|
+
iml.test_dependencies << 'group:id:jar:1.0'
|
163
|
+
end
|
164
|
+
invoke_generate_task
|
165
|
+
end
|
166
|
+
|
167
|
+
it "generates one non-exported 'module-library' orderEntry in IML" do
|
168
|
+
root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library' and @exported]/library/CLASSES/root", 0)
|
169
|
+
root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library']/library/CLASSES/root", 1)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
describe "with sources artifact present" do
|
174
|
+
before do
|
175
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
176
|
+
artifact('group:id:jar:sources:1.0') { |t| write t.to_s }
|
177
|
+
@foo = define "foo" do
|
178
|
+
compile.with 'group:id:jar:1.0'
|
179
|
+
end
|
180
|
+
invoke_generate_task
|
181
|
+
end
|
182
|
+
|
183
|
+
it "generates 'module-library' orderEntry in IML with SOURCES specified" do
|
184
|
+
root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library' and @exported='']/library/SOURCES/root", 1)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
describe "with local_repository_env_override set to nil" do
|
189
|
+
before do
|
190
|
+
Buildr.repositories.instance_eval do
|
191
|
+
@local = @remote = @release_to = nil
|
192
|
+
end
|
193
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
194
|
+
@foo = define "foo" do
|
195
|
+
iml.local_repository_env_override = nil
|
196
|
+
compile.with 'group:id:jar:1.0'
|
197
|
+
end
|
198
|
+
invoke_generate_task
|
199
|
+
end
|
200
|
+
|
201
|
+
it "generates orderEntry with absolute path for classes jar" do
|
202
|
+
root_module_xml(@foo).should match_xpath("#{order_entry_xpath}/library/CLASSES/root/@url",
|
203
|
+
"jar://$MODULE_DIR$/home/.m2/repository/group/id/1.0/id-1.0.jar!/")
|
204
|
+
end
|
205
|
+
end
|
206
|
+
describe "with local_repository_env_override set to MAVEN_REPOSITORY" do
|
207
|
+
before do
|
208
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
209
|
+
@foo = define "foo" do
|
210
|
+
iml.local_repository_env_override = 'MAVEN_REPOSITORY'
|
211
|
+
compile.with 'group:id:jar:1.0'
|
212
|
+
end
|
213
|
+
invoke_generate_task
|
214
|
+
end
|
215
|
+
|
216
|
+
it "generates orderEntry with absolute path for classes jar" do
|
217
|
+
root_module_xml(@foo).should match_xpath("#{order_entry_xpath}/library/CLASSES/root/@url",
|
218
|
+
"jar://$MAVEN_REPOSITORY$/group/id/1.0/id-1.0.jar!/")
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
describe "with multiple dependencies" do
|
224
|
+
before do
|
225
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
226
|
+
artifact('group:id2:jar:1.0') { |t| write t.to_s }
|
227
|
+
@foo = define "foo" do
|
228
|
+
compile.with 'group:id:jar:1.0', 'group:id2:jar:1.0'
|
229
|
+
end
|
230
|
+
invoke_generate_task
|
231
|
+
end
|
232
|
+
|
233
|
+
it "generates multiple 'module-library' orderEntry in IML" do
|
234
|
+
root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library']", 2)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
describe "with a single non artifact dependency" do
|
239
|
+
before do
|
240
|
+
@foo = define "foo" do
|
241
|
+
filename = _("foo-dep.jar")
|
242
|
+
File.open(filename, "wb") { |t| write "Hello" }
|
243
|
+
compile.with filename
|
244
|
+
end
|
245
|
+
invoke_generate_task
|
246
|
+
end
|
247
|
+
|
248
|
+
it "generates one exported 'module-library' orderEntry in IML" do
|
249
|
+
root_module_xml(@foo).should match_xpath("#{order_entry_xpath}/library/CLASSES/root/@url",
|
250
|
+
"jar://$MODULE_DIR$/foo-dep.jar!/")
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
describe "with extra_modules specified" do
|
255
|
+
before do
|
256
|
+
@foo = define "foo" do
|
257
|
+
ipr.extra_modules << 'other.iml'
|
258
|
+
ipr.extra_modules << 'other_other.iml'
|
259
|
+
end
|
260
|
+
invoke_generate_task
|
261
|
+
end
|
262
|
+
|
263
|
+
it "generate an IPR with extra modules specified" do
|
264
|
+
doc = xml_document(@foo._("foo.ipr"))
|
265
|
+
doc.should have_nodes("#{xpath_to_module}", 3)
|
266
|
+
module_ref = "$PROJECT_DIR$/foo.iml"
|
267
|
+
doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}' and @filepath='#{module_ref}']")
|
268
|
+
module_ref = "$PROJECT_DIR$/other.iml"
|
269
|
+
doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}' and @filepath='#{module_ref}']")
|
270
|
+
module_ref = "$PROJECT_DIR$/other_other.iml"
|
271
|
+
doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}' and @filepath='#{module_ref}']")
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
describe "with web and webservice facet added to root project" do
|
276
|
+
before do
|
277
|
+
@foo = define "foo" do
|
278
|
+
iml.add_facet("Web", "web") do |facet|
|
279
|
+
facet.configuration do |conf|
|
280
|
+
conf.descriptors do |desc|
|
281
|
+
desc.deploymentDescriptor :name => 'web.xml',
|
282
|
+
:url => "file://$MODULE_DIR$/src/main/webapp/WEB-INF/web.xml",
|
283
|
+
:optional => "false", :version => "2.4"
|
284
|
+
end
|
285
|
+
conf.webroots do |webroots|
|
286
|
+
webroots.root :url => "file://$MODULE_DIR$/src/main/webapp", :relative => "/"
|
287
|
+
end
|
288
|
+
end
|
289
|
+
end
|
290
|
+
iml.add_facet("WebServices Client", "WebServicesClient") do |facet|
|
291
|
+
facet.configuration "ws.engine" => "Glassfish / JAX-WS 2.X RI / Metro 1.X / JWSDP 2.0"
|
292
|
+
end
|
293
|
+
define 'bar'
|
294
|
+
end
|
295
|
+
invoke_generate_task
|
296
|
+
end
|
297
|
+
|
298
|
+
it "generates an IML for root project with a web and webservice facet" do
|
299
|
+
doc = xml_document(@foo._("foo.iml"))
|
300
|
+
ensure_facet_xpath(doc, 'web', 'Web')
|
301
|
+
ensure_facet_xpath(doc, 'WebServicesClient', 'WebServices Client')
|
302
|
+
end
|
303
|
+
end
|
304
|
+
|
305
|
+
describe "using add_gwt_facet" do
|
306
|
+
before do
|
307
|
+
@foo = define "foo" do
|
308
|
+
iml.add_gwt_facet("com.biz.MyModule" => true, "com.biz.MyOtherModule" => false)
|
309
|
+
end
|
310
|
+
invoke_generate_task
|
311
|
+
end
|
312
|
+
|
313
|
+
it "generates a gwt facet with default settings" do
|
314
|
+
doc = xml_document(@foo._("foo.iml"))
|
315
|
+
facet_xpath = ensure_facet_xpath(doc, 'gwt', 'GWT')
|
316
|
+
setting_xpath = "#{facet_xpath}/configuration/setting"
|
317
|
+
doc.should have_xpath("#{setting_xpath}[@name='gwtSdkUrl', value='file://$GWT_TOOLS$']")
|
318
|
+
doc.should have_xpath("#{setting_xpath}[@name='gwtScriptOutputStyle', value='PRETTY']")
|
319
|
+
doc.should have_xpath("#{setting_xpath}[@name='compilerParameters', value='-draftCompile -localWorkers 2 -strict']")
|
320
|
+
doc.should have_xpath("#{setting_xpath}[@name='compilerParameters', value='-draftCompile -localWorkers 2 -strict']")
|
321
|
+
doc.should have_xpath("#{setting_xpath}[@name='compilerMaxHeapSize', value='512']")
|
322
|
+
doc.should have_xpath("#{setting_xpath}[@name='webFacet', value='Web']")
|
323
|
+
end
|
324
|
+
|
325
|
+
it "generates a gwt facet with specified modules" do
|
326
|
+
doc = xml_document(@foo._("foo.iml"))
|
327
|
+
facet_xpath = ensure_facet_xpath(doc, 'gwt', 'GWT')
|
328
|
+
prefix = "#{facet_xpath}/configuration/packaging/module"
|
329
|
+
doc.should have_xpath("#{prefix}[@name='com.biz.MyModule' and @enabled='true']")
|
330
|
+
doc.should have_xpath("#{prefix}[@name='com.biz.MyOtherModule' and @enabled='false']")
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
describe "using add_gwt_facet that detects gwt sdk" do
|
335
|
+
before do
|
336
|
+
artifact('com.google.gwt:gwt-dev:jar:2.5.1-not-a-release') { |task| write task.name }
|
337
|
+
@foo = define "foo" do
|
338
|
+
compile.with 'com.google.gwt:gwt-dev:jar:2.5.1-not-a-release'
|
339
|
+
iml.add_gwt_facet("com.biz.MyModule" => true)
|
340
|
+
end
|
341
|
+
invoke_generate_task
|
342
|
+
end
|
343
|
+
|
344
|
+
it "generates a gwt facet with detected gwt sdk settings" do
|
345
|
+
doc = xml_document(@foo._("foo.iml"))
|
346
|
+
facet_xpath = ensure_facet_xpath(doc, 'gwt', 'GWT')
|
347
|
+
setting_xpath = "#{facet_xpath}/configuration/setting"
|
348
|
+
doc.should have_xpath("#{setting_xpath}[@name='gwtSdkType', value='maven']")
|
349
|
+
doc.should have_xpath("#{setting_xpath}[@name='gwtSdkUrl', value='$MAVEN_REPOSITORY$/com/google/gwt/gwt-dev/2.5.1-not-a-release']")
|
350
|
+
end
|
351
|
+
end
|
352
|
+
|
353
|
+
describe "using add_gwt_facet that specifies gwt sdk" do
|
354
|
+
before do
|
355
|
+
artifact('com.example:library:jar:2.0') { |task| write task.name }
|
356
|
+
@foo = define "foo" do
|
357
|
+
iml.add_gwt_facet({"com.biz.MyModule" => true},:gwt_dev_artifact => 'com.example:library:jar:2.0')
|
358
|
+
end
|
359
|
+
invoke_generate_task
|
360
|
+
end
|
361
|
+
|
362
|
+
it "generates a gwt facet with detected gwt sdk settings" do
|
363
|
+
doc = xml_document(@foo._("foo.iml"))
|
364
|
+
facet_xpath = ensure_facet_xpath(doc, 'gwt', 'GWT')
|
365
|
+
setting_xpath = "#{facet_xpath}/configuration/setting"
|
366
|
+
doc.should have_xpath("#{setting_xpath}[@name='gwtSdkType', value='maven']")
|
367
|
+
doc.should have_xpath("#{setting_xpath}[@name='gwtSdkUrl', value='$MAVEN_REPOSITORY$/com/google/gwt/gwt-dev/2.5.1']")
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
describe "using add_gwt_facet that specifies settings" do
|
372
|
+
before do
|
373
|
+
@foo = define "foo" do
|
374
|
+
iml.add_gwt_facet({"com.biz.MyModule" => true, "com.biz.MyOtherModule" => false},
|
375
|
+
:settings => {:gwtScriptOutputStyle => 'OTHER', :compilerMaxHeapSize => 1024, :zang => 'zang'})
|
376
|
+
end
|
377
|
+
invoke_generate_task
|
378
|
+
end
|
379
|
+
|
380
|
+
it "generates a gwt facet with specified settings" do
|
381
|
+
doc = xml_document(@foo._("foo.iml"))
|
382
|
+
facet_xpath = ensure_facet_xpath(doc, 'gwt', 'GWT')
|
383
|
+
setting_xpath = "#{facet_xpath}/configuration/setting"
|
384
|
+
doc.should have_xpath("#{setting_xpath}[@name='zang', value='zang']")
|
385
|
+
doc.should have_xpath("#{setting_xpath}[@name='gwtScriptOutputStyle', value='OTHER']")
|
386
|
+
doc.should have_xpath("#{setting_xpath}[@name='compilerMaxHeapSize', value='1024']")
|
387
|
+
end
|
388
|
+
end
|
389
|
+
|
390
|
+
describe "using add_web_facet with jsf and idea version 12" do
|
391
|
+
before do
|
392
|
+
write "src/main/webapp/WEB-INF/web.xml"
|
393
|
+
write "src/main/webapp/WEB-INF/faces-config.xml"
|
394
|
+
|
395
|
+
@foo = define "foo" do
|
396
|
+
ipr.version = "12"
|
397
|
+
iml.add_web_facet
|
398
|
+
end
|
399
|
+
invoke_generate_task
|
400
|
+
end
|
401
|
+
|
402
|
+
it "generates a web facet with jsf facet auto-detected" do
|
403
|
+
doc = xml_document(@foo._("foo.iml"))
|
404
|
+
web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
|
405
|
+
doc.should have_xpath("#{web_facet_xpath}/facet[@type='jsf' and @name='JSF']")
|
406
|
+
end
|
407
|
+
end
|
408
|
+
|
409
|
+
describe "using add_web_facet should default to no jsf" do
|
410
|
+
before do
|
411
|
+
write "src/main/webapp/WEB-INF/web.xml"
|
412
|
+
|
413
|
+
@foo = define "foo" do
|
414
|
+
iml.add_web_facet
|
415
|
+
end
|
416
|
+
invoke_generate_task
|
417
|
+
end
|
418
|
+
|
419
|
+
it "does not generate a web facet with jsf facet" do
|
420
|
+
doc = xml_document(@foo._("foo.iml"))
|
421
|
+
web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
|
422
|
+
doc.should_not have_xpath("#{web_facet_xpath}/facet[@type='jsf' and @name='JSF']")
|
423
|
+
end
|
424
|
+
end
|
425
|
+
|
426
|
+
describe "using add_web_facet with jsf and idea version 13" do
|
427
|
+
before do
|
428
|
+
write "src/main/webapp/WEB-INF/web.xml"
|
429
|
+
write "src/main/webapp/WEB-INF/faces-config.xml"
|
430
|
+
|
431
|
+
@foo = define "foo" do
|
432
|
+
ipr.version = "13"
|
433
|
+
iml.add_web_facet
|
434
|
+
end
|
435
|
+
invoke_generate_task
|
436
|
+
end
|
437
|
+
|
438
|
+
it "does not generate a web facet with jsf facet" do
|
439
|
+
doc = xml_document(@foo._("foo.iml"))
|
440
|
+
web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
|
441
|
+
doc.should_not have_xpath("#{web_facet_xpath}/facet[@type='jsf' and @name='JSF']")
|
442
|
+
end
|
443
|
+
end
|
444
|
+
|
445
|
+
describe "using add_web_facet with jsf and idea version 13 and jsf 'enabled'" do
|
446
|
+
before do
|
447
|
+
write "src/main/webapp/WEB-INF/web.xml"
|
448
|
+
write "src/main/webapp/WEB-INF/faces-config.xml"
|
449
|
+
|
450
|
+
@foo = define "foo" do
|
451
|
+
ipr.version = "13"
|
452
|
+
iml.add_web_facet(:enable_jsf => true)
|
453
|
+
end
|
454
|
+
invoke_generate_task
|
455
|
+
end
|
456
|
+
|
457
|
+
it "does not generate a web facet with jsf facet" do
|
458
|
+
doc = xml_document(@foo._("foo.iml"))
|
459
|
+
web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
|
460
|
+
doc.should_not have_xpath("#{web_facet_xpath}/facet[@type='jsf' and @name='JSF']")
|
461
|
+
end
|
462
|
+
end
|
463
|
+
|
464
|
+
describe "using add_web_facet" do
|
465
|
+
before do
|
466
|
+
write "src/main/webapp/WEB-INF/web.xml"
|
467
|
+
write "src/main/webapp/WEB-INF/glassfish-web.xml"
|
468
|
+
write "src/main/webapp/WEB-INF/context.xml"
|
469
|
+
|
470
|
+
@foo = define "foo" do
|
471
|
+
iml.add_web_facet
|
472
|
+
end
|
473
|
+
invoke_generate_task
|
474
|
+
end
|
475
|
+
|
476
|
+
it "generates a web facet with appropriate deployment descriptors" do
|
477
|
+
doc = xml_document(@foo._("foo.iml"))
|
478
|
+
web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
|
479
|
+
deployment_descriptor_xpath = "#{web_facet_xpath}/configuration/descriptors/deploymentDescriptor"
|
480
|
+
doc.should have_xpath("#{deployment_descriptor_xpath}[@name='web.xml', url='file://$MODULE_DIR$/src/main/webapp/WEB-INF/web.xml']")
|
481
|
+
doc.should have_xpath("#{deployment_descriptor_xpath}[@name='glassfish-web.xml', url='file://$MODULE_DIR$/src/main/webapp/WEB-INF/glassfish-web.xml']")
|
482
|
+
end
|
483
|
+
|
484
|
+
it "generates a web facet with derived webroots" do
|
485
|
+
doc = xml_document(@foo._("foo.iml"))
|
486
|
+
web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
|
487
|
+
doc.should have_xpath("#{web_facet_xpath}/configuration/webroots/root[@url='file://$MODULE_DIR$/src/main/webapp' and @relative='/']")
|
488
|
+
end
|
489
|
+
end
|
490
|
+
|
491
|
+
describe "using add_web_facet with specified parameters" do
|
492
|
+
before do
|
493
|
+
@foo = define "foo" do
|
494
|
+
iml.add_web_facet(:deployment_descriptors => ["src/main/webapp2/WEB-INF/web.xml"],
|
495
|
+
:webroots => {"src/main/webapp2" => "/", "src/main/css" => "/css"})
|
496
|
+
end
|
497
|
+
invoke_generate_task
|
498
|
+
end
|
499
|
+
|
500
|
+
it "generates a web facet with appropriate deployment descriptors" do
|
501
|
+
doc = xml_document(@foo._("foo.iml"))
|
502
|
+
web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
|
503
|
+
deployment_descriptor_xpath = "#{web_facet_xpath}/configuration/descriptors/deploymentDescriptor"
|
504
|
+
doc.should have_xpath("#{deployment_descriptor_xpath}[@name='web.xml', url='file://$MODULE_DIR$/src/main/webapp2/WEB-INF/web.xml']")
|
505
|
+
end
|
506
|
+
|
507
|
+
it "generates a web facet with specified webroots" do
|
508
|
+
doc = xml_document(@foo._("foo.iml"))
|
509
|
+
web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
|
510
|
+
doc.should have_xpath("#{web_facet_xpath}/configuration/webroots/root[@url='file://$MODULE_DIR$/src/main/webapp2' and @relative='/']")
|
511
|
+
doc.should have_xpath("#{web_facet_xpath}/configuration/webroots/root[@url='file://$MODULE_DIR$/src/main/css' and @relative='/css']")
|
512
|
+
end
|
513
|
+
end
|
514
|
+
|
515
|
+
describe "using add_jpa_facet" do
|
516
|
+
before do
|
517
|
+
write "src/main/resources/META-INF/persistence.xml", "org.hibernate.ejb.HibernatePersistence"
|
518
|
+
write "src/main/resources/META-INF/orm.xml"
|
519
|
+
|
520
|
+
@foo = define "foo" do
|
521
|
+
iml.add_jpa_facet
|
522
|
+
end
|
523
|
+
invoke_generate_task
|
524
|
+
end
|
525
|
+
|
526
|
+
it "generates a jpa facet with appropriate deployment descriptors" do
|
527
|
+
doc = xml_document(@foo._("foo.iml"))
|
528
|
+
facet_xpath = ensure_facet_xpath(doc, 'jpa', 'JPA')
|
529
|
+
deployment_descriptor_xpath = "#{facet_xpath}/configuration/deploymentDescriptor"
|
530
|
+
doc.should have_xpath("#{deployment_descriptor_xpath}[@name='persistence.xml', url='file://$MODULE_DIR$/src/main/resources/META-INF/persistence.xml']")
|
531
|
+
doc.should have_xpath("#{deployment_descriptor_xpath}[@name='orm.xml', url='file://$MODULE_DIR$/src/main/resources/META-INF/orm.xml']")
|
532
|
+
end
|
533
|
+
|
534
|
+
it "generates a jpa facet with default settings" do
|
535
|
+
doc = xml_document(@foo._("foo.iml"))
|
536
|
+
facet_xpath = ensure_facet_xpath(doc, 'jpa', 'JPA')
|
537
|
+
doc.should have_xpath("#{facet_xpath}/configuration/setting[@name='validation-enabled' and @value='true']")
|
538
|
+
doc.should have_xpath("#{facet_xpath}/configuration/setting[@name='provider-name' and @value='Hibernate']")
|
539
|
+
end
|
540
|
+
end
|
541
|
+
|
542
|
+
describe "using add_jpa_facet specifying parameters" do
|
543
|
+
before do
|
544
|
+
write "src/main/resources2/META-INF/persistence.xml"
|
545
|
+
write "src/main/resources2/META-INF/orm.xml"
|
546
|
+
|
547
|
+
@foo = define "foo" do
|
548
|
+
iml.add_jpa_facet(:provider_enabled => 'Hibernate',
|
549
|
+
:deployment_descriptors => ["src/main/resources2/META-INF/persistence.xml",
|
550
|
+
"src/main/resources2/META-INF/orm.xml"])
|
551
|
+
end
|
552
|
+
invoke_generate_task
|
553
|
+
end
|
554
|
+
|
555
|
+
it "generates a jpa facet with appropriate deployment descriptors" do
|
556
|
+
doc = xml_document(@foo._("foo.iml"))
|
557
|
+
facet_xpath = ensure_facet_xpath(doc, 'jpa', 'JPA')
|
558
|
+
deployment_descriptor_xpath = "#{facet_xpath}/configuration/deploymentDescriptor"
|
559
|
+
doc.should have_xpath("#{deployment_descriptor_xpath}[@name='persistence.xml', url='file://$MODULE_DIR$/src/main/resources2/META-INF/persistence.xml']")
|
560
|
+
doc.should have_xpath("#{deployment_descriptor_xpath}[@name='orm.xml', url='file://$MODULE_DIR$/src/main/resources2/META-INF/orm.xml']")
|
561
|
+
end
|
562
|
+
|
563
|
+
it "generates a jpa facet with default settings" do
|
564
|
+
doc = xml_document(@foo._("foo.iml"))
|
565
|
+
facet_xpath = ensure_facet_xpath(doc, 'jpa', 'JPA')
|
566
|
+
doc.should have_xpath("#{facet_xpath}/configuration/setting[@name='validation-enabled' and @value='true']")
|
567
|
+
doc.should have_xpath("#{facet_xpath}/configuration/setting[@name='provider-name' and @value='Hibernate']")
|
568
|
+
end
|
569
|
+
end
|
570
|
+
|
571
|
+
describe "using add_jpa_facet derived from main_source_directories" do
|
572
|
+
before do
|
573
|
+
write "src/main/resources2/META-INF/persistence.xml"
|
574
|
+
write "src/main/resources2/META-INF/orm.xml"
|
575
|
+
|
576
|
+
@foo = define "foo" do
|
577
|
+
iml.main_source_directories << "src/main/resources2"
|
578
|
+
iml.add_jpa_facet
|
579
|
+
|
580
|
+
end
|
581
|
+
invoke_generate_task
|
582
|
+
end
|
583
|
+
|
584
|
+
it "generates a jpa facet with appropriate deployment descriptors" do
|
585
|
+
doc = xml_document(@foo._("foo.iml"))
|
586
|
+
facet_xpath = ensure_facet_xpath(doc, 'jpa', 'JPA')
|
587
|
+
deployment_descriptor_xpath = "#{facet_xpath}/configuration/deploymentDescriptor"
|
588
|
+
doc.should have_xpath("#{deployment_descriptor_xpath}[@name='persistence.xml', url='file://$MODULE_DIR$/src/main/resources2/META-INF/persistence.xml']")
|
589
|
+
doc.should have_xpath("#{deployment_descriptor_xpath}[@name='orm.xml', url='file://$MODULE_DIR$/src/main/resources2/META-INF/orm.xml']")
|
590
|
+
end
|
591
|
+
end
|
592
|
+
|
593
|
+
describe "using add_jpa_facet with hibernate configured in persistence.xml" do
|
594
|
+
before do
|
595
|
+
write "src/main/resources/META-INF/persistence.xml", "org.hibernate.ejb.HibernatePersistence"
|
596
|
+
write "src/main/resources/META-INF/orm.xml"
|
597
|
+
|
598
|
+
@foo = define "foo" do
|
599
|
+
iml.add_jpa_facet
|
600
|
+
end
|
601
|
+
invoke_generate_task
|
602
|
+
end
|
603
|
+
|
604
|
+
it "generates a jpa facet with default settings" do
|
605
|
+
doc = xml_document(@foo._("foo.iml"))
|
606
|
+
facet_xpath = ensure_facet_xpath(doc, 'jpa', 'JPA')
|
607
|
+
doc.should have_xpath("#{facet_xpath}/configuration/setting[@name='validation-enabled' and @value='true']")
|
608
|
+
doc.should have_xpath("#{facet_xpath}/configuration/setting[@name='provider-name' and @value='Hibernate']")
|
609
|
+
end
|
610
|
+
end
|
611
|
+
|
612
|
+
describe "using add_jpa_facet with eclipselink configured in persistence.xml" do
|
613
|
+
before do
|
614
|
+
write "src/main/resources/META-INF/persistence.xml", "org.eclipse.persistence.jpa.PersistenceProvider"
|
615
|
+
write "src/main/resources/META-INF/orm.xml"
|
616
|
+
|
617
|
+
@foo = define "foo" do
|
618
|
+
iml.add_jpa_facet
|
619
|
+
end
|
620
|
+
invoke_generate_task
|
621
|
+
end
|
622
|
+
|
623
|
+
it "generates a jpa facet with default settings" do
|
624
|
+
doc = xml_document(@foo._("foo.iml"))
|
625
|
+
facet_xpath = ensure_facet_xpath(doc, 'jpa', 'JPA')
|
626
|
+
doc.should have_xpath("#{facet_xpath}/configuration/setting[@name='validation-enabled' and @value='true']")
|
627
|
+
doc.should have_xpath("#{facet_xpath}/configuration/setting[@name='provider-name' and @value='EclipseLink']")
|
628
|
+
end
|
629
|
+
end
|
630
|
+
|
631
|
+
describe "using add_ejb_facet" do
|
632
|
+
before do
|
633
|
+
write "src/main/java/com/bin/foo.java"
|
634
|
+
write "src/main/resources/WEB-INF/ejb-jar.xml"
|
635
|
+
|
636
|
+
@foo = define "foo" do
|
637
|
+
iml.add_ejb_facet
|
638
|
+
end
|
639
|
+
invoke_generate_task
|
640
|
+
end
|
641
|
+
|
642
|
+
it "generates an ejb facet with appropriate deployment descriptors" do
|
643
|
+
doc = xml_document(@foo._("foo.iml"))
|
644
|
+
ejb_facet_xpath = ensure_facet_xpath(doc, 'ejb', 'EJB')
|
645
|
+
deployment_descriptor_xpath = "#{ejb_facet_xpath}/configuration/descriptors/deploymentDescriptor"
|
646
|
+
doc.should have_xpath("#{deployment_descriptor_xpath}[@name='ejb-jar.xml', url='file://$MODULE_DIR$/src/main/resources/WEB-INF/ejb-jar.xml']")
|
647
|
+
end
|
648
|
+
|
649
|
+
it "generates an ejb facet with derived ejbRoots" do
|
650
|
+
doc = xml_document(@foo._("foo.iml"))
|
651
|
+
ejb_facet_xpath = ensure_facet_xpath(doc, 'ejb', 'EJB')
|
652
|
+
doc.should have_xpath("#{ejb_facet_xpath}/configuration/ejbRoots/root[@url='file://$MODULE_DIR$/src/main/java']")
|
653
|
+
doc.should have_xpath("#{ejb_facet_xpath}/configuration/ejbRoots/root[@url='file://$MODULE_DIR$/src/main/resources']")
|
654
|
+
end
|
655
|
+
end
|
656
|
+
|
657
|
+
describe "using add_ejb_facet specifying parameters" do
|
658
|
+
before do
|
659
|
+
@foo = define "foo" do
|
660
|
+
iml.add_ejb_facet(:ejb_roots => ["generated/main/java","generated/main/resources"],
|
661
|
+
:deployment_descriptors => ["generated/main/resources/WEB-INF/ejb-jar.xml"])
|
662
|
+
end
|
663
|
+
invoke_generate_task
|
664
|
+
end
|
665
|
+
|
666
|
+
it "generates an ejb facet with appropriate deployment descriptors" do
|
667
|
+
doc = xml_document(@foo._("foo.iml"))
|
668
|
+
ejb_facet_xpath = ensure_facet_xpath(doc, 'ejb', 'EJB')
|
669
|
+
deployment_descriptor_xpath = "#{ejb_facet_xpath}/configuration/descriptors/deploymentDescriptor"
|
670
|
+
doc.should have_xpath("#{deployment_descriptor_xpath}[@name='ejb-jar.xml', url='file://$MODULE_DIR$/generated/main/resources/WEB-INF/ejb-jar.xml']")
|
671
|
+
end
|
672
|
+
|
673
|
+
it "generates an ejb facet with derived ejbRoots" do
|
674
|
+
doc = xml_document(@foo._("foo.iml"))
|
675
|
+
ejb_facet_xpath = ensure_facet_xpath(doc, 'ejb', 'EJB')
|
676
|
+
doc.should have_xpath("#{ejb_facet_xpath}/configuration/ejbRoots/root[@url='file://$MODULE_DIR$/generated/main/java']")
|
677
|
+
doc.should have_xpath("#{ejb_facet_xpath}/configuration/ejbRoots/root[@url='file://$MODULE_DIR$/generated/main/resources']")
|
678
|
+
end
|
679
|
+
end
|
680
|
+
|
681
|
+
describe "using add_ejb_facet derived from main_source_directories" do
|
682
|
+
before do
|
683
|
+
write "src/main/resources2/WEB-INF/ejb-jar.xml"
|
684
|
+
@foo = define "foo" do
|
685
|
+
iml.main_source_directories << "src/main/resources2"
|
686
|
+
iml.add_ejb_facet
|
687
|
+
end
|
688
|
+
invoke_generate_task
|
689
|
+
end
|
690
|
+
|
691
|
+
it "generates an ejb facet with appropriate deployment descriptors" do
|
692
|
+
doc = xml_document(@foo._("foo.iml"))
|
693
|
+
ejb_facet_xpath = ensure_facet_xpath(doc, 'ejb', 'EJB')
|
694
|
+
deployment_descriptor_xpath = "#{ejb_facet_xpath}/configuration/descriptors/deploymentDescriptor"
|
695
|
+
doc.should have_xpath("#{deployment_descriptor_xpath}[@name='ejb-jar.xml', url='file://$MODULE_DIR$/src/main/resources2/WEB-INF/ejb-jar.xml']")
|
696
|
+
end
|
697
|
+
end
|
698
|
+
|
699
|
+
describe "using add_jruby_facet" do
|
700
|
+
before do
|
701
|
+
|
702
|
+
@foo = define "foo" do
|
703
|
+
iml.add_jruby_facet
|
704
|
+
end
|
705
|
+
invoke_generate_task
|
706
|
+
end
|
707
|
+
|
708
|
+
it "generates a jruby facet with appropriate sdk" do
|
709
|
+
doc = xml_document(@foo._("foo.iml"))
|
710
|
+
jruby_facet_xpath = ensure_facet_xpath(doc, 'JRUBY', 'JRuby')
|
711
|
+
doc.should have_xpath("#{jruby_facet_xpath}/configuration/JRUBY_FACET_CONFIG_ID[@NAME='JRUBY_SDK_NAME', VALUE='jruby-1.6.7.2']")
|
712
|
+
end
|
713
|
+
|
714
|
+
it "generates a jruby facet with appropriate paths" do
|
715
|
+
doc = xml_document(@foo._("foo.iml"))
|
716
|
+
jruby_facet_xpath = ensure_facet_xpath(doc, 'JRUBY', 'JRuby')
|
717
|
+
prefix = "#{jruby_facet_xpath}/configuration"
|
718
|
+
doc.should have_xpath("#{prefix}/LOAD_PATH[@number='0']")
|
719
|
+
doc.should have_xpath("#{prefix}/I18N_FOLDERS[@number='0']")
|
720
|
+
end
|
721
|
+
end
|
722
|
+
|
723
|
+
describe "using add_jruby_facet with .ruby-version specified" do
|
724
|
+
before do
|
725
|
+
|
726
|
+
write ".ruby-version", "jruby-1.7.2"
|
727
|
+
|
728
|
+
@foo = define "foo" do
|
729
|
+
iml.add_jruby_facet
|
730
|
+
end
|
731
|
+
invoke_generate_task
|
732
|
+
end
|
733
|
+
|
734
|
+
it "generates a jruby facet with appropriate sdk" do
|
735
|
+
doc = xml_document(@foo._("foo.iml"))
|
736
|
+
jruby_facet_xpath = ensure_facet_xpath(doc, 'JRUBY', 'JRuby')
|
737
|
+
doc.should have_xpath("#{jruby_facet_xpath}/configuration/JRUBY_FACET_CONFIG_ID[@NAME='JRUBY_SDK_NAME', VALUE='rbenv: jruby-1.7.2']")
|
738
|
+
end
|
739
|
+
|
740
|
+
it "generates a jruby facet with appropriate paths" do
|
741
|
+
doc = xml_document(@foo._("foo.iml"))
|
742
|
+
jruby_facet_xpath = ensure_facet_xpath(doc, 'JRUBY', 'JRuby')
|
743
|
+
prefix = "#{jruby_facet_xpath}/configuration"
|
744
|
+
doc.should have_xpath("#{prefix}/LOAD_PATH[@number='0']")
|
745
|
+
doc.should have_xpath("#{prefix}/I18N_FOLDERS[@number='0']")
|
746
|
+
end
|
747
|
+
end
|
748
|
+
|
749
|
+
describe "with add_data_source" do
|
750
|
+
before do
|
751
|
+
artifact("org.postgresql:postgresql:jar:9.not-a-version") { |task| write task.name }
|
752
|
+
@foo = define "foo" do
|
753
|
+
ipr.add_data_source("Postgres",
|
754
|
+
:driver => 'org.postgresql.Driver',
|
755
|
+
:url => "jdbc:postgresql://127.0.0.1:5432/MyDb",
|
756
|
+
:username => "MyDBUser",
|
757
|
+
:password => "secreto",
|
758
|
+
:dialect => "PostgreSQL",
|
759
|
+
:classpath => ["org.postgresql:postgresql:jar:9.not-a-version"])
|
760
|
+
end
|
761
|
+
invoke_generate_task
|
762
|
+
end
|
763
|
+
|
764
|
+
it "generates a data source manager with specified data source" do
|
765
|
+
doc = xml_document(@foo._("foo.ipr"))
|
766
|
+
prefix_xpath = "/project/component[@name='DataSourceManagerImpl' and @format='xml' and @hash='3208837817']/data-source"
|
767
|
+
doc.should have_nodes(prefix_xpath, 1)
|
768
|
+
ds_path = "#{prefix_xpath}[@source='LOCAL' and @name='Postgres']"
|
769
|
+
doc.should have_xpath(ds_path)
|
770
|
+
doc.should have_xpath("#{ds_path}/synchronize/text() = 'true'")
|
771
|
+
doc.should have_xpath("#{ds_path}/jdbc-driver/text() = 'org.postgresql.Driver'")
|
772
|
+
doc.should have_xpath("#{ds_path}/jdbc-url/text() = 'jdbc:postgresql://127.0.0.1:5432/MyDb'")
|
773
|
+
doc.should have_xpath("#{ds_path}/user-name/text() = 'MyDBUser'")
|
774
|
+
doc.should have_xpath("#{ds_path}/user-password/text() = 'dfd9dfcfdfc9dfd8dfcfdfdedfc5'")
|
775
|
+
doc.should have_xpath("#{ds_path}/default-dialect/text() = 'PostgreSQL'")
|
776
|
+
doc.should have_xpath("#{ds_path}/libraries/library/url/text() = '$MAVEN_REPOSITORY$/org/postgresql/postgresql/9.not-a-version/postgresql-9.not-a-version.jar'")
|
777
|
+
end
|
778
|
+
end
|
779
|
+
|
780
|
+
describe "with add_postgres_data_source" do
|
781
|
+
before do
|
782
|
+
ENV["USER"] = "Bob"
|
783
|
+
artifact("org.postgresql:postgresql:jar:9.2-1003-jdbc4") { |task| write task.name }
|
784
|
+
@foo = define "foo" do
|
785
|
+
ipr.add_postgres_data_source("Postgres", :database => 'MyDb')
|
786
|
+
end
|
787
|
+
invoke_generate_task
|
788
|
+
end
|
789
|
+
|
790
|
+
it "generates a data source manager with specified data source" do
|
791
|
+
doc = xml_document(@foo._("foo.ipr"))
|
792
|
+
prefix_xpath = "/project/component[@name='DataSourceManagerImpl' and @format='xml' and @hash='3208837817']/data-source"
|
793
|
+
doc.should have_nodes(prefix_xpath, 1)
|
794
|
+
ds_path = "#{prefix_xpath}[@source='LOCAL' and @name='Postgres']"
|
795
|
+
doc.should have_xpath(ds_path)
|
796
|
+
doc.should have_xpath("#{ds_path}/synchronize/text() = 'true'")
|
797
|
+
doc.should have_xpath("#{ds_path}/jdbc-driver/text() = 'org.postgresql.Driver'")
|
798
|
+
doc.should have_xpath("#{ds_path}/jdbc-url/text() = 'jdbc:postgresql://127.0.0.1:5432/MyDb'")
|
799
|
+
doc.should have_xpath("#{ds_path}/user-name/text() = 'Bob'")
|
800
|
+
doc.should have_xpath("#{ds_path}/default-dialect/text() = 'PostgreSQL'")
|
801
|
+
doc.should have_xpath("#{ds_path}/libraries/library/url/text() = '$MAVEN_REPOSITORY$/org/postgresql/postgresql/9.2-1003-jdbc4/postgresql-9.2-1003-jdbc4.jar'")
|
802
|
+
end
|
803
|
+
end
|
804
|
+
|
805
|
+
describe "with add_sql_server_data_source" do
|
806
|
+
before do
|
807
|
+
ENV["USER"] = "Bob"
|
808
|
+
artifact('net.sourceforge.jtds:jtds:jar:1.2.7') { |task| write task.name }
|
809
|
+
@foo = define "foo" do
|
810
|
+
ipr.add_sql_server_data_source("SqlServer", :database => 'MyDb')
|
811
|
+
end
|
812
|
+
invoke_generate_task
|
813
|
+
end
|
814
|
+
|
815
|
+
it "generates a data source manager with specified data source" do
|
816
|
+
doc = xml_document(@foo._("foo.ipr"))
|
817
|
+
prefix_xpath = "/project/component[@name='DataSourceManagerImpl' and @format='xml' and @hash='3208837817']/data-source"
|
818
|
+
doc.should have_nodes(prefix_xpath, 1)
|
819
|
+
ds_path = "#{prefix_xpath}[@source='LOCAL' and @name='SqlServer']"
|
820
|
+
doc.should have_xpath(ds_path)
|
821
|
+
|
822
|
+
doc.should have_xpath("#{ds_path}/synchronize/text() = 'true'")
|
823
|
+
doc.should have_xpath("#{ds_path}/jdbc-driver/text() = 'net.sourceforge.jtds.jdbc.Driver'")
|
824
|
+
doc.should have_xpath("#{ds_path}/jdbc-url/text() = 'jdbc:jtds:sqlserver://127.0.0.1:1433/MyDb'")
|
825
|
+
doc.should have_xpath("#{ds_path}/user-name/text() = 'Bob'")
|
826
|
+
doc.should have_xpath("#{ds_path}/default-dialect/text() = 'TSQL'")
|
827
|
+
doc.should have_xpath("#{ds_path}/libraries/library/url/text() = '$MAVEN_REPOSITORY$/net/sourceforge/jtds/1.2.7/jtds-1.2.7.jar'")
|
828
|
+
end
|
829
|
+
end
|
830
|
+
|
831
|
+
describe "with artifacts added to root project" do
|
832
|
+
before do
|
833
|
+
@foo = define "foo" do
|
834
|
+
ipr.add_artifact("MyFancy.jar", "jar") do |xml|
|
835
|
+
xml.tag!('output-path', project._(:artifacts, "MyFancy.jar"))
|
836
|
+
xml.element :id => "module-output", :name => "foo"
|
837
|
+
end
|
838
|
+
ipr.add_artifact("MyOtherFancy.jar", "jar") do |xml|
|
839
|
+
xml.tag!('output-path', project._(:artifacts, "MyOtherFancy.jar"))
|
840
|
+
xml.element :id => "module-output", :name => "foo"
|
841
|
+
end
|
842
|
+
end
|
843
|
+
invoke_generate_task
|
844
|
+
end
|
845
|
+
|
846
|
+
it "generates an IPR with multiple jar artifacts" do
|
847
|
+
doc = xml_document(@foo._("foo.ipr"))
|
848
|
+
facet_xpath = "/project/component[@name='ArtifactManager']/artifact"
|
849
|
+
doc.should have_nodes(facet_xpath, 2)
|
850
|
+
doc.should have_xpath("#{facet_xpath}[@type='jar' and @name='MyFancy.jar']")
|
851
|
+
doc.should have_xpath("#{facet_xpath}[@type='jar' and @name='MyOtherFancy.jar']")
|
852
|
+
end
|
853
|
+
end
|
854
|
+
|
855
|
+
describe "that uses add_jar_artifact with no overrides" do
|
856
|
+
before do
|
857
|
+
write 'foo/bar/src/main/java/foo/Foo.java' # needed so that buildr will treat as a java project
|
858
|
+
artifact('net.sourceforge.jtds:jtds:jar:1.2.7.XX') { |task| write task.name }
|
859
|
+
|
860
|
+
@foo = define "foo" do
|
861
|
+
project.version = '1.0'
|
862
|
+
define "bar" do
|
863
|
+
compile.with 'net.sourceforge.jtds:jtds:jar:1.2.7.XX'
|
864
|
+
package :war
|
865
|
+
end
|
866
|
+
ipr.add_jar_artifact(project("bar"))
|
867
|
+
end
|
868
|
+
invoke_generate_task
|
869
|
+
end
|
870
|
+
|
871
|
+
it "generates an IPR with a jar artifact" do
|
872
|
+
doc = xml_document(@foo._("foo.ipr"))
|
873
|
+
base_xpath = "/project/component[@name='ArtifactManager']/artifact"
|
874
|
+
facet_xpath = "#{base_xpath}[@type='jar' and @name='bar.jar' and @build-on-make='false']"
|
875
|
+
doc.should have_xpath(facet_xpath)
|
876
|
+
|
877
|
+
doc.should have_xpath("#{facet_xpath}/output-path/text() = $PROJECT_DIR$/artifacts/bar")
|
878
|
+
doc.should have_xpath("#{facet_xpath}/root[@id='archive' and @name='bar.jar']/element[@id='module-output' and @name='bar']")
|
879
|
+
end
|
880
|
+
end
|
881
|
+
|
882
|
+
describe "that uses add_jar_artifact with overrides" do
|
883
|
+
before do
|
884
|
+
write 'foo/bar/src/main/java/foo/Foo.java' # needed so that buildr will treat as a java project
|
885
|
+
artifact('net.sourceforge.jtds:jtds:jar:1.2.7.XX') { |task| write task.name }
|
886
|
+
|
887
|
+
@foo = define "foo" do
|
888
|
+
project.version = '1.0'
|
889
|
+
define "bar" do
|
890
|
+
compile.with 'net.sourceforge.jtds:jtds:jar:1.2.7.XX'
|
891
|
+
package :war
|
892
|
+
end
|
893
|
+
ipr.add_jar_artifact(project,
|
894
|
+
:name => 'bar',
|
895
|
+
:output_dir => _('bink'),
|
896
|
+
:build_on_make => true,
|
897
|
+
:ejb_module_names => ['x'],
|
898
|
+
:jpa_module_names => ['p'],
|
899
|
+
:dependencies => [project('bar')])
|
900
|
+
end
|
901
|
+
invoke_generate_task
|
902
|
+
end
|
903
|
+
|
904
|
+
it "generates an IPR with a jar artifact" do
|
905
|
+
doc = xml_document(@foo._("foo.ipr"))
|
906
|
+
base_xpath = "/project/component[@name='ArtifactManager']/artifact"
|
907
|
+
facet_xpath = "#{base_xpath}[@type='jar' and @name='bar.jar' and @build-on-make='true']"
|
908
|
+
doc.should have_xpath(facet_xpath)
|
909
|
+
|
910
|
+
doc.should have_xpath("#{facet_xpath}/output-path/text() = $PROJECT_DIR$/bink")
|
911
|
+
doc.should have_xpath("#{facet_xpath}/root[@id='archive' and @name='bar.jar']/element[@id='module-output' and @name='bar']")
|
912
|
+
doc.should have_xpath("#{facet_xpath}/root[@id='archive' and @name='bar.jar']/element[@id='jpa-descriptors' and @facet='p/jpa/JPA']")
|
913
|
+
doc.should have_xpath("#{facet_xpath}/root[@id='archive' and @name='bar.jar']/element[@id='javaee-facet-resources' and @facet='x/ejb/EJB']")
|
914
|
+
end
|
915
|
+
end
|
916
|
+
|
917
|
+
describe "that uses add_exploded_ejb_artifact with overrides" do
|
918
|
+
before do
|
919
|
+
write 'foo/bar/src/main/java/foo/Foo.java' # needed so that buildr will treat as a java project
|
920
|
+
artifact('net.sourceforge.jtds:jtds:jar:1.2.7.XX') { |task| write task.name }
|
921
|
+
|
922
|
+
@foo = define "foo" do
|
923
|
+
project.version = '1.0'
|
924
|
+
define "bar" do
|
925
|
+
compile.with 'net.sourceforge.jtds:jtds:jar:1.2.7.XX'
|
926
|
+
package :jar
|
927
|
+
end
|
928
|
+
ipr.add_exploded_ejb_artifact(project("bar"),
|
929
|
+
:ejb_module_names => ['x'],
|
930
|
+
:jpa_module_names => ['p'])
|
931
|
+
end
|
932
|
+
invoke_generate_task
|
933
|
+
end
|
934
|
+
|
935
|
+
it "generates an IPR with an ejb artifact" do
|
936
|
+
doc = xml_document(@foo._("foo.ipr"))
|
937
|
+
base_xpath = "/project/component[@name='ArtifactManager']/artifact"
|
938
|
+
facet_xpath = "#{base_xpath}[@type='exploded-ejb' and @name='bar' and @build-on-make='false']"
|
939
|
+
doc.should have_xpath(facet_xpath)
|
940
|
+
doc.should have_xpath("#{facet_xpath}/output-path/text() = $PROJECT_DIR$/artifacts/bar")
|
941
|
+
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='module-output' and @name='bar']")
|
942
|
+
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='jpa-descriptors' and @facet='p/jpa/JPA']")
|
943
|
+
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='javaee-facet-resources' and @facet='x/ejb/EJB']")
|
944
|
+
end
|
945
|
+
end
|
946
|
+
|
947
|
+
describe "that uses add_exploded_ejb_artifact with no overrides" do
|
948
|
+
before do
|
949
|
+
write 'foo/bar/src/main/java/foo/Foo.java' # needed so that buildr will treat as a java project
|
950
|
+
artifact('net.sourceforge.jtds:jtds:jar:1.2.7.XX') { |task| write task.name }
|
951
|
+
|
952
|
+
@foo = define "foo" do
|
953
|
+
project.version = '1.0'
|
954
|
+
define "bar" do
|
955
|
+
compile.with 'net.sourceforge.jtds:jtds:jar:1.2.7.XX'
|
956
|
+
package :war
|
957
|
+
end
|
958
|
+
ipr.add_exploded_ejb_artifact(project("bar"))
|
959
|
+
end
|
960
|
+
invoke_generate_task
|
961
|
+
end
|
962
|
+
|
963
|
+
it "generates an IPR with an ejb artifact" do
|
964
|
+
doc = xml_document(@foo._("foo.ipr"))
|
965
|
+
base_xpath = "/project/component[@name='ArtifactManager']/artifact"
|
966
|
+
facet_xpath = "#{base_xpath}[@type='exploded-ejb' and @name='bar' and @build-on-make='false']"
|
967
|
+
doc.should have_xpath(facet_xpath)
|
968
|
+
|
969
|
+
doc.should have_xpath("#{facet_xpath}/output-path/text() = $PROJECT_DIR$/artifacts/bar")
|
970
|
+
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='module-output' and @name='bar']")
|
971
|
+
end
|
972
|
+
end
|
973
|
+
|
974
|
+
|
975
|
+
describe "that uses add_exploded_war_artifact with no overrides" do
|
976
|
+
before do
|
977
|
+
write 'foo/bar/src/main/java/foo/Foo.java' # needed so that buildr will treat as a java project
|
978
|
+
artifact('net.sourceforge.jtds:jtds:jar:1.2.7.XX') { |task| write task.name }
|
979
|
+
|
980
|
+
@foo = define "foo" do
|
981
|
+
project.version = '1.0'
|
982
|
+
define "bar" do
|
983
|
+
compile.with 'net.sourceforge.jtds:jtds:jar:1.2.7.XX'
|
984
|
+
package :war
|
985
|
+
end
|
986
|
+
ipr.add_exploded_war_artifact(project("bar"))
|
987
|
+
end
|
988
|
+
invoke_generate_task
|
989
|
+
end
|
990
|
+
|
991
|
+
it "generates an IPR with a war artifact" do
|
992
|
+
doc = xml_document(@foo._("foo.ipr"))
|
993
|
+
base_xpath = "/project/component[@name='ArtifactManager']/artifact"
|
994
|
+
facet_xpath = "#{base_xpath}[@type='exploded-war' and @name='bar' and @build-on-make='false']"
|
995
|
+
doc.should have_xpath(facet_xpath)
|
996
|
+
|
997
|
+
doc.should have_xpath("#{facet_xpath}/output-path/text() = $PROJECT_DIR$/artifacts/bar")
|
998
|
+
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='directory' and @name='WEB-INF']/element[@id='directory' and @name='classes']/element[@id='module-output' and @name='bar']")
|
999
|
+
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='directory' and @name='WEB-INF']/element[@id='directory' and @name='lib']/element[@id='file-copy' and @path='$MAVEN_REPOSITORY$/net/sourceforge/jtds/jtds/1.2.7.XX/jtds-1.2.7.XX.jar']")
|
1000
|
+
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='javaee-facet-resources' and @facet='bar/web/Web']")
|
1001
|
+
end
|
1002
|
+
end
|
1003
|
+
|
1004
|
+
describe "that uses add_exploded_war_artifact with overrides" do
|
1005
|
+
before do
|
1006
|
+
write 'foo/bar/src/main/java/foo/Foo.java' # needed so that buildr will treat as a java project
|
1007
|
+
artifact('net.sourceforge.jtds:jtds:jar:1.2.7.XX') { |task| write task.name }
|
1008
|
+
|
1009
|
+
@foo = define "foo" do
|
1010
|
+
project.version = '1.0'
|
1011
|
+
define "bar" do
|
1012
|
+
compile.with 'net.sourceforge.jtds:jtds:jar:1.2.7.XX'
|
1013
|
+
package :war
|
1014
|
+
end
|
1015
|
+
ipr.add_exploded_war_artifact(project,
|
1016
|
+
:name => 'gar',
|
1017
|
+
:war_module_names => ['x','y'],
|
1018
|
+
:gwt_module_names => ['p','q'],
|
1019
|
+
:artifacts => ['baz','biz'],
|
1020
|
+
:dependencies => ['net.sourceforge.jtds:jtds:jar:1.2.7.XX', project('bar')])
|
1021
|
+
end
|
1022
|
+
invoke_generate_task
|
1023
|
+
end
|
1024
|
+
|
1025
|
+
it "generates an IPR with a war artifact" do
|
1026
|
+
doc = xml_document(@foo._("foo.ipr"))
|
1027
|
+
base_xpath = "/project/component[@name='ArtifactManager']/artifact"
|
1028
|
+
facet_xpath = "#{base_xpath}[@type='exploded-war' @name='MyFancy.jar' and @build-on-make='false']"
|
1029
|
+
doc.should have_xpath(facet_xpath)
|
1030
|
+
|
1031
|
+
doc.should have_xpath("#{facet_xpath}/output-path/text() = $PROJECT_DIR$/artifacts/gar")
|
1032
|
+
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='directory' and @name='WEB-INF']/element[@id='directory' and @name='classes']/element[@id='module-output' and @name='bar']")
|
1033
|
+
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='directory' and @name='WEB-INF']/element[@id='directory' and @name='lib']/element[@id='file-copy' and @path='$MAVEN_REPOSITORY$/net/sourceforge/jtds/jtds/1.2.7.XX/jtds-1.2.7.XX.jar']")
|
1034
|
+
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='javaee-facet-resources' and @facet='x/web/Web']")
|
1035
|
+
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='javaee-facet-resources' and @facet='y/web/Web']")
|
1036
|
+
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='gwt-compiler-output' and @facet='p/gwt/GWT']")
|
1037
|
+
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='gwt-compiler-output' and @facet='q/gwt/GWT']")
|
1038
|
+
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='directory' and @name='WEB-INF']/element[@id='directory' and @name='lib']/element[@id='artifact' and @artifact-name='baz.jar']")
|
1039
|
+
doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='directory' and @name='WEB-INF']/element[@id='directory' and @name='lib']/element[@id='artifact' and @artifact-name='biz.jar']")
|
1040
|
+
end
|
1041
|
+
end
|
1042
|
+
|
1043
|
+
describe "with configurations added to root project" do
|
1044
|
+
before do
|
1045
|
+
@foo = define "foo" do
|
1046
|
+
ipr.add_configuration("Run Contacts.html", "GWT.ConfigurationType", "GWT Configuration") do |xml|
|
1047
|
+
xml.module(:name => project.iml.id)
|
1048
|
+
xml.option(:name => "RUN_PAGE", :value => "Contacts.html")
|
1049
|
+
xml.option(:name => "compilerParameters", :value => "-draftCompile -localWorkers 2")
|
1050
|
+
xml.option(:name => "compilerMaxHeapSize", :value => "512")
|
1051
|
+
|
1052
|
+
xml.RunnerSettings(:RunnerId => "Run")
|
1053
|
+
xml.ConfigurationWrapper(:RunnerId => "Run")
|
1054
|
+
xml.tag! :method
|
1055
|
+
end
|
1056
|
+
ipr.add_configuration("Run Planner.html", "GWT.ConfigurationType", "GWT Configuration") do |xml|
|
1057
|
+
xml.module(:name => project.iml.id)
|
1058
|
+
xml.option(:name => "RUN_PAGE", :value => "Planner.html")
|
1059
|
+
xml.option(:name => "compilerParameters", :value => "-draftCompile -localWorkers 2")
|
1060
|
+
xml.option(:name => "compilerMaxHeapSize", :value => "512")
|
1061
|
+
|
1062
|
+
xml.RunnerSettings(:RunnerId => "Run")
|
1063
|
+
xml.ConfigurationWrapper(:RunnerId => "Run")
|
1064
|
+
xml.tag! :method
|
1065
|
+
end
|
1066
|
+
end
|
1067
|
+
invoke_generate_task
|
1068
|
+
end
|
1069
|
+
|
1070
|
+
it "generates an IPR with multiple configurations" do
|
1071
|
+
doc = xml_document(@foo._("foo.ipr"))
|
1072
|
+
facet_xpath = "/project/component[@name='ProjectRunConfigurationManager']/configuration"
|
1073
|
+
doc.should have_nodes(facet_xpath, 2)
|
1074
|
+
doc.should have_xpath("#{facet_xpath}[@type='GWT.ConfigurationType' and @name='Run Contacts.html']")
|
1075
|
+
doc.should have_xpath("#{facet_xpath}[@type='GWT.ConfigurationType' and @name='Run Planner.html']")
|
1076
|
+
end
|
1077
|
+
end
|
1078
|
+
|
1079
|
+
describe "with default configuration added to root project" do
|
1080
|
+
before do
|
1081
|
+
@foo = define "foo" do
|
1082
|
+
ipr.add_default_configuration("GWT.ConfigurationType", "GWT Configuration") do |xml|
|
1083
|
+
xml.module(:name => project.iml.id)
|
1084
|
+
xml.option(:name => "RUN_PAGE", :value => "Planner.html")
|
1085
|
+
xml.option(:name => "compilerParameters", :value => "-draftCompile -localWorkers 2")
|
1086
|
+
xml.option(:name => "compilerMaxHeapSize", :value => "512")
|
1087
|
+
|
1088
|
+
xml.RunnerSettings(:RunnerId => "Run")
|
1089
|
+
xml.ConfigurationWrapper(:RunnerId => "Run")
|
1090
|
+
xml.tag! :method
|
1091
|
+
end
|
1092
|
+
end
|
1093
|
+
invoke_generate_task
|
1094
|
+
end
|
1095
|
+
|
1096
|
+
it "generates an IPR with default configuration" do
|
1097
|
+
doc = xml_document(@foo._("foo.ipr"))
|
1098
|
+
facet_xpath = "/project/component[@name='ProjectRunConfigurationManager']/configuration"
|
1099
|
+
doc.should have_nodes(facet_xpath, 1)
|
1100
|
+
doc.should have_xpath("#{facet_xpath}[@type='GWT.ConfigurationType' and @factoryName='GWT Configuration' and @default='true']")
|
1101
|
+
end
|
1102
|
+
end
|
1103
|
+
|
1104
|
+
describe "with add_default_testng_configuration using defaults" do
|
1105
|
+
before do
|
1106
|
+
@foo = define "foo" do
|
1107
|
+
ipr.add_default_testng_configuration
|
1108
|
+
end
|
1109
|
+
invoke_generate_task
|
1110
|
+
end
|
1111
|
+
|
1112
|
+
it "generates an IPR with default configuration" do
|
1113
|
+
doc = xml_document(@foo._("foo.ipr"))
|
1114
|
+
configurations_xpath = "/project/component[@name='ProjectRunConfigurationManager']/configuration"
|
1115
|
+
doc.should have_nodes(configurations_xpath, 1)
|
1116
|
+
configuration_xpath = "#{configurations_xpath}[@type='TestNG' and @factoryName='TestNG' and @default='true']"
|
1117
|
+
doc.should have_xpath(configuration_xpath)
|
1118
|
+
doc.should have_xpath("#{configuration_xpath}/option[@name='VM_PARAMETERS' and @value='-ea']")
|
1119
|
+
doc.should have_xpath("#{configuration_xpath}/option[@name='WORKING_DIRECTORY' and @value='$PROJECT_DIR$']")
|
1120
|
+
end
|
1121
|
+
end
|
1122
|
+
|
1123
|
+
describe "with add_default_testng_configuration specifying values" do
|
1124
|
+
before do
|
1125
|
+
@foo = define "foo" do
|
1126
|
+
ipr.add_default_testng_configuration(:dir => 'C:/blah', :jvm_args => '-ea -Dtest.db.url=xxxx')
|
1127
|
+
end
|
1128
|
+
invoke_generate_task
|
1129
|
+
end
|
1130
|
+
|
1131
|
+
it "generates an IPR with default configuration" do
|
1132
|
+
doc = xml_document(@foo._("foo.ipr"))
|
1133
|
+
configurations_xpath = "/project/component[@name='ProjectRunConfigurationManager']/configuration"
|
1134
|
+
doc.should have_nodes(configurations_xpath, 1)
|
1135
|
+
configuration_xpath = "#{configurations_xpath}[@type='TestNG' and @factoryName='TestNG' and @default='true']"
|
1136
|
+
doc.should have_xpath(configuration_xpath)
|
1137
|
+
doc.should have_xpath("#{configuration_xpath}/option[@name='VM_PARAMETERS' and @value='-ea -Dtest.db.url=xxxx']")
|
1138
|
+
doc.should have_xpath("#{configuration_xpath}/option[@name='WORKING_DIRECTORY' and @value='C:/blah']")
|
1139
|
+
end
|
1140
|
+
end
|
1141
|
+
|
1142
|
+
describe "with iml.group specified" do
|
1143
|
+
before do
|
1144
|
+
@foo = define "foo" do
|
1145
|
+
iml.group = true
|
1146
|
+
define 'bar' do
|
1147
|
+
define 'baz' do
|
1148
|
+
|
1149
|
+
end
|
1150
|
+
end
|
1151
|
+
define 'rab' do
|
1152
|
+
iml.group = "MyGroup"
|
1153
|
+
end
|
1154
|
+
end
|
1155
|
+
invoke_generate_task
|
1156
|
+
end
|
1157
|
+
|
1158
|
+
it "generate an IPR with correct group references" do
|
1159
|
+
doc = xml_document(@foo._("foo.ipr"))
|
1160
|
+
doc.should have_nodes("#{xpath_to_module}", 4)
|
1161
|
+
module_ref = "$PROJECT_DIR$/foo.iml"
|
1162
|
+
doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}' and @filepath='#{module_ref}']")
|
1163
|
+
module_ref = "$PROJECT_DIR$/rab/rab.iml"
|
1164
|
+
doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}' and @filepath='#{module_ref}' @group = 'MyGroup']")
|
1165
|
+
module_ref = "$PROJECT_DIR$/bar/bar.iml"
|
1166
|
+
doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}' and @filepath='#{module_ref}' @group = 'foo']")
|
1167
|
+
module_ref = "$PROJECT_DIR$/bar/baz/baz.iml"
|
1168
|
+
doc.should have_xpath("#{xpath_to_module}[@fileurl='file://#{module_ref}' and @filepath='#{module_ref}' @group = 'foo/bar']")
|
1169
|
+
end
|
1170
|
+
end
|
1171
|
+
|
1172
|
+
describe "with a single project definition" do
|
1173
|
+
describe "and default naming" do
|
1174
|
+
before do
|
1175
|
+
@foo = define "foo"
|
1176
|
+
invoke_generate_task
|
1177
|
+
end
|
1178
|
+
|
1179
|
+
it "generates a single IPR" do
|
1180
|
+
Dir[@foo._("**/*.ipr")].should have(1).entry
|
1181
|
+
end
|
1182
|
+
|
1183
|
+
it "generate an IPR in the root directory" do
|
1184
|
+
File.should be_exist(@foo._("foo.ipr"))
|
1185
|
+
end
|
1186
|
+
|
1187
|
+
it "generates a single IML" do
|
1188
|
+
Dir[@foo._("**/*.iml")].should have(1).entry
|
1189
|
+
end
|
1190
|
+
|
1191
|
+
it "generates an IML in the root directory" do
|
1192
|
+
File.should be_exist(@foo._("foo.iml"))
|
1193
|
+
end
|
1194
|
+
|
1195
|
+
it "generate an IPR with the reference to correct module file" do
|
1196
|
+
File.should be_exist(@foo._("foo.ipr"))
|
1197
|
+
doc = xml_document(@foo._("foo.ipr"))
|
1198
|
+
module_ref = "$PROJECT_DIR$/foo.iml"
|
1199
|
+
doc.should have_nodes("#{xpath_to_module}[@fileurl='file://#{module_ref}' and @filepath='#{module_ref}']", 1)
|
1200
|
+
end
|
1201
|
+
end
|
1202
|
+
|
1203
|
+
describe "with no_iml generation disabled" do
|
1204
|
+
before do
|
1205
|
+
@foo = define "foo" do
|
1206
|
+
project.no_iml
|
1207
|
+
end
|
1208
|
+
invoke_generate_task
|
1209
|
+
end
|
1210
|
+
|
1211
|
+
it "generates no IML" do
|
1212
|
+
Dir[@foo._("**/*.iml")].should have(0).entry
|
1213
|
+
end
|
1214
|
+
|
1215
|
+
it "generate an IPR with no references" do
|
1216
|
+
File.should be_exist(@foo._("foo.ipr"))
|
1217
|
+
doc = xml_document(@foo._("foo.ipr"))
|
1218
|
+
doc.should have_nodes("#{xpath_to_module}", 0)
|
1219
|
+
end
|
1220
|
+
end
|
1221
|
+
|
1222
|
+
describe "with ipr generation disabled" do
|
1223
|
+
before do
|
1224
|
+
@foo = define "foo" do
|
1225
|
+
project.no_ipr
|
1226
|
+
end
|
1227
|
+
invoke_generate_task
|
1228
|
+
end
|
1229
|
+
|
1230
|
+
it "generates a single IML" do
|
1231
|
+
Dir[@foo._("**/*.iml")].should have(1).entry
|
1232
|
+
end
|
1233
|
+
|
1234
|
+
it "generate no IPR" do
|
1235
|
+
File.should_not be_exist(@foo._("foo.ipr"))
|
1236
|
+
end
|
1237
|
+
end
|
1238
|
+
|
1239
|
+
describe "and id overrides" do
|
1240
|
+
before do
|
1241
|
+
@foo = define "foo" do
|
1242
|
+
ipr.id = 'fooble'
|
1243
|
+
iml.id = 'feap'
|
1244
|
+
define "bar" do
|
1245
|
+
iml.id = "baz"
|
1246
|
+
end
|
1247
|
+
end
|
1248
|
+
invoke_generate_task
|
1249
|
+
end
|
1250
|
+
|
1251
|
+
it "generate an IPR in the root directory" do
|
1252
|
+
File.should be_exist(@foo._("fooble.ipr"))
|
1253
|
+
end
|
1254
|
+
|
1255
|
+
it "generates an IML in the root directory" do
|
1256
|
+
File.should be_exist(@foo._("feap.iml"))
|
1257
|
+
end
|
1258
|
+
|
1259
|
+
it "generates an IML in the subproject directory" do
|
1260
|
+
File.should be_exist(@foo._("bar/baz.iml"))
|
1261
|
+
end
|
1262
|
+
|
1263
|
+
it "generate an IPR with the reference to correct module file" do
|
1264
|
+
File.should be_exist(@foo._("fooble.ipr"))
|
1265
|
+
doc = xml_document(@foo._("fooble.ipr"))
|
1266
|
+
module_ref = "$PROJECT_DIR$/feap.iml"
|
1267
|
+
doc.should have_nodes("#{xpath_to_module}[@fileurl='file://#{module_ref}' and @filepath='#{module_ref}']", 1)
|
1268
|
+
end
|
1269
|
+
end
|
1270
|
+
|
1271
|
+
describe "and a suffix defined" do
|
1272
|
+
before do
|
1273
|
+
@foo = define "foo" do
|
1274
|
+
ipr.suffix = '-ipr-suffix'
|
1275
|
+
iml.suffix = '-iml-suffix'
|
1276
|
+
end
|
1277
|
+
invoke_generate_task
|
1278
|
+
end
|
1279
|
+
|
1280
|
+
it "generate an IPR in the root directory" do
|
1281
|
+
File.should be_exist(@foo._("foo-ipr-suffix.ipr"))
|
1282
|
+
end
|
1283
|
+
|
1284
|
+
it "generates an IML in the root directory" do
|
1285
|
+
File.should be_exist(@foo._("foo-iml-suffix.iml"))
|
1286
|
+
end
|
1287
|
+
|
1288
|
+
it "generate an IPR with the reference to correct module file" do
|
1289
|
+
File.should be_exist(@foo._("foo-ipr-suffix.ipr"))
|
1290
|
+
doc = xml_document(@foo._("foo-ipr-suffix.ipr"))
|
1291
|
+
doc.should have_nodes("#{xpath_to_module}", 1)
|
1292
|
+
module_ref = "$PROJECT_DIR$/foo-iml-suffix.iml"
|
1293
|
+
doc.should have_nodes("#{xpath_to_module}[@fileurl='file://#{module_ref}' and @filepath='#{module_ref}']", 1)
|
1294
|
+
end
|
1295
|
+
end
|
1296
|
+
end
|
1297
|
+
|
1298
|
+
describe "with a subproject" do
|
1299
|
+
before do
|
1300
|
+
@foo = define "foo" do
|
1301
|
+
define 'bar'
|
1302
|
+
end
|
1303
|
+
invoke_generate_task
|
1304
|
+
end
|
1305
|
+
|
1306
|
+
it "creates the subproject directory" do
|
1307
|
+
File.should be_exist(@foo._("bar"))
|
1308
|
+
end
|
1309
|
+
|
1310
|
+
it "generates an IML in the subproject directory" do
|
1311
|
+
File.should be_exist(@foo._("bar/bar.iml"))
|
1312
|
+
end
|
1313
|
+
|
1314
|
+
it "generate an IPR with the reference to correct module file" do
|
1315
|
+
File.should be_exist(@foo._("foo.ipr"))
|
1316
|
+
doc = xml_document(@foo._("foo.ipr"))
|
1317
|
+
doc.should have_nodes("#{xpath_to_module}", 2)
|
1318
|
+
module_ref = "$PROJECT_DIR$/foo.iml"
|
1319
|
+
doc.should have_nodes("#{xpath_to_module}[@fileurl='file://#{module_ref}' and @filepath='#{module_ref}']", 1)
|
1320
|
+
module_ref = "$PROJECT_DIR$/bar/bar.iml"
|
1321
|
+
doc.should have_nodes("#{xpath_to_module}[@fileurl='file://#{module_ref}' and @filepath='#{module_ref}']", 1)
|
1322
|
+
end
|
1323
|
+
end
|
1324
|
+
|
1325
|
+
describe "with base_dir specified" do
|
1326
|
+
before do
|
1327
|
+
@foo = define "foo" do
|
1328
|
+
define('bar', :base_dir => 'fe') do
|
1329
|
+
define('baz', :base_dir => 'fi') do
|
1330
|
+
define('foe')
|
1331
|
+
end
|
1332
|
+
define('fum')
|
1333
|
+
end
|
1334
|
+
end
|
1335
|
+
invoke_generate_task
|
1336
|
+
end
|
1337
|
+
|
1338
|
+
it "generates a subproject IML in the specified directory" do
|
1339
|
+
File.should be_exist(@foo._("fe/bar.iml"))
|
1340
|
+
end
|
1341
|
+
|
1342
|
+
it "generates a sub-subproject IML in the specified directory" do
|
1343
|
+
File.should be_exist(@foo._("fi/baz.iml"))
|
1344
|
+
end
|
1345
|
+
|
1346
|
+
it "generates a sub-sub-subproject IML that inherits the specified directory" do
|
1347
|
+
File.should be_exist(@foo._("fi/foe/foe.iml"))
|
1348
|
+
end
|
1349
|
+
|
1350
|
+
it "generates a sub-subproject IML that inherits the specified directory" do
|
1351
|
+
File.should be_exist(@foo._("fe/fum/fum.iml"))
|
1352
|
+
end
|
1353
|
+
|
1354
|
+
it "generate an IPR with the references to correct module files" do
|
1355
|
+
doc = xml_document(@foo._("foo.ipr"))
|
1356
|
+
doc.should have_nodes("#{xpath_to_module}", 5)
|
1357
|
+
["foo.iml", "fe/bar.iml", "fi/baz.iml", "fi/foe/foe.iml", "fe/fum/fum.iml"].each do |module_ref|
|
1358
|
+
doc.should have_nodes("#{xpath_to_module}[@fileurl='file://$PROJECT_DIR$/#{module_ref}' and @filepath='$PROJECT_DIR$/#{module_ref}']", 1)
|
1359
|
+
end
|
1360
|
+
end
|
1361
|
+
end
|
1362
|
+
|
1363
|
+
describe "with extensive intermodule dependencies" do
|
1364
|
+
before do
|
1365
|
+
mkdir_p 'foo/src/main/resources'
|
1366
|
+
mkdir_p 'foo/src/main/java/foo'
|
1367
|
+
touch 'foo/src/main/java/foo/Foo.java' # needed so that buildr will treat as a java project
|
1368
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
1369
|
+
define "root" do
|
1370
|
+
repositories.remote << 'http://mirrors.ibiblio.org/pub/mirrors/maven2/'
|
1371
|
+
project.version = "2.5.2"
|
1372
|
+
define 'foo' do
|
1373
|
+
resources.from _(:source, :main, :resources)
|
1374
|
+
compile.with 'group:id:jar:1.0'
|
1375
|
+
test.using(:junit)
|
1376
|
+
package(:jar)
|
1377
|
+
end
|
1378
|
+
|
1379
|
+
define 'bar' do
|
1380
|
+
# internally transitive dependencies on foo, both runtime and test
|
1381
|
+
compile.with project('root:foo'), project('root:foo').compile.dependencies
|
1382
|
+
test.using(:junit).with [project('root:foo').test.compile.target,
|
1383
|
+
project('root:foo').test.resources.target,
|
1384
|
+
project('root:foo').test.compile.dependencies].compact
|
1385
|
+
package(:jar)
|
1386
|
+
end
|
1387
|
+
end
|
1388
|
+
|
1389
|
+
invoke_generate_task
|
1390
|
+
@bar_iml = xml_document(project('root:bar')._('bar.iml'))
|
1391
|
+
@bar_lib_urls = @bar_iml.get_elements("//orderEntry[@type='module-library']/library/CLASSES/root").collect do |root|
|
1392
|
+
root.attribute('url').to_s
|
1393
|
+
end
|
1394
|
+
end
|
1395
|
+
|
1396
|
+
it "depends on the associated module exactly once" do
|
1397
|
+
@bar_iml.should have_nodes("//orderEntry[@type='module' and @module-name='foo' and @exported=""]", 1)
|
1398
|
+
end
|
1399
|
+
|
1400
|
+
it "does not depend on the other project's packaged JAR" do
|
1401
|
+
@bar_lib_urls.grep(%r{#{project('root:foo').packages.first}}).should == []
|
1402
|
+
end
|
1403
|
+
|
1404
|
+
it "does not depend on the the other project's target/classes directory" do
|
1405
|
+
@bar_lib_urls.grep(%r{foo/target/classes}).should == []
|
1406
|
+
end
|
1407
|
+
|
1408
|
+
it "does not depend on the the other project's target/resources directory" do
|
1409
|
+
@bar_lib_urls.grep(%r{file://\$MODULE_DIR\$/../foo/target/resources}).size.should == 0
|
1410
|
+
end
|
1411
|
+
end
|
1412
|
+
|
1413
|
+
describe "with a single project definition" do
|
1414
|
+
before do
|
1415
|
+
@foo = define "foo"
|
1416
|
+
end
|
1417
|
+
|
1418
|
+
it "informs the user about generating IPR" do
|
1419
|
+
lambda { invoke_generate_task }.should show_info(/Writing (.+)\/foo\.ipr/)
|
1420
|
+
end
|
1421
|
+
|
1422
|
+
it "informs the user about generating IML" do
|
1423
|
+
lambda { invoke_generate_task }.should show_info(/Writing (.+)\/foo\.iml/)
|
1424
|
+
end
|
1425
|
+
end
|
1426
|
+
describe "with a subproject" do
|
1427
|
+
before do
|
1428
|
+
@foo = define "foo" do
|
1429
|
+
define 'bar'
|
1430
|
+
end
|
1431
|
+
end
|
1432
|
+
|
1433
|
+
it "informs the user about generating subporoject IML" do
|
1434
|
+
lambda { invoke_generate_task }.should show_info(/Writing (.+)\/bar\/bar\.iml/)
|
1435
|
+
end
|
1436
|
+
end
|
1437
|
+
|
1438
|
+
describe "with compile.options.source = '1.6'" do
|
1439
|
+
|
1440
|
+
before do
|
1441
|
+
@foo = define "foo" do
|
1442
|
+
compile.options.source = '1.5'
|
1443
|
+
end
|
1444
|
+
invoke_generate_task
|
1445
|
+
end
|
1446
|
+
|
1447
|
+
it "generate an ProjectRootManager with 1.5 jdk specified" do
|
1448
|
+
#raise File.read(@foo._("foo.ipr"))
|
1449
|
+
xml_document(@foo._("foo.ipr")).
|
1450
|
+
should have_xpath("/project/component[@name='ProjectRootManager' and @project-jdk-name = '1.5' and @languageLevel = 'JDK_1_5']")
|
1451
|
+
end
|
1452
|
+
|
1453
|
+
it "generates a ProjectDetails component with the projectName option set" do
|
1454
|
+
xml_document(@foo._("foo.ipr")).
|
1455
|
+
should have_xpath("/project/component[@name='ProjectDetails']/option[@name = 'projectName' and @value = 'foo']")
|
1456
|
+
end
|
1457
|
+
end
|
1458
|
+
|
1459
|
+
describe "with compile.options.source = '1.6'" do
|
1460
|
+
before do
|
1461
|
+
@foo = define "foo" do
|
1462
|
+
compile.options.source = '1.6'
|
1463
|
+
end
|
1464
|
+
invoke_generate_task
|
1465
|
+
end
|
1466
|
+
|
1467
|
+
it "generate an ProjectRootManager with 1.6 jdk specified" do
|
1468
|
+
xml_document(@foo._("foo.ipr")).
|
1469
|
+
should have_xpath("/project/component[@name='ProjectRootManager' and @project-jdk-name = '1.6' and @languageLevel = 'JDK_1_6']")
|
1470
|
+
end
|
1471
|
+
end
|
1472
|
+
|
1473
|
+
describe "with iml.skip_content! specified" do
|
1474
|
+
before do
|
1475
|
+
@foo = define "foo" do
|
1476
|
+
iml.skip_content!
|
1477
|
+
end
|
1478
|
+
invoke_generate_task
|
1479
|
+
end
|
1480
|
+
|
1481
|
+
it "generate an IML with no content section" do
|
1482
|
+
doc = xml_document(@foo._(root_module_filename(@foo)))
|
1483
|
+
doc.should_not have_xpath("/module/component[@name='NewModuleRootManager']/content")
|
1484
|
+
end
|
1485
|
+
end
|
1486
|
+
|
1487
|
+
describe "with iml.skip_content! not specified and standard layout" do
|
1488
|
+
before do
|
1489
|
+
@foo = define "foo" do
|
1490
|
+
end
|
1491
|
+
invoke_generate_task
|
1492
|
+
end
|
1493
|
+
|
1494
|
+
it "generate an IML with content section" do
|
1495
|
+
root_module_xml(@foo).should have_xpath("/module/component[@name='NewModuleRootManager']/content")
|
1496
|
+
end
|
1497
|
+
|
1498
|
+
it "generate an exclude in content section for reports" do
|
1499
|
+
root_module_xml(@foo).should have_xpath("/module/component[@name='NewModuleRootManager']/content/excludeFolder[@url='file://$MODULE_DIR$/reports']")
|
1500
|
+
end
|
1501
|
+
|
1502
|
+
it "generate an exclude in content section for target" do
|
1503
|
+
root_module_xml(@foo).should have_xpath("/module/component[@name='NewModuleRootManager']/content/excludeFolder[@url='file://$MODULE_DIR$/target']")
|
1504
|
+
end
|
1505
|
+
end
|
1506
|
+
|
1507
|
+
describe "with subprojects" do
|
1508
|
+
before do
|
1509
|
+
@foo = define "foo" do
|
1510
|
+
define "bar" do
|
1511
|
+
compile.from _(:source, :main, :bar)
|
1512
|
+
end
|
1513
|
+
end
|
1514
|
+
invoke_generate_task
|
1515
|
+
@bar_doc = xml_document(project('foo:bar')._('bar.iml'))
|
1516
|
+
end
|
1517
|
+
|
1518
|
+
it "generates the correct source directories" do
|
1519
|
+
@bar_doc.should have_xpath("//content/sourceFolder[@url='file://$MODULE_DIR$/src/main/bar']")
|
1520
|
+
end
|
1521
|
+
|
1522
|
+
it "generates the correct exclude directories" do
|
1523
|
+
@bar_doc.should have_xpath("//content/excludeFolder[@url='file://$MODULE_DIR$/target']")
|
1524
|
+
end
|
1525
|
+
end
|
1526
|
+
|
1527
|
+
describe "with overrides" do
|
1528
|
+
before do
|
1529
|
+
@foo = define "foo" do
|
1530
|
+
compile.from _(:source, :main, :bar)
|
1531
|
+
iml.main_source_directories << _(:source, :main, :baz)
|
1532
|
+
iml.test_source_directories << _(:source, :test, :foo)
|
1533
|
+
end
|
1534
|
+
invoke_generate_task
|
1535
|
+
end
|
1536
|
+
|
1537
|
+
it "generates the correct main source directories" do
|
1538
|
+
root_module_xml(@foo).should have_xpath("//content/sourceFolder[@url='file://$MODULE_DIR$/src/main/baz' and @isTestSource='false']")
|
1539
|
+
end
|
1540
|
+
|
1541
|
+
it "generates the correct test source directories" do
|
1542
|
+
root_module_xml(@foo).should have_xpath("//content/sourceFolder[@url='file://$MODULE_DIR$/src/test/foo' and @isTestSource='true']")
|
1543
|
+
end
|
1544
|
+
end
|
1545
|
+
|
1546
|
+
describe "with report dir outside content" do
|
1547
|
+
before do
|
1548
|
+
layout = Layout::Default.new
|
1549
|
+
layout[:reports] = "../reports"
|
1550
|
+
|
1551
|
+
@foo = define "foo", :layout => layout do
|
1552
|
+
end
|
1553
|
+
invoke_generate_task
|
1554
|
+
end
|
1555
|
+
|
1556
|
+
it "generate an exclude in content section for target" do
|
1557
|
+
root_module_xml(@foo).should have_xpath("/module/component[@name='NewModuleRootManager']/content/excludeFolder[@url='file://$MODULE_DIR$/target']")
|
1558
|
+
end
|
1559
|
+
|
1560
|
+
it "generates an content section without an exclude for report dir" do
|
1561
|
+
root_module_xml(@foo).should have_nodes("/module/component[@name='NewModuleRootManager']/content/excludeFolder", 1)
|
1562
|
+
end
|
1563
|
+
end
|
1564
|
+
|
1565
|
+
describe "with target dir outside content" do
|
1566
|
+
before do
|
1567
|
+
layout = Layout::Default.new
|
1568
|
+
layout[:target] = "../target"
|
1569
|
+
layout[:target, :main] = "../target"
|
1570
|
+
|
1571
|
+
@foo = define "foo", :layout => layout do
|
1572
|
+
end
|
1573
|
+
invoke_generate_task
|
1574
|
+
end
|
1575
|
+
|
1576
|
+
it "generate an exclude in content section for reports" do
|
1577
|
+
root_module_xml(@foo).should have_xpath("/module/component[@name='NewModuleRootManager']/content/excludeFolder[@url='file://$MODULE_DIR$/reports']")
|
1578
|
+
end
|
1579
|
+
|
1580
|
+
it "generates an content section without an exclude for target dir" do
|
1581
|
+
root_module_xml(@foo).should have_nodes("/module/component[@name='NewModuleRootManager']/content/excludeFolder", 1)
|
1582
|
+
end
|
1583
|
+
end
|
1584
|
+
|
1585
|
+
describe "templates" do
|
1586
|
+
|
1587
|
+
def ipr_template
|
1588
|
+
return <<PROJECT_XML
|
1589
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
1590
|
+
<project version="4">
|
1591
|
+
<component name="SvnBranchConfigurationManager">
|
1592
|
+
<option name="mySupportsUserInfoFilter" value="false" />
|
1593
|
+
</component>
|
1594
|
+
</project>
|
1595
|
+
PROJECT_XML
|
1596
|
+
end
|
1597
|
+
|
1598
|
+
def ipr_existing
|
1599
|
+
return <<PROJECT_XML
|
1600
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
1601
|
+
<project version="4">
|
1602
|
+
<component name="AntConfiguration">
|
1603
|
+
<defaultAnt bundledAnt="true" />
|
1604
|
+
</component>
|
1605
|
+
<component name="SvnBranchConfigurationManager">
|
1606
|
+
<option name="mySupportsUserInfoFilter" value="true" />
|
1607
|
+
</component>
|
1608
|
+
<component name="ProjectModuleManager">
|
1609
|
+
<modules>
|
1610
|
+
<module fileurl="file://$PROJECT_DIR$/existing.iml" filepath="$PROJECT_DIR$/existing.iml" />
|
1611
|
+
</modules>
|
1612
|
+
</component>
|
1613
|
+
</project>
|
1614
|
+
PROJECT_XML
|
1615
|
+
end
|
1616
|
+
|
1617
|
+
def ipr_from_template_xpath
|
1618
|
+
"/project/component[@name='SvnBranchConfigurationManager']/option[@name = 'mySupportsUserInfoFilter' and @value = 'false']"
|
1619
|
+
end
|
1620
|
+
|
1621
|
+
def ipr_from_existing_xpath
|
1622
|
+
"/project/component[@name='AntConfiguration']"
|
1623
|
+
end
|
1624
|
+
|
1625
|
+
def ipr_from_existing_shadowing_template_xpath
|
1626
|
+
"/project/component[@name='SvnBranchConfigurationManager']/option[@name = 'mySupportsUserInfoFilter' and @value = 'true']"
|
1627
|
+
end
|
1628
|
+
|
1629
|
+
def ipr_from_existing_shadowing_generated_xpath
|
1630
|
+
"/project/component[@name='ProjectModuleManager']/modules/module[@fileurl = 'file://$PROJECT_DIR$/existing.iml']"
|
1631
|
+
end
|
1632
|
+
|
1633
|
+
def ipr_from_generated_xpath
|
1634
|
+
"/project/component[@name='ProjectModuleManager']/modules/module[@fileurl = 'file://$PROJECT_DIR$/foo.iml']"
|
1635
|
+
end
|
1636
|
+
|
1637
|
+
def iml_template
|
1638
|
+
return <<PROJECT_XML
|
1639
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
1640
|
+
<module type="JAVA_MODULE" version="4">
|
1641
|
+
<component name="FacetManager">
|
1642
|
+
<facet type="JRUBY" name="JRuby">
|
1643
|
+
<configuration number="0">
|
1644
|
+
<JRUBY_FACET_CONFIG_ID NAME="JRUBY_SDK_NAME" VALUE="JRuby SDK 1.4.0RC1" />
|
1645
|
+
</configuration>
|
1646
|
+
</facet>
|
1647
|
+
</component>
|
1648
|
+
</module>
|
1649
|
+
PROJECT_XML
|
1650
|
+
end
|
1651
|
+
|
1652
|
+
def iml_existing
|
1653
|
+
return <<PROJECT_XML
|
1654
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
1655
|
+
<module type="JAVA_MODULE" version="4">
|
1656
|
+
<component name="FunkyPlugin"/>
|
1657
|
+
<component name="FacetManager">
|
1658
|
+
<facet type="SCALA" name="Scala"/>
|
1659
|
+
</component>
|
1660
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
1661
|
+
<exclude-output />
|
1662
|
+
<content url="file://$MODULE_DIR$"/>
|
1663
|
+
<orderEntry type="inheritedJdk" />
|
1664
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
1665
|
+
<orderEntry type="module" module-name="buildr-bnd" exported="" />
|
1666
|
+
</component>
|
1667
|
+
</module>
|
1668
|
+
PROJECT_XML
|
1669
|
+
end
|
1670
|
+
|
1671
|
+
def iml_from_template_xpath
|
1672
|
+
"/module/component[@name='FacetManager']/facet[@type = 'JRUBY']"
|
1673
|
+
end
|
1674
|
+
|
1675
|
+
def iml_from_existing_xpath
|
1676
|
+
"/module/component[@name='FunkyPlugin']"
|
1677
|
+
end
|
1678
|
+
|
1679
|
+
def iml_from_existing_shadowing_template_xpath
|
1680
|
+
"/module/component[@name='FacetManager']/facet[@type = 'SCALA']"
|
1681
|
+
end
|
1682
|
+
|
1683
|
+
def iml_from_existing_shadowing_generated_xpath
|
1684
|
+
"/module/component[@name='NewModuleRootManager']/orderEntry[@module-name = 'buildr-bnd']"
|
1685
|
+
end
|
1686
|
+
|
1687
|
+
def iml_from_generated_xpath
|
1688
|
+
"/module/component[@name='NewModuleRootManager']/orderEntry[@type = 'module-library']"
|
1689
|
+
end
|
1690
|
+
|
1691
|
+
describe "with existing project files" do
|
1692
|
+
before do
|
1693
|
+
write "foo.ipr", ipr_existing
|
1694
|
+
write "foo.iml", iml_existing
|
1695
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
1696
|
+
@foo = define "foo" do
|
1697
|
+
ipr.template = nil
|
1698
|
+
iml.template = nil
|
1699
|
+
compile.with 'group:id:jar:1.0'
|
1700
|
+
end
|
1701
|
+
invoke_generate_task
|
1702
|
+
end
|
1703
|
+
|
1704
|
+
it "replaces ProjectModuleManager component in existing ipr file" do
|
1705
|
+
xml_document(@foo._("foo.ipr")).should have_xpath(ipr_from_generated_xpath)
|
1706
|
+
xml_document(@foo._("foo.ipr")).should_not have_xpath(ipr_from_existing_shadowing_generated_xpath)
|
1707
|
+
end
|
1708
|
+
|
1709
|
+
it "merges component in existing ipr file" do
|
1710
|
+
xml_document(@foo._("foo.ipr")).should have_xpath(ipr_from_existing_xpath)
|
1711
|
+
end
|
1712
|
+
|
1713
|
+
def iml_from_generated_xpath
|
1714
|
+
"/module/component[@name='NewModuleRootManager']/orderEntry[@type = 'module-library']"
|
1715
|
+
end
|
1716
|
+
|
1717
|
+
it "replaces NewModuleRootManager component in existing iml file" do
|
1718
|
+
xml_document(@foo._("foo.iml")).should have_xpath(iml_from_generated_xpath)
|
1719
|
+
xml_document(@foo._("foo.iml")).should_not have_xpath(iml_from_existing_shadowing_generated_xpath)
|
1720
|
+
end
|
1721
|
+
|
1722
|
+
it "merges component in existing iml file" do
|
1723
|
+
xml_document(@foo._("foo.iml")).should have_xpath(iml_from_existing_xpath)
|
1724
|
+
end
|
1725
|
+
end
|
1726
|
+
|
1727
|
+
describe "with an iml template" do
|
1728
|
+
before do
|
1729
|
+
write "module.template.iml", iml_template
|
1730
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
1731
|
+
@foo = define "foo" do
|
1732
|
+
ipr.template = nil
|
1733
|
+
iml.template = "module.template.iml"
|
1734
|
+
compile.with 'group:id:jar:1.0'
|
1735
|
+
end
|
1736
|
+
invoke_generate_task
|
1737
|
+
end
|
1738
|
+
|
1739
|
+
it "replaces generated components" do
|
1740
|
+
xml_document(@foo._("foo.iml")).should have_xpath(iml_from_generated_xpath)
|
1741
|
+
end
|
1742
|
+
|
1743
|
+
it "merges component in iml template" do
|
1744
|
+
xml_document(@foo._("foo.iml")).should have_xpath(iml_from_template_xpath)
|
1745
|
+
end
|
1746
|
+
end
|
1747
|
+
|
1748
|
+
describe "with an iml template and existing iml" do
|
1749
|
+
before do
|
1750
|
+
write "module.template.iml", iml_template
|
1751
|
+
write "foo.iml", iml_existing
|
1752
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
1753
|
+
@foo = define "foo" do
|
1754
|
+
ipr.template = nil
|
1755
|
+
iml.template = "module.template.iml"
|
1756
|
+
compile.with 'group:id:jar:1.0'
|
1757
|
+
end
|
1758
|
+
invoke_generate_task
|
1759
|
+
end
|
1760
|
+
|
1761
|
+
it "replaces generated components" do
|
1762
|
+
xml_document(@foo._("foo.iml")).should have_xpath(iml_from_generated_xpath)
|
1763
|
+
end
|
1764
|
+
|
1765
|
+
it "merges component in iml template" do
|
1766
|
+
xml_document(@foo._("foo.iml")).should have_xpath(iml_from_template_xpath)
|
1767
|
+
end
|
1768
|
+
|
1769
|
+
it "merges components not in iml template and not generated by task" do
|
1770
|
+
xml_document(@foo._("foo.iml")).should have_xpath(iml_from_existing_xpath)
|
1771
|
+
xml_document(@foo._("foo.iml")).should_not have_xpath(iml_from_existing_shadowing_template_xpath)
|
1772
|
+
xml_document(@foo._("foo.iml")).should_not have_xpath(iml_from_existing_shadowing_generated_xpath)
|
1773
|
+
end
|
1774
|
+
end
|
1775
|
+
|
1776
|
+
describe "with an ipr template" do
|
1777
|
+
before do
|
1778
|
+
write "project.template.iml", ipr_template
|
1779
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
1780
|
+
@foo = define "foo" do
|
1781
|
+
ipr.template = "project.template.iml"
|
1782
|
+
iml.template = nil
|
1783
|
+
compile.with 'group:id:jar:1.0'
|
1784
|
+
end
|
1785
|
+
invoke_generate_task
|
1786
|
+
end
|
1787
|
+
|
1788
|
+
it "replaces generated component in ipr template" do
|
1789
|
+
xml_document(@foo._("foo.ipr")).should have_xpath(ipr_from_generated_xpath)
|
1790
|
+
end
|
1791
|
+
|
1792
|
+
it "merges component in ipr template" do
|
1793
|
+
xml_document(@foo._("foo.ipr")).should have_xpath(ipr_from_template_xpath)
|
1794
|
+
end
|
1795
|
+
end
|
1796
|
+
|
1797
|
+
describe "with an ipr template and existing ipr" do
|
1798
|
+
before do
|
1799
|
+
write "project.template.iml", ipr_template
|
1800
|
+
write "foo.ipr", ipr_existing
|
1801
|
+
artifact('group:id:jar:1.0') { |t| write t.to_s }
|
1802
|
+
@foo = define "foo" do
|
1803
|
+
ipr.template = "project.template.iml"
|
1804
|
+
iml.template = nil
|
1805
|
+
compile.with 'group:id:jar:1.0'
|
1806
|
+
end
|
1807
|
+
invoke_generate_task
|
1808
|
+
end
|
1809
|
+
|
1810
|
+
it "replaces generated component in ipr template" do
|
1811
|
+
xml_document(@foo._("foo.ipr")).should have_xpath(ipr_from_generated_xpath)
|
1812
|
+
end
|
1813
|
+
|
1814
|
+
it "merges component in ipr template" do
|
1815
|
+
xml_document(@foo._("foo.ipr")).should have_xpath(ipr_from_template_xpath)
|
1816
|
+
end
|
1817
|
+
|
1818
|
+
it "merges components not in ipr template and not generated by task" do
|
1819
|
+
xml_document(@foo._("foo.ipr")).should have_xpath(ipr_from_existing_xpath)
|
1820
|
+
xml_document(@foo._("foo.ipr")).should_not have_xpath(ipr_from_existing_shadowing_generated_xpath)
|
1821
|
+
xml_document(@foo._("foo.ipr")).should_not have_xpath(ipr_from_existing_shadowing_template_xpath)
|
1822
|
+
end
|
1823
|
+
end
|
1824
|
+
end
|
1825
|
+
end
|
1826
|
+
|
1827
|
+
describe "Buildr::IntellijIdea::IdeaModule" do
|
1828
|
+
|
1829
|
+
describe "with no settings" do
|
1830
|
+
before do
|
1831
|
+
@foo = define "foo"
|
1832
|
+
end
|
1833
|
+
|
1834
|
+
it "has correct default iml.type setting" do
|
1835
|
+
@foo.iml.type.should == "JAVA_MODULE"
|
1836
|
+
end
|
1837
|
+
|
1838
|
+
it "has correct default iml.local_repository_env_override setting" do
|
1839
|
+
@foo.iml.local_repository_env_override.should == "MAVEN_REPOSITORY"
|
1840
|
+
end
|
1841
|
+
end
|
1842
|
+
|
1843
|
+
describe "settings inherited in subprojects" do
|
1844
|
+
before do
|
1845
|
+
mkdir_p 'bar'
|
1846
|
+
@foo = define "foo" do
|
1847
|
+
iml.type = "FOO_MODULE_TYPE"
|
1848
|
+
define 'bar'
|
1849
|
+
end
|
1850
|
+
invoke_generate_task
|
1851
|
+
end
|
1852
|
+
|
1853
|
+
it "generates root IML with specified type" do
|
1854
|
+
module_file = root_module_filename(@foo)
|
1855
|
+
File.should be_exist(module_file)
|
1856
|
+
File.read(module_file).should =~ /FOO_MODULE_TYPE/
|
1857
|
+
end
|
1858
|
+
|
1859
|
+
it "generates subproject IML with inherited type" do
|
1860
|
+
module_file = subproject_module_filename(@foo, "bar")
|
1861
|
+
File.should be_exist(module_file)
|
1862
|
+
File.read(module_file).should =~ /FOO_MODULE_TYPE/
|
1863
|
+
end
|
1864
|
+
|
1865
|
+
end
|
1866
|
+
|
1867
|
+
describe "with local_repository_env_override = nil" do
|
1868
|
+
if Buildr::Util.win_os?
|
1869
|
+
describe "base_directory on different drive on windows" do
|
1870
|
+
before do
|
1871
|
+
@foo = define "foo", :base_dir => "C:/bar" do
|
1872
|
+
iml.local_repository_env_override = nil
|
1873
|
+
end
|
1874
|
+
end
|
1875
|
+
|
1876
|
+
it "generates relative paths correctly" do
|
1877
|
+
@foo.iml.send(:resolve_path, "E:/foo").should eql('E:/foo')
|
1878
|
+
end
|
1879
|
+
end
|
1880
|
+
|
1881
|
+
describe "base_directory on same drive on windows" do
|
1882
|
+
before do
|
1883
|
+
@foo = define "foo", :base_dir => "C:/bar" do
|
1884
|
+
iml.local_repository_env_override = nil
|
1885
|
+
end
|
1886
|
+
end
|
1887
|
+
|
1888
|
+
it "generates relative paths correctly" do
|
1889
|
+
@foo.iml.send(:resolve_path, "C:/foo").should eql('$MODULE_DIR$/../foo')
|
1890
|
+
end
|
1891
|
+
end
|
1892
|
+
end
|
1893
|
+
end
|
1894
|
+
end
|
1895
|
+
|
1896
|
+
describe "project extension" do
|
1897
|
+
it "provides an 'idea' task" do
|
1898
|
+
Rake::Task.tasks.detect { |task| task.to_s == "idea" }.should_not be_nil
|
1899
|
+
end
|
1900
|
+
|
1901
|
+
it "documents the 'idea' task" do
|
1902
|
+
Rake::Task.tasks.detect { |task| task.to_s == "idea" }.comment.should_not be_nil
|
1903
|
+
end
|
1904
|
+
|
1905
|
+
it "provides an 'idea:clean' task" do
|
1906
|
+
Rake::Task.tasks.detect { |task| task.to_s == "idea:clean" }.should_not be_nil
|
1907
|
+
end
|
1908
|
+
|
1909
|
+
it "documents the 'idea:clean' task" do
|
1910
|
+
Rake::Task.tasks.detect { |task| task.to_s == "idea:clean" }.comment.should_not be_nil
|
1911
|
+
end
|
1912
|
+
|
1913
|
+
describe "#no_iml" do
|
1914
|
+
it "makes #iml? false" do
|
1915
|
+
@foo = define "foo" do
|
1916
|
+
project.no_iml
|
1917
|
+
end
|
1918
|
+
@foo.iml?.should be_false
|
1919
|
+
end
|
1920
|
+
end
|
1921
|
+
|
1922
|
+
describe "#iml" do
|
1923
|
+
before do
|
1924
|
+
define "foo" do
|
1925
|
+
iml.suffix = "-top"
|
1926
|
+
|
1927
|
+
define "bar" do
|
1928
|
+
iml.suffix = "-mid"
|
1929
|
+
|
1930
|
+
define "baz" do
|
1931
|
+
end
|
1932
|
+
end
|
1933
|
+
end
|
1934
|
+
end
|
1935
|
+
|
1936
|
+
it "inherits the direct parent's IML settings" do
|
1937
|
+
project('foo:bar:baz').iml.suffix.should == "-mid"
|
1938
|
+
end
|
1939
|
+
|
1940
|
+
it "does not modify the parent's IML settings" do
|
1941
|
+
project('foo').iml.suffix.should == "-top"
|
1942
|
+
end
|
1943
|
+
|
1944
|
+
it "works even when the parent has no IML" do
|
1945
|
+
lambda {
|
1946
|
+
define "a" do
|
1947
|
+
project.no_iml
|
1948
|
+
define "b" do
|
1949
|
+
iml.suffix = "-alone"
|
1950
|
+
end
|
1951
|
+
end
|
1952
|
+
}.should_not raise_error
|
1953
|
+
end
|
1954
|
+
|
1955
|
+
it "inherits from the first ancestor which has an IML" do
|
1956
|
+
define "a" do
|
1957
|
+
iml.suffix = "-a"
|
1958
|
+
define "b" do
|
1959
|
+
iml.suffix = "-b"
|
1960
|
+
define "c" do
|
1961
|
+
project.no_iml
|
1962
|
+
define "d" do
|
1963
|
+
project.no_iml
|
1964
|
+
define "e" do
|
1965
|
+
project.no_iml
|
1966
|
+
define "f" do
|
1967
|
+
end
|
1968
|
+
end
|
1969
|
+
end
|
1970
|
+
end
|
1971
|
+
end
|
1972
|
+
end
|
1973
|
+
|
1974
|
+
project("a:b:c:d:e:f").iml.suffix.should == "-b"
|
1975
|
+
end
|
1976
|
+
end
|
1977
|
+
end
|
1978
|
+
|
1979
|
+
end
|