Search in sources :

Example 51 with Locale

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;
}
Also used : Locale(java.util.Locale) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ModelAndView(org.springframework.web.servlet.ModelAndView) ServletContext(javax.servlet.ServletContext) RequestContext(org.springframework.web.servlet.support.RequestContext) SystemInformationDto(org.mifos.application.admin.servicefacade.SystemInformationDto) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 52 with Locale

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);
}
Also used : Locale(java.util.Locale) RepaymentScheduleInstallmentBuilder(org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallmentBuilder) MifosCurrency(org.mifos.application.master.business.MifosCurrency) Before(org.junit.Before)

Example 53 with Locale

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));
}
Also used : Locale(java.util.Locale) LocalizationConverter(org.mifos.framework.util.LocalizationConverter) SimpleTimeZone(java.util.SimpleTimeZone) GregorianCalendar(java.util.GregorianCalendar) Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) Test(org.junit.Test)

Example 54 with Locale

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);
}
Also used : Locale(java.util.Locale) StandardTestingService(org.mifos.framework.util.StandardTestingService) BeforeClass(org.junit.BeforeClass)

Example 55 with Locale

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"));
}
Also used : Locale(java.util.Locale) LocalizationConverter(org.mifos.framework.util.LocalizationConverter) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

Locale (java.util.Locale)5854 Test (org.junit.Test)902 HashMap (java.util.HashMap)548 GenericValue (org.apache.ofbiz.entity.GenericValue)504 ArrayList (java.util.ArrayList)486 Delegator (org.apache.ofbiz.entity.Delegator)484 GenericEntityException (org.apache.ofbiz.entity.GenericEntityException)398 IOException (java.io.IOException)313 LocalDispatcher (org.apache.ofbiz.service.LocalDispatcher)296 Date (java.util.Date)273 GenericServiceException (org.apache.ofbiz.service.GenericServiceException)271 Map (java.util.Map)244 BigDecimal (java.math.BigDecimal)214 SimpleDateFormat (java.text.SimpleDateFormat)198 ResourceBundle (java.util.ResourceBundle)197 File (java.io.File)166 LinkedList (java.util.LinkedList)158 ULocale (android.icu.util.ULocale)156 List (java.util.List)147 Test (org.junit.jupiter.api.Test)132