use of com.opensymphony.xwork2.config.providers.MockConfigurationProvider in project struts by apache.
the class SimpleActionValidationTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
XmlConfigurationProvider provider = new StrutsXmlConfigurationProvider("xwork-test-beans.xml");
container.inject(provider);
loadConfigurationProviders(provider, new MockConfigurationProvider());
}
use of com.opensymphony.xwork2.config.providers.MockConfigurationProvider in project struts by apache.
the class StringValidatorTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
loadConfigurationProviders(new MockConfigurationProvider());
ActionConfig config = new ActionConfig.Builder("", "name", "").build();
ActionInvocation invocation = EasyMock.createNiceMock(ActionInvocation.class);
ActionProxy proxy = EasyMock.createNiceMock(ActionProxy.class);
EasyMock.expect(invocation.getProxy()).andReturn(proxy).anyTimes();
EasyMock.expect(invocation.getAction()).andReturn(null).anyTimes();
EasyMock.expect(invocation.invoke()).andReturn(Action.SUCCESS).anyTimes();
EasyMock.expect(proxy.getMethod()).andReturn("execute").anyTimes();
EasyMock.expect(proxy.getConfig()).andReturn(config).anyTimes();
EasyMock.replay(invocation);
EasyMock.replay(proxy);
ActionContext.getContext().withActionInvocation(invocation);
tpf = container.getInstance(TextProviderFactory.class);
}
use of com.opensymphony.xwork2.config.providers.MockConfigurationProvider in project struts by apache.
the class DoubleRangeFieldValidatorTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
XmlConfigurationProvider provider = new StrutsXmlConfigurationProvider("xwork-default.xml");
container.inject(provider);
loadConfigurationProviders(provider, new MockConfigurationProvider());
val = new DoubleRangeFieldValidator();
val.setValueStack(ActionContext.getContext().getValueStack());
ActionContext.getContext().setParameters(HttpParameters.create().build());
tpf = container.getInstance(TextProviderFactory.class);
}
use of com.opensymphony.xwork2.config.providers.MockConfigurationProvider in project struts by apache.
the class ConfigurationTest method testMultipleConfigProviders.
public void testMultipleConfigProviders() {
configurationManager.addContainerProvider(new MockConfigurationProvider());
try {
configurationManager.reload();
} catch (ConfigurationException e) {
e.printStackTrace();
fail();
}
RuntimeConfiguration configuration = configurationManager.getConfiguration().getRuntimeConfiguration();
// check that it has configuration from xml
assertNotNull(configuration.getActionConfig("/foo/bar", "Bar"));
// check that it has configuration from MockConfigurationProvider
assertNotNull(configuration.getActionConfig("", MockConfigurationProvider.FOO_ACTION_NAME));
}
use of com.opensymphony.xwork2.config.providers.MockConfigurationProvider in project struts by apache.
the class LocaleAwareTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
XmlConfigurationProvider configurationProvider = new StrutsXmlConfigurationProvider("xwork-test-beans.xml");
container.inject(configurationProvider);
loadConfigurationProviders(configurationProvider, new MockConfigurationProvider());
ValueStack stack = container.getInstance(ValueStackFactory.class).createValueStack();
stack.getActionContext().withContainer(container);
ActionContext.of(stack.getContext()).bind();
}
Aggregations