Search in sources :

Example 21 with ConfigurationProvider

use of com.opensymphony.xwork2.config.ConfigurationProvider in project struts by apache.

the class WildCardResultTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    // ensure we're using the default configuration, not simple config
    XmlConfigurationProvider configurationProvider = new StrutsXmlConfigurationProvider("xwork-sample.xml");
    container.inject(configurationProvider);
    loadConfigurationProviders(configurationProvider);
}
Also used : StrutsXmlConfigurationProvider(org.apache.struts2.config.StrutsXmlConfigurationProvider) XmlConfigurationProvider(com.opensymphony.xwork2.config.providers.XmlConfigurationProvider) StrutsXmlConfigurationProvider(org.apache.struts2.config.StrutsXmlConfigurationProvider)

Example 22 with ConfigurationProvider

use of com.opensymphony.xwork2.config.ConfigurationProvider in project struts by apache.

the class ConfigurationManagerTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    configurationManager.destroyConfiguration();
    configProviderMock = new Mock(ConfigurationProvider.class);
    configProviderMock.matchAndReturn("equals", C.ANY_ARGS, false);
    ConfigurationProvider mockProvider = (ConfigurationProvider) configProviderMock.proxy();
    configurationManager.addContainerProvider(new StrutsDefaultConfigurationProvider());
    configurationManager.addContainerProvider(mockProvider);
    // the first time it always inits
    configProviderMock.expect("init", C.isA(Configuration.class));
    configProviderMock.expect("register", C.ANY_ARGS);
    configProviderMock.expect("loadPackages", C.ANY_ARGS);
    configProviderMock.matchAndReturn("toString", "mock");
    configuration = configurationManager.getConfiguration();
}
Also used : StrutsDefaultConfigurationProvider(com.opensymphony.xwork2.config.providers.StrutsDefaultConfigurationProvider) StrutsDefaultConfigurationProvider(com.opensymphony.xwork2.config.providers.StrutsDefaultConfigurationProvider) Mock(com.mockobjects.dynamic.Mock)

Example 23 with ConfigurationProvider

use of com.opensymphony.xwork2.config.ConfigurationProvider in project struts by apache.

the class DefaultActionInvocationTester method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    // ensure we're using the default configuration, not simple config
    XmlConfigurationProvider configurationProvider = new StrutsXmlConfigurationProvider("xwork-sample.xml");
    container.inject(configurationProvider);
    loadConfigurationProviders(configurationProvider);
}
Also used : StrutsXmlConfigurationProvider(org.apache.struts2.config.StrutsXmlConfigurationProvider) XmlConfigurationProvider(com.opensymphony.xwork2.config.providers.XmlConfigurationProvider) StrutsXmlConfigurationProvider(org.apache.struts2.config.StrutsXmlConfigurationProvider)

Example 24 with ConfigurationProvider

use of com.opensymphony.xwork2.config.ConfigurationProvider in project struts by apache.

the class DefaultClasstTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    // ensure we're using the default configuration, not simple config
    XmlConfigurationProvider configurationProvider = new StrutsXmlConfigurationProvider("xwork-sample.xml");
    container.inject(configurationProvider);
    loadConfigurationProviders(configurationProvider);
}
Also used : StrutsXmlConfigurationProvider(org.apache.struts2.config.StrutsXmlConfigurationProvider) XmlConfigurationProvider(com.opensymphony.xwork2.config.providers.XmlConfigurationProvider) StrutsXmlConfigurationProvider(org.apache.struts2.config.StrutsXmlConfigurationProvider)

Example 25 with ConfigurationProvider

use of com.opensymphony.xwork2.config.ConfigurationProvider in project struts by apache.

the class XmlConfigurationProviderActionsTest method testDefaultActionClass.

public void testDefaultActionClass() throws Exception {
    final String filename = "com/opensymphony/xwork2/config/providers/xwork-test-actions.xml";
    final String testDefaultClassName = "com.opensymphony.xwork2.ActionSupport";
    ConfigurationProvider provider = buildConfigurationProvider(filename);
    // setup expectations
    params.put("foo", "17");
    params.put("bar", "23");
    ActionConfig barWithoutClassNameConfig = new ActionConfig.Builder("", "BarWithoutClassName", "").addParams(params).build();
    // execute the configuration
    provider.init(configuration);
    PackageConfig pkg = configuration.getPackageConfig("default");
    Map actionConfigs = pkg.getActionConfigs();
    // assertions
    assertEquals(7, actionConfigs.size());
    assertEquals(barWithoutClassNameConfig, actionConfigs.get("BarWithoutClassName"));
}
Also used : ConfigurationProvider(com.opensymphony.xwork2.config.ConfigurationProvider) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

ConfigurationProvider (com.opensymphony.xwork2.config.ConfigurationProvider)41 PackageConfig (com.opensymphony.xwork2.config.entities.PackageConfig)22 StrutsXmlConfigurationProvider (org.apache.struts2.config.StrutsXmlConfigurationProvider)21 Map (java.util.Map)12 ActionConfig (com.opensymphony.xwork2.config.entities.ActionConfig)11 XmlConfigurationProvider (com.opensymphony.xwork2.config.providers.XmlConfigurationProvider)10 HashMap (java.util.HashMap)9 ConfigurationException (com.opensymphony.xwork2.config.ConfigurationException)7 ResultConfig (com.opensymphony.xwork2.config.entities.ResultConfig)6 File (java.io.File)6 InterceptorMapping (com.opensymphony.xwork2.config.entities.InterceptorMapping)5 ContainerBuilder (com.opensymphony.xwork2.inject.ContainerBuilder)5 LocatableProperties (com.opensymphony.xwork2.util.location.LocatableProperties)5 InterceptorStackConfig (com.opensymphony.xwork2.config.entities.InterceptorStackConfig)4 MockResult (com.opensymphony.xwork2.mock.MockResult)4 DefaultUnknownHandlerManager (com.opensymphony.xwork2.DefaultUnknownHandlerManager)3 SimpleAction (com.opensymphony.xwork2.SimpleAction)3 UnknownHandlerManager (com.opensymphony.xwork2.UnknownHandlerManager)3 Configuration (com.opensymphony.xwork2.config.Configuration)3 RuntimeConfiguration (com.opensymphony.xwork2.config.RuntimeConfiguration)3