Polish
This commit is contained in:
@@ -395,8 +395,8 @@ public class SpringApplicationBuilder {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
for (String property : properties) {
|
||||
int index = lowestIndexOf(property, ":", "=");
|
||||
String key = index > 0 ? property.substring(0, index) : property;
|
||||
String value = index > 0 ? property.substring(index + 1) : "";
|
||||
String key = (index > 0 ? property.substring(0, index) : property);
|
||||
String value = (index > 0 ? property.substring(index + 1) : "");
|
||||
map.put(key, value);
|
||||
}
|
||||
return map;
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
package org.springframework.boot.endpoint;
|
||||
|
||||
/**
|
||||
* Strategy interface that can be used to resolve endpoint paths
|
||||
* based on endpoint id.
|
||||
* Strategy interface that can be used to resolve endpoint paths based on endpoint id.
|
||||
*
|
||||
* @author Madhura Bhave
|
||||
* @since 2.0.0
|
||||
@@ -33,4 +32,3 @@ public interface EndpointPathResolver {
|
||||
String resolvePath(String endpointId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,8 @@ import org.springframework.core.env.PropertySource;
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public class ServerPortInfoApplicationContextInitializer
|
||||
implements ApplicationContextInitializer<ConfigurableApplicationContext>, ApplicationListener<WebServerInitializedEvent> {
|
||||
implements ApplicationContextInitializer<ConfigurableApplicationContext>,
|
||||
ApplicationListener<WebServerInitializedEvent> {
|
||||
|
||||
@Override
|
||||
public void initialize(ConfigurableApplicationContext applicationContext) {
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.boot.web.servlet;
|
||||
|
||||
/**
|
||||
* Enumeration of filter dispatcher types, identical to
|
||||
* {@link javax.servlet.DispatcherType} and used in configuration as the servlet api may
|
||||
* {@link javax.servlet.DispatcherType} and used in configuration as the servlet API may
|
||||
* not be present.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -102,8 +102,8 @@ public class BindFailureAnalyzerTests {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
for (String pair : environment) {
|
||||
int index = pair.indexOf("=");
|
||||
String key = index > 0 ? pair.substring(0, index) : pair;
|
||||
String value = index > 0 ? pair.substring(index + 1) : "";
|
||||
String key = (index > 0 ? pair.substring(0, index) : pair);
|
||||
String value = (index > 0 ? pair.substring(index + 1) : "");
|
||||
map.put(key.trim(), value.trim());
|
||||
}
|
||||
sources.addFirst(new MapPropertySource("test", map));
|
||||
|
||||
@@ -135,8 +135,8 @@ public class BindValidationFailureAnalyzerTests {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
for (String pair : environment) {
|
||||
int index = pair.indexOf("=");
|
||||
String key = index > 0 ? pair.substring(0, index) : pair;
|
||||
String value = index > 0 ? pair.substring(index + 1) : "";
|
||||
String key = (index > 0 ? pair.substring(0, index) : pair);
|
||||
String value = (index > 0 ? pair.substring(index + 1) : "");
|
||||
map.put(key.trim(), value.trim());
|
||||
}
|
||||
sources.addFirst(new MapPropertySource("test", map));
|
||||
|
||||
@@ -98,8 +98,8 @@ public class UnboundConfigurationPropertyFailureAnalyzerTests {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
for (String pair : environment) {
|
||||
int index = pair.indexOf("=");
|
||||
String key = index > 0 ? pair.substring(0, index) : pair;
|
||||
String value = index > 0 ? pair.substring(index + 1) : "";
|
||||
String key = (index > 0 ? pair.substring(0, index) : pair);
|
||||
String value = (index > 0 ? pair.substring(index + 1) : "");
|
||||
map.put(key.trim(), value.trim());
|
||||
}
|
||||
sources.addFirst(new MapPropertySource("test", map));
|
||||
|
||||
@@ -119,9 +119,8 @@ public class AnnotationEndpointDiscovererTests {
|
||||
Map<Method, TestEndpointOperation> operations = mapOperations(
|
||||
endpoints.get("test"));
|
||||
assertThat(operations).hasSize(4);
|
||||
operations.values()
|
||||
.forEach(operation -> assertThat(operation.getInvoker())
|
||||
.isNotInstanceOf(CachingOperationInvoker.class));
|
||||
operations.values().forEach(operation -> assertThat(operation.getInvoker())
|
||||
.isNotInstanceOf(CachingOperationInvoker.class));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -138,9 +137,8 @@ public class AnnotationEndpointDiscovererTests {
|
||||
Map<Method, TestEndpointOperation> operations = mapOperations(
|
||||
endpoints.get("test"));
|
||||
assertThat(operations).hasSize(4);
|
||||
operations.values()
|
||||
.forEach(operation -> assertThat(operation.getInvoker())
|
||||
.isNotInstanceOf(CachingOperationInvoker.class));
|
||||
operations.values().forEach(operation -> assertThat(operation.getInvoker())
|
||||
.isNotInstanceOf(CachingOperationInvoker.class));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -190,8 +188,8 @@ public class AnnotationEndpointDiscovererTests {
|
||||
EndpointInfo<TestEndpointOperation> endpoint) {
|
||||
Map<Method, TestEndpointOperation> operationByMethod = new HashMap<>();
|
||||
endpoint.getOperations().forEach((operation) -> {
|
||||
Operation existing = operationByMethod
|
||||
.put(operation.getOperationMethod(), operation);
|
||||
Operation existing = operationByMethod.put(operation.getOperationMethod(),
|
||||
operation);
|
||||
if (existing != null) {
|
||||
throw new AssertionError(String.format(
|
||||
"Found endpoint with duplicate operation method '%s'",
|
||||
|
||||
@@ -113,7 +113,7 @@ public class EndpointMBeanTests {
|
||||
// deleteOne
|
||||
Object deleteResponse = this.server.invoke(objectName, "deleteOne",
|
||||
new Object[] { "one" }, new String[] { String.class.getName() });
|
||||
assertThat(oneResponse).isEqualTo("ONE");
|
||||
assertThat(deleteResponse).isNull();
|
||||
|
||||
// getOne validation after delete
|
||||
updatedOneResponse = this.server.invoke(objectName, "getOne",
|
||||
|
||||
@@ -171,8 +171,8 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
@Test
|
||||
public void deleteOperationWithVoidResponse() {
|
||||
load(VoidDeleteResponseEndpointConfiguration.class, (context, client) -> {
|
||||
client.delete().uri("/voiddelete").accept(MediaType.APPLICATION_JSON).exchange()
|
||||
.expectStatus().isNoContent().expectBody().isEmpty();
|
||||
client.delete().uri("/voiddelete").accept(MediaType.APPLICATION_JSON)
|
||||
.exchange().expectStatus().isNoContent().expectBody().isEmpty();
|
||||
verify(context.getBean(EndpointDelegate.class)).delete();
|
||||
});
|
||||
}
|
||||
@@ -346,7 +346,6 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Configuration
|
||||
@Import(BaseConfiguration.class)
|
||||
static class NullWriteResponseEndpointConfiguration {
|
||||
|
||||
Reference in New Issue
Block a user