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
bf8a8167
Commit
bf8a8167
authored
Jul 12, 2016
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6374 from izeye:polish-20160712
* pr/6374: Polish
parents
43afc149
a9f6ae44
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
15 additions
and
20 deletions
+15
-20
CompositeHealthIndicatorConfiguration.java
.../autoconfigure/CompositeHealthIndicatorConfiguration.java
+2
-2
ElasticsearchHealthIndicatorConfiguration.java
...oconfigure/ElasticsearchHealthIndicatorConfiguration.java
+2
-2
HealthIndicatorAutoConfiguration.java
...tuate/autoconfigure/HealthIndicatorAutoConfiguration.java
+1
-1
ElasticsearchHealthIndicatorProperties.java
...ctuate/health/ElasticsearchHealthIndicatorProperties.java
+1
-1
ElasticsearchJestHealthIndicator.java
...boot/actuate/health/ElasticsearchJestHealthIndicator.java
+3
-2
HealthIndicatorAutoConfigurationTests.java
.../autoconfigure/HealthIndicatorAutoConfigurationTests.java
+2
-2
ElasticsearchJestHealthIndicatorTests.java
...actuate/health/ElasticsearchJestHealthIndicatorTests.java
+3
-3
Neo4jDataAutoConfigurationTests.java
...configure/data/neo4j/Neo4jDataAutoConfigurationTests.java
+0
-5
Neo4jRepositoriesAutoConfigurationTests.java
...e/data/neo4j/Neo4jRepositoriesAutoConfigurationTests.java
+0
-1
SpringBootTestContextCustomizer.java
...rk/boot/test/context/SpringBootTestContextCustomizer.java
+1
-1
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CompositeHealthIndicatorConfiguration.java
View file @
bf8a8167
...
@@ -28,8 +28,8 @@ import org.springframework.core.ResolvableType;
...
@@ -28,8 +28,8 @@ import org.springframework.core.ResolvableType;
* Base class for configurations that can combine source beans using a
* Base class for configurations that can combine source beans using a
* {@link CompositeHealthIndicator}.
* {@link CompositeHealthIndicator}.
*
*
* @param <H>
T
he health indicator type
* @param <H>
t
he health indicator type
* @param <S>
T
he bean source type
* @param <S>
t
he bean source type
* @author Stephane Nicoll
* @author Stephane Nicoll
* @since 1.4.0
* @since 1.4.0
*/
*/
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ElasticsearchHealthIndicatorConfiguration.java
View file @
bf8a8167
...
@@ -43,14 +43,14 @@ class ElasticsearchHealthIndicatorConfiguration {
...
@@ -43,14 +43,14 @@ class ElasticsearchHealthIndicatorConfiguration {
@ConditionalOnBean
(
Client
.
class
)
@ConditionalOnBean
(
Client
.
class
)
@ConditionalOnEnabledHealthIndicator
(
"elasticsearch"
)
@ConditionalOnEnabledHealthIndicator
(
"elasticsearch"
)
@EnableConfigurationProperties
(
ElasticsearchHealthIndicatorProperties
.
class
)
@EnableConfigurationProperties
(
ElasticsearchHealthIndicatorProperties
.
class
)
static
class
Elasticsearch
SpringData
HealthIndicatorConfiguration
extends
static
class
Elasticsearch
Client
HealthIndicatorConfiguration
extends
CompositeHealthIndicatorConfiguration
<
ElasticsearchHealthIndicator
,
Client
>
{
CompositeHealthIndicatorConfiguration
<
ElasticsearchHealthIndicator
,
Client
>
{
private
final
Map
<
String
,
Client
>
clients
;
private
final
Map
<
String
,
Client
>
clients
;
private
final
ElasticsearchHealthIndicatorProperties
properties
;
private
final
ElasticsearchHealthIndicatorProperties
properties
;
Elasticsearch
SpringData
HealthIndicatorConfiguration
(
Map
<
String
,
Client
>
clients
,
Elasticsearch
Client
HealthIndicatorConfiguration
(
Map
<
String
,
Client
>
clients
,
ElasticsearchHealthIndicatorProperties
properties
)
{
ElasticsearchHealthIndicatorProperties
properties
)
{
this
.
clients
=
clients
;
this
.
clients
=
clients
;
this
.
properties
=
properties
;
this
.
properties
=
properties
;
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java
View file @
bf8a8167
...
@@ -98,7 +98,7 @@ import org.springframework.mail.javamail.JavaMailSenderImpl;
...
@@ -98,7 +98,7 @@ import org.springframework.mail.javamail.JavaMailSenderImpl;
MongoDataAutoConfiguration
.
class
,
RabbitAutoConfiguration
.
class
,
MongoDataAutoConfiguration
.
class
,
RabbitAutoConfiguration
.
class
,
RedisAutoConfiguration
.
class
,
SolrAutoConfiguration
.
class
})
RedisAutoConfiguration
.
class
,
SolrAutoConfiguration
.
class
})
@EnableConfigurationProperties
({
HealthIndicatorProperties
.
class
})
@EnableConfigurationProperties
({
HealthIndicatorProperties
.
class
})
@Import
({
ElasticsearchHealthIndicatorConfiguration
.
Elasticsearch
SpringData
HealthIndicatorConfiguration
.
class
,
@Import
({
ElasticsearchHealthIndicatorConfiguration
.
Elasticsearch
Client
HealthIndicatorConfiguration
.
class
,
ElasticsearchHealthIndicatorConfiguration
.
ElasticsearchJestHealthIndicatorConfiguration
.
class
})
ElasticsearchHealthIndicatorConfiguration
.
ElasticsearchJestHealthIndicatorConfiguration
.
class
})
public
class
HealthIndicatorAutoConfiguration
{
public
class
HealthIndicatorAutoConfiguration
{
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ElasticsearchHealthIndicatorProperties.java
View file @
bf8a8167
...
@@ -37,7 +37,7 @@ public class ElasticsearchHealthIndicatorProperties {
...
@@ -37,7 +37,7 @@ public class ElasticsearchHealthIndicatorProperties {
private
List
<
String
>
indices
=
new
ArrayList
<
String
>();
private
List
<
String
>
indices
=
new
ArrayList
<
String
>();
/**
/**
* T
he t
ime, in milliseconds, to wait for a response from the cluster.
* Time, in milliseconds, to wait for a response from the cluster.
*/
*/
private
long
responseTimeout
=
100L
;
private
long
responseTimeout
=
100L
;
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ElasticsearchJestHealthIndicator.java
View file @
bf8a8167
...
@@ -33,6 +33,8 @@ public class ElasticsearchJestHealthIndicator extends AbstractHealthIndicator {
...
@@ -33,6 +33,8 @@ public class ElasticsearchJestHealthIndicator extends AbstractHealthIndicator {
private
final
JestClient
jestClient
;
private
final
JestClient
jestClient
;
private
final
JsonParser
jsonParser
=
new
JsonParser
();
public
ElasticsearchJestHealthIndicator
(
JestClient
jestClient
)
{
public
ElasticsearchJestHealthIndicator
(
JestClient
jestClient
)
{
this
.
jestClient
=
jestClient
;
this
.
jestClient
=
jestClient
;
}
}
...
@@ -40,8 +42,7 @@ public class ElasticsearchJestHealthIndicator extends AbstractHealthIndicator {
...
@@ -40,8 +42,7 @@ public class ElasticsearchJestHealthIndicator extends AbstractHealthIndicator {
@Override
@Override
protected
void
doHealthCheck
(
Health
.
Builder
builder
)
throws
Exception
{
protected
void
doHealthCheck
(
Health
.
Builder
builder
)
throws
Exception
{
JestResult
aliases
=
this
.
jestClient
.
execute
(
new
Stats
.
Builder
().
build
());
JestResult
aliases
=
this
.
jestClient
.
execute
(
new
Stats
.
Builder
().
build
());
JsonParser
jsonParser
=
new
JsonParser
();
JsonElement
root
=
this
.
jsonParser
.
parse
(
aliases
.
getJsonString
());
JsonElement
root
=
jsonParser
.
parse
(
aliases
.
getJsonString
());
JsonObject
shards
=
root
.
getAsJsonObject
().
get
(
"_shards"
).
getAsJsonObject
();
JsonObject
shards
=
root
.
getAsJsonObject
().
get
(
"_shards"
).
getAsJsonObject
();
int
failedShards
=
shards
.
get
(
"failed"
).
getAsInt
();
int
failedShards
=
shards
.
get
(
"failed"
).
getAsInt
();
if
(
failedShards
!=
0
)
{
if
(
failedShards
!=
0
)
{
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java
View file @
bf8a8167
...
@@ -394,7 +394,7 @@ public class HealthIndicatorAutoConfigurationTests {
...
@@ -394,7 +394,7 @@ public class HealthIndicatorAutoConfigurationTests {
}
}
@Test
@Test
public
void
elastic
S
earchHealthIndicator
()
{
public
void
elastic
s
earchHealthIndicator
()
{
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"spring.data.elasticsearch.properties.path.home:target"
,
"spring.data.elasticsearch.properties.path.home:target"
,
"management.health.diskspace.enabled:false"
);
"management.health.diskspace.enabled:false"
);
...
@@ -411,7 +411,7 @@ public class HealthIndicatorAutoConfigurationTests {
...
@@ -411,7 +411,7 @@ public class HealthIndicatorAutoConfigurationTests {
}
}
@Test
@Test
public
void
elastic
S
earchJestHealthIndicator
()
{
public
void
elastic
s
earchJestHealthIndicator
()
{
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"management.health.diskspace.enabled:false"
);
"management.health.diskspace.enabled:false"
);
this
.
context
.
register
(
JestClientConfiguration
.
class
,
this
.
context
.
register
(
JestClientConfiguration
.
class
,
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ElasticsearchJestHealthIndicatorTests.java
View file @
bf8a8167
...
@@ -46,7 +46,7 @@ public class ElasticsearchJestHealthIndicatorTests {
...
@@ -46,7 +46,7 @@ public class ElasticsearchJestHealthIndicatorTests {
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
@Test
@Test
public
void
elastic
S
earchIsUp
()
throws
IOException
{
public
void
elastic
s
earchIsUp
()
throws
IOException
{
given
(
this
.
jestClient
.
execute
(
any
(
Action
.
class
)))
given
(
this
.
jestClient
.
execute
(
any
(
Action
.
class
)))
.
willReturn
(
createJestResult
(
4
,
0
));
.
willReturn
(
createJestResult
(
4
,
0
));
...
@@ -56,7 +56,7 @@ public class ElasticsearchJestHealthIndicatorTests {
...
@@ -56,7 +56,7 @@ public class ElasticsearchJestHealthIndicatorTests {
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
@Test
@Test
public
void
elastic
S
earchIsDown
()
throws
IOException
{
public
void
elastic
s
earchIsDown
()
throws
IOException
{
given
(
this
.
jestClient
.
execute
(
any
(
Action
.
class
))).
willThrow
(
given
(
this
.
jestClient
.
execute
(
any
(
Action
.
class
))).
willThrow
(
new
CouldNotConnectException
(
"http://localhost:9200"
,
new
IOException
()));
new
CouldNotConnectException
(
"http://localhost:9200"
,
new
IOException
()));
Health
health
=
this
.
healthIndicator
.
health
();
Health
health
=
this
.
healthIndicator
.
health
();
...
@@ -65,7 +65,7 @@ public class ElasticsearchJestHealthIndicatorTests {
...
@@ -65,7 +65,7 @@ public class ElasticsearchJestHealthIndicatorTests {
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
@Test
@Test
public
void
elastic
S
earchIsOutOfService
()
throws
IOException
{
public
void
elastic
s
earchIsOutOfService
()
throws
IOException
{
given
(
this
.
jestClient
.
execute
(
any
(
Action
.
class
)))
given
(
this
.
jestClient
.
execute
(
any
(
Action
.
class
)))
.
willReturn
(
createJestResult
(
4
,
1
));
.
willReturn
(
createJestResult
(
4
,
1
));
Health
health
=
this
.
healthIndicator
.
health
();
Health
health
=
this
.
healthIndicator
.
health
();
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfigurationTests.java
View file @
bf8a8167
...
@@ -18,9 +18,7 @@ package org.springframework.boot.autoconfigure.data.neo4j;
...
@@ -18,9 +18,7 @@ package org.springframework.boot.autoconfigure.data.neo4j;
import
org.assertj.core.api.Assertions
;
import
org.assertj.core.api.Assertions
;
import
org.junit.After
;
import
org.junit.After
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.rules.ExpectedException
;
import
org.neo4j.ogm.drivers.http.driver.HttpDriver
;
import
org.neo4j.ogm.drivers.http.driver.HttpDriver
;
import
org.neo4j.ogm.session.Session
;
import
org.neo4j.ogm.session.Session
;
import
org.neo4j.ogm.session.SessionFactory
;
import
org.neo4j.ogm.session.SessionFactory
;
...
@@ -48,9 +46,6 @@ import static org.mockito.Mockito.mock;
...
@@ -48,9 +46,6 @@ import static org.mockito.Mockito.mock;
*/
*/
public
class
Neo4jDataAutoConfigurationTests
{
public
class
Neo4jDataAutoConfigurationTests
{
@Rule
public
final
ExpectedException
thrown
=
ExpectedException
.
none
();
private
AnnotationConfigApplicationContext
context
;
private
AnnotationConfigApplicationContext
context
;
@After
@After
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jRepositoriesAutoConfigurationTests.java
View file @
bf8a8167
...
@@ -86,7 +86,6 @@ public class Neo4jRepositoriesAutoConfigurationTests {
...
@@ -86,7 +86,6 @@ public class Neo4jRepositoriesAutoConfigurationTests {
"spring.data.neo4j.uri=http://localhost:9797"
);
"spring.data.neo4j.uri=http://localhost:9797"
);
this
.
context
.
register
(
configurationClasses
);
this
.
context
.
register
(
configurationClasses
);
this
.
context
.
register
(
Neo4jDataAutoConfiguration
.
class
,
this
.
context
.
register
(
Neo4jDataAutoConfiguration
.
class
,
Neo4jDataAutoConfiguration
.
class
,
Neo4jRepositoriesAutoConfiguration
.
class
,
Neo4jRepositoriesAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
);
PropertyPlaceholderAutoConfiguration
.
class
);
this
.
context
.
refresh
();
this
.
context
.
refresh
();
...
...
spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTestContextCustomizer.java
View file @
bf8a8167
...
@@ -78,7 +78,7 @@ class SpringBootTestContextCustomizer implements ContextCustomizer {
...
@@ -78,7 +78,7 @@ class SpringBootTestContextCustomizer implements ContextCustomizer {
}
}
/**
/**
* {@link FactoryBean} used to create a configure a {@link TestRestTemplate}.
* {@link FactoryBean} used to create a
nd
configure a {@link TestRestTemplate}.
*/
*/
public
static
class
TestRestTemplateFactory
public
static
class
TestRestTemplateFactory
implements
FactoryBean
<
TestRestTemplate
>,
ApplicationContextAware
{
implements
FactoryBean
<
TestRestTemplate
>,
ApplicationContextAware
{
...
...
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