List of usage examples for com.liferay.portal.util PortalImpl PortalImpl
public PortalImpl()
From source file:com.liferay.asset.assetrendererfactoryregistryutil.test.AssetRendererFactoryRegistryUtilTest.java
License:Open Source License
@Test public void testGetAssetRendererFactoryByClassNameId() { PortalImpl portalImpl = new PortalImpl(); long classNameId = portalImpl.getClassNameId(TestAssetRendererFactory.class); AssetRendererFactory<?> assetRendererFactory = AssetRendererFactoryRegistryUtil .getAssetRendererFactoryByClassNameId(classNameId); Class<?> clazz = assetRendererFactory.getClass(); Assert.assertEquals(TestAssetRendererFactory.class.getName(), clazz.getName()); }
From source file:com.liferay.exportimport.internal.content.processor.test.DefaultExportImportContentProcessorTest.java
License:Open Source License
@Test public void testExportLayoutReferencesWithContext() throws Exception { PortalImpl portalImpl = new PortalImpl() { @Override/*w ww . ja v a 2 s. co m*/ public String getPathContext() { return "/de"; } }; PortalUtil portalUtil = new PortalUtil(); portalUtil.setPortal(portalImpl); Portal originalPortal = ReflectionTestUtil .getAndSetFieldValue(_layoutReferencesExportImportContentProcessor, "_portal", portalImpl); _oldLayoutFriendlyURLPrivateUserServletMapping = PropsValues.LAYOUT_FRIENDLY_URL_PRIVATE_USER_SERVLET_MAPPING; setFinalStaticField(PropsValues.class.getField("LAYOUT_FRIENDLY_URL_PRIVATE_USER_SERVLET_MAPPING"), "/en"); Class<?> clazz = _layoutReferencesExportImportContentProcessor.getClass(); setFinalStaticField(clazz.getDeclaredField("_PRIVATE_USER_SERVLET_MAPPING"), "/en/"); String content = replaceParameters(getContent("layout_references.txt"), _fileEntry); _exportImportContentProcessor.validateContentReferences(_stagingGroup.getGroupId(), content); content = _exportImportContentProcessor.replaceExportContentReferences(_portletDataContextExport, _referrerStagedModel, content, true, true); Assert.assertFalse(content, content.contains(VirtualLayoutConstants.CANONICAL_URL_SEPARATOR)); Assert.assertFalse(content, content.contains(GroupConstants.CONTROL_PANEL_FRIENDLY_URL)); Assert.assertFalse(content, content.contains(PropsValues.CONTROL_PANEL_LAYOUT_FRIENDLY_URL)); Assert.assertFalse(content, content.contains(PropsValues.LAYOUT_FRIENDLY_URL_PRIVATE_GROUP_SERVLET_MAPPING)); Assert.assertFalse(content, content.contains(PropsValues.LAYOUT_FRIENDLY_URL_PUBLIC_SERVLET_MAPPING)); Assert.assertTrue(content, content.contains("@data_handler_group_friendly_url@@" + _stagingGroup.getFriendlyURL() + "@")); Assert.assertTrue(content, content.contains("@data_handler_path_context@/en@")); Assert.assertFalse(content, content.contains("@data_handler_path_context@/de@")); setFinalStaticField(PropsValues.class.getDeclaredField("LAYOUT_FRIENDLY_URL_PRIVATE_USER_SERVLET_MAPPING"), _oldLayoutFriendlyURLPrivateUserServletMapping); setFinalStaticField(clazz.getDeclaredField("_PRIVATE_USER_SERVLET_MAPPING"), PropsValues.LAYOUT_FRIENDLY_URL_PRIVATE_USER_SERVLET_MAPPING + StringPool.SLASH); portalUtil.setPortal(new PortalImpl()); ReflectionTestUtil.setFieldValue(_layoutReferencesExportImportContentProcessor, "_portal", originalPortal); }
From source file:com.liferay.exportimport.internal.content.processor.test.DefaultExportImportContentProcessorTest.java
License:Open Source License
@Test public void testInvalidLayoutReferencesCauseNoSuchLayoutException() throws Exception { PortalImpl portalImpl = new PortalImpl() { @Override/* w w w. j a va 2s .co m*/ public String getPathContext() { return "/de"; } }; PortalUtil portalUtil = new PortalUtil(); portalUtil.setPortal(portalImpl); String content = replaceParameters(getContent("invalid_layout_references.txt"), _fileEntry); String[] layoutReferences = StringUtil.split(content, StringPool.NEW_LINE); for (String layoutReference : layoutReferences) { if (!layoutReference.contains(PortalUtil.getPathContext())) { continue; } boolean noSuchLayoutExceptionThrown = false; try { _exportImportContentProcessor.validateContentReferences(_stagingGroup.getGroupId(), layoutReference); } catch (NoSuchLayoutException nsle) { noSuchLayoutExceptionThrown = true; } Assert.assertTrue(layoutReference + " was not flagged as invalid", noSuchLayoutExceptionThrown); } portalUtil.setPortal(new PortalImpl()); }
From source file:com.liferay.frontend.js.loader.modules.extender.internal.JSLoaderModulesServletTest.java
License:Open Source License
@Before public void setUp() { _portal = PortalUtil.getPortal();/*from w ww .ja v a 2s.c o m*/ _portalUtil.setPortal(new PortalImpl() { @Override public String getPathContext() { return StringPool.BLANK; } }); }
From source file:com.liferay.item.selector.web.internal.ItemSelectorImplTest.java
License:Open Source License
@Before public void setUp() { _flickrItemSelectorCriterion = new FlickrItemSelectorCriterion(); List<ItemSelectorReturnType> desiredItemSelectorReturnTypes = new ArrayList<>(); desiredItemSelectorReturnTypes.add(_testURLItemSelectorReturnType); _flickrItemSelectorCriterion.setDesiredItemSelectorReturnTypes(desiredItemSelectorReturnTypes); _itemSelectorImpl = new ItemSelectorImpl(); _stubItemSelectorCriterionSerializer.addItemSelectorReturnType(_testFileEntryItemSelectorReturnType); _stubItemSelectorCriterionSerializer.addItemSelectorReturnType(_testStringItemSelectorReturnType); _stubItemSelectorCriterionSerializer.addItemSelectorReturnType(_testURLItemSelectorReturnType); _itemSelectorImpl.setItemSelectorCriterionSerializer(_stubItemSelectorCriterionSerializer); ReflectionTestUtil.setFieldValue(_itemSelectorImpl, "_http", new HttpImpl()); ReflectionTestUtil.setFieldValue(_itemSelectorImpl, "_portal", new PortalImpl()); _mediaItemSelectorCriterion = new MediaItemSelectorCriterion(); _mediaItemSelectorCriterion.setFileExtension("jpg"); _mediaItemSelectorCriterion.setMaxSize(2048); desiredItemSelectorReturnTypes = new ArrayList<>(); desiredItemSelectorReturnTypes.add(new TestFileEntryItemSelectorReturnType()); desiredItemSelectorReturnTypes.add(_testURLItemSelectorReturnType); _mediaItemSelectorCriterion.setDesiredItemSelectorReturnTypes(desiredItemSelectorReturnTypes); HttpUtil httpUtil = new HttpUtil(); httpUtil.setHttp(new HttpImpl()); JSONFactoryUtil jsonFactoryUtil = new JSONFactoryUtil(); jsonFactoryUtil.setJSONFactory(new JSONFactoryImpl()); PortalUtil portalUtil = new PortalUtil(); portalUtil.setPortal(new PortalImpl()); }
From source file:org.mimacom.commons.liferay.adapter512.LiferayToolsImpl.java
License:Apache License
public void initLiferay() { new FileUtil().setFile(new FileImpl()); new SAXReaderUtil().setSAXReader(new SAXReaderImpl()); new PortalUtil().setPortal(new PortalImpl()); ModelHintsImpl modelHints = new ModelHintsImpl(); modelHints.afterPropertiesSet();/*from w ww. j a v a 2 s .c o m*/ new ModelHintsUtil().setModelHints(modelHints); }
From source file:org.mimacom.commons.liferay.adapter523.LiferayToolsImpl.java
License:Apache License
public void initLiferay() { new FileUtil().setFile(new FileImpl()); new SAXReaderUtil().setSAXReader(new SAXReaderImpl()); new PortalUtil().setPortal(new PortalImpl()); new HtmlUtil().setHtml(new HtmlImpl()); ModelHintsImpl modelHints = new ModelHintsImpl(); modelHints.afterPropertiesSet();//from w w w. j a va 2 s . com new ModelHintsUtil().setModelHints(modelHints); }
From source file:org.mimacom.commons.liferay.adapter526.LiferayToolsImpl.java
License:Apache License
public void initLiferay() { new FileUtil().setFile(new FileImpl()); new SAXReaderUtil().setSAXReader(new SAXReaderImpl()); new PortalUtil().setPortal(new PortalImpl()); new HtmlUtil().setHtml(new HtmlImpl()); ModelHintsImpl modelHints = new ModelHintsImpl(); modelHints.afterPropertiesSet();// w ww . j a v a 2 s .c o m new ModelHintsUtil().setModelHints(modelHints); new FastDateFormatFactoryUtil().setFastDateFormatFactory(new FastDateFormatFactoryImpl()); }
From source file:org.mimacom.commons.liferay.adapter529.LiferayToolsImpl.java
License:Apache License
public void initLiferay() { new FileUtil().setFile(new FileImpl()); new SAXReaderUtil().setSAXReader(new SAXReaderImpl()); new PortalUtil().setPortal(new PortalImpl()); new HtmlUtil().setHtml(new HtmlImpl()); }