use of io.confluent.ksql.rest.entity.CommandStatus.Status in project ksql by confluentinc.
the class DistributingExecutorTest method setUp.
@Before
public void setUp() throws InterruptedException {
scnCounter = new AtomicLong();
when(schemaInjector.inject(any())).thenAnswer(inv -> inv.getArgument(0));
when(topicInjector.inject(any())).thenAnswer(inv -> inv.getArgument(0));
when(queue.enqueueCommand(any(), any(), any())).thenReturn(status);
when(status.tryWaitForFinalStatus(any())).thenReturn(SUCCESS_STATUS);
when(status.getCommandId()).thenReturn(CS_COMMAND);
when(status.getCommandSequenceNumber()).thenAnswer(inv -> scnCounter.incrementAndGet());
when(executionContext.getMetaStore()).thenReturn(metaStore);
when(executionContext.createSandbox(any())).thenReturn(sandboxContext);
when(commandRunnerWarning.get()).thenReturn("");
serviceContext = SandboxedServiceContext.create(TestServiceContext.create());
when(executionContext.getServiceContext()).thenReturn(serviceContext);
when(validatedCommandFactory.create(any(), any())).thenReturn(command);
when(queue.createTransactionalProducer()).thenReturn(transactionalProducer);
securityContext = new KsqlSecurityContext(Optional.empty(), serviceContext);
distributor = new DistributingExecutor(KSQL_CONFIG, queue, DURATION_10_MS, (ec, sc) -> InjectorChain.of(schemaInjector, topicInjector), Optional.of(authorizationValidator), validatedCommandFactory, errorHandler, commandRunnerWarning);
}
Aggregations