コード例 #1
0
  @Test
  public void testTypeArticle() throws Exception {
    initExport();

    Map<String, List<StagedModel>> dependentStagedModelsMap = new HashMap<>();

    JournalArticle journalArticle =
        JournalTestUtil.addArticle(
            stagingGroup.getGroupId(),
            JournalFolderConstants.DEFAULT_PARENT_FOLDER_ID,
            RandomTestUtil.randomString(),
            RandomTestUtil.randomString());

    addDependentStagedModel(dependentStagedModelsMap, JournalArticle.class, journalArticle);

    Layout layout =
        LayoutTestUtil.addTypeArticleLayout(
            stagingGroup.getGroupId(), journalArticle.getArticleId());

    addDependentLayoutFriendlyURLs(dependentStagedModelsMap, layout);

    StagedModelDataHandlerUtil.exportStagedModel(portletDataContext, layout);

    validateExport(portletDataContext, layout, dependentStagedModelsMap);

    initImport();

    Layout exportedLayout = (Layout) readExportedStagedModel(layout);

    StagedModelDataHandlerUtil.importStagedModel(portletDataContext, exportedLayout);
  }
コード例 #2
0
  @Test
  public void testJournalArticleTreePathWithJournalArticleInTrash() throws Exception {

    JournalFolder parentFolder =
        JournalTestUtil.addFolder(_group.getGroupId(), RandomTestUtil.randomString());

    JournalArticle article =
        JournalTestUtil.addArticle(
            _group.getGroupId(), parentFolder.getFolderId(), "title", "content");

    JournalArticleLocalServiceUtil.moveArticleToTrash(
        TestPropsValues.getUserId(), _group.getGroupId(), article.getArticleId());

    JournalFolderLocalServiceUtil.deleteFolder(parentFolder.getFolderId(), false);

    doVerify();
  }
コード例 #3
0
  @Override
  protected StagedModel addStagedModel(long groupId, Date createdDate) throws Exception {

    String title = RandomTestUtil.randomString();

    ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(groupId);

    serviceContext.setCommand(Constants.ADD);
    serviceContext.setCreateDate(createdDate);
    serviceContext.setLayoutFullURL("http://localhost");
    serviceContext.setModifiedDate(createdDate);

    return JournalTestUtil.addArticle(
        groupId,
        JournalFolderConstants.DEFAULT_PARENT_FOLDER_ID,
        JournalArticleConstants.CLASSNAME_ID_DEFAULT,
        title,
        title,
        RandomTestUtil.randomString(),
        LocaleUtil.getSiteDefault(),
        false,
        false,
        serviceContext);
  }
コード例 #4
0
 @Override
 protected StagedModel addStagedModel(long groupId) throws Exception {
   return JournalTestUtil.addArticle(
       groupId, RandomTestUtil.randomString(), RandomTestUtil.randomString());
 }