Search in sources :

Example 16 with MessageResources

use of org.apache.struts.util.MessageResources in project sonarqube by SonarSource.

the class TagTestBase method putBundleInScope.

protected void putBundleInScope(int scope, boolean returnNull) {
    MessageResourcesFactory factory = MessageResourcesFactory.createFactory();
    MessageResources messageResources = new PropertyMessageResources(factory, "org.apache.struts.taglib.sample");
    messageResources.setReturnNull(returnNull);
    pageContext.setAttribute(Globals.MESSAGES_KEY, messageResources, scope);
}
Also used : PropertyMessageResources(org.apache.struts.util.PropertyMessageResources) MessageResources(org.apache.struts.util.MessageResources) PropertyMessageResources(org.apache.struts.util.PropertyMessageResources) MessageResourcesFactory(org.apache.struts.util.MessageResourcesFactory)

Example 17 with MessageResources

use of org.apache.struts.util.MessageResources in project head by mifos.

the class MifosPropertyMessageResourcesIntegrationTest method testGetMessageLocaleString.

@Test
public void testGetMessageLocaleString() {
    MifosPropertyMessageResourcesFactory factory = new MifosPropertyMessageResourcesFactory();
    MessageResources resource = factory.createResources(FilePaths.ACCOUNTS_UI_RESOURCE_PROPERTYFILE);
    // get a simple resource bundle entry
    Assert.assertEquals("Admin", resource.getMessage(TestUtils.ukLocale(), "Account.Admin"));
    // get a LookupValue
    Assert.assertEquals("Branch Office", resource.getMessage(TestUtils.ukLocale(), ConfigurationConstants.BRANCHOFFICE));
}
Also used : MessageResources(org.apache.struts.util.MessageResources) Test(org.junit.Test)

Aggregations

MessageResources (org.apache.struts.util.MessageResources)17 Locale (java.util.Locale)4 ServletContext (javax.servlet.ServletContext)4 ModuleConfig (org.apache.struts.config.ModuleConfig)4 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 JspException (javax.servlet.jsp.JspException)2 Arg (org.apache.commons.validator.Arg)2 Msg (org.apache.commons.validator.Msg)2 ActionServlet (org.apache.struts.action.ActionServlet)2 ServletActionContext (org.apache.struts.chain.contexts.ServletActionContext)2 MessageResourcesFactory (org.apache.struts.util.MessageResourcesFactory)2 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Map (java.util.Map)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 Field (org.apache.commons.validator.Field)1 ValidatorAction (org.apache.commons.validator.ValidatorAction)1 Var (org.apache.commons.validator.Var)1 ActionMapping (org.apache.struts.action.ActionMapping)1