    001    package org.apache.turbine.modules.actions;
    002
    003    /*
    004     * Licensed to the Apache Software Foundation (ASF) under one
    005     * or more contributor license agreements.  See the NOTICE file
    006     * distributed with this work for additional information
    007     * regarding copyright ownership.  The ASF licenses this file
    008     * to you under the Apache License, Version 2.0 (the
    009     * "License"); you may not use this file except in compliance
    010     * with the License.  You may obtain a copy of the License at
    011     *
    012     *   http://www.apache.org/licenses/LICENSE-2.0
    013     *
    014     * Unless required by applicable law or agreed to in writing,
    015     * software distributed under the License is distributed on an
    016     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    017     * KIND, either express or implied.  See the License for the
    018     * specific language governing permissions and limitations
    019     * under the License.
    020     */
    021
    022
    023    import junit.framework.Assert;
    024
    025    import org.apache.turbine.pipeline.PipelineData;
    026    import org.apache.turbine.util.RunData;
    027    import org.apache.velocity.context.Context;
    028    import org.apache.commons.logging.Log;
    029    import org.apache.commons.logging.LogFactory;
    030    /**
    031     * This action is used in testing the ExecutePageValve by the ExecutePageValveTest.
    032     *
    033     * @author     <a href="mailto:epugh@upstate.com">Eric Pugh</a>
    034     * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a>
    035     */
    036    public class VelocityActionDoesNothing extends VelocityAction
    037    {
    038        private static Log log = LogFactory.getLog(VelocityActionDoesNothing.class);
    039        public static int numberOfCalls;
    040        public static int runDataCalls;
    041        public static int pipelineDataCalls;
    042        /**
    043         *  Default action is throw an exception.
    044         *
    045         * @param  data           Current RunData information
    046         * @param  context        Context to populate
    047         * @exception  Exception  Thrown on error
    048         */
    049        public void doPerform(RunData data, Context context) throws Exception
    050        {
    051            log.debug("Calling doPerform");
    052                    VelocityActionDoesNothing.numberOfCalls++;
    053                    VelocityActionDoesNothing.runDataCalls++;
    054        }
    055
    056        /**
    057         *  Default action is throw an exception.
    058         *
    059         * @param  data           Current RunData information
    060         * @param  context        Context to populate
    061         * @exception  Exception  Thrown on error
    062         */
    063        public void doPerform(PipelineData pipelineData, Context context) throws Exception
    064        {
    065            log.debug("Calling doPerform(PipelineData)");
    066                    VelocityActionDoesNothing.numberOfCalls++;
    067            RunData rd = (RunData)pipelineData;
    068                    Assert.assertNotNull("RunData object was Null.", rd);
    069                    VelocityActionDoesNothing.pipelineDataCalls++;
    070        }
    071
    072    }