@@ -2,12 +2,12 @@ package org.codehaus.groovy.grails.web.filters
22
33import grails.web.CamelCaseUrlConverter
44import grails.web.UrlConverter
5-
65import org.codehaus.groovy.grails.commons.DefaultGrailsApplication
6+ import org.codehaus.groovy.grails.plugins.web.filters.FilterConfig
77import org.codehaus.groovy.grails.plugins.web.filters.FilterToHandlerAdapter
88import org.codehaus.groovy.grails.support.MockApplicationContext
99
10- /**
10+ /**
1111 * @author Graeme Rocher
1212 * @since 1.0
1313 */
@@ -23,20 +23,19 @@ class FilterToHandlerAdapterTests extends GroovyTestCase {
2323
2424 void testURIMapping () {
2525 def filterAdapter = new FilterToHandlerAdapter ()
26- filterAdapter. filterConfig = new Expando ()
27- filterAdapter. filterConfig. scope = new Expando ()
26+ filterAdapter. filterConfig = new FilterConfig ()
2827 filterAdapter. filterConfig. scope. uri = " /restricted/**"
2928 filterAdapter. afterPropertiesSet()
3029
3130 assert filterAdapter. accept(" Ignore" , " index" , " /restricted/1" )
31+ assert filterAdapter. accept(" Ignore" , " index" , " /restricted;" )
3232 assert filterAdapter. accept(" Ignore" , " index" , " /restricted/1/2" )
3333 assert ! filterAdapter. accept(" Ignore" , " index" , " /foo/1/2" )
3434 }
3535
3636 void testURIMapping2 () {
3737 def filterAdapter = new FilterToHandlerAdapter ()
38- filterAdapter. filterConfig = new Expando ()
39- filterAdapter. filterConfig. scope = new Expando ()
38+ filterAdapter. filterConfig = new FilterConfig ()
4039 filterAdapter. filterConfig. scope. controller = " trol"
4140 filterAdapter. filterConfig. scope. find = true
4241 filterAdapter. afterPropertiesSet()
@@ -49,8 +48,7 @@ class FilterToHandlerAdapterTests extends GroovyTestCase {
4948
5049 void testURIMapping3 () {
5150 def filterAdapter = new FilterToHandlerAdapter ()
52- filterAdapter. filterConfig = new Expando ()
53- filterAdapter. filterConfig. scope = new Expando ()
51+ filterAdapter. filterConfig = new FilterConfig ()
5452 filterAdapter. filterConfig. scope. controller = " .*trol.*"
5553 filterAdapter. filterConfig. scope. action = " index"
5654 filterAdapter. filterConfig. scope. invert = true
@@ -66,8 +64,7 @@ class FilterToHandlerAdapterTests extends GroovyTestCase {
6664
6765 void testDefaultActionWithControllerMatchAndActionWildcard () {
6866 def filterAdapter = new FilterToHandlerAdapter ()
69- filterAdapter. filterConfig = new Expando ()
70- filterAdapter. filterConfig. scope = new Expando ()
67+ filterAdapter. filterConfig = new FilterConfig ()
7168 filterAdapter. filterConfig. scope. controller = " demo"
7269 filterAdapter. filterConfig. scope. action = " *"
7370 filterAdapter. afterPropertiesSet()
@@ -77,8 +74,7 @@ class FilterToHandlerAdapterTests extends GroovyTestCase {
7774
7875 void testDefaultActionWithControllerMismatchAndActionWildcard () {
7976 def filterAdapter = new FilterToHandlerAdapter ()
80- filterAdapter. filterConfig = new Expando ()
81- filterAdapter. filterConfig. scope = new Expando ()
77+ filterAdapter. filterConfig = new FilterConfig ()
8278 filterAdapter. filterConfig. scope. controller = " demo"
8379 filterAdapter. filterConfig. scope. action = " *"
8480 filterAdapter. afterPropertiesSet()
@@ -88,8 +84,7 @@ class FilterToHandlerAdapterTests extends GroovyTestCase {
8884
8985 void testDefaultActionWithControllerMatchAndActionMismatch () {
9086 def filterAdapter = new FilterToHandlerAdapter ()
91- filterAdapter. filterConfig = new Expando ()
92- filterAdapter. filterConfig. scope = new Expando ()
87+ filterAdapter. filterConfig = new FilterConfig ()
9388 filterAdapter. filterConfig. scope. controller = " demo"
9489 filterAdapter. filterConfig. scope. action = " foo"
9590 filterAdapter. afterPropertiesSet()
@@ -104,8 +99,7 @@ class FilterToHandlerAdapterTests extends GroovyTestCase {
10499 application. mainContext = mainContext
105100 application. initialise()
106101 def filterAdapter = new FilterToHandlerAdapter (grailsApplication : application)
107- filterAdapter. filterConfig = new Expando ()
108- filterAdapter. filterConfig. scope = new Expando ()
102+ filterAdapter. filterConfig = new FilterConfig ()
109103 filterAdapter. filterConfig. scope. controller = " demo"
110104 filterAdapter. filterConfig. scope. action = " index"
111105 filterAdapter. afterPropertiesSet()
@@ -115,8 +109,7 @@ class FilterToHandlerAdapterTests extends GroovyTestCase {
115109
116110 void testDefaultActionWithControllerMatchAndNoActionSpecifiedInConfig () {
117111 def filterAdapter = new FilterToHandlerAdapter ()
118- filterAdapter. filterConfig = new Expando ()
119- filterAdapter. filterConfig. scope = new Expando ()
112+ filterAdapter. filterConfig = new FilterConfig ()
120113 filterAdapter. filterConfig. scope. controller = " demo"
121114 filterAdapter. afterPropertiesSet()
122115
@@ -125,8 +118,7 @@ class FilterToHandlerAdapterTests extends GroovyTestCase {
125118
126119 void testAppRootWithWildcardedControllerAndAction () {
127120 def filterAdapter = new FilterToHandlerAdapter ()
128- filterAdapter. filterConfig = new Expando ()
129- filterAdapter. filterConfig. scope = new Expando ()
121+ filterAdapter. filterConfig = new FilterConfig ()
130122 filterAdapter. filterConfig. scope. controller = " *"
131123 filterAdapter. filterConfig. scope. action = " *"
132124 filterAdapter. afterPropertiesSet()
@@ -136,8 +128,7 @@ class FilterToHandlerAdapterTests extends GroovyTestCase {
136128
137129 void testAppRootWithWildcardedControllerAndActionRegex () {
138130 def filterAdapter = new FilterToHandlerAdapter ()
139- filterAdapter. filterConfig = new Expando ()
140- filterAdapter. filterConfig. scope = new Expando ()
131+ filterAdapter. filterConfig = new FilterConfig ()
141132 filterAdapter. filterConfig. scope. controller = " .*"
142133 filterAdapter. filterConfig. scope. action = " .*"
143134 filterAdapter. filterConfig. scope. regex = true
@@ -148,8 +139,7 @@ class FilterToHandlerAdapterTests extends GroovyTestCase {
148139
149140 void testAppRootWithWildcardedControllerAndNoAction () {
150141 def filterAdapter = new FilterToHandlerAdapter ()
151- filterAdapter. filterConfig = new Expando ()
152- filterAdapter. filterConfig. scope = new Expando ()
142+ filterAdapter. filterConfig = new FilterConfig ()
153143 filterAdapter. filterConfig. scope. controller = " *"
154144 filterAdapter. afterPropertiesSet()
155145
@@ -158,8 +148,7 @@ class FilterToHandlerAdapterTests extends GroovyTestCase {
158148
159149 void testAppRootWithWildcardedControllerAndSpecificAction () {
160150 def filterAdapter = new FilterToHandlerAdapter ()
161- filterAdapter. filterConfig = new Expando ()
162- filterAdapter. filterConfig. scope = new Expando ()
151+ filterAdapter. filterConfig = new FilterConfig ()
163152 filterAdapter. filterConfig. scope. controller = " *"
164153 filterAdapter. filterConfig. scope. action = " something"
165154 filterAdapter. afterPropertiesSet()
@@ -169,15 +158,15 @@ class FilterToHandlerAdapterTests extends GroovyTestCase {
169158
170159 void testAppRootWithSpecificControllerAndWildcardedAction () {
171160 def filterAdapter = new FilterToHandlerAdapter ()
172- filterAdapter. filterConfig = new Expando ()
173- filterAdapter. filterConfig. scope = new Expando ()
161+ filterAdapter. filterConfig = new FilterConfig ()
174162 filterAdapter. filterConfig. scope. controller = " something"
175163 filterAdapter. filterConfig. scope. action = " *"
176164 filterAdapter. afterPropertiesSet()
177165
178166 assertFalse filterAdapter. accept(null , null , ' /' )
179167 }
180168}
169+
181170class DemoController {
182171 def index = {}
183172}
0 commit comments