Package net.jsunit.interceptor

Source Code of net.jsunit.interceptor.RemoteServerHitterInterceptor

package net.jsunit.interceptor;

import com.opensymphony.xwork.Action;
import net.jsunit.RemoteMachineServerHitter;
import net.jsunit.RemoteServerHitter;
import net.jsunit.action.RemoteRunnerHitterAware;

public class RemoteServerHitterInterceptor extends JsUnitInterceptor {

    public interface RemoteServerHitterFactory {
        public RemoteServerHitter create();
    }

    private static class DefaultRemoteServerHitterFactory implements RemoteServerHitterFactory {

        public RemoteServerHitter create() {
            return new RemoteMachineServerHitter();
        }
    }

    public static RemoteServerHitterFactory factory = new DefaultRemoteServerHitterFactory();

    public static void resetFactory() {
        factory = new DefaultRemoteServerHitterFactory();
    }

    protected void execute(Action targetAction) throws Exception {
        RemoteRunnerHitterAware aware = ((RemoteRunnerHitterAware) targetAction);
        aware.setRemoteServerHitter(factory.create());
    }

}
TOP

Related Classes of net.jsunit.interceptor.RemoteServerHitterInterceptor

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.