Search in sources :

Example 6 with CommandStatusEntity

use of io.confluent.ksql.rest.entity.CommandStatusEntity 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"));
}
Also used : Response(javax.ws.rs.core.Response) KsqlEntityList(io.confluent.ksql.rest.entity.KsqlEntityList) KsqlRequest(io.confluent.ksql.rest.entity.KsqlRequest) HashMap(java.util.HashMap) CommandStatusEntity(io.confluent.ksql.rest.entity.CommandStatusEntity) Test(org.junit.Test)

Aggregations

CommandStatusEntity (io.confluent.ksql.rest.entity.CommandStatusEntity)6 KsqlEntityList (io.confluent.ksql.rest.entity.KsqlEntityList)4 CommandStatus (io.confluent.ksql.rest.entity.CommandStatus)3 ErrorMessageEntity (io.confluent.ksql.rest.entity.ErrorMessageEntity)3 KsqlEntity (io.confluent.ksql.rest.entity.KsqlEntity)3 HashMap (java.util.HashMap)3 Test (org.junit.Test)3 ExecutionPlan (io.confluent.ksql.rest.entity.ExecutionPlan)2 KafkaTopicInfo (io.confluent.ksql.rest.entity.KafkaTopicInfo)2 KafkaTopicsList (io.confluent.ksql.rest.entity.KafkaTopicsList)2 KsqlTopicInfo (io.confluent.ksql.rest.entity.KsqlTopicInfo)2 KsqlTopicsList (io.confluent.ksql.rest.entity.KsqlTopicsList)2 PropertiesList (io.confluent.ksql.rest.entity.PropertiesList)2 Queries (io.confluent.ksql.rest.entity.Queries)2 SourceDescription (io.confluent.ksql.rest.entity.SourceDescription)2 StreamsList (io.confluent.ksql.rest.entity.StreamsList)2 TablesList (io.confluent.ksql.rest.entity.TablesList)2 TopicDescription (io.confluent.ksql.rest.entity.TopicDescription)2 CommandId (io.confluent.ksql.rest.server.computation.CommandId)2 ArrayList (java.util.ArrayList)2