Liquibase compatibility fix
This commit is contained in:
committed by
Arnold Gálovics
parent
9a7a425696
commit
51028fdbd0
+1
-1
@@ -126,7 +126,7 @@ public class RuntimeDelegatingCacheManager implements CacheManager, Initializing
|
|||||||
Objects.requireNonNull(ehCacheManager.getCache(cacheName)).clear();
|
Objects.requireNonNull(ehCacheManager.getCache(cacheName)).clear();
|
||||||
}
|
}
|
||||||
} catch (NullPointerException npe) {
|
} catch (NullPointerException npe) {
|
||||||
log.warn(npe.getMessage());
|
log.warn("NullPointerException occurred", npe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.infrastructure.core.api;
|
package org.apache.fineract.infrastructure.core.api;
|
||||||
|
|
||||||
import jakarta.ws.rs.WebApplicationException;
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import org.apache.fineract.infrastructure.core.data.DateFormat;
|
import org.apache.fineract.infrastructure.core.data.DateFormat;
|
||||||
@@ -31,7 +30,7 @@ public class DateParam {
|
|||||||
|
|
||||||
private final String dateAsString;
|
private final String dateAsString;
|
||||||
|
|
||||||
public DateParam(final String dateStr) throws WebApplicationException {
|
public DateParam(final String dateStr) {
|
||||||
this.dateAsString = dateStr;
|
this.dateAsString = dateStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-5
@@ -19,14 +19,14 @@
|
|||||||
package org.apache.fineract.infrastructure.core.exception;
|
package org.apache.fineract.infrastructure.core.exception;
|
||||||
|
|
||||||
import com.google.common.io.CharStreams;
|
import com.google.common.io.CharStreams;
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exception with multiple root causes.
|
* Exception with multiple root causes.
|
||||||
@@ -45,11 +45,12 @@ import org.slf4j.LoggerFactory;
|
|||||||
*
|
*
|
||||||
* @author Michael Vorburger.ch <mike@vorburger.ch>
|
* @author Michael Vorburger.ch <mike@vorburger.ch>
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
public class MultiException extends Exception {
|
public class MultiException extends Exception {
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(MultiException.class);
|
|
||||||
private final List<Throwable> throwables;
|
private final List<Throwable> throwables;
|
||||||
|
|
||||||
|
@SuppressFBWarnings("CT_CONSTRUCTOR_THROW")
|
||||||
public MultiException(List<Throwable> problems) {
|
public MultiException(List<Throwable> problems) {
|
||||||
super("MultiException with " + problems.size() + " contained causes (details available)");
|
super("MultiException with " + problems.size() + " contained causes (details available)");
|
||||||
if (problems.isEmpty()) {
|
if (problems.isEmpty()) {
|
||||||
@@ -80,11 +81,12 @@ public class MultiException extends Exception {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("RegexpSinglelineJava")
|
@SuppressWarnings("RegexpSinglelineJava")
|
||||||
|
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
|
||||||
public void printStackTrace() {
|
public void printStackTrace() {
|
||||||
LOG.error("{}", super.getMessage());
|
log.error("{}", super.getMessage());
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Throwable e : throwables) {
|
for (Throwable e : throwables) {
|
||||||
LOG.error("{}.", ++i);
|
log.error("{}.", ++i);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -22,6 +22,7 @@ import static org.apache.fineract.infrastructure.core.domain.FineractPlatformTen
|
|||||||
import static org.apache.fineract.infrastructure.core.domain.FineractPlatformTenantConnection.toProtocol;
|
import static org.apache.fineract.infrastructure.core.domain.FineractPlatformTenantConnection.toProtocol;
|
||||||
|
|
||||||
import com.zaxxer.hikari.HikariConfig;
|
import com.zaxxer.hikari.HikariConfig;
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -60,6 +61,7 @@ public class DataSourcePerTenantServiceFactory {
|
|||||||
this.databasePasswordEncryptor = databasePasswordEncryptor;
|
this.databasePasswordEncryptor = databasePasswordEncryptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressFBWarnings(value = "SLF4J_SIGN_ONLY_FORMAT")
|
||||||
public DataSource createNewDataSourceFor(final FineractPlatformTenantConnection tenantConnection) {
|
public DataSource createNewDataSourceFor(final FineractPlatformTenantConnection tenantConnection) {
|
||||||
if (!databasePasswordEncryptor.isMasterPasswordHashValid(tenantConnection.getMasterPasswordHash())) {
|
if (!databasePasswordEncryptor.isMasterPasswordHashValid(tenantConnection.getMasterPasswordHash())) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
|
|||||||
+2
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.cob.api;
|
package org.apache.fineract.cob.api;
|
||||||
|
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import jakarta.ws.rs.Consumes;
|
import jakarta.ws.rs.Consumes;
|
||||||
import jakarta.ws.rs.GET;
|
import jakarta.ws.rs.GET;
|
||||||
import jakarta.ws.rs.Path;
|
import jakarta.ws.rs.Path;
|
||||||
@@ -54,6 +55,7 @@ public class InternalCOBApiResource implements InitializingBean {
|
|||||||
private final ToApiJsonSerializer<List> toApiJsonSerializerForList;
|
private final ToApiJsonSerializer<List> toApiJsonSerializerForList;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() throws Exception {
|
||||||
log.warn("------------------------------------------------------------");
|
log.warn("------------------------------------------------------------");
|
||||||
log.warn(" ");
|
log.warn(" ");
|
||||||
|
|||||||
+3
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.cob.api;
|
package org.apache.fineract.cob.api;
|
||||||
|
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import jakarta.ws.rs.Consumes;
|
import jakarta.ws.rs.Consumes;
|
||||||
import jakarta.ws.rs.POST;
|
import jakarta.ws.rs.POST;
|
||||||
import jakarta.ws.rs.Path;
|
import jakarta.ws.rs.Path;
|
||||||
@@ -50,6 +51,7 @@ public class InternalLoanAccountLockApiResource implements InitializingBean {
|
|||||||
private final LoanAccountLockRepository loanAccountLockRepository;
|
private final LoanAccountLockRepository loanAccountLockRepository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() throws Exception {
|
||||||
log.warn("------------------------------------------------------------");
|
log.warn("------------------------------------------------------------");
|
||||||
log.warn(" ");
|
log.warn(" ");
|
||||||
@@ -65,6 +67,7 @@ public class InternalLoanAccountLockApiResource implements InitializingBean {
|
|||||||
@Path("{loanId}/place-lock/{lockOwner}")
|
@Path("{loanId}/place-lock/{lockOwner}")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
|
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
|
||||||
public Response placeLockOnLoanAccount(@Context final UriInfo uriInfo, @PathParam("loanId") Long loanId,
|
public Response placeLockOnLoanAccount(@Context final UriInfo uriInfo, @PathParam("loanId") Long loanId,
|
||||||
@PathParam("lockOwner") String lockOwner, @RequestBody(required = false) String error) {
|
@PathParam("lockOwner") String lockOwner, @RequestBody(required = false) String error) {
|
||||||
log.warn("------------------------------------------------------------");
|
log.warn("------------------------------------------------------------");
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ package org.apache.fineract.cob.loan;
|
|||||||
import static org.springframework.transaction.TransactionDefinition.PROPAGATION_REQUIRES_NEW;
|
import static org.springframework.transaction.TransactionDefinition.PROPAGATION_REQUIRES_NEW;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -55,6 +56,7 @@ public class ApplyLoanLockTasklet implements Tasklet {
|
|||||||
private final TransactionTemplate transactionTemplate;
|
private final TransactionTemplate transactionTemplate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
|
||||||
public RepeatStatus execute(@NotNull StepContribution contribution, @NotNull ChunkContext chunkContext)
|
public RepeatStatus execute(@NotNull StepContribution contribution, @NotNull ChunkContext chunkContext)
|
||||||
throws LoanLockCannotBeAppliedException {
|
throws LoanLockCannotBeAppliedException {
|
||||||
ExecutionContext executionContext = contribution.getStepExecution().getExecutionContext();
|
ExecutionContext executionContext = contribution.getStepExecution().getExecutionContext();
|
||||||
|
|||||||
+32
-25
@@ -20,6 +20,7 @@ package org.apache.fineract.cob.loan;
|
|||||||
|
|
||||||
import static org.apache.fineract.infrastructure.core.diagnostics.performance.MeasuringUtil.measure;
|
import static org.apache.fineract.infrastructure.core.diagnostics.performance.MeasuringUtil.measure;
|
||||||
|
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@@ -57,35 +58,41 @@ public class SetLoanDelinquencyTagsBusinessStep implements LoanCOBBusinessStep {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String externalId = Optional.ofNullable(loan.getExternalId()).map(ExternalId::getValue).orElse(null);
|
String externalId = Optional.ofNullable(loan.getExternalId()).map(ExternalId::getValue).orElse(null);
|
||||||
measure(() -> {
|
measure(new Runnable() {
|
||||||
try {
|
|
||||||
log.debug("Starting delinquency tag processing for loan with Id [{}], account number [{}], external Id [{}]", loan.getId(),
|
|
||||||
loan.getAccountNumber(), externalId);
|
|
||||||
|
|
||||||
// Change the Action Context to DEFAULT for Business Date so that we can compare the loan due date to
|
@SuppressFBWarnings("SLF4J_MANUALLY_PROVIDED_MESSAGE")
|
||||||
// the
|
@Override
|
||||||
// current date and not the previous (COB) date.
|
public void run() {
|
||||||
ThreadLocalContextUtil.setActionContext(ActionContext.DEFAULT);
|
try {
|
||||||
|
log.debug("Starting delinquency tag processing for loan with Id [{}], account number [{}], external Id [{}]",
|
||||||
|
loan.getId(), loan.getAccountNumber(), externalId);
|
||||||
|
|
||||||
final List<LoanDelinquencyAction> savedDelinquencyList = delinquencyReadPlatformService
|
// Change the Action Context to DEFAULT for Business Date so that we can compare the loan due date
|
||||||
.retrieveLoanDelinquencyActions(loan.getId());
|
// to
|
||||||
List<LoanDelinquencyActionData> effectiveDelinquencyList = delinquencyEffectivePauseHelper
|
// the
|
||||||
.calculateEffectiveDelinquencyList(savedDelinquencyList);
|
// current date and not the previous (COB) date.
|
||||||
|
ThreadLocalContextUtil.setActionContext(ActionContext.DEFAULT);
|
||||||
|
|
||||||
if (!isDelinquencyOnPause(loan, effectiveDelinquencyList)) {
|
final List<LoanDelinquencyAction> savedDelinquencyList = delinquencyReadPlatformService
|
||||||
loanAccountDomainService.setLoanDelinquencyTag(loan, DateUtils.getBusinessLocalDate(), effectiveDelinquencyList);
|
.retrieveLoanDelinquencyActions(loan.getId());
|
||||||
} else {
|
List<LoanDelinquencyActionData> effectiveDelinquencyList = delinquencyEffectivePauseHelper
|
||||||
log.debug("Delinquency is on pause for loan with ID [{}]", loan.getId());
|
.calculateEffectiveDelinquencyList(savedDelinquencyList);
|
||||||
|
|
||||||
|
if (!SetLoanDelinquencyTagsBusinessStep.this.isDelinquencyOnPause(loan, effectiveDelinquencyList)) {
|
||||||
|
loanAccountDomainService.setLoanDelinquencyTag(loan, DateUtils.getBusinessLocalDate(), effectiveDelinquencyList);
|
||||||
|
} else {
|
||||||
|
log.debug("Delinquency is on pause for loan with ID [{}]", loan.getId());
|
||||||
|
}
|
||||||
|
} catch (RuntimeException re) {
|
||||||
|
log.error(
|
||||||
|
"Received [{}] exception while processing delinquency tag for loan with Id [{}], account number [{}], external Id [{}]",
|
||||||
|
re.getMessage(), loan.getId(), loan.getAccountNumber(), externalId, re);
|
||||||
|
|
||||||
|
throw re;
|
||||||
|
} finally {
|
||||||
|
// Change the Action Context back to COB to resume COB steps.
|
||||||
|
ThreadLocalContextUtil.setActionContext(ActionContext.COB);
|
||||||
}
|
}
|
||||||
} catch (RuntimeException re) {
|
|
||||||
log.error(
|
|
||||||
"Received [{}] exception while processing delinquency tag for loan with Id [{}], account number [{}], external Id [{}]",
|
|
||||||
re.getMessage(), loan.getId(), loan.getAccountNumber(), externalId, re);
|
|
||||||
|
|
||||||
throw re;
|
|
||||||
} finally {
|
|
||||||
// Change the Action Context back to COB to resume COB steps.
|
|
||||||
ThreadLocalContextUtil.setActionContext(ActionContext.COB);
|
|
||||||
}
|
}
|
||||||
}, duration -> {
|
}, duration -> {
|
||||||
log.debug("Ending delinquency tag processing for loan with Id [{}], account number [{}], external Id [{}], finished in [{}]ms",
|
log.debug("Ending delinquency tag processing for loan with Id [{}], account number [{}], external Id [{}], finished in [{}]ms",
|
||||||
|
|||||||
+2
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.cob.service;
|
package org.apache.fineract.cob.service;
|
||||||
|
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -67,6 +68,7 @@ public class AsyncLoanCOBExecutorServiceImpl implements AsyncLoanCOBExecutorServ
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Async(TaskExecutorConstant.LOAN_COB_CATCH_UP_TASK_EXECUTOR_BEAN_NAME)
|
@Async(TaskExecutorConstant.LOAN_COB_CATCH_UP_TASK_EXECUTOR_BEAN_NAME)
|
||||||
|
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
|
||||||
public void executeLoanCOBCatchUpAsync(FineractContext context) {
|
public void executeLoanCOBCatchUpAsync(FineractContext context) {
|
||||||
try {
|
try {
|
||||||
ThreadLocalContextUtil.init(context);
|
ThreadLocalContextUtil.init(context);
|
||||||
|
|||||||
+5
-3
@@ -22,6 +22,7 @@ import static org.springframework.transaction.TransactionDefinition.PROPAGATION_
|
|||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -134,6 +135,7 @@ public class InlineLoanCOBExecutorServiceImpl implements InlineExecutorService<L
|
|||||||
return loanIdsToBeProcessed;
|
return loanIdsToBeProcessed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
|
||||||
private void execute(List<Long> loanIds, String jobName, LocalDate businessDate) {
|
private void execute(List<Long> loanIds, String jobName, LocalDate businessDate) {
|
||||||
lockLoanAccounts(loanIds, businessDate);
|
lockLoanAccounts(loanIds, businessDate);
|
||||||
Job inlineLoanCOBJob;
|
Job inlineLoanCOBJob;
|
||||||
@@ -226,9 +228,9 @@ public class InlineLoanCOBExecutorServiceImpl implements InlineExecutorService<L
|
|||||||
loanAccountLock.setNewLockOwner(LockOwner.LOAN_INLINE_COB_PROCESSING);
|
loanAccountLock.setNewLockOwner(LockOwner.LOAN_INLINE_COB_PROCESSING);
|
||||||
loanAccountLockRepository.saveAndFlush(loanAccountLock);
|
loanAccountLockRepository.saveAndFlush(loanAccountLock);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String message = "Error updating lock on loan account. Locked loan ID: %s".formatted(loanAccountLock.getLoanId());
|
log.error("Error updating lock on loan account. Locked loan ID: {}", loanAccountLock.getLoanId(), e);
|
||||||
log.error("{}", message, e);
|
throw new LoanAccountLockCannotBeOverruledException(
|
||||||
throw new LoanAccountLockCannotBeOverruledException(message, e);
|
"Error updating lock on loan account. Locked loan ID: %s".formatted(loanAccountLock.getLoanId()), e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.infrastructure.campaigns.jobs.sendmessagetosmsgateway;
|
package org.apache.fineract.infrastructure.campaigns.jobs.sendmessagetosmsgateway;
|
||||||
|
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -133,6 +134,7 @@ public class SendMessageToSmsGatewayTasklet implements Tasklet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
|
||||||
private void connectAndSendToIntermediateServer(Collection<SmsMessageApiQueueResourceData> apiQueueResourceDatas) {
|
private void connectAndSendToIntermediateServer(Collection<SmsMessageApiQueueResourceData> apiQueueResourceDatas) {
|
||||||
Map<String, Object> hostConfig = smsConfigUtils.getMessageGateWayRequestURI("sms",
|
Map<String, Object> hostConfig = smsConfigUtils.getMessageGateWayRequestURI("sms",
|
||||||
SmsMessageApiQueueResourceData.toJsonString(apiQueueResourceDatas));
|
SmsMessageApiQueueResourceData.toJsonString(apiQueueResourceDatas));
|
||||||
|
|||||||
+2
@@ -21,6 +21,7 @@ package org.apache.fineract.infrastructure.core.config;
|
|||||||
|
|
||||||
import com.zaxxer.hikari.HikariConfig;
|
import com.zaxxer.hikari.HikariConfig;
|
||||||
import com.zaxxer.hikari.HikariDataSource;
|
import com.zaxxer.hikari.HikariDataSource;
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import jakarta.annotation.PostConstruct;
|
import jakarta.annotation.PostConstruct;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -43,6 +44,7 @@ public class CompatibilityConfig {
|
|||||||
ApplicationContext context;
|
ApplicationContext context;
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
|
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
|
||||||
public void init() {
|
public void init() {
|
||||||
Environment environment = context.getEnvironment();
|
Environment environment = context.getEnvironment();
|
||||||
|
|
||||||
|
|||||||
+4
-9
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
package org.apache.fineract.infrastructure.core.config;
|
package org.apache.fineract.infrastructure.core.config;
|
||||||
|
|
||||||
import com.zaxxer.hikari.HikariConfig;
|
|
||||||
import com.zaxxer.hikari.HikariDataSource;
|
import com.zaxxer.hikari.HikariDataSource;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
@@ -33,14 +32,10 @@ public class HikariCpConfig {
|
|||||||
// TODO: we can get rid of this config class by defining "spring.hikariTenantDataSource.hikari.*" in
|
// TODO: we can get rid of this config class by defining "spring.hikariTenantDataSource.hikari.*" in
|
||||||
// "application.properties" and enabling auto-configuration
|
// "application.properties" and enabling auto-configuration
|
||||||
|
|
||||||
@Bean
|
// initMethod is triggering lazy initialization of Hikari pool
|
||||||
|
@Bean(initMethod = "getConnection", destroyMethod = "close")
|
||||||
@ConfigurationProperties(prefix = "spring.datasource.hikari")
|
@ConfigurationProperties(prefix = "spring.datasource.hikari")
|
||||||
public HikariConfig hikariConfig() {
|
public HikariDataSource hikariTenantDataSource() {
|
||||||
return new HikariConfig();
|
return new HikariDataSource();
|
||||||
}
|
|
||||||
|
|
||||||
@Bean(destroyMethod = "close")
|
|
||||||
public HikariDataSource hikariTenantDataSource(HikariConfig hikariConfig) {
|
|
||||||
return new HikariDataSource(hikariConfig);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -20,6 +20,7 @@ package org.apache.fineract.infrastructure.core.diagnostics.performance.sampling
|
|||||||
|
|
||||||
import static org.apache.fineract.infrastructure.core.diagnostics.performance.MeasuringUtil.measure;
|
import static org.apache.fineract.infrastructure.core.diagnostics.performance.MeasuringUtil.measure;
|
||||||
|
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@@ -31,6 +32,7 @@ public abstract class AbstractSamplingService implements SamplingService {
|
|||||||
private final Map<String, AtomicInteger> sampleCounters = new ConcurrentHashMap<>();
|
private final Map<String, AtomicInteger> sampleCounters = new ConcurrentHashMap<>();
|
||||||
private final int samplingRate;
|
private final int samplingRate;
|
||||||
|
|
||||||
|
@SuppressFBWarnings("CT_CONSTRUCTOR_THROW")
|
||||||
public AbstractSamplingService(int samplingRate) {
|
public AbstractSamplingService(int samplingRate) {
|
||||||
if (samplingRate < 1) {
|
if (samplingRate < 1) {
|
||||||
throw new IllegalArgumentException("samplingRate cannot be less than 1");
|
throw new IllegalArgumentException("samplingRate cannot be less than 1");
|
||||||
|
|||||||
+3
-3
@@ -42,7 +42,7 @@ public class ExtendedSpringLiquibaseBuilder {
|
|||||||
private final String databaseChangeLogTable;
|
private final String databaseChangeLogTable;
|
||||||
private final String databaseChangeLogLockTable;
|
private final String databaseChangeLogLockTable;
|
||||||
private final boolean shouldRun;
|
private final boolean shouldRun;
|
||||||
private final String labels;
|
private final String labelFilter;
|
||||||
private final File rollbackFile;
|
private final File rollbackFile;
|
||||||
private final boolean testRollbackOnUpdate;
|
private final boolean testRollbackOnUpdate;
|
||||||
private final String tag;
|
private final String tag;
|
||||||
@@ -68,7 +68,7 @@ public class ExtendedSpringLiquibaseBuilder {
|
|||||||
this.databaseChangeLogTable = liquibaseProperties.getDatabaseChangeLogTable();
|
this.databaseChangeLogTable = liquibaseProperties.getDatabaseChangeLogTable();
|
||||||
this.databaseChangeLogLockTable = liquibaseProperties.getDatabaseChangeLogLockTable();
|
this.databaseChangeLogLockTable = liquibaseProperties.getDatabaseChangeLogLockTable();
|
||||||
this.shouldRun = liquibaseProperties.isEnabled();
|
this.shouldRun = liquibaseProperties.isEnabled();
|
||||||
this.labels = liquibaseProperties.getLabels();
|
this.labelFilter = liquibaseProperties.getLabelFilter();
|
||||||
this.rollbackFile = liquibaseProperties.getRollbackFile();
|
this.rollbackFile = liquibaseProperties.getRollbackFile();
|
||||||
this.testRollbackOnUpdate = liquibaseProperties.isTestRollbackOnUpdate();
|
this.testRollbackOnUpdate = liquibaseProperties.isTestRollbackOnUpdate();
|
||||||
this.tag = liquibaseProperties.getTag();
|
this.tag = liquibaseProperties.getTag();
|
||||||
@@ -116,7 +116,7 @@ public class ExtendedSpringLiquibaseBuilder {
|
|||||||
result.setDatabaseChangeLogTable(databaseChangeLogTable);
|
result.setDatabaseChangeLogTable(databaseChangeLogTable);
|
||||||
result.setDatabaseChangeLogLockTable(databaseChangeLogLockTable);
|
result.setDatabaseChangeLogLockTable(databaseChangeLogLockTable);
|
||||||
result.setShouldRun(shouldRun);
|
result.setShouldRun(shouldRun);
|
||||||
result.setLabels(labels);
|
result.setLabelFilter(labelFilter);
|
||||||
result.setRollbackFile(rollbackFile);
|
result.setRollbackFile(rollbackFile);
|
||||||
result.setTestRollbackOnUpdate(testRollbackOnUpdate);
|
result.setTestRollbackOnUpdate(testRollbackOnUpdate);
|
||||||
result.setTag(tag);
|
result.setTag(tag);
|
||||||
|
|||||||
+2
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.infrastructure.entityaccess.service;
|
package org.apache.fineract.infrastructure.entityaccess.service;
|
||||||
|
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import java.sql.Date;
|
import java.sql.Date;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -132,6 +133,7 @@ public class FineractEntityAccessReadServiceImpl implements FineractEntityAccess
|
|||||||
return entityAccessData;
|
return entityAccessData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
|
||||||
private String getSQLForRetriveEntityAccessFor() {
|
private String getSQLForRetriveEntityAccessFor() {
|
||||||
StringBuilder str = new StringBuilder("select eem.rel_id as relId,eem.from_id as fromId, ");
|
StringBuilder str = new StringBuilder("select eem.rel_id as relId,eem.from_id as fromId, ");
|
||||||
str.append("eem.to_id as toId, eem.start_date as startDate, eem.end_date as endDate ");
|
str.append("eem.to_id as toId, eem.start_date as startDate, eem.end_date as endDate ");
|
||||||
|
|||||||
+3
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.infrastructure.instancemode.api;
|
package org.apache.fineract.infrastructure.instancemode.api;
|
||||||
|
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.media.Content;
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@@ -48,6 +49,7 @@ public class InstanceModeApiResource implements InitializingBean {
|
|||||||
private final FineractProperties fineractProperties;
|
private final FineractProperties fineractProperties;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() throws Exception {
|
||||||
log.warn("------------------------------------------------------------");
|
log.warn("------------------------------------------------------------");
|
||||||
log.warn(" ");
|
log.warn(" ");
|
||||||
@@ -63,6 +65,7 @@ public class InstanceModeApiResource implements InitializingBean {
|
|||||||
@Operation(summary = "Changes the Fineract instance mode", description = "")
|
@Operation(summary = "Changes the Fineract instance mode", description = "")
|
||||||
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = InstanceModeApiResourceSwagger.ChangeInstanceModeRequest.class)))
|
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = InstanceModeApiResourceSwagger.ChangeInstanceModeRequest.class)))
|
||||||
@ApiResponses({ @ApiResponse(responseCode = "200", description = "OK") })
|
@ApiResponses({ @ApiResponse(responseCode = "200", description = "OK") })
|
||||||
|
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
|
||||||
public Response changeMode(InstanceModeApiResourceSwagger.ChangeInstanceModeRequest request) {
|
public Response changeMode(InstanceModeApiResourceSwagger.ChangeInstanceModeRequest request) {
|
||||||
log.warn("------------------------------------------------------------");
|
log.warn("------------------------------------------------------------");
|
||||||
log.warn(" ");
|
log.warn(" ");
|
||||||
|
|||||||
+2
@@ -19,6 +19,7 @@
|
|||||||
package org.apache.fineract.infrastructure.jobs.service;
|
package org.apache.fineract.infrastructure.jobs.service;
|
||||||
|
|
||||||
import com.google.common.base.Splitter;
|
import com.google.common.base.Splitter;
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -96,6 +97,7 @@ public class JobRegisterServiceImpl implements JobRegisterService, ApplicationLi
|
|||||||
|
|
||||||
private static final String JOB_STARTER_METHOD_NAME = "run";
|
private static final String JOB_STARTER_METHOD_NAME = "run";
|
||||||
|
|
||||||
|
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
|
||||||
public void executeJob(final ScheduledJobDetail scheduledJobDetail, String triggerType, Set<JobParameterDTO> jobParameterDTOSet) {
|
public void executeJob(final ScheduledJobDetail scheduledJobDetail, String triggerType, Set<JobParameterDTO> jobParameterDTOSet) {
|
||||||
try {
|
try {
|
||||||
final JobDataMap jobDataMap = new JobDataMap();
|
final JobDataMap jobDataMap = new JobDataMap();
|
||||||
|
|||||||
+2
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.infrastructure.jobs.service;
|
package org.apache.fineract.infrastructure.jobs.service;
|
||||||
|
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -49,6 +50,7 @@ public class JobSchedulerServiceImpl implements ApplicationListener<ContextRefre
|
|||||||
private final BusinessDateReadPlatformService businessDateReadPlatformService;
|
private final BusinessDateReadPlatformService businessDateReadPlatformService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
|
||||||
public void onApplicationEvent(ContextRefreshedEvent event) {
|
public void onApplicationEvent(ContextRefreshedEvent event) {
|
||||||
// If the instance is not Batch Enabled will not load the Jobs
|
// If the instance is not Batch Enabled will not load the Jobs
|
||||||
if (!fineractProperties.getMode().isBatchManagerEnabled()) {
|
if (!fineractProperties.getMode().isBatchManagerEnabled()) {
|
||||||
|
|||||||
+18
-17
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.infrastructure.security.filter;
|
package org.apache.fineract.infrastructure.security.filter;
|
||||||
|
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import jakarta.servlet.FilterChain;
|
import jakarta.servlet.FilterChain;
|
||||||
import jakarta.servlet.ServletException;
|
import jakarta.servlet.ServletException;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
@@ -66,7 +67,10 @@ import org.springframework.security.web.util.matcher.RequestMatcher;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class TenantAwareBasicAuthenticationFilter extends BasicAuthenticationFilter {
|
public class TenantAwareBasicAuthenticationFilter extends BasicAuthenticationFilter {
|
||||||
|
|
||||||
private static boolean firstRequestProcessed = false;
|
private static boolean FIRST_REQUEST_PROCESSED = false;
|
||||||
|
private static final String TENANT_ID_REQUEST_HEADER = "Fineract-Platform-TenantId";
|
||||||
|
private static final boolean EXCEPTION_IF_HEADER_MISSING = true;
|
||||||
|
|
||||||
private final ToApiJsonSerializer<PlatformRequestLog> toApiJsonSerializer;
|
private final ToApiJsonSerializer<PlatformRequestLog> toApiJsonSerializer;
|
||||||
private final ConfigurationDomainService configurationDomainService;
|
private final ConfigurationDomainService configurationDomainService;
|
||||||
private final CacheWritePlatformService cacheWritePlatformService;
|
private final CacheWritePlatformService cacheWritePlatformService;
|
||||||
@@ -74,9 +78,6 @@ public class TenantAwareBasicAuthenticationFilter extends BasicAuthenticationFil
|
|||||||
private final BasicAuthTenantDetailsService basicAuthTenantDetailsService;
|
private final BasicAuthTenantDetailsService basicAuthTenantDetailsService;
|
||||||
private final BusinessDateReadPlatformService businessDateReadPlatformService;
|
private final BusinessDateReadPlatformService businessDateReadPlatformService;
|
||||||
|
|
||||||
private final String tenantRequestHeader = "Fineract-Platform-TenantId";
|
|
||||||
private final boolean exceptionIfHeaderMissing = true;
|
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
private RequestMatcher requestMatcher = AnyRequestMatcher.INSTANCE;
|
private RequestMatcher requestMatcher = AnyRequestMatcher.INSTANCE;
|
||||||
|
|
||||||
@@ -95,6 +96,7 @@ public class TenantAwareBasicAuthenticationFilter extends BasicAuthenticationFil
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
|
||||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
|
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
|
||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
|
|
||||||
@@ -109,15 +111,15 @@ public class TenantAwareBasicAuthenticationFilter extends BasicAuthenticationFil
|
|||||||
filterChain.doFilter(request, response);
|
filterChain.doFilter(request, response);
|
||||||
} else {
|
} else {
|
||||||
if (requestMatcher.matches(request)) {
|
if (requestMatcher.matches(request)) {
|
||||||
String tenantIdentifier = request.getHeader(this.tenantRequestHeader);
|
String tenantIdentifier = request.getHeader(TENANT_ID_REQUEST_HEADER);
|
||||||
|
|
||||||
if (org.apache.commons.lang3.StringUtils.isBlank(tenantIdentifier)) {
|
if (org.apache.commons.lang3.StringUtils.isBlank(tenantIdentifier)) {
|
||||||
tenantIdentifier = request.getParameter("tenantIdentifier");
|
tenantIdentifier = request.getParameter("tenantIdentifier");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tenantIdentifier == null && this.exceptionIfHeaderMissing) {
|
if (tenantIdentifier == null && EXCEPTION_IF_HEADER_MISSING) {
|
||||||
throw new InvalidTenantIdentifierException("No tenant identifier found: Add request header of '"
|
throw new InvalidTenantIdentifierException("No tenant identifier found: Add request header of '"
|
||||||
+ this.tenantRequestHeader + "' or add the parameter 'tenantIdentifier' to query string of request URL.");
|
+ TENANT_ID_REQUEST_HEADER + "' or add the parameter 'tenantIdentifier' to query string of request URL.");
|
||||||
}
|
}
|
||||||
|
|
||||||
String pathInfo = request.getRequestURI();
|
String pathInfo = request.getRequestURI();
|
||||||
@@ -125,10 +127,9 @@ public class TenantAwareBasicAuthenticationFilter extends BasicAuthenticationFil
|
|||||||
if (pathInfo != null && pathInfo.contains("report")) {
|
if (pathInfo != null && pathInfo.contains("report")) {
|
||||||
isReportRequest = true;
|
isReportRequest = true;
|
||||||
}
|
}
|
||||||
final FineractPlatformTenant tenant = this.basicAuthTenantDetailsService.loadTenantById(tenantIdentifier,
|
final FineractPlatformTenant tenant = basicAuthTenantDetailsService.loadTenantById(tenantIdentifier, isReportRequest);
|
||||||
isReportRequest);
|
|
||||||
ThreadLocalContextUtil.setTenant(tenant);
|
ThreadLocalContextUtil.setTenant(tenant);
|
||||||
HashMap<BusinessDateType, LocalDate> businessDates = this.businessDateReadPlatformService.getBusinessDates();
|
HashMap<BusinessDateType, LocalDate> businessDates = businessDateReadPlatformService.getBusinessDates();
|
||||||
ThreadLocalContextUtil.setBusinessDates(businessDates);
|
ThreadLocalContextUtil.setBusinessDates(businessDates);
|
||||||
String authToken = request.getHeader("Authorization");
|
String authToken = request.getHeader("Authorization");
|
||||||
|
|
||||||
@@ -136,17 +137,17 @@ public class TenantAwareBasicAuthenticationFilter extends BasicAuthenticationFil
|
|||||||
ThreadLocalContextUtil.setAuthToken(authToken.replaceFirst("Basic ", ""));
|
ThreadLocalContextUtil.setAuthToken(authToken.replaceFirst("Basic ", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!firstRequestProcessed) {
|
if (!FIRST_REQUEST_PROCESSED) {
|
||||||
final String baseUrl = request.getRequestURL().toString().replace(request.getPathInfo(), "/");
|
final String baseUrl = request.getRequestURL().toString().replace(request.getPathInfo(), "/");
|
||||||
System.setProperty("baseUrl", baseUrl);
|
System.setProperty("baseUrl", baseUrl);
|
||||||
|
|
||||||
final boolean ehcacheEnabled = this.configurationDomainService.isEhcacheEnabled();
|
final boolean ehcacheEnabled = configurationDomainService.isEhcacheEnabled();
|
||||||
if (ehcacheEnabled) {
|
if (ehcacheEnabled) {
|
||||||
this.cacheWritePlatformService.switchToCache(CacheType.SINGLE_NODE);
|
cacheWritePlatformService.switchToCache(CacheType.SINGLE_NODE);
|
||||||
} else {
|
} else {
|
||||||
this.cacheWritePlatformService.switchToCache(CacheType.NO_CACHE);
|
cacheWritePlatformService.switchToCache(CacheType.NO_CACHE);
|
||||||
}
|
}
|
||||||
TenantAwareBasicAuthenticationFilter.firstRequestProcessed = true;
|
TenantAwareBasicAuthenticationFilter.FIRST_REQUEST_PROCESSED = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,8 +162,8 @@ public class TenantAwareBasicAuthenticationFilter extends BasicAuthenticationFil
|
|||||||
} finally {
|
} finally {
|
||||||
ThreadLocalContextUtil.reset();
|
ThreadLocalContextUtil.reset();
|
||||||
task.stop();
|
task.stop();
|
||||||
final PlatformRequestLog log = PlatformRequestLog.from(task, request);
|
final PlatformRequestLog msg = PlatformRequestLog.from(task, request);
|
||||||
TenantAwareBasicAuthenticationFilter.log.debug("{}", this.toApiJsonSerializer.serialize(log));
|
log.debug("{}", toApiJsonSerializer.serialize(msg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+18
-16
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.infrastructure.security.filter;
|
package org.apache.fineract.infrastructure.security.filter;
|
||||||
|
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import jakarta.servlet.FilterChain;
|
import jakarta.servlet.FilterChain;
|
||||||
import jakarta.servlet.ServletException;
|
import jakarta.servlet.ServletException;
|
||||||
import jakarta.servlet.ServletRequest;
|
import jakarta.servlet.ServletRequest;
|
||||||
@@ -60,7 +61,7 @@ import org.springframework.web.filter.GenericFilterBean;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class TenantAwareTenantIdentifierFilter extends GenericFilterBean {
|
public class TenantAwareTenantIdentifierFilter extends GenericFilterBean {
|
||||||
|
|
||||||
private static AtomicBoolean firstRequestProcessed = new AtomicBoolean();
|
private static final AtomicBoolean FIRST_PROCESSED_REQUEST = new AtomicBoolean();
|
||||||
|
|
||||||
private final BasicAuthTenantDetailsService basicAuthTenantDetailsService;
|
private final BasicAuthTenantDetailsService basicAuthTenantDetailsService;
|
||||||
private final ToApiJsonSerializer<PlatformRequestLog> toApiJsonSerializer;
|
private final ToApiJsonSerializer<PlatformRequestLog> toApiJsonSerializer;
|
||||||
@@ -69,11 +70,12 @@ public class TenantAwareTenantIdentifierFilter extends GenericFilterBean {
|
|||||||
|
|
||||||
private final BusinessDateReadPlatformService businessDateReadPlatformService;
|
private final BusinessDateReadPlatformService businessDateReadPlatformService;
|
||||||
|
|
||||||
private final String tenantRequestHeader = "Fineract-Platform-TenantId";
|
private static final String TENANT_ID_REQUEST_HEADER = "Fineract-Platform-TenantId";
|
||||||
private final boolean exceptionIfHeaderMissing = true;
|
private static final boolean EXCEPTION_IF_HEADER_MISSING = true;
|
||||||
private final String apiUri = "/api/v1/";
|
private static final String API_URI = "/api/v1/";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
|
||||||
public void doFilter(final ServletRequest req, final ServletResponse res, final FilterChain chain)
|
public void doFilter(final ServletRequest req, final ServletResponse res, final FilterChain chain)
|
||||||
throws IOException, ServletException {
|
throws IOException, ServletException {
|
||||||
|
|
||||||
@@ -97,14 +99,14 @@ public class TenantAwareTenantIdentifierFilter extends GenericFilterBean {
|
|||||||
|
|
||||||
if (!"OPTIONS".equalsIgnoreCase(request.getMethod())) {
|
if (!"OPTIONS".equalsIgnoreCase(request.getMethod())) {
|
||||||
|
|
||||||
String tenantIdentifier = request.getHeader(this.tenantRequestHeader);
|
String tenantIdentifier = request.getHeader(TENANT_ID_REQUEST_HEADER);
|
||||||
if (org.apache.commons.lang3.StringUtils.isBlank(tenantIdentifier)) {
|
if (org.apache.commons.lang3.StringUtils.isBlank(tenantIdentifier)) {
|
||||||
tenantIdentifier = request.getParameter("tenantIdentifier");
|
tenantIdentifier = request.getParameter("tenantIdentifier");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tenantIdentifier == null && this.exceptionIfHeaderMissing) {
|
if (tenantIdentifier == null && EXCEPTION_IF_HEADER_MISSING) {
|
||||||
throw new InvalidTenantIdentifierException("No tenant identifier found: Add request header of '"
|
throw new InvalidTenantIdentifierException("No tenant identifier found: Add request header of '"
|
||||||
+ this.tenantRequestHeader + "' or add the parameter 'tenantIdentifier' to query string of request URL.");
|
+ TENANT_ID_REQUEST_HEADER + "' or add the parameter 'tenantIdentifier' to query string of request URL.");
|
||||||
}
|
}
|
||||||
|
|
||||||
String pathInfo = request.getRequestURI();
|
String pathInfo = request.getRequestURI();
|
||||||
@@ -112,9 +114,9 @@ public class TenantAwareTenantIdentifierFilter extends GenericFilterBean {
|
|||||||
if (pathInfo != null && pathInfo.contains("report")) {
|
if (pathInfo != null && pathInfo.contains("report")) {
|
||||||
isReportRequest = true;
|
isReportRequest = true;
|
||||||
}
|
}
|
||||||
final FineractPlatformTenant tenant = this.basicAuthTenantDetailsService.loadTenantById(tenantIdentifier, isReportRequest);
|
final FineractPlatformTenant tenant = basicAuthTenantDetailsService.loadTenantById(tenantIdentifier, isReportRequest);
|
||||||
ThreadLocalContextUtil.setTenant(tenant);
|
ThreadLocalContextUtil.setTenant(tenant);
|
||||||
HashMap<BusinessDateType, LocalDate> businessDates = this.businessDateReadPlatformService.getBusinessDates();
|
HashMap<BusinessDateType, LocalDate> businessDates = businessDateReadPlatformService.getBusinessDates();
|
||||||
ThreadLocalContextUtil.setBusinessDates(businessDates);
|
ThreadLocalContextUtil.setBusinessDates(businessDates);
|
||||||
String authToken = request.getHeader("Authorization");
|
String authToken = request.getHeader("Authorization");
|
||||||
|
|
||||||
@@ -122,18 +124,18 @@ public class TenantAwareTenantIdentifierFilter extends GenericFilterBean {
|
|||||||
ThreadLocalContextUtil.setAuthToken(authToken.replaceFirst("bearer ", ""));
|
ThreadLocalContextUtil.setAuthToken(authToken.replaceFirst("bearer ", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!firstRequestProcessed.get()) {
|
if (!FIRST_PROCESSED_REQUEST.get()) {
|
||||||
final String baseUrl = request.getRequestURL().toString().replace(request.getRequestURI(),
|
final String baseUrl = request.getRequestURL().toString().replace(request.getRequestURI(),
|
||||||
request.getContextPath() + apiUri);
|
request.getContextPath() + API_URI);
|
||||||
System.setProperty("baseUrl", baseUrl);
|
System.setProperty("baseUrl", baseUrl);
|
||||||
|
|
||||||
final boolean ehcacheEnabled = this.configurationDomainService.isEhcacheEnabled();
|
final boolean ehcacheEnabled = configurationDomainService.isEhcacheEnabled();
|
||||||
if (ehcacheEnabled) {
|
if (ehcacheEnabled) {
|
||||||
this.cacheWritePlatformService.switchToCache(CacheType.SINGLE_NODE);
|
cacheWritePlatformService.switchToCache(CacheType.SINGLE_NODE);
|
||||||
} else {
|
} else {
|
||||||
this.cacheWritePlatformService.switchToCache(CacheType.NO_CACHE);
|
cacheWritePlatformService.switchToCache(CacheType.NO_CACHE);
|
||||||
}
|
}
|
||||||
firstRequestProcessed.set(true);
|
FIRST_PROCESSED_REQUEST.set(true);
|
||||||
}
|
}
|
||||||
chain.doFilter(request, response);
|
chain.doFilter(request, response);
|
||||||
}
|
}
|
||||||
@@ -147,7 +149,7 @@ public class TenantAwareTenantIdentifierFilter extends GenericFilterBean {
|
|||||||
ThreadLocalContextUtil.reset();
|
ThreadLocalContextUtil.reset();
|
||||||
task.stop();
|
task.stop();
|
||||||
final PlatformRequestLog logRequest = PlatformRequestLog.from(task, request);
|
final PlatformRequestLog logRequest = PlatformRequestLog.from(task, request);
|
||||||
log.debug("{}", this.toApiJsonSerializer.serialize(logRequest));
|
log.debug("{}", toApiJsonSerializer.serialize(logRequest));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-7
@@ -23,8 +23,7 @@ import jakarta.servlet.http.HttpServletRequest;
|
|||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.servlet.http.HttpSession;
|
import jakarta.servlet.http.HttpSession;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.security.core.AuthenticationException;
|
import org.springframework.security.core.AuthenticationException;
|
||||||
import org.springframework.security.web.DefaultRedirectStrategy;
|
import org.springframework.security.web.DefaultRedirectStrategy;
|
||||||
import org.springframework.security.web.RedirectStrategy;
|
import org.springframework.security.web.RedirectStrategy;
|
||||||
@@ -33,10 +32,9 @@ import org.springframework.security.web.authentication.AuthenticationFailureHand
|
|||||||
import org.springframework.security.web.util.UrlUtils;
|
import org.springframework.security.web.util.UrlUtils;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
public class CustomAuthenticationFailureHandler implements AuthenticationFailureHandler {
|
public class CustomAuthenticationFailureHandler implements AuthenticationFailureHandler {
|
||||||
|
|
||||||
protected static final Logger LOG = LoggerFactory.getLogger(CustomAuthenticationFailureHandler.class);
|
|
||||||
|
|
||||||
private String defaultFailureUrl;
|
private String defaultFailureUrl;
|
||||||
private boolean forwardToDestination = false;
|
private boolean forwardToDestination = false;
|
||||||
private boolean allowSessionCreation = true;
|
private boolean allowSessionCreation = true;
|
||||||
@@ -55,18 +53,18 @@ public class CustomAuthenticationFailureHandler implements AuthenticationFailure
|
|||||||
final AuthenticationException exception) throws IOException, ServletException {
|
final AuthenticationException exception) throws IOException, ServletException {
|
||||||
|
|
||||||
if (this.defaultFailureUrl == null) {
|
if (this.defaultFailureUrl == null) {
|
||||||
LOG.debug("No failure URL set, sending 401 Unauthorized error");
|
log.debug("No failure URL set, sending 401 Unauthorized error");
|
||||||
|
|
||||||
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Authentication Failed: " + exception.getMessage());
|
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Authentication Failed: " + exception.getMessage());
|
||||||
} else {
|
} else {
|
||||||
saveException(request, exception);
|
saveException(request, exception);
|
||||||
|
|
||||||
if (this.forwardToDestination) {
|
if (this.forwardToDestination) {
|
||||||
LOG.debug("Forwarding to {}", this.defaultFailureUrl);
|
log.debug("Forwarding to {}", this.defaultFailureUrl);
|
||||||
|
|
||||||
request.getRequestDispatcher(this.defaultFailureUrl).forward(request, response);
|
request.getRequestDispatcher(this.defaultFailureUrl).forward(request, response);
|
||||||
} else {
|
} else {
|
||||||
LOG.debug("Redirecting to {}", this.defaultFailureUrl);
|
log.debug("Redirecting to {}", this.defaultFailureUrl);
|
||||||
|
|
||||||
final String oauthToken = request.getParameter("oauth_token");
|
final String oauthToken = request.getParameter("oauth_token");
|
||||||
request.setAttribute("oauth_token", oauthToken);
|
request.setAttribute("oauth_token", oauthToken);
|
||||||
|
|||||||
+2
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.infrastructure.sms.scheduler;
|
package org.apache.fineract.infrastructure.sms.scheduler;
|
||||||
|
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -65,6 +66,7 @@ public class SmsMessageScheduledJobServiceImpl implements SmsMessageScheduledJob
|
|||||||
@Qualifier(TaskExecutorConstant.DEFAULT_TASK_EXECUTOR_BEAN_NAME)
|
@Qualifier(TaskExecutorConstant.DEFAULT_TASK_EXECUTOR_BEAN_NAME)
|
||||||
private final ThreadPoolTaskExecutor taskExecutor;
|
private final ThreadPoolTaskExecutor taskExecutor;
|
||||||
|
|
||||||
|
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
|
||||||
private void connectAndSendToIntermediateServer(Collection<SmsMessageApiQueueResourceData> apiQueueResourceDatas) {
|
private void connectAndSendToIntermediateServer(Collection<SmsMessageApiQueueResourceData> apiQueueResourceDatas) {
|
||||||
Map<String, Object> hostConfig = this.smsConfigUtils.getMessageGateWayRequestURI("sms",
|
Map<String, Object> hostConfig = this.smsConfigUtils.getMessageGateWayRequestURI("sms",
|
||||||
SmsMessageApiQueueResourceData.toJsonString(apiQueueResourceDatas));
|
SmsMessageApiQueueResourceData.toJsonString(apiQueueResourceDatas));
|
||||||
|
|||||||
+3
@@ -23,6 +23,7 @@ import static org.apache.fineract.infrastructure.core.domain.AuditableFieldsCons
|
|||||||
import static org.apache.fineract.infrastructure.core.domain.AuditableFieldsConstants.LAST_MODIFIED_BY;
|
import static org.apache.fineract.infrastructure.core.domain.AuditableFieldsConstants.LAST_MODIFIED_BY;
|
||||||
import static org.apache.fineract.infrastructure.core.domain.AuditableFieldsConstants.LAST_MODIFIED_DATE;
|
import static org.apache.fineract.infrastructure.core.domain.AuditableFieldsConstants.LAST_MODIFIED_DATE;
|
||||||
|
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import jakarta.ws.rs.Consumes;
|
import jakarta.ws.rs.Consumes;
|
||||||
import jakarta.ws.rs.GET;
|
import jakarta.ws.rs.GET;
|
||||||
import jakarta.ws.rs.Path;
|
import jakarta.ws.rs.Path;
|
||||||
@@ -56,6 +57,7 @@ public class InternalClientInformationApiResource implements InitializingBean {
|
|||||||
private final ApiRequestParameterHelper apiRequestParameterHelper;
|
private final ApiRequestParameterHelper apiRequestParameterHelper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
log.warn("------------------------------------------------------------");
|
log.warn("------------------------------------------------------------");
|
||||||
log.warn(" ");
|
log.warn(" ");
|
||||||
@@ -71,6 +73,7 @@ public class InternalClientInformationApiResource implements InitializingBean {
|
|||||||
@Path("{clientId}/audit")
|
@Path("{clientId}/audit")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
|
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
|
||||||
public String getClientAuditFields(@Context final UriInfo uriInfo, @PathParam("clientId") Long clientId) {
|
public String getClientAuditFields(@Context final UriInfo uriInfo, @PathParam("clientId") Long clientId) {
|
||||||
log.warn("------------------------------------------------------------");
|
log.warn("------------------------------------------------------------");
|
||||||
log.warn(" ");
|
log.warn(" ");
|
||||||
|
|||||||
+8
-8
@@ -27,14 +27,14 @@ import org.apache.fineract.portfolio.delinquency.domain.LoanDelinquencyAction;
|
|||||||
@Data
|
@Data
|
||||||
public class LoanDelinquencyActionData {
|
public class LoanDelinquencyActionData {
|
||||||
|
|
||||||
public Long id;
|
private Long id;
|
||||||
public DelinquencyAction action;
|
private DelinquencyAction action;
|
||||||
public LocalDate startDate;
|
private LocalDate startDate;
|
||||||
public LocalDate endDate;
|
private LocalDate endDate;
|
||||||
public Long createdById;
|
private Long createdById;
|
||||||
public OffsetDateTime createdOn;
|
private OffsetDateTime createdOn;
|
||||||
public Long updatedById;
|
private Long updatedById;
|
||||||
public OffsetDateTime lastModifiedOn;
|
private OffsetDateTime lastModifiedOn;
|
||||||
|
|
||||||
public LoanDelinquencyActionData(LoanDelinquencyAction loanDelinquencyAction) {
|
public LoanDelinquencyActionData(LoanDelinquencyAction loanDelinquencyAction) {
|
||||||
this.id = loanDelinquencyAction.getId();
|
this.id = loanDelinquencyAction.getId();
|
||||||
|
|||||||
+6
@@ -23,6 +23,7 @@ import static org.apache.fineract.infrastructure.core.domain.AuditableFieldsCons
|
|||||||
import static org.apache.fineract.infrastructure.core.domain.AuditableFieldsConstants.LAST_MODIFIED_BY;
|
import static org.apache.fineract.infrastructure.core.domain.AuditableFieldsConstants.LAST_MODIFIED_BY;
|
||||||
import static org.apache.fineract.infrastructure.core.domain.AuditableFieldsConstants.LAST_MODIFIED_DATE;
|
import static org.apache.fineract.infrastructure.core.domain.AuditableFieldsConstants.LAST_MODIFIED_DATE;
|
||||||
|
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import jakarta.ws.rs.Consumes;
|
import jakarta.ws.rs.Consumes;
|
||||||
import jakarta.ws.rs.GET;
|
import jakarta.ws.rs.GET;
|
||||||
import jakarta.ws.rs.Path;
|
import jakarta.ws.rs.Path;
|
||||||
@@ -64,6 +65,7 @@ public class InternalLoanInformationApiResource implements InitializingBean {
|
|||||||
private final AdvancedPaymentDataMapper advancedPaymentDataMapper;
|
private final AdvancedPaymentDataMapper advancedPaymentDataMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
log.warn("------------------------------------------------------------");
|
log.warn("------------------------------------------------------------");
|
||||||
log.warn(" ");
|
log.warn(" ");
|
||||||
@@ -79,6 +81,7 @@ public class InternalLoanInformationApiResource implements InitializingBean {
|
|||||||
@Path("{loanId}/audit")
|
@Path("{loanId}/audit")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
|
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
|
||||||
public String getLoanAuditFields(@Context final UriInfo uriInfo, @PathParam("loanId") Long loanId) {
|
public String getLoanAuditFields(@Context final UriInfo uriInfo, @PathParam("loanId") Long loanId) {
|
||||||
log.warn("------------------------------------------------------------");
|
log.warn("------------------------------------------------------------");
|
||||||
log.warn(" ");
|
log.warn(" ");
|
||||||
@@ -98,6 +101,7 @@ public class InternalLoanInformationApiResource implements InitializingBean {
|
|||||||
@Path("{loanId}/transaction/{transactionId}/audit")
|
@Path("{loanId}/transaction/{transactionId}/audit")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
|
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
|
||||||
public String getLoanTransactionAuditFields(@Context final UriInfo uriInfo, @PathParam("loanId") Long loanId,
|
public String getLoanTransactionAuditFields(@Context final UriInfo uriInfo, @PathParam("loanId") Long loanId,
|
||||||
@PathParam("transactionId") Long transactionId) {
|
@PathParam("transactionId") Long transactionId) {
|
||||||
log.warn("------------------------------------------------------------");
|
log.warn("------------------------------------------------------------");
|
||||||
@@ -118,6 +122,7 @@ public class InternalLoanInformationApiResource implements InitializingBean {
|
|||||||
@Path("status/{statusId}")
|
@Path("status/{statusId}")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
|
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
|
||||||
public String getLoansByStatus(@Context final UriInfo uriInfo, @PathParam("statusId") Integer statusId) {
|
public String getLoansByStatus(@Context final UriInfo uriInfo, @PathParam("statusId") Integer statusId) {
|
||||||
log.warn("------------------------------------------------------------");
|
log.warn("------------------------------------------------------------");
|
||||||
log.warn(" ");
|
log.warn(" ");
|
||||||
@@ -134,6 +139,7 @@ public class InternalLoanInformationApiResource implements InitializingBean {
|
|||||||
@Path("{loanId}/advanced-payment-allocation-rules")
|
@Path("{loanId}/advanced-payment-allocation-rules")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
|
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
|
||||||
public List<AdvancedPaymentData> getAdvancedPaymentAllocationRulesOfLoan(@Context final UriInfo uriInfo,
|
public List<AdvancedPaymentData> getAdvancedPaymentAllocationRulesOfLoan(@Context final UriInfo uriInfo,
|
||||||
@PathParam("loanId") Long loanId) {
|
@PathParam("loanId") Long loanId) {
|
||||||
log.warn("------------------------------------------------------------");
|
log.warn("------------------------------------------------------------");
|
||||||
|
|||||||
+2
@@ -22,6 +22,7 @@ import com.google.common.collect.Lists;
|
|||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import io.github.resilience4j.retry.annotation.Retry;
|
import io.github.resilience4j.retry.annotation.Retry;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
@@ -889,6 +890,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
|
||||||
public CommandProcessingResult makeGLIMLoanRepayment(final Long loanId, final JsonCommand command) {
|
public CommandProcessingResult makeGLIMLoanRepayment(final Long loanId, final JsonCommand command) {
|
||||||
|
|
||||||
final Long parentLoanId = loanId;
|
final Long parentLoanId = loanId;
|
||||||
|
|||||||
+4
-3
@@ -52,13 +52,14 @@ import org.springframework.stereotype.Component;
|
|||||||
@Component
|
@Component
|
||||||
public class PostInterestForSavingTasklet implements Tasklet {
|
public class PostInterestForSavingTasklet implements Tasklet {
|
||||||
|
|
||||||
|
private static final int QUEUE_SIZE = 1;
|
||||||
|
|
||||||
private final SavingsAccountReadPlatformService savingAccountReadPlatformService;
|
private final SavingsAccountReadPlatformService savingAccountReadPlatformService;
|
||||||
private final ConfigurationDomainService configurationDomainService;
|
private final ConfigurationDomainService configurationDomainService;
|
||||||
private final Queue<List<SavingsAccountData>> queue = new ArrayDeque<>();
|
private final Queue<List<SavingsAccountData>> queue = new ArrayDeque<>();
|
||||||
private final ApplicationContext applicationContext;
|
private final ApplicationContext applicationContext;
|
||||||
@Qualifier(TaskExecutorConstant.CONFIGURABLE_TASK_EXECUTOR_BEAN_NAME)
|
@Qualifier(TaskExecutorConstant.CONFIGURABLE_TASK_EXECUTOR_BEAN_NAME)
|
||||||
private final ThreadPoolTaskExecutor taskExecutor;
|
private final ThreadPoolTaskExecutor taskExecutor;
|
||||||
private final int queueSize = 1;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
|
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
|
||||||
@@ -122,7 +123,7 @@ public class PostInterestForSavingTasklet implements Tasklet {
|
|||||||
maxId = Math.max(maxSavingsIdInList, queue.element().get(queue.element().size() - 1).getId());
|
maxId = Math.max(maxSavingsIdInList, queue.element().get(queue.element().size() - 1).getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
while (queue.size() <= queueSize) {
|
while (queue.size() <= QUEUE_SIZE) {
|
||||||
log.debug("Fetching while threads are running!");
|
log.debug("Fetching while threads are running!");
|
||||||
List<SavingsAccountData> savingsAccountDataList = Collections.synchronizedList(this.savingAccountReadPlatformService
|
List<SavingsAccountData> savingsAccountDataList = Collections.synchronizedList(this.savingAccountReadPlatformService
|
||||||
.retrieveAllSavingsDataForInterestPosting(backdatedTxnsAllowedTill, pageSize, ACTIVE.getValue(), maxId));
|
.retrieveAllSavingsDataForInterestPosting(backdatedTxnsAllowedTill, pageSize, ACTIVE.getValue(), maxId));
|
||||||
@@ -166,7 +167,7 @@ public class PostInterestForSavingTasklet implements Tasklet {
|
|||||||
maxId = Math.max(maxSavingsIdInList, queue.element().get(queue.element().size() - 1).getId());
|
maxId = Math.max(maxSavingsIdInList, queue.element().get(queue.element().size() - 1).getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
while (queue.size() <= queueSize) {
|
while (queue.size() <= QUEUE_SIZE) {
|
||||||
log.debug("Fetching while threads are running!..:: this is not supposed to run........");
|
log.debug("Fetching while threads are running!..:: this is not supposed to run........");
|
||||||
savingsAccounts = Collections.synchronizedList(this.savingAccountReadPlatformService
|
savingsAccounts = Collections.synchronizedList(this.savingAccountReadPlatformService
|
||||||
.retrieveAllSavingsDataForInterestPosting(backdatedTxnsAllowedTill, pageSize, ACTIVE.getValue(), maxId));
|
.retrieveAllSavingsDataForInterestPosting(backdatedTxnsAllowedTill, pageSize, ACTIVE.getValue(), maxId));
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract;
|
package org.apache.fineract;
|
||||||
|
|
||||||
|
import static org.mockito.BDDMockito.given;
|
||||||
import static org.mockito.Mockito.RETURNS_MOCKS;
|
import static org.mockito.Mockito.RETURNS_MOCKS;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
|
|
||||||
@@ -30,6 +31,8 @@ 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.database.DatabaseIndependentQueryService;
|
import org.apache.fineract.infrastructure.core.service.database.DatabaseIndependentQueryService;
|
||||||
import org.apache.fineract.infrastructure.core.service.database.DatabasePasswordEncryptor;
|
import org.apache.fineract.infrastructure.core.service.database.DatabasePasswordEncryptor;
|
||||||
|
import org.apache.fineract.infrastructure.core.service.database.DatabaseType;
|
||||||
|
import org.apache.fineract.infrastructure.core.service.database.DatabaseTypeResolver;
|
||||||
import org.apache.fineract.infrastructure.core.service.migration.ExtendedSpringLiquibaseFactory;
|
import org.apache.fineract.infrastructure.core.service.migration.ExtendedSpringLiquibaseFactory;
|
||||||
import org.apache.fineract.infrastructure.core.service.migration.TenantDataSourceFactory;
|
import org.apache.fineract.infrastructure.core.service.migration.TenantDataSourceFactory;
|
||||||
import org.apache.fineract.infrastructure.core.service.migration.TenantDatabaseStateVerifier;
|
import org.apache.fineract.infrastructure.core.service.migration.TenantDatabaseStateVerifier;
|
||||||
@@ -108,11 +111,32 @@ public class TestConfiguration {
|
|||||||
return mock(JobLauncher.class, RETURNS_MOCKS);
|
return mock(JobLauncher.class, RETURNS_MOCKS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Primary
|
||||||
@Bean
|
@Bean
|
||||||
public HikariDataSource tenantDataSource() {
|
public HikariDataSource tenantDataSource() {
|
||||||
return mock(HikariDataSource.class, Mockito.RETURNS_MOCKS);
|
HikariDataSource mockDataSource = mock(HikariDataSource.class, Mockito.RETURNS_MOCKS);
|
||||||
|
return mockDataSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DataSource with Mockito RETURNS_MOCKS black magic.
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public DataSource hikariTenantDataSource() {
|
||||||
|
HikariDataSource mockDataSource = mock(HikariDataSource.class, Mockito.RETURNS_MOCKS);
|
||||||
|
return mockDataSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Primary
|
||||||
|
@Bean
|
||||||
|
public DatabaseTypeResolver databaseTypeResolver() {
|
||||||
|
DatabaseTypeResolver mock = mock(DatabaseTypeResolver.class, RETURNS_MOCKS);
|
||||||
|
given(mock.databaseType()).willReturn(DatabaseType.POSTGRESQL);
|
||||||
|
given(mock.isPostgreSQL()).willReturn(true);
|
||||||
|
return mock;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Primary
|
||||||
@Bean
|
@Bean
|
||||||
public TenantDetailsService tenantDetailsService() {
|
public TenantDetailsService tenantDetailsService() {
|
||||||
return mock(TenantDetailsService.class, Mockito.RETURNS_MOCKS);
|
return mock(TenantDetailsService.class, Mockito.RETURNS_MOCKS);
|
||||||
@@ -158,15 +182,6 @@ public class TestConfiguration {
|
|||||||
return mockJobRegisterService;
|
return mockJobRegisterService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* DataSource with Mockito RETURNS_MOCKS black magic.
|
|
||||||
*/
|
|
||||||
@Bean
|
|
||||||
public DataSource hikariTenantDataSource() {
|
|
||||||
DataSource mockDataSource = mock(DataSource.class, Mockito.RETURNS_MOCKS);
|
|
||||||
return mockDataSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public JdbcTemplate jdbcTemplate() {
|
public JdbcTemplate jdbcTemplate() {
|
||||||
return mock(JdbcTemplate.class);
|
return mock(JdbcTemplate.class);
|
||||||
|
|||||||
+1
@@ -72,6 +72,7 @@ public class COBBusinessStepServiceStepDefinitions implements En {
|
|||||||
private BatchBusinessStep batchBusinessStep = mock(BatchBusinessStep.class);
|
private BatchBusinessStep batchBusinessStep = mock(BatchBusinessStep.class);
|
||||||
private Set<BusinessStepNameAndOrder> resultSet;
|
private Set<BusinessStepNameAndOrder> resultSet;
|
||||||
|
|
||||||
|
@SuppressFBWarnings(value = "CT_CONSTRUCTOR_THROW")
|
||||||
public COBBusinessStepServiceStepDefinitions() throws Exception {
|
public COBBusinessStepServiceStepDefinitions() throws Exception {
|
||||||
businessStepService = new COBBusinessStepServiceImpl(batchBusinessStepRepository, applicationContext, beanFactory,
|
businessStepService = new COBBusinessStepServiceImpl(batchBusinessStepRepository, applicationContext, beanFactory,
|
||||||
businessEventNotifierService, configurationDomainService, reloaderService);
|
businessEventNotifierService, configurationDomainService, reloaderService);
|
||||||
|
|||||||
+2
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.infrastructure.classpath;
|
package org.apache.fineract.infrastructure.classpath;
|
||||||
|
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import io.cucumber.java8.En;
|
import io.cucumber.java8.En;
|
||||||
import io.github.classgraph.ClassGraph;
|
import io.github.classgraph.ClassGraph;
|
||||||
import io.github.classgraph.ResourceList;
|
import io.github.classgraph.ResourceList;
|
||||||
@@ -38,6 +39,7 @@ public class ClasspathDuplicatesStepDefinitions implements En {
|
|||||||
|
|
||||||
private ClassGraph classGraph;
|
private ClassGraph classGraph;
|
||||||
|
|
||||||
|
@SuppressFBWarnings(value = "CT_CONSTRUCTOR_THROW")
|
||||||
public ClasspathDuplicatesStepDefinitions() {
|
public ClasspathDuplicatesStepDefinitions() {
|
||||||
// tag::given[]
|
// tag::given[]
|
||||||
Given("A class graph", () -> {
|
Given("A class graph", () -> {
|
||||||
|
|||||||
+1
@@ -32,6 +32,7 @@ public class MultiExceptionStepDefinitions implements En {
|
|||||||
|
|
||||||
private List<Throwable> exceptions = new ArrayList<>();
|
private List<Throwable> exceptions = new ArrayList<>();
|
||||||
|
|
||||||
|
@SuppressFBWarnings(value = "CT_CONSTRUCTOR_THROW")
|
||||||
public MultiExceptionStepDefinitions() {
|
public MultiExceptionStepDefinitions() {
|
||||||
Given("/^A multi exception with exceptions (.*) and (.*)$/", (String exception1, String exception2) -> {
|
Given("/^A multi exception with exceptions (.*) and (.*)$/", (String exception1, String exception2) -> {
|
||||||
if (!StringUtils.isBlank(exception1)) {
|
if (!StringUtils.isBlank(exception1)) {
|
||||||
|
|||||||
@@ -52,5 +52,5 @@ dependencies {
|
|||||||
testImplementation 'org.mapstruct:mapstruct'
|
testImplementation 'org.mapstruct:mapstruct'
|
||||||
testAnnotationProcessor 'org.mapstruct:mapstruct-processor'
|
testAnnotationProcessor 'org.mapstruct:mapstruct-processor'
|
||||||
|
|
||||||
testImplementation 'com.github.tomakehurst:wiremock:3.0.1'
|
testImplementation 'com.github.tomakehurst:wiremock-standalone:3.0.1'
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user