Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
b8eb13d8
Commit
b8eb13d8
authored
Oct 08, 2014
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests after addition of disk space health indicator
parent
20c4795a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
7 deletions
+38
-7
HealthIndicatorAutoConfigurationTests.java
.../autoconfigure/HealthIndicatorAutoConfigurationTests.java
+38
-7
No files found.
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java
View file @
b8eb13d8
...
...
@@ -25,6 +25,7 @@ import org.junit.Before;
import
org.junit.Test
;
import
org.springframework.boot.actuate.health.ApplicationHealthIndicator
;
import
org.springframework.boot.actuate.health.DataSourceHealthIndicator
;
import
org.springframework.boot.actuate.health.DiskSpaceHealthIndicator
;
import
org.springframework.boot.actuate.health.HealthIndicator
;
import
org.springframework.boot.actuate.health.MongoHealthIndicator
;
import
org.springframework.boot.actuate.health.RabbitHealthIndicator
;
...
...
@@ -76,6 +77,8 @@ public class HealthIndicatorAutoConfigurationTests {
public
void
defaultHealthIndicator
()
{
this
.
context
=
new
AnnotationConfigApplicationContext
();
this
.
context
.
register
(
HealthIndicatorAutoConfiguration
.
class
);
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"health.diskspace.enabled:false"
);
this
.
context
.
refresh
();
Map
<
String
,
HealthIndicator
>
beans
=
this
.
context
.
getBeansOfType
(
HealthIndicator
.
class
);
...
...
@@ -89,6 +92,8 @@ public class HealthIndicatorAutoConfigurationTests {
this
.
context
=
new
AnnotationConfigApplicationContext
();
this
.
context
.
register
(
RedisAutoConfiguration
.
class
,
HealthIndicatorAutoConfiguration
.
class
);
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"health.diskspace.enabled:false"
);
this
.
context
.
refresh
();
Map
<
String
,
HealthIndicator
>
beans
=
this
.
context
.
getBeansOfType
(
HealthIndicator
.
class
);
...
...
@@ -102,7 +107,8 @@ public class HealthIndicatorAutoConfigurationTests {
this
.
context
=
new
AnnotationConfigApplicationContext
();
this
.
context
.
register
(
RedisAutoConfiguration
.
class
,
HealthIndicatorAutoConfiguration
.
class
);
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"health.redis.enabled:false"
);
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"health.redis.enabled:false"
,
"health.diskspace.enabled:false"
);
this
.
context
.
refresh
();
Map
<
String
,
HealthIndicator
>
beans
=
this
.
context
.
getBeansOfType
(
HealthIndicator
.
class
);
...
...
@@ -116,6 +122,8 @@ public class HealthIndicatorAutoConfigurationTests {
this
.
context
=
new
AnnotationConfigApplicationContext
();
this
.
context
.
register
(
MongoAutoConfiguration
.
class
,
MongoDataAutoConfiguration
.
class
,
HealthIndicatorAutoConfiguration
.
class
);
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"health.diskspace.enabled:false"
);
this
.
context
.
refresh
();
Map
<
String
,
HealthIndicator
>
beans
=
this
.
context
.
getBeansOfType
(
HealthIndicator
.
class
);
...
...
@@ -129,7 +137,8 @@ public class HealthIndicatorAutoConfigurationTests {
this
.
context
=
new
AnnotationConfigApplicationContext
();
this
.
context
.
register
(
MongoAutoConfiguration
.
class
,
MongoDataAutoConfiguration
.
class
,
HealthIndicatorAutoConfiguration
.
class
);
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"health.mongo.enabled:false"
);
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"health.mongo.enabled:false"
,
"health.diskspace.enabled:false"
);
this
.
context
.
refresh
();
Map
<
String
,
HealthIndicator
>
beans
=
this
.
context
.
getBeansOfType
(
HealthIndicator
.
class
);
...
...
@@ -147,7 +156,7 @@ public class HealthIndicatorAutoConfigurationTests {
this
.
context
.
refresh
();
Map
<
String
,
HealthIndicator
>
beans
=
this
.
context
.
getBeansOfType
(
HealthIndicator
.
class
);
assertEquals
(
3
,
beans
.
size
());
assertEquals
(
4
,
beans
.
size
());
}
@Test
...
...
@@ -155,6 +164,8 @@ public class HealthIndicatorAutoConfigurationTests {
this
.
context
=
new
AnnotationConfigApplicationContext
();
this
.
context
.
register
(
EmbeddedDataSourceConfiguration
.
class
,
HealthIndicatorAutoConfiguration
.
class
);
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"health.diskspace.enabled:false"
);
this
.
context
.
refresh
();
Map
<
String
,
HealthIndicator
>
beans
=
this
.
context
.
getBeansOfType
(
HealthIndicator
.
class
);
...
...
@@ -171,7 +182,8 @@ public class HealthIndicatorAutoConfigurationTests {
DataSourcePoolMetadataProvidersConfiguration
.
class
,
HealthIndicatorAutoConfiguration
.
class
);
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"spring.datasource.validation-query:SELECT from FOOBAR"
);
"spring.datasource.validation-query:SELECT from FOOBAR"
,
"health.diskspace.enabled:false"
);
this
.
context
.
refresh
();
Map
<
String
,
HealthIndicator
>
beans
=
this
.
context
.
getBeansOfType
(
HealthIndicator
.
class
);
...
...
@@ -187,7 +199,8 @@ public class HealthIndicatorAutoConfigurationTests {
this
.
context
=
new
AnnotationConfigApplicationContext
();
this
.
context
.
register
(
EmbeddedDataSourceConfiguration
.
class
,
HealthIndicatorAutoConfiguration
.
class
);
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"health.db.enabled:false"
);
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"health.db.enabled:false"
,
"health.diskspace.enabled:false"
);
this
.
context
.
refresh
();
Map
<
String
,
HealthIndicator
>
beans
=
this
.
context
.
getBeansOfType
(
HealthIndicator
.
class
);
...
...
@@ -201,6 +214,8 @@ public class HealthIndicatorAutoConfigurationTests {
this
.
context
=
new
AnnotationConfigApplicationContext
();
this
.
context
.
register
(
RabbitAutoConfiguration
.
class
,
HealthIndicatorAutoConfiguration
.
class
);
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"health.diskspace.enabled:false"
);
this
.
context
.
refresh
();
Map
<
String
,
HealthIndicator
>
beans
=
this
.
context
.
getBeansOfType
(
HealthIndicator
.
class
);
...
...
@@ -214,7 +229,8 @@ public class HealthIndicatorAutoConfigurationTests {
this
.
context
=
new
AnnotationConfigApplicationContext
();
this
.
context
.
register
(
RabbitAutoConfiguration
.
class
,
HealthIndicatorAutoConfiguration
.
class
);
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"health.rabbit.enabled:false"
);
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"health.rabbit.enabled:false"
,
"health.diskspace.enabled:false"
);
this
.
context
.
refresh
();
Map
<
String
,
HealthIndicator
>
beans
=
this
.
context
.
getBeansOfType
(
HealthIndicator
.
class
);
...
...
@@ -228,6 +244,8 @@ public class HealthIndicatorAutoConfigurationTests {
this
.
context
=
new
AnnotationConfigApplicationContext
();
this
.
context
.
register
(
SolrAutoConfiguration
.
class
,
HealthIndicatorAutoConfiguration
.
class
);
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"health.diskspace.enabled:false"
);
this
.
context
.
refresh
();
Map
<
String
,
HealthIndicator
>
beans
=
this
.
context
.
getBeansOfType
(
HealthIndicator
.
class
);
...
...
@@ -241,7 +259,8 @@ public class HealthIndicatorAutoConfigurationTests {
this
.
context
=
new
AnnotationConfigApplicationContext
();
this
.
context
.
register
(
SolrAutoConfiguration
.
class
,
HealthIndicatorAutoConfiguration
.
class
);
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"health.solr.enabled:false"
);
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"health.solr.enabled:false"
,
"health.diskspace.enabled:false"
);
this
.
context
.
refresh
();
Map
<
String
,
HealthIndicator
>
beans
=
this
.
context
.
getBeansOfType
(
HealthIndicator
.
class
);
...
...
@@ -250,6 +269,18 @@ public class HealthIndicatorAutoConfigurationTests {
.
getClass
());
}
@Test
public
void
diskSpaceHealthIndicator
()
{
this
.
context
=
new
AnnotationConfigApplicationContext
();
this
.
context
.
register
(
HealthIndicatorAutoConfiguration
.
class
);
this
.
context
.
refresh
();
Map
<
String
,
HealthIndicator
>
beans
=
this
.
context
.
getBeansOfType
(
HealthIndicator
.
class
);
assertEquals
(
1
,
beans
.
size
());
assertEquals
(
DiskSpaceHealthIndicator
.
class
,
beans
.
values
().
iterator
().
next
()
.
getClass
());
}
@Configuration
@EnableConfigurationProperties
protected
static
class
DataSourceConfig
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment