Skip to content

Commit 43f7bde

Browse files
adolfopanikki-pru
authored andcommitted
LPD-43352 Integration test
1 parent 0615e45 commit 43f7bde

File tree

1 file changed

+33
-13
lines changed

1 file changed

+33
-13
lines changed

modules/apps/dynamic-data-mapping/dynamic-data-mapping-test/src/testIntegration/java/com/liferay/dynamic/data/mapping/internal/upgrade/v5_6_1/test/DDMFieldAttributeUpgradeProcessTest.java

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313
import com.liferay.document.library.util.DLURLHelperUtil;
1414
import com.liferay.dynamic.data.mapping.service.DDMStructureLocalService;
1515
import com.liferay.dynamic.data.mapping.test.util.DDMStructureTestUtil;
16+
import com.liferay.exportimport.kernel.lar.ExportImportThreadLocal;
1617
import com.liferay.journal.model.JournalArticle;
1718
import com.liferay.journal.service.JournalArticleLocalService;
1819
import com.liferay.journal.test.util.JournalTestUtil;
1920
import com.liferay.petra.io.unsync.UnsyncByteArrayInputStream;
21+
import com.liferay.petra.string.StringBundler;
2022
import com.liferay.petra.string.StringPool;
2123
import com.liferay.portal.kernel.cache.MultiVMPool;
2224
import 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

Comments
 (0)