Commit 63be1678 authored by Stephane Nicoll's avatar Stephane Nicoll

Polish "Use LOCAL_ONE when querying system.local"

See gh-20709
parent 851f631e
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -32,6 +32,7 @@ import org.springframework.util.Assert; ...@@ -32,6 +32,7 @@ import org.springframework.util.Assert;
* Cassandra data stores. * Cassandra data stores.
* *
* @author Julien Dubois * @author Julien Dubois
* @author Alexandre Dutra
* @since 2.0.0 * @since 2.0.0
*/ */
public class CassandraHealthIndicator extends AbstractHealthIndicator { public class CassandraHealthIndicator extends AbstractHealthIndicator {
......
...@@ -18,7 +18,7 @@ package org.springframework.boot.actuate.cassandra; ...@@ -18,7 +18,7 @@ package org.springframework.boot.actuate.cassandra;
import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row; import com.datastax.driver.core.Row;
import com.datastax.driver.core.querybuilder.Select; import com.datastax.driver.core.Statement;
import org.junit.Test; import org.junit.Test;
import org.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.health.Health;
...@@ -51,8 +51,8 @@ public class CassandraHealthIndicatorTests { ...@@ -51,8 +51,8 @@ public class CassandraHealthIndicatorTests {
ResultSet resultSet = mock(ResultSet.class); ResultSet resultSet = mock(ResultSet.class);
CassandraHealthIndicator healthIndicator = new CassandraHealthIndicator(cassandraOperations); CassandraHealthIndicator healthIndicator = new CassandraHealthIndicator(cassandraOperations);
given(cassandraOperations.getCqlOperations()).willReturn(cqlOperations); given(cassandraOperations.getCqlOperations()).willReturn(cqlOperations);
given(cqlOperations.queryForResultSet(any(Select.class))).willReturn(resultSet); given(cqlOperations.queryForResultSet(any(Statement.class))).willReturn(resultSet);
given(resultSet.isExhausted()).willReturn(true); given(resultSet.isFullyFetched()).willReturn(true);
Health health = healthIndicator.health(); Health health = healthIndicator.health();
assertThat(health.getStatus()).isEqualTo(Status.UP); assertThat(health.getStatus()).isEqualTo(Status.UP);
} }
...@@ -65,8 +65,8 @@ public class CassandraHealthIndicatorTests { ...@@ -65,8 +65,8 @@ public class CassandraHealthIndicatorTests {
Row row = mock(Row.class); Row row = mock(Row.class);
CassandraHealthIndicator healthIndicator = new CassandraHealthIndicator(cassandraOperations); CassandraHealthIndicator healthIndicator = new CassandraHealthIndicator(cassandraOperations);
given(cassandraOperations.getCqlOperations()).willReturn(cqlOperations); given(cassandraOperations.getCqlOperations()).willReturn(cqlOperations);
given(cqlOperations.queryForResultSet(any(Select.class))).willReturn(resultSet); given(cqlOperations.queryForResultSet(any(Statement.class))).willReturn(resultSet);
given(resultSet.isExhausted()).willReturn(false); given(resultSet.isFullyFetched()).willReturn(false);
given(resultSet.one()).willReturn(row); given(resultSet.one()).willReturn(row);
String expectedVersion = "1.0.0"; String expectedVersion = "1.0.0";
given(row.getString(0)).willReturn(expectedVersion); given(row.getString(0)).willReturn(expectedVersion);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment