use of io.confluent.ksql.api.client.ServerInfo in project ksql by confluentinc.
the class ClientIntegrationTest method shouldExecutePlainHttpRequests.
@Test
public void shouldExecutePlainHttpRequests() throws Exception {
final HttpResponse response = client.buildRequest("GET", "/info").send().get();
assertThat(response.status(), is(200));
final Map<String, Map<String, Object>> info = response.bodyAsMap();
final ServerInfo serverInfo = client.serverInfo().get();
final Map<String, Object> innerMap = info.get("KsqlServerInfo");
assertThat(innerMap.get("version"), is(serverInfo.getServerVersion()));
assertThat(innerMap.get("ksqlServiceId"), is(serverInfo.getKsqlServiceId()));
assertThat(innerMap.get("kafkaClusterId"), is(serverInfo.getKafkaClusterId()));
assertThat(innerMap.get("serverStatus"), is("RUNNING"));
}
use of io.confluent.ksql.api.client.ServerInfo in project ksql by confluentinc.
the class MetadataUtil method serverSupportsMultiKeyPullQuery.
private static boolean serverSupportsMultiKeyPullQuery(final Client ksqlClient, final MigrationConfig config) {
final String ksqlServerUrl = config.getString(MigrationConfig.KSQL_SERVER_URL);
final ServerInfo serverInfo = getServerInfo(ksqlClient, ksqlServerUrl);
return versionSupportsMultiKeyPullQuery(serverInfo.getServerVersion());
}
use of io.confluent.ksql.api.client.ServerInfo in project ksql by confluentinc.
the class ClientImpl method serverInfo.
@Override
public CompletableFuture<ServerInfo> serverInfo() {
final CompletableFuture<ServerInfo> cf = new CompletableFuture<>();
makeGetRequest(INFO_ENDPOINT, new JsonObject(), cf, response -> handleObjectResponse(response, cf, AdminResponseHandlers::handleServerInfoResponse));
return cf;
}
use of io.confluent.ksql.api.client.ServerInfo in project ksql by confluentinc.
the class ClientIntegrationTest method shouldGetServerInfo.
@Test
public void shouldGetServerInfo() throws Exception {
// Given:
final String expectedClusterId = REST_APP.getServiceContext().getAdminClient().describeCluster().clusterId().get();
// When:
final ServerInfo serverInfo = client.serverInfo().get();
// Then:
assertThat(serverInfo.getServerVersion(), is(AppInfo.getVersion()));
assertThat(serverInfo.getKsqlServiceId(), is("default_"));
assertThat(serverInfo.getKafkaClusterId(), is(expectedClusterId));
}
use of io.confluent.ksql.api.client.ServerInfo in project ksql by confluentinc.
the class ServerVersionUtil method serverVersionCompatible.
public static boolean serverVersionCompatible(final Client ksqlClient, final MigrationConfig config) {
final String ksqlServerUrl = config.getString(MigrationConfig.KSQL_SERVER_URL);
final ServerInfo serverInfo;
try {
serverInfo = getServerInfo(ksqlClient, ksqlServerUrl);
} catch (MigrationException e) {
LOGGER.error("Failed to get server info to verify version compatibility: {}", e.getMessage());
return false;
}
final String serverVersion = serverInfo.getServerVersion();
try {
return isSupportedVersion(serverVersion);
} catch (MigrationException e) {
LOGGER.warn(e.getMessage() + ". Proceeding anyway.");
return true;
}
}
Aggregations