Skip to content

Commit ba77c1b

Browse files
committed
fix failing test
1 parent 8cd50d2 commit ba77c1b

File tree

1 file changed

+21
-31
lines changed

1 file changed

+21
-31
lines changed

grails-test-suite-uber/src/test/groovy/grails/spring/BeanBuilderTests.groovy

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -139,30 +139,28 @@ class BeanBuilderTests extends GroovyTestCase {
139139

140140
void testUseTwoSpringNamespaces() {
141141

142-
SimpleNamingContextBuilder builder = new SimpleNamingContextBuilder()
143-
try {
144-
145-
builder.bind("bar", "success")
146-
builder.activate()
147142
TestScope scope = new TestScope()
148143

149144
GenericApplicationContext appCtx = bb.getSpringConfig().getUnrefreshedApplicationContext()
150145
appCtx.getBeanFactory().registerScope("test", scope)
151146
bb.beans {
152147
xmlns aop:"http://www.springframework.org/schema/aop"
153-
xmlns jee:"http://www.springframework.org/schema/jee"
148+
xmlns util:"http://www.springframework.org/schema/util"
154149
scopedList(ArrayList) { bean ->
155150
bean.scope = "test"
156151
aop.'scoped-proxy'()
157152
}
158153

159-
jee.'jndi-lookup'(id:"foo", 'jndi-name':"bar")
154+
util.list(id:"foo") {
155+
value "one"
156+
value "two"
157+
}
160158

161159
}
162160

163161
appCtx = bb.createApplicationContext()
164162

165-
assertEquals "success", appCtx.getBean("foo")
163+
assert ['one', 'two'] == appCtx.getBean("foo")
166164

167165
assertNotNull appCtx.getBean("scopedList")
168166
assertNotNull appCtx.getBean("scopedList").size()
@@ -177,29 +175,28 @@ class BeanBuilderTests extends GroovyTestCase {
177175
appCtx.getBeanFactory().registerScope("test", scope)
178176
bb.beans {
179177
xmlns aop:"http://www.springframework.org/schema/aop",
180-
jee:"http://www.springframework.org/schema/jee"
178+
util:"http://www.springframework.org/schema/util"
181179
scopedList(ArrayList) { bean ->
182180
bean.scope = "test"
183181
aop.'scoped-proxy'()
184182
}
185183

186-
jee.'jndi-lookup'(id:"foo", 'jndi-name':"bar")
184+
util.list(id:"foo") {
185+
value "one"
186+
value "two"
187+
}
187188

188189
}
189190
appCtx = bb.createApplicationContext()
190191

191-
assertEquals "success", appCtx.getBean("foo")
192+
assert ['one', 'two'] == appCtx.getBean("foo")
192193

193194
assertNotNull appCtx.getBean("scopedList")
194195
assertNotNull appCtx.getBean("scopedList").size()
195196
assertNotNull appCtx.getBean("scopedList").size()
196197

197198
// should only be true because bean not initialized until proxy called
198199
assertEquals 4, scope.instanceCount
199-
}
200-
finally {
201-
builder.deactivate()
202-
}
203200
}
204201

205202
void testSpringAOPSupport() {
@@ -256,25 +253,18 @@ class BeanBuilderTests extends GroovyTestCase {
256253
}
257254

258255
void testSpringNamespaceBean() {
259-
260-
SimpleNamingContextBuilder builder = new SimpleNamingContextBuilder()
261-
try {
262-
263-
builder.bind("bar", "success")
264-
builder.activate()
265-
266-
bb.beans {
267-
xmlns jee:"http://www.springframework.org/schema/jee"
268-
jee.'jndi-lookup'(id:"foo", 'jndi-name':"bar")
256+
bb.beans {
257+
xmlns util:"http://www.springframework.org/schema/util"
258+
util.list(id:"foo") {
259+
value "one"
260+
value "two"
269261
}
270262

271-
ApplicationContext appCtx = bb.createApplicationContext()
272-
273-
assertEquals "success", appCtx.getBean("foo")
274-
}
275-
finally {
276-
builder.deactivate()
277263
}
264+
265+
ApplicationContext appCtx = bb.createApplicationContext()
266+
267+
assert ['one', 'two'] == appCtx.getBean("foo")
278268
}
279269

280270
void testNamedArgumentConstructor() {

0 commit comments

Comments
 (0)