FileDocCategorySizeDatePackage
ConfigTest.javaAPI DocExample3844Mon Jul 23 13:25:38 BST 2007example

ConfigTest

public class ConfigTest extends org.apache.struts2.StrutsTestCase

Fields Summary
Constructors Summary
Methods Summary
protected com.opensymphony.xwork2.config.entities.ActionConfigassertClass(java.lang.String namespace, java.lang.String action_name, java.lang.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;
    
protected com.opensymphony.xwork2.config.entities.ActionConfigassertClass(java.lang.String action_name, java.lang.String class_name)

        return assertClass("", action_name, class_name);
    
protected voidassertFieldError(java.util.Map field_errors, java.lang.String field_name, java.lang.String error_message)


        List errors = (List) field_errors.get(field_name);
        assertNotNull("Expected errors for " + field_name, errors);
        assertTrue("Expected errors for " + field_name, errors.size()>0);
        // TODO: Should be a loop
        assertEquals(error_message,errors.get(0));

    
protected java.util.MapassertFieldErrors(com.opensymphony.xwork2.ActionSupport action)

        assertTrue(action.hasFieldErrors());
        return action.getFieldErrors();
    
protected voidassertInput(java.lang.String result)

        assertTrue("Expected an input result!",
                ActionSupport.INPUT.equals(result));
    
protected voidassertResult(com.opensymphony.xwork2.config.entities.ActionConfig config, java.lang.String result_name, java.lang.String result_value)

        Map results = config.getResults();
        ResultConfig result = (ResultConfig) results.get(result_name);
        Map params = result.getParams();
        String value = (String) params.get("actionName");
        if (value == null)
            value = (String) params.get("location");
        assertTrue("Wrong result value: [" + value + "]",
                result_value.equals(value));
    
protected voidassertSuccess(java.lang.String result)

        assertTrue("Expected a success result!",
                ActionSupport.SUCCESS.equals(result));
    
protected voidsetUp()

        super.setUp();
        XmlConfigurationProvider c = new XmlConfigurationProvider("struts.xml");
        configurationManager.addConfigurationProvider(c);
        configurationManager.reload();
    
public voidtestConfig()

        assertNotNull(configurationManager);