Closes gh-10168
pull/10130/merge
Johnny Lim 7 years ago committed by Stephane Nicoll
parent 8b88c6e884
commit 30262e3bc1

@ -121,8 +121,8 @@ public class StatsdMetricWriter implements MetricWriter, Closeable {
/** /**
* Sanitize the metric name if necessary. * Sanitize the metric name if necessary.
* @param name The metric name * @param name the metric name
* @return The sanitized metric name * @return the sanitized metric name
*/ */
private String sanitizeMetricName(String name) { private String sanitizeMetricName(String name) {
return name.replace(":", "-"); return name.replace(":", "-");

@ -74,19 +74,19 @@ public class CompositeReactiveHealthIndicatorFactoryTests {
@Test @Test
public void reactiveHealthIndicatorTakesPrecedence() { public void reactiveHealthIndicatorTakesPrecedence() {
ReactiveHealthIndicator reactivehealthIndicator = mock( ReactiveHealthIndicator reactiveHealthIndicator = mock(
ReactiveHealthIndicator.class); ReactiveHealthIndicator.class);
given(reactivehealthIndicator.health()).willReturn(Mono.just(UP)); given(reactiveHealthIndicator.health()).willReturn(Mono.just(UP));
HealthIndicator regularHealthIndicator = mock(HealthIndicator.class); HealthIndicator regularHealthIndicator = mock(HealthIndicator.class);
given(regularHealthIndicator.health()).willReturn(UP); given(regularHealthIndicator.health()).willReturn(UP);
ReactiveHealthIndicator healthIndicator = createHealthIndicator( ReactiveHealthIndicator healthIndicator = createHealthIndicator(
Collections.singletonMap("test", reactivehealthIndicator), Collections.singletonMap("test", reactiveHealthIndicator),
Collections.singletonMap("test", regularHealthIndicator)); Collections.singletonMap("test", regularHealthIndicator));
StepVerifier.create(healthIndicator.health()).consumeNextWith((h) -> { StepVerifier.create(healthIndicator.health()).consumeNextWith((h) -> {
assertThat(h.getStatus()).isEqualTo(Status.UP); assertThat(h.getStatus()).isEqualTo(Status.UP);
assertThat(h.getDetails()).containsOnlyKeys("test"); assertThat(h.getDetails()).containsOnlyKeys("test");
}).verifyComplete(); }).verifyComplete();
verify(reactivehealthIndicator, times(1)).health(); verify(reactiveHealthIndicator, times(1)).health();
verify(regularHealthIndicator, times(0)).health(); verify(regularHealthIndicator, times(0)).health();
} }

@ -36,7 +36,7 @@ import org.springframework.util.ClassUtils;
*/ */
public class AutoConfigurations extends Configurations implements Ordered { public class AutoConfigurations extends Configurations implements Ordered {
private static AutoConfigurationSorter SORTER = new AutoConfigurationSorter( private static final AutoConfigurationSorter SORTER = new AutoConfigurationSorter(
new SimpleMetadataReaderFactory(), null); new SimpleMetadataReaderFactory(), null);
private static final Ordered ORDER = new AutoConfigurationImportSelector(); private static final Ordered ORDER = new AutoConfigurationImportSelector();

@ -35,8 +35,8 @@ public final class RepositoryConfiguration {
/** /**
* Creates a new {@code RepositoryConfiguration} instance. * Creates a new {@code RepositoryConfiguration} instance.
* @param name The name of the repository * @param name the name of the repository
* @param uri The uri of the repository * @param uri the uri of the repository
* @param snapshotsEnabled {@code true} if the repository should enable access to * @param snapshotsEnabled {@code true} if the repository should enable access to
* snapshots, {@code false} otherwise * snapshots, {@code false} otherwise
*/ */

@ -60,7 +60,7 @@ public final class TestPropertyValues {
/** /**
* Builder method to add more properties. * Builder method to add more properties.
* @param pairs The property pairs to add * @param pairs the property pairs to add
* @return a new {@link TestPropertyValues} instance * @return a new {@link TestPropertyValues} instance
*/ */
public TestPropertyValues and(String... pairs) { public TestPropertyValues and(String... pairs) {
@ -119,7 +119,7 @@ public final class TestPropertyValues {
/** /**
* Add the properties to the {@link System#getProperties() system properties} for the * Add the properties to the {@link System#getProperties() system properties} for the
* duration of the {@code call}, restoring previous values then the call completes. * duration of the {@code call}, restoring previous values when the call completes.
* @param <T> the result type * @param <T> the result type
* @param call the call to make * @param call the call to make
* @return the result of the call * @return the result of the call
@ -158,7 +158,7 @@ public final class TestPropertyValues {
* Return a new {@link TestPropertyValues} with the underlying map populated with the * Return a new {@link TestPropertyValues} with the underlying map populated with the
* given property pairs. Name-value pairs can be specified with colon (":") or equals * given property pairs. Name-value pairs can be specified with colon (":") or equals
* ("=") separators. * ("=") separators.
* @param pairs The key value pairs for properties that need to be added to the * @param pairs the name-value pairs for properties that need to be added to the
* environment * environment
* @return the new instance * @return the new instance
*/ */
@ -170,7 +170,7 @@ public final class TestPropertyValues {
* Return a new {@link TestPropertyValues} with the underlying map populated with the * Return a new {@link TestPropertyValues} with the underlying map populated with the
* given property pairs. Name-value pairs can be specified with colon (":") or equals * given property pairs. Name-value pairs can be specified with colon (":") or equals
* ("=") separators. * ("=") separators.
* @param pairs The key value pairs for properties that need to be added to the * @param pairs the name-value pairs for properties that need to be added to the
* environment * environment
* @return the new instance * @return the new instance
*/ */
@ -185,7 +185,7 @@ public final class TestPropertyValues {
* Return a new {@link TestPropertyValues} with the underlying map populated with the * Return a new {@link TestPropertyValues} with the underlying map populated with the
* given property pairs. Name-value pairs can be specified with colon (":") or equals * given property pairs. Name-value pairs can be specified with colon (":") or equals
* ("=") separators. * ("=") separators.
* @param pairs The key value pairs for properties that need to be added to the * @param pairs the name-value pairs for properties that need to be added to the
* environment * environment
* @return the new instance * @return the new instance
*/ */
@ -197,7 +197,7 @@ public final class TestPropertyValues {
} }
/** /**
* Return a new empty {@link TestPropertyValues} instance. * Return an empty {@link TestPropertyValues} instance.
* @return an empty instance * @return an empty instance
*/ */
public static TestPropertyValues empty() { public static TestPropertyValues empty() {
@ -252,9 +252,9 @@ public final class TestPropertyValues {
public static Pair parse(String pair) { public static Pair parse(String pair) {
int index = getSeparatorIndex(pair); int index = getSeparatorIndex(pair);
String key = (index > 0 ? pair.substring(0, index) : pair); String name = (index > 0 ? pair.substring(0, index) : pair);
String value = (index > 0 ? pair.substring(index + 1) : ""); String value = (index > 0 ? pair.substring(index + 1) : "");
return of(key.trim(), value.trim()); return of(name.trim(), value.trim());
} }
private static int getSeparatorIndex(String pair) { private static int getSeparatorIndex(String pair) {

@ -132,7 +132,6 @@ public class TestPropertyValuesTests {
return null; return null;
}); });
assertThat(System.getProperty("foo")).isEqualTo("bar1"); assertThat(System.getProperty("foo")).isEqualTo("bar1");
assertThat(System.getProperties()).doesNotContainKey("baz");
} }
finally { finally {
System.clearProperty("foo"); System.clearProperty("foo");

@ -36,9 +36,9 @@ import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.Assert; import org.springframework.util.Assert;
/** /**
* A set of {@link Configuration @Configuration} classes that can be registered * A set of {@link Configuration @Configuration} classes that can be registered in
* {@link ApplicationContext}. Classes can be returned from one or more * {@link ApplicationContext}. Classes can be returned from one or more
* {@link Configurations} instance by using {@link #getClasses(Configurations[])}. The * {@link Configurations} instances by using {@link #getClasses(Configurations[])}. The
* resulting array follows the ordering rules usually applied by the * resulting array follows the ordering rules usually applied by the
* {@link ApplicationContext} and/or custom {@link ImportSelector} implementations. * {@link ApplicationContext} and/or custom {@link ImportSelector} implementations.
* <p> * <p>
@ -57,7 +57,7 @@ public abstract class Configurations {
private static final Comparator<Object> COMPARATOR = OrderComparator.INSTANCE private static final Comparator<Object> COMPARATOR = OrderComparator.INSTANCE
.thenComparing((other) -> other.getClass().getName()); .thenComparing((other) -> other.getClass().getName());
private Set<Class<?>> classes; private final Set<Class<?>> classes;
protected Configurations(Collection<Class<?>> classes) { protected Configurations(Collection<Class<?>> classes) {
Assert.notNull(classes, "Classes must not be null"); Assert.notNull(classes, "Classes must not be null");
@ -92,7 +92,7 @@ public abstract class Configurations {
/** /**
* Merge configurations. * Merge configurations.
* @param mergedClasses the merge classes * @param mergedClasses the merged classes
* @return a new configurations instance (must be of the same type as this instance) * @return a new configurations instance (must be of the same type as this instance)
*/ */
protected abstract Configurations merge(Set<Class<?>> mergedClasses); protected abstract Configurations merge(Set<Class<?>> mergedClasses);

@ -72,7 +72,7 @@ public abstract class AbstractWebEndpointServletHandlerMapping
* operations of the given {@code webEndpoints}. * operations of the given {@code webEndpoints}.
* @param endpointPath the path beneath which all endpoints should be mapped * @param endpointPath the path beneath which all endpoints should be mapped
* @param webEndpoints the web endpoints * @param webEndpoints the web endpoints
* @param corsConfiguration the CORS configuraton for the endpoints * @param corsConfiguration the CORS configuration for the endpoints
*/ */
public AbstractWebEndpointServletHandlerMapping(String endpointPath, public AbstractWebEndpointServletHandlerMapping(String endpointPath,
Collection<EndpointInfo<WebEndpointOperation>> webEndpoints, Collection<EndpointInfo<WebEndpointOperation>> webEndpoints,

@ -68,7 +68,7 @@ public class GenericReactiveWebApplicationContext
* {@link org.springframework.web.context.support.ServletContextResource} in a * {@link org.springframework.web.context.support.ServletContextResource} in a
* reactive web application. * reactive web application.
* <p> * <p>
* {@link #exists()} always returns null in order to avoid exposing the whole * {@link #exists()} always returns {@code false} in order to avoid exposing the whole
* classpath in a non-servlet environment. * classpath in a non-servlet environment.
*/ */
class FilteredReactiveWebContextResource extends AbstractResource { class FilteredReactiveWebContextResource extends AbstractResource {

@ -68,7 +68,6 @@ public class ConfigurationsTests {
Arrays.asList(String.class, Integer.class)); Arrays.asList(String.class, Integer.class));
Configurations c4 = new TestConfigurations(Arrays.asList(Long.class, Byte.class)); Configurations c4 = new TestConfigurations(Arrays.asList(Long.class, Byte.class));
Class<?>[] classes = Configurations.getClasses(c1, c2, c3, c4); Class<?>[] classes = Configurations.getClasses(c1, c2, c3, c4);
System.out.println(Arrays.asList(classes));
assertThat(classes).containsExactly(Short.class, Long.class, Byte.class, assertThat(classes).containsExactly(Short.class, Long.class, Byte.class,
InputStream.class, Integer.class, OutputStream.class, String.class); InputStream.class, Integer.class, OutputStream.class, String.class);
} }

Loading…
Cancel
Save