Skip to content

Commit 8a9b347

Browse files
committed
Use limited ContextConfiguration enabled
1 parent 4c705c5 commit 8a9b347

12 files changed

+25
-0
lines changed

src/test/java/org/phoebus/channelfinder/ChannelControllerIT.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,16 @@
2525
import org.springframework.beans.factory.annotation.Autowired;
2626
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
2727
import org.springframework.security.test.context.support.WithMockUser;
28+
import org.springframework.test.context.ContextConfiguration;
2829
import org.springframework.test.context.TestPropertySource;
2930
import org.springframework.web.server.ResponseStatusException;
3031

3132
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
3233
@WebMvcTest(ChannelController.class)
3334
@WithMockUser(roles = "CF-ADMINS")
3435
@TestPropertySource(value = "classpath:application_test.properties")
36+
@ContextConfiguration(
37+
classes = {ChannelController.class, ElasticConfig.class, ChannelRepository.class})
3538
class ChannelControllerIT {
3639

3740
@Autowired IChannel channelManager;

src/test/java/org/phoebus/channelfinder/ChannelRepositoryIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.phoebus.channelfinder.repository.TagRepository;
2626
import org.springframework.beans.factory.annotation.Autowired;
2727
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
28+
import org.springframework.test.context.ContextConfiguration;
2829
import org.springframework.test.context.TestPropertySource;
2930
import org.springframework.util.LinkedMultiValueMap;
3031
import org.springframework.util.MultiValueMap;
@@ -33,6 +34,7 @@
3334
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
3435
@WebMvcTest(ChannelRepository.class)
3536
@TestPropertySource(value = "classpath:application_test.properties")
37+
@ContextConfiguration(classes = {ChannelRepository.class, ElasticConfig.class})
3638
class ChannelRepositoryIT {
3739

3840
@Autowired ElasticConfig esService;

src/test/java/org/phoebus/channelfinder/ChannelRepositorySearchIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@
2525
import org.springframework.beans.factory.annotation.Autowired;
2626
import org.springframework.beans.factory.annotation.Value;
2727
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
28+
import org.springframework.test.context.ContextConfiguration;
2829
import org.springframework.test.context.TestPropertySource;
2930
import org.springframework.util.LinkedMultiValueMap;
3031
import org.springframework.util.MultiValueMap;
3132

3233
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
3334
@WebMvcTest(ChannelRepository.class)
3435
@TestPropertySource(locations = "classpath:application_test.properties")
36+
@ContextConfiguration(classes = {ChannelRepository.class, ElasticConfig.class})
3537
class ChannelRepositorySearchIT {
3638
private static final Logger logger = Logger.getLogger(ChannelRepositorySearchIT.class.getName());
3739

src/test/java/org/phoebus/channelfinder/ChannelScrollControllerIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@
1616
import org.phoebus.channelfinder.rest.controller.ChannelScrollController;
1717
import org.springframework.beans.factory.annotation.Autowired;
1818
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
19+
import org.springframework.test.context.ContextConfiguration;
1920
import org.springframework.test.context.TestPropertySource;
2021
import org.springframework.util.LinkedMultiValueMap;
2122
import org.springframework.util.MultiValueMap;
2223

2324
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
2425
@WebMvcTest(ChannelScrollController.class)
2526
@TestPropertySource(value = "classpath:application_test.properties")
27+
@ContextConfiguration(classes = {ChannelScrollController.class, ElasticConfig.class})
2628
class ChannelScrollControllerIT {
2729

2830
@Autowired IChannelScroll channelScroll;

src/test/java/org/phoebus/channelfinder/ChannelScrollControllerSearchIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@
1818
import org.phoebus.channelfinder.rest.controller.ChannelScrollController;
1919
import org.springframework.beans.factory.annotation.Autowired;
2020
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
21+
import org.springframework.test.context.ContextConfiguration;
2122
import org.springframework.test.context.TestPropertySource;
2223
import org.springframework.util.LinkedMultiValueMap;
2324
import org.springframework.util.MultiValueMap;
2425

2526
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
2627
@WebMvcTest(ChannelScrollController.class)
2728
@TestPropertySource(value = "classpath:application_test.properties")
29+
@ContextConfiguration(classes = {ChannelScrollController.class, ElasticConfig.class})
2830
class ChannelScrollControllerSearchIT {
2931

3032
private static final Logger logger =

src/test/java/org/phoebus/channelfinder/ChannelValidationIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@
2222
import org.springframework.beans.factory.annotation.Autowired;
2323
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
2424
import org.springframework.security.test.context.support.WithMockUser;
25+
import org.springframework.test.context.ContextConfiguration;
2526
import org.springframework.test.context.TestPropertySource;
2627
import org.springframework.web.server.ResponseStatusException;
2728

2829
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
2930
@WebMvcTest(ChannelController.class)
3031
@WithMockUser(roles = "CF-ADMINS")
3132
@TestPropertySource(value = "classpath:application_test.properties")
33+
@ContextConfiguration(classes = {ChannelController.class, ElasticConfig.class})
3234
class ChannelValidationIT {
3335

3436
@Autowired IChannel channelManager;

src/test/java/org/phoebus/channelfinder/MetricsServiceIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
2626
import org.springframework.boot.test.context.SpringBootTest;
2727
import org.springframework.test.context.ActiveProfiles;
28+
import org.springframework.test.context.ContextConfiguration;
2829
import org.springframework.test.context.TestPropertySource;
2930
import org.springframework.test.web.servlet.MockMvc;
3031
import org.springframework.util.LinkedMultiValueMap;
@@ -41,6 +42,7 @@
4142
"metrics.properties=testProperty0: value0, value1; testProperty1: value0, !*",
4243
"metrics.updateInterval=1"
4344
})
45+
@ContextConfiguration(classes = {ElasticConfig.class, MetricsService.class})
4446
class MetricsServiceIT {
4547

4648
public static final String METRICS_ENDPOINT = "/actuator/metrics";

src/test/java/org/phoebus/channelfinder/PropertyControllerIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.springframework.beans.factory.annotation.Autowired;
2727
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
2828
import org.springframework.security.test.context.support.WithMockUser;
29+
import org.springframework.test.context.ContextConfiguration;
2930
import org.springframework.test.context.TestPropertySource;
3031
import org.springframework.util.LinkedMultiValueMap;
3132
import org.springframework.util.MultiValueMap;
@@ -35,6 +36,7 @@
3536
@WebMvcTest(PropertyController.class) // TODO Somehow creating one
3637
@WithMockUser(roles = "CF-ADMINS")
3738
@TestPropertySource(value = "classpath:application_test.properties")
39+
@ContextConfiguration(classes = {PropertyController.class, ElasticConfig.class})
3840
class PropertyControllerIT {
3941

4042
@Autowired IProperty propertyManager;

src/test/java/org/phoebus/channelfinder/PropertyRepositoryIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.phoebus.channelfinder.repository.PropertyRepository;
2222
import org.springframework.beans.factory.annotation.Autowired;
2323
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
24+
import org.springframework.test.context.ContextConfiguration;
2425
import org.springframework.test.context.TestPropertySource;
2526
import org.springframework.util.LinkedMultiValueMap;
2627
import org.springframework.util.MultiValueMap;
@@ -29,6 +30,7 @@
2930
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
3031
@WebMvcTest(PropertyRepository.class)
3132
@TestPropertySource(value = "classpath:application_test.properties")
33+
@ContextConfiguration(classes = {PropertyRepository.class, ElasticConfig.class})
3234
class PropertyRepositoryIT {
3335
public static final String TEST_PROPERTY_NAME = "testProperty";
3436

src/test/java/org/phoebus/channelfinder/PropertyValidationIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@
1919
import org.springframework.beans.factory.annotation.Autowired;
2020
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
2121
import org.springframework.security.test.context.support.WithMockUser;
22+
import org.springframework.test.context.ContextConfiguration;
2223
import org.springframework.test.context.TestPropertySource;
2324
import org.springframework.web.server.ResponseStatusException;
2425

2526
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
2627
@WebMvcTest(PropertyController.class)
2728
@WithMockUser(roles = "CF-ADMINS")
2829
@TestPropertySource(value = "classpath:application_test.properties")
30+
@ContextConfiguration(classes = {PropertyController.class, ElasticConfig.class})
2931
class PropertyValidationIT {
3032

3133
@Autowired IProperty propertyManager;

0 commit comments

Comments
 (0)