use of com.bakdata.quick.common.config.TopicRegistryConfig in project quick by bakdata.
the class TopicRegistryInitializerTest method shouldNotFailIfTopicExists.
@Test
void shouldNotFailIfTopicExists() {
final String topicName = UUID.randomUUID().toString();
kafkaCluster.createTopic(TopicConfig.forTopic(topicName).useDefaults());
this.successfulMock();
final KafkaConfig kafkaConfig = new KafkaConfig(kafkaCluster.getBrokerList(), this.schemaRegistry.getUrl());
final TopicRegistryConfig registryConfig = new TopicRegistryConfig(topicName, TEST_NAME, 3, (short) 1);
final TopicRegistryInitializer topicRegistryInitializer = new TopicRegistryInitializer(kafkaConfig, registryConfig, this.mock);
assertThatCode(() -> {
topicRegistryInitializer.onStartUp(new StartupEvent(this.applicationContext));
}).doesNotThrowAnyException();
}
use of com.bakdata.quick.common.config.TopicRegistryConfig in project quick by bakdata.
the class TopicRegistryInitializerTest method shouldCreateMirror.
@Test
void shouldCreateMirror() {
final String topicName = UUID.randomUUID().toString();
this.successfulMock();
final KafkaConfig kafkaConfig = new KafkaConfig(kafkaCluster.getBrokerList(), this.schemaRegistry.getUrl());
final TopicRegistryConfig registryConfig = new TopicRegistryConfig(topicName, TEST_NAME, 3, (short) 1);
final TopicRegistryInitializer topicRegistryInitializer = new TopicRegistryInitializer(kafkaConfig, registryConfig, this.mock);
topicRegistryInitializer.onStartUp(new StartupEvent(this.applicationContext));
final MirrorCreationData mirrorCreationData = new MirrorCreationData(TEST_NAME, topicName, 1, null, null);
verify(this.mock).createInternalMirror(mirrorCreationData);
}
use of com.bakdata.quick.common.config.TopicRegistryConfig in project quick by bakdata.
the class TopicRegistryInitializerTest method shouldFailIfSchemaRegistryIsNotAvailable.
@Test
void shouldFailIfSchemaRegistryIsNotAvailable() {
final String topicName = UUID.randomUUID().toString();
this.successfulMock();
final KafkaConfig kafkaConfig = new KafkaConfig(kafkaCluster.getBrokerList(), "http://nope:9092");
final TopicRegistryConfig registryConfig = new TopicRegistryConfig(topicName, TEST_NAME, 3, (short) 1);
final TopicRegistryInitializer topicRegistryInitializer = new TopicRegistryInitializer(kafkaConfig, registryConfig, this.mock);
assertThatExceptionOfType(InternalErrorException.class).isThrownBy(() -> {
topicRegistryInitializer.onStartUp(new StartupEvent(this.applicationContext));
});
}
use of com.bakdata.quick.common.config.TopicRegistryConfig in project quick by bakdata.
the class TopicRegistryInitializerTest method shouldCreateTopicRegistryTopic.
@Test
void shouldCreateTopicRegistryTopic() {
final String topicName = UUID.randomUUID().toString();
this.successfulMock();
final KafkaConfig kafkaConfig = new KafkaConfig(kafkaCluster.getBrokerList(), this.schemaRegistry.getUrl());
final TopicRegistryConfig registryConfig = new TopicRegistryConfig(topicName, TEST_NAME, 3, (short) 1);
final TopicRegistryInitializer topicRegistryInitializer = new TopicRegistryInitializer(kafkaConfig, registryConfig, this.mock);
topicRegistryInitializer.onStartUp(new StartupEvent(this.applicationContext));
assertThat(kafkaCluster.exists(topicName)).isTrue();
}
use of com.bakdata.quick.common.config.TopicRegistryConfig in project quick by bakdata.
the class TopicRegistryInitializerTest method shouldNotFailIfTopicRegistryExists.
@Test
void shouldNotFailIfTopicRegistryExists() {
final String topicName = UUID.randomUUID().toString();
this.failingMock();
final KafkaConfig kafkaConfig = new KafkaConfig(kafkaCluster.getBrokerList(), this.schemaRegistry.getUrl());
final TopicRegistryConfig registryConfig = new TopicRegistryConfig(topicName, TEST_NAME, 3, (short) 1);
final TopicRegistryInitializer topicRegistryInitializer = new TopicRegistryInitializer(kafkaConfig, registryConfig, this.mock);
assertThatCode(() -> {
topicRegistryInitializer.onStartUp(new StartupEvent(this.applicationContext));
}).doesNotThrowAnyException();
}
Aggregations