use of com.bakdata.quick.common.api.model.TopicData in project quick by bakdata.
the class TopicControllerTest method shouldGetTopicList.
@Test
void shouldGetTopicList() {
final TopicData topic = new TopicData(NAME, TopicWriteType.MUTABLE, QuickTopicType.LONG, QuickTopicType.STRING, null);
when(this.service.getTopicList()).thenReturn(Single.just(List.of(topic)));
this.client.toBlocking().exchange(GET("/topics"));
verify(this.service).getTopicList();
}
use of com.bakdata.quick.common.api.model.TopicData in project quick by bakdata.
the class KafkaTopicServiceTest method shouldRegisterTopic.
@Test
void shouldRegisterTopic() {
final String topicName = UUID.randomUUID().toString();
this.successfulMock();
final TopicCreationData requestData = new TopicCreationData(TopicWriteType.MUTABLE, null, null, null);
final Completable completable = this.topicService.createTopic(topicName, QuickTopicType.DOUBLE, QuickTopicType.DOUBLE, requestData);
final TopicData expectedTopicData = new TopicData(topicName, TopicWriteType.MUTABLE, QuickTopicType.DOUBLE, QuickTopicType.DOUBLE, null);
assertThat(completable.blockingGet()).isNull();
assertThat(this.topicRegistryClient.getTopicData(topicName).blockingGet()).usingRecursiveComparison().isEqualTo(expectedTopicData);
}
use of com.bakdata.quick.common.api.model.TopicData in project quick by bakdata.
the class KafkaTopicServiceTest method shouldNotCreateTopicThatAlreadyExistsInRegistry.
@Test
void shouldNotCreateTopicThatAlreadyExistsInRegistry() throws RestClientException, IOException {
final String topicName = UUID.randomUUID().toString();
this.successfulMock();
final TopicCreationData requestData = new TopicCreationData(TopicWriteType.MUTABLE, null, null, null);
this.topicRegistryClient.register(topicName, new TopicData(topicName, TopicWriteType.MUTABLE, null, null, null)).blockingAwait();
assertThat(this.topicRegistryClient.topicDataExists(topicName).blockingGet()).isTrue();
final Throwable exception = this.topicService.createTopic(topicName, QuickTopicType.DOUBLE, QuickTopicType.DOUBLE, requestData).blockingGet();
final String expectedErrorMsg = String.format("Topic \"%s\" already exists", topicName);
assertThat(exception).isExactlyInstanceOf(BadArgumentException.class).extracting(Throwable::getMessage).asString().startsWith(expectedErrorMsg);
assertThat(kafkaCluster.exists(topicName)).isFalse();
assertThat(this.schemaRegistry.getSchemaRegistryClient().getAllSubjects()).isEmpty();
}
use of com.bakdata.quick.common.api.model.TopicData in project quick by bakdata.
the class TopicDataClientTest method shouldReturnTrueIfTopicDoesNotExist.
@Test
void shouldReturnTrueIfTopicDoesNotExist() throws JsonProcessingException {
final TopicData topicData = createTopicData("dummy");
final String body = this.generateBody(topicData);
this.server.enqueue(new MockResponse().setBody(body));
final Boolean exists = this.topicDataClient.exists("dummy");
assertThat(exists).isTrue();
}
use of com.bakdata.quick.common.api.model.TopicData in project quick by bakdata.
the class TopicDataClientTest method shouldReturnGetTopicDataWithSpecificKey.
@Test
void shouldReturnGetTopicDataWithSpecificKey() throws JsonProcessingException {
final TopicData topicData = createTopicData("dummy");
final String body = this.generateBody(topicData);
this.server.enqueue(new MockResponse().setBody(body));
final TopicData topic = this.topicDataClient.fetchValue("dummy");
assertThat(Objects.requireNonNull(topic).getName()).isEqualTo("dummy");
}
Aggregations