Replace getHostName with getHostString

This commit is contained in:
nivy 2026-07-21 16:46:46 -07:00
parent 57dabaea8c
commit 43df1a2e15
4 changed files with 5 additions and 4 deletions

View File

@ -88,7 +88,7 @@ final class ClientsTable extends AbstractVirtualTable
InetSocketAddress remoteAddress = client.remoteAddress();
result.row(remoteAddress.getAddress(), remoteAddress.getPort())
.column(HOSTNAME, remoteAddress.getHostName())
.column(HOSTNAME, remoteAddress.getHostString())
.column(USERNAME, client.username().orElse(null))
.column(CONNECTION_STAGE, toLowerCaseLocalized(client.stage().toString()))
.column(PROTOCOL_VERSION, client.protocolVersion())

View File

@ -98,7 +98,7 @@ final class GossipInfoTable extends AbstractVirtualTable
EndpointState localState = new EndpointState(entry.getValue());
SimpleDataSet dataSet = result.row(endpoint.getAddress(), endpoint.getPort())
.column(HOSTNAME, endpoint.getHostName())
.column(HOSTNAME, endpoint.getHostString())
.column(GENERATION, getGeneration(localState))
.column(HEARTBEAT, getHeartBeat(localState));

View File

@ -70,6 +70,7 @@ public class ClientsTableTest extends CQLTester
shouldUseEncryption(true);
shouldUseClientCertificate(true);
ResultSet result = executeNet("SELECT * FROM vts.clients");
assertThat(result.getColumnDefinitions().size()).isEqualTo(16);
for (Row r : result)
{
Assert.assertEquals(InetAddress.getLoopbackAddress(), r.getInet("address"));
@ -78,7 +79,7 @@ public class ClientsTableTest extends CQLTester
Assert.assertNotNull(r.getMap("client_options", String.class, String.class));
Assert.assertTrue(r.getLong("request_count") > 0 );
// the following are questionable if they belong here
Assert.assertEquals("localhost", r.getString("hostname"));
Assert.assertEquals(r.getInet("address").getHostAddress(), r.getString("hostname"));
Assertions.assertThat(r.getMap("client_options", String.class, String.class))
.hasEntrySatisfying("DRIVER_VERSION", value -> assertThat(value.contains(r.getString("driver_name"))))
.hasEntrySatisfying("DRIVER_VERSION", value -> assertThat(value.contains(r.getString("driver_version"))));

View File

@ -76,7 +76,7 @@ public class GossipInfoTableTest extends CQLTester
assertThat(localState).isNotNull();
assertThat(row.getInetAddress("address")).isEqualTo(endpoint.getAddress());
assertThat(row.getInt("port")).isEqualTo(endpoint.getPort());
assertThat(row.getString("hostname")).isEqualTo(endpoint.getHostName());
assertThat(row.getString("hostname")).isEqualTo(endpoint.getAddress().getHostAddress());
assertThat(row.getInt("generation")).isEqualTo(localState.getHeartBeatState().getGeneration());
assertThat(row.getInt("heartbeat")).isNotNull();