File tree Expand file tree Collapse file tree 20 files changed +208
-26
lines changed
spring-cloud-archaius/additional-sources-simple/src
main/java/com/baeldung/spring/cloud/archaius/additionalsources/config
test/java/com/baeldung/spring/cloud/archaius/additionalsources
spring-cloud-aws/src/test/java/com/baeldung/spring/cloud/aws
spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server
spring-cloud-eureka-client
src/test/java/com/baeldung/spring/cloud/eureka/client
spring-cloud-eureka-feign-client/src/test/java/com/baeldung/spring/cloud/feign/client
spring-cloud-eureka-server/src/test/java/com/baeldung/spring/cloud/eureka/server
feign-rest-consumer/src/test/java/com/baeldung/spring/cloud/hystrix/rest/consumer
src/test/java/com/baeldung/spring/cloud/hystrix/rest/consumer
src/test/java/com/baeldung/spring/cloud/hystrix/rest/producer
spring-cloud-zuul-eureka-integration
src/test/java/com/baeldung/spring/cloud/eureka/client
src/test/java/com/baeldung/spring/cloud/eureka/server
src/test/java/com/baeldung/spring/cloud/zuul/config Expand file tree Collapse file tree 20 files changed +208
-26
lines changed Original file line number Diff line number Diff line change 1
1
package com .baeldung .spring .cloud .archaius .additionalsources .config ;
2
2
3
+ import java .io .IOException ;
4
+ import java .net .URL ;
5
+
3
6
import org .apache .commons .configuration .AbstractConfiguration ;
4
7
import org .springframework .context .annotation .Bean ;
5
8
import org .springframework .context .annotation .Configuration ;
9
+ import org .springframework .core .io .ClassPathResource ;
6
10
7
11
import com .netflix .config .DynamicConfiguration ;
8
12
import com .netflix .config .FixedDelayPollingScheduler ;
13
17
public class ApplicationPropertiesConfigurations {
14
18
15
19
@ Bean
16
- public AbstractConfiguration addApplicationPropertiesSource () {
17
- PolledConfigurationSource source = new URLConfigurationSource ("classpath:other-config.properties" );
20
+ public AbstractConfiguration addApplicationPropertiesSource () throws IOException {
21
+ URL configPropertyURL = (new ClassPathResource ("other-config.properties" )).getURL ();
22
+ PolledConfigurationSource source = new URLConfigurationSource (configPropertyURL );
18
23
return new DynamicConfiguration (source , new FixedDelayPollingScheduler ());
19
24
}
20
25
Original file line number Diff line number Diff line change 1
- package org .baeldung ;
1
+ package com .baeldung . spring . cloud . archaius . additionalsources ;
2
2
3
3
import org .junit .Test ;
4
4
import org .junit .runner .RunWith ;
5
5
import org .springframework .boot .test .context .SpringBootTest ;
6
6
import org .springframework .test .context .junit4 .SpringRunner ;
7
7
8
- import com .baeldung .spring .cloud .archaius .additionalsources .AdditionalSourcesSimpleApplication ;
9
-
10
8
@ RunWith (SpringRunner .class )
11
9
@ SpringBootTest (classes = AdditionalSourcesSimpleApplication .class )
12
10
public class SpringContextIntegrationTest {
Original file line number Diff line number Diff line change
1
+ package com .baeldung .spring .cloud .aws ;
2
+
3
+ import org .junit .Test ;
4
+ import org .junit .runner .RunWith ;
5
+ import org .springframework .boot .test .context .SpringBootTest ;
6
+ import org .springframework .test .context .junit4 .SpringRunner ;
7
+
8
+ @ RunWith (SpringRunner .class )
9
+ @ SpringBootTest (classes = SpringCloudAwsApplication .class )
10
+ public class SpringContextIntegrationTest {
11
+
12
+ @ Test
13
+ public void whenSpringContextIsBootstrapped_thenNoExceptions () {
14
+ }
15
+ }
Original file line number Diff line number Diff line change 1
1
package com .baeldung .spring .cloud .config .server ;
2
2
3
- import org .junit .Ignore ;
4
3
import org .junit .Test ;
5
4
import org .junit .runner .RunWith ;
6
5
import org .springframework .boot .test .context .SpringBootTest ;
7
6
import org .springframework .test .context .junit4 .SpringJUnit4ClassRunner ;
8
7
import org .springframework .test .context .web .WebAppConfiguration ;
9
8
9
+
10
+ /**
11
+ *
12
+ * The context will load successfully with some properties provided by docker
13
+ *
14
+ */
10
15
@ RunWith (SpringJUnit4ClassRunner .class )
11
16
@ SpringBootTest (classes = ConfigServer .class )
12
17
@ WebAppConfiguration
13
- @ Ignore
14
- public class ConfigServerListIntegrationTest {
18
+ public class SpringContextLiveTest {
15
19
@ Test
16
- public void contextLoads () {
20
+ public void whenSpringContextIsBootstrapped_thenNoExceptions () {
17
21
}
18
22
}
Original file line number Diff line number Diff line change 21
21
<version >1.0.0-SNAPSHOT</version >
22
22
<relativePath >..</relativePath >
23
23
</parent >
24
+
25
+ <dependencies >
26
+ <dependency >
27
+ <groupId >org.springframework.boot</groupId >
28
+ <artifactId >spring-boot-starter-test</artifactId >
29
+ <version >${spring-boot.version} </version >
30
+ <scope >test</scope >
31
+ </dependency >
32
+ </dependencies >
24
33
25
34
<properties >
26
35
<spring-boot .version>2.0.1.RELEASE</spring-boot .version>
Original file line number Diff line number Diff line change 26
26
<artifactId >spring-boot-starter-web</artifactId >
27
27
<version >${spring-boot.version} </version >
28
28
</dependency >
29
- <dependency >
30
- <groupId >org.springframework.boot</groupId >
31
- <artifactId >spring-boot-starter-test</artifactId >
32
- <version >${spring-boot.version} </version >
33
- <scope >test</scope >
34
- </dependency >
35
29
</dependencies >
36
30
37
31
<dependencyManagement >
Original file line number Diff line number Diff line change
1
+ package com .baeldung .spring .cloud .eureka .client ;
2
+
3
+ import org .junit .Test ;
4
+ import org .junit .runner .RunWith ;
5
+ import org .springframework .boot .test .context .SpringBootTest ;
6
+ import org .springframework .test .context .junit4 .SpringRunner ;
7
+
8
+ @ RunWith (SpringRunner .class )
9
+ @ SpringBootTest
10
+ public class SpringContextIntegrationTest {
11
+
12
+ @ Test
13
+ public void whenSpringContextIsBootstrapped_thenNoExceptions () {
14
+ }
15
+
16
+ }
Original file line number Diff line number Diff line change 1
- package org .baeldung ;
1
+ package com .baeldung . spring . cloud . feign . client ;
2
2
3
3
import org .junit .Test ;
4
4
import org .junit .runner .RunWith ;
5
5
import org .springframework .boot .test .context .SpringBootTest ;
6
6
import org .springframework .test .context .junit4 .SpringRunner ;
7
7
8
- import com .baeldung .spring .cloud .aws .InstanceProfileAwsApplication ;
9
-
10
8
@ RunWith (SpringRunner .class )
11
- @ SpringBootTest ( classes = InstanceProfileAwsApplication . class )
9
+ @ SpringBootTest
12
10
public class SpringContextIntegrationTest {
13
11
14
12
@ Test
15
13
public void whenSpringContextIsBootstrapped_thenNoExceptions () {
16
14
}
15
+
17
16
}
Original file line number Diff line number Diff line change
1
+ package com .baeldung .spring .cloud .eureka .server ;
2
+
3
+ import org .junit .Test ;
4
+ import org .junit .runner .RunWith ;
5
+ import org .springframework .boot .test .context .SpringBootTest ;
6
+ import org .springframework .test .context .junit4 .SpringRunner ;
7
+
8
+ @ RunWith (SpringRunner .class )
9
+ @ SpringBootTest
10
+ public class SpringContextIntegrationTest {
11
+
12
+ @ Test
13
+ public void whenSpringContextIsBootstrapped_thenNoExceptions () {
14
+ }
15
+
16
+ }
Original file line number Diff line number Diff line change
1
+ package com .baeldung .spring .cloud .hystrix .rest .consumer ;
2
+
3
+ import org .junit .Test ;
4
+ import org .junit .runner .RunWith ;
5
+ import org .springframework .test .context .ContextConfiguration ;
6
+ import org .springframework .test .context .junit4 .SpringJUnit4ClassRunner ;
7
+ import org .springframework .test .context .web .WebAppConfiguration ;
8
+
9
+ @ RunWith (SpringJUnit4ClassRunner .class )
10
+ @ ContextConfiguration (classes = RestConsumerFeignApplication .class )
11
+ @ WebAppConfiguration
12
+ public class SpringContextIntegrationTest {
13
+
14
+ @ Test
15
+ public void whenSpringContextIsBootstrapped_thenNoExceptions () {
16
+ }
17
+
18
+ }
Original file line number Diff line number Diff line change 40
40
<artifactId >spring-boot-starter-actuator</artifactId >
41
41
<version >${spring-boot-starter-web.version} </version >
42
42
</dependency >
43
+
44
+ <dependency >
45
+ <groupId >org.springframework.boot</groupId >
46
+ <artifactId >spring-boot-starter-test</artifactId >
47
+ <scope >test</scope >
48
+ <version >${spring-boot-starter-web.version} </version >
49
+ </dependency >
43
50
</dependencies >
44
51
45
52
<dependencyManagement >
53
60
</dependency >
54
61
</dependencies >
55
62
</dependencyManagement >
63
+
64
+ <properties >
65
+ <!-- we need the Mockito version provided by Spring Boot -->
66
+ <mockito .version>1.10.19</mockito .version>
67
+ </properties >
56
68
57
69
</project >
Original file line number Diff line number Diff line change 1
- package org .baeldung ;
1
+ package com .baeldung . spring . cloud . hystrix . rest . consumer ;
2
2
3
3
import org .junit .Test ;
4
4
import org .junit .runner .RunWith ;
5
- import org .springframework .boot . test .context .SpringBootTest ;
5
+ import org .springframework .test .context .ContextConfiguration ;
6
6
import org .springframework .test .context .junit4 .SpringJUnit4ClassRunner ;
7
7
import org .springframework .test .context .web .WebAppConfiguration ;
8
8
9
- import com .baeldung .spring .cloud .config .server .ConfigServer ;
10
-
11
9
@ RunWith (SpringJUnit4ClassRunner .class )
12
- @ SpringBootTest (classes = ConfigServer .class )
10
+ @ ContextConfiguration (classes = RestConsumerApplication .class )
13
11
@ WebAppConfiguration
14
12
public class SpringContextIntegrationTest {
13
+
15
14
@ Test
16
- public void contextLoads () {
15
+ public void whenSpringContextIsBootstrapped_thenNoExceptions () {
17
16
}
17
+
18
18
}
Original file line number Diff line number Diff line change 20
20
<artifactId >spring-boot-starter-web</artifactId >
21
21
<version >${spring-boot-starter-web.version} </version >
22
22
</dependency >
23
+
24
+ <dependency >
25
+ <groupId >org.springframework.boot</groupId >
26
+ <artifactId >spring-boot-starter-test</artifactId >
27
+ <version >${spring-boot-starter-web.version} </version >
28
+ <scope >test</scope >
29
+ </dependency >
23
30
</dependencies >
31
+
32
+ <properties >
33
+ <!-- we need the Mockito version provided by Spring Boot -->
34
+ <mockito .version>1.10.19</mockito .version>
35
+ </properties >
24
36
25
37
</project >
Original file line number Diff line number Diff line change
1
+ package com .baeldung .spring .cloud .hystrix .rest .producer ;
2
+
3
+ import org .junit .Test ;
4
+ import org .junit .runner .RunWith ;
5
+ import org .springframework .boot .test .context .SpringBootTest ;
6
+ import org .springframework .test .context .junit4 .SpringRunner ;
7
+
8
+ @ RunWith (SpringRunner .class )
9
+ @ SpringBootTest
10
+ public class SpringContextIntegrationTest {
11
+
12
+ @ Test
13
+ public void whenSpringContextIsBootstrapped_thenNoExceptions () {
14
+ }
15
+
16
+ }
Original file line number Diff line number Diff line change 25
25
<artifactId >spring-boot-starter-web</artifactId >
26
26
<version >${spring-boot-starter-web.version} </version >
27
27
</dependency >
28
+
29
+ <dependency >
30
+ <groupId >org.springframework.boot</groupId >
31
+ <artifactId >spring-boot-starter-test</artifactId >
32
+ <version >${spring-boot-starter-web.version} </version >
33
+ <scope >test</scope >
34
+ </dependency >
28
35
</dependencies >
29
36
30
37
<dependencyManagement >
Original file line number Diff line number Diff line change
1
+ package com .baeldung .spring .cloud .eureka .client ;
2
+
3
+ import org .junit .Test ;
4
+ import org .junit .runner .RunWith ;
5
+ import org .springframework .boot .test .context .SpringBootTest ;
6
+ import org .springframework .test .context .junit4 .SpringRunner ;
7
+
8
+ @ RunWith (SpringRunner .class )
9
+ @ SpringBootTest
10
+ public class SpringContextIntegrationTest {
11
+
12
+ @ Test
13
+ public void whenSpringContextIsBootstrapped_thenNoExceptions () {
14
+ }
15
+
16
+ }
Original file line number Diff line number Diff line change 25
25
<artifactId >commons-configuration</artifactId >
26
26
<version >${commons-config.version} </version >
27
27
</dependency >
28
-
28
+
29
+ <dependency >
30
+ <groupId >org.springframework.boot</groupId >
31
+ <artifactId >spring-boot-starter-test</artifactId >
32
+ <version >${spring-boot-starter-web.version} </version >
33
+ <scope >test</scope >
34
+ </dependency >
29
35
</dependencies >
30
36
31
37
<dependencyManagement >
Original file line number Diff line number Diff line change
1
+ package com .baeldung .spring .cloud .eureka .server ;
2
+
3
+ import org .junit .Test ;
4
+ import org .junit .runner .RunWith ;
5
+ import org .springframework .boot .test .context .SpringBootTest ;
6
+ import org .springframework .test .context .junit4 .SpringRunner ;
7
+
8
+ @ RunWith (SpringRunner .class )
9
+ @ SpringBootTest
10
+ public class SpringContextIntegrationTest {
11
+
12
+ @ Test
13
+ public void whenSpringContextIsBootstrapped_thenNoExceptions () {
14
+ }
15
+
16
+ }
Original file line number Diff line number Diff line change 33
33
<artifactId >rxjava</artifactId >
34
34
<version >${rxjava.version} </version >
35
35
</dependency >
36
+
37
+ <dependency >
38
+ <groupId >org.springframework.boot</groupId >
39
+ <artifactId >spring-boot-starter-test</artifactId >
40
+ <version >${spring-boot-starter-web.version} </version >
41
+ <scope >test</scope >
42
+ </dependency >
36
43
</dependencies >
37
44
38
45
<dependencyManagement >
Original file line number Diff line number Diff line change
1
+ package com .baeldung .spring .cloud .zuul .config ;
2
+
3
+ import org .junit .Test ;
4
+ import org .junit .runner .RunWith ;
5
+ import org .springframework .boot .test .context .SpringBootTest ;
6
+ import org .springframework .test .context .junit4 .SpringRunner ;
7
+
8
+ @ RunWith (SpringRunner .class )
9
+ @ SpringBootTest
10
+ public class SpringContextIntegrationTest {
11
+
12
+ @ Test
13
+ public void whenSpringContextIsBootstrapped_thenNoExceptions () {
14
+ }
15
+
16
+ }
You can’t perform that action at this time.
0 commit comments