Example usage for java.util Locale FRANCE

List of usage examples for java.util Locale FRANCE

Introduction

In this page you can find the example usage for java.util Locale FRANCE.

Prototype

Locale FRANCE

To view the source code for java.util Locale FRANCE.

Click Source Link

Document

Useful constant for country.

Usage

From source file:fr.paris.lutece.portal.web.user.AdminUserJspBeanTest.java

public void testGetModifyUserPassword() throws AccessDeniedException, UserNotSignedException {
    AdminUserJspBean bean = new AdminUserJspBean();
    MockHttpServletRequest request = new MockHttpServletRequest();
    AdminUser user = getUserToModify();/*from   w w w  .ja va2  s.  co m*/
    try {
        AdminAuthenticationService.getInstance().registerUser(request, user);
        request.setParameter("id_user", Integer.toString(1));
        bean.init(request, "CORE_USERS_MANAGEMENT");
        String html = bean.getModifyUserPassword(request);
        assertNotNull(html);
        assertTrue(html.contains("<small>"
                + I18nService.getLocalizedString("portal.users.modify_user_password.pageTitle", Locale.FRANCE)
                + "</small>"));
    } finally {
        disposeOfUser(user);
    }
}

From source file:gc.david.dfm.ui.activity.MainActivity.java

private Locale getAmericanOrEuropeanLocale() {
    final String defaultUnit = DFMPreferences.getMeasureUnitPreference(getBaseContext());
    return DFMPreferences.MEASURE_AMERICAN_UNIT_VALUE.equals(defaultUnit) ? Locale.US : Locale.FRANCE;
}

From source file:org.openmrs.api.ConceptServiceTest.java

/**
 * @see ConceptService#saveConceptStopWord(org.openmrs.ConceptStopWord)
 *///ww w.  j  ava2s .  c  o  m
@Test
@Verifies(value = "should save concept stop word into database", method = "saveConceptStopWord(ConceptStopWord)")
public void saveConceptStopWord_shouldSaveConceptStopWordIntoDatabase() throws Exception {
    ConceptStopWord conceptStopWord = new ConceptStopWord("AND", Locale.FRANCE);
    conceptService.saveConceptStopWord(conceptStopWord);

    List<String> conceptStopWords = conceptService.getConceptStopWords(Locale.FRANCE);
    assertEquals(1, conceptStopWords.size());
    assertEquals("AND", conceptStopWords.get(0));
}

From source file:fr.paris.lutece.portal.web.user.AdminUserJspBeanTest.java

public void testDoImportUsersFromFile() throws AccessDeniedException, UserNotSignedException, IOException {
    AdminUserJspBean bean = new AdminUserJspBean();
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.addParameter(SecurityTokenService.PARAMETER_TOKEN,
            SecurityTokenService.getInstance().getToken(request, "jsp/admin/user/ImportUser.jsp"));
    AdminUser user = getUserToModify();//  w  w  w  . j av  a  2s  . co m
    AdminAuthenticationService.getInstance().registerUser(request, user);
    bean.init(request, "CORE_USERS_MANAGEMENT");
    Map<String, List<FileItem>> multipartFiles = new HashMap<>();
    List<FileItem> fileItems = new ArrayList<>();
    FileItem file = new DiskFileItem("import_file", "application/csv", true, "junit.csv", 1024,
            new File(System.getProperty("java.io.tmpdir")));
    OutputStreamWriter writer = new OutputStreamWriter(file.getOutputStream(), Charset.forName("UTF-8"));
    writer.write(
            "test;test;test;test@test.fr;" + AdminUser.ACTIVE_CODE + ";" + Locale.FRANCE + ";0;false;false;;;");
    writer.close();
    fileItems.add(file);
    multipartFiles.put("import_file", fileItems);
    Map<String, String[]> parameters = request.getParameterMap();
    MultipartHttpServletRequest multipartRequest = new MultipartHttpServletRequest(request, multipartFiles,
            parameters);
    bean.getImportUsersFromFile(request); // initialize _importAdminUserService
    AdminUser importedUser = null;
    try {
        bean.doImportUsersFromFile(multipartRequest);
        importedUser = AdminUserHome.findUserByLogin("test");
        assertNotNull(importedUser);
        assertEquals("test", importedUser.getAccessCode());
        assertEquals("test", importedUser.getFirstName());
        assertEquals("test", importedUser.getLastName());
        assertEquals("test@test.fr", importedUser.getEmail());
        assertEquals(AdminUser.ACTIVE_CODE, importedUser.getStatus());
    } finally {
        if (importedUser != null) {
            disposeOfUser(importedUser);
        }
        disposeOfUser(user);
    }
}

From source file:fr.paris.lutece.portal.web.user.AdminUserJspBeanTest.java

public void testDoImportUsersFromFileInvalidToken()
        throws AccessDeniedException, UserNotSignedException, IOException {
    AdminUserJspBean bean = new AdminUserJspBean();
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.addParameter(SecurityTokenService.PARAMETER_TOKEN,
            SecurityTokenService.getInstance().getToken(request, "jsp/admin/user/ImportUser.jsp") + "b");
    AdminUser user = getUserToModify();//from   w  w w.  j a v  a 2  s.com
    AdminAuthenticationService.getInstance().registerUser(request, user);
    bean.init(request, "CORE_USERS_MANAGEMENT");
    Map<String, List<FileItem>> multipartFiles = new HashMap<>();
    List<FileItem> fileItems = new ArrayList<>();
    FileItem file = new DiskFileItem("import_file", "application/csv", true, "junit.csv", 1024,
            new File(System.getProperty("java.io.tmpdir")));
    OutputStreamWriter writer = new OutputStreamWriter(file.getOutputStream(), Charset.forName("UTF-8"));
    writer.write(
            "test;test;test;test@test.fr;" + AdminUser.ACTIVE_CODE + ";" + Locale.FRANCE + ";0;false;false;;;");
    writer.close();
    fileItems.add(file);
    multipartFiles.put("import_file", fileItems);
    Map<String, String[]> parameters = request.getParameterMap();
    MultipartHttpServletRequest multipartRequest = new MultipartHttpServletRequest(request, multipartFiles,
            parameters);
    bean.getImportUsersFromFile(request); // initialize _importAdminUserService
    AdminUser importedUser = null;
    try {
        bean.doImportUsersFromFile(multipartRequest);
        fail("Should have thrown");
    } catch (AccessDeniedException e) {
        importedUser = AdminUserHome.findUserByLogin("test");
        assertNull(importedUser);
    } finally {
        if (importedUser != null) {
            disposeOfUser(importedUser);
        }
        disposeOfUser(user);
    }
}

From source file:fr.paris.lutece.portal.web.user.AdminUserJspBeanTest.java

public void testDoImportUsersFromFileNoToken()
        throws AccessDeniedException, UserNotSignedException, IOException {
    AdminUserJspBean bean = new AdminUserJspBean();
    MockHttpServletRequest request = new MockHttpServletRequest();
    AdminUser user = getUserToModify();// w  w w. j  av a2s .c o m
    AdminAuthenticationService.getInstance().registerUser(request, user);
    bean.init(request, "CORE_USERS_MANAGEMENT");
    Map<String, List<FileItem>> multipartFiles = new HashMap<>();
    List<FileItem> fileItems = new ArrayList<>();
    FileItem file = new DiskFileItem("import_file", "application/csv", true, "junit.csv", 1024,
            new File(System.getProperty("java.io.tmpdir")));
    OutputStreamWriter writer = new OutputStreamWriter(file.getOutputStream(), Charset.forName("UTF-8"));
    writer.write(
            "test;test;test;test@test.fr;" + AdminUser.ACTIVE_CODE + ";" + Locale.FRANCE + ";0;false;false;;;");
    writer.close();
    fileItems.add(file);
    multipartFiles.put("import_file", fileItems);
    Map<String, String[]> parameters = request.getParameterMap();
    MultipartHttpServletRequest multipartRequest = new MultipartHttpServletRequest(request, multipartFiles,
            parameters);
    bean.getImportUsersFromFile(request); // initialize _importAdminUserService
    AdminUser importedUser = null;
    try {
        bean.doImportUsersFromFile(multipartRequest);
        fail("Should have thrown");
    } catch (AccessDeniedException e) {
        importedUser = AdminUserHome.findUserByLogin("test");
        assertNull(importedUser);
    } finally {
        if (importedUser != null) {
            disposeOfUser(importedUser);
        }
        disposeOfUser(user);
    }
}