Search in sources :

Example 1 with KsqlQueryType

use of io.confluent.ksql.util.KsqlConstants.KsqlQueryType in project ksql by confluentinc.

the class TestKsqlRestApp method getQueries.

private Set<RunningQuery> getQueries(final KsqlRestClient client, final KsqlQueryType queryType) {
    final RestResponse<KsqlEntityList> response = makeKsqlRequest(client, "SHOW QUERIES;");
    if (response.isErroneous()) {
        throw new AssertionError("Failed to get persistent queries." + " msg:" + response.getErrorMessage());
    }
    final Queries queries = (Queries) response.getResponse().get(0);
    return queries.getQueries().stream().filter(query -> query.getQueryType() == queryType).collect(Collectors.toSet());
}
Also used : KsqlEntityList(io.confluent.ksql.rest.entity.KsqlEntityList) Arrays(java.util.Arrays) StreamsList(io.confluent.ksql.rest.entity.StreamsList) URL(java.net.URL) RunningQuery(io.confluent.ksql.rest.entity.RunningQuery) InternalKsqlClientFactory(io.confluent.ksql.rest.server.services.InternalKsqlClientFactory) BiFunction(java.util.function.BiFunction) ServiceContext(io.confluent.ksql.services.ServiceContext) KsqlQueryType(io.confluent.ksql.util.KsqlConstants.KsqlQueryType) RestResponse(io.confluent.ksql.rest.client.RestResponse) KsqlErrorMessage(io.confluent.ksql.rest.entity.KsqlErrorMessage) NetworkState(io.confluent.ksql.rest.server.NetworkDisruptorClient.NetworkState) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) QueryId(io.confluent.ksql.query.QueryId) URI(java.net.URI) ImmutableMap(com.google.common.collect.ImmutableMap) PropertiesUtil(io.confluent.ksql.properties.PropertiesUtil) Set(java.util.Set) ConsumerConfig(org.apache.kafka.clients.consumer.ConsumerConfig) KsqlConfig(io.confluent.ksql.util.KsqlConfig) Collectors(java.util.stream.Collectors) SimpleKsqlClient(io.confluent.ksql.services.SimpleKsqlClient) TestRestServiceContextFactory(io.confluent.ksql.rest.server.services.TestRestServiceContextFactory) DisabledKsqlClient(io.confluent.ksql.services.DisabledKsqlClient) CountDownLatch(java.util.concurrent.CountDownLatch) ConsistencyLevel(io.confluent.ksql.util.ClientConfig.ConsistencyLevel) List(java.util.List) ExternalResource(org.junit.rules.ExternalResource) VersionCheckerAgent(io.confluent.ksql.version.metrics.VersionCheckerAgent) KsqlExecutionContext(io.confluent.ksql.KsqlExecutionContext) Optional(java.util.Optional) Mockito.mock(org.mockito.Mockito.mock) Iterables(com.google.common.collect.Iterables) InternalSimpleKsqlClientFactory(io.confluent.ksql.rest.server.services.TestRestServiceContextFactory.InternalSimpleKsqlClientFactory) EmbeddedSingleNodeKafkaCluster(io.confluent.ksql.test.util.EmbeddedSingleNodeKafkaCluster) KsqlEntityList(io.confluent.ksql.rest.entity.KsqlEntityList) HashMap(java.util.HashMap) MetricCollectors(io.confluent.ksql.metrics.MetricCollectors) ReservedInternalTopics(io.confluent.ksql.util.ReservedInternalTopics) Supplier(java.util.function.Supplier) Stack(java.util.Stack) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) KsqlRestClient(io.confluent.ksql.rest.client.KsqlRestClient) TestDefaultKsqlClientFactory(io.confluent.ksql.rest.server.services.TestDefaultKsqlClientFactory) Objects.requireNonNull(java.util.Objects.requireNonNull) SourceDescriptionEntity(io.confluent.ksql.rest.entity.SourceDescriptionEntity) Queries(io.confluent.ksql.rest.entity.Queries) TablesList(io.confluent.ksql.rest.entity.TablesList) LinkedList(java.util.LinkedList) LinkedHashSet(java.util.LinkedHashSet) SocketAddress(io.vertx.core.net.SocketAddress) Iterator(java.util.Iterator) Vertx(io.vertx.core.Vertx) CommandStatusEntity(io.confluent.ksql.rest.entity.CommandStatusEntity) BasicCredentials(io.confluent.ksql.rest.client.BasicCredentials) SourceInfo(io.confluent.ksql.rest.entity.SourceInfo) ServiceContextFactory(io.confluent.ksql.services.ServiceContextFactory) Collections(java.util.Collections) Queries(io.confluent.ksql.rest.entity.Queries)

Aggregations

ImmutableMap (com.google.common.collect.ImmutableMap)1 Iterables (com.google.common.collect.Iterables)1 KsqlExecutionContext (io.confluent.ksql.KsqlExecutionContext)1 MetricCollectors (io.confluent.ksql.metrics.MetricCollectors)1 PropertiesUtil (io.confluent.ksql.properties.PropertiesUtil)1 QueryId (io.confluent.ksql.query.QueryId)1 BasicCredentials (io.confluent.ksql.rest.client.BasicCredentials)1 KsqlRestClient (io.confluent.ksql.rest.client.KsqlRestClient)1 RestResponse (io.confluent.ksql.rest.client.RestResponse)1 CommandStatusEntity (io.confluent.ksql.rest.entity.CommandStatusEntity)1 KsqlEntityList (io.confluent.ksql.rest.entity.KsqlEntityList)1 KsqlErrorMessage (io.confluent.ksql.rest.entity.KsqlErrorMessage)1 Queries (io.confluent.ksql.rest.entity.Queries)1 RunningQuery (io.confluent.ksql.rest.entity.RunningQuery)1 SourceDescriptionEntity (io.confluent.ksql.rest.entity.SourceDescriptionEntity)1 SourceInfo (io.confluent.ksql.rest.entity.SourceInfo)1 StreamsList (io.confluent.ksql.rest.entity.StreamsList)1 TablesList (io.confluent.ksql.rest.entity.TablesList)1 NetworkState (io.confluent.ksql.rest.server.NetworkDisruptorClient.NetworkState)1 InternalKsqlClientFactory (io.confluent.ksql.rest.server.services.InternalKsqlClientFactory)1