    1   /*
    2    * Copyright 2004-2009 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.internal.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  		@Override
    34  		protected void initialize() {
    35  		}
    36
    37  	};
    38
    39  	public String attr1;
    40  	public String attr2;
    41  	public String attr3;
    42  	public boolean executedInitalizeMethod = false;
    43  	public boolean executedPrerenderMethod = false;
    44
    45  	@Override
    46  	public void initialize() {
    47  		super.initialize();
    48  		executedInitalizeMethod = true;
    49  	}
    50
    51  	@Override
    52  	public void prerender() {
    53  		super.prerender();
    54  		executedPrerenderMethod =  true;
    55  	}
    56
    57  	@Validation(errorPage="error.jsp", rules="validation1")
    58  	@Form
    59  	public ActionResult dummy1() {
    60  		return new Forward("dummy1.jsp");
    61  	}
    62
    63  	public ActionResult dummy2() {
    64  		return new Redirect("dummy2");
    65  	}
    66
    67  	@Validation(errorPage="error.jsp", rules="validation2")
    68  	@Form
    69  	public ActionResult dummy3() {
    70  		return new Forward("dummy1.jsp");
    71  	}
    72
    73  	@Form
    74  	public ActionResult index() {
    75  		return new Forward("dummy1.jsp");
    76  	}
    77
    78  	@Path("todo/lists")
    79  	public ActionResult todolist() {
    80  		return new Forward("dummy1.jsp");
    81  	}
    82
    83  	@Path("/tasklists")
    84  	public ActionResult tasklist() {
    85  		return new Forward("dummy1.jsp");
    86  	}
    87  }