@Override
  protected void addActivities() throws Exception {
    _folder =
        DLAppTestUtil.addFolder(
            group.getGroupId(),
            DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,
            ServiceTestUtil.randomString());

    DLAppServiceUtil.moveFolderToTrash(_folder.getFolderId());

    DLAppServiceUtil.restoreFolderFromTrash(_folder.getFolderId());
  }
    @Override
    protected void doRun() throws Exception {
      try {
        FileEntry fileEntry =
            DLAppTestUtil.addFileEntry(
                group.getGroupId(), parentFolder.getFolderId(), false, "Test-" + _index + ".txt");

        _fileEntryIds[_index] = fileEntry.getFileEntryId();

        _log.debug("Added file " + _index);

        _success = true;
      } catch (Exception e) {
        _log.error("Unable to add file " + _index, e);
      }
    }
  @Before
  @Override
  public void setUp() throws Exception {
    super.setUp();

    _fileEntry =
        DLAppTestUtil.addFileEntry(
            group.getGroupId(), parentFolder.getFolderId(), false, "Test DLAppService.txt");

    _userIds = new long[ServiceTestUtil.THREAD_COUNT];

    for (int i = 0; i < ServiceTestUtil.THREAD_COUNT; i++) {
      User user = ServiceTestUtil.addUser("DLAppServiceTest" + (i + 1), group.getGroupId());

      _userIds[i] = user.getUserId();
    }
  }
  @Test
  public void testVersionLabel() throws Exception {
    String fileName = "TestVersion.txt";

    FileEntry fileEntry =
        DLAppTestUtil.addFileEntry(group.getGroupId(), parentFolder.getFolderId(), false, fileName);

    Assert.assertEquals("Version label incorrect after add", "1.0", fileEntry.getVersion());

    fileEntry = updateFileEntry(fileEntry.getFileEntryId(), fileName, false);

    Assert.assertEquals(
        "Version label incorrect after minor update", "1.1", fileEntry.getVersion());

    fileEntry = updateFileEntry(fileEntry.getFileEntryId(), fileName, true);

    Assert.assertEquals(
        "Version label incorrect after major update", "2.0", fileEntry.getVersion());
  }
  @Before
  public void setUp() throws Exception {
    FinderCacheUtil.clearCache();

    _liveGroup = GroupTestUtil.addGroup();
    _stagingGroup = GroupTestUtil.addGroup();

    _fileEntry =
        DLAppTestUtil.addFileEntry(
            _stagingGroup.getGroupId(),
            DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,
            ServiceTestUtil.randomString() + ".txt",
            ServiceTestUtil.randomString(),
            true);

    LiferayFileEntry liferayFileEntry = (LiferayFileEntry) _fileEntry;

    DLFileEntry dlFileEntry = liferayFileEntry.getDLFileEntry();

    dlFileEntry.setLargeImageId(dlFileEntry.getFileEntryId());

    DLFileEntryLocalServiceUtil.updateDLFileEntry(dlFileEntry);

    TestReaderWriter testReaderWriter = new TestReaderWriter();

    _portletDataContextExport =
        PortletDataContextFactoryUtil.createExportPortletDataContext(
            _stagingGroup.getCompanyId(),
            _stagingGroup.getGroupId(),
            new HashMap<String, String[]>(),
            new Date(System.currentTimeMillis() - Time.HOUR),
            new Date(),
            testReaderWriter);

    Element rootElement = SAXReaderUtil.createElement("root");

    _portletDataContextExport.setExportDataRootElement(rootElement);

    _stagingPrivateLayout =
        LayoutTestUtil.addLayout(_stagingGroup.getGroupId(), ServiceTestUtil.randomString(), true);
    _stagingPublicLayout =
        LayoutTestUtil.addLayout(_stagingGroup.getGroupId(), ServiceTestUtil.randomString(), false);

    _portletDataContextExport.setPlid(_stagingPublicLayout.getPlid());

    _portletDataContextImport =
        PortletDataContextFactoryUtil.createImportPortletDataContext(
            _stagingGroup.getCompanyId(),
            _stagingGroup.getGroupId(),
            new HashMap<String, String[]>(),
            new CurrentUserIdStrategy(TestPropsValues.getUser()),
            testReaderWriter);

    _portletDataContextImport.setImportDataRootElement(rootElement);

    _livePublicLayout =
        LayoutTestUtil.addLayout(_liveGroup.getGroupId(), ServiceTestUtil.randomString(), false);

    _portletDataContextImport.setPlid(_livePublicLayout.getPlid());

    _portletDataContextImport.setSourceGroupId(_stagingGroup.getGroupId());

    rootElement.addElement("entry");

    _referrerStagedModel =
        JournalTestUtil.addArticle(
            _stagingGroup.getGroupId(),
            ServiceTestUtil.randomString(),
            ServiceTestUtil.randomString());
  }
  protected FileEntry updateFileEntry(long fileEntryId, String fileName, boolean majorVersion)
      throws Exception {

    return DLAppTestUtil.updateFileEntry(
        group.getGroupId(), fileEntryId, fileName, fileName, majorVersion);
  }
 protected FileEntry addFileEntry(boolean rootFolder) throws Exception {
   return DLAppTestUtil.addFileEntry(
       group.getGroupId(), parentFolder.getFolderId(), rootFolder, "Title.txt");
 }