-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat : upgrade to spring boot 3.4 and polish tc config (#606)
* feat : upgrade to spring boot 3.4 and polish tc config * feat : improve * Update confluent version * Update pom.xml * let spring boot manage container lifecycle
- Loading branch information
1 parent
5f6bb9f
commit a9129e9
Showing
16 changed files
with
247 additions
and
319 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 2 additions & 6 deletions
8
...vro-consumer/src/main/java/com/example/springbootkafkaavro/util/ApplicationConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
package com.example.springbootkafkaavro.util; | ||
|
||
import lombok.experimental.UtilityClass; | ||
|
||
@UtilityClass | ||
public class ApplicationConstants { | ||
|
||
public static final String PERSONS_TOPIC = "persons"; | ||
public interface ApplicationConstants { | ||
String PERSONS_TOPIC = "persons"; | ||
} |
40 changes: 40 additions & 0 deletions
40
...afka-avro-consumer/src/test/java/com/example/springbootkafkaavro/ApplicationIntTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.example.springbootkafkaavro; | ||
|
||
import static java.util.concurrent.TimeUnit.SECONDS; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.awaitility.Awaitility.await; | ||
|
||
import com.example.springbootkafkaavro.common.KafkaContainersConfig; | ||
import com.example.springbootkafkaavro.model.Person; | ||
import com.example.springbootkafkaavro.repository.PersonRepository; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.context.annotation.Import; | ||
import org.springframework.test.web.servlet.MockMvc; | ||
|
||
@SpringBootTest( | ||
properties = { | ||
"spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer", | ||
"spring.kafka.producer.value-serializer=io.confluent.kafka.serializers.KafkaAvroSerializer" | ||
}, | ||
classes = {KafkaContainersConfig.class}) | ||
@AutoConfigureMockMvc | ||
@Import(KafkaProducer.class) | ||
class ApplicationIntTests { | ||
|
||
@Autowired MockMvc mockMvc; | ||
@Autowired PersonRepository personRepository; | ||
@Autowired KafkaProducer kafkaProducer; | ||
|
||
@Test | ||
void contextLoads() { | ||
Person person = new Person(); | ||
person.setAge(33); | ||
person.setName("junit"); | ||
this.kafkaProducer.sendMessage(person); | ||
await().atMost(10, SECONDS) | ||
.untilAsserted(() -> assertThat(personRepository.count()).isEqualTo(1)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 0 additions & 112 deletions
112
...est/java/com/example/springbootkafkaavro/SpringBootKafkaAvroConsumerApplicationTests.java
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
...test/java/com/example/springbootkafkaavro/TestSpringBootKafkaAvroConsumerApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.example.springbootkafkaavro; | ||
|
||
import com.example.springbootkafkaavro.common.KafkaContainersConfig; | ||
import org.springframework.boot.SpringApplication; | ||
|
||
class TestSpringBootKafkaAvroConsumerApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.from(SpringBootKafkaAvroConsumerApplication::main) | ||
.with(KafkaContainersConfig.class) | ||
.run(args); | ||
} | ||
} |
Oops, something went wrong.