Package org.apache.struts.config.impl

Examples of org.apache.struts.config.impl.ModuleConfigImpl


     * @see TestCase#setUp()
     */
    protected void setUp() throws Exception {
        context = new MockActionContext();

        ModuleConfigImpl moduleConfig = new ModuleConfigImpl("/");

        context.setModuleConfig(moduleConfig);

        FormBeanConfig fooFBC = new FormBeanConfig();

        fooFBC.setName("foo");
        fooFBC.setType("org.apache.struts.mock.MockFormBean");
        moduleConfig.addFormBeanConfig(fooFBC);

        FormBeanConfig barFBC = new FormBeanConfig();

        barFBC.setName("bar");
        barFBC.setType("org.apache.struts.action.DynaActionForm"); // use a different type so we can verify lookups better

        FormPropertyConfig fpc = new FormPropertyConfig();

        fpc.setName("property");
        fpc.setType("java.lang.String");
        fpc.setInitial("test");
        barFBC.addFormPropertyConfig(fpc);
        moduleConfig.addFormBeanConfig(barFBC);

        ActionConfig testActionConfig = new ActionConfig();

        testActionConfig.setPath("/Test");
        testActionConfig.setName("foo");
        testActionConfig.setScope("request");
        moduleConfig.addActionConfig(testActionConfig);

        moduleConfig.freeze(); // otherwise, ActionConfigMatcher will be null and we'll get an NPE...
    }
View Full Code Here


     *
     * "/myapp", "/foo", null, null,
     */
    public void setUp() {
        // -- default Module
        this.moduleConfig = new ModuleConfigImpl("");
        this.moduleConfig.addForwardConfig(new ForwardConfig("foo", "/bar.jsp",
                false));
        this.moduleConfig.addForwardConfig(new ForwardConfig("relative1",
                "relative.jsp", false));
        this.moduleConfig.addForwardConfig(new ForwardConfig("relative2",
                "relative.jsp", false));
        this.moduleConfig.addForwardConfig(new ForwardConfig("external",
                "http://struts.apache.org/", false));

        // -- module "/2"
        this.moduleConfig2 = new ModuleConfigImpl("/2");
        this.moduleConfig2.addForwardConfig(new ForwardConfig("foo",
                "/baz.jsp", false));
        this.moduleConfig2.addForwardConfig(new ForwardConfig("relative1",
                "relative.jsp", false));
        this.moduleConfig2.addForwardConfig(new ForwardConfig("relative2",
                "relative.jsp", false));
        this.moduleConfig2.addForwardConfig(new ForwardConfig("external",
                "http://struts.apache.org/", false));

        // -- module "/3"
        this.moduleConfig3 = new ModuleConfigImpl("/3");

        // -- configure the ServletContext
        this.servletContext = new MockServletContext();
        this.servletContext.setAttribute(Globals.MODULE_KEY, moduleConfig);
        this.servletContext.setAttribute(Globals.MODULE_KEY + "/2",
View Full Code Here

    }

    // ----public ModuleConfig getModuleConfig(PageContext pageContext)
    public void testModuleConfig_getModuleConfig_PageContext() {
        MockServletConfig mockServletConfig = new MockServletConfig();
        ModuleConfig moduleConfig = new ModuleConfigImpl("");
        MockServletContext mockServletContext = new MockServletContext();
        MockHttpServletRequest mockHttpServletRequest =
            new MockHttpServletRequest();
        MockHttpServletResponse mockHttpServletResponse =
            new MockHttpServletResponse();
View Full Code Here

        pageContext.getResponseReturn = response;
        servletConfig = new ServletConfigSimulator();
        FieldAccessor.set(actionServlet, "config", servletConfig);
        pageContext.getServletConfigReturn = servletConfig;
        servletContext = new XServletContextSimulator();
        servletContext.setAttribute(Globals.MODULE_KEY, new ModuleConfigImpl(""));
        FieldAccessor.set(servletConfig, "context", servletContext);
        servletContext.setAttribute(Globals.MESSAGES_KEY, resources);
        pageContext.getServletContextReturn = servletContext;
        pageContext.getSessionReturn = request.getSession();
        jspWriter = new MockJspWriter();
View Full Code Here

    }

    public void setForward(String name, String path) {
        ModuleConfig config = mapping.getModuleConfig();
        if (config == null) {
            config = new ModuleConfigImpl("");
            mapping.setModuleConfig(config);
        }
        ForwardConfig forwardConfig = config.findForwardConfig(name);
        if (forwardConfig == null) {
            config.addForwardConfig(new ActionForward(name, path, false));
View Full Code Here

        for (int i = 0; i < dynaProperties.length; i++) {
            beanConfig.addFormPropertyConfig(dynaProperties[i]);
        }
       
        // Create a temporary ModuleConfig
        ModuleConfigImpl moduleConfig = new ModuleConfigImpl("");

        // Construct a corresponding DynaActionFormClass
        dynaClass = new DynaActionFormClass(beanConfig);

    }
View Full Code Here

        for (int i = 0; i < dynaProperties.length; i++) {
            beanConfig.addFormPropertyConfig(dynaProperties[i]);
        }
       
        // Create a temporary ModuleConfig
        ModuleConfigImpl moduleConfig = new ModuleConfigImpl("");

        // Construct a corresponding DynaActionFormClass
        dynaClass = new DynaActionFormClass(beanConfig);

    }
View Full Code Here

     *
     * "/myapp", "/foo", null, null,
     */
    public void setUp() {
        // -- default Module
        this.moduleConfig = new ModuleConfigImpl("");
        this.moduleConfig.addForwardConfig(new ForwardConfig("foo", "/bar.jsp",
                false));
        this.moduleConfig.addForwardConfig(new ForwardConfig("relative1",
                "relative.jsp", false));
        this.moduleConfig.addForwardConfig(new ForwardConfig("relative2",
                "relative.jsp", false));
        this.moduleConfig.addForwardConfig(new ForwardConfig("external",
                "http://struts.apache.org/", false));

        // -- module "/2"
        this.moduleConfig2 = new ModuleConfigImpl("/2");
        this.moduleConfig2.addForwardConfig(new ForwardConfig("foo",
                "/baz.jsp", false));
        this.moduleConfig2.addForwardConfig(new ForwardConfig("relative1",
                "relative.jsp", false));
        this.moduleConfig2.addForwardConfig(new ForwardConfig("relative2",
                "relative.jsp", false));
        this.moduleConfig2.addForwardConfig(new ForwardConfig("external",
                "http://struts.apache.org/", false));

        // -- module "/3"
        this.moduleConfig3 = new ModuleConfigImpl("/3");

        // -- configure the ServletContext
        this.servletContext = new MockServletContext();
        this.servletContext.setAttribute(Globals.MODULE_KEY, moduleConfig);
        this.servletContext.setAttribute(Globals.MODULE_KEY + "/2",
View Full Code Here

     * @see TestCase#setUp()
     */
    protected void setUp() throws Exception {
        context = new MockActionContext();

        ModuleConfigImpl moduleConfig = new ModuleConfigImpl("/");

        context.setModuleConfig(moduleConfig);

        FormBeanConfig fooFBC = new FormBeanConfig();

        fooFBC.setName("foo");
        fooFBC.setType("org.apache.struts.mock.MockFormBean");
        moduleConfig.addFormBeanConfig(fooFBC);

        FormBeanConfig barFBC = new FormBeanConfig();

        barFBC.setName("bar");
        barFBC.setType("org.apache.struts.action.DynaActionForm"); // use a different type so we can verify lookups better

        FormPropertyConfig fpc = new FormPropertyConfig();

        fpc.setName("property");
        fpc.setType("java.lang.String");
        fpc.setInitial("test");
        barFBC.addFormPropertyConfig(fpc);
        moduleConfig.addFormBeanConfig(barFBC);

        ActionConfig testActionConfig = new ActionConfig();

        testActionConfig.setPath("/Test");
        testActionConfig.setName("foo");
        testActionConfig.setScope("request");
        moduleConfig.addActionConfig(testActionConfig);

        moduleConfig.freeze(); // otherwise, ActionConfigMatcher will be null and we'll get an NPE...
    }
View Full Code Here

    }

    // ----public ModuleConfig getModuleConfig(PageContext pageContext)
    public void testModuleConfig_getModuleConfig_PageContext() {
        MockServletConfig mockServletConfig = new MockServletConfig();
        ModuleConfig moduleConfig = new ModuleConfigImpl("");
        MockServletContext mockServletContext = new MockServletContext();
        MockHttpServletRequest mockHttpServletRequest =
            new MockHttpServletRequest();
        MockHttpServletResponse mockHttpServletResponse =
            new MockHttpServletResponse();
View Full Code Here

TOP

Related Classes of org.apache.struts.config.impl.ModuleConfigImpl

Copyright © 2018 www.massapicom. 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.