1313import com .liferay .document .library .util .DLURLHelperUtil ;
1414import com .liferay .dynamic .data .mapping .service .DDMStructureLocalService ;
1515import com .liferay .dynamic .data .mapping .test .util .DDMStructureTestUtil ;
16+ import com .liferay .exportimport .kernel .lar .ExportImportThreadLocal ;
1617import com .liferay .journal .model .JournalArticle ;
1718import com .liferay .journal .service .JournalArticleLocalService ;
1819import com .liferay .journal .test .util .JournalTestUtil ;
1920import com .liferay .petra .io .unsync .UnsyncByteArrayInputStream ;
21+ import com .liferay .petra .string .StringBundler ;
2022import com .liferay .petra .string .StringPool ;
2123import com .liferay .portal .kernel .cache .MultiVMPool ;
2224import com .liferay .portal .kernel .dao .orm .EntityCache ;
@@ -74,6 +76,8 @@ public void testUpgradeProcess() throws Exception {
7476 _assertContains (
7577 journalArticle .getContent (),
7678 "data-fileentryid=\" " + _dlFileEntry .getFileEntryId () + "\" " );
79+ _assertContains (
80+ journalArticle .getContent (), "/documents/d/orphan/document" );
7781 }
7882
7983 private void _addDLFileEntry () throws Exception {
@@ -91,19 +95,35 @@ null, new UnsyncByteArrayInputStream(new byte[0]), 0, null, null,
9195 }
9296
9397 private void _addJournalArticle () throws Exception {
94- String previewURL = DLURLHelperUtil .getPreviewURL (
95- new LiferayFileEntry (_dlFileEntry ),
96- new LiferayFileVersion (_dlFileEntry .getFileVersion ()), null , null );
97-
98- _journalArticle = JournalTestUtil .addArticleWithXMLContent (
99- DDMStructureTestUtil .getSampleStructuredContent (
100- "content" ,
101- Collections .singletonList (
102- HashMapBuilder .put (
103- LocaleUtil .US , "<img src=\" " + previewURL + "\" />"
104- ).build ()),
105- LanguageUtil .getLanguageId (LocaleUtil .US )),
106- "BASIC-WEB-CONTENT" , "BASIC-WEB-CONTENT" );
98+ boolean portletImportInProcess =
99+ ExportImportThreadLocal .isPortletImportInProcess ();
100+
101+ try {
102+ ExportImportThreadLocal .setPortletImportInProcess (true );
103+
104+ _journalArticle = JournalTestUtil .addArticleWithXMLContent (
105+ DDMStructureTestUtil .getSampleStructuredContent (
106+ "content" ,
107+ Collections .singletonList (
108+ HashMapBuilder .put (
109+ LocaleUtil .US ,
110+ StringBundler .concat (
111+ "<img src=\" " ,
112+ DLURLHelperUtil .getPreviewURL (
113+ new LiferayFileEntry (_dlFileEntry ),
114+ new LiferayFileVersion (
115+ _dlFileEntry .getFileVersion ()),
116+ null , null ),
117+ "\" /><img src=\" /documents/d/orphan/document\" " ,
118+ "/>" )
119+ ).build ()),
120+ LanguageUtil .getLanguageId (LocaleUtil .US )),
121+ "BASIC-WEB-CONTENT" , "BASIC-WEB-CONTENT" );
122+ }
123+ finally {
124+ ExportImportThreadLocal .setPortletImportInProcess (
125+ portletImportInProcess );
126+ }
107127 }
108128
109129 private void _assertContains (String content , String fragment ) {
0 commit comments