mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Merge previously split strings
Merge some string lines that were previously split because of the 90 chars wide formatting.
This commit is contained in:
parent
c3816bfe7b
commit
01933f9b06
@ -54,8 +54,8 @@ public class HttpClientMetricsAutoConfiguration {
|
|||||||
@Order(0)
|
@Order(0)
|
||||||
public MeterFilter metricsHttpClientUriTagFilter(MetricsProperties properties) {
|
public MeterFilter metricsHttpClientUriTagFilter(MetricsProperties properties) {
|
||||||
String metricName = properties.getWeb().getClient().getRequest().getMetricName();
|
String metricName = properties.getWeb().getClient().getRequest().getMetricName();
|
||||||
MeterFilter denyFilter = new OnlyOnceLoggingDenyMeterFilter(() -> String.format(
|
MeterFilter denyFilter = new OnlyOnceLoggingDenyMeterFilter(() -> String
|
||||||
"Reached the maximum number of URI tags for '%s'. Are you using " + "'uriVariables'?", metricName));
|
.format("Reached the maximum number of URI tags for '%s'. Are you using 'uriVariables'?", metricName));
|
||||||
return MeterFilter.maximumAllowableTags(metricName, "uri", properties.getWeb().getClient().getMaxUriTags(),
|
return MeterFilter.maximumAllowableTags(metricName, "uri", properties.getWeb().getClient().getMaxUriTags(),
|
||||||
denyFilter);
|
denyFilter);
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ class ReactiveManagementContextFactory implements ManagementContextFactory {
|
|||||||
Class<?> factoryClass = parent.getBean(ReactiveWebServerFactory.class).getClass();
|
Class<?> factoryClass = parent.getBean(ReactiveWebServerFactory.class).getClass();
|
||||||
if (cannotBeInstantiated(factoryClass)) {
|
if (cannotBeInstantiated(factoryClass)) {
|
||||||
throw new FatalBeanException("ReactiveWebServerFactory implementation " + factoryClass.getName()
|
throw new FatalBeanException("ReactiveWebServerFactory implementation " + factoryClass.getName()
|
||||||
+ " cannot be instantiated. " + "To allow a separate management port to be used, a top-level class "
|
+ " cannot be instantiated. To allow a separate management port to be used, a top-level class "
|
||||||
+ "or static inner class should be used instead");
|
+ "or static inner class should be used instead");
|
||||||
}
|
}
|
||||||
return factoryClass;
|
return factoryClass;
|
||||||
|
@ -73,7 +73,7 @@ class ServletManagementContextFactory implements ManagementContextFactory {
|
|||||||
Class<?> factoryClass = parent.getBean(ServletWebServerFactory.class).getClass();
|
Class<?> factoryClass = parent.getBean(ServletWebServerFactory.class).getClass();
|
||||||
if (cannotBeInstantiated(factoryClass)) {
|
if (cannotBeInstantiated(factoryClass)) {
|
||||||
throw new FatalBeanException("ServletWebServerFactory implementation " + factoryClass.getName()
|
throw new FatalBeanException("ServletWebServerFactory implementation " + factoryClass.getName()
|
||||||
+ " cannot be instantiated. " + "To allow a separate management port to be used, a top-level class "
|
+ " cannot be instantiated. To allow a separate management port to be used, a top-level class "
|
||||||
+ "or static inner class should be used instead");
|
+ "or static inner class should be used instead");
|
||||||
}
|
}
|
||||||
return factoryClass;
|
return factoryClass;
|
||||||
|
@ -113,7 +113,7 @@ class TokenTests {
|
|||||||
@Test
|
@Test
|
||||||
void getExpiryWhenExpIsNullShouldThrowException() {
|
void getExpiryWhenExpIsNullShouldThrowException() {
|
||||||
String header = "{\"alg\": \"RS256\", \"kid\": \"key-id\", \"typ\": \"JWT\"}";
|
String header = "{\"alg\": \"RS256\", \"kid\": \"key-id\", \"typ\": \"JWT\"}";
|
||||||
String claims = "{\"iss\": \"http://localhost:8080/uaa/oauth/token\"" + "}";
|
String claims = "{\"iss\": \"http://localhost:8080/uaa/oauth/token\"}";
|
||||||
Token token = createToken(header, claims);
|
Token token = createToken(header, claims);
|
||||||
assertThatExceptionOfType(CloudFoundryAuthorizationException.class).isThrownBy(token::getExpiry)
|
assertThatExceptionOfType(CloudFoundryAuthorizationException.class).isThrownBy(token::getExpiry)
|
||||||
.satisfies(reasonRequirement(Reason.INVALID_TOKEN));
|
.satisfies(reasonRequirement(Reason.INVALID_TOKEN));
|
||||||
|
@ -75,13 +75,14 @@ class AuditEventsEndpointDocumentationTests extends MockMvcEndpointDocumentation
|
|||||||
.perform(get("/actuator/auditevents")
|
.perform(get("/actuator/auditevents")
|
||||||
.param("principal", "alice").param("after", queryTimestamp).param("type", "logout"))
|
.param("principal", "alice").param("after", queryTimestamp).param("type", "logout"))
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andDo(document("auditevents/filtered", requestParameters(
|
.andDo(document("auditevents/filtered",
|
||||||
parameterWithName("after").description(
|
requestParameters(
|
||||||
"Restricts the events to those that occurred " + "after the given time. Optional."),
|
parameterWithName("after").description(
|
||||||
parameterWithName("principal")
|
"Restricts the events to those that occurred after the given time. Optional."),
|
||||||
.description("Restricts the events to those with the given " + "principal. Optional."),
|
parameterWithName("principal").description(
|
||||||
parameterWithName("type")
|
"Restricts the events to those with the given principal. Optional."),
|
||||||
.description("Restricts the events to those with the given " + "type. Optional."))));
|
parameterWithName("type")
|
||||||
|
.description("Restricts the events to those with the given type. Optional."))));
|
||||||
verify(this.repository).find("alice", now.toInstant(), "logout");
|
verify(this.repository).find("alice", now.toInstant(), "logout");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ class CachesEndpointDocumentationTests extends MockMvcEndpointDocumentationTests
|
|||||||
|
|
||||||
private static final List<ParameterDescriptor> requestParameters = Collections
|
private static final List<ParameterDescriptor> requestParameters = Collections
|
||||||
.singletonList(parameterWithName("cacheManager").description(
|
.singletonList(parameterWithName("cacheManager").description(
|
||||||
"Name of the cacheManager to qualify the cache. May be " + "omitted if the cache name is unique.")
|
"Name of the cacheManager to qualify the cache. May be omitted if the cache name is unique.")
|
||||||
.optional());
|
.optional());
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -66,7 +66,7 @@ class CachesEndpointDocumentationTests extends MockMvcEndpointDocumentationTests
|
|||||||
.andDo(MockMvcRestDocumentation.document("caches/all",
|
.andDo(MockMvcRestDocumentation.document("caches/all",
|
||||||
responseFields(fieldWithPath("cacheManagers").description("Cache managers keyed by id."),
|
responseFields(fieldWithPath("cacheManagers").description("Cache managers keyed by id."),
|
||||||
fieldWithPath("cacheManagers.*.caches")
|
fieldWithPath("cacheManagers.*.caches")
|
||||||
.description("Caches in the application context keyed by " + "name."))
|
.description("Caches in the application context keyed by name."))
|
||||||
.andWithPrefix("cacheManagers.*.caches.*.", fieldWithPath("target")
|
.andWithPrefix("cacheManagers.*.caches.*.", fieldWithPath("target")
|
||||||
.description("Fully qualified name of the native cache."))));
|
.description("Fully qualified name of the native cache."))));
|
||||||
}
|
}
|
||||||
|
@ -66,15 +66,14 @@ class ConditionsReportEndpointDocumentationTests extends MockMvcEndpointDocument
|
|||||||
@Test
|
@Test
|
||||||
void conditions() throws Exception {
|
void conditions() throws Exception {
|
||||||
List<FieldDescriptor> positiveMatchFields = Arrays.asList(
|
List<FieldDescriptor> positiveMatchFields = Arrays.asList(
|
||||||
fieldWithPath("").description("Classes and methods with conditions that were " + "matched."),
|
fieldWithPath("").description("Classes and methods with conditions that were matched."),
|
||||||
fieldWithPath(".*.[].condition").description("Name of the condition."),
|
fieldWithPath(".*.[].condition").description("Name of the condition."),
|
||||||
fieldWithPath(".*.[].message").description("Details of why the condition was matched."));
|
fieldWithPath(".*.[].message").description("Details of why the condition was matched."));
|
||||||
List<FieldDescriptor> negativeMatchFields = Arrays.asList(
|
List<FieldDescriptor> negativeMatchFields = Arrays.asList(
|
||||||
fieldWithPath("").description("Classes and methods with conditions that " + "were not matched."),
|
fieldWithPath("").description("Classes and methods with conditions that were not matched."),
|
||||||
fieldWithPath(".*.notMatched").description("Conditions that were matched."),
|
fieldWithPath(".*.notMatched").description("Conditions that were matched."),
|
||||||
fieldWithPath(".*.notMatched.[].condition").description("Name of the condition."),
|
fieldWithPath(".*.notMatched.[].condition").description("Name of the condition."),
|
||||||
fieldWithPath(".*.notMatched.[].message")
|
fieldWithPath(".*.notMatched.[].message").description("Details of why the condition was not matched."),
|
||||||
.description("Details of why the condition was" + " not matched."),
|
|
||||||
fieldWithPath(".*.matched").description("Conditions that were matched."),
|
fieldWithPath(".*.matched").description("Conditions that were matched."),
|
||||||
fieldWithPath(".*.matched.[].condition").description("Name of the condition.")
|
fieldWithPath(".*.matched.[].condition").description("Name of the condition.")
|
||||||
.type(JsonFieldType.STRING).optional(),
|
.type(JsonFieldType.STRING).optional(),
|
||||||
|
@ -55,7 +55,7 @@ class FlywayEndpointDocumentationTests extends MockMvcEndpointDocumentationTests
|
|||||||
.andDo(MockMvcRestDocumentation.document("flyway",
|
.andDo(MockMvcRestDocumentation.document("flyway",
|
||||||
responseFields(fieldWithPath("contexts").description("Application contexts keyed by id"),
|
responseFields(fieldWithPath("contexts").description("Application contexts keyed by id"),
|
||||||
fieldWithPath("contexts.*.flywayBeans.*.migrations").description(
|
fieldWithPath("contexts.*.flywayBeans.*.migrations").description(
|
||||||
"Migrations performed by the Flyway instance, keyed by" + " Flyway bean name."))
|
"Migrations performed by the Flyway instance, keyed by Flyway bean name."))
|
||||||
.andWithPrefix("contexts.*.flywayBeans.*.migrations.[].",
|
.andWithPrefix("contexts.*.flywayBeans.*.migrations.[].",
|
||||||
migrationFieldDescriptors())
|
migrationFieldDescriptors())
|
||||||
.and(parentIdField())));
|
.and(parentIdField())));
|
||||||
@ -69,9 +69,9 @@ class FlywayEndpointDocumentationTests extends MockMvcEndpointDocumentationTests
|
|||||||
fieldWithPath("installedBy").description("User that installed the applied migration, if any.")
|
fieldWithPath("installedBy").description("User that installed the applied migration, if any.")
|
||||||
.optional(),
|
.optional(),
|
||||||
fieldWithPath("installedOn")
|
fieldWithPath("installedOn")
|
||||||
.description("Timestamp of when the applied migration was installed, " + "if any.").optional(),
|
.description("Timestamp of when the applied migration was installed, if any.").optional(),
|
||||||
fieldWithPath("installedRank")
|
fieldWithPath("installedRank")
|
||||||
.description("Rank of the applied migration, if any. Later migrations have " + "higher ranks.")
|
.description("Rank of the applied migration, if any. Later migrations have higher ranks.")
|
||||||
.optional(),
|
.optional(),
|
||||||
fieldWithPath("script").description("Name of the script used to execute the migration, if any.")
|
fieldWithPath("script").description("Name of the script used to execute the migration, if any.")
|
||||||
.optional(),
|
.optional(),
|
||||||
@ -79,8 +79,8 @@ class FlywayEndpointDocumentationTests extends MockMvcEndpointDocumentationTests
|
|||||||
.description("State of the migration. (" + describeEnumValues(MigrationState.class) + ")"),
|
.description("State of the migration. (" + describeEnumValues(MigrationState.class) + ")"),
|
||||||
fieldWithPath("type")
|
fieldWithPath("type")
|
||||||
.description("Type of the migration. (" + describeEnumValues(MigrationType.class) + ")"),
|
.description("Type of the migration. (" + describeEnumValues(MigrationType.class) + ")"),
|
||||||
fieldWithPath("version")
|
fieldWithPath("version").description("Version of the database after applying the migration, if any.")
|
||||||
.description("Version of the database after applying the migration, " + "if any.").optional());
|
.optional());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
|
@ -59,8 +59,7 @@ class HealthEndpointDocumentationTests extends MockMvcEndpointDocumentationTests
|
|||||||
|
|
||||||
private static final List<FieldDescriptor> componentFields = Arrays.asList(
|
private static final List<FieldDescriptor> componentFields = Arrays.asList(
|
||||||
fieldWithPath("status").description("Status of a specific part of the application"),
|
fieldWithPath("status").description("Status of a specific part of the application"),
|
||||||
subsectionWithPath("details")
|
subsectionWithPath("details").description("Details of the health of a specific part of the application."));
|
||||||
.description("Details of the health of a specific part of the" + " application."));
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void health() throws Exception {
|
void health() throws Exception {
|
||||||
@ -71,7 +70,7 @@ class HealthEndpointDocumentationTests extends MockMvcEndpointDocumentationTests
|
|||||||
+ "`management.endpoint.health.show-details`)."),
|
+ "`management.endpoint.health.show-details`)."),
|
||||||
fieldWithPath("details.*.status").description("Status of a specific part of the application."),
|
fieldWithPath("details.*.status").description("Status of a specific part of the application."),
|
||||||
subsectionWithPath("details.*.details")
|
subsectionWithPath("details.*.details")
|
||||||
.description("Details of the health of a specific part of the" + " application."))));
|
.description("Details of the health of a specific part of the application."))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -48,7 +48,7 @@ class LiquibaseEndpointDocumentationTests extends MockMvcEndpointDocumentationTe
|
|||||||
@Test
|
@Test
|
||||||
void liquibase() throws Exception {
|
void liquibase() throws Exception {
|
||||||
FieldDescriptor changeSetsField = fieldWithPath("contexts.*.liquibaseBeans.*.changeSets")
|
FieldDescriptor changeSetsField = fieldWithPath("contexts.*.liquibaseBeans.*.changeSets")
|
||||||
.description("Change sets made by the Liquibase beans, keyed by " + "bean name.");
|
.description("Change sets made by the Liquibase beans, keyed by bean name.");
|
||||||
this.mockMvc.perform(get("/actuator/liquibase")).andExpect(status().isOk())
|
this.mockMvc.perform(get("/actuator/liquibase")).andExpect(status().isOk())
|
||||||
.andDo(MockMvcRestDocumentation.document("liquibase",
|
.andDo(MockMvcRestDocumentation.document("liquibase",
|
||||||
responseFields(fieldWithPath("contexts").description("Application contexts keyed by id"),
|
responseFields(fieldWithPath("contexts").description("Application contexts keyed by id"),
|
||||||
|
@ -85,7 +85,7 @@ class LoggersEndpointDocumentationTests extends MockMvcEndpointDocumentationTest
|
|||||||
.contentType(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
.andExpect(status().isNoContent())
|
.andExpect(status().isNoContent())
|
||||||
.andDo(MockMvcRestDocumentation.document("loggers/set", requestFields(fieldWithPath("configuredLevel")
|
.andDo(MockMvcRestDocumentation.document("loggers/set", requestFields(fieldWithPath("configuredLevel")
|
||||||
.description("Level for the logger. May be" + " omitted to clear the level.").optional())));
|
.description("Level for the logger. May be omitted to clear the level.").optional())));
|
||||||
verify(this.loggingSystem).setLogLevel("com.example", LogLevel.DEBUG);
|
verify(this.loggingSystem).setLogLevel("com.example", LogLevel.DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,23 +100,23 @@ class MappingsEndpointReactiveDocumentationTests extends AbstractEndpointDocumen
|
|||||||
requestMappingConditionField(".produces.[].negated").description("Whether the media type is negated."));
|
requestMappingConditionField(".produces.[].negated").description("Whether the media type is negated."));
|
||||||
List<FieldDescriptor> handlerMethod = Arrays.asList(
|
List<FieldDescriptor> handlerMethod = Arrays.asList(
|
||||||
fieldWithPath("*.[].details.handlerMethod").optional().type(JsonFieldType.OBJECT)
|
fieldWithPath("*.[].details.handlerMethod").optional().type(JsonFieldType.OBJECT)
|
||||||
.description("Details of the method, if any, " + "that will handle requests to this mapping."),
|
.description("Details of the method, if any, that will handle requests to this mapping."),
|
||||||
fieldWithPath("*.[].details.handlerMethod.className").type(JsonFieldType.STRING)
|
fieldWithPath("*.[].details.handlerMethod.className").type(JsonFieldType.STRING)
|
||||||
.description("Fully qualified name of the class of the method."),
|
.description("Fully qualified name of the class of the method."),
|
||||||
fieldWithPath("*.[].details.handlerMethod.name").type(JsonFieldType.STRING)
|
fieldWithPath("*.[].details.handlerMethod.name").type(JsonFieldType.STRING)
|
||||||
.description("Name of the method."),
|
.description("Name of the method."),
|
||||||
fieldWithPath("*.[].details.handlerMethod.descriptor").type(JsonFieldType.STRING)
|
fieldWithPath("*.[].details.handlerMethod.descriptor").type(JsonFieldType.STRING)
|
||||||
.description("Descriptor of the method as specified in the Java " + "Language Specification."));
|
.description("Descriptor of the method as specified in the Java Language Specification."));
|
||||||
List<FieldDescriptor> handlerFunction = Arrays.asList(
|
List<FieldDescriptor> handlerFunction = Arrays.asList(
|
||||||
fieldWithPath("*.[].details.handlerFunction").optional().type(JsonFieldType.OBJECT).description(
|
fieldWithPath("*.[].details.handlerFunction").optional().type(JsonFieldType.OBJECT)
|
||||||
"Details of the function, if any, that will handle " + "requests to this mapping."),
|
.description("Details of the function, if any, that will handle requests to this mapping."),
|
||||||
fieldWithPath("*.[].details.handlerFunction.className").type(JsonFieldType.STRING)
|
fieldWithPath("*.[].details.handlerFunction.className").type(JsonFieldType.STRING)
|
||||||
.description("Fully qualified name of the class of the function."));
|
.description("Fully qualified name of the class of the function."));
|
||||||
List<FieldDescriptor> dispatcherHandlerFields = new ArrayList<>(Arrays.asList(
|
List<FieldDescriptor> dispatcherHandlerFields = new ArrayList<>(Arrays.asList(
|
||||||
fieldWithPath("*").description(
|
fieldWithPath("*")
|
||||||
"Dispatcher handler mappings, if any, keyed by " + "dispatcher handler bean name."),
|
.description("Dispatcher handler mappings, if any, keyed by dispatcher handler bean name."),
|
||||||
fieldWithPath("*.[].details").optional().type(JsonFieldType.OBJECT)
|
fieldWithPath("*.[].details").optional().type(JsonFieldType.OBJECT)
|
||||||
.description("Additional implementation-specific " + "details about the mapping. Optional."),
|
.description("Additional implementation-specific details about the mapping. Optional."),
|
||||||
fieldWithPath("*.[].handler").description("Handler for the mapping."),
|
fieldWithPath("*.[].handler").description("Handler for the mapping."),
|
||||||
fieldWithPath("*.[].predicate").description("Predicate for the mapping.")));
|
fieldWithPath("*.[].predicate").description("Predicate for the mapping.")));
|
||||||
dispatcherHandlerFields.addAll(requestMappingConditions);
|
dispatcherHandlerFields.addAll(requestMappingConditions);
|
||||||
|
@ -89,10 +89,10 @@ class MappingsEndpointServletDocumentationTests extends AbstractEndpointDocument
|
|||||||
.description("Dispatcher handler mappings, if any.").optional().type(JsonFieldType.OBJECT),
|
.description("Dispatcher handler mappings, if any.").optional().type(JsonFieldType.OBJECT),
|
||||||
parentIdField());
|
parentIdField());
|
||||||
List<FieldDescriptor> dispatcherServletFields = new ArrayList<>(Arrays.asList(
|
List<FieldDescriptor> dispatcherServletFields = new ArrayList<>(Arrays.asList(
|
||||||
fieldWithPath("*").description(
|
fieldWithPath("*")
|
||||||
"Dispatcher servlet mappings, if any, keyed by " + "dispatcher servlet bean name."),
|
.description("Dispatcher servlet mappings, if any, keyed by dispatcher servlet bean name."),
|
||||||
fieldWithPath("*.[].details").optional().type(JsonFieldType.OBJECT)
|
fieldWithPath("*.[].details").optional().type(JsonFieldType.OBJECT)
|
||||||
.description("Additional implementation-specific " + "details about the mapping. Optional."),
|
.description("Additional implementation-specific details about the mapping. Optional."),
|
||||||
fieldWithPath("*.[].handler").description("Handler for the mapping."),
|
fieldWithPath("*.[].handler").description("Handler for the mapping."),
|
||||||
fieldWithPath("*.[].predicate").description("Predicate for the mapping.")));
|
fieldWithPath("*.[].predicate").description("Predicate for the mapping.")));
|
||||||
List<FieldDescriptor> requestMappingConditions = Arrays.asList(
|
List<FieldDescriptor> requestMappingConditions = Arrays.asList(
|
||||||
@ -117,12 +117,12 @@ class MappingsEndpointServletDocumentationTests extends AbstractEndpointDocument
|
|||||||
requestMappingConditionField(".produces.[].negated").description("Whether the media type is negated."));
|
requestMappingConditionField(".produces.[].negated").description("Whether the media type is negated."));
|
||||||
List<FieldDescriptor> handlerMethod = Arrays.asList(
|
List<FieldDescriptor> handlerMethod = Arrays.asList(
|
||||||
fieldWithPath("*.[].details.handlerMethod").optional().type(JsonFieldType.OBJECT)
|
fieldWithPath("*.[].details.handlerMethod").optional().type(JsonFieldType.OBJECT)
|
||||||
.description("Details of the method, if any, " + "that will handle requests to this mapping."),
|
.description("Details of the method, if any, that will handle requests to this mapping."),
|
||||||
fieldWithPath("*.[].details.handlerMethod.className")
|
fieldWithPath("*.[].details.handlerMethod.className")
|
||||||
.description("Fully qualified name of the class of the method."),
|
.description("Fully qualified name of the class of the method."),
|
||||||
fieldWithPath("*.[].details.handlerMethod.name").description("Name of the method."),
|
fieldWithPath("*.[].details.handlerMethod.name").description("Name of the method."),
|
||||||
fieldWithPath("*.[].details.handlerMethod.descriptor")
|
fieldWithPath("*.[].details.handlerMethod.descriptor")
|
||||||
.description("Descriptor of the method as specified in the Java " + "Language Specification."));
|
.description("Descriptor of the method as specified in the Java Language Specification."));
|
||||||
dispatcherServletFields.addAll(handlerMethod);
|
dispatcherServletFields.addAll(handlerMethod);
|
||||||
dispatcherServletFields.addAll(requestMappingConditions);
|
dispatcherServletFields.addAll(requestMappingConditions);
|
||||||
this.client.get().uri("/actuator/mappings").exchange().expectBody()
|
this.client.get().uri("/actuator/mappings").exchange().expectBody()
|
||||||
|
@ -52,27 +52,27 @@ class ScheduledTasksEndpointDocumentationTests extends MockMvcEndpointDocumentat
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void scheduledTasks() throws Exception {
|
void scheduledTasks() throws Exception {
|
||||||
this.mockMvc.perform(get("/actuator/scheduledtasks")).andExpect(status().isOk()).andDo(document(
|
this.mockMvc.perform(get("/actuator/scheduledtasks")).andExpect(status().isOk())
|
||||||
"scheduled-tasks",
|
.andDo(document("scheduled-tasks",
|
||||||
preprocessResponse(replacePattern(
|
preprocessResponse(replacePattern(
|
||||||
Pattern.compile("org.*\\.ScheduledTasksEndpointDocumentationTests\\$" + "TestConfiguration"),
|
Pattern.compile("org.*\\.ScheduledTasksEndpointDocumentationTests\\$TestConfiguration"),
|
||||||
"com.example.Processor")),
|
"com.example.Processor")),
|
||||||
responseFields(fieldWithPath("cron").description("Cron tasks, if any."),
|
responseFields(fieldWithPath("cron").description("Cron tasks, if any."),
|
||||||
targetFieldWithPrefix("cron.[]."),
|
targetFieldWithPrefix("cron.[]."),
|
||||||
fieldWithPath("cron.[].expression").description("Cron expression."),
|
fieldWithPath("cron.[].expression").description("Cron expression."),
|
||||||
fieldWithPath("fixedDelay").description("Fixed delay tasks, if any."),
|
fieldWithPath("fixedDelay").description("Fixed delay tasks, if any."),
|
||||||
targetFieldWithPrefix("fixedDelay.[]."), initialDelayWithPrefix("fixedDelay.[]."),
|
targetFieldWithPrefix("fixedDelay.[]."), initialDelayWithPrefix("fixedDelay.[]."),
|
||||||
fieldWithPath("fixedDelay.[].interval")
|
fieldWithPath("fixedDelay.[].interval")
|
||||||
.description("Interval, in milliseconds, between the end of the last"
|
.description("Interval, in milliseconds, between the end of the last"
|
||||||
+ " execution and the start of the next."),
|
+ " execution and the start of the next."),
|
||||||
fieldWithPath("fixedRate").description("Fixed rate tasks, if any."),
|
fieldWithPath("fixedRate").description("Fixed rate tasks, if any."),
|
||||||
targetFieldWithPrefix("fixedRate.[]."),
|
targetFieldWithPrefix("fixedRate.[]."),
|
||||||
fieldWithPath("fixedRate.[].interval")
|
fieldWithPath("fixedRate.[].interval")
|
||||||
.description("Interval, in milliseconds, between the start of each execution."),
|
.description("Interval, in milliseconds, between the start of each execution."),
|
||||||
initialDelayWithPrefix("fixedRate.[]."),
|
initialDelayWithPrefix("fixedRate.[]."),
|
||||||
fieldWithPath("custom").description("Tasks with custom triggers, if any."),
|
fieldWithPath("custom").description("Tasks with custom triggers, if any."),
|
||||||
targetFieldWithPrefix("custom.[]."),
|
targetFieldWithPrefix("custom.[]."),
|
||||||
fieldWithPath("custom.[].trigger").description("Trigger for the task."))))
|
fieldWithPath("custom.[].trigger").description("Trigger for the task."))))
|
||||||
.andDo(MockMvcResultHandlers.print());
|
.andDo(MockMvcResultHandlers.print());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,8 +70,8 @@ class SessionsEndpointDocumentationTests extends MockMvcEndpointDocumentationTes
|
|||||||
fieldWithPath("attributeNames").description("Names of the attributes stored in the session."),
|
fieldWithPath("attributeNames").description("Names of the attributes stored in the session."),
|
||||||
fieldWithPath("creationTime").description("Timestamp of when the session was created."),
|
fieldWithPath("creationTime").description("Timestamp of when the session was created."),
|
||||||
fieldWithPath("lastAccessedTime").description("Timestamp of when the session was last accessed."),
|
fieldWithPath("lastAccessedTime").description("Timestamp of when the session was last accessed."),
|
||||||
fieldWithPath("maxInactiveInterval").description(
|
fieldWithPath("maxInactiveInterval")
|
||||||
"Maximum permitted period of inactivity, in seconds, " + "before the session will expire."),
|
.description("Maximum permitted period of inactivity, in seconds, before the session will expire."),
|
||||||
fieldWithPath("expired").description("Whether the session has expired."));
|
fieldWithPath("expired").description("Whether the session has expired."));
|
||||||
|
|
||||||
@MockBean
|
@MockBean
|
||||||
|
@ -69,14 +69,14 @@ class ThreadDumpEndpointDocumentationTests extends MockMvcEndpointDocumentationT
|
|||||||
.document("threaddump/json", preprocessResponse(limit("threads")),
|
.document("threaddump/json", preprocessResponse(limit("threads")),
|
||||||
responseFields(fieldWithPath("threads").description("JVM's threads."),
|
responseFields(fieldWithPath("threads").description("JVM's threads."),
|
||||||
fieldWithPath("threads.[].blockedCount").description(
|
fieldWithPath("threads.[].blockedCount").description(
|
||||||
"Total number of times that the thread has been " + "blocked."),
|
"Total number of times that the thread has been blocked."),
|
||||||
fieldWithPath("threads.[].blockedTime").description(
|
fieldWithPath("threads.[].blockedTime").description(
|
||||||
"Time in milliseconds that the thread has spent "
|
"Time in milliseconds that the thread has spent "
|
||||||
+ "blocked. -1 if thread contention "
|
+ "blocked. -1 if thread contention "
|
||||||
+ "monitoring is disabled."),
|
+ "monitoring is disabled."),
|
||||||
fieldWithPath("threads.[].daemon")
|
fieldWithPath("threads.[].daemon")
|
||||||
.description("Whether the thread is a daemon "
|
.description("Whether the thread is a daemon "
|
||||||
+ "thread. Only available on Java 9 or " + "later.")
|
+ "thread. Only available on Java 9 or later.")
|
||||||
.optional().type(JsonFieldType.BOOLEAN),
|
.optional().type(JsonFieldType.BOOLEAN),
|
||||||
fieldWithPath("threads.[].inNative")
|
fieldWithPath("threads.[].inNative")
|
||||||
.description("Whether the thread is executing native code."),
|
.description("Whether the thread is executing native code."),
|
||||||
@ -85,12 +85,10 @@ class ThreadDumpEndpointDocumentationTests extends MockMvcEndpointDocumentationT
|
|||||||
+ "thread is blocked, if any.")
|
+ "thread is blocked, if any.")
|
||||||
.optional().type(JsonFieldType.STRING),
|
.optional().type(JsonFieldType.STRING),
|
||||||
fieldWithPath("threads.[].lockInfo")
|
fieldWithPath("threads.[].lockInfo")
|
||||||
.description(
|
.description("Object for which the thread is blocked waiting.")
|
||||||
"Object for which the thread is blocked " + "waiting.")
|
|
||||||
.optional().type(JsonFieldType.OBJECT),
|
.optional().type(JsonFieldType.OBJECT),
|
||||||
fieldWithPath("threads.[].lockInfo.className")
|
fieldWithPath("threads.[].lockInfo.className")
|
||||||
.description(
|
.description("Fully qualified class name of the lock object.")
|
||||||
"Fully qualified class name of the lock" + " object.")
|
|
||||||
.optional().type(JsonFieldType.STRING),
|
.optional().type(JsonFieldType.STRING),
|
||||||
fieldWithPath("threads.[].lockInfo.identityHashCode")
|
fieldWithPath("threads.[].lockInfo.identityHashCode")
|
||||||
.description("Identity hash code of the lock object.")
|
.description("Identity hash code of the lock object.")
|
||||||
@ -101,22 +99,21 @@ class ThreadDumpEndpointDocumentationTests extends MockMvcEndpointDocumentationT
|
|||||||
.description("Class name of the lock object.").optional()
|
.description("Class name of the lock object.").optional()
|
||||||
.type(JsonFieldType.STRING),
|
.type(JsonFieldType.STRING),
|
||||||
fieldWithPath("threads.[].lockedMonitors.[].identityHashCode")
|
fieldWithPath("threads.[].lockedMonitors.[].identityHashCode")
|
||||||
.description("Identity hash code of the lock " + "object.")
|
.description("Identity hash code of the lock object.")
|
||||||
.optional().type(JsonFieldType.NUMBER),
|
.optional().type(JsonFieldType.NUMBER),
|
||||||
fieldWithPath("threads.[].lockedMonitors.[].lockedStackDepth")
|
fieldWithPath("threads.[].lockedMonitors.[].lockedStackDepth")
|
||||||
.description("Stack depth where the monitor " + "was locked.")
|
.description("Stack depth where the monitor was locked.")
|
||||||
.optional().type(JsonFieldType.NUMBER),
|
.optional().type(JsonFieldType.NUMBER),
|
||||||
subsectionWithPath("threads.[].lockedMonitors.[].lockedStackFrame")
|
subsectionWithPath("threads.[].lockedMonitors.[].lockedStackFrame")
|
||||||
.description("Stack frame that locked the " + "monitor.")
|
.description("Stack frame that locked the monitor.").optional()
|
||||||
.optional().type(JsonFieldType.OBJECT),
|
.type(JsonFieldType.OBJECT),
|
||||||
fieldWithPath("threads.[].lockedSynchronizers")
|
fieldWithPath("threads.[].lockedSynchronizers")
|
||||||
.description("Synchronizers locked by this thread."),
|
.description("Synchronizers locked by this thread."),
|
||||||
fieldWithPath("threads.[].lockedSynchronizers.[].className")
|
fieldWithPath("threads.[].lockedSynchronizers.[].className")
|
||||||
.description("Class name of the locked " + "synchronizer.")
|
.description("Class name of the locked synchronizer.")
|
||||||
.optional().type(JsonFieldType.STRING),
|
.optional().type(JsonFieldType.STRING),
|
||||||
fieldWithPath("threads.[].lockedSynchronizers.[].identityHashCode")
|
fieldWithPath("threads.[].lockedSynchronizers.[].identityHashCode")
|
||||||
.description(
|
.description("Identity hash code of the locked synchronizer.")
|
||||||
"Identity hash code of the locked " + "synchronizer.")
|
|
||||||
.optional().type(JsonFieldType.NUMBER),
|
.optional().type(JsonFieldType.NUMBER),
|
||||||
fieldWithPath("threads.[].lockOwnerId")
|
fieldWithPath("threads.[].lockOwnerId")
|
||||||
.description("ID of the thread that owns the object on which "
|
.description("ID of the thread that owns the object on which "
|
||||||
@ -124,7 +121,7 @@ class ThreadDumpEndpointDocumentationTests extends MockMvcEndpointDocumentationT
|
|||||||
+ "thread is not blocked."),
|
+ "thread is not blocked."),
|
||||||
fieldWithPath("threads.[].lockOwnerName")
|
fieldWithPath("threads.[].lockOwnerName")
|
||||||
.description("Name of the thread that owns the "
|
.description("Name of the thread that owns the "
|
||||||
+ "object on which the thread is " + "blocked, if any.")
|
+ "object on which the thread is blocked, if any.")
|
||||||
.optional().type(JsonFieldType.STRING),
|
.optional().type(JsonFieldType.STRING),
|
||||||
fieldWithPath("threads.[].priority")
|
fieldWithPath("threads.[].priority")
|
||||||
.description("Priority of the thread. Only "
|
.description("Priority of the thread. Only "
|
||||||
@ -136,11 +133,11 @@ class ThreadDumpEndpointDocumentationTests extends MockMvcEndpointDocumentationT
|
|||||||
.description("Name of the class loader of the "
|
.description("Name of the class loader of the "
|
||||||
+ "class that contains the execution "
|
+ "class that contains the execution "
|
||||||
+ "point identified by this entry, if "
|
+ "point identified by this entry, if "
|
||||||
+ "any. Only available on Java 9 or " + "later.")
|
+ "any. Only available on Java 9 or later.")
|
||||||
.optional().type(JsonFieldType.STRING),
|
.optional().type(JsonFieldType.STRING),
|
||||||
fieldWithPath("threads.[].stackTrace.[].className")
|
fieldWithPath("threads.[].stackTrace.[].className")
|
||||||
.description("Name of the class that contains the "
|
.description("Name of the class that contains the "
|
||||||
+ "execution point identified " + "by this entry."),
|
+ "execution point identified by this entry."),
|
||||||
fieldWithPath("threads.[].stackTrace.[].fileName")
|
fieldWithPath("threads.[].stackTrace.[].fileName")
|
||||||
.description("Name of the source file that "
|
.description("Name of the source file that "
|
||||||
+ "contains the execution point "
|
+ "contains the execution point "
|
||||||
@ -164,8 +161,8 @@ class ThreadDumpEndpointDocumentationTests extends MockMvcEndpointDocumentationT
|
|||||||
+ "identified by this entry, if any. "
|
+ "identified by this entry, if any. "
|
||||||
+ "Only available on Java 9 or later.")
|
+ "Only available on Java 9 or later.")
|
||||||
.optional().type(JsonFieldType.STRING),
|
.optional().type(JsonFieldType.STRING),
|
||||||
fieldWithPath("threads.[].stackTrace.[].nativeMethod").description(
|
fieldWithPath("threads.[].stackTrace.[].nativeMethod")
|
||||||
"Whether the execution point is a native " + "method."),
|
.description("Whether the execution point is a native method."),
|
||||||
fieldWithPath("threads.[].suspended")
|
fieldWithPath("threads.[].suspended")
|
||||||
.description("Whether the thread is suspended."),
|
.description("Whether the thread is suspended."),
|
||||||
fieldWithPath("threads.[].threadId").description("ID of the thread."),
|
fieldWithPath("threads.[].threadId").description("ID of the thread."),
|
||||||
|
@ -177,7 +177,7 @@ class WebMvcEndpointExposureIntegrationTests {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
String.format("Unexpected %s HTTP status for " + "endpoint %s", result.getStatus(), path));
|
String.format("Unexpected %s HTTP status for endpoint %s", result.getStatus(), path));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RestControllerEndpoint(id = "custommvc")
|
@RestControllerEndpoint(id = "custommvc")
|
||||||
|
@ -91,7 +91,7 @@ class LiquibaseEndpointAutoConfigurationTests {
|
|||||||
public void setCloseDataSourceOnceMigrated(boolean closeDataSourceOnceMigrated) {
|
public void setCloseDataSourceOnceMigrated(boolean closeDataSourceOnceMigrated) {
|
||||||
if (this.propertiesSet) {
|
if (this.propertiesSet) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"setCloseDataSourceOnceMigrated " + "invoked after afterPropertiesSet");
|
"setCloseDataSourceOnceMigrated invoked after afterPropertiesSet");
|
||||||
}
|
}
|
||||||
super.setCloseDataSourceOnceMigrated(closeDataSourceOnceMigrated);
|
super.setCloseDataSourceOnceMigrated(closeDataSourceOnceMigrated);
|
||||||
}
|
}
|
||||||
|
@ -89,8 +89,7 @@ class RestTemplateMetricsConfigurationTests {
|
|||||||
this.contextRunner.withPropertyValues("management.metrics.web.client.max-uri-tags=5").run((context) -> {
|
this.contextRunner.withPropertyValues("management.metrics.web.client.max-uri-tags=5").run((context) -> {
|
||||||
MeterRegistry registry = getInitializedMeterRegistry(context);
|
MeterRegistry registry = getInitializedMeterRegistry(context);
|
||||||
assertThat(registry.get("http.client.requests").meters()).hasSize(3);
|
assertThat(registry.get("http.client.requests").meters()).hasSize(3);
|
||||||
assertThat(output)
|
assertThat(output).doesNotContain("Reached the maximum number of URI tags for 'http.client.requests'.")
|
||||||
.doesNotContain("Reached the maximum number of URI tags for 'http.client.requests'.")
|
|
||||||
.doesNotContain("Are you using 'uriVariables'?");
|
.doesNotContain("Are you using 'uriVariables'?");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -88,8 +88,7 @@ class WebClientMetricsConfigurationTests {
|
|||||||
this.contextRunner.withPropertyValues("management.metrics.web.client.max-uri-tags=5").run((context) -> {
|
this.contextRunner.withPropertyValues("management.metrics.web.client.max-uri-tags=5").run((context) -> {
|
||||||
MeterRegistry registry = getInitializedMeterRegistry(context);
|
MeterRegistry registry = getInitializedMeterRegistry(context);
|
||||||
assertThat(registry.get("http.client.requests").meters()).hasSize(3);
|
assertThat(registry.get("http.client.requests").meters()).hasSize(3);
|
||||||
assertThat(output)
|
assertThat(output).doesNotContain("Reached the maximum number of URI tags for 'http.client.requests'.")
|
||||||
.doesNotContain("Reached the maximum number of URI tags for 'http.client.requests'.")
|
|
||||||
.doesNotContain("Are you using 'uriVariables'?");
|
.doesNotContain("Are you using 'uriVariables'?");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ class WebMvcMetricsAutoConfigurationTests {
|
|||||||
MeterRegistry registry = getInitializedMeterRegistry(context);
|
MeterRegistry registry = getInitializedMeterRegistry(context);
|
||||||
assertThat(registry.get("http.server.requests").meters()).hasSize(3);
|
assertThat(registry.get("http.server.requests").meters()).hasSize(3);
|
||||||
assertThat(output)
|
assertThat(output)
|
||||||
.doesNotContain("Reached the maximum number of URI tags " + "for 'http.server.requests'");
|
.doesNotContain("Reached the maximum number of URI tags for 'http.server.requests'");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ public class NonUniqueCacheException extends RuntimeException {
|
|||||||
private final Collection<String> cacheManagerNames;
|
private final Collection<String> cacheManagerNames;
|
||||||
|
|
||||||
public NonUniqueCacheException(String cacheName, Collection<String> cacheManagerNames) {
|
public NonUniqueCacheException(String cacheName, Collection<String> cacheManagerNames) {
|
||||||
super(String.format("Multiple caches named %s found, specify the 'cacheManager' " + "to use: %s", cacheName,
|
super(String.format("Multiple caches named %s found, specify the 'cacheManager' to use: %s", cacheName,
|
||||||
cacheManagerNames));
|
cacheManagerNames));
|
||||||
this.cacheName = cacheName;
|
this.cacheName = cacheName;
|
||||||
this.cacheManagerNames = Collections.unmodifiableCollection(cacheManagerNames);
|
this.cacheManagerNames = Collections.unmodifiableCollection(cacheManagerNames);
|
||||||
|
@ -326,7 +326,7 @@ public class ConfigurationPropertiesReportEndpoint implements ApplicationContext
|
|||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("Skipping '" + writer.getFullName() + "' on '" + pojo.getClass().getName()
|
logger.debug("Skipping '" + writer.getFullName() + "' on '" + pojo.getClass().getName()
|
||||||
+ "' as an exception " + "was thrown when retrieving its value", ex);
|
+ "' as an exception was thrown when retrieving its value", ex);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ public final class MissingParametersException extends InvalidEndpointRequestExce
|
|||||||
private final Set<OperationParameter> missingParameters;
|
private final Set<OperationParameter> missingParameters;
|
||||||
|
|
||||||
public MissingParametersException(Set<OperationParameter> missingParameters) {
|
public MissingParametersException(Set<OperationParameter> missingParameters) {
|
||||||
super("Failed to invoke operation because the following required " + "parameters were missing: "
|
super("Failed to invoke operation because the following required parameters were missing: "
|
||||||
+ StringUtils.collectionToCommaDelimitedString(missingParameters),
|
+ StringUtils.collectionToCommaDelimitedString(missingParameters),
|
||||||
"Missing parameters: "
|
"Missing parameters: "
|
||||||
+ missingParameters.stream().map(OperationParameter::getName).collect(Collectors.joining(",")));
|
+ missingParameters.stream().map(OperationParameter::getName).collect(Collectors.joining(",")));
|
||||||
|
@ -113,7 +113,7 @@ public class JmxEndpointExporter implements InitializingBean, DisposableBean, Be
|
|||||||
private void unregister(ObjectName objectName) {
|
private void unregister(ObjectName objectName) {
|
||||||
try {
|
try {
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("Unregister endpoint with ObjectName '" + objectName + "' " + "from the JMX domain");
|
logger.debug("Unregister endpoint with ObjectName '" + objectName + "' from the JMX domain");
|
||||||
}
|
}
|
||||||
this.mBeanServer.unregisterMBean(objectName);
|
this.mBeanServer.unregisterMBean(objectName);
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ public class MetricsEndpoint {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "MeasurementSample{" + "statistic=" + this.statistic + ", value=" + this.value + '}';
|
return "MeasurementSample{statistic=" + this.statistic + ", value=" + this.value + '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ public class DiskSpaceHealthIndicator extends AbstractHealthIndicator {
|
|||||||
builder.up();
|
builder.up();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
logger.warn(String.format("Free disk space below threshold. " + "Available: %d bytes (threshold: %s)",
|
logger.warn(String.format("Free disk space below threshold. Available: %d bytes (threshold: %s)",
|
||||||
diskFreeInBytes, this.threshold));
|
diskFreeInBytes, this.threshold));
|
||||||
builder.down();
|
builder.down();
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ class ElasticsearchJestHealthIndicatorTests {
|
|||||||
status);
|
status);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
json = "{\n" + " \"error\": \"Server Error\",\n" + " \"status\": \"" + status + "\"\n" + "}";
|
json = "{\n \"error\": \"Server Error\",\n \"status\": \"" + status + "\"\n}";
|
||||||
}
|
}
|
||||||
searchResult.setJsonString(json);
|
searchResult.setJsonString(json);
|
||||||
searchResult.setJsonObject(new JsonParser().parse(json).getAsJsonObject());
|
searchResult.setJsonObject(new JsonParser().parse(json).getAsJsonObject());
|
||||||
|
@ -137,7 +137,7 @@ class ElasticsearchRestHealthIndicatorTest {
|
|||||||
+ "\"task_max_waiting_in_queue_millis\":0,\"active_shards_percent_as_number\":100.0}",
|
+ "\"task_max_waiting_in_queue_millis\":0,\"active_shards_percent_as_number\":100.0}",
|
||||||
status);
|
status);
|
||||||
}
|
}
|
||||||
return "{\n" + " \"error\": \"Server Error\",\n" + " \"status\": " + responseCode + "\n" + "}";
|
return "{\n \"error\": \"Server Error\",\n \"status\": " + responseCode + "\n}";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ class WebEndpointDiscovererTests {
|
|||||||
load(TestWebEndpointExtensionConfiguration.class,
|
load(TestWebEndpointExtensionConfiguration.class,
|
||||||
(discoverer) -> assertThatIllegalStateException().isThrownBy(discoverer::getEndpoints)
|
(discoverer) -> assertThatIllegalStateException().isThrownBy(discoverer::getEndpoints)
|
||||||
.withMessageContaining(
|
.withMessageContaining(
|
||||||
"Invalid extension 'endpointExtension': no endpoint found with id '" + "test'"));
|
"Invalid extension 'endpointExtension': no endpoint found with id 'test'"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -82,7 +82,7 @@ class CompositeHealthIndicatorTests {
|
|||||||
assertThat(mapper.writeValueAsString(result))
|
assertThat(mapper.writeValueAsString(result))
|
||||||
.isEqualTo("{\"status\":\"UNKNOWN\",\"details\":{\"db\":{\"status\":\"UNKNOWN\""
|
.isEqualTo("{\"status\":\"UNKNOWN\",\"details\":{\"db\":{\"status\":\"UNKNOWN\""
|
||||||
+ ",\"details\":{\"db1\":{\"status\":\"UNKNOWN\",\"details\""
|
+ ",\"details\":{\"db1\":{\"status\":\"UNKNOWN\",\"details\""
|
||||||
+ ":{\"1\":\"1\"}},\"db2\":{\"status\":\"UNKNOWN\",\"details\"" + ":{\"2\":\"2\"}}}}}}");
|
+ ":{\"1\":\"1\"}},\"db2\":{\"status\":\"UNKNOWN\",\"details\":{\"2\":\"2\"}}}}}}");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ public class AutoConfigurationImportSelector implements DeferredImportSelector,
|
|||||||
message.append("\t- ").append(exclude).append(String.format("%n"));
|
message.append("\t- ").append(exclude).append(String.format("%n"));
|
||||||
}
|
}
|
||||||
throw new IllegalStateException(String.format(
|
throw new IllegalStateException(String.format(
|
||||||
"The following classes could not be excluded because they are" + " not auto-configuration classes:%n%s",
|
"The following classes could not be excluded because they are not auto-configuration classes:%n%s",
|
||||||
message));
|
message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ import org.springframework.util.StringUtils;
|
|||||||
*/
|
*/
|
||||||
final class AutoConfigurationMetadataLoader {
|
final class AutoConfigurationMetadataLoader {
|
||||||
|
|
||||||
protected static final String PATH = "META-INF/" + "spring-autoconfigure-metadata.properties";
|
protected static final String PATH = "META-INF/spring-autoconfigure-metadata.properties";
|
||||||
|
|
||||||
private AutoConfigurationMetadataLoader() {
|
private AutoConfigurationMetadataLoader() {
|
||||||
}
|
}
|
||||||
|
@ -196,8 +196,8 @@ public abstract class AutoConfigurationPackages {
|
|||||||
else {
|
else {
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
String packageNames = StringUtils.collectionToCommaDelimitedString(this.packages);
|
String packageNames = StringUtils.collectionToCommaDelimitedString(this.packages);
|
||||||
logger.debug("@EnableAutoConfiguration was declared on a class " + "in the package '"
|
logger.debug("@EnableAutoConfiguration was declared on a class in the package '" + packageNames
|
||||||
+ packageNames + "'. Automatic @Repository and @Entity scanning is " + "enabled.");
|
+ "'. Automatic @Repository and @Entity scanning is enabled.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.loggedBasePackageInfo = true;
|
this.loggedBasePackageInfo = true;
|
||||||
|
@ -106,8 +106,8 @@ public class CacheAutoConfiguration {
|
|||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
Assert.notNull(this.cacheManager.getIfAvailable(),
|
Assert.notNull(this.cacheManager.getIfAvailable(),
|
||||||
() -> "No cache manager could " + "be auto-configured, check your configuration (caching "
|
() -> "No cache manager could be auto-configured, check your configuration (caching " + "type is '"
|
||||||
+ "type is '" + this.cacheProperties.getType() + "')");
|
+ this.cacheProperties.getType() + "')");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -405,7 +405,7 @@ class OnBeanCondition extends FilteringSpringBootCondition implements Configurat
|
|||||||
if (ex == null) {
|
if (ex == null) {
|
||||||
throw new IllegalStateException(message);
|
throw new IllegalStateException(message);
|
||||||
}
|
}
|
||||||
throw new IllegalStateException(message + " and the attempt to deduce" + " the bean's type failed", ex);
|
throw new IllegalStateException(message + " and the attempt to deduce the bean's type failed", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class OnResourceCondition extends SpringBootCondition {
|
|||||||
List<String> locations = new ArrayList<>();
|
List<String> locations = new ArrayList<>();
|
||||||
collectValues(locations, attributes.get("resources"));
|
collectValues(locations, attributes.get("resources"));
|
||||||
Assert.isTrue(!locations.isEmpty(),
|
Assert.isTrue(!locations.isEmpty(),
|
||||||
"@ConditionalOnResource annotations must specify at " + "least one resource location");
|
"@ConditionalOnResource annotations must specify at least one resource location");
|
||||||
List<String> missing = new ArrayList<>();
|
List<String> missing = new ArrayList<>();
|
||||||
for (String location : locations) {
|
for (String location : locations) {
|
||||||
String resource = context.getEnvironment().resolvePlaceholders(location);
|
String resource = context.getEnvironment().resolvePlaceholders(location);
|
||||||
|
@ -51,7 +51,7 @@ public abstract class SpringBootCondition implements Condition {
|
|||||||
}
|
}
|
||||||
catch (NoClassDefFoundError ex) {
|
catch (NoClassDefFoundError ex) {
|
||||||
throw new IllegalStateException("Could not evaluate condition on " + classOrMethodName + " due to "
|
throw new IllegalStateException("Could not evaluate condition on " + classOrMethodName + " due to "
|
||||||
+ ex.getMessage() + " not " + "found. Make sure your own configuration does not rely on "
|
+ ex.getMessage() + " not found. Make sure your own configuration does not rely on "
|
||||||
+ "that class. This can also happen if you are "
|
+ "that class. This can also happen if you are "
|
||||||
+ "@ComponentScanning a springframework package (e.g. if you "
|
+ "@ComponentScanning a springframework package (e.g. if you "
|
||||||
+ "put a @ComponentScan in the default package by mistake)", ex);
|
+ "put a @ComponentScan in the default package by mistake)", ex);
|
||||||
|
@ -123,7 +123,7 @@ abstract class RedisConnectionConfiguration {
|
|||||||
nodes.add(new RedisNode(parts[0], Integer.valueOf(parts[1])));
|
nodes.add(new RedisNode(parts[0], Integer.valueOf(parts[1])));
|
||||||
}
|
}
|
||||||
catch (RuntimeException ex) {
|
catch (RuntimeException ex) {
|
||||||
throw new IllegalStateException("Invalid redis sentinel " + "property '" + node + "'", ex);
|
throw new IllegalStateException("Invalid redis sentinel property '" + node + "'", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nodes;
|
return nodes;
|
||||||
|
@ -86,7 +86,7 @@ public class GroovyTemplateAutoConfiguration {
|
|||||||
if (!location.exists(this.applicationContext)) {
|
if (!location.exists(this.applicationContext)) {
|
||||||
logger.warn("Cannot find template location: " + location
|
logger.warn("Cannot find template location: " + location
|
||||||
+ " (please add some templates, check your Groovy "
|
+ " (please add some templates, check your Groovy "
|
||||||
+ "configuration, or set spring.groovy.template." + "check-template-location=false)");
|
+ "configuration, or set spring.groovy.template.check-template-location=false)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ public class HazelcastProperties {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Assert.isTrue(this.config.exists(),
|
Assert.isTrue(this.config.exists(),
|
||||||
() -> "Hazelcast configuration does not " + "exist '" + this.config.getDescription() + "'");
|
() -> "Hazelcast configuration does not exist '" + this.config.getDescription() + "'");
|
||||||
return this.config;
|
return this.config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ public class HttpMessageConverters implements Iterable<HttpMessageConverter<?>>
|
|||||||
|
|
||||||
private List<HttpMessageConverter<?>> getDefaultConverters() {
|
private List<HttpMessageConverter<?>> getDefaultConverters() {
|
||||||
List<HttpMessageConverter<?>> converters = new ArrayList<>();
|
List<HttpMessageConverter<?>> converters = new ArrayList<>();
|
||||||
if (ClassUtils.isPresent("org.springframework.web.servlet.config.annotation." + "WebMvcConfigurationSupport",
|
if (ClassUtils.isPresent("org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport",
|
||||||
null)) {
|
null)) {
|
||||||
converters.addAll(new WebMvcConfigurationSupport() {
|
converters.addAll(new WebMvcConfigurationSupport() {
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ public class JacksonAutoConfiguration {
|
|||||||
if (logger.isWarnEnabled()) {
|
if (logger.isWarnEnabled()) {
|
||||||
logger.warn("spring.jackson.date-format could not be used to "
|
logger.warn("spring.jackson.date-format could not be used to "
|
||||||
+ "configure formatting of Joda's DateTime. You may want "
|
+ "configure formatting of Joda's DateTime. You may want "
|
||||||
+ "to configure spring.jackson.joda-date-time-format as " + "well.");
|
+ "to configure spring.jackson.joda-date-time-format as well.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ class DataSourceBeanCreationFailureAnalyzer extends AbstractFailureAnalyzer<Data
|
|||||||
action.append(String.format("Consider the following:%n"));
|
action.append(String.format("Consider the following:%n"));
|
||||||
if (EmbeddedDatabaseConnection.NONE == cause.getConnection()) {
|
if (EmbeddedDatabaseConnection.NONE == cause.getConnection()) {
|
||||||
action.append(String.format(
|
action.append(String.format(
|
||||||
"\tIf you want an embedded database (H2, HSQL or " + "Derby), please put it on the classpath.%n"));
|
"\tIf you want an embedded database (H2, HSQL or Derby), please put it on the classpath.%n"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
action.append(String.format("\tReview the configuration of %s%n.", cause.getConnection()));
|
action.append(String.format("\tReview the configuration of %s%n.", cause.getConnection()));
|
||||||
|
@ -37,9 +37,9 @@ class HikariDriverConfigurationFailureAnalyzer extends AbstractFailureAnalyzer<C
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new FailureAnalysis(
|
return new FailureAnalysis(
|
||||||
"Configuration of the Hikari connection pool failed: " + "'dataSourceClassName' is not supported.",
|
"Configuration of the Hikari connection pool failed: 'dataSourceClassName' is not supported.",
|
||||||
"Spring Boot auto-configures only a driver and can't specify a custom "
|
"Spring Boot auto-configures only a driver and can't specify a custom "
|
||||||
+ "DataSource. Consider configuring the Hikari DataSource in " + "your own configuration.",
|
+ "DataSource. Consider configuring the Hikari DataSource in your own configuration.",
|
||||||
cause);
|
cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ class ActiveMQConnectionFactoryFactory {
|
|||||||
return doCreateConnectionFactory(factoryClass);
|
return doCreateConnectionFactory(factoryClass);
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
throw new IllegalStateException("Unable to create " + "ActiveMQConnectionFactory", ex);
|
throw new IllegalStateException("Unable to create ActiveMQConnectionFactory", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ class ArtemisConnectionFactoryFactory {
|
|||||||
return doCreateConnectionFactory(factoryClass);
|
return doCreateConnectionFactory(factoryClass);
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
throw new IllegalStateException("Unable to create " + "ActiveMQConnectionFactory", ex);
|
throw new IllegalStateException("Unable to create ActiveMQConnectionFactory", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ class ArtemisConnectionFactoryFactory {
|
|||||||
}
|
}
|
||||||
catch (NoClassDefFoundError ex) {
|
catch (NoClassDefFoundError ex) {
|
||||||
throw new IllegalStateException("Unable to create InVM "
|
throw new IllegalStateException("Unable to create InVM "
|
||||||
+ "Artemis connection, ensure that artemis-jms-server.jar " + "is in the classpath", ex);
|
+ "Artemis connection, ensure that artemis-jms-server.jar is in the classpath", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ public class LiquibaseAutoConfiguration {
|
|||||||
if (this.properties.isCheckChangeLogLocation()) {
|
if (this.properties.isCheckChangeLogLocation()) {
|
||||||
Resource resource = this.resourceLoader.getResource(this.properties.getChangeLog());
|
Resource resource = this.resourceLoader.getResource(this.properties.getChangeLog());
|
||||||
Assert.state(resource.exists(), () -> "Cannot find changelog location: " + resource
|
Assert.state(resource.exists(), () -> "Cannot find changelog location: " + resource
|
||||||
+ " (please add changelog or check your Liquibase " + "configuration)");
|
+ " (please add changelog or check your Liquibase configuration)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ public class ConditionEvaluationReportLoggingListener
|
|||||||
public void logAutoConfigurationReport(boolean isCrashReport) {
|
public void logAutoConfigurationReport(boolean isCrashReport) {
|
||||||
if (this.report == null) {
|
if (this.report == null) {
|
||||||
if (this.applicationContext == null) {
|
if (this.applicationContext == null) {
|
||||||
this.logger.info("Unable to provide the conditions report " + "due to missing ApplicationContext");
|
this.logger.info("Unable to provide the conditions report due to missing ApplicationContext");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.report = ConditionEvaluationReport.get(this.applicationContext.getBeanFactory());
|
this.report = ConditionEvaluationReport.get(this.applicationContext.getBeanFactory());
|
||||||
|
@ -95,7 +95,7 @@ public class ReactiveMongoClientFactory {
|
|||||||
|
|
||||||
private MongoClient createCredentialNetworkMongoClient(MongoClientSettings settings) {
|
private MongoClient createCredentialNetworkMongoClient(MongoClientSettings settings) {
|
||||||
Assert.state(this.properties.getUri() == null,
|
Assert.state(this.properties.getUri() == null,
|
||||||
"Invalid mongo configuration, " + "either uri or host/port/credentials must be specified");
|
"Invalid mongo configuration, either uri or host/port/credentials must be specified");
|
||||||
Builder builder = builder(settings);
|
Builder builder = builder(settings);
|
||||||
if (hasCustomCredentials()) {
|
if (hasCustomCredentials()) {
|
||||||
applyCredentials(builder);
|
applyCredentials(builder);
|
||||||
|
@ -65,7 +65,7 @@ public class MustacheAutoConfiguration {
|
|||||||
TemplateLocation location = new TemplateLocation(this.mustache.getPrefix());
|
TemplateLocation location = new TemplateLocation(this.mustache.getPrefix());
|
||||||
if (!location.exists(this.applicationContext)) {
|
if (!location.exists(this.applicationContext)) {
|
||||||
logger.warn("Cannot find template location: " + location
|
logger.warn("Cannot find template location: " + location
|
||||||
+ " (please add some templates, check your Mustache " + "configuration, or set spring.mustache."
|
+ " (please add some templates, check your Mustache configuration, or set spring.mustache."
|
||||||
+ "check-template-location=false)");
|
+ "check-template-location=false)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,8 +182,9 @@ class HibernateJpaConfiguration extends JpaBaseConfiguration {
|
|||||||
// NoClassDefFoundError can happen if Hibernate 4.2 is used and some
|
// NoClassDefFoundError can happen if Hibernate 4.2 is used and some
|
||||||
// containers (e.g. JBoss EAP 6) wrap it in the superclass LinkageError
|
// containers (e.g. JBoss EAP 6) wrap it in the superclass LinkageError
|
||||||
if (!isUsingJndi()) {
|
if (!isUsingJndi()) {
|
||||||
throw new IllegalStateException("Unable to set Hibernate JTA " + "platform, are you using the correct "
|
throw new IllegalStateException(
|
||||||
+ "version of Hibernate?", ex);
|
"Unable to set Hibernate JTA platform, are you using the correct " + "version of Hibernate?",
|
||||||
|
ex);
|
||||||
}
|
}
|
||||||
// Assume that Hibernate will use JNDI
|
// Assume that Hibernate will use JNDI
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
|
@ -219,7 +219,7 @@ public abstract class JpaBaseConfiguration implements BeanFactoryAware {
|
|||||||
if (this.jpaProperties.getOpenInView() == null) {
|
if (this.jpaProperties.getOpenInView() == null) {
|
||||||
logger.warn("spring.jpa.open-in-view is enabled by default. "
|
logger.warn("spring.jpa.open-in-view is enabled by default. "
|
||||||
+ "Therefore, database queries may be performed during view "
|
+ "Therefore, database queries may be performed during view "
|
||||||
+ "rendering. Explicitly configure " + "spring.jpa.open-in-view to disable this warning");
|
+ "rendering. Explicitly configure spring.jpa.open-in-view to disable this warning");
|
||||||
}
|
}
|
||||||
return new OpenEntityManagerInViewInterceptor();
|
return new OpenEntityManagerInViewInterceptor();
|
||||||
}
|
}
|
||||||
|
@ -30,16 +30,15 @@ class NonUniqueSessionRepositoryFailureAnalyzer extends AbstractFailureAnalyzer<
|
|||||||
protected FailureAnalysis analyze(Throwable rootFailure, NonUniqueSessionRepositoryException cause) {
|
protected FailureAnalysis analyze(Throwable rootFailure, NonUniqueSessionRepositoryException cause) {
|
||||||
StringBuilder message = new StringBuilder();
|
StringBuilder message = new StringBuilder();
|
||||||
message.append(
|
message.append(
|
||||||
String.format("Multiple Spring Session store implementations are " + "available on the classpath:%n"));
|
String.format("Multiple Spring Session store implementations are available on the classpath:%n"));
|
||||||
for (Class<?> candidate : cause.getAvailableCandidates()) {
|
for (Class<?> candidate : cause.getAvailableCandidates()) {
|
||||||
message.append(String.format(" - %s%n", candidate.getName()));
|
message.append(String.format(" - %s%n", candidate.getName()));
|
||||||
}
|
}
|
||||||
StringBuilder action = new StringBuilder();
|
StringBuilder action = new StringBuilder();
|
||||||
action.append(String.format("Consider any of the following:%n"));
|
action.append(String.format("Consider any of the following:%n"));
|
||||||
action.append(String
|
|
||||||
.format(" - Define the `spring.session.store-type` " + "property to the store you want to use%n"));
|
|
||||||
action.append(
|
action.append(
|
||||||
String.format(" - Review your classpath and remove the unwanted " + "store implementation(s)%n"));
|
String.format(" - Define the `spring.session.store-type` property to the store you want to use%n"));
|
||||||
|
action.append(String.format(" - Review your classpath and remove the unwanted store implementation(s)%n"));
|
||||||
return new FailureAnalysis(message.toString(), action.toString(), cause);
|
return new FailureAnalysis(message.toString(), action.toString(), cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,7 +295,7 @@ public class ServerProperties {
|
|||||||
+ "169\\.254\\.\\d{1,3}\\.\\d{1,3}|" // 169.254/16
|
+ "169\\.254\\.\\d{1,3}\\.\\d{1,3}|" // 169.254/16
|
||||||
+ "127\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|" // 127/8
|
+ "127\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|" // 127/8
|
||||||
+ "172\\.1[6-9]{1}\\.\\d{1,3}\\.\\d{1,3}|" // 172.16/12
|
+ "172\\.1[6-9]{1}\\.\\d{1,3}\\.\\d{1,3}|" // 172.16/12
|
||||||
+ "172\\.2[0-9]{1}\\.\\d{1,3}\\.\\d{1,3}|" + "172\\.3[0-1]{1}\\.\\d{1,3}\\.\\d{1,3}|" //
|
+ "172\\.2[0-9]{1}\\.\\d{1,3}\\.\\d{1,3}|172\\.3[0-1]{1}\\.\\d{1,3}\\.\\d{1,3}|" //
|
||||||
+ "0:0:0:0:0:0:0:1|::1";
|
+ "0:0:0:0:0:0:0:1|::1";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -170,7 +170,7 @@ class AutoConfigurationImportSelectorTests {
|
|||||||
@Test
|
@Test
|
||||||
void nonAutoConfigurationPropertyExclusionsWhenPresentOnClassPathShouldThrowException() {
|
void nonAutoConfigurationPropertyExclusionsWhenPresentOnClassPathShouldThrowException() {
|
||||||
this.environment.setProperty("spring.autoconfigure.exclude",
|
this.environment.setProperty("spring.autoconfigure.exclude",
|
||||||
"org.springframework.boot.autoconfigure." + "AutoConfigurationImportSelectorTests.TestConfiguration");
|
"org.springframework.boot.autoconfigure.AutoConfigurationImportSelectorTests.TestConfiguration");
|
||||||
assertThatIllegalStateException().isThrownBy(() -> selectImports(BasicEnableAutoConfiguration.class));
|
assertThatIllegalStateException().isThrownBy(() -> selectImports(BasicEnableAutoConfiguration.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ class RabbitPropertiesTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void determineUsernameReturnsUsernameOfFirstAddress() {
|
void determineUsernameReturnsUsernameOfFirstAddress() {
|
||||||
this.properties.setAddresses("user:secret@rabbit1.example.com:1234/alpha," + "rabbit2.example.com:2345/bravo");
|
this.properties.setAddresses("user:secret@rabbit1.example.com:1234/alpha,rabbit2.example.com:2345/bravo");
|
||||||
assertThat(this.properties.determineUsername()).isEqualTo("user");
|
assertThat(this.properties.determineUsername()).isEqualTo("user");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ class RabbitPropertiesTests {
|
|||||||
@Test
|
@Test
|
||||||
void determineUsernameReturnsPropertyWhenFirstAddressHasNoUsername() {
|
void determineUsernameReturnsPropertyWhenFirstAddressHasNoUsername() {
|
||||||
this.properties.setUsername("alice");
|
this.properties.setUsername("alice");
|
||||||
this.properties.setAddresses("rabbit1.example.com:1234/alpha," + "user:secret@rabbit2.example.com:2345/bravo");
|
this.properties.setAddresses("rabbit1.example.com:1234/alpha,user:secret@rabbit2.example.com:2345/bravo");
|
||||||
assertThat(this.properties.determineUsername()).isEqualTo("alice");
|
assertThat(this.properties.determineUsername()).isEqualTo("alice");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ class RabbitPropertiesTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void determinePasswordReturnsPasswordOfFirstAddress() {
|
void determinePasswordReturnsPasswordOfFirstAddress() {
|
||||||
this.properties.setAddresses("user:secret@rabbit1.example.com:1234/alpha," + "rabbit2.example.com:2345/bravo");
|
this.properties.setAddresses("user:secret@rabbit1.example.com:1234/alpha,rabbit2.example.com:2345/bravo");
|
||||||
assertThat(this.properties.determinePassword()).isEqualTo("secret");
|
assertThat(this.properties.determinePassword()).isEqualTo("secret");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ class RabbitPropertiesTests {
|
|||||||
@Test
|
@Test
|
||||||
void determinePasswordReturnsPropertyWhenFirstAddressHasNoPassword() {
|
void determinePasswordReturnsPropertyWhenFirstAddressHasNoPassword() {
|
||||||
this.properties.setPassword("12345678");
|
this.properties.setPassword("12345678");
|
||||||
this.properties.setAddresses("rabbit1.example.com:1234/alpha," + "user:secret@rabbit2.example.com:2345/bravo");
|
this.properties.setAddresses("rabbit1.example.com:1234/alpha,user:secret@rabbit2.example.com:2345/bravo");
|
||||||
assertThat(this.properties.determinePassword()).isEqualTo("12345678");
|
assertThat(this.properties.determinePassword()).isEqualTo("12345678");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ public class CacheAutoConfigurationTests extends AbstractCacheAutoConfigurationT
|
|||||||
@Test
|
@Test
|
||||||
public void simpleCacheWithCustomizers() {
|
public void simpleCacheWithCustomizers() {
|
||||||
this.contextRunner.withUserConfiguration(DefaultCacheAndCustomizersConfiguration.class)
|
this.contextRunner.withUserConfiguration(DefaultCacheAndCustomizersConfiguration.class)
|
||||||
.withPropertyValues("spring.cache.type=" + "simple")
|
.withPropertyValues("spring.cache.type=simple")
|
||||||
.run(verifyCustomizers("allCacheManagerCustomizer", "simpleCacheManagerCustomizer"));
|
.run(verifyCustomizers("allCacheManagerCustomizer", "simpleCacheManagerCustomizer"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ public class CacheAutoConfigurationTests extends AbstractCacheAutoConfigurationT
|
|||||||
@Test
|
@Test
|
||||||
public void genericCacheWithCustomizers() {
|
public void genericCacheWithCustomizers() {
|
||||||
this.contextRunner.withUserConfiguration(GenericCacheAndCustomizersConfiguration.class)
|
this.contextRunner.withUserConfiguration(GenericCacheAndCustomizersConfiguration.class)
|
||||||
.withPropertyValues("spring.cache.type=" + "generic")
|
.withPropertyValues("spring.cache.type=generic")
|
||||||
.run(verifyCustomizers("allCacheManagerCustomizer", "genericCacheManagerCustomizer"));
|
.run(verifyCustomizers("allCacheManagerCustomizer", "genericCacheManagerCustomizer"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,7 +209,7 @@ public class CacheAutoConfigurationTests extends AbstractCacheAutoConfigurationT
|
|||||||
@Test
|
@Test
|
||||||
public void couchbaseCacheWithCustomizers() {
|
public void couchbaseCacheWithCustomizers() {
|
||||||
this.contextRunner.withUserConfiguration(CouchbaseCacheAndCustomizersConfiguration.class)
|
this.contextRunner.withUserConfiguration(CouchbaseCacheAndCustomizersConfiguration.class)
|
||||||
.withPropertyValues("spring.cache.type=" + "couchbase")
|
.withPropertyValues("spring.cache.type=couchbase")
|
||||||
.run(verifyCustomizers("allCacheManagerCustomizer", "couchbaseCacheManagerCustomizer"));
|
.run(verifyCustomizers("allCacheManagerCustomizer", "couchbaseCacheManagerCustomizer"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,7 +288,7 @@ public class CacheAutoConfigurationTests extends AbstractCacheAutoConfigurationT
|
|||||||
@Test
|
@Test
|
||||||
public void redisCacheWithCustomizers() {
|
public void redisCacheWithCustomizers() {
|
||||||
this.contextRunner.withUserConfiguration(RedisWithCustomizersConfiguration.class)
|
this.contextRunner.withUserConfiguration(RedisWithCustomizersConfiguration.class)
|
||||||
.withPropertyValues("spring.cache.type=" + "redis")
|
.withPropertyValues("spring.cache.type=redis")
|
||||||
.run(verifyCustomizers("allCacheManagerCustomizer", "redisCacheManagerCustomizer"));
|
.run(verifyCustomizers("allCacheManagerCustomizer", "redisCacheManagerCustomizer"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -437,7 +437,7 @@ public class CacheAutoConfigurationTests extends AbstractCacheAutoConfigurationT
|
|||||||
@Test
|
@Test
|
||||||
public void hazelcastCacheWithCustomizers() {
|
public void hazelcastCacheWithCustomizers() {
|
||||||
this.contextRunner.withUserConfiguration(HazelcastCacheAndCustomizersConfiguration.class)
|
this.contextRunner.withUserConfiguration(HazelcastCacheAndCustomizersConfiguration.class)
|
||||||
.withPropertyValues("spring.cache.type=" + "hazelcast")
|
.withPropertyValues("spring.cache.type=hazelcast")
|
||||||
.run(verifyCustomizers("allCacheManagerCustomizer", "hazelcastCacheManagerCustomizer"));
|
.run(verifyCustomizers("allCacheManagerCustomizer", "hazelcastCacheManagerCustomizer"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -541,7 +541,7 @@ public class CacheAutoConfigurationTests extends AbstractCacheAutoConfigurationT
|
|||||||
@Test
|
@Test
|
||||||
public void infinispanCacheWithCustomizers() {
|
public void infinispanCacheWithCustomizers() {
|
||||||
this.contextRunner.withUserConfiguration(DefaultCacheAndCustomizersConfiguration.class)
|
this.contextRunner.withUserConfiguration(DefaultCacheAndCustomizersConfiguration.class)
|
||||||
.withPropertyValues("spring.cache.type=" + "infinispan")
|
.withPropertyValues("spring.cache.type=infinispan")
|
||||||
.run(verifyCustomizers("allCacheManagerCustomizer", "infinispanCacheManagerCustomizer"));
|
.run(verifyCustomizers("allCacheManagerCustomizer", "infinispanCacheManagerCustomizer"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -626,7 +626,7 @@ public class CacheAutoConfigurationTests extends AbstractCacheAutoConfigurationT
|
|||||||
@Test
|
@Test
|
||||||
public void caffeineCacheWithCustomizers() {
|
public void caffeineCacheWithCustomizers() {
|
||||||
this.contextRunner.withUserConfiguration(DefaultCacheAndCustomizersConfiguration.class)
|
this.contextRunner.withUserConfiguration(DefaultCacheAndCustomizersConfiguration.class)
|
||||||
.withPropertyValues("spring.cache.type=" + "caffeine")
|
.withPropertyValues("spring.cache.type=caffeine")
|
||||||
.run(verifyCustomizers("allCacheManagerCustomizer", "caffeineCacheManagerCustomizer"));
|
.run(verifyCustomizers("allCacheManagerCustomizer", "caffeineCacheManagerCustomizer"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ public class EhCache2CacheAutoConfigurationTests extends AbstractCacheAutoConfig
|
|||||||
@Test
|
@Test
|
||||||
public void ehCacheWithCustomizers() {
|
public void ehCacheWithCustomizers() {
|
||||||
this.contextRunner.withUserConfiguration(DefaultCacheAndCustomizersConfiguration.class)
|
this.contextRunner.withUserConfiguration(DefaultCacheAndCustomizersConfiguration.class)
|
||||||
.withPropertyValues("spring.cache.type=" + "ehcache")
|
.withPropertyValues("spring.cache.type=ehcache")
|
||||||
.run(verifyCustomizers("allCacheManagerCustomizer", "ehcacheCacheManagerCustomizer"));
|
.run(verifyCustomizers("allCacheManagerCustomizer", "ehcacheCacheManagerCustomizer"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ class ConditionEvaluationReportTests {
|
|||||||
}
|
}
|
||||||
assertThat(messages).areAtLeastOne(Matched.by(containsString("@ConditionalOnClass found required classes "
|
assertThat(messages).areAtLeastOne(Matched.by(containsString("@ConditionalOnClass found required classes "
|
||||||
+ "'javax.servlet.Servlet', 'org.springframework.web.multipart."
|
+ "'javax.servlet.Servlet', 'org.springframework.web.multipart."
|
||||||
+ "support.StandardServletMultipartResolver', " + "'javax.servlet.MultipartConfigElement'")));
|
+ "support.StandardServletMultipartResolver', 'javax.servlet.MultipartConfigElement'")));
|
||||||
context.close();
|
context.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,21 +158,20 @@ class NoSuchBeanDefinitionFailureAnalyzerTests {
|
|||||||
private void assertDescriptionConstructorMissingType(FailureAnalysis analysis, Class<?> component, int index,
|
private void assertDescriptionConstructorMissingType(FailureAnalysis analysis, Class<?> component, int index,
|
||||||
Class<?> type) {
|
Class<?> type) {
|
||||||
String expected = String.format(
|
String expected = String.format(
|
||||||
"Parameter %s of constructor in %s required a bean of " + "type '%s' that could not be found.", index,
|
"Parameter %s of constructor in %s required a bean of type '%s' that could not be found.", index,
|
||||||
component.getName(), type.getName());
|
component.getName(), type.getName());
|
||||||
assertThat(analysis.getDescription()).startsWith(expected);
|
assertThat(analysis.getDescription()).startsWith(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertActionMissingType(FailureAnalysis analysis, Class<?> type) {
|
private void assertActionMissingType(FailureAnalysis analysis, Class<?> type) {
|
||||||
assertThat(analysis.getAction()).startsWith(String.format(
|
assertThat(analysis.getAction()).startsWith(String.format(
|
||||||
"Consider revisiting the entries above or defining a bean of type '%s' " + "in your configuration.",
|
"Consider revisiting the entries above or defining a bean of type '%s' in your configuration.",
|
||||||
type.getName()));
|
type.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertActionMissingName(FailureAnalysis analysis, String name) {
|
private void assertActionMissingName(FailureAnalysis analysis, String name) {
|
||||||
assertThat(analysis.getAction()).startsWith(String.format(
|
assertThat(analysis.getAction()).startsWith(String.format(
|
||||||
"Consider revisiting the entries above or defining a bean named '%s' " + "in your configuration.",
|
"Consider revisiting the entries above or defining a bean named '%s' in your configuration.", name));
|
||||||
name));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertBeanMethodDisabled(FailureAnalysis analysis, String description, Class<?> target,
|
private void assertBeanMethodDisabled(FailureAnalysis analysis, String description, Class<?> target,
|
||||||
|
@ -67,8 +67,7 @@ public class FreeMarkerAutoConfigurationTests {
|
|||||||
File emptyDirectory = new File(this.buildOutput.getTestResourcesLocation(), "empty-templates/empty-directory");
|
File emptyDirectory = new File(this.buildOutput.getTestResourcesLocation(), "empty-templates/empty-directory");
|
||||||
emptyDirectory.mkdirs();
|
emptyDirectory.mkdirs();
|
||||||
this.contextRunner
|
this.contextRunner
|
||||||
.withPropertyValues(
|
.withPropertyValues("spring.freemarker.templateLoaderPath:classpath:/empty-templates/empty-directory/")
|
||||||
"spring.freemarker.templateLoaderPath:" + "classpath:/empty-templates/empty-directory/")
|
|
||||||
.run((context) -> assertThat(output).doesNotContain("Cannot find template location"));
|
.run((context) -> assertThat(output).doesNotContain("Cannot find template location"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,8 +80,7 @@ class GroovyTemplateAutoConfigurationTests {
|
|||||||
@Test
|
@Test
|
||||||
void emptyTemplateLocation() {
|
void emptyTemplateLocation() {
|
||||||
new File(this.buildOutput.getTestResourcesLocation(), "empty-templates/empty-directory").mkdirs();
|
new File(this.buildOutput.getTestResourcesLocation(), "empty-templates/empty-directory").mkdirs();
|
||||||
registerAndRefreshContext(
|
registerAndRefreshContext("spring.groovy.template.resource-loader-path:classpath:/templates/empty-directory/");
|
||||||
"spring.groovy.template.resource-loader-path:" + "classpath:/templates/empty-directory/");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -66,15 +66,17 @@ class HazelcastAutoConfigurationClientTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void systemPropertyWithXml() {
|
void systemPropertyWithXml() {
|
||||||
this.contextRunner.withSystemProperties(HazelcastClientConfiguration.CONFIG_SYSTEM_PROPERTY
|
this.contextRunner
|
||||||
+ "=classpath:org/springframework/boot/autoconfigure/hazelcast/" + "hazelcast-client-specific.xml")
|
.withSystemProperties(HazelcastClientConfiguration.CONFIG_SYSTEM_PROPERTY
|
||||||
|
+ "=classpath:org/springframework/boot/autoconfigure/hazelcast/hazelcast-client-specific.xml")
|
||||||
.run(assertSpecificHazelcastClient("explicit-xml"));
|
.run(assertSpecificHazelcastClient("explicit-xml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void systemPropertyWithYaml() {
|
void systemPropertyWithYaml() {
|
||||||
this.contextRunner.withSystemProperties(HazelcastClientConfiguration.CONFIG_SYSTEM_PROPERTY
|
this.contextRunner
|
||||||
+ "=classpath:org/springframework/boot/autoconfigure/hazelcast/" + "hazelcast-client-specific.yaml")
|
.withSystemProperties(HazelcastClientConfiguration.CONFIG_SYSTEM_PROPERTY
|
||||||
|
+ "=classpath:org/springframework/boot/autoconfigure/hazelcast/hazelcast-client-specific.yaml")
|
||||||
.run(assertSpecificHazelcastClient("explicit-yaml"));
|
.run(assertSpecificHazelcastClient("explicit-yaml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ class ProjectInfoAutoConfigurationTests {
|
|||||||
@Test
|
@Test
|
||||||
void gitPropertiesFallbackWithGitPropertiesBean() {
|
void gitPropertiesFallbackWithGitPropertiesBean() {
|
||||||
this.contextRunner.withUserConfiguration(CustomInfoPropertiesConfiguration.class).withPropertyValues(
|
this.contextRunner.withUserConfiguration(CustomInfoPropertiesConfiguration.class).withPropertyValues(
|
||||||
"spring.info.git.location=" + "classpath:/org/springframework/boot/autoconfigure/info/git.properties")
|
"spring.info.git.location=classpath:/org/springframework/boot/autoconfigure/info/git.properties")
|
||||||
.run((context) -> {
|
.run((context) -> {
|
||||||
GitProperties gitProperties = context.getBean(GitProperties.class);
|
GitProperties gitProperties = context.getBean(GitProperties.class);
|
||||||
assertThat(gitProperties).isSameAs(context.getBean("customGitProperties"));
|
assertThat(gitProperties).isSameAs(context.getBean("customGitProperties"));
|
||||||
@ -115,8 +115,7 @@ class ProjectInfoAutoConfigurationTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void buildPropertiesCustomInvalidLocation() {
|
void buildPropertiesCustomInvalidLocation() {
|
||||||
this.contextRunner
|
this.contextRunner.withPropertyValues("spring.info.build.location=classpath:/org/acme/no-build-info.properties")
|
||||||
.withPropertyValues("spring.info.build.location=" + "classpath:/org/acme/no-build-info.properties")
|
|
||||||
.run((context) -> assertThat(context.getBeansOfType(BuildProperties.class)).hasSize(0));
|
.run((context) -> assertThat(context.getBeansOfType(BuildProperties.class)).hasSize(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
class DataSourceJmxConfigurationTests {
|
class DataSourceJmxConfigurationTests {
|
||||||
|
|
||||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||||
.withPropertyValues("spring.datasource.url=" + "jdbc:hsqldb:mem:test-" + UUID.randomUUID())
|
.withPropertyValues("spring.datasource.url=jdbc:hsqldb:mem:test-" + UUID.randomUUID())
|
||||||
.withConfiguration(AutoConfigurations.of(JmxAutoConfiguration.class, DataSourceAutoConfiguration.class));
|
.withConfiguration(AutoConfigurations.of(JmxAutoConfiguration.class, DataSourceAutoConfiguration.class));
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -60,8 +60,9 @@ class HikariDataSourceConfigurationTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testDataSourceGenericPropertiesOverridden() {
|
void testDataSourceGenericPropertiesOverridden() {
|
||||||
this.contextRunner.withPropertyValues(
|
this.contextRunner
|
||||||
"spring.datasource.hikari.data-source-properties" + ".dataSourceClassName=org.h2.JDBCDataSource")
|
.withPropertyValues(
|
||||||
|
"spring.datasource.hikari.data-source-properties.dataSourceClassName=org.h2.JDBCDataSource")
|
||||||
.run((context) -> {
|
.run((context) -> {
|
||||||
HikariDataSource ds = context.getBean(HikariDataSource.class);
|
HikariDataSource ds = context.getBean(HikariDataSource.class);
|
||||||
assertThat(ds.getDataSourceProperties().getProperty("dataSourceClassName"))
|
assertThat(ds.getDataSourceProperties().getProperty("dataSourceClassName"))
|
||||||
|
@ -40,7 +40,7 @@ class HikariDriverConfigurationFailureAnalyzerTests {
|
|||||||
FailureAnalysis failureAnalysis = performAnalysis(TestConfiguration.class);
|
FailureAnalysis failureAnalysis = performAnalysis(TestConfiguration.class);
|
||||||
assertThat(failureAnalysis).isNotNull();
|
assertThat(failureAnalysis).isNotNull();
|
||||||
assertThat(failureAnalysis.getDescription()).isEqualTo(
|
assertThat(failureAnalysis.getDescription()).isEqualTo(
|
||||||
"Configuration of the Hikari connection pool failed: " + "'dataSourceClassName' is not supported.");
|
"Configuration of the Hikari connection pool failed: 'dataSourceClassName' is not supported.");
|
||||||
assertThat(failureAnalysis.getAction()).contains("Spring Boot auto-configures only a driver");
|
assertThat(failureAnalysis.getAction()).contains("Spring Boot auto-configures only a driver");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,9 +86,8 @@ class ConditionEvaluationReportLoggingListenerTests {
|
|||||||
context.register(ErrorConfig.class);
|
context.register(ErrorConfig.class);
|
||||||
assertThatExceptionOfType(Exception.class).isThrownBy(context::refresh).satisfies((ex) -> this.initializer
|
assertThatExceptionOfType(Exception.class).isThrownBy(context::refresh).satisfies((ex) -> this.initializer
|
||||||
.onApplicationEvent(new ApplicationFailedEvent(new SpringApplication(), new String[0], context, ex)));
|
.onApplicationEvent(new ApplicationFailedEvent(new SpringApplication(), new String[0], context, ex)));
|
||||||
assertThat(output)
|
assertThat(output).contains("Error starting ApplicationContext. To display the conditions report re-run"
|
||||||
.contains("Error starting" + " ApplicationContext. To display the conditions report re-run"
|
+ " your application with 'debug' enabled.");
|
||||||
+ " your application with 'debug' enabled.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -94,7 +94,7 @@ class MongoClientFactoryTests {
|
|||||||
@Test
|
@Test
|
||||||
void uriCanBeCustomized() {
|
void uriCanBeCustomized() {
|
||||||
MongoProperties properties = new MongoProperties();
|
MongoProperties properties = new MongoProperties();
|
||||||
properties.setUri("mongodb://user:secret@mongo1.example.com:12345," + "mongo2.example.com:23456/test");
|
properties.setUri("mongodb://user:secret@mongo1.example.com:12345,mongo2.example.com:23456/test");
|
||||||
MongoClient client = createMongoClient(properties);
|
MongoClient client = createMongoClient(properties);
|
||||||
List<ServerAddress> allAddresses = getAllAddresses(client);
|
List<ServerAddress> allAddresses = getAllAddresses(client);
|
||||||
assertThat(allAddresses).hasSize(2);
|
assertThat(allAddresses).hasSize(2);
|
||||||
|
@ -98,7 +98,7 @@ class ReactiveMongoClientFactoryTests {
|
|||||||
@Test
|
@Test
|
||||||
void uriCanBeCustomized() {
|
void uriCanBeCustomized() {
|
||||||
MongoProperties properties = new MongoProperties();
|
MongoProperties properties = new MongoProperties();
|
||||||
properties.setUri("mongodb://user:secret@mongo1.example.com:12345," + "mongo2.example.com:23456/test");
|
properties.setUri("mongodb://user:secret@mongo1.example.com:12345,mongo2.example.com:23456/test");
|
||||||
MongoClient client = createMongoClient(properties);
|
MongoClient client = createMongoClient(properties);
|
||||||
List<ServerAddress> allAddresses = extractServerAddresses(client);
|
List<ServerAddress> allAddresses = extractServerAddresses(client);
|
||||||
assertThat(allAddresses).hasSize(2);
|
assertThat(allAddresses).hasSize(2);
|
||||||
@ -123,7 +123,7 @@ class ReactiveMongoClientFactoryTests {
|
|||||||
properties.setUsername("user");
|
properties.setUsername("user");
|
||||||
properties.setPassword("secret".toCharArray());
|
properties.setPassword("secret".toCharArray());
|
||||||
assertThatIllegalStateException().isThrownBy(() -> createMongoClient(properties)).withMessageContaining(
|
assertThatIllegalStateException().isThrownBy(() -> createMongoClient(properties)).withMessageContaining(
|
||||||
"Invalid mongo configuration, " + "either uri or host/port/credentials must be specified");
|
"Invalid mongo configuration, either uri or host/port/credentials must be specified");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -133,7 +133,7 @@ class ReactiveMongoClientFactoryTests {
|
|||||||
properties.setHost("localhost");
|
properties.setHost("localhost");
|
||||||
properties.setPort(4567);
|
properties.setPort(4567);
|
||||||
assertThatIllegalStateException().isThrownBy(() -> createMongoClient(properties)).withMessageContaining(
|
assertThatIllegalStateException().isThrownBy(() -> createMongoClient(properties)).withMessageContaining(
|
||||||
"Invalid mongo configuration, " + "either uri or host/port/credentials must be specified");
|
"Invalid mongo configuration, either uri or host/port/credentials must be specified");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -232,7 +232,7 @@ class TomcatWebServerFactoryCustomizerTests {
|
|||||||
+ "169\\.254\\.\\d{1,3}\\.\\d{1,3}|" // 169.254/16
|
+ "169\\.254\\.\\d{1,3}\\.\\d{1,3}|" // 169.254/16
|
||||||
+ "127\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|" // 127/8
|
+ "127\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|" // 127/8
|
||||||
+ "172\\.1[6-9]{1}\\.\\d{1,3}\\.\\d{1,3}|" // 172.16/12
|
+ "172\\.1[6-9]{1}\\.\\d{1,3}\\.\\d{1,3}|" // 172.16/12
|
||||||
+ "172\\.2[0-9]{1}\\.\\d{1,3}\\.\\d{1,3}|" + "172\\.3[0-1]{1}\\.\\d{1,3}\\.\\d{1,3}|" //
|
+ "172\\.2[0-9]{1}\\.\\d{1,3}\\.\\d{1,3}|172\\.3[0-1]{1}\\.\\d{1,3}\\.\\d{1,3}|" //
|
||||||
+ "0:0:0:0:0:0:0:1|::1";
|
+ "0:0:0:0:0:0:0:1|::1";
|
||||||
assertThat(remoteIpValve.getInternalProxies()).isEqualTo(expectedInternalProxies);
|
assertThat(remoteIpValve.getInternalProxies()).isEqualTo(expectedInternalProxies);
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ class ReactiveWebServerFactoryAutoConfigurationTests {
|
|||||||
TooManyHttpHandlers.class)
|
TooManyHttpHandlers.class)
|
||||||
.run((context) -> assertThat(context.getStartupFailure())
|
.run((context) -> assertThat(context.getStartupFailure())
|
||||||
.isInstanceOf(ApplicationContextException.class)
|
.isInstanceOf(ApplicationContextException.class)
|
||||||
.hasMessageContaining("multiple HttpHandler beans : " + "httpHandler,additionalHttpHandler"));
|
.hasMessageContaining("multiple HttpHandler beans : httpHandler,additionalHttpHandler"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -73,7 +73,7 @@ class ErrorMvcAutoConfigurationTests {
|
|||||||
webRequest.getResponse());
|
webRequest.getResponse());
|
||||||
assertThat(output).contains("Cannot render error page for request [/path] "
|
assertThat(output).contains("Cannot render error page for request [/path] "
|
||||||
+ "and exception [Exception message] as the response has "
|
+ "and exception [Exception message] as the response has "
|
||||||
+ "already been committed. As a result, the response may " + "have the wrong status code.");
|
+ "already been committed. As a result, the response may have the wrong status code.");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ abstract class ArchiveCommand extends OptionParsingCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected void doOptions() {
|
protected void doOptions() {
|
||||||
this.includeOption = option("include",
|
this.includeOption = option("include",
|
||||||
"Pattern applied to directories on the classpath to find files to " + "include in the resulting ")
|
"Pattern applied to directories on the classpath to find files to include in the resulting ")
|
||||||
.withRequiredArg().withValuesSeparatedBy(",").defaultsTo("");
|
.withRequiredArg().withValuesSeparatedBy(",").defaultsTo("");
|
||||||
this.excludeOption = option("exclude", "Pattern applied to directories on the classpath to find files to "
|
this.excludeOption = option("exclude", "Pattern applied to directories on the classpath to find files to "
|
||||||
+ "exclude from the resulting " + this.type).withRequiredArg().withValuesSeparatedBy(",")
|
+ "exclude from the resulting " + this.type).withRequiredArg().withValuesSeparatedBy(",")
|
||||||
@ -120,8 +120,8 @@ abstract class ArchiveCommand extends OptionParsingCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected ExitStatus run(OptionSet options) throws Exception {
|
protected ExitStatus run(OptionSet options) throws Exception {
|
||||||
List<?> nonOptionArguments = new ArrayList<Object>(options.nonOptionArguments());
|
List<?> nonOptionArguments = new ArrayList<Object>(options.nonOptionArguments());
|
||||||
Assert.isTrue(nonOptionArguments.size() >= 2, () -> "The name of the " + "resulting " + this.type
|
Assert.isTrue(nonOptionArguments.size() >= 2,
|
||||||
+ " and at least one source file must be " + "specified");
|
() -> "The name of the resulting " + this.type + " and at least one source file must be specified");
|
||||||
|
|
||||||
File output = new File((String) nonOptionArguments.remove(0));
|
File output = new File((String) nonOptionArguments.remove(0));
|
||||||
Assert.isTrue(output.getName().toLowerCase(Locale.ENGLISH).endsWith("." + this.type),
|
Assert.isTrue(output.getName().toLowerCase(Locale.ENGLISH).endsWith("." + this.type),
|
||||||
|
@ -32,8 +32,7 @@ import org.springframework.boot.loader.tools.LibraryScope;
|
|||||||
public class JarCommand extends ArchiveCommand {
|
public class JarCommand extends ArchiveCommand {
|
||||||
|
|
||||||
public JarCommand() {
|
public JarCommand() {
|
||||||
super("jar", "Create a self-contained executable jar " + "file from a Spring Groovy script",
|
super("jar", "Create a self-contained executable jar file from a Spring Groovy script", new JarOptionHandler());
|
||||||
new JarOptionHandler());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class JarOptionHandler extends ArchiveOptionHandler {
|
private static final class JarOptionHandler extends ArchiveOptionHandler {
|
||||||
|
@ -36,8 +36,7 @@ import org.springframework.boot.loader.tools.LibraryScope;
|
|||||||
public class WarCommand extends ArchiveCommand {
|
public class WarCommand extends ArchiveCommand {
|
||||||
|
|
||||||
public WarCommand() {
|
public WarCommand() {
|
||||||
super("war", "Create a self-contained executable war " + "file from a Spring Groovy script",
|
super("war", "Create a self-contained executable war file from a Spring Groovy script", new WarOptionHandler());
|
||||||
new WarOptionHandler());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class WarOptionHandler extends ArchiveOptionHandler {
|
private static final class WarOptionHandler extends ArchiveOptionHandler {
|
||||||
@ -57,7 +56,7 @@ public class WarCommand extends ArchiveCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addCliClasses(JarWriter writer) throws IOException {
|
protected void addCliClasses(JarWriter writer) throws IOException {
|
||||||
addClass(writer, null, "org.springframework.boot." + "cli.app.SpringApplicationWebApplicationInitializer");
|
addClass(writer, null, "org.springframework.boot.cli.app.SpringApplicationWebApplicationInitializer");
|
||||||
super.addCliClasses(writer);
|
super.addCliClasses(writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ public class InitCommand extends OptionParsingCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public InitCommand(InitOptionHandler handler) {
|
public InitCommand(InitOptionHandler handler) {
|
||||||
super("init", "Initialize a new project using Spring " + "Initializr (start.spring.io)", handler);
|
super("init", "Initialize a new project using Spring Initializr (start.spring.io)", handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -140,7 +140,7 @@ public class InitCommand extends OptionParsingCommand {
|
|||||||
this.packageName = option("package-name", "Package name").withRequiredArg();
|
this.packageName = option("package-name", "Package name").withRequiredArg();
|
||||||
this.type = option(Arrays.asList("type", "t"),
|
this.type = option(Arrays.asList("type", "t"),
|
||||||
"Project type. Not normally needed if you use --build "
|
"Project type. Not normally needed if you use --build "
|
||||||
+ "and/or --format. Check the capabilities of the service " + "(--list) for more details")
|
+ "and/or --format. Check the capabilities of the service (--list) for more details")
|
||||||
.withRequiredArg();
|
.withRequiredArg();
|
||||||
this.packaging = option(Arrays.asList("packaging", "p"), "Project packaging (for example 'jar')")
|
this.packaging = option(Arrays.asList("packaging", "p"), "Project packaging (for example 'jar')")
|
||||||
.withRequiredArg();
|
.withRequiredArg();
|
||||||
@ -155,7 +155,7 @@ public class InitCommand extends OptionParsingCommand {
|
|||||||
this.bootVersion = option(Arrays.asList("boot-version", "b"),
|
this.bootVersion = option(Arrays.asList("boot-version", "b"),
|
||||||
"Spring Boot version (for example '1.2.0.RELEASE')").withRequiredArg();
|
"Spring Boot version (for example '1.2.0.RELEASE')").withRequiredArg();
|
||||||
this.dependencies = option(Arrays.asList("dependencies", "d"),
|
this.dependencies = option(Arrays.asList("dependencies", "d"),
|
||||||
"Comma-separated list of dependency identifiers to include in the " + "generated project")
|
"Comma-separated list of dependency identifiers to include in the generated project")
|
||||||
.withRequiredArg();
|
.withRequiredArg();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ class ProjectGenerator {
|
|||||||
}
|
}
|
||||||
if (fileName == null) {
|
if (fileName == null) {
|
||||||
throw new ReportableException("Could not save the project, the server did not set a preferred "
|
throw new ReportableException("Could not save the project, the server did not set a preferred "
|
||||||
+ "file name and no location was set. Specify the output location " + "for the project.");
|
+ "file name and no location was set. Specify the output location for the project.");
|
||||||
}
|
}
|
||||||
writeProject(response, fileName, force);
|
writeProject(response, fileName, force);
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ public class InstallCommand extends OptionParsingCommand {
|
|||||||
protected ExitStatus run(OptionSet options) throws Exception {
|
protected ExitStatus run(OptionSet options) throws Exception {
|
||||||
List<String> args = (List<String>) options.nonOptionArguments();
|
List<String> args = (List<String>) options.nonOptionArguments();
|
||||||
Assert.notEmpty(args,
|
Assert.notEmpty(args,
|
||||||
"Please specify at least one " + "dependency, in the form group:artifact:version, to install");
|
"Please specify at least one dependency, in the form group:artifact:version, to install");
|
||||||
try {
|
try {
|
||||||
new Installer(options, this).install(args);
|
new Installer(options, this).install(args);
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ public class Shell {
|
|||||||
String version = getClass().getPackage().getImplementationVersion();
|
String version = getClass().getPackage().getImplementationVersion();
|
||||||
version = (version != null) ? " (v" + version + ")" : "";
|
version = (version != null) ? " (v" + version + ")" : "";
|
||||||
System.out.println(ansi("Spring Boot", Code.BOLD).append(version, Code.FAINT));
|
System.out.println(ansi("Spring Boot", Code.BOLD).append(version, Code.FAINT));
|
||||||
System.out.println(ansi("Hit TAB to complete. Type 'help' and hit " + "RETURN for help, and 'exit' to quit."));
|
System.out.println(ansi("Hit TAB to complete. Type 'help' and hit RETURN for help, and 'exit' to quit."));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runInputLoop() throws Exception {
|
private void runInputLoop() throws Exception {
|
||||||
|
@ -135,7 +135,7 @@ public class DependencyManagementBomTransformation extends AnnotatedNodeASTTrans
|
|||||||
&& ((ConstantExpression) valueExpression).getValue() instanceof String) {
|
&& ((ConstantExpression) valueExpression).getValue() instanceof String) {
|
||||||
return Arrays.asList((ConstantExpression) valueExpression);
|
return Arrays.asList((ConstantExpression) valueExpression);
|
||||||
}
|
}
|
||||||
reportError("@DependencyManagementBom requires an inline constant that is a " + "string or a string array",
|
reportError("@DependencyManagementBom requires an inline constant that is a string or a string array",
|
||||||
valueExpression);
|
valueExpression);
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ public class DependencyManagementBomTransformation extends AnnotatedNodeASTTrans
|
|||||||
expressions.add((ConstantExpression) expression);
|
expressions.add((ConstantExpression) expression);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
reportError("Each entry in the array must be an " + "inline string constant", expression);
|
reportError("Each entry in the array must be an inline string constant", expression);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return expressions;
|
return expressions;
|
||||||
|
@ -84,7 +84,7 @@ public class DevToolsPropertyDefaultsPostProcessor implements EnvironmentPostPro
|
|||||||
environment.getPropertySources().addLast(new MapPropertySource("devtools", PROPERTIES));
|
environment.getPropertySources().addLast(new MapPropertySource("devtools", PROPERTIES));
|
||||||
}
|
}
|
||||||
if (isWebApplication(environment) && !environment.containsProperty(WEB_LOGGING)) {
|
if (isWebApplication(environment) && !environment.containsProperty(WEB_LOGGING)) {
|
||||||
logger.info("For additional web related logging consider " + "setting the '" + WEB_LOGGING
|
logger.info("For additional web related logging consider setting the '" + WEB_LOGGING
|
||||||
+ "' property to 'DEBUG'");
|
+ "' property to 'DEBUG'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ class Connection {
|
|||||||
String accept = getWebsocketAcceptResponse();
|
String accept = getWebsocketAcceptResponse();
|
||||||
this.outputStream.writeHeaders("HTTP/1.1 101 Switching Protocols", "Upgrade: websocket", "Connection: Upgrade",
|
this.outputStream.writeHeaders("HTTP/1.1 101 Switching Protocols", "Upgrade: websocket", "Connection: Upgrade",
|
||||||
"Sec-WebSocket-Accept: " + accept);
|
"Sec-WebSocket-Accept: " + accept);
|
||||||
new Frame("{\"command\":\"hello\",\"protocols\":" + "[\"http://livereload.com/protocols/official-7\"],"
|
new Frame("{\"command\":\"hello\",\"protocols\":[\"http://livereload.com/protocols/official-7\"],"
|
||||||
+ "\"serverName\":\"spring-boot\"}").write(this.outputStream);
|
+ "\"serverName\":\"spring-boot\"}").write(this.outputStream);
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
this.webSocket = true;
|
this.webSocket = true;
|
||||||
|
@ -104,7 +104,7 @@ public class RemoteClientConfiguration implements InitializingBean {
|
|||||||
String secretHeaderName = remoteProperties.getSecretHeaderName();
|
String secretHeaderName = remoteProperties.getSecretHeaderName();
|
||||||
String secret = remoteProperties.getSecret();
|
String secret = remoteProperties.getSecret();
|
||||||
Assert.state(secret != null,
|
Assert.state(secret != null,
|
||||||
"The environment value 'spring.devtools.remote.secret' " + "is required to secure your connection.");
|
"The environment value 'spring.devtools.remote.secret' is required to secure your connection.");
|
||||||
return new HttpHeaderInterceptor(secretHeaderName, secret);
|
return new HttpHeaderInterceptor(secretHeaderName, secret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ final class ClassLoaderFilesResourcePatternResolver implements ResourcePatternRe
|
|||||||
|
|
||||||
private static final String[] LOCATION_PATTERN_PREFIXES = { CLASSPATH_ALL_URL_PREFIX, CLASSPATH_URL_PREFIX };
|
private static final String[] LOCATION_PATTERN_PREFIXES = { CLASSPATH_ALL_URL_PREFIX, CLASSPATH_URL_PREFIX };
|
||||||
|
|
||||||
private static final String WEB_CONTEXT_CLASS = "org.springframework.web.context." + "WebApplicationContext";
|
private static final String WEB_CONTEXT_CLASS = "org.springframework.web.context.WebApplicationContext";
|
||||||
|
|
||||||
private final ResourcePatternResolver patternResolverDelegate;
|
private final ResourcePatternResolver patternResolverDelegate;
|
||||||
|
|
||||||
|
@ -115,8 +115,7 @@ public class DevToolsSettings {
|
|||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
throw new IllegalStateException("Unable to load devtools settings from " + "location [" + location + "]",
|
throw new IllegalStateException("Unable to load devtools settings from location [" + location + "]", ex);
|
||||||
ex);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class ConnectionInputStreamTests {
|
|||||||
for (int i = 0; i < 100; i++) {
|
for (int i = 0; i < 100; i++) {
|
||||||
header += "x-something-" + i + ": xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
|
header += "x-something-" + i + ": xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
|
||||||
}
|
}
|
||||||
String data = header + "\r\n\r\n" + "content\r\n";
|
String data = header + "\r\n\r\ncontent\r\n";
|
||||||
ConnectionInputStream inputStream = new ConnectionInputStream(new ByteArrayInputStream(data.getBytes()));
|
ConnectionInputStream inputStream = new ConnectionInputStream(new ByteArrayInputStream(data.getBytes()));
|
||||||
assertThat(inputStream.readHeader()).isEqualTo(header);
|
assertThat(inputStream.readHeader()).isEqualTo(header);
|
||||||
}
|
}
|
||||||
|
@ -71,13 +71,13 @@ class DefaultSourceFolderUrlFilterTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void skippedProjects() throws Exception {
|
void skippedProjects() throws Exception {
|
||||||
String sourceFolder = "/Users/me/code/spring-boot-samples/" + "spring-boot-sample-devtools";
|
String sourceFolder = "/Users/me/code/spring-boot-samples/spring-boot-sample-devtools";
|
||||||
URL jarUrl = new URL("jar:file:/Users/me/tmp/" + "spring-boot-sample-devtools-1.3.0.BUILD-SNAPSHOT.jar!/");
|
URL jarUrl = new URL("jar:file:/Users/me/tmp/spring-boot-sample-devtools-1.3.0.BUILD-SNAPSHOT.jar!/");
|
||||||
assertThat(this.filter.isMatch(sourceFolder, jarUrl)).isTrue();
|
assertThat(this.filter.isMatch(sourceFolder, jarUrl)).isTrue();
|
||||||
URL nestedJarUrl = new URL("jar:file:/Users/me/tmp/" + "spring-boot-sample-devtools-1.3.0.BUILD-SNAPSHOT.jar!/"
|
URL nestedJarUrl = new URL("jar:file:/Users/me/tmp/spring-boot-sample-devtools-1.3.0.BUILD-SNAPSHOT.jar!/"
|
||||||
+ "lib/spring-boot-1.3.0.BUILD-SNAPSHOT.jar!/");
|
+ "lib/spring-boot-1.3.0.BUILD-SNAPSHOT.jar!/");
|
||||||
assertThat(this.filter.isMatch(sourceFolder, nestedJarUrl)).isFalse();
|
assertThat(this.filter.isMatch(sourceFolder, nestedJarUrl)).isFalse();
|
||||||
URL fileUrl = new URL("file:/Users/me/tmp/" + "spring-boot-sample-devtools-1.3.0.BUILD-SNAPSHOT.jar");
|
URL fileUrl = new URL("file:/Users/me/tmp/spring-boot-sample-devtools-1.3.0.BUILD-SNAPSHOT.jar");
|
||||||
assertThat(this.filter.isMatch(sourceFolder, fileUrl)).isTrue();
|
assertThat(this.filter.isMatch(sourceFolder, fileUrl)).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,8 +45,8 @@ class PropertiesMigrationReport {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
StringBuilder report = new StringBuilder();
|
StringBuilder report = new StringBuilder();
|
||||||
report.append(String.format(
|
report.append(String
|
||||||
"%nThe use of configuration keys that have been " + "renamed was found in the environment:%n%n"));
|
.format("%nThe use of configuration keys that have been renamed was found in the environment:%n%n"));
|
||||||
append(report, content);
|
append(report, content);
|
||||||
report.append(String.format("%n"));
|
report.append(String.format("%n"));
|
||||||
report.append("Each configuration key has been temporarily mapped to its "
|
report.append("Each configuration key has been temporarily mapped to its "
|
||||||
@ -68,10 +68,10 @@ class PropertiesMigrationReport {
|
|||||||
}
|
}
|
||||||
StringBuilder report = new StringBuilder();
|
StringBuilder report = new StringBuilder();
|
||||||
report.append(String.format(
|
report.append(String.format(
|
||||||
"%nThe use of configuration keys that are no longer " + "supported was found in the environment:%n%n"));
|
"%nThe use of configuration keys that are no longer supported was found in the environment:%n%n"));
|
||||||
append(report, content);
|
append(report, content);
|
||||||
report.append(String.format("%n"));
|
report.append(String.format("%n"));
|
||||||
report.append("Please refer to the migration guide or reference guide for " + "potential alternatives.");
|
report.append("Please refer to the migration guide or reference guide for potential alternatives.");
|
||||||
report.append(String.format("%n"));
|
report.append(String.format("%n"));
|
||||||
return report.toString();
|
return report.toString();
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ class PropertiesMigrationReporterTests {
|
|||||||
String report = createErrorReport(loadRepository("metadata/type-conversion-metadata.json"));
|
String report = createErrorReport(loadRepository("metadata/type-conversion-metadata.json"));
|
||||||
assertThat(report).isNotNull();
|
assertThat(report).isNotNull();
|
||||||
assertThat(report).containsSubsequence("Property source 'test'", "wrong.inconvertible", "Line: 1",
|
assertThat(report).containsSubsequence("Property source 'test'", "wrong.inconvertible", "Line: 1",
|
||||||
"Reason: Replacement key " + "'test.inconvertible' uses an incompatible target type");
|
"Reason: Replacement key 'test.inconvertible' uses an incompatible target type");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -79,7 +79,7 @@ public class TestDatabaseAutoConfiguration {
|
|||||||
@Override
|
@Override
|
||||||
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
|
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
|
||||||
Assert.isInstanceOf(ConfigurableListableBeanFactory.class, registry,
|
Assert.isInstanceOf(ConfigurableListableBeanFactory.class, registry,
|
||||||
"Test Database Auto-configuration can only be " + "used with a ConfigurableListableBeanFactory");
|
"Test Database Auto-configuration can only be used with a ConfigurableListableBeanFactory");
|
||||||
process(registry, (ConfigurableListableBeanFactory) registry);
|
process(registry, (ConfigurableListableBeanFactory) registry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ public class TestDatabaseAutoConfiguration {
|
|||||||
private BeanDefinitionHolder getDataSourceBeanDefinition(ConfigurableListableBeanFactory beanFactory) {
|
private BeanDefinitionHolder getDataSourceBeanDefinition(ConfigurableListableBeanFactory beanFactory) {
|
||||||
String[] beanNames = beanFactory.getBeanNamesForType(DataSource.class);
|
String[] beanNames = beanFactory.getBeanNamesForType(DataSource.class);
|
||||||
if (ObjectUtils.isEmpty(beanNames)) {
|
if (ObjectUtils.isEmpty(beanNames)) {
|
||||||
logger.warn("No DataSource beans found, " + "embedded version will not be used");
|
logger.warn("No DataSource beans found, embedded version will not be used");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (beanNames.length == 1) {
|
if (beanNames.length == 1) {
|
||||||
@ -122,7 +122,7 @@ public class TestDatabaseAutoConfiguration {
|
|||||||
return new BeanDefinitionHolder(beanDefinition, beanName);
|
return new BeanDefinitionHolder(beanDefinition, beanName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.warn("No primary DataSource found, " + "embedded version will not be used");
|
logger.warn("No primary DataSource found, embedded version will not be used");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +179,7 @@ public class TestDatabaseAutoConfiguration {
|
|||||||
Assert.state(connection != EmbeddedDatabaseConnection.NONE,
|
Assert.state(connection != EmbeddedDatabaseConnection.NONE,
|
||||||
"Failed to replace DataSource with an embedded database for tests. If "
|
"Failed to replace DataSource with an embedded database for tests. If "
|
||||||
+ "you want an embedded database please put a supported one "
|
+ "you want an embedded database please put a supported one "
|
||||||
+ "on the classpath or tune the replace attribute of " + "@AutoConfigureTestDatabase.");
|
+ "on the classpath or tune the replace attribute of @AutoConfigureTestDatabase.");
|
||||||
return new EmbeddedDatabaseBuilder().generateUniqueName(true).setType(connection.getType()).build();
|
return new EmbeddedDatabaseBuilder().generateUniqueName(true).setType(connection.getType()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,9 +108,9 @@ public class MockRestServiceServerAutoConfiguration {
|
|||||||
private RequestExpectationManager getDelegate() {
|
private RequestExpectationManager getDelegate() {
|
||||||
Map<RestTemplate, RequestExpectationManager> expectationManagers = this.customizer.getExpectationManagers();
|
Map<RestTemplate, RequestExpectationManager> expectationManagers = this.customizer.getExpectationManagers();
|
||||||
Assert.state(!expectationManagers.isEmpty(), "Unable to use auto-configured MockRestServiceServer since "
|
Assert.state(!expectationManagers.isEmpty(), "Unable to use auto-configured MockRestServiceServer since "
|
||||||
+ "MockServerRestTemplateCustomizer has not been bound to " + "a RestTemplate");
|
+ "MockServerRestTemplateCustomizer has not been bound to a RestTemplate");
|
||||||
Assert.state(expectationManagers.size() == 1, "Unable to use auto-configured MockRestServiceServer since "
|
Assert.state(expectationManagers.size() == 1, "Unable to use auto-configured MockRestServiceServer since "
|
||||||
+ "MockServerRestTemplateCustomizer has been bound to " + "more than one RestTemplate");
|
+ "MockServerRestTemplateCustomizer has been bound to more than one RestTemplate");
|
||||||
return expectationManagers.values().iterator().next();
|
return expectationManagers.values().iterator().next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,8 +88,8 @@ public class SpringBootContextLoader extends AbstractContextLoader {
|
|||||||
Class<?>[] configClasses = config.getClasses();
|
Class<?>[] configClasses = config.getClasses();
|
||||||
String[] configLocations = config.getLocations();
|
String[] configLocations = config.getLocations();
|
||||||
Assert.state(!ObjectUtils.isEmpty(configClasses) || !ObjectUtils.isEmpty(configLocations),
|
Assert.state(!ObjectUtils.isEmpty(configClasses) || !ObjectUtils.isEmpty(configLocations),
|
||||||
() -> "No configuration classes " + "or locations found in @SpringApplicationConfiguration. "
|
() -> "No configuration classes or locations found in @SpringApplicationConfiguration. "
|
||||||
+ "For default configuration detection to work you need " + "Spring 4.0.3 or better (found "
|
+ "For default configuration detection to work you need Spring 4.0.3 or better (found "
|
||||||
+ SpringVersion.getVersion() + ").");
|
+ SpringVersion.getVersion() + ").");
|
||||||
SpringApplication application = getSpringApplication();
|
SpringApplication application = getSpringApplication();
|
||||||
application.setMainApplicationClass(config.getTestClass());
|
application.setMainApplicationClass(config.getTestClass());
|
||||||
@ -244,7 +244,7 @@ public class SpringBootContextLoader extends AbstractContextLoader {
|
|||||||
@Override
|
@Override
|
||||||
public ApplicationContext loadContext(String... locations) throws Exception {
|
public ApplicationContext loadContext(String... locations) throws Exception {
|
||||||
throw new UnsupportedOperationException(
|
throw new UnsupportedOperationException(
|
||||||
"SpringApplicationContextLoader " + "does not support the loadContext(String...) method");
|
"SpringApplicationContextLoader does not support the loadContext(String...) method");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -85,7 +85,7 @@ public class SpringBootTestContextBootstrapper extends DefaultTestContextBootstr
|
|||||||
private static final String REACTIVE_WEB_ENVIRONMENT_CLASS = "org.springframework."
|
private static final String REACTIVE_WEB_ENVIRONMENT_CLASS = "org.springframework."
|
||||||
+ "web.reactive.DispatcherHandler";
|
+ "web.reactive.DispatcherHandler";
|
||||||
|
|
||||||
private static final String MVC_WEB_ENVIRONMENT_CLASS = "org.springframework." + "web.servlet.DispatcherServlet";
|
private static final String MVC_WEB_ENVIRONMENT_CLASS = "org.springframework.web.servlet.DispatcherServlet";
|
||||||
|
|
||||||
private static final String JERSEY_WEB_ENVIRONMENT_CLASS = "org.glassfish.jersey.server.ResourceConfig";
|
private static final String JERSEY_WEB_ENVIRONMENT_CLASS = "org.glassfish.jersey.server.ResourceConfig";
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ public class SpringBootTestContextBootstrapper extends DefaultTestContextBootstr
|
|||||||
Class<?> found = new AnnotatedClassFinder(SpringBootConfiguration.class)
|
Class<?> found = new AnnotatedClassFinder(SpringBootConfiguration.class)
|
||||||
.findFromClass(mergedConfig.getTestClass());
|
.findFromClass(mergedConfig.getTestClass());
|
||||||
Assert.state(found != null, "Unable to find a @SpringBootConfiguration, you need to use "
|
Assert.state(found != null, "Unable to find a @SpringBootConfiguration, you need to use "
|
||||||
+ "@ContextConfiguration or @SpringBootTest(classes=...) " + "with your test");
|
+ "@ContextConfiguration or @SpringBootTest(classes=...) with your test");
|
||||||
logger.info("Found @SpringBootConfiguration " + found.getName() + " for test " + mergedConfig.getTestClass());
|
logger.info("Found @SpringBootConfiguration " + found.getName() + " for test " + mergedConfig.getTestClass());
|
||||||
return merge(found, classes);
|
return merge(found, classes);
|
||||||
}
|
}
|
||||||
@ -327,7 +327,7 @@ public class SpringBootTestContextBootstrapper extends DefaultTestContextBootstr
|
|||||||
.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).isPresent(WebAppConfiguration.class)) {
|
.from(testClass, SearchStrategy.INHERITED_ANNOTATIONS).isPresent(WebAppConfiguration.class)) {
|
||||||
throw new IllegalStateException("@WebAppConfiguration should only be used "
|
throw new IllegalStateException("@WebAppConfiguration should only be used "
|
||||||
+ "with @SpringBootTest when @SpringBootTest is configured with a "
|
+ "with @SpringBootTest when @SpringBootTest is configured with a "
|
||||||
+ "mock web environment. Please remove @WebAppConfiguration or " + "reconfigure @SpringBootTest.");
|
+ "mock web environment. Please remove @WebAppConfiguration or reconfigure @SpringBootTest.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,12 +69,12 @@ class DuplicateJsonObjectContextCustomizerFactory implements ContextCustomizerFa
|
|||||||
|
|
||||||
private void logDuplicateJsonObjectsWarning(List<URL> jsonObjects) {
|
private void logDuplicateJsonObjectsWarning(List<URL> jsonObjects) {
|
||||||
StringBuilder message = new StringBuilder(
|
StringBuilder message = new StringBuilder(
|
||||||
String.format("%n%nFound multiple occurrences of" + " org.json.JSONObject on the class path:%n%n"));
|
String.format("%n%nFound multiple occurrences of org.json.JSONObject on the class path:%n%n"));
|
||||||
for (URL jsonObject : jsonObjects) {
|
for (URL jsonObject : jsonObjects) {
|
||||||
message.append(String.format("\t%s%n", jsonObject));
|
message.append(String.format("\t%s%n", jsonObject));
|
||||||
}
|
}
|
||||||
message.append(String
|
message.append(
|
||||||
.format("%nYou may wish to exclude one of them to ensure" + " predictable runtime behavior%n"));
|
String.format("%nYou may wish to exclude one of them to ensure predictable runtime behavior%n"));
|
||||||
this.logger.warn(message);
|
this.logger.warn(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda
|
|||||||
@Override
|
@Override
|
||||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||||
Assert.isInstanceOf(BeanDefinitionRegistry.class, beanFactory,
|
Assert.isInstanceOf(BeanDefinitionRegistry.class, beanFactory,
|
||||||
"@MockBean can only be used on bean factories that " + "implement BeanDefinitionRegistry");
|
"@MockBean can only be used on bean factories that implement BeanDefinitionRegistry");
|
||||||
postProcessBeanFactory(beanFactory, (BeanDefinitionRegistry) beanFactory);
|
postProcessBeanFactory(beanFactory, (BeanDefinitionRegistry) beanFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,9 +96,9 @@ public class MockServerRestTemplateCustomizer implements RestTemplateCustomizer
|
|||||||
|
|
||||||
public MockRestServiceServer getServer() {
|
public MockRestServiceServer getServer() {
|
||||||
Assert.state(!this.servers.isEmpty(), "Unable to return a single MockRestServiceServer since "
|
Assert.state(!this.servers.isEmpty(), "Unable to return a single MockRestServiceServer since "
|
||||||
+ "MockServerRestTemplateCustomizer has not been bound to " + "a RestTemplate");
|
+ "MockServerRestTemplateCustomizer has not been bound to a RestTemplate");
|
||||||
Assert.state(this.servers.size() == 1, "Unable to return a single MockRestServiceServer since "
|
Assert.state(this.servers.size() == 1, "Unable to return a single MockRestServiceServer since "
|
||||||
+ "MockServerRestTemplateCustomizer has been bound to " + "more than one RestTemplate");
|
+ "MockServerRestTemplateCustomizer has been bound to more than one RestTemplate");
|
||||||
return this.servers.values().iterator().next();
|
return this.servers.values().iterator().next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ class ApplicationContextAssertProviderTests {
|
|||||||
void toStringWhenContextFailsToStartShouldReturnSimpleString() {
|
void toStringWhenContextFailsToStartShouldReturnSimpleString() {
|
||||||
ApplicationContextAssertProvider<ApplicationContext> context = get(this.startupFailureSupplier);
|
ApplicationContextAssertProvider<ApplicationContext> context = get(this.startupFailureSupplier);
|
||||||
assertThat(context.toString()).isEqualTo("Unstarted application context "
|
assertThat(context.toString()).isEqualTo("Unstarted application context "
|
||||||
+ "org.springframework.context.ApplicationContext" + "[startupFailure=java.lang.RuntimeException]");
|
+ "org.springframework.context.ApplicationContext[startupFailure=java.lang.RuntimeException]");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -42,7 +42,7 @@ class SpringBootTestContextBootstrapperTests {
|
|||||||
.isThrownBy(() -> buildTestContext(SpringBootTestNonMockWebEnvironmentAndWebAppConfiguration.class))
|
.isThrownBy(() -> buildTestContext(SpringBootTestNonMockWebEnvironmentAndWebAppConfiguration.class))
|
||||||
.withMessageContaining("@WebAppConfiguration should only be used with "
|
.withMessageContaining("@WebAppConfiguration should only be used with "
|
||||||
+ "@SpringBootTest when @SpringBootTest is configured with a mock web "
|
+ "@SpringBootTest when @SpringBootTest is configured with a mock web "
|
||||||
+ "environment. Please remove @WebAppConfiguration or reconfigure " + "@SpringBootTest.");
|
+ "environment. Please remove @WebAppConfiguration or reconfigure @SpringBootTest.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user