use of io.confluent.ksql.function.InternalFunctionRegistry in project ksql by confluentinc.
the class SecureIntegrationTest method givenTestSetupWithConfig.
private void givenTestSetupWithConfig(final Map<String, Object> ksqlConfigs) {
ksqlConfig = new KsqlConfig(ksqlConfigs);
serviceContext = ServiceContextFactory.create(ksqlConfig, DisabledKsqlClient::instance);
ksqlEngine = new KsqlEngine(serviceContext, ProcessingLogContext.create(), new InternalFunctionRegistry(), ServiceInfo.create(ksqlConfig), new SequentialQueryIdGenerator(), ksqlConfig, Collections.emptyList(), new MetricCollectors());
execInitCreateStreamQueries();
}
use of io.confluent.ksql.function.InternalFunctionRegistry in project ksql by confluentinc.
the class PhysicalPlanBuilderTest method before.
@Before
public void before() {
ksqlConfig = INITIAL_CONFIG;
serviceContext = TestServiceContext.create(kafkaTopicClient);
engineMetastore = new MetaStoreImpl(new InternalFunctionRegistry());
ksqlEngine = KsqlEngineTestUtil.createKsqlEngine(serviceContext, engineMetastore, new MetricCollectors());
}
use of io.confluent.ksql.function.InternalFunctionRegistry in project ksql by confluentinc.
the class KsqlResourceTest method setUp.
@Before
public void setUp() throws IOException, RestClientException {
commandStatus = new QueuedCommandStatus(0, new CommandStatusFuture(new CommandId(TOPIC, "whateva", CREATE)));
commandStatus1 = new QueuedCommandStatus(1, new CommandStatusFuture(new CommandId(TABLE, "something", DROP)));
final QueuedCommandStatus commandStatus2 = new QueuedCommandStatus(2, new CommandStatusFuture(new CommandId(STREAM, "something", EXECUTE)));
kafkaTopicClient = new FakeKafkaTopicClient();
kafkaConsumerGroupClient = new FakeKafkaConsumerGroupClient();
serviceContext = TestServiceContext.create(kafkaTopicClient, kafkaConsumerGroupClient);
schemaRegistryClient = serviceContext.getSchemaRegistryClient();
registerValueSchema(schemaRegistryClient);
ksqlRestConfig = new KsqlRestConfig(getDefaultKsqlConfig());
ksqlConfig = new KsqlConfig(ksqlRestConfig.getKsqlConfigProperties());
final KsqlExecutionContext.ExecuteResult result = mock(KsqlExecutionContext.ExecuteResult.class);
when(sandbox.execute(any(), any(ConfiguredKsqlPlan.class))).thenReturn(result);
when(result.getQuery()).thenReturn(Optional.empty());
MutableFunctionRegistry fnRegistry = new InternalFunctionRegistry();
final Metrics metrics = new Metrics();
UserFunctionLoader.newInstance(ksqlConfig, fnRegistry, ".", metrics).load();
metaStore = new MetaStoreImpl(fnRegistry);
final MetricCollectors metricCollectors = new MetricCollectors(metrics);
realEngine = KsqlEngineTestUtil.createKsqlEngine(serviceContext, metaStore, (engine) -> new KsqlEngineMetrics("", engine, Collections.emptyMap(), Optional.empty(), metricCollectors), new SequentialQueryIdGenerator(), ksqlConfig, metricCollectors);
securityContext = new KsqlSecurityContext(Optional.empty(), serviceContext);
when(commandRunner.getCommandQueue()).thenReturn(commandStore);
when(commandRunnerWarning.get()).thenReturn("");
when(commandStore.createTransactionalProducer()).thenReturn(transactionalProducer);
ksqlEngine = realEngine;
when(sandbox.getMetaStore()).thenAnswer(inv -> metaStore.copy());
addTestTopicAndSources();
when(commandStore.enqueueCommand(any(), any(), any(Producer.class))).thenReturn(commandStatus).thenReturn(commandStatus1).thenReturn(commandStatus2);
streamName = KsqlIdentifierTestUtil.uniqueIdentifierName();
when(schemaInjectorFactory.apply(any())).thenReturn(sandboxSchemaInjector);
when(schemaInjectorFactory.apply(serviceContext)).thenReturn(schemaInjector);
when(topicInjectorFactory.apply(any())).thenReturn(sandboxTopicInjector);
when(topicInjectorFactory.apply(ksqlEngine)).thenReturn(topicInjector);
when(sandboxSchemaInjector.inject(any())).thenAnswer(inv -> inv.getArgument(0));
when(schemaInjector.inject(any())).thenAnswer(inv -> inv.getArgument(0));
when(sandboxTopicInjector.inject(any())).thenAnswer(inv -> inv.getArgument(0));
when(topicInjector.inject(any())).thenAnswer(inv -> inv.getArgument(0));
when(errorsHandler.generateResponse(any(), any())).thenAnswer(new Answer<EndpointResponse>() {
@Override
public EndpointResponse answer(final InvocationOnMock invocation) throws Throwable {
final Object[] args = invocation.getArguments();
return (EndpointResponse) args[1];
}
});
setUpKsqlResource();
}
use of io.confluent.ksql.function.InternalFunctionRegistry in project ksql by confluentinc.
the class RequestHandlerTest method setUp.
@Before
public void setUp() {
metaStore = new MetaStoreImpl(new InternalFunctionRegistry());
when(ksqlEngine.prepare(any(), any())).thenAnswer(invocation -> KSQL_PARSER.prepare(invocation.getArgument(0), metaStore));
when(distributor.execute(any(), any(), any())).thenReturn(response);
when(response.getEntity()).thenReturn(Optional.of(entity));
when(sessionProperties.getMutableScopedProperties()).thenReturn(ImmutableMap.of());
when(ksqlEngine.getKsqlConfig()).thenReturn(ksqlConfig);
doNothing().when(sync).waitFor(any(), any());
securityContext = new KsqlSecurityContext(Optional.empty(), serviceContext);
}
use of io.confluent.ksql.function.InternalFunctionRegistry in project ksql by confluentinc.
the class KsqlAuthorizationValidatorImplTest method setUp.
@Before
public void setUp() {
metaStore = new MetaStoreImpl(new InternalFunctionRegistry());
ksqlEngine = KsqlEngineTestUtil.createKsqlEngine(serviceContext, metaStore, new MetricCollectors());
authorizationValidator = new KsqlAuthorizationValidatorImpl(accessValidator);
securityContext = new KsqlSecurityContext(Optional.empty(), serviceContext);
givenStreamWithTopic(KAFKA_STREAM_TOPIC, KAFKA_KSQL_TOPIC);
givenStreamWithTopic(AVRO_STREAM_TOPIC, AVRO_KSQL_TOPIC);
}
Aggregations