use of org.apache.hudi.helper.MockKafkaControlAgent in project hudi by apache.
the class TestConnectTransactionCoordinator method testSingleCommitScenario.
@ParameterizedTest
@EnumSource(value = MockParticipant.TestScenarios.class)
public void testSingleCommitScenario(MockParticipant.TestScenarios scenario) throws InterruptedException {
kafkaControlAgent = new MockKafkaControlAgent();
participant = new MockParticipant(kafkaControlAgent, latch, scenario, MAX_COMMIT_ROUNDS);
participant.start();
KafkaConnectConfigs.Builder configBuilder = KafkaConnectConfigs.newBuilder().withCommitIntervalSecs(1L).withCoordinatorWriteTimeoutSecs(1L);
if (scenario.equals(MockParticipant.TestScenarios.SUBSET_WRITE_STATUS_FAILED)) {
configBuilder.withAllowCommitOnErrors(false);
}
configs = configBuilder.build();
// Test the coordinator using the mock participant
TransactionCoordinator coordinator = new ConnectTransactionCoordinator(configs, new TopicPartition(TOPIC_NAME, 0), kafkaControlAgent, transactionServices, (bootstrapServers, topicName) -> TOTAL_KAFKA_PARTITIONS);
coordinator.start();
latch.await(TEST_TIMEOUT_SECS, TimeUnit.SECONDS);
if (latch.getCount() > 0) {
throw new HoodieException("Test timedout resulting in failure");
}
coordinator.stop();
participant.stop();
}
use of org.apache.hudi.helper.MockKafkaControlAgent in project hudi by apache.
the class TestConnectTransactionParticipant method setUp.
@BeforeEach
public void setUp() throws Exception {
partition = new TopicPartition(TOPIC_NAME, PARTITION_NUMBER);
kafkaControlAgent = new MockKafkaControlAgent();
mockKafkaConnect = new MockKafkaConnect(partition);
mockCoordinator = new MockCoordinator(kafkaControlAgent);
mockCoordinator.start();
configs = KafkaConnectConfigs.newBuilder().build();
initializeParticipant();
}
Aggregations