use of java.util.Locale in project head by mifos.
the class SystemInformationController method viewSystemInformation.
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "NP_UNWRITTEN_FIELD", justification = "request is not null")
@RequestMapping(method = RequestMethod.GET)
public ModelAndView viewSystemInformation(HttpServletRequest request) {
ServletContext context = request.getSession().getServletContext();
RequestContext requestContext = new RequestContext(request);
Locale locale = requestContext.getLocale();
SystemInformationDto systemInformationDto = systemInformationServiceFacade.getSystemInformation(context, locale);
Map<String, Object> model = new HashMap<String, Object>();
model.put("request", request);
model.put("systemInformationDto", systemInformationDto);
Map<String, Object> status = new HashMap<String, Object>();
List<String> errorMessages = new ArrayList<String>();
status.put("errorMessages", errorMessages);
ModelAndView modelAndView = new ModelAndView("systemInformation", "model", model);
modelAndView.addObject("status", status);
return modelAndView;
}
use of java.util.Locale in project head by mifos.
the class LoanServiceFacadeWebTierTest method setupAndInjectDependencies.
@Before
public void setupAndInjectDependencies() {
locale = new Locale("en", "GB");
installmentBuilder = new RepaymentScheduleInstallmentBuilder(locale);
rupee = new MifosCurrency(Short.valueOf("1"), "Rupee", BigDecimal.valueOf(1), "INR");
loanServiceFacade = new LoanServiceFacadeWebTier(loanDao, loanBusinessService);
}
use of java.util.Locale in project head by mifos.
the class FiscalCalendarRulesTest method testIsWorkingDay.
@Test
public void testIsWorkingDay() {
String configWorkingDays = "MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY";
setNewWorkingDays(configWorkingDays);
// get the supported ids for GMT-08:00 (Pacific Standard Time)
String[] ids = TimeZone.getAvailableIDs(-8 * 60 * 60 * 1000);
// if no ids were returned, something is wrong. get out.
// Otherwise get an id for Pacific Standard Time
String pstId = ids[0];
// create a Pacific Standard Time time zone
SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, pstId);
// set up rules for daylight savings time
pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
// create a GregorianCalendar with the Pacific Daylight time zone
// and the current date and time
Calendar calendar = new GregorianCalendar(pdt);
try {
Locale savedLocale = Localization.getInstance().getConfiguredLocale();
new LocalizationConverter().setCurrentLocale(Locale.US);
SimpleDateFormat df = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT, Locale.US);
// Keith: DateFormat must be set to the same timezone as the
// calendar
// Otherwise dates don't roll over at the same exact time, causing
// this and several other unit tests to fail
df.setTimeZone(TimeZone.getTimeZone(pstId));
df.applyPattern("yyyy/MM/dd");
Date thursday = df.parse("2007/10/11");
calendar.setTime(thursday);
String out = thursday.toString();
out.contains("A");
new LocalizationConverter().setCurrentLocale(savedLocale);
} catch (Exception e) {
}
Assert.assertTrue(new FiscalCalendarRules().isWorkingDay(calendar));
// Friday
calendar.add(Calendar.DAY_OF_WEEK, 1);
Assert.assertTrue(new FiscalCalendarRules().isWorkingDay(calendar));
// Sat
calendar.add(Calendar.DAY_OF_WEEK, 1);
Assert.assertTrue(!new FiscalCalendarRules().isWorkingDay(calendar));
// Sunday
calendar.add(Calendar.DAY_OF_WEEK, 1);
Assert.assertTrue(!new FiscalCalendarRules().isWorkingDay(calendar));
}
use of java.util.Locale in project head by mifos.
the class ApplicationConfigurationDaoHibernateIntegrationTest method initialiseHibernateUtil.
@BeforeClass
public static void initialiseHibernateUtil() {
Locale locale = Localization.getInstance().getConfiguredLocale();
AuditConfiguration.init(locale);
oldDefaultCurrency = Money.getDefaultCurrency();
Money.setDefaultCurrency(TestUtils.RUPEE);
new StandardTestingService().setTestMode(TestMode.INTEGRATION);
}
use of java.util.Locale in project head by mifos.
the class BaseActionFormTest method xtestGetDoubleValue_is_IS.
/**
* Currently broken -- incomplete support for multiple locales for numeric
* input.
*/
@Ignore
@Test
public void xtestGetDoubleValue_is_IS() throws Exception {
Locale locale = Localization.getInstance().getConfiguredLocale();
LocalizationConverter converter = new LocalizationConverter();
double dValue = 2.34;
Assert.assertEquals(dValue, baseActionForm.getDoubleValue("2,34"));
}
Aggregations