Search in sources :

Example 1 with UserDataProvider

use of io.confluent.ksql.util.UserDataProvider in project ksql by confluentinc.

the class EndToEndIntegrationTest method before.

@Before
public void before() throws Exception {
    testHarness = new IntegrationTestHarness();
    testHarness.start();
    Map<String, Object> streamsConfig = testHarness.ksqlConfig.getKsqlStreamConfigProps();
    streamsConfig.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
    KsqlConfig ksqlconfig = new KsqlConfig(streamsConfig);
    AdminClient adminClient = AdminClient.create(ksqlconfig.getKsqlAdminClientConfigProps());
    KafkaTopicClient topicClient = new KafkaTopicClientImpl(adminClient);
    ksqlEngine = new KsqlEngine(ksqlconfig, topicClient);
    testHarness.createTopic(pageViewTopic);
    testHarness.createTopic(usersTopic);
    pageViewDataProvider = new PageViewDataProvider();
    testHarness.publishTestData(usersTopic, new UserDataProvider(), System.currentTimeMillis() - 10000);
    testHarness.publishTestData(pageViewTopic, pageViewDataProvider, System.currentTimeMillis());
    ksqlEngine.buildMultipleQueries(format("CREATE TABLE %s (registertime bigint, gender varchar, regionid varchar, " + "userid varchar) WITH (kafka_topic='%s', value_format='JSON', key = 'userid');", userTable, usersTopic), Collections.emptyMap());
    ksqlEngine.buildMultipleQueries(format("CREATE STREAM %s (viewtime bigint, userid varchar, pageid varchar) " + "WITH (kafka_topic='%s', value_format='JSON');", pageViewStream, pageViewTopic), Collections.emptyMap());
}
Also used : KsqlEngine(io.confluent.ksql.KsqlEngine) UserDataProvider(io.confluent.ksql.util.UserDataProvider) KafkaTopicClient(io.confluent.ksql.util.KafkaTopicClient) PageViewDataProvider(io.confluent.ksql.util.PageViewDataProvider) KsqlConfig(io.confluent.ksql.util.KsqlConfig) KafkaTopicClientImpl(io.confluent.ksql.util.KafkaTopicClientImpl) AdminClient(org.apache.kafka.clients.admin.AdminClient) Before(org.junit.Before)

Aggregations

KsqlEngine (io.confluent.ksql.KsqlEngine)1 KafkaTopicClient (io.confluent.ksql.util.KafkaTopicClient)1 KafkaTopicClientImpl (io.confluent.ksql.util.KafkaTopicClientImpl)1 KsqlConfig (io.confluent.ksql.util.KsqlConfig)1 PageViewDataProvider (io.confluent.ksql.util.PageViewDataProvider)1 UserDataProvider (io.confluent.ksql.util.UserDataProvider)1 AdminClient (org.apache.kafka.clients.admin.AdminClient)1 Before (org.junit.Before)1