use of com.opensymphony.xwork2.util.Bar in project struts by apache.
the class PropertyTest method testDefaultShouldBeOutputIfPropertyIsNull.
public void testDefaultShouldBeOutputIfPropertyIsNull() {
final ValueStack stack = ActionContext.getContext().getValueStack();
stack.push(new FooBar(null, "bar-value"));
final Property property = new Property(stack);
property.setDefault("default");
property.setValue("foo");
assertPropertyOutput("default", property);
}
use of com.opensymphony.xwork2.util.Bar in project struts by apache.
the class PropertyTest method testNormalBehaviour.
public void testNormalBehaviour() {
final ValueStack stack = ActionContext.getContext().getValueStack();
stack.push(new FooBar("foo-value", "bar-value"));
final Property property = new Property(stack);
property.setDefault("default");
property.setValue("foo");
assertPropertyOutput("foo-value", property);
}
use of com.opensymphony.xwork2.util.Bar in project struts by apache.
the class UIBeanTest method testGetThemeFromContext.
public void testGetThemeFromContext() {
ValueStack stack = ActionContext.getContext().getValueStack();
MockHttpServletRequest req = new MockHttpServletRequest();
MockHttpServletResponse res = new MockHttpServletResponse();
Map<String, Object> context = Collections.singletonMap("theme", "bar");
ActionContext.getContext().put("attr", context);
TextField txtFld = new TextField(stack, req, res);
assertEquals("bar", txtFld.getTheme());
}
use of com.opensymphony.xwork2.util.Bar in project struts by apache.
the class CoopInterceptorTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
container.inject(interceptor);
interceptor.setExemptedPaths("/foo,/bar");
ServletActionContext.setRequest(request);
ServletActionContext.setResponse(response);
ActionContext context = ServletActionContext.getActionContext();
mai.setInvocationContext(context);
}
use of com.opensymphony.xwork2.util.Bar in project struts by apache.
the class PropertiesConfigurationProviderTest method testRegister_DifferentLocale.
public void testRegister_DifferentLocale() {
ContainerBuilder builder = new ContainerBuilder();
builder.constant("foo", "bar");
builder.constant("struts.locale", "de_DE");
PropertiesConfigurationProvider prov = new PropertiesConfigurationProvider();
prov.register(builder, new LocatableProperties());
Container container = builder.create(true);
String localeStr = container.getInstance(String.class, StrutsConstants.STRUTS_LOCALE);
Locale locale = LocaleUtils.toLocale(localeStr);
assertNotNull(locale);
assertEquals("DE", locale.getCountry());
assertEquals("de", locale.getLanguage());
}
Aggregations