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