1   /*
2    * Copyright 2004-2008 the Seasar Foundation and the Others.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * 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,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  package org.seasar.cubby.interceptor;
17  
18  import java.util.Map;
19  
20  import org.junit.Assert;
21  import org.seasar.cubby.action.Action;
22  import org.seasar.cubby.action.ActionErrors;
23  import org.seasar.cubby.action.ActionResult;
24  import org.seasar.cubby.action.Forward;
25  import org.seasar.cubby.action.Path;
26  import org.seasar.cubby.action.Validation;
27  import org.seasar.cubby.validator.DefaultValidationRules;
28  import org.seasar.cubby.validator.ValidationRule;
29  import org.seasar.cubby.validator.ValidationRules;
30  
31  @Path("bar")
32  public class ActionMethodCallInActionMethodAction extends Action {
33  
34  	public int count = 0;
35  
36  	public ValidationRules validationRules = new DefaultValidationRules() {
37  
38  		@Override
39  		public void initialize() {
40  			add(new ValidationRule() {
41  
42  				public void apply(Map<String, Object[]> params, Object form,
43  						ActionErrors errors) {
44  					Assert.assertEquals(0, count);
45  				}
46  
47  			});
48  		}
49  
50  	};
51  
52  	@Validation(rules = "validationRules", errorPage = "error.jsp")
53  	public ActionResult entry() {
54  		return top();
55  	}
56  
57  	public ActionResult top() {
58  		return new Forward("top.jsp");
59  	}
60  
61  }