FINERACT-1734-Create-Custom-Business-Event
This commit is contained in:
committed by
Arnold Gálovics
parent
0f41eb2c42
commit
d3dcc760e2
+3
@@ -54,6 +54,7 @@ public class LiquibaseStepDefinitions implements En {
|
||||
private ExtendedSpringLiquibase tenantStoreLiquibase;
|
||||
private ExtendedSpringLiquibase initialTenantLiquibase;
|
||||
private ExtendedSpringLiquibase tenantLiquibase;
|
||||
private ExtendedSpringLiquibase customChangeLogLiquibase;
|
||||
private FineractPlatformTenant defaultTenant;
|
||||
private DataSource tenantStoreDataSource;
|
||||
private TenantDatabaseUpgradeService tenantDatabaseUpgradeService;
|
||||
@@ -158,6 +159,7 @@ public class LiquibaseStepDefinitions implements En {
|
||||
|
||||
initialTenantLiquibase = mock(ExtendedSpringLiquibase.class);
|
||||
tenantLiquibase = mock(ExtendedSpringLiquibase.class);
|
||||
customChangeLogLiquibase = mock(ExtendedSpringLiquibase.class);
|
||||
initialTenantStoreLiquibase = mock(ExtendedSpringLiquibase.class);
|
||||
tenantStoreLiquibase = mock(ExtendedSpringLiquibase.class);
|
||||
|
||||
@@ -171,6 +173,7 @@ public class LiquibaseStepDefinitions implements En {
|
||||
given(tenantDataSourceFactory.create(defaultTenant)).willReturn(defaultTenantDataSource);
|
||||
given(liquibaseFactory.create(defaultTenantDataSource, "tenant_db", "initial_switch")).willReturn(initialTenantLiquibase);
|
||||
given(liquibaseFactory.create(defaultTenantDataSource, "tenant_db")).willReturn(tenantLiquibase);
|
||||
given(liquibaseFactory.create(defaultTenantDataSource, "tenant_db", "custom_changelog")).willReturn(customChangeLogLiquibase);
|
||||
|
||||
tenantDatabaseUpgradeService = new TenantDatabaseUpgradeService(tenantDetailsService, tenantStoreDataSource, fineractProperties,
|
||||
databaseStateVerifier, liquibaseFactory, tenantDataSourceFactory);
|
||||
|
||||
+11
-4
@@ -32,6 +32,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
||||
import org.apache.fineract.infrastructure.event.external.exception.ExternalEventConfigurationNotFoundException;
|
||||
import org.apache.fineract.infrastructure.event.external.service.validation.ExternalEventSourceService;
|
||||
import org.apache.fineract.infrastructure.security.service.TenantDetailsService;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -50,11 +51,14 @@ public class ExternalEventConfigurationValidationServiceTest {
|
||||
@Mock
|
||||
private TenantDetailsService tenantDetailsService;
|
||||
|
||||
@Mock
|
||||
private ExternalEventSourceService externalEventSourceService;
|
||||
|
||||
private ExternalEventConfigurationValidationService underTest;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
underTest = new ExternalEventConfigurationValidationService(tenantDetailsService, jdbcTemplateFactory);
|
||||
underTest = new ExternalEventConfigurationValidationService(tenantDetailsService, jdbcTemplateFactory, externalEventSourceService);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -98,7 +102,8 @@ public class ExternalEventConfigurationValidationServiceTest {
|
||||
when(tenantDetailsService.findAllTenants()).thenReturn(tenants);
|
||||
when(jdbcTemplateFactory.create(any())).thenReturn(jdbcTemplate);
|
||||
when(jdbcTemplate.queryForList(anyString(), eq(String.class))).thenReturn(configurations);
|
||||
|
||||
List<String> sourcePackage = Arrays.asList("org.apache.fineract.infrastructure.event.business.domain");
|
||||
when(externalEventSourceService.getSourcePackages()).thenReturn(sourcePackage);
|
||||
// when
|
||||
underTest.afterPropertiesSet();
|
||||
|
||||
@@ -117,7 +122,8 @@ public class ExternalEventConfigurationValidationServiceTest {
|
||||
when(tenantDetailsService.findAllTenants()).thenReturn(tenants);
|
||||
when(jdbcTemplateFactory.create(any())).thenReturn(jdbcTemplate);
|
||||
when(jdbcTemplate.queryForList(anyString(), eq(String.class))).thenReturn(new ArrayList<>());
|
||||
|
||||
List<String> sourcePackage = Arrays.asList("org.apache.fineract.infrastructure.event.business.domain");
|
||||
when(externalEventSourceService.getSourcePackages()).thenReturn(sourcePackage);
|
||||
// when
|
||||
ExternalEventConfigurationNotFoundException exceptionThrown = assertThrows(ExternalEventConfigurationNotFoundException.class,
|
||||
() -> underTest.afterPropertiesSet());
|
||||
@@ -171,7 +177,8 @@ public class ExternalEventConfigurationValidationServiceTest {
|
||||
when(tenantDetailsService.findAllTenants()).thenReturn(tenants);
|
||||
when(jdbcTemplateFactory.create(any())).thenReturn(jdbcTemplate);
|
||||
when(jdbcTemplate.queryForList(anyString(), eq(String.class))).thenReturn(configurationWithMissingCentersCreateBusinessEvent);
|
||||
|
||||
List<String> sourcePackage = Arrays.asList("org.apache.fineract.infrastructure.event.business.domain");
|
||||
when(externalEventSourceService.getSourcePackages()).thenReturn(sourcePackage);
|
||||
// when
|
||||
ExternalEventConfigurationNotFoundException exceptionThrown = assertThrows(ExternalEventConfigurationNotFoundException.class,
|
||||
() -> underTest.afterPropertiesSet());
|
||||
|
||||
Reference in New Issue
Block a user