pull/12071/merge
Andy Wilkinson 7 years ago
parent e3f0a70df2
commit a9645a3d07

@ -115,7 +115,7 @@ public class ConfigurationPropertiesReportEndpoint
String beanName = entry.getKey();
Object bean = entry.getValue();
Map<String, Object> root = new HashMap<String, Object>();
String prefix = extractPrefix(context, beanFactoryMetaData, beanName, bean);
String prefix = extractPrefix(context, beanFactoryMetaData, beanName);
root.put("prefix", prefix);
root.put("properties", sanitize(prefix, safeSerialize(mapper, bean, prefix)));
result.put(beanName, root);
@ -204,12 +204,10 @@ public class ConfigurationPropertiesReportEndpoint
* @param context the application context
* @param beanFactoryMetaData the bean factory meta-data
* @param beanName the bean name
* @param bean the bean
* @return the prefix
*/
private String extractPrefix(ApplicationContext context,
ConfigurationBeanFactoryMetaData beanFactoryMetaData, String beanName,
Object bean) {
ConfigurationBeanFactoryMetaData beanFactoryMetaData, String beanName) {
ConfigurationProperties annotation = context.findAnnotationOnBean(beanName,
ConfigurationProperties.class);
if (beanFactoryMetaData != null) {

@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 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.
@ -80,7 +80,7 @@ public class RedisMultiMetricRepository implements MultiMetricRepository {
List<String> values = this.redisOperations.opsForValue().multiGet(keys);
for (String v : values) {
String key = keysIt.next();
result.add(deserialize(group, key, v, zSetOperations.score(key)));
result.add(deserialize(key, v, zSetOperations.score(key)));
}
return result;
@ -143,7 +143,7 @@ public class RedisMultiMetricRepository implements MultiMetricRepository {
this.zSetOperations.remove(groupKey);
}
private Metric<?> deserialize(String group, String redisKey, String v, Double value) {
private Metric<?> deserialize(String redisKey, String v, Double value) {
Date timestamp = new Date(Long.valueOf(v));
return new Metric<Double>(nameFor(redisKey), value, timestamp);
}

@ -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.
@ -51,8 +51,7 @@ public class TestCommand extends OptionParsingCommand {
SourceOptions sourceOptions = new SourceOptions(options);
TestRunnerConfiguration configuration = new TestRunnerConfigurationAdapter(
options, this);
this.runner = new TestRunner(configuration, sourceOptions.getSourcesArray(),
sourceOptions.getArgsArray());
this.runner = new TestRunner(configuration, sourceOptions.getSourcesArray());
this.runner.compileAndRunTests();
return ExitStatus.OK.hangup();
}

@ -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.
@ -46,9 +46,8 @@ public class TestRunner {
* Create a new {@link TestRunner} instance.
* @param configuration the configuration
* @param sources the sources
* @param args the args
*/
TestRunner(TestRunnerConfiguration configuration, String[] sources, String[] args) {
TestRunner(TestRunnerConfiguration configuration, String[] sources) {
this.sources = sources.clone();
this.compiler = new GroovyCompiler(configuration);
}
@ -97,12 +96,11 @@ public class TestRunner {
if (sources.length != 0 && sources[0] instanceof Class) {
setContextClassLoader(((Class<?>) sources[0]).getClassLoader());
}
this.spockSpecificationClass = loadSpockSpecificationClass(
getContextClassLoader());
this.spockSpecificationClass = loadSpockSpecificationClass();
this.testClasses = getTestClasses(sources);
}
private Class<?> loadSpockSpecificationClass(ClassLoader contextClassLoader) {
private Class<?> loadSpockSpecificationClass() {
try {
return getContextClassLoader().loadClass("spock.lang.Specification");
}

@ -186,7 +186,7 @@ public class ExtendedGroovyClassLoader extends GroovyClassLoader {
Set<URL> urls = new HashSet<URL>();
findGroovyJarsDirectly(parent, urls);
if (urls.isEmpty()) {
findGroovyJarsFromClassPath(parent, urls);
findGroovyJarsFromClassPath(urls);
}
Assert.state(!urls.isEmpty(), "Unable to find groovy JAR");
return new ArrayList<URL>(urls).toArray(new URL[urls.size()]);
@ -205,7 +205,7 @@ public class ExtendedGroovyClassLoader extends GroovyClassLoader {
}
}
private void findGroovyJarsFromClassPath(ClassLoader parent, Set<URL> urls) {
private void findGroovyJarsFromClassPath(Set<URL> urls) {
String classpath = System.getProperty("java.class.path");
String[] entries = classpath.split(System.getProperty("path.separator"));
for (String entry : entries) {

@ -56,7 +56,7 @@ class SpringApplicationBannerPrinter {
}
public Banner print(Environment environment, Class<?> sourceClass, Log logger) {
Banner banner = getBanner(environment, this.fallbackBanner);
Banner banner = getBanner(environment);
try {
logger.info(createStringFromBanner(banner, environment, sourceClass));
}
@ -67,12 +67,12 @@ class SpringApplicationBannerPrinter {
}
public Banner print(Environment environment, Class<?> sourceClass, PrintStream out) {
Banner banner = getBanner(environment, this.fallbackBanner);
Banner banner = getBanner(environment);
banner.printBanner(environment, sourceClass, out);
return new PrintedBanner(banner, sourceClass);
}
private Banner getBanner(Environment environment, Banner definedBanner) {
private Banner getBanner(Environment environment) {
Banners banners = new Banners();
banners.addIfNotNull(getImageBanner(environment));
banners.addIfNotNull(getTextBanner(environment));

@ -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.
@ -50,10 +50,10 @@ class TomcatErrorPage {
this.location = errorPage.getPath();
this.exceptionType = errorPage.getExceptionName();
this.errorCode = errorPage.getStatusCode();
this.nativePage = createNativePage(errorPage);
this.nativePage = createNativePage();
}
private Object createNativePage(ErrorPage errorPage) {
private Object createNativePage() {
try {
if (ClassUtils.isPresent(ERROR_PAGE_CLASS, null)) {
return BeanUtils.instantiate(ClassUtils.forName(ERROR_PAGE_CLASS, null));

@ -41,7 +41,7 @@ public class RelaxedConversionServiceTests {
Locale.setDefault(new Locale("tr"));
TestEnum result = this.conversionService
.convert("accept-case-insensitive-properties", TestEnum.class);
assertThat(result.equals(TestEnum.ACCEPT_CASE_INSENSITIVE_PROPERTIES));
assertThat(result).isEqualTo(TestEnum.ACCEPT_CASE_INSENSITIVE_PROPERTIES);
}
finally {
Locale.setDefault(defaultLocale);

Loading…
Cancel
Save