Polish
This commit is contained in:
parent
306c79f0de
commit
29c3be3590
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 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.
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ public class ControllerEndpointHandlerMapping extends RequestMappingHandlerMappi
|
|||
ExposableControllerEndpoint endpoint, RequestMappingInfo mapping) {
|
||||
Set<PathPattern> patterns = mapping.getPatternsCondition().getPatterns();
|
||||
if (patterns.isEmpty()) {
|
||||
patterns = new HashSet<PathPattern>(
|
||||
patterns = new HashSet<>(
|
||||
Arrays.asList(getPathPatternParser().parse("")));
|
||||
}
|
||||
PathPattern[] endpointMappedPatterns = patterns.stream()
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ final class TraceableHttpServletRequest implements TraceableRequest {
|
|||
}
|
||||
|
||||
private List<String> toList(Enumeration<String> enumeration) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
List<String> list = new ArrayList<>();
|
||||
while (enumeration.hasMoreElements()) {
|
||||
list.add(enumeration.nextElement());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -358,8 +358,7 @@ public final class ConditionMessage {
|
|||
* @return a built {@link ConditionMessage}
|
||||
*/
|
||||
public ConditionMessage items(Style style, Object... items) {
|
||||
return items(style,
|
||||
items == null ? null : Arrays.asList(items));
|
||||
return items(style, items == null ? null : Arrays.asList(items));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 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.
|
||||
|
|
|
|||
|
|
@ -250,11 +250,11 @@ public class SessionAutoConfiguration {
|
|||
if (storeType != StoreType.NONE
|
||||
&& this.sessionRepositoryProvider.getIfAvailable() == null) {
|
||||
if (storeType != null) {
|
||||
throw new SessionRepositoryUnavailableException("No session "
|
||||
+ "repository could be auto-configured, check your "
|
||||
+ "configuration (session store type is '"
|
||||
+ storeType.name().toLowerCase(Locale.ENGLISH)
|
||||
+ "')", storeType);
|
||||
throw new SessionRepositoryUnavailableException(
|
||||
"No session repository could be auto-configured, check your "
|
||||
+ "configuration (session store type is '"
|
||||
+ storeType.name().toLowerCase(Locale.ENGLISH) + "')",
|
||||
storeType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 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.
|
||||
|
|
|
|||
|
|
@ -86,18 +86,14 @@ public class MessageSourceAutoConfigurationTests {
|
|||
|
||||
@Test
|
||||
public void testCacheDurationNoUnit() {
|
||||
this.contextRunner
|
||||
.withPropertyValues("spring.messages.basename:test/messages",
|
||||
"spring.messages.cache-duration=10")
|
||||
.run(assertCache(10 * 1000));
|
||||
this.contextRunner.withPropertyValues("spring.messages.basename:test/messages",
|
||||
"spring.messages.cache-duration=10").run(assertCache(10 * 1000));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCacheDurationWithUnit() {
|
||||
this.contextRunner
|
||||
.withPropertyValues("spring.messages.basename:test/messages",
|
||||
"spring.messages.cache-duration=1m")
|
||||
.run(assertCache(60 * 1000));
|
||||
this.contextRunner.withPropertyValues("spring.messages.basename:test/messages",
|
||||
"spring.messages.cache-duration=1m").run(assertCache(60 * 1000));
|
||||
}
|
||||
|
||||
private ContextConsumer<AssertableApplicationContext> assertCache(long expected) {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ public class RedisAutoConfigurationJedisTests {
|
|||
|
||||
@Test
|
||||
public void testOverrideRedisConfiguration() {
|
||||
this.contextRunner.withPropertyValues("spring.redis.host:foo", "spring.redis.database:1")
|
||||
this.contextRunner
|
||||
.withPropertyValues("spring.redis.host:foo", "spring.redis.database:1")
|
||||
.run((context) -> {
|
||||
JedisConnectionFactory cf = context
|
||||
.getBean(JedisConnectionFactory.class);
|
||||
|
|
@ -60,10 +61,12 @@ public class RedisAutoConfigurationJedisTests {
|
|||
|
||||
@Test
|
||||
public void testCustomizeRedisConfiguration() {
|
||||
this.contextRunner.withUserConfiguration(CustomConfiguration.class).run((context) -> {
|
||||
JedisConnectionFactory cf = context.getBean(JedisConnectionFactory.class);
|
||||
assertThat(cf.isUseSsl()).isTrue();
|
||||
});
|
||||
this.contextRunner.withUserConfiguration(CustomConfiguration.class)
|
||||
.run((context) -> {
|
||||
JedisConnectionFactory cf = context
|
||||
.getBean(JedisConnectionFactory.class);
|
||||
assertThat(cf.isUseSsl()).isTrue();
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -99,7 +102,8 @@ public class RedisAutoConfigurationJedisTests {
|
|||
|
||||
@Test
|
||||
public void testPasswordInUrlWithColon() {
|
||||
this.contextRunner.withPropertyValues("spring.redis.url:redis://:pass:word@example:33")
|
||||
this.contextRunner
|
||||
.withPropertyValues("spring.redis.url:redis://:pass:word@example:33")
|
||||
.run((context) -> {
|
||||
assertThat(
|
||||
context.getBean(JedisConnectionFactory.class).getHostName())
|
||||
|
|
|
|||
|
|
@ -72,8 +72,8 @@ public class MustacheAutoConfigurationReactiveIntegrationTests {
|
|||
}
|
||||
|
||||
@Configuration
|
||||
@Import({ ReactiveWebServerFactoryAutoConfiguration.class, WebFluxAutoConfiguration.class,
|
||||
HttpHandlerAutoConfiguration.class,
|
||||
@Import({ ReactiveWebServerFactoryAutoConfiguration.class,
|
||||
WebFluxAutoConfiguration.class, HttpHandlerAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class })
|
||||
@Controller
|
||||
public static class Application {
|
||||
|
|
|
|||
|
|
@ -42,8 +42,7 @@ public class ReactiveWebServerFactoryCustomizerTests {
|
|||
|
||||
@Before
|
||||
public void setup() {
|
||||
this.customizer = new ReactiveWebServerFactoryCustomizer(
|
||||
this.properties);
|
||||
this.customizer = new ReactiveWebServerFactoryCustomizer(this.properties);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -62,8 +62,7 @@ public class ServletWebServerFactoryCustomizerTests {
|
|||
@Before
|
||||
public void setup() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
this.customizer = new ServletWebServerFactoryCustomizer(
|
||||
this.properties);
|
||||
this.customizer = new ServletWebServerFactoryCustomizer(this.properties);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 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.
|
||||
|
|
|
|||
|
|
@ -129,9 +129,10 @@ abstract class ArchiveCommand extends OptionParsingCommand {
|
|||
|
||||
File output = new File((String) nonOptionArguments.remove(0));
|
||||
Assert.isTrue(
|
||||
output.getName().toLowerCase(Locale.ENGLISH).endsWith("." + this.type),
|
||||
"The output '" + output + "' is not a " + this.type.toUpperCase(
|
||||
Locale.ENGLISH) + " file.");
|
||||
output.getName().toLowerCase(Locale.ENGLISH)
|
||||
.endsWith("." + this.type),
|
||||
"The output '" + output + "' is not a "
|
||||
+ this.type.toUpperCase(Locale.ENGLISH) + " file.");
|
||||
deleteIfExists(output);
|
||||
|
||||
GroovyCompiler compiler = createCompiler(options);
|
||||
|
|
|
|||
|
|
@ -324,9 +324,8 @@ public class AetherGrapeEngine implements GrapeEngine {
|
|||
}
|
||||
|
||||
private DependencyRequest getDependencyRequest(CollectRequest collectRequest) {
|
||||
return new DependencyRequest(collectRequest,
|
||||
DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE,
|
||||
JavaScopes.RUNTIME));
|
||||
return new DependencyRequest(collectRequest, DependencyFilterUtils
|
||||
.classpathFilter(JavaScopes.COMPILE, JavaScopes.RUNTIME));
|
||||
}
|
||||
|
||||
private void addManagedDependencies(DependencyResult result) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 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.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 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.
|
||||
|
|
|
|||
|
|
@ -48,12 +48,14 @@ public class CloudFoundryCustomContextPathExample {
|
|||
return new TomcatServletWebServerFactory() {
|
||||
|
||||
@Override
|
||||
protected void prepareContext(Host host, ServletContextInitializer[] initializers) {
|
||||
protected void prepareContext(Host host,
|
||||
ServletContextInitializer[] initializers) {
|
||||
super.prepareContext(host, initializers);
|
||||
StandardContext child = new StandardContext();
|
||||
child.addLifecycleListener(new Tomcat.FixContextListener());
|
||||
child.setPath("/cloudfoundryapplication");
|
||||
ServletContainerInitializer initializer = getServletContextInitializer(getContextPath());
|
||||
ServletContainerInitializer initializer = getServletContextInitializer(
|
||||
getContextPath());
|
||||
child.addServletContainerInitializer(initializer, Collections.emptySet());
|
||||
child.setCrossContext(true);
|
||||
host.addChild(child);
|
||||
|
|
@ -69,8 +71,10 @@ public class CloudFoundryCustomContextPathExample {
|
|||
@Override
|
||||
public void service(ServletRequest req, ServletResponse res)
|
||||
throws ServletException, IOException {
|
||||
ServletContext context = req.getServletContext().getContext(contextPath);
|
||||
context.getRequestDispatcher("/cloudfoundryapplication").forward(req, res);
|
||||
ServletContext context = req.getServletContext()
|
||||
.getContext(contextPath);
|
||||
context.getRequestDispatcher("/cloudfoundryapplication").forward(req,
|
||||
res);
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 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.
|
||||
|
|
@ -95,13 +95,13 @@ public class MetadataStore {
|
|||
}
|
||||
|
||||
private FileObject getMetadataResource() throws IOException {
|
||||
return this.environment.getFiler()
|
||||
.getResource(StandardLocation.CLASS_OUTPUT, "", METADATA_PATH);
|
||||
return this.environment.getFiler().getResource(StandardLocation.CLASS_OUTPUT, "",
|
||||
METADATA_PATH);
|
||||
}
|
||||
|
||||
private FileObject createMetadataResource() throws IOException {
|
||||
return this.environment.getFiler()
|
||||
.createResource(StandardLocation.CLASS_OUTPUT, "", METADATA_PATH);
|
||||
return this.environment.getFiler().createResource(StandardLocation.CLASS_OUTPUT,
|
||||
"", METADATA_PATH);
|
||||
}
|
||||
|
||||
private InputStream getAdditionalMetadataStream() throws IOException {
|
||||
|
|
|
|||
|
|
@ -140,9 +140,8 @@ final class JavaPluginAction implements PluginApplicationAction {
|
|||
}
|
||||
|
||||
private void configureAdditionalMetadataLocations(Project project) {
|
||||
project.afterEvaluate((evaluated) ->
|
||||
evaluated.getTasks().withType(JavaCompile.class,
|
||||
this::configureAdditionalMetadataLocations));
|
||||
project.afterEvaluate((evaluated) -> evaluated.getTasks()
|
||||
.withType(JavaCompile.class, this::configureAdditionalMetadataLocations));
|
||||
}
|
||||
|
||||
private void configureAdditionalMetadataLocations(JavaCompile compile) {
|
||||
|
|
|
|||
|
|
@ -247,8 +247,8 @@ public class JarWriter implements LoaderClassesWriter, AutoCloseable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Perform the actual write of a {@link JarEntry}. All other write methods
|
||||
* delegate to this one.
|
||||
* Perform the actual write of a {@link JarEntry}. All other write methods delegate to
|
||||
* this one.
|
||||
* @param entry the entry to write
|
||||
* @param entryWriter the entry writer or {@code null} if there is no content
|
||||
* @param unpackHandler handles possible unpacking for the entry
|
||||
|
|
|
|||
|
|
@ -208,8 +208,7 @@ public class RepackagerTests {
|
|||
repackager.setLayout(new Layouts.None());
|
||||
repackager.repackage(file, NO_LIBRARIES);
|
||||
Manifest actualManifest = getManifest(file);
|
||||
assertThat(actualManifest.getMainAttributes().getValue("Main-Class"))
|
||||
.isNull();
|
||||
assertThat(actualManifest.getMainAttributes().getValue("Main-Class")).isNull();
|
||||
assertThat(hasLauncherClasses(file)).isFalse();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ public class JarFile extends java.util.jar.JarFile {
|
|||
|
||||
private JarFile(RandomAccessDataFile rootFile, String pathFromRoot,
|
||||
RandomAccessData data, JarEntryFilter filter, JarFileType type)
|
||||
throws IOException {
|
||||
throws IOException {
|
||||
super(rootFile.getFile());
|
||||
this.rootFile = rootFile;
|
||||
this.pathFromRoot = pathFromRoot;
|
||||
|
|
|
|||
|
|
@ -185,12 +185,13 @@ public abstract class SystemPropertyUtils {
|
|||
}
|
||||
if (propVal == null) {
|
||||
// Try with underscores.
|
||||
propVal = System.getenv(key.replace('.', '_'));
|
||||
String name = key.replace('.', '_');
|
||||
propVal = System.getenv(name);
|
||||
}
|
||||
if (propVal == null) {
|
||||
// Try uppercase with underscores as well.
|
||||
propVal = System.getenv(key.toUpperCase(Locale.ENGLISH)
|
||||
.replace('.', '_'));
|
||||
String name = key.toUpperCase(Locale.ENGLISH).replace('.', '_');
|
||||
propVal = System.getenv(name);
|
||||
}
|
||||
if (propVal != null) {
|
||||
return propVal;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 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.
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ public final class LambdaSafe {
|
|||
|
||||
private Log logger;
|
||||
|
||||
private Filter<C, A> filter = new GenericTypeFilter<C, A>();
|
||||
private Filter<C, A> filter = new GenericTypeFilter<>();
|
||||
|
||||
protected LambdaSafeCallback(Class<C> callbackType, A argument,
|
||||
Object[] additionalArguments) {
|
||||
|
|
@ -414,7 +414,7 @@ public final class LambdaSafe {
|
|||
* @return an {@link InvocationResult}
|
||||
*/
|
||||
public static <R> InvocationResult<R> of(R value) {
|
||||
return new InvocationResult<R>(value);
|
||||
return new InvocationResult<>(value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2018 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.
|
||||
|
|
@ -47,10 +47,12 @@ public class SampleAntApplicationIT {
|
|||
|
||||
});
|
||||
assertThat(jarFiles).hasSize(1);
|
||||
Process process = new JavaExecutable().processBuilder("-jar", jarFiles[0].getName()).directory(target).start();
|
||||
Process process = new JavaExecutable().processBuilder("-jar", jarFiles[0]
|
||||
.getName()).directory(target).start();
|
||||
process.waitFor(5, TimeUnit.MINUTES);
|
||||
assertThat(process.exitValue()).isEqualTo(0);
|
||||
String output = FileCopyUtils.copyToString(new InputStreamReader(process.getInputStream()));
|
||||
String output = FileCopyUtils.copyToString(new InputStreamReader(process
|
||||
.getInputStream()));
|
||||
assertThat(output).contains("Spring Boot Ant Example");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue