@Before public void setUp() throws Exception { group = GroupTestUtil.addGroup(); importedGroup = GroupTestUtil.addGroup(); layout = LayoutTestUtil.addLayout(group.getGroupId(), RandomTestUtil.randomString()); // Delete and readd to ensure a different layout ID (not ID or UUID). // See LPS-32132. LayoutLocalServiceUtil.deleteLayout(layout, true, new ServiceContext()); layout = LayoutTestUtil.addLayout(group.getGroupId(), RandomTestUtil.randomString()); }
@Test public void testLocalizedSiteAddFileEntryType() throws Exception { Group group = GroupTestUtil.addGroup(); ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(group.getGroupId()); Locale locale = LocaleThreadLocal.getSiteDefaultLocale(); try { LocaleThreadLocal.setSiteDefaultLocale(LocaleUtil.SPAIN); String name = RandomTestUtil.randomString(); String description = RandomTestUtil.randomString(); DDMStructure ddmStructure = DDMStructureTestUtil.addStructure( DLFileEntry.class.getName(), new Locale[] {LocaleUtil.SPAIN}, LocaleUtil.SPAIN); DLFileEntryType dlFileEntryType = DLFileEntryTypeLocalServiceUtil.addFileEntryType( TestPropsValues.getUserId(), group.getGroupId(), name, description, new long[] {ddmStructure.getStructureId()}, serviceContext); Assert.assertEquals(name, dlFileEntryType.getName(LocaleUtil.US, true)); Assert.assertEquals(description, dlFileEntryType.getDescription(LocaleUtil.US, true)); } finally { LocaleThreadLocal.setSiteDefaultLocale(locale); } }
@Before public void setUp() throws Exception { _group = GroupTestUtil.addGroup(); _actorUser = UserTestUtil.addUser("actor", _group.getGroupId()); _creatorUser = UserTestUtil.addUser("creator", _group.getGroupId()); _assetEntry = SocialActivityTestUtil.addAssetEntry(_creatorUser, _group, null); SocialActivityHierarchyEntryThreadLocal.clear(); }
@Before public void setUp() throws Exception { _group = GroupTestUtil.addGroup(); Map<Locale, String> nameMap = new HashMap<>(); nameMap.put(LocaleUtil.GERMANY, "Zuhause1"); nameMap.put(LocaleUtil.SPAIN, "Casa1"); nameMap.put(LocaleUtil.US, "Home1"); Map<Locale, String> friendlyURLMap = new HashMap<>(); friendlyURLMap.put(LocaleUtil.GERMANY, "/zuhause1"); friendlyURLMap.put(LocaleUtil.SPAIN, "/casa1"); friendlyURLMap.put(LocaleUtil.US, "/home1"); _layout1 = LayoutTestUtil.addLayout(_group.getGroupId(), false, nameMap, friendlyURLMap); nameMap = new HashMap<>(); nameMap.put(LocaleUtil.GERMANY, "Zuhause2"); nameMap.put(LocaleUtil.SPAIN, "Casa2"); nameMap.put(LocaleUtil.US, "Home2"); friendlyURLMap = new HashMap<>(); friendlyURLMap.put(LocaleUtil.GERMANY, "/zuhause2"); friendlyURLMap.put(LocaleUtil.SPAIN, "/casa2"); friendlyURLMap.put(LocaleUtil.US, "/home2"); _layout2 = LayoutTestUtil.addLayout(_group.getGroupId(), false, nameMap, friendlyURLMap); if (_defaultGroup == null) { _defaultGroup = GroupLocalServiceUtil.getGroup( TestPropsValues.getCompanyId(), PropsValues.VIRTUAL_HOSTS_DEFAULT_SITE_NAME); _defaultGrouplayout1 = LayoutLocalServiceUtil.fetchFirstLayout( _defaultGroup.getGroupId(), false, LayoutConstants.DEFAULT_PARENT_LAYOUT_ID); if (_defaultGrouplayout1 == null) { _defaultGrouplayout1 = LayoutTestUtil.addLayout(_defaultGroup); } _defaultGrouplayout2 = LayoutTestUtil.addLayout(_defaultGroup.getGroupId()); } }
@Before public void setUp() throws Exception { SimpleAction simpleAction = new AddDefaultDocumentLibraryStructuresAction(); String companyIdString = String.valueOf(TestPropsValues.getCompanyId()); simpleAction.run(new String[] {companyIdString}); _group = GroupTestUtil.addGroup(); _folder = DLAppLocalServiceUtil.addFolder( TestPropsValues.getUserId(), _group.getGroupId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, "Folder A", "", ServiceContextTestUtil.getServiceContext(_group.getGroupId())); _subfolder = DLAppLocalServiceUtil.addFolder( TestPropsValues.getUserId(), _group.getGroupId(), _folder.getFolderId(), "SubFolder AA", "", ServiceContextTestUtil.getServiceContext(_group.getGroupId())); _basicDocumentDLFileEntryType = DLFileEntryTypeLocalServiceUtil.getFileEntryType( DLFileEntryTypeConstants.FILE_ENTRY_TYPE_ID_BASIC_DOCUMENT); _dlFileEntryTypes = DLFileEntryTypeLocalServiceUtil.getFileEntryTypes( PortalUtil.getCurrentAndAncestorSiteGroupIds(_group.getGroupId())); for (DLFileEntryType dlFileEntryType : _dlFileEntryTypes) { String name = dlFileEntryType.getName(LocaleUtil.getSiteDefault()); if (name.equals(DLFileEntryTypeConstants.NAME_CONTRACT)) { _contractDLFileEntryType = dlFileEntryType; } else if (name.equals(DLFileEntryTypeConstants.NAME_MARKETING_BANNER)) { _marketingBannerDLFileEntryType = dlFileEntryType; } } }
@Before public void setUp() throws Exception { _assetCategoryPersistence = AssetCategoryUtil.getPersistence(); _sessionFactoryInvocationHandler = new SessionFactoryInvocationHandler( ReflectionTestUtil.getFieldValue(_assetCategoryPersistence, "_sessionFactory")); ReflectionTestUtil.setFieldValue( _assetCategoryPersistence, "_sessionFactory", ProxyUtil.newProxyInstance( SessionFactory.class.getClassLoader(), new Class<?>[] {SessionFactory.class}, _sessionFactoryInvocationHandler)); _assetCategoryPersistence.setRebuildTreeEnabled(false); _nestedSetsTreeManager = new PersistenceNestedSetsTreeManager<AssetCategory>( (BasePersistenceImpl<?>) _assetCategoryPersistence, "AssetCategory", "AssetCategory", AssetCategoryImpl.class, "categoryId", "groupId", "leftCategoryId", "rightCategoryId"); _group = GroupTestUtil.addGroup(); _assetVocabulary = AssetTestUtil.addVocabulary(_group.getGroupId()); _assetCategories = new AssetCategory[9]; for (int i = 0; i < 9; i++) { _assetCategories[i] = AssetTestUtil.addCategory(_group.getGroupId(), _assetVocabulary.getVocabularyId()); } PropsValues.SPRING_HIBERNATE_SESSION_DELEGATED = false; }
@Before public void setUp() throws Exception { _group = GroupTestUtil.addGroup(); }
@Before public void setUp() throws Exception { _group = GroupTestUtil.addGroup(); _node = WikiTestUtil.addNode(_group.getGroupId()); }