List of usage examples for com.liferay.portal.kernel.theme ThemeDisplay setCompany
public void setCompany(Company company) throws PortalException
From source file:com.liferay.blogs.trackback.test.TrackbackImplTest.java
License:Open Source License
@Test public void testAddTrackback() throws Exception { ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(); _blogsEntry = BlogsEntryLocalServiceUtil.addEntry(TestPropsValues.getUserId(), StringUtil.randomString(), StringUtil.randomString(), new Date(), serviceContext); IdentityServiceContextFunction serviceContextFunction = new IdentityServiceContextFunction(serviceContext); CommentManagerUtil.addComment(TestPropsValues.getUserId(), TestPropsValues.getGroupId(), BlogsEntry.class.getName(), _blogsEntry.getEntryId(), StringUtil.randomString(), serviceContextFunction);// ww w. ja va2s . co m int initialCommentsCount = CommentManagerUtil.getCommentsCount(BlogsEntry.class.getName(), _blogsEntry.getEntryId()); Trackback trackback = new TrackbackImpl(); ThemeDisplay themeDisplay = new ThemeDisplay(); Company company = CompanyLocalServiceUtil.getCompany(TestPropsValues.getCompanyId()); themeDisplay.setCompany(company); trackback.addTrackback(_blogsEntry, themeDisplay, StringUtil.randomString(), StringUtil.randomString(), StringUtil.randomString(), StringUtil.randomString(), serviceContextFunction); Assert.assertEquals(initialCommentsCount + 1, CommentManagerUtil.getCommentsCount(BlogsEntry.class.getName(), _blogsEntry.getEntryId())); LinkbackConsumerUtil.verifyNewTrackbacks(); }
From source file:com.liferay.calendar.util.test.CalendarUtilTest.java
License:Open Source License
protected ThemeDisplay createThemeDisplay() throws PortalException { ThemeDisplay themeDisplay = new ThemeDisplay(); Company company = CompanyLocalServiceUtil.getCompany(_group.getCompanyId()); themeDisplay.setCompany(company); themeDisplay.setLocale(LocaleUtil.getDefault()); themeDisplay.setScopeGroupId(_group.getGroupId()); themeDisplay.setPermissionChecker(PermissionThreadLocal.getPermissionChecker()); themeDisplay.setUser(_user);/*from www . j a v a2s . co m*/ return themeDisplay; }
From source file:com.liferay.journal.search.test.JournalArticleIndexerSummaryTest.java
License:Open Source License
protected ThemeDisplay createThemeDisplay(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { ThemeDisplay themeDisplay = new ThemeDisplay(); themeDisplay.setCompany(CompanyLocalServiceUtil.getCompany(_group.getCompanyId())); themeDisplay.setLayout(LayoutTestUtil.addLayout(_group)); LayoutSet layoutSet = _group.getPublicLayoutSet(); themeDisplay.setLayoutSet(layoutSet); Theme theme = ThemeLocalServiceUtil.getTheme(_group.getCompanyId(), layoutSet.getThemeId()); themeDisplay.setLookAndFeel(theme, null); themeDisplay.setRealUser(_user);/*from ww w . java2s . co m*/ themeDisplay.setRequest(httpServletRequest); themeDisplay.setResponse(httpServletResponse); themeDisplay.setTimeZone(TimeZoneUtil.getDefault()); themeDisplay.setUser(_user); return themeDisplay; }
From source file:com.liferay.layout.type.controller.test.LayoutTypeURLTest.java
License:Open Source License
private ThemeDisplay _initThemeDisplay() throws Exception { _company.setVirtualHostname(_VIRTUAL_HOSTNAME); ThemeDisplay themeDisplay = new ThemeDisplay(); themeDisplay.setCompany(_company); themeDisplay.setI18nLanguageId(StringPool.BLANK); themeDisplay.setLayout(_publicLayout); themeDisplay.setLayoutSet(_publicLayout.getLayoutSet()); themeDisplay.setSecure(false);//from www .ja va2 s.com themeDisplay.setServerName(_VIRTUAL_HOSTNAME); themeDisplay.setServerPort(8080); themeDisplay.setSiteGroupId(_group.getGroupId()); themeDisplay.setUser(TestPropsValues.getUser()); themeDisplay.setWidget(false); return themeDisplay; }
From source file:com.liferay.site.service.persistence.test.GroupServiceTest.java
License:Open Source License
@Test public void testGroupIsGlobalScopeLabel() throws Exception { ThemeDisplay themeDisplay = new ThemeDisplay(); Group group = GroupTestUtil.addGroup(); Company company = CompanyLocalServiceUtil.getCompany(group.getCompanyId()); themeDisplay.setCompany(company); Group companyGroup = company.getGroup(); String scopeLabel = companyGroup.getScopeLabel(themeDisplay); Assert.assertEquals("global", scopeLabel); GroupLocalServiceUtil.deleteGroup(group); }