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
05f10819
Commit
05f10819
authored
Mar 29, 2020
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.1.x' into 2.2.x
Closes gh-20717
parents
a9a6df2e
c9e32aaa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
CassandraReactiveHealthIndicator.java
...t/actuate/cassandra/CassandraReactiveHealthIndicator.java
+8
-5
CassandraReactiveHealthIndicatorTests.java
...uate/cassandra/CassandraReactiveHealthIndicatorTests.java
+4
-3
No files found.
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cassandra/CassandraReactiveHealthIndicator.java
View file @
05f10819
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -15,8 +15,9 @@
*/
package
org
.
springframework
.
boot
.
actuate
.
cassandra
;
import
com.datastax.driver.core.querybuilder.QueryBuilder
;
import
com.datastax.driver.core.querybuilder.Select
;
import
com.datastax.driver.core.ConsistencyLevel
;
import
com.datastax.driver.core.SimpleStatement
;
import
com.datastax.driver.core.Statement
;
import
reactor.core.publisher.Mono
;
import
org.springframework.boot.actuate.health.AbstractReactiveHealthIndicator
;
...
...
@@ -33,6 +34,9 @@ import org.springframework.util.Assert;
*/
public
class
CassandraReactiveHealthIndicator
extends
AbstractReactiveHealthIndicator
{
private
static
final
Statement
SELECT
=
new
SimpleStatement
(
"SELECT release_version FROM system.local"
)
.
setConsistencyLevel
(
ConsistencyLevel
.
LOCAL_ONE
);
private
final
ReactiveCassandraOperations
reactiveCassandraOperations
;
/**
...
...
@@ -47,8 +51,7 @@ public class CassandraReactiveHealthIndicator extends AbstractReactiveHealthIndi
@Override
protected
Mono
<
Health
>
doHealthCheck
(
Health
.
Builder
builder
)
{
Select
select
=
QueryBuilder
.
select
(
"release_version"
).
from
(
"system"
,
"local"
);
return
this
.
reactiveCassandraOperations
.
getReactiveCqlOperations
().
queryForObject
(
select
,
String
.
class
)
return
this
.
reactiveCassandraOperations
.
getReactiveCqlOperations
().
queryForObject
(
SELECT
,
String
.
class
)
.
map
((
version
)
->
builder
.
up
().
withDetail
(
"version"
,
version
).
build
()).
single
();
}
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cassandra/CassandraReactiveHealthIndicatorTests.java
View file @
05f10819
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -15,7 +15,7 @@
*/
package
org
.
springframework
.
boot
.
actuate
.
cassandra
;
import
com.datastax.driver.core.
querybuilder.Selec
t
;
import
com.datastax.driver.core.
Statemen
t
;
import
org.junit.jupiter.api.Test
;
import
reactor.core.publisher.Mono
;
import
reactor.test.StepVerifier
;
...
...
@@ -42,7 +42,8 @@ class CassandraReactiveHealthIndicatorTests {
@Test
void
testCassandraIsUp
()
{
ReactiveCqlOperations
reactiveCqlOperations
=
mock
(
ReactiveCqlOperations
.
class
);
given
(
reactiveCqlOperations
.
queryForObject
(
any
(
Select
.
class
),
eq
(
String
.
class
))).
willReturn
(
Mono
.
just
(
"6.0.0"
));
given
(
reactiveCqlOperations
.
queryForObject
(
any
(
Statement
.
class
),
eq
(
String
.
class
)))
.
willReturn
(
Mono
.
just
(
"6.0.0"
));
ReactiveCassandraOperations
reactiveCassandraOperations
=
mock
(
ReactiveCassandraOperations
.
class
);
given
(
reactiveCassandraOperations
.
getReactiveCqlOperations
()).
willReturn
(
reactiveCqlOperations
);
...
...
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