Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename TestTopologyFactory #249

Merged
merged 2 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AvroMirrorTest {
private final ConfiguredStreamsApp<MirrorWithNonDefaultSerde> app = createApp();
@RegisterExtension
final TestTopologyExtension<TestRecord, TestRecord> testTopology =
StreamsBootstrapTopologyFactory.createTopologyExtensionWithSchemaRegistry(this.app);
TestTopologyFactory.createTopologyExtensionWithSchemaRegistry(this.app);

private static ConfiguredStreamsApp<MirrorWithNonDefaultSerde> createApp() {
final AppConfiguration<StreamsTopicConfig> configuration = new AppConfiguration<>(StreamsTopicConfig.builder()
Expand Down Expand Up @@ -69,7 +69,7 @@ private Serde<TestRecord> getValueSerde() {
}

private Configurator createSerdeFactory() {
return StreamsBootstrapTopologyFactory.createConfigurator(this.testTopology);
return TestTopologyFactory.createConfigurator(this.testTopology);
}

private Serde<TestRecord> getKeySerde() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* Utility class that provides helpers for using Fluent Kafka Streams Tests with {@link ConfiguredStreamsApp}
*/
@UtilityClass
public class StreamsBootstrapTopologyFactory {
public class TestTopologyFactory {

/**
* Create a {@code TestTopology} from a {@code ConfiguredStreamsApp}. It injects are {@link KafkaEndpointConfig}
Expand Down Expand Up @@ -112,12 +112,7 @@ public static <K, V> TestTopologyExtension<K, V> createTopologyExtension(
*/
public static Function<String, Map<String, Object>> getKafkaPropertiesWithSchemaRegistryUrl(
final ConfiguredStreamsApp<? extends StreamsApp> app) {
return schemaRegistryUrl -> {
final KafkaEndpointConfig endpointConfig = newEndpointConfig()
.schemaRegistryUrl(schemaRegistryUrl)
.build();
return app.getKafkaProperties(endpointConfig);
};
return schemaRegistryUrl -> getKafkaProperties(app, schemaRegistryUrl);
}

/**
Expand All @@ -131,14 +126,18 @@ public static Configurator createConfigurator(final TestTopology<?, ?> testTopol
return new Configurator(testTopology.getProperties());
}

private static Map<String, Object> getKafkaProperties(final ConfiguredStreamsApp<? extends StreamsApp> app) {
final KafkaEndpointConfig endpointConfig = createEndpointConfig();
private static Map<String, Object> getKafkaProperties(final ConfiguredStreamsApp<? extends StreamsApp> app,
final String schemaRegistryUrl) {
final KafkaEndpointConfig endpointConfig = newEndpointConfig()
.schemaRegistryUrl(schemaRegistryUrl)
.build();
return app.getKafkaProperties(endpointConfig);
}

private static KafkaEndpointConfig createEndpointConfig() {
return newEndpointConfig()
private static Map<String, Object> getKafkaProperties(final ConfiguredStreamsApp<? extends StreamsApp> app) {
final KafkaEndpointConfig endpointConfig = newEndpointConfig()
.build();
return app.getKafkaProperties(endpointConfig);
}

private static KafkaEndpointConfigBuilder newEndpointConfig() {
Expand Down
Loading