use of io.confluent.ksql.util.PersistentQueryMetadata in project ksql by confluentinc.
the class StandaloneExecutor method executeStatements.
private void executeStatements(final String queries) throws Exception {
final List<QueryMetadata> queryMetadataList = ksqlEngine.createQueries(queries);
for (QueryMetadata queryMetadata : queryMetadataList) {
if (queryMetadata instanceof PersistentQueryMetadata) {
PersistentQueryMetadata persistentQueryMetadata = (PersistentQueryMetadata) queryMetadata;
persistentQueryMetadata.start();
} else {
final String message = String.format("Ignoring statements: %s" + "%nOnly CREATE statements can run in standalone mode.", queryMetadata.getStatementString());
System.err.println(message);
log.warn(message);
}
}
}
use of io.confluent.ksql.util.PersistentQueryMetadata in project ksql by confluentinc.
the class StandaloneExecutorTest method shouldExecutePersistentQueries.
@Test
public void shouldExecutePersistentQueries() throws Exception {
final PersistentQueryMetadata query = EasyMock.niceMock(PersistentQueryMetadata.class);
EasyMock.expect(engine.createQueries(anyString())).andReturn(Collections.singletonList(query));
query.start();
EasyMock.expectLastCall();
EasyMock.replay(query, engine);
executor.start();
EasyMock.verify(query);
}
Aggregations