From 1ae0e8d994287161d2e084ad0672662adcdfb483 Mon Sep 17 00:00:00 2001 From: Manu Zi Date: Mon, 1 Apr 2019 21:17:35 +0200 Subject: [PATCH] Activate surefire plugin and remove unnecessary configuration --- pom.xml | 22 +++++---------- src/main/resources/application.yml | 28 ------------------- .../KafkaConsumingHealthIndicatorTest.java | 19 ++++++------- 3 files changed, 16 insertions(+), 53 deletions(-) diff --git a/pom.xml b/pom.xml index f0b4af8..be7562c 100644 --- a/pom.xml +++ b/pom.xml @@ -22,11 +22,10 @@ 5.3.2 0.27.2 1.0-m5.1 - 2.1.1.RELEASE + 2.1.3.RELEASE 2.2.4.RELEASE 2.22.1 - 2.22.1 3.11.1 27.1-jre @@ -35,7 +34,7 @@ org.springframework.boot spring-boot-starter-actuator - ${spring-boot-starter.version} + ${spring-boot.version} provided @@ -77,7 +76,7 @@ org.springframework.boot spring-boot-test - 2.1.2.RELEASE + ${spring-boot.version} test @@ -102,6 +101,10 @@ + + maven-surefire-plugin + ${maven-surefire-plugin.version} + external.atlassian.jgitflow jgitflow-maven-plugin @@ -138,15 +141,4 @@ - - - releases - http://nexus.device-insight.de/nexus/content/repositories/releases - - - snapshots - http://nexus.device-insight.de/nexus/content/repositories/snapshots - - - diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 83e8867..e69de29 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,28 +0,0 @@ -spring: - jackson: - serialization: - write-dates-as-timestamps: false - -management: - server: - port: 9090 - metrics: - export: - prometheus: - enabled: true - endpoints: - web: - exposure: - include: - - health - - info - - prometheus - - loggers - - httptrace - - configprops - - metrics - - heapdump - - threaddump - endpoint: - health: - show-details: always diff --git a/src/test/java/com/deviceinsight/kafka/health/KafkaConsumingHealthIndicatorTest.java b/src/test/java/com/deviceinsight/kafka/health/KafkaConsumingHealthIndicatorTest.java index 311ab07..70c398b 100644 --- a/src/test/java/com/deviceinsight/kafka/health/KafkaConsumingHealthIndicatorTest.java +++ b/src/test/java/com/deviceinsight/kafka/health/KafkaConsumingHealthIndicatorTest.java @@ -6,10 +6,7 @@ import static org.assertj.core.api.Assertions.assertThat; import kafka.server.KafkaServer; import org.apache.kafka.clients.consumer.Consumer; import org.apache.kafka.common.serialization.StringDeserializer; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.*; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.actuate.health.Health; @@ -29,7 +26,6 @@ import java.util.Map; @ExtendWith(SpringExtension.class) @EmbeddedKafka(topics = {TOPIC}) -@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class KafkaConsumingHealthIndicatorTest { static final String TOPIC = "health-checks"; @@ -39,7 +35,7 @@ public class KafkaConsumingHealthIndicatorTest { @Autowired private EmbeddedKafkaBroker embeddedKafkaBroker; - @BeforeAll + @BeforeEach public void setUp() { Map consumerConfigs = new HashMap<>(KafkaTestUtils.consumerProps("consumer", "false", embeddedKafkaBroker)); @@ -49,7 +45,7 @@ public class KafkaConsumingHealthIndicatorTest { consumer.poll(Duration.ofSeconds(1)); } - @AfterAll + @AfterEach public void tearDown() { consumer.close(); embeddedKafkaBroker.getKafkaServers().forEach(KafkaServer::shutdown); @@ -58,14 +54,14 @@ public class KafkaConsumingHealthIndicatorTest { @Test public void kafkaIsDown() throws Exception { - KafkaHealthProperties kafkaHealthProperties = new KafkaHealthProperties(); + final KafkaHealthProperties kafkaHealthProperties = new KafkaHealthProperties(); kafkaHealthProperties.setTopic(TOPIC); final KafkaProperties kafkaProperties = new KafkaProperties(); - BrokerAddress[] brokerAddresses = embeddedKafkaBroker.getBrokerAddresses(); + final BrokerAddress[] brokerAddresses = embeddedKafkaBroker.getBrokerAddresses(); kafkaProperties.setBootstrapServers(Collections.singletonList(brokerAddresses[0].toString())); - KafkaConsumingHealthIndicator healthIndicator = + final KafkaConsumingHealthIndicator healthIndicator = new KafkaConsumingHealthIndicator(kafkaHealthProperties, kafkaProperties.buildConsumerProperties(), kafkaProperties.buildProducerProperties()); healthIndicator.subscribeToTopic(); @@ -74,6 +70,9 @@ public class KafkaConsumingHealthIndicatorTest { assertThat(health.getStatus()).isEqualTo(Status.UP); shutdownKafka(); + + health = healthIndicator.health(); + assertThat(health.getStatus()).isEqualTo(Status.DOWN); } private void shutdownKafka() {