Add Pulsar ConnectionDetails support

Add `ConnectionDetails` support for Apache Pulsar and provide adapters
for Docker Compose and Testcontainers.

See gh-37197
This commit is contained in:
Chris Bono
2023-05-22 00:15:30 -05:00
committed by Phillip Webb
parent db73e071cc
commit 089fef0392
22 changed files with 549 additions and 14 deletions

View File

@@ -10,6 +10,7 @@ dependencies {
implementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-pulsar-reactive"))
testImplementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-test"))
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
testImplementation(project(":spring-boot-project:spring-boot-testcontainers"))
testImplementation("org.awaitility:awaitility")
testImplementation("org.testcontainers:junit-jupiter")
testImplementation("org.testcontainers:pulsar")

View File

@@ -32,10 +32,9 @@ import org.testcontainers.junit.jupiter.Testcontainers;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.system.CapturedOutput;
import org.springframework.boot.test.system.OutputCaptureExtension;
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.boot.testsupport.testcontainers.DockerImageNames;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import static org.assertj.core.api.Assertions.assertThat;
@@ -44,15 +43,11 @@ import static org.assertj.core.api.Assertions.assertThat;
class SamplePulsarApplicationTests {
@Container
@ServiceConnection
@SuppressWarnings("unused")
static final PulsarContainer container = new PulsarContainer(DockerImageNames.pulsar()).withStartupAttempts(2)
.withStartupTimeout(Duration.ofMinutes(3));
@DynamicPropertySource
static void pulsarProperties(DynamicPropertyRegistry registry) {
registry.add("spring.pulsar.client.service-url", container::getPulsarBrokerUrl);
registry.add("spring.pulsar.admin.service-url", container::getHttpServiceUrl);
}
abstract class PulsarApplication {
private final String type;