Simplify build for different auth strategies
This commit is contained in:
committed by
Petri Tuomola
parent
c691c11699
commit
907f932abe
+2
-2
@@ -29,14 +29,14 @@ import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@TestPropertySource("classpath:application-test.properties")
|
||||
@WebAppConfiguration
|
||||
@ActiveProfiles("basicauth")
|
||||
@ContextConfiguration(classes = TestsWithoutDatabaseAndNoJobsConfiguration.class)
|
||||
public class CommandHandlerProviderTest {
|
||||
|
||||
|
||||
+2
-2
@@ -20,8 +20,8 @@ package org.apache.fineract.infrastructure.configuration.spring;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
@@ -34,8 +34,8 @@ import org.springframework.test.context.web.WebAppConfiguration;
|
||||
* sufficient (as long as the TestsWithoutDatabaseAndNoJobsConfiguration used extends AbstractApplicationConfiguration).
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@TestPropertySource("classpath:application-test.properties")
|
||||
@WebAppConfiguration
|
||||
@ActiveProfiles("basicauth")
|
||||
@ContextConfiguration(classes = TestsWithoutDatabaseAndNoJobsConfiguration.class)
|
||||
public class SpringConfigurationTest {
|
||||
|
||||
|
||||
+9
@@ -24,6 +24,9 @@ import org.apache.fineract.infrastructure.core.service.TenantDatabaseUpgradeServ
|
||||
import org.apache.fineract.infrastructure.jobs.service.JobRegisterService;
|
||||
import org.mockito.Mockito;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
|
||||
/**
|
||||
* Spring @Configuration which does not require a running database. It also does not load any job configuration (as they
|
||||
@@ -65,4 +68,10 @@ public class TestsWithoutDatabaseAndNoJobsConfiguration extends AbstractApplicat
|
||||
DataSource mockDataSource = Mockito.mock(DataSource.class, Mockito.RETURNS_MOCKS);
|
||||
return mockDataSource;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
public PasswordEncoder passwordEncoder() {
|
||||
return new BCryptPasswordEncoder();
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -21,14 +21,14 @@ package org.apache.fineract.infrastructure.core.boot.tests;
|
||||
import org.apache.fineract.ServerWithMariaDB4jApplication;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(classes = ServerWithMariaDB4jApplication.Configuration.class)
|
||||
@TestPropertySource("classpath:application-test.properties")
|
||||
@WebAppConfiguration
|
||||
@ActiveProfiles("basicauth")
|
||||
public abstract class AbstractSpringBootWithMariaDB4jIntegrationTest {
|
||||
|
||||
// do NOT put any helper methods here!
|
||||
|
||||
Reference in New Issue
Block a user