Examples of ActionConfig


Examples of com.opensymphony.xwork2.config.entities.ActionConfig

            return config;
        }

        private ActionConfig findActionConfigInNamespace(String namespace, String name) {
            ActionConfig config = null;
            if (namespace == null) {
                namespace = "";
            }
            Map<String, ActionConfig> actions = namespaceActionConfigs.get(namespace);
            if (actions != null) {
View Full Code Here

Examples of com.opensymphony.xwork2.config.entities.ActionConfig

        configurationManager.reload();
    }

    protected ActionConfig assertClass(String namespace, String action_name, String class_name) {
        RuntimeConfiguration configuration = configurationManager.getConfiguration().getRuntimeConfiguration();
        ActionConfig config = configuration.getActionConfig(namespace, action_name);
        assertNotNull("Mssing action", config);
        assertTrue("Wrong class name: [" + config.getClassName() + "]",
                class_name.equals(config.getClassName()));
        return config;
    }
View Full Code Here

Examples of com.opensymphony.xwork2.config.entities.ActionConfig

import java.util.Map;

public class LoginTest extends ConfigTest {

    public void FIXME_testLoginConfig() throws Exception {
        ActionConfig config = assertClass("example", "Login_input", "example.Login");
        assertResult(config, ActionSupport.SUCCESS, "Menu");
        assertResult(config, ActionSupport.INPUT, "/example/Login.jsp");
    }
View Full Code Here

Examples of com.opensymphony.xwork2.config.entities.ActionConfig

        HashMap successParams = new HashMap();
        successParams.put("propertyName", "executionCount");
        successParams.put("expectedValue", "1");

        ActionConfig executionCountActionConfig = new ActionConfig.Builder("", "", ExecutionCountTestAction.class.getName())
            .addResultConfig(new ResultConfig.Builder(Action.SUCCESS, TestResult.class.getName())
                .addParams(successParams)
                .build())
            .build();


        ActionConfig testActionConfig = new ActionConfig.Builder("", "", TestAction.class.getName())
            .addResultConfig(new ResultConfig.Builder(Action.SUCCESS, ServletDispatcherResult.class.getName())
                    .addParam("location", "success.jsp")
                    .build())
            .addInterceptor(new InterceptorMapping("params", new ParametersInterceptor()))
            .build();


        ActionConfig tokenActionConfig = new ActionConfig.Builder("", "", TestAction.class.getName())
            .addInterceptor(new InterceptorMapping("token", new TokenInterceptor()))
            .addResultConfig(new ResultConfig.Builder("invalid.token", MockResult.class.getName()).build())
            .addResultConfig(new ResultConfig.Builder("success", MockResult.class.getName()).build())
            .build();


        // empty results for token session unit test
        ActionConfig tokenSessionActionConfig = new ActionConfig.Builder("", "", TestAction.class.getName())
            .addResultConfig(new ResultConfig.Builder("invalid.token", MockResult.class.getName()).build())
            .addResultConfig(new ResultConfig.Builder("success", MockResult.class.getName()).build())
            .addInterceptor(new InterceptorMapping("tokenSession", new TokenSessionStoreInterceptor()))
            .build();
View Full Code Here

Examples of com.opensymphony.xwork2.config.entities.ActionConfig


        Map<String, ResultConfig> results=  new HashMap<String, ResultConfig>();
        results.put("myResult", resultConfig);

        ActionConfig actionConfig = new ActionConfig.Builder("", "", "")
                .addResultConfigs(results).build();

        ServletRedirectResult result = new ServletRedirectResult();
        result.setLocation("/myNamespace/myAction.action");
        result.setParse(false);
View Full Code Here

Examples of com.opensymphony.xwork2.config.entities.ActionConfig

         ResultConfig resultConfig = new ResultConfig.Builder("", "").build();

        Map<String, ResultConfig> results=  new HashMap<String, ResultConfig>();
        results.put("myResult", resultConfig);

        ActionConfig actionConfig = new ActionConfig.Builder("", "", "")
                .addResultConfigs(results).build();

        ActionContext ac = new ActionContext(Ognl.createDefaultContext(null));
        ac.put(ServletActionContext.HTTP_REQUEST, requestMock.proxy());
        ac.put(ServletActionContext.HTTP_RESPONSE, responseMock.proxy());
View Full Code Here

Examples of com.opensymphony.xwork2.config.entities.ActionConfig

        assertEquals(methodName, ac.getMethodName());
        assertEquals(packageName, ac.getPackageName());
    }

    private void verifyActionConfigInterceptors(PackageConfig pkgConfig, String actionName, String... refs) {
        ActionConfig ac = pkgConfig.getAllActionConfigs().get(actionName);
        assertNotNull(ac);
        List<InterceptorMapping> interceptorMappings = ac.getInterceptors();
        for (int i = 0; i < interceptorMappings.size(); i++) {
            InterceptorMapping interceptorMapping = interceptorMappings.get(i);
            assertEquals(refs[i], interceptorMapping.getName());
        }
    }
View Full Code Here

Examples of com.opensymphony.xwork2.config.entities.ActionConfig

        this.configuration = config;
    }
   
    public String execute() throws Exception {
        ActionContext ctx = ActionContext.getContext();
        ActionConfig actionConfig = ctx.getActionInvocation().getProxy().getConfig();
        Action action = null;
        try {
            action = (Action) objectFactory.buildBean(className, null);
        } catch (Exception e) {
            throw new StrutsException("Unable to create the legacy Struts Action", e, actionConfig);
        }
       
        // We should call setServlet() here, but let's stub that out later
       
        Struts1Factory strutsFactory = new Struts1Factory(Dispatcher.getInstance().getConfigurationManager().getConfiguration());
        ActionMapping mapping = strutsFactory.createActionMapping(actionConfig);
        HttpServletRequest request = ServletActionContext.getRequest();
        HttpServletResponse response = ServletActionContext.getResponse();
        ActionForward forward = action.execute(mapping, actionForm, request, response);
       
        ActionMessages messages = (ActionMessages) request.getAttribute(Globals.MESSAGE_KEY);
        if (messages != null) {
            for (Iterator i = messages.get(); i.hasNext(); ) {
                ActionMessage msg = (ActionMessage) i.next();
                if (msg.getValues() != null && msg.getValues().length > 0) {
                    addActionMessage(getText(msg.getKey(), Arrays.asList(msg.getValues())));
                } else {
                    addActionMessage(getText(msg.getKey()));
                }
            }
        }
       
        if (forward instanceof WrapperActionForward || actionConfig.getResults().containsKey(forward.getName())) {
            return forward.getName();
        } else {
            throw new StrutsException("Unable to handle action forwards that don't have an associated result", actionConfig);
        }
    }
View Full Code Here

Examples of com.opensymphony.xwork2.config.entities.ActionConfig

                Map<String, ActionConfig> actionConfigs = packageConfig.getAllActionConfigs();

                for (Object o : actionConfigs.keySet()) {
                    String actionName = (String) o;
                    ActionConfig baseConfig = actionConfigs.get(actionName);
                    configs.put(actionName, buildFullActionConfig(packageConfig, baseConfig));
                }

                namespaceActionConfigs.put(namespace, configs);
                if (packageConfig.getFullDefaultActionRef() != null) {
View Full Code Here

Examples of com.opensymphony.xwork2.config.entities.ActionConfig

    }

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        ActionConfig config = new ActionConfig.Builder("", "name", "").build();
        ValidateErrorAction action = EasyMock.createNiceMock(ValidateErrorAction.class);
        invocation = EasyMock.createNiceMock(ActionInvocation.class);
        interceptor = new DefaultWorkflowInterceptor();
        ActionProxy proxy = EasyMock.createNiceMock(ActionProxy.class);
View Full Code Here
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.