From 74cc7113fa6dd7de98e61222c6e43628572695f1 Mon Sep 17 00:00:00 2001 From: macacia Date: Thu, 19 Dec 2024 13:19:56 +0100 Subject: [PATCH 01/16] P4ADEV-1635 added implementation --- .../ClearClassifyIuvActivity.java | 20 +++++++++++++++++ .../ClearClassifyIuvActivityImpl.java | 22 +++++++++++++++++++ .../activities/dao/ClassificationDao.java | 9 +++++++- version | 2 +- 4 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/ClearClassifyIuvActivity.java create mode 100644 src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/ClearClassifyIuvActivityImpl.java diff --git a/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/ClearClassifyIuvActivity.java b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/ClearClassifyIuvActivity.java new file mode 100644 index 00000000..2e0a9824 --- /dev/null +++ b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/ClearClassifyIuvActivity.java @@ -0,0 +1,20 @@ +package it.gov.pagopa.payhub.activities.activity.classifications; + +import io.temporal.activity.ActivityInterface; +import io.temporal.activity.ActivityMethod; + +/** + * Interface for defining an activity to delete classifications based on IUV. + */ +@ActivityInterface +public interface ClearClassifyIuvActivity { + /** + * deletion of a classification based on the provided parameters + * + * @param organizationId organization id + * @param iuv creditor reference identifier + * @return boolean true if success deletion or false if fails + */ + @ActivityMethod + boolean deleteClassificationByIuv(Long organizationId, String iuv); +} diff --git a/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/ClearClassifyIuvActivityImpl.java b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/ClearClassifyIuvActivityImpl.java new file mode 100644 index 00000000..c479dd30 --- /dev/null +++ b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/ClearClassifyIuvActivityImpl.java @@ -0,0 +1,22 @@ +package it.gov.pagopa.payhub.activities.activity.classifications; + +import it.gov.pagopa.payhub.activities.dao.ClassificationDao; +import lombok.extern.slf4j.Slf4j; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Component; + +@Lazy +@Slf4j +@Component +public class ClearClassifyIuvActivityImpl implements ClearClassifyIuvActivity { + private final ClassificationDao classificationDao; + + public ClearClassifyIuvActivityImpl(ClassificationDao classificationDao) { + this.classificationDao = classificationDao; + } + + public boolean deleteClassificationByIuv(Long organizationId, String iuv) { + log.debug("Deleting classifications for organization id: {} and iuv: {}", organizationId, iuv); + return classificationDao.deleteClassificationByIuv(organizationId, iuv); + } +} diff --git a/src/main/java/it/gov/pagopa/payhub/activities/dao/ClassificationDao.java b/src/main/java/it/gov/pagopa/payhub/activities/dao/ClassificationDao.java index ff470329..26296228 100644 --- a/src/main/java/it/gov/pagopa/payhub/activities/dao/ClassificationDao.java +++ b/src/main/java/it/gov/pagopa/payhub/activities/dao/ClassificationDao.java @@ -14,5 +14,12 @@ public interface ClassificationDao { * @return true for success deletion */ boolean deleteClassificationByIuf(Long organizationId, String iuf, ClassificationsEnum classification); -} + /** + * + * @param organizationId organization id + * @param iuv creditor reference identifier + * @return true for success deletion + */ + boolean deleteClassificationByIuv(Long organizationId, String iuv); +} diff --git a/version b/version index 15b989e3..a0026c4e 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.16.0 +1.16.2-SNAPSHOT From 74e411224475c04b708cc097adf47c45ddd13bec Mon Sep 17 00:00:00 2001 From: macacia Date: Thu, 19 Dec 2024 13:20:26 +0100 Subject: [PATCH 02/16] P4ADEV-1635 added unit test --- .../ClearClassifyIuvActivityImplTest.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/ClearClassifyIuvActivityImplTest.java diff --git a/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/ClearClassifyIuvActivityImplTest.java b/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/ClearClassifyIuvActivityImplTest.java new file mode 100644 index 00000000..7c923e21 --- /dev/null +++ b/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/ClearClassifyIuvActivityImplTest.java @@ -0,0 +1,39 @@ +package it.gov.pagopa.payhub.activities.activity.classifications; + +import it.gov.pagopa.payhub.activities.dao.ClassificationDao; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +class ClearClassifyIuvActivityImplTest { + private static final Long ORGANIZATION = 1L; + private static final String IUV = "01011112222333345"; + + @Mock + private ClassificationDao classificationDaoMock; + + private ClearClassifyIuvActivity activity; + + @BeforeEach + void setUp() { + activity = new ClearClassifyIuvActivityImpl(classificationDaoMock); + } + + @Test + void deleteClassificationSuccess() { + assertDoesNotThrow(() -> activity.deleteClassificationByIuv(ORGANIZATION, IUV)); + } + + @Test + void deleteClassificationFailed() { + when(classificationDaoMock.deleteClassificationByIuv(ORGANIZATION, IUV)).thenReturn(Boolean.FALSE); + assertFalse(activity.deleteClassificationByIuv(ORGANIZATION, IUV)); + } +} From 74f51f9150ceb27f44084f70524e03bd264b3911 Mon Sep 17 00:00:00 2001 From: macacia Date: Fri, 20 Dec 2024 13:06:05 +0100 Subject: [PATCH 03/16] P4ADEV-1635 refactor activity --- .../ClearClassifyIuvActivity.java | 20 ------------------- .../IuvClassificationActivity.java | 8 +++++++- ...ava => IuvClassificationActivityImpl.java} | 13 +++++++++--- ...=> IuvClassificationActivityImplTest.java} | 12 +++++------ 4 files changed, 23 insertions(+), 30 deletions(-) delete mode 100644 src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/ClearClassifyIuvActivity.java rename src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/{ClearClassifyIuvActivityImpl.java => IuvClassificationActivityImpl.java} (57%) rename src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/{ClearClassifyIuvActivityImplTest.java => IuvClassificationActivityImplTest.java} (71%) diff --git a/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/ClearClassifyIuvActivity.java b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/ClearClassifyIuvActivity.java deleted file mode 100644 index 2e0a9824..00000000 --- a/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/ClearClassifyIuvActivity.java +++ /dev/null @@ -1,20 +0,0 @@ -package it.gov.pagopa.payhub.activities.activity.classifications; - -import io.temporal.activity.ActivityInterface; -import io.temporal.activity.ActivityMethod; - -/** - * Interface for defining an activity to delete classifications based on IUV. - */ -@ActivityInterface -public interface ClearClassifyIuvActivity { - /** - * deletion of a classification based on the provided parameters - * - * @param organizationId organization id - * @param iuv creditor reference identifier - * @return boolean true if success deletion or false if fails - */ - @ActivityMethod - boolean deleteClassificationByIuv(Long organizationId, String iuv); -} diff --git a/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/IuvClassificationActivity.java b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/IuvClassificationActivity.java index b2ef4636..71d0e2ff 100644 --- a/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/IuvClassificationActivity.java +++ b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/IuvClassificationActivity.java @@ -1,7 +1,12 @@ package it.gov.pagopa.payhub.activities.activity.classifications; + +import io.temporal.activity.ActivityInterface; +import io.temporal.activity.ActivityMethod; + /** * Interface for defining an activity to process payment classifications based on IUV. */ +@ActivityInterface public interface IuvClassificationActivity { /** @@ -13,5 +18,6 @@ public interface IuvClassificationActivity { * @param transferIndex the index of the transfer to be classified * @return true if the classification is successful, false otherwise */ - boolean classify(String organizationId, String iuv, String receiptId, int transferIndex); + @ActivityMethod + boolean classify(Long organizationId, String iuv, String receiptId, int transferIndex); } \ No newline at end of file diff --git a/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/ClearClassifyIuvActivityImpl.java b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/IuvClassificationActivityImpl.java similarity index 57% rename from src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/ClearClassifyIuvActivityImpl.java rename to src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/IuvClassificationActivityImpl.java index c479dd30..6a4bfda7 100644 --- a/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/ClearClassifyIuvActivityImpl.java +++ b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/IuvClassificationActivityImpl.java @@ -8,14 +8,21 @@ @Lazy @Slf4j @Component -public class ClearClassifyIuvActivityImpl implements ClearClassifyIuvActivity { +public class IuvClassificationActivityImpl implements IuvClassificationActivity { private final ClassificationDao classificationDao; - public ClearClassifyIuvActivityImpl(ClassificationDao classificationDao) { + public IuvClassificationActivityImpl(ClassificationDao classificationDao) { this.classificationDao = classificationDao; } - public boolean deleteClassificationByIuv(Long organizationId, String iuv) { + + @Override + public boolean classify(Long organizationId, String iuv, String receiptId, int transferIndex) { + + return cleanUpCurrentProcessingRequests(organizationId, iuv); + } + + private boolean cleanUpCurrentProcessingRequests(Long organizationId, String iuv) { log.debug("Deleting classifications for organization id: {} and iuv: {}", organizationId, iuv); return classificationDao.deleteClassificationByIuv(organizationId, iuv); } diff --git a/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/ClearClassifyIuvActivityImplTest.java b/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/IuvClassificationActivityImplTest.java similarity index 71% rename from src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/ClearClassifyIuvActivityImplTest.java rename to src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/IuvClassificationActivityImplTest.java index 7c923e21..67c01a03 100644 --- a/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/ClearClassifyIuvActivityImplTest.java +++ b/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/IuvClassificationActivityImplTest.java @@ -12,28 +12,28 @@ import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) -class ClearClassifyIuvActivityImplTest { - private static final Long ORGANIZATION = 1L; +class IuvClassificationActivityImplTest { + private static final Long ORGANIZATION = 123L; private static final String IUV = "01011112222333345"; @Mock private ClassificationDao classificationDaoMock; - private ClearClassifyIuvActivity activity; + private IuvClassificationActivity activity; @BeforeEach void setUp() { - activity = new ClearClassifyIuvActivityImpl(classificationDaoMock); + activity = new IuvClassificationActivityImpl(classificationDaoMock); } @Test void deleteClassificationSuccess() { - assertDoesNotThrow(() -> activity.deleteClassificationByIuv(ORGANIZATION, IUV)); + assertDoesNotThrow(() -> activity.classify(ORGANIZATION, IUV, "receiptId", 1)); } @Test void deleteClassificationFailed() { when(classificationDaoMock.deleteClassificationByIuv(ORGANIZATION, IUV)).thenReturn(Boolean.FALSE); - assertFalse(activity.deleteClassificationByIuv(ORGANIZATION, IUV)); + assertFalse(activity.classify(ORGANIZATION, IUV, "receiptId", 1)); } } From 0adbb205bccfe0108437e6613894797f5e7d203f Mon Sep 17 00:00:00 2001 From: macacia Date: Fri, 20 Dec 2024 14:56:27 +0100 Subject: [PATCH 04/16] P4ADEV-1635 refactoring according to new documentation --- .../IuvClassificationActivityImpl.java | 29 ------------------- ...va => TransferClassificationActivity.java} | 10 +++---- .../TransferClassificationActivityImpl.java | 28 ++++++++++++++++++ .../activities/dao/ClassificationDao.java | 2 +- ...ansferClassificationActivityImplTest.java} | 14 +++++---- 5 files changed, 42 insertions(+), 41 deletions(-) delete mode 100644 src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/IuvClassificationActivityImpl.java rename src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/{IuvClassificationActivity.java => TransferClassificationActivity.java} (59%) create mode 100644 src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImpl.java rename src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/{IuvClassificationActivityImplTest.java => TransferClassificationActivityImplTest.java} (66%) diff --git a/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/IuvClassificationActivityImpl.java b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/IuvClassificationActivityImpl.java deleted file mode 100644 index 6a4bfda7..00000000 --- a/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/IuvClassificationActivityImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -package it.gov.pagopa.payhub.activities.activity.classifications; - -import it.gov.pagopa.payhub.activities.dao.ClassificationDao; -import lombok.extern.slf4j.Slf4j; -import org.springframework.context.annotation.Lazy; -import org.springframework.stereotype.Component; - -@Lazy -@Slf4j -@Component -public class IuvClassificationActivityImpl implements IuvClassificationActivity { - private final ClassificationDao classificationDao; - - public IuvClassificationActivityImpl(ClassificationDao classificationDao) { - this.classificationDao = classificationDao; - } - - - @Override - public boolean classify(Long organizationId, String iuv, String receiptId, int transferIndex) { - - return cleanUpCurrentProcessingRequests(organizationId, iuv); - } - - private boolean cleanUpCurrentProcessingRequests(Long organizationId, String iuv) { - log.debug("Deleting classifications for organization id: {} and iuv: {}", organizationId, iuv); - return classificationDao.deleteClassificationByIuv(organizationId, iuv); - } -} diff --git a/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/IuvClassificationActivity.java b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivity.java similarity index 59% rename from src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/IuvClassificationActivity.java rename to src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivity.java index 71d0e2ff..a553510c 100644 --- a/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/IuvClassificationActivity.java +++ b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivity.java @@ -7,17 +7,17 @@ * Interface for defining an activity to process payment classifications based on IUV. */ @ActivityInterface -public interface IuvClassificationActivity { +public interface TransferClassificationActivity { /** * Processes IUV classification based on the provided parameters. * - * @param organizationId the unique identifier of the organization - * @param iuv the unique identifier of the payment (IUV) - * @param receiptId the identifier of the receipt associated with the payment + * @param orgId the unique identifier of the organization + * @param iuv the unique identifier of the payment (IUV) + * @param iur the identifier of the receipt associated with the payment * @param transferIndex the index of the transfer to be classified * @return true if the classification is successful, false otherwise */ @ActivityMethod - boolean classify(Long organizationId, String iuv, String receiptId, int transferIndex); + boolean classify(Long orgId, String iuv, String iur, int transferIndex); } \ No newline at end of file diff --git a/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImpl.java b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImpl.java new file mode 100644 index 00000000..804e5d4c --- /dev/null +++ b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImpl.java @@ -0,0 +1,28 @@ +package it.gov.pagopa.payhub.activities.activity.classifications; + +import it.gov.pagopa.payhub.activities.dao.ClassificationDao; +import lombok.extern.slf4j.Slf4j; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Component; + +@Lazy +@Slf4j +@Component +public class TransferClassificationActivityImpl implements TransferClassificationActivity { + private final ClassificationDao classificationDao; + + public TransferClassificationActivityImpl(ClassificationDao classificationDao) { + this.classificationDao = classificationDao; + } + + @Override + public boolean classify(Long orgId, String iuv, String iur, int transferIndex) { + + return cleanUpCurrentProcessingRequests(orgId, iuv, iur, transferIndex); + } + + private boolean cleanUpCurrentProcessingRequests(Long orgId, String iuv, String iur, int transferIndex) { + log.debug("Deleting classifications for organization id: {} and iuv: {}", orgId, iuv); + return classificationDao.deleteClassificationByTransferKeySet(orgId, iuv, iur, transferIndex); + } +} diff --git a/src/main/java/it/gov/pagopa/payhub/activities/dao/ClassificationDao.java b/src/main/java/it/gov/pagopa/payhub/activities/dao/ClassificationDao.java index 26296228..88b8027a 100644 --- a/src/main/java/it/gov/pagopa/payhub/activities/dao/ClassificationDao.java +++ b/src/main/java/it/gov/pagopa/payhub/activities/dao/ClassificationDao.java @@ -21,5 +21,5 @@ public interface ClassificationDao { * @param iuv creditor reference identifier * @return true for success deletion */ - boolean deleteClassificationByIuv(Long organizationId, String iuv); + boolean deleteClassificationByTransferKeySet(Long orgId, String iuv, String iur, int transferIndex); } diff --git a/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/IuvClassificationActivityImplTest.java b/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java similarity index 66% rename from src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/IuvClassificationActivityImplTest.java rename to src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java index 67c01a03..c7aee263 100644 --- a/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/IuvClassificationActivityImplTest.java +++ b/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java @@ -12,28 +12,30 @@ import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) -class IuvClassificationActivityImplTest { +class TransferClassificationActivityImplTest { private static final Long ORGANIZATION = 123L; private static final String IUV = "01011112222333345"; + private static final String IUR = "IUR"; + private static final int INDEX = 1; @Mock private ClassificationDao classificationDaoMock; - private IuvClassificationActivity activity; + private TransferClassificationActivity activity; @BeforeEach void setUp() { - activity = new IuvClassificationActivityImpl(classificationDaoMock); + activity = new TransferClassificationActivityImpl(classificationDaoMock); } @Test void deleteClassificationSuccess() { - assertDoesNotThrow(() -> activity.classify(ORGANIZATION, IUV, "receiptId", 1)); + assertDoesNotThrow(() -> activity.classify(ORGANIZATION, IUV, IUR, INDEX)); } @Test void deleteClassificationFailed() { - when(classificationDaoMock.deleteClassificationByIuv(ORGANIZATION, IUV)).thenReturn(Boolean.FALSE); - assertFalse(activity.classify(ORGANIZATION, IUV, "receiptId", 1)); + when(classificationDaoMock.deleteClassificationByTransferKeySet(ORGANIZATION, IUV, IUR, INDEX)).thenReturn(Boolean.FALSE); + assertFalse(activity.classify(ORGANIZATION, IUV, IUR, INDEX)); } } From 66c2450e87ea050b0f05dc7e764db3fe885fc1f4 Mon Sep 17 00:00:00 2001 From: macacia Date: Fri, 20 Dec 2024 15:10:47 +0100 Subject: [PATCH 05/16] P4ADEV-1635 arrange javadoc --- .../gov/pagopa/payhub/activities/dao/ClassificationDao.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/it/gov/pagopa/payhub/activities/dao/ClassificationDao.java b/src/main/java/it/gov/pagopa/payhub/activities/dao/ClassificationDao.java index 88b8027a..e54a4ba5 100644 --- a/src/main/java/it/gov/pagopa/payhub/activities/dao/ClassificationDao.java +++ b/src/main/java/it/gov/pagopa/payhub/activities/dao/ClassificationDao.java @@ -17,8 +17,10 @@ public interface ClassificationDao { /** * - * @param organizationId organization id + * @param orgId organization id * @param iuv creditor reference identifier + * @param iur the identifier of the receipt associated with the payment + * @param transferIndex the index of the transfer to be classified * @return true for success deletion */ boolean deleteClassificationByTransferKeySet(Long orgId, String iuv, String iur, int transferIndex); From ab2e6f18f879db70d62a5917ae7234fb3e8851b5 Mon Sep 17 00:00:00 2001 From: macacia Date: Fri, 20 Dec 2024 16:08:42 +0100 Subject: [PATCH 06/16] P4ADEV-1635 clean --- .../classifications/TransferClassificationActivityImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImpl.java b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImpl.java index 804e5d4c..664125b4 100644 --- a/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImpl.java +++ b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImpl.java @@ -17,8 +17,9 @@ public TransferClassificationActivityImpl(ClassificationDao classificationDao) { @Override public boolean classify(Long orgId, String iuv, String iur, int transferIndex) { + cleanUpCurrentProcessingRequests(orgId, iuv, iur, transferIndex); - return cleanUpCurrentProcessingRequests(orgId, iuv, iur, transferIndex); + return false; } private boolean cleanUpCurrentProcessingRequests(Long orgId, String iuv, String iur, int transferIndex) { From 67f742350d50975d4256bd1e2ca257cbebbadc70 Mon Sep 17 00:00:00 2001 From: macacia Date: Fri, 20 Dec 2024 16:45:40 +0100 Subject: [PATCH 07/16] P4ADEV-1639 added dao --- .../payhub/activities/dao/TransferDao.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/main/java/it/gov/pagopa/payhub/activities/dao/TransferDao.java diff --git a/src/main/java/it/gov/pagopa/payhub/activities/dao/TransferDao.java b/src/main/java/it/gov/pagopa/payhub/activities/dao/TransferDao.java new file mode 100644 index 00000000..4e268070 --- /dev/null +++ b/src/main/java/it/gov/pagopa/payhub/activities/dao/TransferDao.java @@ -0,0 +1,16 @@ +package it.gov.pagopa.payhub.activities.dao; + +import it.gov.pagopa.payhub.activities.dto.TransferDTO; + +import java.util.List; + +/** + * Data Access Object (DAO) interface for handling operations related to + * `Transfer` objects. + * + * @see TransferDTO + */ +public interface TransferDao { + + List retrieveTransferByLogicalKey(Long orgId, String iuv, String iur, int transferIndex); +} From 517d2d6c7aae8fa1e92c7917411404c1ddcc95a4 Mon Sep 17 00:00:00 2001 From: macacia Date: Fri, 20 Dec 2024 17:34:06 +0100 Subject: [PATCH 08/16] P4ADEV-1635 resolved change request --- .../TransferClassificationActivity.java | 7 +++---- .../TransferClassificationActivityImpl.java | 14 ++++++-------- .../payhub/activities/dao/ClassificationDao.java | 2 +- .../exception/ClassificationException.java | 12 ++++++++++++ .../TransferClassificationActivityImplTest.java | 13 +++++++------ 5 files changed, 29 insertions(+), 19 deletions(-) create mode 100644 src/main/java/it/gov/pagopa/payhub/activities/exception/ClassificationException.java diff --git a/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivity.java b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivity.java index a553510c..fe727294 100644 --- a/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivity.java +++ b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivity.java @@ -4,20 +4,19 @@ import io.temporal.activity.ActivityMethod; /** - * Interface for defining an activity to process payment classifications based on IUV. + * Interface for defining an activity to process Transfer classifications. */ @ActivityInterface public interface TransferClassificationActivity { /** - * Processes IUV classification based on the provided parameters. + * Processes Transfer classification based on the provided parameters. * * @param orgId the unique identifier of the organization * @param iuv the unique identifier of the payment (IUV) * @param iur the identifier of the receipt associated with the payment * @param transferIndex the index of the transfer to be classified - * @return true if the classification is successful, false otherwise */ @ActivityMethod - boolean classify(Long orgId, String iuv, String iur, int transferIndex); + void classify(Long orgId, String iuv, String iur, int transferIndex); } \ No newline at end of file diff --git a/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImpl.java b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImpl.java index 664125b4..29dc5ff4 100644 --- a/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImpl.java +++ b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImpl.java @@ -1,6 +1,7 @@ package it.gov.pagopa.payhub.activities.activity.classifications; import it.gov.pagopa.payhub.activities.dao.ClassificationDao; +import it.gov.pagopa.payhub.activities.exception.ClassificationException; import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; @@ -16,14 +17,11 @@ public TransferClassificationActivityImpl(ClassificationDao classificationDao) { } @Override - public boolean classify(Long orgId, String iuv, String iur, int transferIndex) { - cleanUpCurrentProcessingRequests(orgId, iuv, iur, transferIndex); - - return false; + public void classify(Long orgId, String iuv, String iur, int transferIndex) { + log.info("Transfer classification for organization id: {} and iuv: {}", orgId, iuv); + if (!classificationDao.deleteTransferClassification(orgId, iuv, iur, transferIndex)) { + throw new ClassificationException("Error occured while clean up current processing Requests due to deletion failed"); + } } - private boolean cleanUpCurrentProcessingRequests(Long orgId, String iuv, String iur, int transferIndex) { - log.debug("Deleting classifications for organization id: {} and iuv: {}", orgId, iuv); - return classificationDao.deleteClassificationByTransferKeySet(orgId, iuv, iur, transferIndex); - } } diff --git a/src/main/java/it/gov/pagopa/payhub/activities/dao/ClassificationDao.java b/src/main/java/it/gov/pagopa/payhub/activities/dao/ClassificationDao.java index e54a4ba5..62804aa1 100644 --- a/src/main/java/it/gov/pagopa/payhub/activities/dao/ClassificationDao.java +++ b/src/main/java/it/gov/pagopa/payhub/activities/dao/ClassificationDao.java @@ -23,5 +23,5 @@ public interface ClassificationDao { * @param transferIndex the index of the transfer to be classified * @return true for success deletion */ - boolean deleteClassificationByTransferKeySet(Long orgId, String iuv, String iur, int transferIndex); + boolean deleteTransferClassification(Long orgId, String iuv, String iur, int transferIndex); } diff --git a/src/main/java/it/gov/pagopa/payhub/activities/exception/ClassificationException.java b/src/main/java/it/gov/pagopa/payhub/activities/exception/ClassificationException.java new file mode 100644 index 00000000..110431ed --- /dev/null +++ b/src/main/java/it/gov/pagopa/payhub/activities/exception/ClassificationException.java @@ -0,0 +1,12 @@ +package it.gov.pagopa.payhub.activities.exception; + +public class ClassificationException extends ActivitiesException { + /** + * Constructs a new {@code ActivitiesException} with the specified detail message. + * + * @param message the detail message explaining the cause of the exception. + */ + public ClassificationException(String message) { + super(message); + } +} diff --git a/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java b/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java index c7aee263..7b16a12c 100644 --- a/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java +++ b/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java @@ -1,14 +1,14 @@ package it.gov.pagopa.payhub.activities.activity.classifications; import it.gov.pagopa.payhub.activities.dao.ClassificationDao; +import it.gov.pagopa.payhub.activities.exception.ClassificationException; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) @@ -29,13 +29,14 @@ void setUp() { } @Test - void deleteClassificationSuccess() { + void classificationSuccess() { + when(classificationDaoMock.deleteTransferClassification(ORGANIZATION, IUV, IUR, INDEX)).thenReturn(Boolean.TRUE); assertDoesNotThrow(() -> activity.classify(ORGANIZATION, IUV, IUR, INDEX)); } @Test - void deleteClassificationFailed() { - when(classificationDaoMock.deleteClassificationByTransferKeySet(ORGANIZATION, IUV, IUR, INDEX)).thenReturn(Boolean.FALSE); - assertFalse(activity.classify(ORGANIZATION, IUV, IUR, INDEX)); + void classificationFailed() { + when(classificationDaoMock.deleteTransferClassification(ORGANIZATION, IUV, IUR, INDEX)).thenThrow(new ClassificationException("deletion failed")); + assertThrows(ClassificationException.class, () -> activity.classify(ORGANIZATION, IUV, IUR, INDEX), "classification failed"); } } From 324a0896d76f812dec389fe7a2f414faa2ab2466 Mon Sep 17 00:00:00 2001 From: macacia Date: Fri, 20 Dec 2024 18:45:44 +0100 Subject: [PATCH 09/16] P4ADEV-1639 added implementation --- .../TransferClassificationActivity.java | 20 +++++++++---------- .../TransferClassificationActivityImpl.java | 8 ++++++-- ...ransferClassificationActivityImplTest.java | 19 ++++++++++++++++-- 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivity.java b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivity.java index fe727294..9fc8337c 100644 --- a/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivity.java +++ b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivity.java @@ -9,14 +9,14 @@ @ActivityInterface public interface TransferClassificationActivity { - /** - * Processes Transfer classification based on the provided parameters. - * - * @param orgId the unique identifier of the organization - * @param iuv the unique identifier of the payment (IUV) - * @param iur the identifier of the receipt associated with the payment - * @param transferIndex the index of the transfer to be classified - */ - @ActivityMethod - void classify(Long orgId, String iuv, String iur, int transferIndex); + /** + * Processes Transfer classification based on the provided parameters. + * + * @param orgId the unique identifier of the organization + * @param iuv the unique identifier of the payment (IUV) + * @param iur the identifier of the receipt associated with the payment + * @param transferIndex the index of the transfer to be classified + */ + @ActivityMethod + void classify(Long orgId, String iuv, String iur, int transferIndex); } \ No newline at end of file diff --git a/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImpl.java b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImpl.java index 588de427..3ee76d54 100644 --- a/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImpl.java +++ b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImpl.java @@ -1,6 +1,7 @@ package it.gov.pagopa.payhub.activities.activity.classifications; import it.gov.pagopa.payhub.activities.dao.ClassificationDao; +import it.gov.pagopa.payhub.activities.dao.TransferDao; import it.gov.pagopa.payhub.activities.exception.ClassificationException; import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Lazy; @@ -11,9 +12,12 @@ @Component public class TransferClassificationActivityImpl implements TransferClassificationActivity { private final ClassificationDao classificationDao; + private final TransferDao transferDao; - public TransferClassificationActivityImpl(ClassificationDao classificationDao) { + public TransferClassificationActivityImpl(ClassificationDao classificationDao, + TransferDao transferDao) { this.classificationDao = classificationDao; + this.transferDao = transferDao; } @Override @@ -22,6 +26,6 @@ public void classify(Long orgId, String iuv, String iur, int transferIndex) { if (!classificationDao.deleteTransferClassification(orgId, iuv, iur, transferIndex)) { throw new ClassificationException("Error occurred while clean up current processing Requests due to failed deletion"); } + transferDao.retrieveTransferByLogicalKey(orgId, iuv, iur, transferIndex); } - } diff --git a/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java b/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java index f7322ff1..eea3ed53 100644 --- a/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java +++ b/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java @@ -1,6 +1,8 @@ package it.gov.pagopa.payhub.activities.activity.classifications; import it.gov.pagopa.payhub.activities.dao.ClassificationDao; +import it.gov.pagopa.payhub.activities.dao.TransferDao; +import it.gov.pagopa.payhub.activities.dto.TransferDTO; import it.gov.pagopa.payhub.activities.exception.ClassificationException; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -8,6 +10,8 @@ import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; +import java.util.List; + import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.when; @@ -21,22 +25,33 @@ class TransferClassificationActivityImplTest { @Mock private ClassificationDao classificationDaoMock; + @Mock + private TransferDao transferDaoMock; + private TransferClassificationActivity activity; @BeforeEach void setUp() { - activity = new TransferClassificationActivityImpl(classificationDaoMock); + activity = new TransferClassificationActivityImpl(classificationDaoMock, transferDaoMock); } @Test void classificationSuccess() { when(classificationDaoMock.deleteTransferClassification(ORGANIZATION, IUV, IUR, INDEX)).thenReturn(Boolean.TRUE); + when(transferDaoMock.retrieveTransferByLogicalKey(ORGANIZATION, IUV, IUR, INDEX)).thenReturn(List.of(new TransferDTO())); assertDoesNotThrow(() -> activity.classify(ORGANIZATION, IUV, IUR, INDEX)); } @Test - void classificationFailed() { + void whenDeleteTransferClassificationThenClassificationFailed() { when(classificationDaoMock.deleteTransferClassification(ORGANIZATION, IUV, IUR, INDEX)).thenReturn(Boolean.FALSE); assertThrows(ClassificationException.class, () -> activity.classify(ORGANIZATION, IUV, IUR, INDEX), "classification failed"); } + + @Test + void whenRetrieveTransferByLogicalKeyThenClassificationFailed() { + when(classificationDaoMock.deleteTransferClassification(ORGANIZATION, IUV, IUR, INDEX)).thenReturn(Boolean.TRUE); + when(transferDaoMock.retrieveTransferByLogicalKey(ORGANIZATION, IUV, IUR, INDEX)).thenThrow(new ClassificationException("retrieving failed")); + assertThrows(ClassificationException.class, () -> activity.classify(ORGANIZATION, IUV, IUR, INDEX), "classification failed"); + } } From 3f373486c7d1cf04e17528ee6b58771335a91486 Mon Sep 17 00:00:00 2001 From: antonioT90 <34568575+antonioT90@users.noreply.github.com> Date: Mon, 23 Dec 2024 09:37:24 +0100 Subject: [PATCH 10/16] Update src/main/java/it/gov/pagopa/payhub/activities/dao/TransferDao.java --- .../java/it/gov/pagopa/payhub/activities/dao/TransferDao.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/it/gov/pagopa/payhub/activities/dao/TransferDao.java b/src/main/java/it/gov/pagopa/payhub/activities/dao/TransferDao.java index 4e268070..ce941707 100644 --- a/src/main/java/it/gov/pagopa/payhub/activities/dao/TransferDao.java +++ b/src/main/java/it/gov/pagopa/payhub/activities/dao/TransferDao.java @@ -12,5 +12,5 @@ */ public interface TransferDao { - List retrieveTransferByLogicalKey(Long orgId, String iuv, String iur, int transferIndex); + TransferDTO findBySemanticKey(Long orgId, String iuv, String iur, int transferIndex); } From a5bb6de998f4f276101eb1c4bf262af6c07223aa Mon Sep 17 00:00:00 2001 From: antonioT90 <34568575+antonioT90@users.noreply.github.com> Date: Mon, 23 Dec 2024 09:37:33 +0100 Subject: [PATCH 11/16] Update src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImpl.java --- .../classifications/TransferClassificationActivityImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImpl.java b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImpl.java index 3ee76d54..eef9d153 100644 --- a/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImpl.java +++ b/src/main/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImpl.java @@ -26,6 +26,6 @@ public void classify(Long orgId, String iuv, String iur, int transferIndex) { if (!classificationDao.deleteTransferClassification(orgId, iuv, iur, transferIndex)) { throw new ClassificationException("Error occurred while clean up current processing Requests due to failed deletion"); } - transferDao.retrieveTransferByLogicalKey(orgId, iuv, iur, transferIndex); + transferDao.findBySemanticKey(orgId, iuv, iur, transferIndex); } } From 34251c7e4711a31fbef7cdec45f7141fde96d834 Mon Sep 17 00:00:00 2001 From: antonioT90 <34568575+antonioT90@users.noreply.github.com> Date: Mon, 23 Dec 2024 09:37:38 +0100 Subject: [PATCH 12/16] Update src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java --- .../classifications/TransferClassificationActivityImplTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java b/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java index eea3ed53..587cf098 100644 --- a/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java +++ b/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java @@ -51,7 +51,7 @@ void whenDeleteTransferClassificationThenClassificationFailed() { @Test void whenRetrieveTransferByLogicalKeyThenClassificationFailed() { when(classificationDaoMock.deleteTransferClassification(ORGANIZATION, IUV, IUR, INDEX)).thenReturn(Boolean.TRUE); - when(transferDaoMock.retrieveTransferByLogicalKey(ORGANIZATION, IUV, IUR, INDEX)).thenThrow(new ClassificationException("retrieving failed")); + when(transferDaoMock.findBySemanticKey(ORGANIZATION, IUV, IUR, INDEX)).thenThrow(new ClassificationException("retrieving failed")); assertThrows(ClassificationException.class, () -> activity.classify(ORGANIZATION, IUV, IUR, INDEX), "classification failed"); } } From 86d83edce18a543f764705993633437940e8df3a Mon Sep 17 00:00:00 2001 From: antonioT90 <34568575+antonioT90@users.noreply.github.com> Date: Mon, 23 Dec 2024 09:37:43 +0100 Subject: [PATCH 13/16] Update src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java --- .../classifications/TransferClassificationActivityImplTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java b/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java index 587cf098..f9a91c91 100644 --- a/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java +++ b/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java @@ -43,7 +43,7 @@ void classificationSuccess() { } @Test - void whenDeleteTransferClassificationThenClassificationFailed() { + void givenFailedDeletePreviousClassificationWhenClassifyThenClassificationFailed() { when(classificationDaoMock.deleteTransferClassification(ORGANIZATION, IUV, IUR, INDEX)).thenReturn(Boolean.FALSE); assertThrows(ClassificationException.class, () -> activity.classify(ORGANIZATION, IUV, IUR, INDEX), "classification failed"); } From d565c3042f8d944fc1c764c9fcaa94355fefdcda Mon Sep 17 00:00:00 2001 From: antonioT90 <34568575+antonioT90@users.noreply.github.com> Date: Mon, 23 Dec 2024 09:37:51 +0100 Subject: [PATCH 14/16] Update src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java --- .../classifications/TransferClassificationActivityImplTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java b/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java index f9a91c91..0974b09b 100644 --- a/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java +++ b/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java @@ -49,7 +49,7 @@ void givenFailedDeletePreviousClassificationWhenClassifyThenClassificationFailed } @Test - void whenRetrieveTransferByLogicalKeyThenClassificationFailed() { + void givenFailedFindTransferWhenClassifyThenClassificationFailed() { when(classificationDaoMock.deleteTransferClassification(ORGANIZATION, IUV, IUR, INDEX)).thenReturn(Boolean.TRUE); when(transferDaoMock.findBySemanticKey(ORGANIZATION, IUV, IUR, INDEX)).thenThrow(new ClassificationException("retrieving failed")); assertThrows(ClassificationException.class, () -> activity.classify(ORGANIZATION, IUV, IUR, INDEX), "classification failed"); From fee8f8651f7b0a90f0ebba97f942210fd234c836 Mon Sep 17 00:00:00 2001 From: antonioT90 <34568575+antonioT90@users.noreply.github.com> Date: Mon, 23 Dec 2024 09:43:25 +0100 Subject: [PATCH 15/16] Update src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java --- .../classifications/TransferClassificationActivityImplTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java b/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java index 0974b09b..fda3d2a2 100644 --- a/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java +++ b/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java @@ -38,7 +38,7 @@ void setUp() { @Test void classificationSuccess() { when(classificationDaoMock.deleteTransferClassification(ORGANIZATION, IUV, IUR, INDEX)).thenReturn(Boolean.TRUE); - when(transferDaoMock.retrieveTransferByLogicalKey(ORGANIZATION, IUV, IUR, INDEX)).thenReturn(List.of(new TransferDTO())); + when(transferDaoMock.[retrieveTransferByLogicalKey](https://github.com/pagopa/p4pa-payhub-activities/pull/50)(ORGANIZATION, IUV, IUR, INDEX)).thenReturn(new TransferDTO()); assertDoesNotThrow(() -> activity.classify(ORGANIZATION, IUV, IUR, INDEX)); } From 1d7634a9f61b60856a3afa479a5a951fab6c2817 Mon Sep 17 00:00:00 2001 From: antonioT90 <34568575+antonioT90@users.noreply.github.com> Date: Mon, 23 Dec 2024 09:48:56 +0100 Subject: [PATCH 16/16] Update src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java --- .../classifications/TransferClassificationActivityImplTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java b/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java index fda3d2a2..6644135a 100644 --- a/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java +++ b/src/test/java/it/gov/pagopa/payhub/activities/activity/classifications/TransferClassificationActivityImplTest.java @@ -38,7 +38,7 @@ void setUp() { @Test void classificationSuccess() { when(classificationDaoMock.deleteTransferClassification(ORGANIZATION, IUV, IUR, INDEX)).thenReturn(Boolean.TRUE); - when(transferDaoMock.[retrieveTransferByLogicalKey](https://github.com/pagopa/p4pa-payhub-activities/pull/50)(ORGANIZATION, IUV, IUR, INDEX)).thenReturn(new TransferDTO()); + when(transferDaoMock.findBySemanticKey(ORGANIZATION, IUV, IUR, INDEX)).thenReturn(new TransferDTO()); assertDoesNotThrow(() -> activity.classify(ORGANIZATION, IUV, IUR, INDEX)); }