From ce1f12133b7b7950dcecf9551d906150db7e05ed Mon Sep 17 00:00:00 2001 From: Regisson Aguiar Date: Mon, 16 Sep 2024 15:38:51 -0300 Subject: [PATCH] LPD-36483 add unit tests for the method copyCPDefinition from CPDefinition Services classes --- .../expected/upgrade/UpgradeCatchAllCheck.testjava | 9 +++++++++ .../dependencies/upgrade/UpgradeCatchAllCheck.testjava | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/modules/util/source-formatter/src/test/resources/com/liferay/source/formatter/dependencies/expected/upgrade/UpgradeCatchAllCheck.testjava b/modules/util/source-formatter/src/test/resources/com/liferay/source/formatter/dependencies/expected/upgrade/UpgradeCatchAllCheck.testjava index 4b34ab3f31e9c8..8a12cc443b7e41 100644 --- a/modules/util/source-formatter/src/test/resources/com/liferay/source/formatter/dependencies/expected/upgrade/UpgradeCatchAllCheck.testjava +++ b/modules/util/source-formatter/src/test/resources/com/liferay/source/formatter/dependencies/expected/upgrade/UpgradeCatchAllCheck.testjava @@ -19,6 +19,7 @@ import com.liferay.portal.kernel.service.ServiceContextThreadLocal; import com.liferay.portal.kernel.util.HtmlParser; import com.liferay.portal.kernel.util.HttpComponentsUtil; import com.liferay.portal.kernel.util.PortalUtil; +import com.liferay.portal.kernel.workflow.WorkflowConstants; import java.util.ArrayList; @@ -884,6 +885,14 @@ public class UpgradeCatchAllCheck implements ConfigurationBeanDeclaration { _cpDefinitionLinkLocalService.addCPDefinitionLinkByCProductId(cpDefinitionId, cProductId, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, true, priority, type, serviceContext); } + public void method( + long sourceCPDefinitionId, long groupId, int status) { + + CPDefinitionLocalServiceUtil.copyCPDefinition(null, groupId); + CPDefinitionLocalServiceUtil.copyCPDefinition(sourceCPDefinitionId, groupId, WorkflowConstants.STATUS_DRAFT); + _cpDefinitionLocalService.copyCPDefinition(sourceCPDefinitionId, groupId, WorkflowConstants.STATUS_DRAFT); + } + public void method( long commerceOrderId, long cpInstanceId, int quantity, int shippedQuantity, String json, CommerceContext commerceContext, diff --git a/modules/util/source-formatter/src/test/resources/com/liferay/source/formatter/dependencies/upgrade/UpgradeCatchAllCheck.testjava b/modules/util/source-formatter/src/test/resources/com/liferay/source/formatter/dependencies/upgrade/UpgradeCatchAllCheck.testjava index 5758c46bc6d615..636b9703c1fb8e 100644 --- a/modules/util/source-formatter/src/test/resources/com/liferay/source/formatter/dependencies/upgrade/UpgradeCatchAllCheck.testjava +++ b/modules/util/source-formatter/src/test/resources/com/liferay/source/formatter/dependencies/upgrade/UpgradeCatchAllCheck.testjava @@ -870,6 +870,14 @@ public class UpgradeCatchAllCheck implements ConfigurationBeanDeclaration { _cpDefinitionLinkLocalService.addCPDefinitionLinkByCProductId(cpDefinitionId, cProductId, priority, type, serviceContext); } + public void method( + long sourceCPDefinitionId, long groupId, int status) { + + CPDefinitionLocalServiceUtil.copyCPDefinition(null, groupId); + CPDefinitionLocalServiceUtil.copyCPDefinition(sourceCPDefinitionId, groupId); + _cpDefinitionLocalService.copyCPDefinition(sourceCPDefinitionId, groupId); + } + public void method( long commerceOrderId, long cpInstanceId, int quantity, int shippedQuantity, String json, CommerceContext commerceContext,