FINERACT-1678: Improvements around locking
This commit is contained in:
+4
-1
@@ -32,6 +32,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.fineract.cob.domain.LoanAccountLock;
|
import org.apache.fineract.cob.domain.LoanAccountLock;
|
||||||
import org.apache.fineract.cob.domain.LoanAccountLockRepository;
|
import org.apache.fineract.cob.domain.LoanAccountLockRepository;
|
||||||
import org.apache.fineract.cob.domain.LockOwner;
|
import org.apache.fineract.cob.domain.LockOwner;
|
||||||
|
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
||||||
|
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
import org.springframework.context.annotation.Profile;
|
import org.springframework.context.annotation.Profile;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -69,7 +71,8 @@ public class InternalLoanAccountLockApiResource implements InitializingBean {
|
|||||||
log.warn(" ");
|
log.warn(" ");
|
||||||
log.warn("------------------------------------------------------------");
|
log.warn("------------------------------------------------------------");
|
||||||
|
|
||||||
LoanAccountLock loanAccountLock = new LoanAccountLock(loanId, LockOwner.valueOf(lockOwner));
|
LoanAccountLock loanAccountLock = new LoanAccountLock(loanId, LockOwner.valueOf(lockOwner),
|
||||||
|
ThreadLocalContextUtil.getBusinessDateByType(BusinessDateType.COB_DATE));
|
||||||
loanAccountLockRepository.save(loanAccountLock);
|
loanAccountLockRepository.save(loanAccountLock);
|
||||||
return Response.status(Response.Status.ACCEPTED).build();
|
return Response.status(Response.Status.ACCEPTED).build();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,9 +29,7 @@ import javax.persistence.Table;
|
|||||||
import javax.persistence.Version;
|
import javax.persistence.Version;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
|
||||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "m_loan_account_locks")
|
@Table(name = "m_loan_account_locks")
|
||||||
@@ -63,11 +61,11 @@ public class LoanAccountLock {
|
|||||||
@Column(name = "lock_placed_on_cob_business_date")
|
@Column(name = "lock_placed_on_cob_business_date")
|
||||||
private LocalDate lockPlacedOnCobBusinessDate;
|
private LocalDate lockPlacedOnCobBusinessDate;
|
||||||
|
|
||||||
public LoanAccountLock(Long loanId, LockOwner lockOwner) {
|
public LoanAccountLock(Long loanId, LockOwner lockOwner, LocalDate lockPlacedOnCobBusinessDate) {
|
||||||
this.loanId = loanId;
|
this.loanId = loanId;
|
||||||
this.lockOwner = lockOwner;
|
this.lockOwner = lockOwner;
|
||||||
this.lockPlacedOn = DateUtils.getOffsetDateTimeOfTenant();
|
this.lockPlacedOn = DateUtils.getOffsetDateTimeOfTenant();
|
||||||
this.lockPlacedOnCobBusinessDate = ThreadLocalContextUtil.getBusinessDateByType(BusinessDateType.COB_DATE);
|
this.lockPlacedOnCobBusinessDate = lockPlacedOnCobBusinessDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setError(String errorMessage, String stacktrace) {
|
public void setError(String errorMessage, String stacktrace) {
|
||||||
@@ -78,6 +76,5 @@ public class LoanAccountLock {
|
|||||||
public void setNewLockOwner(LockOwner newLockOwner) {
|
public void setNewLockOwner(LockOwner newLockOwner) {
|
||||||
this.lockOwner = newLockOwner;
|
this.lockOwner = newLockOwner;
|
||||||
this.lockPlacedOn = DateUtils.getOffsetDateTimeOfTenant();
|
this.lockPlacedOn = DateUtils.getOffsetDateTimeOfTenant();
|
||||||
this.lockPlacedOnCobBusinessDate = ThreadLocalContextUtil.getBusinessDateByType(BusinessDateType.COB_DATE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-4
@@ -23,7 +23,6 @@ import lombok.AccessLevel;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.fineract.cob.exceptions.LoanAccountWasAlreadyLockedOrProcessed;
|
|
||||||
import org.apache.fineract.cob.exceptions.LoanReadException;
|
import org.apache.fineract.cob.exceptions.LoanReadException;
|
||||||
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
|
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
|
||||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanRepository;
|
import org.apache.fineract.portfolio.loanaccount.domain.LoanRepository;
|
||||||
@@ -51,9 +50,6 @@ public abstract class AbstractLoanItemReader implements ItemReader<Loan> {
|
|||||||
try {
|
try {
|
||||||
if (remainingData.size() > 0) {
|
if (remainingData.size() > 0) {
|
||||||
loanId = remainingData.remove(0);
|
loanId = remainingData.remove(0);
|
||||||
if (alreadyLockedOrProcessedAccounts != null && alreadyLockedOrProcessedAccounts.remove(loanId)) {
|
|
||||||
throw new LoanAccountWasAlreadyLockedOrProcessed(loanId);
|
|
||||||
}
|
|
||||||
return loanRepository.findById(loanId).orElseThrow(() -> new LoanNotFoundException(loanId));
|
return loanRepository.findById(loanId).orElseThrow(() -> new LoanNotFoundException(loanId));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
+18
-10
@@ -30,12 +30,14 @@ import org.apache.fineract.cob.domain.LoanAccountLock;
|
|||||||
import org.apache.fineract.cob.domain.LoanAccountLockRepository;
|
import org.apache.fineract.cob.domain.LoanAccountLockRepository;
|
||||||
import org.apache.fineract.cob.domain.LockOwner;
|
import org.apache.fineract.cob.domain.LockOwner;
|
||||||
import org.apache.fineract.infrastructure.core.config.FineractProperties;
|
import org.apache.fineract.infrastructure.core.config.FineractProperties;
|
||||||
|
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.batch.core.StepContribution;
|
import org.springframework.batch.core.StepContribution;
|
||||||
import org.springframework.batch.core.scope.context.ChunkContext;
|
import org.springframework.batch.core.scope.context.ChunkContext;
|
||||||
import org.springframework.batch.core.step.tasklet.Tasklet;
|
import org.springframework.batch.core.step.tasklet.Tasklet;
|
||||||
import org.springframework.batch.item.ExecutionContext;
|
import org.springframework.batch.item.ExecutionContext;
|
||||||
import org.springframework.batch.repeat.RepeatStatus;
|
import org.springframework.batch.repeat.RepeatStatus;
|
||||||
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@@ -43,6 +45,7 @@ public class ApplyLoanLockTasklet implements Tasklet {
|
|||||||
|
|
||||||
private final LoanAccountLockRepository accountLockRepository;
|
private final LoanAccountLockRepository accountLockRepository;
|
||||||
private final FineractProperties fineractProperties;
|
private final FineractProperties fineractProperties;
|
||||||
|
private final JdbcTemplate jdbcTemplate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RepeatStatus execute(@NotNull StepContribution contribution, @NotNull ChunkContext chunkContext) throws Exception {
|
public RepeatStatus execute(@NotNull StepContribution contribution, @NotNull ChunkContext chunkContext) throws Exception {
|
||||||
@@ -61,23 +64,28 @@ public class ApplyLoanLockTasklet implements Tasklet {
|
|||||||
|
|
||||||
List<Long> toBeProcessedLoanIds = new ArrayList<>(alreadySoftLockedAccountsMap.keySet());
|
List<Long> toBeProcessedLoanIds = new ArrayList<>(alreadySoftLockedAccountsMap.keySet());
|
||||||
|
|
||||||
for (Long loanId : toBeProcessedLoanIds) {
|
upgradeToHardLock(toBeProcessedLoanIds);
|
||||||
upgradeToHardLock(loanId, alreadySoftLockedAccountsMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
toBeProcessedLoanIds.addAll(alreadyLockedByChunkProcessingAccountIds);
|
toBeProcessedLoanIds.addAll(alreadyLockedByChunkProcessingAccountIds);
|
||||||
List<Long> alreadyLockedByInlineCOBOrProcessedLoanIds = new ArrayList<>(loanIds);
|
List<Long> alreadyLockedByInlineCOBOrProcessedLoanIds = new ArrayList<>(loanIds);
|
||||||
alreadyLockedByInlineCOBOrProcessedLoanIds.removeAll(toBeProcessedLoanIds);
|
alreadyLockedByInlineCOBOrProcessedLoanIds.removeAll(toBeProcessedLoanIds);
|
||||||
|
|
||||||
executionContext.put(LoanCOBConstant.ALREADY_LOCKED_BY_INLINE_COB_OR_PROCESSED_LOAN_IDS,
|
loanIds.removeAll(alreadyLockedByInlineCOBOrProcessedLoanIds);
|
||||||
new ArrayList<>(alreadyLockedByInlineCOBOrProcessedLoanIds));
|
|
||||||
return RepeatStatus.FINISHED;
|
return RepeatStatus.FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void upgradeToHardLock(Long loanId, Map<Long, LoanAccountLock> alreadySoftLockedAccountsMap) {
|
private void upgradeToHardLock(List<Long> accountsToLock) {
|
||||||
LoanAccountLock loanAccountLock = alreadySoftLockedAccountsMap.get(loanId);
|
jdbcTemplate.batchUpdate("""
|
||||||
// Upgrade lock
|
UPDATE m_loan_account_locks SET version= version + 1, lock_owner = ?, lock_placed_on = ? WHERE loan_id = ?
|
||||||
loanAccountLock.setNewLockOwner(LockOwner.LOAN_COB_CHUNK_PROCESSING);
|
""", accountsToLock, getInClauseParameterSizeLimit(), (ps, id) -> {
|
||||||
accountLockRepository.save(loanAccountLock);
|
ps.setString(1, LockOwner.LOAN_COB_CHUNK_PROCESSING.name());
|
||||||
|
ps.setObject(2, DateUtils.getOffsetDateTimeOfTenant());
|
||||||
|
ps.setLong(3, id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getInClauseParameterSizeLimit() {
|
||||||
|
return fineractProperties.getQuery().getInClauseParameterSizeLimit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-11
@@ -38,7 +38,6 @@ import org.springframework.batch.core.configuration.annotation.StepBuilderFactor
|
|||||||
import org.springframework.batch.core.configuration.annotation.StepScope;
|
import org.springframework.batch.core.configuration.annotation.StepScope;
|
||||||
import org.springframework.batch.core.job.builder.FlowBuilder;
|
import org.springframework.batch.core.job.builder.FlowBuilder;
|
||||||
import org.springframework.batch.core.job.flow.Flow;
|
import org.springframework.batch.core.job.flow.Flow;
|
||||||
import org.springframework.batch.core.listener.ExecutionContextPromotionListener;
|
|
||||||
import org.springframework.batch.integration.partition.RemotePartitioningWorkerStepBuilderFactory;
|
import org.springframework.batch.integration.partition.RemotePartitioningWorkerStepBuilderFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@@ -46,6 +45,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.integration.channel.QueueChannel;
|
import org.springframework.integration.channel.QueueChannel;
|
||||||
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.transaction.support.TransactionTemplate;
|
import org.springframework.transaction.support.TransactionTemplate;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@@ -78,6 +78,8 @@ public class LoanCOBWorkerConfiguration {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private FineractProperties fineractProperties;
|
private FineractProperties fineractProperties;
|
||||||
|
@Autowired
|
||||||
|
private JdbcTemplate jdbcTemplate;
|
||||||
|
|
||||||
@Bean(name = LoanCOBConstant.LOAN_COB_WORKER_STEP)
|
@Bean(name = LoanCOBConstant.LOAN_COB_WORKER_STEP)
|
||||||
public Step loanCOBWorkerStep() {
|
public Step loanCOBWorkerStep() {
|
||||||
@@ -103,13 +105,13 @@ public class LoanCOBWorkerConfiguration {
|
|||||||
.<Loan, Loan>chunk(propertyService.getChunkSize(JobName.LOAN_COB.name())).reader(cobWorkerItemReader())
|
.<Loan, Loan>chunk(propertyService.getChunkSize(JobName.LOAN_COB.name())).reader(cobWorkerItemReader())
|
||||||
.processor(cobWorkerItemProcessor()).writer(cobWorkerItemWriter()).faultTolerant().skip(Exception.class)
|
.processor(cobWorkerItemProcessor()).writer(cobWorkerItemWriter()).faultTolerant().skip(Exception.class)
|
||||||
.skipLimit(propertyService.getChunkSize(JobName.LOAN_COB.name()) + 1).listener(loanItemListener())
|
.skipLimit(propertyService.getChunkSize(JobName.LOAN_COB.name()) + 1).listener(loanItemListener())
|
||||||
.listener(promotionListener()).listener(samplingStepExecutionListener()).build();
|
.listener(samplingStepExecutionListener()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@StepScope
|
@StepScope
|
||||||
public Step applyLockStep(@Value("#{stepExecutionContext['partition']}") String partitionName) {
|
public Step applyLockStep(@Value("#{stepExecutionContext['partition']}") String partitionName) {
|
||||||
return localStepBuilderFactory.get("Apply lock - Step:" + partitionName).tasklet(applyLock()).listener(promotionListener()).build();
|
return localStepBuilderFactory.get("Apply lock - Step:" + partitionName).tasklet(applyLock()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@@ -130,7 +132,7 @@ public class LoanCOBWorkerConfiguration {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ApplyLoanLockTasklet applyLock() {
|
public ApplyLoanLockTasklet applyLock() {
|
||||||
return new ApplyLoanLockTasklet(accountLockRepository, fineractProperties);
|
return new ApplyLoanLockTasklet(accountLockRepository, fineractProperties, jdbcTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@@ -158,13 +160,6 @@ public class LoanCOBWorkerConfiguration {
|
|||||||
return repositoryItemWriter;
|
return repositoryItemWriter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
|
||||||
public ExecutionContextPromotionListener promotionListener() {
|
|
||||||
ExecutionContextPromotionListener listener = new ExecutionContextPromotionListener();
|
|
||||||
listener.setKeys(new String[] { LoanCOBConstant.ALREADY_LOCKED_BY_INLINE_COB_OR_PROCESSED_LOAN_IDS });
|
|
||||||
return listener;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public SamplingStepExecutionListener samplingStepExecutionListener() {
|
public SamplingStepExecutionListener samplingStepExecutionListener() {
|
||||||
SamplingStepExecutionListener listener = new SamplingStepExecutionListener(samplingServiceFactory, samplingDataPrinter);
|
SamplingStepExecutionListener listener = new SamplingStepExecutionListener(samplingServiceFactory, samplingDataPrinter);
|
||||||
|
|||||||
@@ -36,10 +36,7 @@ public class LoanItemReader extends AbstractLoanItemReader {
|
|||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
public void beforeStep(@NotNull StepExecution stepExecution) {
|
public void beforeStep(@NotNull StepExecution stepExecution) {
|
||||||
ExecutionContext executionContext = stepExecution.getExecutionContext();
|
ExecutionContext executionContext = stepExecution.getExecutionContext();
|
||||||
ExecutionContext jobExecutionContext = stepExecution.getJobExecution().getExecutionContext();
|
|
||||||
List<Long> loanIds = (List<Long>) executionContext.get(LoanCOBConstant.LOAN_IDS);
|
List<Long> loanIds = (List<Long>) executionContext.get(LoanCOBConstant.LOAN_IDS);
|
||||||
setAlreadyLockedOrProcessedAccounts(
|
|
||||||
(List<Long>) jobExecutionContext.get(LoanCOBConstant.ALREADY_LOCKED_BY_INLINE_COB_OR_PROCESSED_LOAN_IDS));
|
|
||||||
setRemainingData(new ArrayList<>(loanIds));
|
setRemainingData(new ArrayList<>(loanIds));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -129,7 +129,7 @@ public class InlineLoanCOBExecutorServiceImpl implements InlineExecutorService<L
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void execute(List<Long> loanIds, String jobName, LocalDate businessDate) {
|
private void execute(List<Long> loanIds, String jobName, LocalDate businessDate) {
|
||||||
lockLoanAccounts(loanIds);
|
lockLoanAccounts(loanIds, businessDate);
|
||||||
Job inlineLoanCOBJob;
|
Job inlineLoanCOBJob;
|
||||||
try {
|
try {
|
||||||
inlineLoanCOBJob = jobLocator.getJob(jobName);
|
inlineLoanCOBJob = jobLocator.getJob(jobName);
|
||||||
@@ -167,7 +167,7 @@ public class InlineLoanCOBExecutorServiceImpl implements InlineExecutorService<L
|
|||||||
return loanIdAndLastClosedBusinessDates;
|
return loanIdAndLastClosedBusinessDates;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<LoanAccountLock> getLoanAccountLocks(List<Long> loanIds) {
|
private List<LoanAccountLock> getLoanAccountLocks(List<Long> loanIds, LocalDate businessDate) {
|
||||||
List<LoanAccountLock> loanAccountLocks = new ArrayList<>();
|
List<LoanAccountLock> loanAccountLocks = new ArrayList<>();
|
||||||
List<Long> alreadyLockedLoanIds = new ArrayList<>();
|
List<Long> alreadyLockedLoanIds = new ArrayList<>();
|
||||||
loanIds.forEach(loanId -> {
|
loanIds.forEach(loanId -> {
|
||||||
@@ -180,7 +180,7 @@ public class InlineLoanCOBExecutorServiceImpl implements InlineExecutorService<L
|
|||||||
alreadyLockedLoanIds.add(loanId);
|
alreadyLockedLoanIds.add(loanId);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
loanAccountLocks.add(new LoanAccountLock(loanId, LockOwner.LOAN_INLINE_COB_PROCESSING));
|
loanAccountLocks.add(new LoanAccountLock(loanId, LockOwner.LOAN_INLINE_COB_PROCESSING, businessDate));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!alreadyLockedLoanIds.isEmpty()) {
|
if (!alreadyLockedLoanIds.isEmpty()) {
|
||||||
@@ -207,13 +207,13 @@ public class InlineLoanCOBExecutorServiceImpl implements InlineExecutorService<L
|
|||||||
return jobParameterMap;
|
return jobParameterMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void lockLoanAccounts(List<Long> loanIds) {
|
private void lockLoanAccounts(List<Long> loanIds, LocalDate businessDate) {
|
||||||
transactionTemplate.setPropagationBehavior(PROPAGATION_REQUIRES_NEW);
|
transactionTemplate.setPropagationBehavior(PROPAGATION_REQUIRES_NEW);
|
||||||
transactionTemplate.execute(new TransactionCallbackWithoutResult() {
|
transactionTemplate.execute(new TransactionCallbackWithoutResult() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doInTransactionWithoutResult(@NotNull TransactionStatus status) {
|
protected void doInTransactionWithoutResult(@NotNull TransactionStatus status) {
|
||||||
List<LoanAccountLock> loanAccountLocks = getLoanAccountLocks(loanIds);
|
List<LoanAccountLock> loanAccountLocks = getLoanAccountLocks(loanIds, businessDate);
|
||||||
loanAccountLocks.forEach(loanAccountLock -> {
|
loanAccountLocks.forEach(loanAccountLock -> {
|
||||||
loanAccountLock.setNewLockOwner(LockOwner.LOAN_INLINE_COB_PROCESSING);
|
loanAccountLock.setNewLockOwner(LockOwner.LOAN_INLINE_COB_PROCESSING);
|
||||||
loanAccountLockRepository.save(loanAccountLock);
|
loanAccountLockRepository.save(loanAccountLock);
|
||||||
|
|||||||
+5
-3
@@ -27,6 +27,8 @@ import static org.mockito.Mockito.verify;
|
|||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import io.cucumber.java8.En;
|
import io.cucumber.java8.En;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import org.apache.fineract.cob.domain.LoanAccountLock;
|
import org.apache.fineract.cob.domain.LoanAccountLock;
|
||||||
@@ -58,7 +60,7 @@ public class LoanItemListenerStepDefinitions implements En {
|
|||||||
Given("/^The LoanItemListener.onReadError method (.*)$/", (String action) -> {
|
Given("/^The LoanItemListener.onReadError method (.*)$/", (String action) -> {
|
||||||
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
||||||
exception = new LoanReadException(1L, new RuntimeException("fail"));
|
exception = new LoanReadException(1L, new RuntimeException("fail"));
|
||||||
loanAccountLock = new LoanAccountLock(1L, LockOwner.LOAN_COB_CHUNK_PROCESSING);
|
loanAccountLock = new LoanAccountLock(1L, LockOwner.LOAN_COB_CHUNK_PROCESSING, LocalDate.now(ZoneId.systemDefault()));
|
||||||
when(accountLockRepository.findByLoanIdAndLockOwner(1L, LockOwner.LOAN_COB_CHUNK_PROCESSING))
|
when(accountLockRepository.findByLoanIdAndLockOwner(1L, LockOwner.LOAN_COB_CHUNK_PROCESSING))
|
||||||
.thenReturn(Optional.of(loanAccountLock));
|
.thenReturn(Optional.of(loanAccountLock));
|
||||||
transactionTemplate.setTransactionManager(mock(PlatformTransactionManager.class));
|
transactionTemplate.setTransactionManager(mock(PlatformTransactionManager.class));
|
||||||
@@ -80,7 +82,7 @@ public class LoanItemListenerStepDefinitions implements En {
|
|||||||
Given("/^The LoanItemListener.onProcessError method (.*)$/", (String action) -> {
|
Given("/^The LoanItemListener.onProcessError method (.*)$/", (String action) -> {
|
||||||
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
||||||
exception = new LoanReadException(1L, new RuntimeException("fail"));
|
exception = new LoanReadException(1L, new RuntimeException("fail"));
|
||||||
loanAccountLock = new LoanAccountLock(2L, LockOwner.LOAN_COB_CHUNK_PROCESSING);
|
loanAccountLock = new LoanAccountLock(2L, LockOwner.LOAN_COB_CHUNK_PROCESSING, LocalDate.now(ZoneId.systemDefault()));
|
||||||
when(accountLockRepository.findByLoanIdAndLockOwner(2L, LockOwner.LOAN_COB_CHUNK_PROCESSING))
|
when(accountLockRepository.findByLoanIdAndLockOwner(2L, LockOwner.LOAN_COB_CHUNK_PROCESSING))
|
||||||
.thenReturn(Optional.of(loanAccountLock));
|
.thenReturn(Optional.of(loanAccountLock));
|
||||||
when(loan.getId()).thenReturn(2L);
|
when(loan.getId()).thenReturn(2L);
|
||||||
@@ -102,7 +104,7 @@ public class LoanItemListenerStepDefinitions implements En {
|
|||||||
Given("/^The LoanItemListener.onWriteError method (.*)$/", (String action) -> {
|
Given("/^The LoanItemListener.onWriteError method (.*)$/", (String action) -> {
|
||||||
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
||||||
exception = new LoanReadException(3L, new RuntimeException("fail"));
|
exception = new LoanReadException(3L, new RuntimeException("fail"));
|
||||||
loanAccountLock = new LoanAccountLock(3L, LockOwner.LOAN_COB_CHUNK_PROCESSING);
|
loanAccountLock = new LoanAccountLock(3L, LockOwner.LOAN_COB_CHUNK_PROCESSING, LocalDate.now(ZoneId.systemDefault()));
|
||||||
when(accountLockRepository.findByLoanIdAndLockOwner(3L, LockOwner.LOAN_COB_CHUNK_PROCESSING))
|
when(accountLockRepository.findByLoanIdAndLockOwner(3L, LockOwner.LOAN_COB_CHUNK_PROCESSING))
|
||||||
.thenReturn(Optional.of(loanAccountLock));
|
.thenReturn(Optional.of(loanAccountLock));
|
||||||
when(loan.getId()).thenReturn(3L);
|
when(loan.getId()).thenReturn(3L);
|
||||||
|
|||||||
+2
@@ -35,6 +35,7 @@ import java.util.Map;
|
|||||||
import org.apache.commons.lang3.RandomUtils;
|
import org.apache.commons.lang3.RandomUtils;
|
||||||
import org.apache.fineract.cob.exceptions.BusinessStepException;
|
import org.apache.fineract.cob.exceptions.BusinessStepException;
|
||||||
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
||||||
|
import org.apache.fineract.infrastructure.core.domain.ActionContext;
|
||||||
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
||||||
import org.apache.fineract.infrastructure.core.exception.MultiException;
|
import org.apache.fineract.infrastructure.core.exception.MultiException;
|
||||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||||
@@ -59,6 +60,7 @@ public class AddPeriodicAccrualEntriesBusinessStepTest {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
||||||
|
ThreadLocalContextUtil.setActionContext(ActionContext.DEFAULT);
|
||||||
ThreadLocalContextUtil
|
ThreadLocalContextUtil
|
||||||
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
||||||
underTest = new AddPeriodicAccrualEntriesBusinessStep(loanAccrualPlatformService);
|
underTest = new AddPeriodicAccrualEntriesBusinessStep(loanAccrualPlatformService);
|
||||||
|
|||||||
+22
-14
@@ -25,10 +25,15 @@ import static org.mockito.Mockito.mock;
|
|||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
|
|
||||||
import io.cucumber.java8.En;
|
import io.cucumber.java8.En;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.fineract.cob.domain.LoanAccountLock;
|
import org.apache.fineract.cob.domain.LoanAccountLock;
|
||||||
import org.apache.fineract.cob.domain.LoanAccountLockRepository;
|
import org.apache.fineract.cob.domain.LoanAccountLockRepository;
|
||||||
import org.apache.fineract.cob.domain.LockOwner;
|
import org.apache.fineract.cob.domain.LockOwner;
|
||||||
|
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
||||||
import org.apache.fineract.infrastructure.core.config.FineractProperties;
|
import org.apache.fineract.infrastructure.core.config.FineractProperties;
|
||||||
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
||||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||||
@@ -38,23 +43,29 @@ import org.springframework.batch.core.StepContribution;
|
|||||||
import org.springframework.batch.core.StepExecution;
|
import org.springframework.batch.core.StepExecution;
|
||||||
import org.springframework.batch.item.ExecutionContext;
|
import org.springframework.batch.item.ExecutionContext;
|
||||||
import org.springframework.batch.repeat.RepeatStatus;
|
import org.springframework.batch.repeat.RepeatStatus;
|
||||||
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
import org.springframework.jdbc.core.ParameterizedPreparedStatementSetter;
|
||||||
|
|
||||||
public class ApplyLoanLockTaskletStepDefinitions implements En {
|
public class ApplyLoanLockTaskletStepDefinitions implements En {
|
||||||
|
|
||||||
ArgumentCaptor<LoanAccountLock> valueCaptor = ArgumentCaptor.forClass(LoanAccountLock.class);
|
ArgumentCaptor<List> valueCaptor = ArgumentCaptor.forClass(List.class);
|
||||||
private LoanAccountLockRepository accountLockRepository = mock(LoanAccountLockRepository.class);
|
private LoanAccountLockRepository accountLockRepository = mock(LoanAccountLockRepository.class);
|
||||||
private FineractProperties fineractProperties = mock(FineractProperties.class);
|
private FineractProperties fineractProperties = mock(FineractProperties.class);
|
||||||
|
private JdbcTemplate jdbcTemplate = mock(JdbcTemplate.class);
|
||||||
private FineractProperties.FineractQueryProperties fineractQueryProperties = mock(FineractProperties.FineractQueryProperties.class);
|
private FineractProperties.FineractQueryProperties fineractQueryProperties = mock(FineractProperties.FineractQueryProperties.class);
|
||||||
private ApplyLoanLockTasklet applyLoanLockTasklet = new ApplyLoanLockTasklet(accountLockRepository, fineractProperties);
|
private ApplyLoanLockTasklet applyLoanLockTasklet = new ApplyLoanLockTasklet(accountLockRepository, fineractProperties, jdbcTemplate);
|
||||||
private RepeatStatus resultItem;
|
private RepeatStatus resultItem;
|
||||||
private StepContribution stepContribution;
|
private StepContribution stepContribution;
|
||||||
|
|
||||||
public ApplyLoanLockTaskletStepDefinitions() {
|
public ApplyLoanLockTaskletStepDefinitions() {
|
||||||
Given("/^The ApplyLoanLockTasklet.execute method with action (.*)$/", (String action) -> {
|
Given("/^The ApplyLoanLockTasklet.execute method with action (.*)$/", (String action) -> {
|
||||||
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
||||||
|
HashMap<BusinessDateType, LocalDate> businessDateMap = new HashMap<>();
|
||||||
|
businessDateMap.put(BusinessDateType.COB_DATE, LocalDate.now(ZoneId.systemDefault()));
|
||||||
|
ThreadLocalContextUtil.setBusinessDates(businessDateMap);
|
||||||
StepExecution stepExecution = new StepExecution("test", null);
|
StepExecution stepExecution = new StepExecution("test", null);
|
||||||
ExecutionContext executionContext = new ExecutionContext();
|
ExecutionContext executionContext = new ExecutionContext();
|
||||||
executionContext.put(LoanCOBConstant.LOAN_IDS, List.of(1L, 2L, 3L, 4L));
|
executionContext.put(LoanCOBConstant.LOAN_IDS, new ArrayList<>(List.of(1L, 2L, 3L, 4L)));
|
||||||
stepExecution.setExecutionContext(executionContext);
|
stepExecution.setExecutionContext(executionContext);
|
||||||
this.stepContribution = new StepContribution(stepExecution);
|
this.stepContribution = new StepContribution(stepExecution);
|
||||||
|
|
||||||
@@ -63,9 +74,10 @@ public class ApplyLoanLockTaskletStepDefinitions implements En {
|
|||||||
lenient().when(fineractQueryProperties.getInClauseParameterSizeLimit()).thenReturn(65000);
|
lenient().when(fineractQueryProperties.getInClauseParameterSizeLimit()).thenReturn(65000);
|
||||||
lenient().when(this.accountLockRepository.findAllByLoanIdIn(Mockito.anyList())).thenThrow(new RuntimeException("fail"));
|
lenient().when(this.accountLockRepository.findAllByLoanIdIn(Mockito.anyList())).thenThrow(new RuntimeException("fail"));
|
||||||
} else {
|
} else {
|
||||||
LoanAccountLock lock1 = new LoanAccountLock(1L, LockOwner.LOAN_COB_CHUNK_PROCESSING);
|
LoanAccountLock lock1 = new LoanAccountLock(1L, LockOwner.LOAN_COB_CHUNK_PROCESSING, LocalDate.now(ZoneId.systemDefault()));
|
||||||
LoanAccountLock lock2 = new LoanAccountLock(2L, LockOwner.LOAN_COB_PARTITIONING);
|
LoanAccountLock lock2 = new LoanAccountLock(2L, LockOwner.LOAN_COB_PARTITIONING, LocalDate.now(ZoneId.systemDefault()));
|
||||||
LoanAccountLock lock3 = new LoanAccountLock(3L, LockOwner.LOAN_INLINE_COB_PROCESSING);
|
LoanAccountLock lock3 = new LoanAccountLock(3L, LockOwner.LOAN_INLINE_COB_PROCESSING,
|
||||||
|
LocalDate.now(ZoneId.systemDefault()));
|
||||||
List<LoanAccountLock> accountLocks = List.of(lock1, lock2, lock3);
|
List<LoanAccountLock> accountLocks = List.of(lock1, lock2, lock3);
|
||||||
lenient().when(fineractProperties.getQuery()).thenReturn(fineractQueryProperties);
|
lenient().when(fineractProperties.getQuery()).thenReturn(fineractQueryProperties);
|
||||||
lenient().when(fineractQueryProperties.getInClauseParameterSizeLimit()).thenReturn(65000);
|
lenient().when(fineractQueryProperties.getInClauseParameterSizeLimit()).thenReturn(65000);
|
||||||
@@ -80,14 +92,10 @@ public class ApplyLoanLockTaskletStepDefinitions implements En {
|
|||||||
|
|
||||||
Then("ApplyLoanLockTasklet.execute result should match", () -> {
|
Then("ApplyLoanLockTasklet.execute result should match", () -> {
|
||||||
assertEquals(RepeatStatus.FINISHED, resultItem);
|
assertEquals(RepeatStatus.FINISHED, resultItem);
|
||||||
assertEquals(3L, ((List) stepContribution.getStepExecution().getExecutionContext()
|
verify(this.jdbcTemplate, Mockito.times(1)).batchUpdate(Mockito.anyString(), valueCaptor.capture(), Mockito.anyInt(),
|
||||||
.get(LoanCOBConstant.ALREADY_LOCKED_BY_INLINE_COB_OR_PROCESSED_LOAN_IDS)).get(0));
|
Mockito.any(ParameterizedPreparedStatementSetter.class));
|
||||||
assertEquals(4L, ((List) stepContribution.getStepExecution().getExecutionContext()
|
List<Long> values = valueCaptor.getValue();
|
||||||
.get(LoanCOBConstant.ALREADY_LOCKED_BY_INLINE_COB_OR_PROCESSED_LOAN_IDS)).get(1));
|
assertEquals(2L, values.get(0));
|
||||||
verify(this.accountLockRepository, Mockito.times(1)).save(valueCaptor.capture());
|
|
||||||
List<LoanAccountLock> values = valueCaptor.getAllValues();
|
|
||||||
assertEquals(2L, values.get(0).getLoanId());
|
|
||||||
assertEquals(LockOwner.LOAN_COB_CHUNK_PROCESSING, values.get(0).getLockOwner());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Then("throw exception ApplyLoanLockTasklet.execute method", () -> {
|
Then("throw exception ApplyLoanLockTasklet.execute method", () -> {
|
||||||
|
|||||||
+2
@@ -34,6 +34,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
||||||
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
|
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
|
||||||
|
import org.apache.fineract.infrastructure.core.domain.ActionContext;
|
||||||
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
||||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||||
@@ -61,6 +62,7 @@ public class CheckLoanRepaymentDueBusinessStepTest {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
||||||
|
ThreadLocalContextUtil.setActionContext(ActionContext.DEFAULT);
|
||||||
ThreadLocalContextUtil
|
ThreadLocalContextUtil
|
||||||
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
||||||
underTest = new CheckLoanRepaymentDueBusinessStep(configurationDomainService, businessEventNotifierService);
|
underTest = new CheckLoanRepaymentDueBusinessStep(configurationDomainService, businessEventNotifierService);
|
||||||
|
|||||||
+2
@@ -34,6 +34,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
||||||
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
|
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
|
||||||
|
import org.apache.fineract.infrastructure.core.domain.ActionContext;
|
||||||
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
||||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||||
@@ -61,6 +62,7 @@ public class CheckLoanRepaymentOverdueBusinessStepTest {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
||||||
|
ThreadLocalContextUtil.setActionContext(ActionContext.DEFAULT);
|
||||||
ThreadLocalContextUtil
|
ThreadLocalContextUtil
|
||||||
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
||||||
underTest = new CheckLoanRepaymentOverdueBusinessStep(configurationDomainService, businessEventNotifierService);
|
underTest = new CheckLoanRepaymentOverdueBusinessStep(configurationDomainService, businessEventNotifierService);
|
||||||
|
|||||||
+6
-6
@@ -80,20 +80,20 @@ public class FetchAndLockLoanStepDefinitions implements En {
|
|||||||
lenient().when(retrieveLoanIdService.retrieveLoanIdsNDaysBehind(anyLong(), any())).thenReturn(List.of(1L, 2L, 3L));
|
lenient().when(retrieveLoanIdService.retrieveLoanIdsNDaysBehind(anyLong(), any())).thenReturn(List.of(1L, 2L, 3L));
|
||||||
lenient().when(fineractProperties.getQuery()).thenReturn(fineractQueryProperties);
|
lenient().when(fineractProperties.getQuery()).thenReturn(fineractQueryProperties);
|
||||||
lenient().when(fineractQueryProperties.getInClauseParameterSizeLimit()).thenReturn(65000);
|
lenient().when(fineractQueryProperties.getInClauseParameterSizeLimit()).thenReturn(65000);
|
||||||
lenient().when(loanAccountLockRepository.findAllByLoanIdIn(Mockito.anyList()))
|
lenient().when(loanAccountLockRepository.findAllByLoanIdIn(Mockito.anyList())).thenReturn(
|
||||||
.thenReturn(List.of(new LoanAccountLock(1L, LockOwner.LOAN_COB_PARTITIONING)));
|
List.of(new LoanAccountLock(1L, LockOwner.LOAN_COB_PARTITIONING, LocalDate.now(ZoneId.systemDefault()))));
|
||||||
} else if ("inline cob".equals(action)) {
|
} else if ("inline cob".equals(action)) {
|
||||||
lenient().when(retrieveLoanIdService.retrieveLoanIdsNDaysBehind(anyLong(), any())).thenReturn(List.of(1L, 2L, 3L));
|
lenient().when(retrieveLoanIdService.retrieveLoanIdsNDaysBehind(anyLong(), any())).thenReturn(List.of(1L, 2L, 3L));
|
||||||
lenient().when(fineractProperties.getQuery()).thenReturn(fineractQueryProperties);
|
lenient().when(fineractProperties.getQuery()).thenReturn(fineractQueryProperties);
|
||||||
lenient().when(fineractQueryProperties.getInClauseParameterSizeLimit()).thenReturn(65000);
|
lenient().when(fineractQueryProperties.getInClauseParameterSizeLimit()).thenReturn(65000);
|
||||||
lenient().when(loanAccountLockRepository.findAllByLoanIdIn(Mockito.anyList()))
|
lenient().when(loanAccountLockRepository.findAllByLoanIdIn(Mockito.anyList())).thenReturn(
|
||||||
.thenReturn(List.of(new LoanAccountLock(2L, LockOwner.LOAN_INLINE_COB_PROCESSING)));
|
List.of(new LoanAccountLock(2L, LockOwner.LOAN_INLINE_COB_PROCESSING, LocalDate.now(ZoneId.systemDefault()))));
|
||||||
} else if ("chunk processing".equals(action)) {
|
} else if ("chunk processing".equals(action)) {
|
||||||
lenient().when(retrieveLoanIdService.retrieveLoanIdsNDaysBehind(anyLong(), any())).thenReturn(List.of(1L, 2L, 3L));
|
lenient().when(retrieveLoanIdService.retrieveLoanIdsNDaysBehind(anyLong(), any())).thenReturn(List.of(1L, 2L, 3L));
|
||||||
lenient().when(fineractProperties.getQuery()).thenReturn(fineractQueryProperties);
|
lenient().when(fineractProperties.getQuery()).thenReturn(fineractQueryProperties);
|
||||||
lenient().when(fineractQueryProperties.getInClauseParameterSizeLimit()).thenReturn(65000);
|
lenient().when(fineractQueryProperties.getInClauseParameterSizeLimit()).thenReturn(65000);
|
||||||
lenient().when(loanAccountLockRepository.findAllByLoanIdIn(Mockito.anyList()))
|
lenient().when(loanAccountLockRepository.findAllByLoanIdIn(Mockito.anyList())).thenReturn(
|
||||||
.thenReturn(List.of(new LoanAccountLock(3L, LockOwner.LOAN_COB_CHUNK_PROCESSING)));
|
List.of(new LoanAccountLock(3L, LockOwner.LOAN_COB_CHUNK_PROCESSING, LocalDate.now(ZoneId.systemDefault()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
JobExecution jobExecution = new JobExecution(1L);
|
JobExecution jobExecution = new JobExecution(1L);
|
||||||
|
|||||||
+1
-10
@@ -47,18 +47,9 @@ public class LoanItemReaderStepDefinitions implements En {
|
|||||||
private Loan resultItem;
|
private Loan resultItem;
|
||||||
|
|
||||||
public LoanItemReaderStepDefinitions() {
|
public LoanItemReaderStepDefinitions() {
|
||||||
Given("/^The LoanItemReader.read method with loanIds (.*), lockedAccounts (.*)$/", (String loanIds, String lockedAccounts) -> {
|
Given("/^The LoanItemReader.read method with loanIds (.*)$/", (String loanIds) -> {
|
||||||
JobExecution jobExecution = new JobExecution(1L);
|
JobExecution jobExecution = new JobExecution(1L);
|
||||||
ExecutionContext jobExecutionContext = new ExecutionContext();
|
ExecutionContext jobExecutionContext = new ExecutionContext();
|
||||||
List<Long> splitLockedAccounts;
|
|
||||||
if (lockedAccounts.isEmpty()) {
|
|
||||||
splitLockedAccounts = new ArrayList<>();
|
|
||||||
} else {
|
|
||||||
List<String> splitLockedAccountsStr = Splitter.on(',').splitToList(lockedAccounts);
|
|
||||||
splitLockedAccounts = splitLockedAccountsStr.stream().map(Long::parseLong).toList();
|
|
||||||
}
|
|
||||||
jobExecutionContext.put(LoanCOBConstant.ALREADY_LOCKED_BY_INLINE_COB_OR_PROCESSED_LOAN_IDS,
|
|
||||||
new ArrayList<>(splitLockedAccounts));
|
|
||||||
jobExecution.setExecutionContext(jobExecutionContext);
|
jobExecution.setExecutionContext(jobExecutionContext);
|
||||||
StepExecution stepExecution = new StepExecution("test", jobExecution);
|
StepExecution stepExecution = new StepExecution("test", jobExecution);
|
||||||
ExecutionContext stepExecutionContext = new ExecutionContext();
|
ExecutionContext stepExecutionContext = new ExecutionContext();
|
||||||
|
|||||||
+2
@@ -37,6 +37,7 @@ import java.util.Map;
|
|||||||
import org.apache.commons.lang3.RandomStringUtils;
|
import org.apache.commons.lang3.RandomStringUtils;
|
||||||
import org.apache.commons.lang3.RandomUtils;
|
import org.apache.commons.lang3.RandomUtils;
|
||||||
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
||||||
|
import org.apache.fineract.infrastructure.core.domain.ActionContext;
|
||||||
import org.apache.fineract.infrastructure.core.domain.ExternalId;
|
import org.apache.fineract.infrastructure.core.domain.ExternalId;
|
||||||
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
||||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||||
@@ -82,6 +83,7 @@ public class SetLoanDelinquencyTagsBusinessStepTest {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
||||||
|
ThreadLocalContextUtil.setActionContext(ActionContext.DEFAULT);
|
||||||
ThreadLocalContextUtil
|
ThreadLocalContextUtil
|
||||||
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
||||||
underTest = new SetLoanDelinquencyTagsBusinessStep(loanAccountDomainService);
|
underTest = new SetLoanDelinquencyTagsBusinessStep(loanAccountDomainService);
|
||||||
|
|||||||
+1
@@ -79,6 +79,7 @@ public class COBBulkEventConfigurationTest {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
||||||
|
ThreadLocalContextUtil.setActionContext(ActionContext.DEFAULT);
|
||||||
ThreadLocalContextUtil
|
ThreadLocalContextUtil
|
||||||
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
||||||
when(reloaderService.reload(any())).thenAnswer(invocation -> invocation.getArgument(0));
|
when(reloaderService.reload(any())).thenAnswer(invocation -> invocation.getArgument(0));
|
||||||
|
|||||||
+2
@@ -32,6 +32,7 @@ import java.util.Map;
|
|||||||
import org.apache.fineract.commands.domain.CommandSourceRepository;
|
import org.apache.fineract.commands.domain.CommandSourceRepository;
|
||||||
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
||||||
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
|
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
|
||||||
|
import org.apache.fineract.infrastructure.core.domain.ActionContext;
|
||||||
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
||||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||||
@@ -63,6 +64,7 @@ public class PurgeProcessedCommandsTaskletTest {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
||||||
|
ThreadLocalContextUtil.setActionContext(ActionContext.DEFAULT);
|
||||||
ThreadLocalContextUtil
|
ThreadLocalContextUtil
|
||||||
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
||||||
underTest = new PurgeProcessedCommandsTasklet(repository, configurationDomainService);
|
underTest = new PurgeProcessedCommandsTasklet(repository, configurationDomainService);
|
||||||
|
|||||||
+2
@@ -30,6 +30,7 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
||||||
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
|
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
|
||||||
|
import org.apache.fineract.infrastructure.core.domain.ActionContext;
|
||||||
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
||||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||||
@@ -62,6 +63,7 @@ public class PurgeExternalEventsTaskletTest {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
||||||
|
ThreadLocalContextUtil.setActionContext(ActionContext.DEFAULT);
|
||||||
ThreadLocalContextUtil
|
ThreadLocalContextUtil
|
||||||
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
||||||
underTest = new PurgeExternalEventsTasklet(repository, configurationDomainService);
|
underTest = new PurgeExternalEventsTasklet(repository, configurationDomainService);
|
||||||
|
|||||||
+2
@@ -38,6 +38,7 @@ import org.apache.fineract.avro.MessageV1;
|
|||||||
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
||||||
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
|
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
|
||||||
import org.apache.fineract.infrastructure.core.config.FineractProperties;
|
import org.apache.fineract.infrastructure.core.config.FineractProperties;
|
||||||
|
import org.apache.fineract.infrastructure.core.domain.ActionContext;
|
||||||
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
||||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||||
import org.apache.fineract.infrastructure.event.external.exception.AcknowledgementTimeoutException;
|
import org.apache.fineract.infrastructure.event.external.exception.AcknowledgementTimeoutException;
|
||||||
@@ -88,6 +89,7 @@ class SendAsynchronousEventsTaskletTest {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
||||||
|
ThreadLocalContextUtil.setActionContext(ActionContext.DEFAULT);
|
||||||
ThreadLocalContextUtil
|
ThreadLocalContextUtil
|
||||||
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
||||||
configureExternalEventsProducerReadBatchSizeProperty();
|
configureExternalEventsProducerReadBatchSizeProperty();
|
||||||
|
|||||||
+2
@@ -39,6 +39,7 @@ import java.util.Set;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import org.apache.fineract.avro.loan.v1.LoanAccountDelinquencyRangeDataV1;
|
import org.apache.fineract.avro.loan.v1.LoanAccountDelinquencyRangeDataV1;
|
||||||
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
||||||
|
import org.apache.fineract.infrastructure.core.domain.ActionContext;
|
||||||
import org.apache.fineract.infrastructure.core.domain.ExternalId;
|
import org.apache.fineract.infrastructure.core.domain.ExternalId;
|
||||||
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
||||||
import org.apache.fineract.infrastructure.core.service.ExternalIdFactory;
|
import org.apache.fineract.infrastructure.core.service.ExternalIdFactory;
|
||||||
@@ -94,6 +95,7 @@ public class LoanAccountDelinquencyRangeEventSerializerTest {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
||||||
|
ThreadLocalContextUtil.setActionContext(ActionContext.DEFAULT);
|
||||||
ThreadLocalContextUtil
|
ThreadLocalContextUtil
|
||||||
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -39,6 +39,7 @@ import org.apache.fineract.avro.loan.v1.LoanRepaymentDueDataV1;
|
|||||||
import org.apache.fineract.avro.loan.v1.RepaymentDueDataV1;
|
import org.apache.fineract.avro.loan.v1.RepaymentDueDataV1;
|
||||||
import org.apache.fineract.avro.loan.v1.RepaymentPastDueDataV1;
|
import org.apache.fineract.avro.loan.v1.RepaymentPastDueDataV1;
|
||||||
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
||||||
|
import org.apache.fineract.infrastructure.core.domain.ActionContext;
|
||||||
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
||||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||||
import org.apache.fineract.infrastructure.core.service.ExternalIdFactory;
|
import org.apache.fineract.infrastructure.core.service.ExternalIdFactory;
|
||||||
@@ -82,6 +83,7 @@ public class LoanRepaymentBusinessEventSerializerTest {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
||||||
|
ThreadLocalContextUtil.setActionContext(ActionContext.DEFAULT);
|
||||||
ThreadLocalContextUtil
|
ThreadLocalContextUtil
|
||||||
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
||||||
moneyHelper.when(() -> MoneyHelper.getRoundingMode()).thenReturn(RoundingMode.UP);
|
moneyHelper.when(() -> MoneyHelper.getRoundingMode()).thenReturn(RoundingMode.UP);
|
||||||
|
|||||||
+2
@@ -34,6 +34,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
||||||
|
import org.apache.fineract.infrastructure.core.domain.ActionContext;
|
||||||
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
||||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||||
@@ -93,6 +94,7 @@ public class DelinquencyWritePlatformServiceRangeChangeEventTest {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
||||||
|
ThreadLocalContextUtil.setActionContext(ActionContext.DEFAULT);
|
||||||
ThreadLocalContextUtil
|
ThreadLocalContextUtil
|
||||||
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -34,6 +34,7 @@ import java.util.Map;
|
|||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
||||||
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
|
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
|
||||||
|
import org.apache.fineract.infrastructure.core.domain.ActionContext;
|
||||||
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
||||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||||
@@ -85,6 +86,7 @@ public class LoanDelinquencyDomainServiceTest {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
||||||
|
ThreadLocalContextUtil.setActionContext(ActionContext.DEFAULT);
|
||||||
ThreadLocalContextUtil
|
ThreadLocalContextUtil
|
||||||
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
||||||
|
|
||||||
|
|||||||
+2
@@ -31,6 +31,7 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
||||||
|
import org.apache.fineract.infrastructure.core.domain.ActionContext;
|
||||||
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
||||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||||
@@ -59,6 +60,7 @@ public class LoanCalculateRepaymentPastDueServiceTest {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
||||||
|
ThreadLocalContextUtil.setActionContext(ActionContext.DEFAULT);
|
||||||
ThreadLocalContextUtil
|
ThreadLocalContextUtil
|
||||||
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
||||||
underTest = new LoanCalculateRepaymentPastDueService();
|
underTest = new LoanCalculateRepaymentPastDueService();
|
||||||
|
|||||||
@@ -21,32 +21,31 @@ Feature: COB Reader
|
|||||||
|
|
||||||
@cob
|
@cob
|
||||||
Scenario Outline: LoanItemReader - run test
|
Scenario Outline: LoanItemReader - run test
|
||||||
Given The LoanItemReader.read method with loanIds <loanIds>, lockedAccounts <lockedAccounts>
|
Given The LoanItemReader.read method with loanIds <loanIds>
|
||||||
When LoanItemReader.read method executed
|
When LoanItemReader.read method executed
|
||||||
Then The LoanItemReader.read result should match
|
Then The LoanItemReader.read result should match
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|loanIds|lockedAccounts|
|
|loanIds|
|
||||||
|1 | |
|
|1 |
|
||||||
|1,2 |3,4 |
|
|1,2 |
|
||||||
|
|
||||||
@cob
|
@cob
|
||||||
Scenario Outline: LoanItemReader - run test: null
|
Scenario Outline: LoanItemReader - run test: null
|
||||||
Given The LoanItemReader.read method with loanIds <loanIds>, lockedAccounts <lockedAccounts>
|
Given The LoanItemReader.read method with loanIds <loanIds>
|
||||||
When LoanItemReader.read method executed
|
When LoanItemReader.read method executed
|
||||||
Then The LoanItemReader.read result null
|
Then The LoanItemReader.read result null
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|loanIds|lockedAccounts|
|
|loanIds|
|
||||||
| | |
|
| |
|
||||||
|
|
||||||
@cob
|
@cob
|
||||||
Scenario Outline: LoanItemReader - run test: exception
|
Scenario Outline: LoanItemReader - run test: exception
|
||||||
Given The LoanItemReader.read method with loanIds <loanIds>, lockedAccounts <lockedAccounts>
|
Given The LoanItemReader.read method with loanIds <loanIds>
|
||||||
Then throw exception LoanItemReader.read method
|
Then throw exception LoanItemReader.read method
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|loanIds|lockedAccounts|
|
|loanIds|
|
||||||
|-1 | |
|
|-1 |
|
||||||
|1 | 1 |
|
|0 |
|
||||||
|0 | |
|
|
||||||
|
|||||||
Reference in New Issue
Block a user