List of usage examples for com.liferay.portal.kernel.util LocaleUtil HUNGARY
Locale HUNGARY
To view the source code for com.liferay.portal.kernel.util LocaleUtil HUNGARY.
Click Source Link
From source file:com.liferay.calendar.search.test.CalendarBookingIndexerIndexedFieldsTest.java
License:Open Source License
@Test public void testIndexedFields() throws Exception { String originalTitle = "entity title"; String translatedTitle = "entitas neve"; String description = StringUtil.toLowerCase(RandomTestUtil.randomString()); CalendarBooking calendarBooking = addCalendarBooking(new LocalizedValuesMap() { {//ww w .jav a 2s . co m put(LocaleUtil.US, originalTitle); put(LocaleUtil.HUNGARY, translatedTitle); } }, new LocalizedValuesMap() { { put(LocaleUtil.US, originalTitle); put(LocaleUtil.HUNGARY, translatedTitle); } }, new LocalizedValuesMap() { { put(LocaleUtil.US, description); put(LocaleUtil.HUNGARY, description); } }); Map<String, String> map = new HashMap<>(); map.put(Field.CLASS_NAME_ID, String.valueOf(portal.getClassNameId(Calendar.class))); map.put(Field.EXPIRATION_DATE, "99950812133000"); map.put(Field.EXPIRATION_DATE.concat("_sortable"), "9223372036854775807"); map.put(Field.PRIORITY, "0.0"); map.put(Field.PUBLISH_DATE, "19700101000000"); map.put(Field.PUBLISH_DATE.concat("_sortable"), "0"); map.put(Field.RELATED_ENTRY, "true"); map.put(Field.STAGING_GROUP, "false"); map.put(Field.STATUS, "0"); map.put("viewActionId", CalendarActionKeys.VIEW_BOOKING_DETAILS); populateTitle(originalTitle, map); populateTranslatedTitle(translatedTitle, map); CalendarResource calendarResource = calendarBooking.getCalendarResource(); populateCalendarResource(calendarResource, map); Calendar calendar = calendarResource.getDefaultCalendar(); populateCalendar(calendar, map); populateCalendarBooking(calendarBooking, map); DateFormat dateFormat = DateFormatFactoryUtil.getSimpleDateFormat("yyyyMMddHHmm"); populateCalendarDate(Field.CREATE_DATE, calendar.getCreateDate(), dateFormat, map); populateCalendarDate(Field.MODIFIED_DATE, calendar.getModifiedDate(), dateFormat, map); calendarFieldsFixture.populateGroupRoleId(map); calendarFieldsFixture.populateRoleId("Owner", map); calendarFieldsFixture.populateUID(calendarBooking, map); String keywords = "nev"; Document document = calendarSearchFixture.searchOnlyOne(keywords, LocaleUtil.HUNGARY); adjustDatePrecision(Field.CREATE_DATE, document, dateFormat); adjustDatePrecision(Field.MODIFIED_DATE, document, dateFormat); FieldValuesAssert.assertFieldValues(map, document, keywords); }
From source file:com.liferay.calendar.search.test.CalendarBookingIndexerLocalizedContentTest.java
License:Open Source License
@Test public void testJapaneseTitleFullWordOnly() throws Exception { String full = "??"; String partial1 = ""; String partial2 = "?"; Stream<String> titlesStream = Stream.of(full, partial1, partial2); String description = StringUtil.toLowerCase(RandomTestUtil.randomString()); titlesStream.forEach(title -> {// w w w.j av a2s . c o m addCalendarBooking(new LocalizedValuesMap() { { put(LocaleUtil.JAPAN, title); } }, new LocalizedValuesMap() { { put(LocaleUtil.US, description); put(LocaleUtil.HUNGARY, description); } }, new LocalizedValuesMap() { { put(LocaleUtil.US, description); put(LocaleUtil.HUNGARY, description); } }); }); Map<String, String> titleMap = new HashMap<String, String>() { { put("title_ja_JP", "??"); } }; String word1 = "?"; String word2 = "?"; Stream<String> keywordsStream = Stream.of(word1, word2); keywordsStream.forEach(keywords -> assertFieldValues("title", LocaleUtil.JAPAN, titleMap, keywords)); }
From source file:com.liferay.calendar.search.test.CalendarBookingIndexerTest.java
License:Open Source License
@Test public void testIndexedFields() throws Exception { setUpSearchContext(_group, TestPropsValues.getUser()); String originalTitle = "entity title"; String translatedTitle = "entitas neve"; addCalendarBooking(new LocalizedValuesMap() { {// w w w. jav a 2 s .c om put(LocaleUtil.US, originalTitle); put(LocaleUtil.HUNGARY, translatedTitle); } }); String searchTerm = "nev"; assertSearchHitsLength(searchTerm, 1, LocaleUtil.HUNGARY); }
From source file:com.liferay.calendar.search.test.CalendarIndexerIndexedFieldsTest.java
License:Open Source License
@Test public void testIndexedFields() throws Exception { String originalName = "entity title"; String translatedName = "entitas neve"; String originalDescription = "calendar description"; String translatedDescription = "descripcin del calendario"; Calendar calendar = addCalendar(new LocalizedValuesMap() { {//from w w w. j a v a2 s. c om put(LocaleUtil.US, originalName); put(LocaleUtil.HUNGARY, translatedName); } }, new LocalizedValuesMap() { { put(LocaleUtil.US, originalDescription); put(LocaleUtil.HUNGARY, translatedDescription); } }); Map<String, String> map = new HashMap<>(); populateExpectedFieldValues(calendar, map); map.put(Field.DESCRIPTION, originalDescription); map.put(Field.DESCRIPTION + "_en_US", originalDescription); map.put(Field.DESCRIPTION + "_hu_HU", translatedDescription); map.put(Field.NAME, originalName); map.put(Field.NAME + "_en_US", originalName); map.put(Field.NAME + "_hu_HU", translatedName); String keywords = "nev"; Document document = calendarSearchFixture.searchOnlyOne(keywords, LocaleUtil.HUNGARY); FieldValuesAssert.assertFieldValues(map, document, keywords); }
From source file:com.liferay.document.library.service.test.DLFileEntryTypeServiceTest.java
License:Open Source License
@Test public void testAddFileEntryTypeWithNonemptyDDMForm() throws Exception { ServiceContext serviceContext = new ServiceContext(); byte[] testFileBytes = FileUtil.getBytes(getClass(), _TEST_DDM_STRUCTURE); DDMForm ddmForm = _ddmFormXSDDeserializer.deserialize(new String(testFileBytes)); serviceContext.setAttribute("ddmForm", DDMBeanTranslatorUtil.translate(ddmForm)); User user = TestPropsValues.getUser(); serviceContext.setLanguageId(LocaleUtil.toLanguageId(user.getLocale())); DLFileEntryType dlFileEntryType = DLFileEntryTypeLocalServiceUtil.addFileEntryType( TestPropsValues.getUserId(), _group.getGroupId(), "Test Structure", StringPool.BLANK, new long[0], serviceContext);/* w ww. ja v a2s.c om*/ List<com.liferay.dynamic.data.mapping.kernel.DDMStructure> ddmStructures = dlFileEntryType .getDDMStructures(); Assert.assertEquals(ddmStructures.toString(), 1, ddmStructures.size()); DDMStructure ddmStructure = DDMStructureLocalServiceUtil .getStructure(ddmStructures.get(0).getStructureId()); Locale[] availableLocales = LocaleUtil.fromLanguageIds(ddmStructure.getAvailableLanguageIds()); boolean hasDefaultLocale = ArrayUtil.contains(availableLocales, LocaleUtil.getSiteDefault()); Assert.assertTrue(hasDefaultLocale); boolean hasHungarianLocale = ArrayUtil.contains(availableLocales, LocaleUtil.HUNGARY); Assert.assertTrue(hasHungarianLocale); boolean hasUserLocale = ArrayUtil.contains(availableLocales, user.getLocale()); Assert.assertTrue(hasUserLocale); DLFileEntryTypeLocalServiceUtil.deleteDLFileEntryType(dlFileEntryType); }
From source file:com.liferay.journal.search.test.JournalArticleIndexerLocalizedContentTest.java
License:Open Source License
@Test public void testIndexedFields() throws Exception { String originalTitle = "entity title"; String translatedTitle = "entitas neve"; setTitle(new JournalArticleTitle() { {/*from w ww . j a va2 s.c o m*/ put(LocaleUtil.US, originalTitle); put(LocaleUtil.HUNGARY, translatedTitle); } }); String originalContent = RandomTestUtil.randomString(); String translatedContent = RandomTestUtil.randomString(); setContent(new JournalArticleContent() { { name = "content"; defaultLocale = LocaleUtil.US; put(LocaleUtil.US, originalContent); put(LocaleUtil.HUNGARY, translatedContent); } }); addArticle(); Map<String, String> titleStrings = new HashMap<String, String>() { { put("title_en_US", originalTitle); put("title_hu_HU", translatedTitle); } }; Map<String, String> contentStrings = new HashMap<String, String>() { { put("content", originalContent); put("content_en_US", originalContent); put("content_hu_HU", translatedContent); } }; Map<String, String> localizedTitleStrings = _withSortableValues(new HashMap<String, String>() { { put("localized_title_en_US", originalTitle); put("localized_title_hu_HU", translatedTitle); put("localized_title_ca_ES", originalTitle); put("localized_title_de_DE", originalTitle); put("localized_title_es_ES", originalTitle); put("localized_title_fi_FI", originalTitle); put("localized_title_fr_FR", originalTitle); put("localized_title_iw_IL", originalTitle); put("localized_title_ja_JP", originalTitle); put("localized_title_nl_NL", originalTitle); put("localized_title_pt_BR", originalTitle); put("localized_title_zh_CN", originalTitle); } }); localizedTitleStrings.put("localized_title", originalTitle); Map<String, String> ddmContentStrings = _withSortableValues(new HashMap<String, String>() { { put("ddm__text__NNNNN__content_en_US", originalContent); put("ddm__text__NNNNN__content_hu_HU", translatedContent); put("ddm__text__NNNNN__content_ca_ES", originalContent); put("ddm__text__NNNNN__content_de_DE", originalContent); put("ddm__text__NNNNN__content_es_ES", originalContent); put("ddm__text__NNNNN__content_fi_FI", originalContent); put("ddm__text__NNNNN__content_fr_FR", originalContent); put("ddm__text__NNNNN__content_iw_IL", originalContent); put("ddm__text__NNNNN__content_ja_JP", originalContent); put("ddm__text__NNNNN__content_nl_NL", originalContent); put("ddm__text__NNNNN__content_pt_BR", originalContent); put("ddm__text__NNNNN__content_zh_CN", originalContent); } }); String searchTerm = "nev"; Document document = _search(searchTerm, LocaleUtil.HUNGARY); FieldValuesAssert.assertFieldValues(titleStrings, "title", document, searchTerm); FieldValuesAssert.assertFieldValues(contentStrings, "content", document, searchTerm); FieldValuesAssert.assertFieldValues(localizedTitleStrings, "localized_title", document, searchTerm); String ddmNumber = _getDDMNumber(document); FieldValuesAssert.assertFieldValues(_replaceKeys("NNNNN", ddmNumber, ddmContentStrings), "ddm__text", document, searchTerm); }