FINERACT-1724: Sampling support for performance measurements
This commit is contained in:
committed by
Arnold Gálovics
parent
0db4610367
commit
883761bd80
+19
-3
@@ -40,9 +40,11 @@ import org.apache.fineract.cob.exceptions.BusinessStepException;
|
||||
import org.apache.fineract.cob.loan.LoanCOBBusinessStep;
|
||||
import org.apache.fineract.cob.service.ReloaderService;
|
||||
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
|
||||
import org.apache.fineract.infrastructure.core.config.FineractProperties;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractAuditableCustom;
|
||||
import org.apache.fineract.infrastructure.core.domain.ActionContext;
|
||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||
import org.apache.fineract.infrastructure.core.service.performance.sampling.SamplingServiceFactory;
|
||||
import org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService;
|
||||
import org.apache.fineract.mix.data.MixTaxonomyData;
|
||||
import org.mockito.Mockito;
|
||||
@@ -52,6 +54,8 @@ import org.springframework.context.ApplicationContext;
|
||||
|
||||
public class COBBusinessStepServiceStepDefinitions implements En {
|
||||
|
||||
private SamplingServiceFactory samplingServiceFactory;
|
||||
|
||||
private ApplicationContext applicationContext = mock(ApplicationContext.class);
|
||||
private ListableBeanFactory beanFactory = mock(ListableBeanFactory.class);
|
||||
private BatchBusinessStepRepository batchBusinessStepRepository = mock(BatchBusinessStepRepository.class);
|
||||
@@ -59,8 +63,8 @@ public class COBBusinessStepServiceStepDefinitions implements En {
|
||||
private ConfigurationDomainService configurationDomainService = mock(ConfigurationDomainService.class);
|
||||
|
||||
private ReloaderService reloaderService = mock(ReloaderService.class);
|
||||
private final COBBusinessStepService businessStepService = new COBBusinessStepServiceImpl(batchBusinessStepRepository,
|
||||
applicationContext, beanFactory, businessEventNotifierService, configurationDomainService, reloaderService);
|
||||
private final COBBusinessStepServiceImpl businessStepService;
|
||||
|
||||
private COBBusinessStep cobBusinessStep = mock(COBBusinessStep.class);
|
||||
private COBBusinessStep notRegistereCobBusinessStep = mock(COBBusinessStep.class);
|
||||
private TreeMap<Long, String> executionMap;
|
||||
@@ -77,7 +81,19 @@ public class COBBusinessStepServiceStepDefinitions implements En {
|
||||
private BatchBusinessStep batchBusinessStep = mock(BatchBusinessStep.class);
|
||||
private Set<BusinessStepNameAndOrder> resultSet;
|
||||
|
||||
public COBBusinessStepServiceStepDefinitions() {
|
||||
public COBBusinessStepServiceStepDefinitions() throws Exception {
|
||||
FineractProperties.FineractSamplingProperties sampling = new FineractProperties.FineractSamplingProperties();
|
||||
sampling.setEnabled(false);
|
||||
sampling.setSampledClasses("");
|
||||
FineractProperties fineractProperties = new FineractProperties();
|
||||
fineractProperties.setSampling(sampling);
|
||||
samplingServiceFactory = new SamplingServiceFactory(fineractProperties);
|
||||
samplingServiceFactory.afterPropertiesSet();
|
||||
|
||||
businessStepService = new COBBusinessStepServiceImpl(batchBusinessStepRepository, applicationContext, beanFactory,
|
||||
businessEventNotifierService, configurationDomainService, reloaderService, samplingServiceFactory);
|
||||
businessStepService.afterPropertiesSet();
|
||||
|
||||
Given("/^The COBBusinessStepService.run method with executeMap (.*)$/", (String executionMap) -> {
|
||||
if ("null".equals(executionMap)) {
|
||||
this.executionMap = null;
|
||||
|
||||
+7
-1
@@ -41,6 +41,8 @@ import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDoma
|
||||
import org.apache.fineract.infrastructure.core.domain.ActionContext;
|
||||
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||
import org.apache.fineract.infrastructure.core.service.performance.sampling.NoopSamplingService;
|
||||
import org.apache.fineract.infrastructure.core.service.performance.sampling.SamplingServiceFactory;
|
||||
import org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
@@ -66,6 +68,8 @@ public class COBBulkEventConfigurationTest {
|
||||
private BusinessEventNotifierService businessEventNotifierService;
|
||||
@Mock
|
||||
private ConfigurationDomainService configurationDomainService;
|
||||
@Mock
|
||||
private SamplingServiceFactory samplingServiceFactory;
|
||||
@InjectMocks
|
||||
private COBBusinessStepServiceImpl underTest;
|
||||
|
||||
@@ -73,11 +77,13 @@ public class COBBulkEventConfigurationTest {
|
||||
private ReloaderService reloaderService;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
public void setUp() throws Exception {
|
||||
ThreadLocalContextUtil.setTenant(new FineractPlatformTenant(1L, "default", "Default", "Asia/Kolkata", null));
|
||||
ThreadLocalContextUtil
|
||||
.setBusinessDates(new HashMap<>(Map.of(BusinessDateType.BUSINESS_DATE, LocalDate.now(ZoneId.systemDefault()))));
|
||||
when(reloaderService.reload(any())).thenAnswer(invocation -> invocation.getArgument(0));
|
||||
when(samplingServiceFactory.forClass(any())).thenReturn(new NoopSamplingService());
|
||||
underTest.afterPropertiesSet();
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
|
||||
@@ -78,6 +78,10 @@ fineract.report.export.s3.enabled=${FINERACT_REPORT_EXPORT_S3_ENABLED:false}
|
||||
|
||||
fineract.jpa.statementLoggingEnabled=${FINERACT_STATEMENT_LOGGING_ENABLED:false}
|
||||
|
||||
|
||||
fineract.sampling.enabled=false
|
||||
fineract.sampling.sampledClasses=
|
||||
|
||||
management.health.jms.enabled=false
|
||||
|
||||
# FINERACT 1296
|
||||
|
||||
Reference in New Issue
Block a user