use of io.confluent.ksql.rest.entity.KsqlEntityList in project ksql by confluentinc.
the class KsqlResourceTest method shouldFailCreateTableWithInferenceWithIncorrectKey.
@Test
public void shouldFailCreateTableWithInferenceWithIncorrectKey() throws Exception {
KsqlResource testResource = TestKsqlResourceUtil.get(ksqlEngine, ksqlRestConfig);
final String ksqlString = "CREATE TABLE orders WITH (KAFKA_TOPIC='orders-topic', " + "VALUE_FORMAT = 'avro', KEY = 'orderid1');";
Response response = testResource.handleKsqlStatements(new KsqlRequest(ksqlString, new HashMap<>()));
KsqlEntityList result = (KsqlEntityList) response.getEntity();
assertThat("Incorrect response.", result.size(), equalTo(1));
assertThat(result.get(0), instanceOf(ErrorMessageEntity.class));
}
use of io.confluent.ksql.rest.entity.KsqlEntityList in project ksql by confluentinc.
the class KsqlResourceTest method shouldCreateTableWithInference.
@Test
public void shouldCreateTableWithInference() throws Exception {
KsqlResource testResource = TestKsqlResourceUtil.get(ksqlEngine, ksqlRestConfig);
final String ksqlString = "CREATE TABLE orders WITH (KAFKA_TOPIC='orders-topic', " + "VALUE_FORMAT = 'avro', KEY = 'orderid');";
Response response = testResource.handleKsqlStatements(new KsqlRequest(ksqlString, new HashMap<>()));
KsqlEntityList result = (KsqlEntityList) response.getEntity();
assertThat("Incorrect response.", result.size(), equalTo(1));
assertTrue(result.get(0) instanceof CommandStatusEntity);
CommandStatusEntity commandStatusEntity = (CommandStatusEntity) result.get(0);
assertTrue(commandStatusEntity.getCommandId().getType().name().equalsIgnoreCase("TABLE"));
}
use of io.confluent.ksql.rest.entity.KsqlEntityList in project ksql by confluentinc.
the class KsqlRestClientTest method testKsqlResource.
@Test
public void testKsqlResource() {
RestResponse<KsqlEntityList> results = ksqlRestClient.makeKsqlRequest("Test request");
Assert.assertNotNull(results);
Assert.assertTrue(results.isSuccessful());
KsqlEntityList ksqlEntityList = results.getResponse();
Assert.assertTrue(ksqlEntityList.size() == 1);
Assert.assertTrue(ksqlEntityList.get(0) instanceof ExecutionPlan);
}
Aggregations