Search in sources :

Example 1 with KafkaConfigStore

use of io.confluent.ksql.rest.server.computation.KafkaConfigStore in project ksql by confluentinc.

the class StandaloneExecutorFunctionalTest method setUp.

@SuppressWarnings("unchecked")
@Before
public void setUp() throws Exception {
    queryFile = TMP.newFile().toPath();
    final Map<String, Object> properties = ImmutableMap.<String, Object>builder().putAll(KsqlConfigTestUtil.baseTestConfig()).put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, TEST_HARNESS.kafkaBootstrapServers()).put(KsqlConfig.SCHEMA_REGISTRY_URL_PROPERTY, "http://foo:8080").build();
    final Function<KsqlConfig, ServiceContext> serviceContextFactory = config -> TestServiceContext.create(new KsqlConfig(properties), TEST_HARNESS.getServiceContext().getSchemaRegistryClientFactory());
    standalone = StandaloneExecutorFactory.create((Map) properties, queryFile.toString(), ".", serviceContextFactory, KafkaConfigStore::new, activeQuerySupplier -> versionChecker, StandaloneExecutor::new, new MetricCollectors());
    s1 = KsqlIdentifierTestUtil.uniqueIdentifierName("S1");
    s2 = KsqlIdentifierTestUtil.uniqueIdentifierName("S2");
    t1 = KsqlIdentifierTestUtil.uniqueIdentifierName("T1");
}
Also used : PhysicalSchema(io.confluent.ksql.schema.ksql.PhysicalSchema) MethodSorters(org.junit.runners.MethodSorters) BeforeClass(org.junit.BeforeClass) ColumnName(io.confluent.ksql.name.ColumnName) JSON(io.confluent.ksql.serde.FormatFactory.JSON) Mock(org.mockito.Mock) Assert.assertThrows(org.junit.Assert.assertThrows) ServiceContext(io.confluent.ksql.services.ServiceContext) RunWith(org.junit.runner.RunWith) KsqlIdentifierTestUtil(io.confluent.ksql.test.util.KsqlIdentifierTestUtil) MetricCollectors(io.confluent.ksql.metrics.MetricCollectors) AVRO(io.confluent.ksql.serde.FormatFactory.AVRO) Function(java.util.function.Function) KafkaConfigStore(io.confluent.ksql.rest.server.computation.KafkaConfigStore) Map(java.util.Map) After(org.junit.After) KsqlTestFolder(io.confluent.ksql.test.util.KsqlTestFolder) OrderDataProvider(io.confluent.ksql.util.OrderDataProvider) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) SerdeFeatures(io.confluent.ksql.serde.SerdeFeatures) ClassRule(org.junit.ClassRule) Path(java.nio.file.Path) Before(org.junit.Before) CommonClientConfigs(org.apache.kafka.clients.CommonClientConfigs) SystemColumns(io.confluent.ksql.schema.ksql.SystemColumns) ImmutableMap(com.google.common.collect.ImmutableMap) Files(java.nio.file.Files) IntegrationTest(io.confluent.common.utils.IntegrationTest) KAFKA(io.confluent.ksql.serde.FormatFactory.KAFKA) IOException(java.io.IOException) Test(org.junit.Test) KsqlConfig(io.confluent.ksql.util.KsqlConfig) Category(org.junit.experimental.categories.Category) IntegrationTestHarness(io.confluent.ksql.integration.IntegrationTestHarness) LogicalSchema(io.confluent.ksql.schema.ksql.LogicalSchema) StandardCharsets(java.nio.charset.StandardCharsets) TestServiceContext(io.confluent.ksql.services.TestServiceContext) KsqlConfigTestUtil(io.confluent.ksql.KsqlConfigTestUtil) VersionCheckerAgent(io.confluent.ksql.version.metrics.VersionCheckerAgent) KsqlException(io.confluent.ksql.util.KsqlException) FixMethodOrder(org.junit.FixMethodOrder) Matchers.containsString(org.hamcrest.Matchers.containsString) SqlTypes(io.confluent.ksql.schema.ksql.types.SqlTypes) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) TemporaryFolder(org.junit.rules.TemporaryFolder) ServiceContext(io.confluent.ksql.services.ServiceContext) TestServiceContext(io.confluent.ksql.services.TestServiceContext) MetricCollectors(io.confluent.ksql.metrics.MetricCollectors) KsqlConfig(io.confluent.ksql.util.KsqlConfig) Matchers.containsString(org.hamcrest.Matchers.containsString) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap) Before(org.junit.Before)

Example 2 with KafkaConfigStore

use of io.confluent.ksql.rest.server.computation.KafkaConfigStore in project ksql by confluentinc.

the class StandaloneExecutorFactory method create.

public static StandaloneExecutor create(final Map<String, String> properties, final String queriesFile, final String installDir, final MetricCollectors metricCollectors) {
    final KsqlConfig tempConfig = new KsqlConfig(properties);
    final Function<KsqlConfig, ServiceContext> serviceContextFactory = config -> ServiceContextFactory.create(config, DisabledKsqlClient::instance);
    final ServiceContext tempServiceContext = serviceContextFactory.apply(tempConfig);
    final String kafkaClusterId = KafkaClusterUtil.getKafkaClusterId(tempServiceContext);
    final String ksqlServerId = tempConfig.getString(KsqlConfig.KSQL_SERVICE_ID_CONFIG);
    final Map<String, Object> updatedProperties = tempConfig.originals();
    updatedProperties.putAll(metricCollectors.addConfluentMetricsContextConfigs(ksqlServerId, kafkaClusterId));
    return create(updatedProperties, queriesFile, installDir, serviceContextFactory, KafkaConfigStore::new, KsqlVersionCheckerAgent::new, StandaloneExecutor::new, metricCollectors);
}
Also used : InternalFunctionRegistry(io.confluent.ksql.function.InternalFunctionRegistry) SequentialQueryIdGenerator(io.confluent.ksql.query.id.SequentialQueryIdGenerator) BiFunction(java.util.function.BiFunction) ServiceContext(io.confluent.ksql.services.ServiceContext) ProcessingLogContext(io.confluent.ksql.logging.processing.ProcessingLogContext) MetricCollectors(io.confluent.ksql.metrics.MetricCollectors) ReservedInternalTopics(io.confluent.ksql.util.ReservedInternalTopics) Function(java.util.function.Function) Supplier(java.util.function.Supplier) KafkaConfigStore(io.confluent.ksql.rest.server.computation.KafkaConfigStore) Injector(io.confluent.ksql.statement.Injector) Map(java.util.Map) UserFunctionLoader(io.confluent.ksql.function.UserFunctionLoader) KafkaClusterUtil(io.confluent.ksql.services.KafkaClusterUtil) KsqlVersionCheckerAgent(io.confluent.ksql.version.metrics.KsqlVersionCheckerAgent) KsqlEngine(io.confluent.ksql.engine.KsqlEngine) MutableFunctionRegistry(io.confluent.ksql.function.MutableFunctionRegistry) KsqlInternalTopicUtils(io.confluent.ksql.rest.util.KsqlInternalTopicUtils) ServiceInfo(io.confluent.ksql.ServiceInfo) KsqlConfig(io.confluent.ksql.util.KsqlConfig) ServiceContextFactory(io.confluent.ksql.services.ServiceContextFactory) DisabledKsqlClient(io.confluent.ksql.services.DisabledKsqlClient) VersionCheckerAgent(io.confluent.ksql.version.metrics.VersionCheckerAgent) KsqlExecutionContext(io.confluent.ksql.KsqlExecutionContext) VisibleForTesting(com.google.common.annotations.VisibleForTesting) ConfigStore(io.confluent.ksql.rest.server.computation.ConfigStore) Collections(java.util.Collections) ProcessingLogConfig(io.confluent.ksql.logging.processing.ProcessingLogConfig) Injectors(io.confluent.ksql.statement.Injectors) DisabledKsqlClient(io.confluent.ksql.services.DisabledKsqlClient) KafkaConfigStore(io.confluent.ksql.rest.server.computation.KafkaConfigStore) ServiceContext(io.confluent.ksql.services.ServiceContext) KsqlConfig(io.confluent.ksql.util.KsqlConfig) KsqlVersionCheckerAgent(io.confluent.ksql.version.metrics.KsqlVersionCheckerAgent)

Aggregations

MetricCollectors (io.confluent.ksql.metrics.MetricCollectors)2 KafkaConfigStore (io.confluent.ksql.rest.server.computation.KafkaConfigStore)2 ServiceContext (io.confluent.ksql.services.ServiceContext)2 KsqlConfig (io.confluent.ksql.util.KsqlConfig)2 VersionCheckerAgent (io.confluent.ksql.version.metrics.VersionCheckerAgent)2 Map (java.util.Map)2 Function (java.util.function.Function)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 IntegrationTest (io.confluent.common.utils.IntegrationTest)1 KsqlConfigTestUtil (io.confluent.ksql.KsqlConfigTestUtil)1 KsqlExecutionContext (io.confluent.ksql.KsqlExecutionContext)1 ServiceInfo (io.confluent.ksql.ServiceInfo)1 KsqlEngine (io.confluent.ksql.engine.KsqlEngine)1 InternalFunctionRegistry (io.confluent.ksql.function.InternalFunctionRegistry)1 MutableFunctionRegistry (io.confluent.ksql.function.MutableFunctionRegistry)1 UserFunctionLoader (io.confluent.ksql.function.UserFunctionLoader)1 IntegrationTestHarness (io.confluent.ksql.integration.IntegrationTestHarness)1 ProcessingLogConfig (io.confluent.ksql.logging.processing.ProcessingLogConfig)1 ProcessingLogContext (io.confluent.ksql.logging.processing.ProcessingLogContext)1