use of io.confluent.ksql.api.client.Client.HttpResponse in project ksql by confluentinc.
the class ClientTest method setSessionVariablesWithHttpRequest.
@Test
public void setSessionVariablesWithHttpRequest() throws Exception {
javaClient.define("some-var", "var-value");
HttpResponse response = javaClient.buildRequest("POST", "/ksql").payload("ksql", "CREATE STREAM FOO AS CONCAT(A, `wow;`) FROM `BAR`;").propertiesKey("streamsProperties").property("auto.offset.reset", "earliest").send().get();
assertThat(response.status(), is(200));
assertThat(testEndpoints.getLastSessionVariables(), is(new JsonObject().put("some-var", "var-value")));
assertThat(testEndpoints.getLastProperties(), is(new JsonObject().put("auto.offset.reset", "earliest")));
}
use of io.confluent.ksql.api.client.Client.HttpResponse in project ksql by confluentinc.
the class ClientTest method clientShouldMakeHttpRequests.
@Test
public void clientShouldMakeHttpRequests() throws Exception {
HttpResponse response = javaClient.buildRequest("GET", "/info").send().get();
assertThat(response.status(), is(200));
Map<String, Map<String, Object>> info = response.bodyAsMap();
Map<String, Object> serverInfo = info.get("KsqlServerInfo");
assertThat(serverInfo.get("version"), is(AppInfo.getVersion()));
assertThat(serverInfo.get("ksqlServiceId"), is("ksql-service-id"));
assertThat(serverInfo.get("kafkaClusterId"), is("kafka-cluster-id"));
}
use of io.confluent.ksql.api.client.Client.HttpResponse 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.Client.HttpResponse in project ksql by confluentinc.
the class ClientTest method clientShouldReturn404Responses.
@Test
public void clientShouldReturn404Responses() throws Exception {
HttpResponse response = javaClient.buildRequest("GET", "/abc").send().get();
assertThat(response.status(), is(404));
}
Aggregations