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