mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Polish
This commit is contained in:
parent
ba9708d754
commit
82d8222f56
|
@ -92,21 +92,21 @@ class AntoraAsciidocAttributesTests {
|
|||
}
|
||||
|
||||
@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");
|
||||
|
|
|
@ -54,7 +54,7 @@ class DefaultGraphQlSchemaConditionTests {
|
|||
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");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ class DefaultGraphQlSchemaConditionTests {
|
|||
static class CustomCustomizerConfiguration {
|
||||
|
||||
@Bean
|
||||
GraphQlSourceBuilderCustomizer myBuilderCuystomizer() {
|
||||
GraphQlSourceBuilderCustomizer myBuilderCustomizer() {
|
||||
return (builder) -> {
|
||||
|
||||
};
|
||||
|
|
|
@ -55,7 +55,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
|||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ class PulsarPropertiesTests {
|
|||
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));
|
||||
|
@ -81,7 +81,7 @@ class PulsarPropertiesTests {
|
|||
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");
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ class PulsarPropertiesTests {
|
|||
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");
|
||||
|
@ -132,7 +132,7 @@ class PulsarPropertiesTests {
|
|||
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));
|
||||
|
@ -144,7 +144,7 @@ class PulsarPropertiesTests {
|
|||
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);
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ class PulsarPropertiesTests {
|
|||
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);
|
||||
|
@ -177,7 +177,7 @@ class PulsarPropertiesTests {
|
|||
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);
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ class PulsarPropertiesTests {
|
|||
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);
|
||||
|
@ -200,7 +200,7 @@ class PulsarPropertiesTests {
|
|||
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);
|
||||
|
@ -211,7 +211,7 @@ class PulsarPropertiesTests {
|
|||
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");
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ class PulsarPropertiesTests {
|
|||
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");
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ class PulsarPropertiesTests {
|
|||
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");
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ class PulsarPropertiesTests {
|
|||
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();
|
||||
|
@ -285,7 +285,7 @@ class PulsarPropertiesTests {
|
|||
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));
|
||||
|
@ -323,7 +323,7 @@ class PulsarPropertiesTests {
|
|||
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");
|
||||
|
@ -355,7 +355,7 @@ class PulsarPropertiesTests {
|
|||
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();
|
||||
}
|
||||
|
@ -373,7 +373,7 @@ class PulsarPropertiesTests {
|
|||
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");
|
||||
|
@ -390,7 +390,7 @@ class PulsarPropertiesTests {
|
|||
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();
|
||||
}
|
||||
|
||||
|
@ -403,7 +403,7 @@ class PulsarPropertiesTests {
|
|||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ class MyContainersConfiguration {
|
|||
@Bean
|
||||
@RestartScope
|
||||
@ServiceConnection
|
||||
fun monogDbContainer(): MongoDBContainer {
|
||||
fun mongoDbContainer(): MongoDBContainer {
|
||||
return MongoDBContainer("mongo:5.0")
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -100,7 +100,7 @@ class BindFailureAnalyzerTests {
|
|||
}
|
||||
|
||||
@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"));
|
||||
|
|
Loading…
Reference in New Issue
Block a user