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