Skip to content

Commit

Permalink
GH-1563: Fix JUnit5 @EmbeddedKafka.partitions()
Browse files Browse the repository at this point in the history
Resolves #1563

Paritions property ignored in the JUnit5 condition.
  • Loading branch information
garyrussell committed Aug 14, 2020
1 parent 045b1d0 commit cca897b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Expand Up @@ -117,7 +117,8 @@ private boolean springTestContext(AnnotatedElement annotatedElement) {
private EmbeddedKafkaBroker createBroker(EmbeddedKafka embedded) {
EmbeddedKafkaBroker broker;
int[] ports = setupPorts(embedded);
broker = new EmbeddedKafkaBroker(embedded.count(), embedded.controlledShutdown(), embedded.topics())
broker = new EmbeddedKafkaBroker(embedded.count(), embedded.controlledShutdown(),
embedded.partitions(), embedded.topics())
.zkPort(embedded.zookeeperPort())
.kafkaPorts(ports)
.zkConnectionTimeout(embedded.zkConnectionTimeout())
Expand Down
Expand Up @@ -29,13 +29,15 @@
* @since 2.3
*
*/
@EmbeddedKafka(bootstrapServersProperty = "my.bss.property", count = 2)
@EmbeddedKafka(bootstrapServersProperty = "my.bss.property", count = 2, controlledShutdown = true, partitions = 3)
public class EmbeddedKafkaConditionTests {

@Test
public void test(EmbeddedKafkaBroker broker) {
assertThat(broker.getBrokersAsString()).isNotNull();
assertThat(KafkaTestUtils.getPropertyValue(broker, "brokerListProperty")).isEqualTo("my.bss.property");
assertThat(KafkaTestUtils.getPropertyValue(broker, "controlledShutdown")).isEqualTo(Boolean.TRUE);
assertThat(broker.getPartitionsPerTopic()).isEqualTo(3);
}

}
@@ -1,5 +1,5 @@
/*
* Copyright 2019 the original author or authors.
* Copyright 2019-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -72,7 +72,7 @@
*
* @since 2.3.0
*/
@EmbeddedKafka(topics = ReactiveKafkaProducerTemplateIntegrationTests.REACTIVE_INT_KEY_TOPIC, partitions = 1)
@EmbeddedKafka(topics = ReactiveKafkaProducerTemplateIntegrationTests.REACTIVE_INT_KEY_TOPIC, partitions = 2)
public class ReactiveKafkaProducerTemplateIntegrationTests {

private static final int DEFAULT_PARTITIONS_COUNT = 2;
Expand Down

0 comments on commit cca897b

Please sign in to comment.