1 package org.apache.turbine.modules.actions;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22
23 import static org.junit.Assert.assertNotNull;
24
25 import org.apache.commons.logging.Log;
26 import org.apache.commons.logging.LogFactory;
27 import org.apache.turbine.pipeline.PipelineData;
28 import org.apache.turbine.util.RunData;
29 import org.apache.velocity.context.Context;
30 /**
31 * This action is used to test the secure action methods.
32 *
33 * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
34 */
35 public class VelocitySecureActionDoesNothing extends VelocitySecureAction
36 {
37 private static Log log = LogFactory.getLog(VelocitySecureActionDoesNothing.class);
38 public static int numberOfCalls;
39 public static int pipelineDataCalls;
40 public static int isAuthorizedCalls;
41
42 /**
43 * Default action is throw an exception.
44 *
45 * @param pipelineData Current RunData information
46 * @param context Context to populate
47 * @exception Exception Thrown on error
48 */
49 @Override
50 public void doPerform(PipelineData pipelineData, Context context) throws Exception
51 {
52 log.debug("Calling doPerform(PipelineData)");
53 VelocitySecureActionDoesNothing.numberOfCalls++;
54 RunData rd = (RunData)pipelineData;
55 assertNotNull("PipelineData object was Null.", rd);
56 VelocitySecureActionDoesNothing.pipelineDataCalls++;
57 }
58
59 /**
60 * @see org.apache.turbine.modules.actions.VelocitySecureAction#isAuthorized(org.apache.turbine.pipeline.PipelineData)
61 */
62 @Override
63 protected boolean isAuthorized(PipelineData pipelineData) throws Exception
64 {
65 log.debug("Calling isAuthorized(PipelineData)");
66 VelocitySecureActionDoesNothing.isAuthorizedCalls++;
67 return true;
68 }
69 }