1   /*
2    * Copyright 2004-2010 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  
17  package org.seasar.cubby.internal.util;
18  
19  import org.seasar.cubby.action.Action;
20  import org.seasar.cubby.action.ActionResult;
21  import org.seasar.cubby.action.Form;
22  import org.seasar.cubby.action.Forward;
23  import org.seasar.cubby.action.Path;
24  import org.seasar.cubby.action.Redirect;
25  import org.seasar.cubby.action.Validation;
26  import org.seasar.cubby.validator.DefaultValidationRules;
27  import org.seasar.cubby.validator.ValidationRules;
28  
29  @Path("/")
30  public class MockAction extends Action {
31  	
32  	public ValidationRules validation = new DefaultValidationRules() {
33  
34  		@Override
35  		protected void initialize() {
36  		}
37  		
38  	};
39  	
40  	public String attr1;
41  	public String attr2;
42  	public String attr3;
43  	public boolean executedInitalizeMethod = false;
44  	public boolean executedPrerenderMethod = false;
45  	
46  	@Override
47  	public void initialize() {
48  		super.initialize();
49  		executedInitalizeMethod = true;
50  	}
51  	
52  	@Override
53  	public void prerender() {
54  		super.prerender();
55  		executedPrerenderMethod =  true;
56  	}
57  	
58  	@Validation(errorPage="error.jsp", rules="validation1")
59  	@Form
60  	public ActionResult dummy1() {
61  		return new Forward("dummy1.jsp");
62  	}
63  
64  	public ActionResult dummy2() {
65  		return new Redirect("dummy2");
66  	}
67  
68  	@Validation(errorPage="error.jsp", rules="validation2")
69  	@Form
70  	public ActionResult dummy3() {
71  		return new Forward("dummy1.jsp");
72  	}
73  
74  	@Form
75  	public ActionResult index() {
76  		return new Forward("dummy1.jsp");
77  	}
78  	
79  	@Path("todo/lists")
80  	public ActionResult todolist() {
81  		return new Forward("dummy1.jsp");
82  	}
83  
84  	@Path("/tasklists")
85  	public ActionResult tasklist() {
86  		return new Forward("dummy1.jsp");
87  	}
88  }