Skip to content

Commit

Permalink
LPD-35068 update usages and use RandomTestUtil for the themeId value
Browse files Browse the repository at this point in the history
  • Loading branch information
thiago-buarqque committed Sep 30, 2024
1 parent 3843257 commit 7873ad3
Show file tree
Hide file tree
Showing 20 changed files with 79 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -442,10 +442,9 @@ public void testStyleBookEntry() throws Exception {
_styleBookEntryLocalService.addStyleBookEntry(
null, TestPropsValues.getUserId(), stagingGroup.getGroupId(),
false, StringPool.BLANK, RandomTestUtil.randomString(),
StringPool.BLANK,
StringPool.BLANK, RandomTestUtil.randomString(),
ServiceContextTestUtil.getServiceContext(
stagingGroup.getGroupId()),
StringPool.BLANK);
stagingGroup.getGroupId()));

Layout layout = LayoutTestUtil.addTypeContentLayout(stagingGroup);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ public void testEditLayoutDesignDoesntChangeWithNotEditedValues()
_styleBookEntryLocalService.addStyleBookEntry(
null, TestPropsValues.getUserId(), _group.getGroupId(), false,
StringPool.BLANK, RandomTestUtil.randomString(),
StringPool.BLANK, serviceContext, StringPool.BLANK);
StringPool.BLANK, RandomTestUtil.randomString(),
serviceContext);

FileEntry fileEntry = _dlAppLocalService.addFileEntry(
null, TestPropsValues.getUserId(), _group.getGroupId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,8 @@ public void testCreateLayoutPageTemplateEntry() throws Exception {
_styleBookEntryLocalService.addStyleBookEntry(
null, TestPropsValues.getUserId(), _group.getGroupId(), false,
StringPool.BLANK, RandomTestUtil.randomString(),
StringPool.BLANK,
ServiceContextTestUtil.getServiceContext(_group.getGroupId()),
StringPool.BLANK);
StringPool.BLANK, RandomTestUtil.randomString(),
ServiceContextTestUtil.getServiceContext(_group.getGroupId()));

draftLayout = _layoutLocalService.updateStyleBookEntryId(
draftLayout.getGroupId(), draftLayout.isPrivateLayout(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ public void testUpdateLayoutPageTemplateEntryName() throws Exception {
_styleBookEntryLocalService.addStyleBookEntry(
null, TestPropsValues.getUserId(), _group.getGroupId(), false,
StringPool.BLANK, RandomTestUtil.randomString(),
StringPool.BLANK, _serviceContext, StringPool.BLANK);
StringPool.BLANK, RandomTestUtil.randomString(),
_serviceContext);

Layout layout = _layoutLocalService.fetchLayout(
layoutPageTemplateEntry.getPlid());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public StyleBookEntry addStagedModel(
styleBookEntry.getGroupId(),
styleBookEntry.isDefaultStyleBookEntry(),
styleBookEntry.getFrontendTokensValues(), styleBookEntry.getName(),
styleBookEntry.getStyleBookEntryKey(), serviceContext,
styleBookEntry.getThemeId());
styleBookEntry.getStyleBookEntryKey(), styleBookEntry.getThemeId(),
serviceContext);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ public StyleBookEntry copyStyleBookEntry(
StyleBookEntry targetStyleBookEntry = addStyleBookEntry(
null, userId, groupId, false,
sourceStyleBookEntry.getFrontendTokensValues(), name,
StringPool.BLANK, serviceContext,
sourceStyleBookEntry.getThemeId());
StringPool.BLANK, sourceStyleBookEntry.getThemeId(),
serviceContext);

long previewFileEntryId = _copyStyleBookEntryPreviewFileEntry(
userId, groupId, sourceStyleBookEntry, targetStyleBookEntry);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public StyleBookEntry addStyleBookEntry(

return addStyleBookEntry(
externalReferenceCode, groupId, StringPool.BLANK, name,
styleBookEntryKey, serviceContext, themeId);
styleBookEntryKey, themeId, serviceContext);
}

@Override
Expand All @@ -56,8 +56,8 @@ public StyleBookEntry addStyleBookEntry(

return styleBookEntryLocalService.addStyleBookEntry(
externalReferenceCode, getUserId(), groupId, false,
frontendTokensValues, name, styleBookEntryKey, serviceContext,
themeId);
frontendTokensValues, name, styleBookEntryKey, themeId,
serviceContext);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ protected CTModel<?> addCTModel() throws Exception {
return _styleBookEntryLocalService.addStyleBookEntry(
null, TestPropsValues.getUserId(), TestPropsValues.getGroupId(),
false, StringPool.BLANK, RandomTestUtil.randomString(),
StringPool.BLANK, ServiceContextTestUtil.getServiceContext(),
StringPool.BLANK);
StringPool.BLANK, RandomTestUtil.randomString(),
ServiceContextTestUtil.getServiceContext());
}

@Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public void setUp() throws Exception {
_styleBookEntry = _styleBookEntryLocalService.addStyleBookEntry(
null, TestPropsValues.getUserId(), TestPropsValues.getGroupId(),
false, StringPool.BLANK, RandomTestUtil.randomString(),
RandomTestUtil.randomString(),
ServiceContextTestUtil.getServiceContext(), StringPool.BLANK);
RandomTestUtil.randomString(), RandomTestUtil.randomString(),
ServiceContextTestUtil.getServiceContext());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void testAddStyleBookEntry() throws Exception {
_styleBookEntryLocalService.addStyleBookEntry(
RandomTestUtil.randomString(), TestPropsValues.getUserId(),
_group.getGroupId(), false, null, RandomTestUtil.randomString(),
null, _serviceContext, null);
null, RandomTestUtil.randomString(), _serviceContext);

Assert.assertTrue(
Validator.isNotNull(styleBookEntry.getExternalReferenceCode()));
Expand All @@ -73,11 +73,11 @@ public void testAddStyleBookEntryWithExistingExternalReferenceCode()
_styleBookEntryLocalService.addStyleBookEntry(
externalReferenceCode, TestPropsValues.getUserId(),
_group.getGroupId(), false, null, RandomTestUtil.randomString(),
null, _serviceContext, null);
null, RandomTestUtil.randomString(), _serviceContext);
_styleBookEntryLocalService.addStyleBookEntry(
externalReferenceCode, TestPropsValues.getUserId(),
_group.getGroupId(), false, null, RandomTestUtil.randomString(),
null, _serviceContext, null);
null, RandomTestUtil.randomString(), _serviceContext);
}

@Test
Expand All @@ -88,7 +88,7 @@ public void testDeleteStyleBookEntryByExternalReferenceCode()
_styleBookEntryLocalService.addStyleBookEntry(
RandomTestUtil.randomString(), TestPropsValues.getUserId(),
_group.getGroupId(), false, null, RandomTestUtil.randomString(),
null, _serviceContext, null);
null, RandomTestUtil.randomString(), _serviceContext);

_styleBookEntryLocalService.deleteStyleBookEntry(
styleBookEntry.getExternalReferenceCode(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public void testAddStyleBookEntryWithoutAddPermission() throws Exception {

_styleBookEntryService.addStyleBookEntry(
RandomTestUtil.randomString(), _group.getGroupId(),
RandomTestUtil.randomString(), null, _serviceContext,
RandomTestUtil.randomString());
RandomTestUtil.randomString(), null,
RandomTestUtil.randomString(), _serviceContext);

Assert.fail();
}
Expand All @@ -82,8 +82,8 @@ public void testDeleteStyleBookEntryByExternalReferenceCode()
StyleBookEntry styleBookEntry =
_styleBookEntryService.addStyleBookEntry(
RandomTestUtil.randomString(), _group.getGroupId(),
RandomTestUtil.randomString(), null, _serviceContext,
RandomTestUtil.randomString());
RandomTestUtil.randomString(), null,
RandomTestUtil.randomString(), _serviceContext);

_styleBookEntryService.deleteStyleBookEntry(
styleBookEntry.getExternalReferenceCode(),
Expand All @@ -101,8 +101,8 @@ public void testDeleteStyleBookEntryByExternalReferenceCodeWithoutDeletePermissi
StyleBookEntry styleBookEntry =
_styleBookEntryService.addStyleBookEntry(
RandomTestUtil.randomString(), _group.getGroupId(),
RandomTestUtil.randomString(), null, _serviceContext,
RandomTestUtil.randomString());
RandomTestUtil.randomString(), null,
RandomTestUtil.randomString(), _serviceContext);

try {
UserTestUtil.setUser(
Expand All @@ -128,8 +128,8 @@ public void testGetStyleBookEntryByExternalReferenceCode()
StyleBookEntry styleBookEntry =
_styleBookEntryService.addStyleBookEntry(
RandomTestUtil.randomString(), _group.getGroupId(),
RandomTestUtil.randomString(), null, _serviceContext,
RandomTestUtil.randomString());
RandomTestUtil.randomString(), null,
RandomTestUtil.randomString(), _serviceContext);

StyleBookEntry curStyleBookEntry =
_styleBookEntryService.getStyleBookEntryByExternalReferenceCode(
Expand All @@ -148,8 +148,8 @@ public void testGetStyleBookEntryByExternalReferenceCodeWithoutViewPermission()
StyleBookEntry styleBookEntry =
_styleBookEntryService.addStyleBookEntry(
RandomTestUtil.randomString(), _group.getGroupId(),
RandomTestUtil.randomString(), null, _serviceContext,
RandomTestUtil.randomString());
RandomTestUtil.randomString(), null,
RandomTestUtil.randomString(), _serviceContext);

RoleTestUtil.removeResourcePermission(
RoleConstants.GUEST, StyleBookEntry.class.getName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,15 @@ public void testDeleteStyleBookEntries() throws Exception {
_styleBookEntryLocalService.addStyleBookEntry(
null, TestPropsValues.getUserId(), _group.getGroupId(), false,
StringPool.BLANK, RandomTestUtil.randomString(),
StringPool.BLANK, _serviceContext, StringPool.BLANK);
StringPool.BLANK, RandomTestUtil.randomString(),
_serviceContext);

StyleBookEntry styleBookEntry2 =
_styleBookEntryLocalService.addStyleBookEntry(
null, TestPropsValues.getUserId(), _group.getGroupId(), false,
StringPool.BLANK, RandomTestUtil.randomString(),
StringPool.BLANK, _serviceContext, StringPool.BLANK);
StringPool.BLANK, RandomTestUtil.randomString(),
_serviceContext);

MockLiferayPortletActionRequest mockLiferayPortletActionRequest =
new MockLiferayPortletActionRequest();
Expand Down Expand Up @@ -99,8 +101,8 @@ public void testDeleteStyleBookEntry() throws Exception {
StyleBookEntry styleBookEntry =
_styleBookEntryLocalService.addStyleBookEntry(
null, TestPropsValues.getUserId(), _group.getGroupId(), false,
StringPool.BLANK, name, StringPool.BLANK, _serviceContext,
StringPool.BLANK);
StringPool.BLANK, name, StringPool.BLANK,
RandomTestUtil.randomString(), _serviceContext);

MockLiferayPortletActionRequest mockLiferayPortletActionRequest =
new MockLiferayPortletActionRequest();
Expand Down Expand Up @@ -130,7 +132,8 @@ public void testDeleteStyleBookEntryWithPreviewFileEntry()
_styleBookEntryLocalService.addStyleBookEntry(
null, TestPropsValues.getUserId(), _group.getGroupId(), false,
StringPool.BLANK, RandomTestUtil.randomString(),
StringPool.BLANK, _serviceContext, StringPool.BLANK);
StringPool.BLANK, RandomTestUtil.randomString(),
_serviceContext);

FileEntry fileEntry = _addFileEntry(styleBookEntry);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ public void testDeleteStyleBookEntryPreviewFileEntry() throws Exception {
_styleBookEntryLocalService.addStyleBookEntry(
null, TestPropsValues.getUserId(), _group.getGroupId(), false,
StringPool.BLANK, RandomTestUtil.randomString(),
StringPool.BLANK, _serviceContext, StringPool.BLANK);
StringPool.BLANK, RandomTestUtil.randomString(),
_serviceContext);

FileEntry fileEntry = _addFileEntry(styleBookEntry);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import com.liferay.arquillian.extension.junit.bridge.junit.Arquillian;
import com.liferay.petra.string.CharPool;
import com.liferay.petra.string.StringPool;
import com.liferay.portal.kernel.json.JSONFactoryUtil;
import com.liferay.portal.kernel.json.JSONObject;
import com.liferay.portal.kernel.model.Group;
Expand Down Expand Up @@ -78,13 +77,13 @@ public void testExportImportMultipleStyleBookEntries() throws Exception {
null, TestPropsValues.getUserId(), _sourceGroup.getGroupId(),
false, _read("frontend-tokens-values.json"),
RandomTestUtil.randomString(), "STYLE_BOOK_ENTRY_KEY_1",
serviceContext, StringPool.BLANK);
RandomTestUtil.randomString(), serviceContext);
StyleBookEntry styleBookEntry2 =
_styleBookEntryLocalService.addStyleBookEntry(
null, TestPropsValues.getUserId(), _sourceGroup.getGroupId(),
false, _read("frontend-tokens-values.json"),
RandomTestUtil.randomString(), "STYLE_BOOK_ENTRY_KEY_2",
serviceContext, StringPool.BLANK);
RandomTestUtil.randomString(), serviceContext);

File file = ReflectionTestUtil.invoke(
_exportStyleBookEntriesMVCResourceCommand,
Expand Down Expand Up @@ -122,8 +121,8 @@ public void testExportImportSingleStyleBookEntry() throws Exception {
_styleBookEntryLocalService.addStyleBookEntry(
null, TestPropsValues.getUserId(), _sourceGroup.getGroupId(),
false, _read("frontend-tokens-values.json"),
"Style Book Entry Name", "STYLE_BOOK_ENTRY_KEY", serviceContext,
StringPool.BLANK);
"Style Book Entry Name", "STYLE_BOOK_ENTRY_KEY",
RandomTestUtil.randomString(), serviceContext);

File file = ReflectionTestUtil.invoke(
_exportStyleBookEntriesMVCResourceCommand,
Expand Down Expand Up @@ -174,8 +173,8 @@ public void testExportImportSingleStyleBookEntryAndNotOverwrite()
_styleBookEntryLocalService.addStyleBookEntry(
null, TestPropsValues.getUserId(), _sourceGroup.getGroupId(),
false, _read("frontend-tokens-values.json"),
"Style Book Entry Name", "STYLE_BOOK_ENTRY_KEY", serviceContext,
StringPool.BLANK);
"Style Book Entry Name", "STYLE_BOOK_ENTRY_KEY",
RandomTestUtil.randomString(), serviceContext);

File file = ReflectionTestUtil.invoke(
_exportStyleBookEntriesMVCResourceCommand,
Expand Down Expand Up @@ -218,8 +217,8 @@ public void testExportImportSingleStyleBookEntryAndOverwrite()
_styleBookEntryLocalService.addStyleBookEntry(
null, TestPropsValues.getUserId(), _sourceGroup.getGroupId(),
false, _read("frontend-tokens-values.json"),
"Style Book Entry Name", "STYLE_BOOK_ENTRY_KEY", serviceContext,
StringPool.BLANK);
"Style Book Entry Name", "STYLE_BOOK_ENTRY_KEY",
RandomTestUtil.randomString(), serviceContext);

File file = ReflectionTestUtil.invoke(
_exportStyleBookEntriesMVCResourceCommand,
Expand Down Expand Up @@ -284,7 +283,7 @@ public void testExportStyleBookEntries() throws Exception {
null, TestPropsValues.getUserId(), _sourceGroup.getGroupId(),
false, _read("frontend-tokens-values.json"),
RandomTestUtil.randomString(), "STYLE_BOOK_ENTRY_KEY",
serviceContext, StringPool.BLANK);
RandomTestUtil.randomString(), serviceContext);

FileEntry fileEntry = _addFileEntry(styleBookEntry);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ public void testCopyStyleBookEntry() throws Exception {
StyleBookEntry sourceStyleBookEntry =
_styleBookEntryService.addStyleBookEntry(
null, _group.getGroupId(), RandomTestUtil.randomString(),
"STYLE_BOOK_ENTRY_KEY",
ServiceContextTestUtil.getServiceContext(_group.getGroupId()),
RandomTestUtil.randomString());
"STYLE_BOOK_ENTRY_KEY", RandomTestUtil.randomString(),
ServiceContextTestUtil.getServiceContext(_group.getGroupId()));

StyleBookEntry targetStyleBookEntry =
_styleBookEntryService.copyStyleBookEntry(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ public void testMarkAsDefaultStyleBookEntry() throws Exception {
_styleBookEntryLocalService.addStyleBookEntry(
null, TestPropsValues.getUserId(), _group.getGroupId(), false,
StringPool.BLANK, RandomTestUtil.randomString(),
StringPool.BLANK, _serviceContext, StringPool.BLANK);
StringPool.BLANK, RandomTestUtil.randomString(),
_serviceContext);

MockLiferayPortletActionRequest mockLiferayPortletActionRequest =
new MockLiferayPortletActionRequest();
Expand Down Expand Up @@ -107,7 +108,8 @@ public void testReplaceDefaultStyleBookEntry() throws Exception {
_styleBookEntryLocalService.addStyleBookEntry(
null, TestPropsValues.getUserId(), _group.getGroupId(), false,
StringPool.BLANK, RandomTestUtil.randomString(),
StringPool.BLANK, _serviceContext, StringPool.BLANK);
StringPool.BLANK, RandomTestUtil.randomString(),
_serviceContext);

MockLiferayPortletActionRequest mockLiferayPortletActionRequest =
new MockLiferayPortletActionRequest();
Expand All @@ -134,7 +136,8 @@ public void testReplaceDefaultStyleBookEntry() throws Exception {
_styleBookEntryLocalService.addStyleBookEntry(
null, TestPropsValues.getUserId(), _group.getGroupId(), false,
StringPool.BLANK, RandomTestUtil.randomString(),
StringPool.BLANK, _serviceContext, StringPool.BLANK);
StringPool.BLANK, RandomTestUtil.randomString(),
_serviceContext);

mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest();

Expand Down Expand Up @@ -167,7 +170,8 @@ public void testUnmarkAsDefaultStyleBookEntry() throws Exception {
_styleBookEntryLocalService.addStyleBookEntry(
null, TestPropsValues.getUserId(), _group.getGroupId(), false,
StringPool.BLANK, RandomTestUtil.randomString(),
StringPool.BLANK, _serviceContext, StringPool.BLANK);
StringPool.BLANK, RandomTestUtil.randomString(),
_serviceContext);

MockLiferayPortletActionRequest mockLiferayPortletActionRequest =
new MockLiferayPortletActionRequest();
Expand Down
Loading

0 comments on commit 7873ad3

Please sign in to comment.