Skip to content

Commit

Permalink
Polish
Browse files Browse the repository at this point in the history
  • Loading branch information
philwebb committed May 25, 2024
1 parent ba9708d commit 82d8222
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,21 @@ void versionNativeBuildTools() {
}

@Test
void urlArtifactReposiroryWhenRelease() {
void urlArtifactRepositoryWhenRelease() {
AntoraAsciidocAttributes attributes = new AntoraAsciidocAttributes("1.2.3", true, null,
mockDependencyVersions(), null);
assertThat(attributes.get()).containsEntry("url-artifact-repository", "https://repo.maven.apache.org/maven2");
}

@Test
void urlArtifactReposiroryWhenMilestone() {
void urlArtifactRepositoryWhenMilestone() {
AntoraAsciidocAttributes attributes = new AntoraAsciidocAttributes("1.2.3-M1", true, null,
mockDependencyVersions(), null);
assertThat(attributes.get()).containsEntry("url-artifact-repository", "https://repo.spring.io/milestone");
}

@Test
void urlArtifactReposiroryWhenSnapshot() {
void urlArtifactRepositoryWhenSnapshot() {
AntoraAsciidocAttributes attributes = new AntoraAsciidocAttributes("1.2.3-SNAPSHOT", true, null,
mockDependencyVersions(), null);
assertThat(attributes.get()).containsEntry("url-artifact-repository", "https://repo.spring.io/snapshot");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void matchesWhenCustomizerIsDetected() {
didMatch(context);
assertThat(conditionReportMessage(context)).contains(
"@ConditionalOnGraphQlSchema did not find schema files in locations 'classpath:graphql/missing/'")
.contains("@ConditionalOnGraphQlSchema found customizer myBuilderCuystomizer");
.contains("@ConditionalOnGraphQlSchema found customizer myBuilderCustomizer");
});
}

Expand Down Expand Up @@ -98,7 +98,7 @@ String success() {
static class CustomCustomizerConfiguration {

@Bean
GraphQlSourceBuilderCustomizer myBuilderCuystomizer() {
GraphQlSourceBuilderCustomizer myBuilderCustomizer() {
return (builder) -> {

};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
*/
class PulsarPropertiesTests {

private PulsarProperties bindPropeties(Map<String, String> map) {
private PulsarProperties bindProperties(Map<String, String> map) {
return new Binder(new MapConfigurationPropertySource(map)).bind("spring.pulsar", PulsarProperties.class).get();
}

Expand All @@ -69,7 +69,7 @@ void bind() {
map.put("spring.pulsar.client.operation-timeout", "1s");
map.put("spring.pulsar.client.lookup-timeout", "2s");
map.put("spring.pulsar.client.connection-timeout", "12s");
PulsarProperties.Client properties = bindPropeties(map).getClient();
PulsarProperties.Client properties = bindProperties(map).getClient();
assertThat(properties.getServiceUrl()).isEqualTo("my-service-url");
assertThat(properties.getOperationTimeout()).isEqualTo(Duration.ofMillis(1000));
assertThat(properties.getLookupTimeout()).isEqualTo(Duration.ofMillis(2000));
Expand All @@ -81,7 +81,7 @@ void bindAuthentication() {
Map<String, String> map = new HashMap<>();
map.put("spring.pulsar.client.authentication.plugin-class-name", "com.example.MyAuth");
map.put("spring.pulsar.client.authentication.param.token", "1234");
PulsarProperties.Client properties = bindPropeties(map).getClient();
PulsarProperties.Client properties = bindProperties(map).getClient();
assertThat(properties.getAuthentication().getPluginClassName()).isEqualTo("com.example.MyAuth");
assertThat(properties.getAuthentication().getParam()).containsEntry("token", "1234");
}
Expand All @@ -101,7 +101,7 @@ void bindFailover() {
map.put("spring.pulsar.client.failover.backup-clusters[1].authentication.plugin-class-name",
"com.example.MyAuth2");
map.put("spring.pulsar.client.failover.backup-clusters[1].authentication.param.token", "5678");
PulsarProperties.Client properties = bindPropeties(map).getClient();
PulsarProperties.Client properties = bindProperties(map).getClient();
Failover failoverProperties = properties.getFailover();
List<BackupCluster> backupClusters = properties.getFailover().getBackupClusters();
assertThat(properties.getServiceUrl()).isEqualTo("my-service-url");
Expand Down Expand Up @@ -132,7 +132,7 @@ void bind() {
map.put("spring.pulsar.admin.connection-timeout", "12s");
map.put("spring.pulsar.admin.read-timeout", "13s");
map.put("spring.pulsar.admin.request-timeout", "14s");
PulsarProperties.Admin properties = bindPropeties(map).getAdmin();
PulsarProperties.Admin properties = bindProperties(map).getAdmin();
assertThat(properties.getServiceUrl()).isEqualTo("my-service-url");
assertThat(properties.getConnectionTimeout()).isEqualTo(Duration.ofSeconds(12));
assertThat(properties.getReadTimeout()).isEqualTo(Duration.ofSeconds(13));
Expand All @@ -144,7 +144,7 @@ void bindAuthentication() {
Map<String, String> map = new HashMap<>();
map.put("spring.pulsar.admin.authentication.plugin-class-name", this.authPluginClassName);
map.put("spring.pulsar.admin.authentication.param.token", this.authToken);
PulsarProperties.Admin properties = bindPropeties(map).getAdmin();
PulsarProperties.Admin properties = bindProperties(map).getAdmin();
assertThat(properties.getAuthentication().getPluginClassName()).isEqualTo(this.authPluginClassName);
assertThat(properties.getAuthentication().getParam()).containsEntry("token", this.authToken);
}
Expand All @@ -166,7 +166,7 @@ void bindWhenTypeMappingsWithTopicsOnly() {
map.put("spring.pulsar.defaults.type-mappings[0].topic-name", "foo-topic");
map.put("spring.pulsar.defaults.type-mappings[1].message-type", String.class.getName());
map.put("spring.pulsar.defaults.type-mappings[1].topic-name", "string-topic");
PulsarProperties.Defaults properties = bindPropeties(map).getDefaults();
PulsarProperties.Defaults properties = bindProperties(map).getDefaults();
TypeMapping expectedTopic1 = new TypeMapping(TestMessage.class, "foo-topic", null);
TypeMapping expectedTopic2 = new TypeMapping(String.class, "string-topic", null);
assertThat(properties.getTypeMappings()).containsExactly(expectedTopic1, expectedTopic2);
Expand All @@ -177,7 +177,7 @@ void bindWhenTypeMappingsWithSchemaOnly() {
Map<String, String> map = new HashMap<>();
map.put("spring.pulsar.defaults.type-mappings[0].message-type", TestMessage.class.getName());
map.put("spring.pulsar.defaults.type-mappings[0].schema-info.schema-type", "JSON");
PulsarProperties.Defaults properties = bindPropeties(map).getDefaults();
PulsarProperties.Defaults properties = bindProperties(map).getDefaults();
TypeMapping expected = new TypeMapping(TestMessage.class, null, new SchemaInfo(SchemaType.JSON, null));
assertThat(properties.getTypeMappings()).containsExactly(expected);
}
Expand All @@ -188,7 +188,7 @@ void bindWhenTypeMappingsWithTopicAndSchema() {
map.put("spring.pulsar.defaults.type-mappings[0].message-type", TestMessage.class.getName());
map.put("spring.pulsar.defaults.type-mappings[0].topic-name", "foo-topic");
map.put("spring.pulsar.defaults.type-mappings[0].schema-info.schema-type", "JSON");
PulsarProperties.Defaults properties = bindPropeties(map).getDefaults();
PulsarProperties.Defaults properties = bindProperties(map).getDefaults();
TypeMapping expected = new TypeMapping(TestMessage.class, "foo-topic",
new SchemaInfo(SchemaType.JSON, null));
assertThat(properties.getTypeMappings()).containsExactly(expected);
Expand All @@ -200,7 +200,7 @@ void bindWhenTypeMappingsWithKeyValueSchema() {
map.put("spring.pulsar.defaults.type-mappings[0].message-type", TestMessage.class.getName());
map.put("spring.pulsar.defaults.type-mappings[0].schema-info.schema-type", "KEY_VALUE");
map.put("spring.pulsar.defaults.type-mappings[0].schema-info.message-key-type", String.class.getName());
PulsarProperties.Defaults properties = bindPropeties(map).getDefaults();
PulsarProperties.Defaults properties = bindProperties(map).getDefaults();
TypeMapping expected = new TypeMapping(TestMessage.class, null,
new SchemaInfo(SchemaType.KEY_VALUE, String.class));
assertThat(properties.getTypeMappings()).containsExactly(expected);
Expand All @@ -211,7 +211,7 @@ void bindWhenNoSchemaThrowsException() {
Map<String, String> map = new HashMap<>();
map.put("spring.pulsar.defaults.type-mappings[0].message-type", TestMessage.class.getName());
map.put("spring.pulsar.defaults.type-mappings[0].schema-info.message-key-type", String.class.getName());
assertThatExceptionOfType(BindException.class).isThrownBy(() -> bindPropeties(map))
assertThatExceptionOfType(BindException.class).isThrownBy(() -> bindProperties(map))
.havingRootCause()
.withMessageContaining("schemaType must not be null");
}
Expand All @@ -221,7 +221,7 @@ void bindWhenSchemaTypeNoneThrowsException() {
Map<String, String> map = new HashMap<>();
map.put("spring.pulsar.defaults.type-mappings[0].message-type", TestMessage.class.getName());
map.put("spring.pulsar.defaults.type-mappings[0].schema-info.schema-type", "NONE");
assertThatExceptionOfType(BindException.class).isThrownBy(() -> bindPropeties(map))
assertThatExceptionOfType(BindException.class).isThrownBy(() -> bindProperties(map))
.havingRootCause()
.withMessageContaining("schemaType 'NONE' not supported");
}
Expand All @@ -232,7 +232,7 @@ void bindWhenMessageKeyTypeSetOnNonKeyValueSchemaThrowsException() {
map.put("spring.pulsar.defaults.type-mappings[0].message-type", TestMessage.class.getName());
map.put("spring.pulsar.defaults.type-mappings[0].schema-info.schema-type", "JSON");
map.put("spring.pulsar.defaults.type-mappings[0].schema-info.message-key-type", String.class.getName());
assertThatExceptionOfType(BindException.class).isThrownBy(() -> bindPropeties(map))
assertThatExceptionOfType(BindException.class).isThrownBy(() -> bindProperties(map))
.havingRootCause()
.withMessageContaining("messageKeyType can only be set when schemaType is KEY_VALUE");
}
Expand All @@ -259,7 +259,7 @@ void bind() {
props.put("spring.pulsar.function.fail-fast", "false");
props.put("spring.pulsar.function.propagate-failures", "false");
props.put("spring.pulsar.function.propagate-stop-failures", "true");
PulsarProperties.Function properties = bindPropeties(props).getFunction();
PulsarProperties.Function properties = bindProperties(props).getFunction();
assertThat(properties.isFailFast()).isFalse();
assertThat(properties.isPropagateFailures()).isFalse();
assertThat(properties.isPropagateStopFailures()).isTrue();
Expand All @@ -285,7 +285,7 @@ void bind() {
map.put("spring.pulsar.producer.cache.expire-after-access", "2s");
map.put("spring.pulsar.producer.cache.maximum-size", "3");
map.put("spring.pulsar.producer.cache.initial-capacity", "5");
PulsarProperties.Producer properties = bindPropeties(map).getProducer();
PulsarProperties.Producer properties = bindProperties(map).getProducer();
assertThat(properties.getName()).isEqualTo("my-producer");
assertThat(properties.getTopicName()).isEqualTo("my-topic");
assertThat(properties.getSendTimeout()).isEqualTo(Duration.ofSeconds(2));
Expand Down Expand Up @@ -323,7 +323,7 @@ void bind() {
map.put("spring.pulsar.consumer.dead-letter-policy.dead-letter-topic", "my-dlt-topic");
map.put("spring.pulsar.consumer.dead-letter-policy.initial-subscription-name", "my-initial-subscription");
map.put("spring.pulsar.consumer.retry-enable", "true");
PulsarProperties.Consumer properties = bindPropeties(map).getConsumer();
PulsarProperties.Consumer properties = bindProperties(map).getConsumer();
assertThat(properties.getName()).isEqualTo("my-consumer");
assertThat(properties.getSubscription()).satisfies((subscription) -> {
assertThat(subscription.getName()).isEqualTo("my-subscription");
Expand Down Expand Up @@ -355,7 +355,7 @@ void bind() {
Map<String, String> map = new HashMap<>();
map.put("spring.pulsar.listener.schema-type", "avro");
map.put("spring.pulsar.listener.observation-enabled", "true");
PulsarProperties.Listener properties = bindPropeties(map).getListener();
PulsarProperties.Listener properties = bindProperties(map).getListener();
assertThat(properties.getSchemaType()).isEqualTo(SchemaType.AVRO);
assertThat(properties.isObservationEnabled()).isTrue();
}
Expand All @@ -373,7 +373,7 @@ void bind() {
map.put("spring.pulsar.reader.subscription-name", "my-subscription");
map.put("spring.pulsar.reader.subscription-role-prefix", "sub-role");
map.put("spring.pulsar.reader.read-compacted", "true");
PulsarProperties.Reader properties = bindPropeties(map).getReader();
PulsarProperties.Reader properties = bindProperties(map).getReader();
assertThat(properties.getName()).isEqualTo("my-reader");
assertThat(properties.getTopics()).containsExactly("my-topic");
assertThat(properties.getSubscriptionName()).isEqualTo("my-subscription");
Expand All @@ -390,7 +390,7 @@ class TemplateProperties {
void bind() {
Map<String, String> map = new HashMap<>();
map.put("spring.pulsar.template.observations-enabled", "true");
PulsarProperties.Template properties = bindPropeties(map).getTemplate();
PulsarProperties.Template properties = bindProperties(map).getTemplate();
assertThat(properties.isObservationsEnabled()).isTrue();
}

Expand All @@ -403,7 +403,7 @@ class TransactionProperties {
void bind() {
Map<String, String> map = new HashMap<>();
map.put("spring.pulsar.transaction.enabled", "true");
PulsarProperties.Transaction properties = bindPropeties(map).getTransaction();
PulsarProperties.Transaction properties = bindProperties(map).getTransaction();
assertThat(properties.isEnabled()).isTrue();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class MyContainersConfiguration {
@Bean
@RestartScope
@ServiceConnection
fun monogDbContainer(): MongoDBContainer {
fun mongoDbContainer(): MongoDBContainer {
return MongoDBContainer("mongo:5.0")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import org.testcontainers.containers.MongoDBContainer
class MyContainersConfiguration {

@Bean
fun monogDbContainer(properties: DynamicPropertyRegistry): MongoDBContainer {
fun mongoDbContainer(properties: DynamicPropertyRegistry): MongoDBContainer {
var container = MongoDBContainer("mongo:5.0")
properties.add("spring.data.mongodb.host", container::getHost)
properties.add("spring.data.mongodb.port", container::getFirstMappedPort)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void bindExceptionDueToMapConversionFailure() {
}

@Test
void bindExceptionWithSupressedMissingParametersException() {
void bindExceptionWithSuppressedMissingParametersException() {
BeanCreationException failure = createFailure(GenericFailureConfiguration.class, "test.foo.value=alpha");
failure.addSuppressed(new IllegalStateException(
"Missing parameter names. Ensure that the compiler uses the '-parameters' flag"));
Expand Down

0 comments on commit 82d8222

Please sign in to comment.