@After
  @Override
  public void tearDown() throws Exception {
    super.tearDown();

    ExpandoTableLocalServiceUtil.deleteTables(
        TestPropsValues.getCompanyId(), Group.class.getName());
  }
  protected ThemeDisplay getThemeDisplay(Group group) throws Exception {
    ThemeDisplay themeDisplay = new ThemeDisplay();

    Company company = CompanyLocalServiceUtil.getCompany(TestPropsValues.getCompanyId());

    themeDisplay.setCompany(company);

    themeDisplay.setLayoutSet(group.getPublicLayoutSet());
    themeDisplay.setServerPort(80);
    themeDisplay.setSiteGroupId(group.getGroupId());

    return themeDisplay;
  }
  @Before
  @Override
  public void setUp() throws Exception {
    super.setUp();

    SimpleAction simpleAction = new AddDefaultDocumentLibraryStructuresAction();

    String companyIdString = String.valueOf(TestPropsValues.getCompanyId());

    simpleAction.run(new String[] {companyIdString});

    List<DLFileEntryType> dlFileEntryTypes =
        DLFileEntryTypeLocalServiceUtil.getFileEntryTypes(
            PortalUtil.getCurrentAndAncestorSiteGroupIds(group.getGroupId()));

    for (DLFileEntryType dlFileEntryType : dlFileEntryTypes) {
      String name = dlFileEntryType.getName(LocaleUtil.getSiteDefault());

      if (name.equals(DLFileEntryTypeConstants.NAME_CONTRACT)) {
        _contractDLFileEntryTypeId = dlFileEntryType.getFileEntryTypeId();
      }
    }

    ExpandoTable expandoTable =
        ExpandoTableLocalServiceUtil.addDefaultTable(
            PortalUtil.getDefaultCompanyId(), DLFileEntry.class.getName());

    ExpandoColumnLocalServiceUtil.addColumn(
        expandoTable.getTableId(),
        _EXPANDO_ATTRIBUTE_NAME,
        ExpandoColumnConstants.STRING,
        StringPool.BLANK);

    _serviceContext = getServiceContext();

    FileEntry fileEntry =
        DLAppServiceUtil.addFileEntry(
            group.getGroupId(),
            parentFolder.getFolderId(),
            _SOURCE_FILE_NAME,
            ContentTypes.APPLICATION_OCTET_STREAM,
            _TITLE,
            StringPool.BLANK,
            StringPool.BLANK,
            _DATA_VERSION_1,
            _serviceContext);

    _fileVersion =
        DLFileVersionLocalServiceUtil.getFileVersion(
            fileEntry.getFileEntryId(), DLFileEntryConstants.VERSION_DEFAULT);
  }
  @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;
      }
    }
  }