parent
a256602c7b
commit
6168fae720
|
|
@ -67,7 +67,7 @@ public abstract class ManagementServerFactoryCustomizer<T extends ConfigurableWe
|
||||||
// the same place)
|
// the same place)
|
||||||
webServerFactoryCustomizer.customize(factory);
|
webServerFactoryCustomizer.customize(factory);
|
||||||
// Then reset the error pages
|
// Then reset the error pages
|
||||||
factory.setErrorPages(Collections.<ErrorPage>emptySet());
|
factory.setErrorPages(Collections.emptySet());
|
||||||
// and add the management-specific bits
|
// and add the management-specific bits
|
||||||
customize(factory, managementServerProperties, serverProperties);
|
customize(factory, managementServerProperties, serverProperties);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,6 @@ import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.context.annotation.ScopedProxyMode;
|
import org.springframework.context.annotation.ScopedProxyMode;
|
||||||
import org.springframework.context.support.StaticApplicationContext;
|
import org.springframework.context.support.StaticApplicationContext;
|
||||||
import org.springframework.web.servlet.handler.AbstractHandlerMethodMapping;
|
|
||||||
import org.springframework.web.servlet.handler.AbstractUrlHandlerMapping;
|
import org.springframework.web.servlet.handler.AbstractUrlHandlerMapping;
|
||||||
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
|
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
|
||||||
|
|
||||||
|
|
@ -60,7 +59,7 @@ public class RequestMappingEndpointTests {
|
||||||
mapping.setApplicationContext(new StaticApplicationContext());
|
mapping.setApplicationContext(new StaticApplicationContext());
|
||||||
mapping.initApplicationContext();
|
mapping.initApplicationContext();
|
||||||
this.endpoint.setHandlerMappings(
|
this.endpoint.setHandlerMappings(
|
||||||
Collections.<AbstractUrlHandlerMapping>singletonList(mapping));
|
Collections.singletonList(mapping));
|
||||||
Map<String, Object> result = this.endpoint.mappings();
|
Map<String, Object> result = this.endpoint.mappings();
|
||||||
assertThat(result).hasSize(1);
|
assertThat(result).hasSize(1);
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
@ -121,7 +120,7 @@ public class RequestMappingEndpointTests {
|
||||||
public void concreteMethodMappings() {
|
public void concreteMethodMappings() {
|
||||||
WebMvcEndpointHandlerMapping mapping = createHandlerMapping();
|
WebMvcEndpointHandlerMapping mapping = createHandlerMapping();
|
||||||
this.endpoint.setMethodMappings(
|
this.endpoint.setMethodMappings(
|
||||||
Collections.<AbstractHandlerMethodMapping<?>>singletonList(mapping));
|
Collections.singletonList(mapping));
|
||||||
Map<String, Object> result = this.endpoint.mappings();
|
Map<String, Object> result = this.endpoint.mappings();
|
||||||
assertThat(result).hasSize(2);
|
assertThat(result).hasSize(2);
|
||||||
assertThat(result.keySet())
|
assertThat(result.keySet())
|
||||||
|
|
|
||||||
|
|
@ -39,11 +39,11 @@ import org.springframework.context.ConfigurableApplicationContext;
|
||||||
public class ShutdownEndpoint implements ApplicationContextAware {
|
public class ShutdownEndpoint implements ApplicationContextAware {
|
||||||
|
|
||||||
private static final Map<String, String> NO_CONTEXT_MESSAGE = Collections
|
private static final Map<String, String> NO_CONTEXT_MESSAGE = Collections
|
||||||
.unmodifiableMap(Collections.<String, String>singletonMap("message",
|
.unmodifiableMap(Collections.singletonMap("message",
|
||||||
"No context to shutdown."));
|
"No context to shutdown."));
|
||||||
|
|
||||||
private static final Map<String, String> SHUTDOWN_MESSAGE = Collections
|
private static final Map<String, String> SHUTDOWN_MESSAGE = Collections
|
||||||
.unmodifiableMap(Collections.<String, String>singletonMap("message",
|
.unmodifiableMap(Collections.singletonMap("message",
|
||||||
"Shutting down, bye..."));
|
"Shutting down, bye..."));
|
||||||
|
|
||||||
private ConfigurableApplicationContext context;
|
private ConfigurableApplicationContext context;
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ public class ConfigurationPropertiesReportEndpoint implements ApplicationContext
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
return new HashMap<>(Collections.<String, Object>singletonMap("error",
|
return new HashMap<>(Collections.singletonMap("error",
|
||||||
"Cannot serialize '" + prefix + "'"));
|
"Cannot serialize '" + prefix + "'"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ public class AuditEventsEndpointWebIntegrationTests {
|
||||||
|
|
||||||
private AuditEvent createEvent(String instant, String principal, String type) {
|
private AuditEvent createEvent(String instant, String principal, String type) {
|
||||||
return new AuditEvent(Date.from(Instant.parse(instant)), principal, type,
|
return new AuditEvent(Date.from(Instant.parse(instant)), principal, type,
|
||||||
Collections.<String, Object>emptyMap());
|
Collections.emptyMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ public class AuditListenerTests {
|
||||||
public void testStoredEvents() {
|
public void testStoredEvents() {
|
||||||
AuditEventRepository repository = mock(AuditEventRepository.class);
|
AuditEventRepository repository = mock(AuditEventRepository.class);
|
||||||
AuditEvent event = new AuditEvent("principal", "type",
|
AuditEvent event = new AuditEvent("principal", "type",
|
||||||
Collections.<String, Object>emptyMap());
|
Collections.emptyMap());
|
||||||
AuditListener listener = new AuditListener(repository);
|
AuditListener listener = new AuditListener(repository);
|
||||||
listener.onApplicationEvent(new AuditApplicationEvent(event));
|
listener.onApplicationEvent(new AuditApplicationEvent(event));
|
||||||
verify(repository).add(event);
|
verify(repository).add(event);
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ import org.mockito.ArgumentCaptor;
|
||||||
import org.springframework.boot.actuate.audit.listener.AuditApplicationEvent;
|
import org.springframework.boot.actuate.audit.listener.AuditApplicationEvent;
|
||||||
import org.springframework.context.ApplicationEventPublisher;
|
import org.springframework.context.ApplicationEventPublisher;
|
||||||
import org.springframework.security.access.AccessDeniedException;
|
import org.springframework.security.access.AccessDeniedException;
|
||||||
import org.springframework.security.access.ConfigAttribute;
|
|
||||||
import org.springframework.security.access.SecurityConfig;
|
import org.springframework.security.access.SecurityConfig;
|
||||||
import org.springframework.security.access.event.AbstractAuthorizationEvent;
|
import org.springframework.security.access.event.AbstractAuthorizationEvent;
|
||||||
import org.springframework.security.access.event.AuthenticationCredentialsNotFoundEvent;
|
import org.springframework.security.access.event.AuthenticationCredentialsNotFoundEvent;
|
||||||
|
|
@ -56,7 +55,7 @@ public class AuthorizationAuditListenerTests {
|
||||||
public void testAuthenticationCredentialsNotFound() {
|
public void testAuthenticationCredentialsNotFound() {
|
||||||
AuditApplicationEvent event = handleAuthorizationEvent(
|
AuditApplicationEvent event = handleAuthorizationEvent(
|
||||||
new AuthenticationCredentialsNotFoundEvent(this,
|
new AuthenticationCredentialsNotFoundEvent(this,
|
||||||
Collections.<ConfigAttribute>singletonList(
|
Collections.singletonList(
|
||||||
new SecurityConfig("USER")),
|
new SecurityConfig("USER")),
|
||||||
new AuthenticationCredentialsNotFoundException("Bad user")));
|
new AuthenticationCredentialsNotFoundException("Bad user")));
|
||||||
assertThat(event.getAuditEvent().getType())
|
assertThat(event.getAuditEvent().getType())
|
||||||
|
|
@ -67,7 +66,7 @@ public class AuthorizationAuditListenerTests {
|
||||||
public void testAuthorizationFailure() {
|
public void testAuthorizationFailure() {
|
||||||
AuditApplicationEvent event = handleAuthorizationEvent(
|
AuditApplicationEvent event = handleAuthorizationEvent(
|
||||||
new AuthorizationFailureEvent(this,
|
new AuthorizationFailureEvent(this,
|
||||||
Collections.<ConfigAttribute>singletonList(
|
Collections.singletonList(
|
||||||
new SecurityConfig("USER")),
|
new SecurityConfig("USER")),
|
||||||
new UsernamePasswordAuthenticationToken("user", "password"),
|
new UsernamePasswordAuthenticationToken("user", "password"),
|
||||||
new AccessDeniedException("Bad user")));
|
new AccessDeniedException("Bad user")));
|
||||||
|
|
@ -83,7 +82,7 @@ public class AuthorizationAuditListenerTests {
|
||||||
authentication.setDetails(details);
|
authentication.setDetails(details);
|
||||||
AuditApplicationEvent event = handleAuthorizationEvent(
|
AuditApplicationEvent event = handleAuthorizationEvent(
|
||||||
new AuthorizationFailureEvent(this,
|
new AuthorizationFailureEvent(this,
|
||||||
Collections.<ConfigAttribute>singletonList(
|
Collections.singletonList(
|
||||||
new SecurityConfig("USER")),
|
new SecurityConfig("USER")),
|
||||||
authentication, new AccessDeniedException("Bad user")));
|
authentication, new AccessDeniedException("Bad user")));
|
||||||
assertThat(event.getAuditEvent().getType())
|
assertThat(event.getAuditEvent().getType())
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,9 @@ public class InMemoryTraceRepositoryTests {
|
||||||
@Test
|
@Test
|
||||||
public void capacityLimited() {
|
public void capacityLimited() {
|
||||||
this.repository.setCapacity(2);
|
this.repository.setCapacity(2);
|
||||||
this.repository.add(Collections.<String, Object>singletonMap("foo", "bar"));
|
this.repository.add(Collections.singletonMap("foo", "bar"));
|
||||||
this.repository.add(Collections.<String, Object>singletonMap("bar", "foo"));
|
this.repository.add(Collections.singletonMap("bar", "foo"));
|
||||||
this.repository.add(Collections.<String, Object>singletonMap("bar", "bar"));
|
this.repository.add(Collections.singletonMap("bar", "bar"));
|
||||||
List<Trace> traces = this.repository.findAll();
|
List<Trace> traces = this.repository.findAll();
|
||||||
assertThat(traces).hasSize(2);
|
assertThat(traces).hasSize(2);
|
||||||
assertThat(traces.get(0).getInfo().get("bar")).isEqualTo("bar");
|
assertThat(traces.get(0).getInfo().get("bar")).isEqualTo("bar");
|
||||||
|
|
@ -48,9 +48,9 @@ public class InMemoryTraceRepositoryTests {
|
||||||
public void reverseFalse() {
|
public void reverseFalse() {
|
||||||
this.repository.setReverse(false);
|
this.repository.setReverse(false);
|
||||||
this.repository.setCapacity(2);
|
this.repository.setCapacity(2);
|
||||||
this.repository.add(Collections.<String, Object>singletonMap("foo", "bar"));
|
this.repository.add(Collections.singletonMap("foo", "bar"));
|
||||||
this.repository.add(Collections.<String, Object>singletonMap("bar", "foo"));
|
this.repository.add(Collections.singletonMap("bar", "foo"));
|
||||||
this.repository.add(Collections.<String, Object>singletonMap("bar", "bar"));
|
this.repository.add(Collections.singletonMap("bar", "bar"));
|
||||||
List<Trace> traces = this.repository.findAll();
|
List<Trace> traces = this.repository.findAll();
|
||||||
assertThat(traces).hasSize(2);
|
assertThat(traces).hasSize(2);
|
||||||
assertThat(traces.get(1).getInfo().get("bar")).isEqualTo("bar");
|
assertThat(traces.get(1).getInfo().get("bar")).isEqualTo("bar");
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ public class TraceEndpointTests {
|
||||||
@Test
|
@Test
|
||||||
public void trace() throws Exception {
|
public void trace() throws Exception {
|
||||||
TraceRepository repository = new InMemoryTraceRepository();
|
TraceRepository repository = new InMemoryTraceRepository();
|
||||||
repository.add(Collections.<String, Object>singletonMap("a", "b"));
|
repository.add(Collections.singletonMap("a", "b"));
|
||||||
Trace trace = new TraceEndpoint(repository).traces().getTraces().get(0);
|
Trace trace = new TraceEndpoint(repository).traces().getTraces().get(0);
|
||||||
assertThat(trace.getInfo().get("a")).isEqualTo("b");
|
assertThat(trace.getInfo().get("a")).isEqualTo("b");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ public abstract class AutoConfigurationPackages {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<Object> determineImports(AnnotationMetadata metadata) {
|
public Set<Object> determineImports(AnnotationMetadata metadata) {
|
||||||
return Collections.<Object>singleton(new PackageImport(metadata));
|
return Collections.singleton(new PackageImport(metadata));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ class AutoConfigurationSorter {
|
||||||
private Set<String> readBefore() {
|
private Set<String> readBefore() {
|
||||||
if (wasProcessed()) {
|
if (wasProcessed()) {
|
||||||
return this.autoConfigurationMetadata.getSet(this.className,
|
return this.autoConfigurationMetadata.getSet(this.className,
|
||||||
"AutoConfigureBefore", Collections.<String>emptySet());
|
"AutoConfigureBefore", Collections.emptySet());
|
||||||
}
|
}
|
||||||
return getAnnotationValue(AutoConfigureBefore.class);
|
return getAnnotationValue(AutoConfigureBefore.class);
|
||||||
}
|
}
|
||||||
|
|
@ -182,7 +182,7 @@ class AutoConfigurationSorter {
|
||||||
private Set<String> readAfter() {
|
private Set<String> readAfter() {
|
||||||
if (wasProcessed()) {
|
if (wasProcessed()) {
|
||||||
return this.autoConfigurationMetadata.getSet(this.className,
|
return this.autoConfigurationMetadata.getSet(this.className,
|
||||||
"AutoConfigureAfter", Collections.<String>emptySet());
|
"AutoConfigureAfter", Collections.emptySet());
|
||||||
}
|
}
|
||||||
return getAnnotationValue(AutoConfigureAfter.class);
|
return getAnnotationValue(AutoConfigureAfter.class);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ class ImportAutoConfigurationImportSelector extends AutoConfigurationImportSelec
|
||||||
Set<String> result = new LinkedHashSet<>();
|
Set<String> result = new LinkedHashSet<>();
|
||||||
result.addAll(getCandidateConfigurations(metadata, null));
|
result.addAll(getCandidateConfigurations(metadata, null));
|
||||||
result.removeAll(getExclusions(metadata, null));
|
result.removeAll(getExclusions(metadata, null));
|
||||||
return Collections.<Object>unmodifiableSet(result);
|
return Collections.unmodifiableSet(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ public class CacheManagerCustomizers {
|
||||||
public CacheManagerCustomizers(
|
public CacheManagerCustomizers(
|
||||||
List<? extends CacheManagerCustomizer<?>> customizers) {
|
List<? extends CacheManagerCustomizer<?>> customizers) {
|
||||||
this.customizers = (customizers != null ? new ArrayList<>(customizers)
|
this.customizers = (customizers != null ? new ArrayList<>(customizers)
|
||||||
: Collections.<CacheManagerCustomizer<?>>emptyList());
|
: Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ public class EntityScanner {
|
||||||
throws ClassNotFoundException {
|
throws ClassNotFoundException {
|
||||||
List<String> packages = getPackages();
|
List<String> packages = getPackages();
|
||||||
if (packages.isEmpty()) {
|
if (packages.isEmpty()) {
|
||||||
return Collections.<Class<?>>emptySet();
|
return Collections.emptySet();
|
||||||
}
|
}
|
||||||
Set<Class<?>> entitySet = new HashSet<>();
|
Set<Class<?>> entitySet = new HashSet<>();
|
||||||
ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(
|
ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ public class HttpMessageConverters implements Iterable<HttpMessageConverter<?>>
|
||||||
Collection<HttpMessageConverter<?>> converters) {
|
Collection<HttpMessageConverter<?>> converters) {
|
||||||
List<HttpMessageConverter<?>> combined = getCombinedConverters(converters,
|
List<HttpMessageConverter<?>> combined = getCombinedConverters(converters,
|
||||||
addDefaultConverters ? getDefaultConverters()
|
addDefaultConverters ? getDefaultConverters()
|
||||||
: Collections.<HttpMessageConverter<?>>emptyList());
|
: Collections.emptyList());
|
||||||
combined = postProcessConverters(combined);
|
combined = postProcessConverters(combined);
|
||||||
this.converters = Collections.unmodifiableList(combined);
|
this.converters = Collections.unmodifiableList(combined);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ public class HttpMessageConvertersAutoConfiguration {
|
||||||
@ConditionalOnMissingBean
|
@ConditionalOnMissingBean
|
||||||
public HttpMessageConverters messageConverters() {
|
public HttpMessageConverters messageConverters() {
|
||||||
return new HttpMessageConverters(this.converters == null
|
return new HttpMessageConverters(this.converters == null
|
||||||
? Collections.<HttpMessageConverter<?>>emptyList() : this.converters);
|
? Collections.emptyList() : this.converters);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ class ActiveMQConnectionFactoryFactory {
|
||||||
Assert.notNull(properties, "Properties must not be null");
|
Assert.notNull(properties, "Properties must not be null");
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
this.factoryCustomizers = (factoryCustomizers != null ? factoryCustomizers
|
this.factoryCustomizers = (factoryCustomizers != null ? factoryCustomizers
|
||||||
: Collections.<ActiveMQConnectionFactoryCustomizer>emptyList());
|
: Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends ActiveMQConnectionFactory> T createConnectionFactory(
|
public <T extends ActiveMQConnectionFactory> T createConnectionFactory(
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ public class LdapAutoConfiguration {
|
||||||
source.setBase(this.properties.getBase());
|
source.setBase(this.properties.getBase());
|
||||||
source.setUrls(this.properties.determineUrls(this.environment));
|
source.setUrls(this.properties.determineUrls(this.environment));
|
||||||
source.setBaseEnvironmentProperties(Collections
|
source.setBaseEnvironmentProperties(Collections
|
||||||
.<String, Object>unmodifiableMap(this.properties.getBaseEnvironment()));
|
.unmodifiableMap(this.properties.getBaseEnvironment()));
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -258,7 +258,7 @@ public class EmbeddedMongoAutoConfiguration {
|
||||||
Set<Feature> features) {
|
Set<Feature> features) {
|
||||||
Assert.notNull(version, "version must not be null");
|
Assert.notNull(version, "version must not be null");
|
||||||
this.version = version;
|
this.version = version;
|
||||||
this.features = (features == null ? Collections.<Feature>emptySet()
|
this.features = (features == null ? Collections.emptySet()
|
||||||
: features);
|
: features);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ public class BasicErrorController extends AbstractErrorController {
|
||||||
public BasicErrorController(ErrorAttributes errorAttributes,
|
public BasicErrorController(ErrorAttributes errorAttributes,
|
||||||
ErrorProperties errorProperties) {
|
ErrorProperties errorProperties) {
|
||||||
this(errorAttributes, errorProperties,
|
this(errorAttributes, errorProperties,
|
||||||
Collections.<ErrorViewResolver>emptyList());
|
Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -248,7 +248,7 @@ public class AutoConfigurationImportSelectorTests {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<AutoConfigurationImportListener> getAutoConfigurationImportListeners() {
|
protected List<AutoConfigurationImportListener> getAutoConfigurationImportListeners() {
|
||||||
return Collections.<AutoConfigurationImportListener>singletonList(
|
return Collections.singletonList(
|
||||||
(event) -> this.lastEvent = event);
|
(event) -> this.lastEvent = event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -936,7 +936,7 @@ public class CacheAutoConfigurationTests {
|
||||||
public javax.cache.CacheManager customJCacheCacheManager() {
|
public javax.cache.CacheManager customJCacheCacheManager() {
|
||||||
javax.cache.CacheManager cacheManager = mock(javax.cache.CacheManager.class);
|
javax.cache.CacheManager cacheManager = mock(javax.cache.CacheManager.class);
|
||||||
given(cacheManager.getCacheNames())
|
given(cacheManager.getCacheNames())
|
||||||
.willReturn(Collections.<String>emptyList());
|
.willReturn(Collections.emptyList());
|
||||||
return cacheManager;
|
return cacheManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,10 +76,10 @@ public class OnClassConditionAutoConfigurationImportFilterTests {
|
||||||
AutoConfigurationMetadata metadata = mock(AutoConfigurationMetadata.class);
|
AutoConfigurationMetadata metadata = mock(AutoConfigurationMetadata.class);
|
||||||
given(metadata.wasProcessed("test.match")).willReturn(true);
|
given(metadata.wasProcessed("test.match")).willReturn(true);
|
||||||
given(metadata.getSet("test.match", "ConditionalOnClass"))
|
given(metadata.getSet("test.match", "ConditionalOnClass"))
|
||||||
.willReturn(Collections.<String>singleton("java.io.InputStream"));
|
.willReturn(Collections.singleton("java.io.InputStream"));
|
||||||
given(metadata.wasProcessed("test.nomatch")).willReturn(true);
|
given(metadata.wasProcessed("test.nomatch")).willReturn(true);
|
||||||
given(metadata.getSet("test.nomatch", "ConditionalOnClass"))
|
given(metadata.getSet("test.nomatch", "ConditionalOnClass"))
|
||||||
.willReturn(Collections.<String>singleton("java.io.DoesNotExist"));
|
.willReturn(Collections.singleton("java.io.DoesNotExist"));
|
||||||
return metadata;
|
return metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ public class EntityScanPackagesTests {
|
||||||
throws Exception {
|
throws Exception {
|
||||||
this.thrown.expect(IllegalArgumentException.class);
|
this.thrown.expect(IllegalArgumentException.class);
|
||||||
this.thrown.expectMessage("Registry must not be null");
|
this.thrown.expectMessage("Registry must not be null");
|
||||||
EntityScanPackages.register(null, Collections.<String>emptyList());
|
EntityScanPackages.register(null, Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ public class HazelcastJpaDependencyAutoConfigurationTests {
|
||||||
.getSourceApplicationContext()).getBeanDefinition("entityManagerFactory")
|
.getSourceApplicationContext()).getBeanDefinition("entityManagerFactory")
|
||||||
.getDependsOn();
|
.getDependsOn();
|
||||||
return dependsOn != null ? Arrays.asList(dependsOn)
|
return dependsOn != null ? Arrays.asList(dependsOn)
|
||||||
: Collections.<String>emptyList();
|
: Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ public class ActiveMQPropertiesTests {
|
||||||
private ActiveMQConnectionFactoryFactory createFactory(
|
private ActiveMQConnectionFactoryFactory createFactory(
|
||||||
ActiveMQProperties properties) {
|
ActiveMQProperties properties) {
|
||||||
return new ActiveMQConnectionFactoryFactory(properties,
|
return new ActiveMQConnectionFactoryFactory(properties,
|
||||||
Collections.<ActiveMQConnectionFactoryCustomizer>emptyList());
|
Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ public class JndiPropertiesHidingClassLoader extends ClassLoader {
|
||||||
@Override
|
@Override
|
||||||
public Enumeration<URL> getResources(String name) throws IOException {
|
public Enumeration<URL> getResources(String name) throws IOException {
|
||||||
if ("jndi.properties".equals(name)) {
|
if ("jndi.properties".equals(name)) {
|
||||||
return Collections.enumeration(Collections.<URL>emptyList());
|
return Collections.enumeration(Collections.emptyList());
|
||||||
}
|
}
|
||||||
return super.getResources(name);
|
return super.getResources(name);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void deviceDelegatingFreeMarkerViewResolver() throws Exception {
|
public void deviceDelegatingFreeMarkerViewResolver() throws Exception {
|
||||||
load(Collections.<Class<?>>singletonList(FreeMarkerAutoConfiguration.class),
|
load(Collections.singletonList(FreeMarkerAutoConfiguration.class),
|
||||||
"spring.mobile.devicedelegatingviewresolver.enabled:true");
|
"spring.mobile.devicedelegatingviewresolver.enabled:true");
|
||||||
assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class))
|
assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class))
|
||||||
.hasSize(2);
|
.hasSize(2);
|
||||||
|
|
@ -100,7 +100,7 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void deviceDelegatingGroovyMarkupViewResolver() throws Exception {
|
public void deviceDelegatingGroovyMarkupViewResolver() throws Exception {
|
||||||
load(Collections.<Class<?>>singletonList(GroovyTemplateAutoConfiguration.class),
|
load(Collections.singletonList(GroovyTemplateAutoConfiguration.class),
|
||||||
"spring.mobile.devicedelegatingviewresolver.enabled:true");
|
"spring.mobile.devicedelegatingviewresolver.enabled:true");
|
||||||
assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class))
|
assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class))
|
||||||
.hasSize(2);
|
.hasSize(2);
|
||||||
|
|
@ -111,7 +111,7 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void deviceDelegatingMustacheViewResolver() throws Exception {
|
public void deviceDelegatingMustacheViewResolver() throws Exception {
|
||||||
load(Collections.<Class<?>>singletonList(MustacheAutoConfiguration.class),
|
load(Collections.singletonList(MustacheAutoConfiguration.class),
|
||||||
"spring.mobile.devicedelegatingviewresolver.enabled:true");
|
"spring.mobile.devicedelegatingviewresolver.enabled:true");
|
||||||
assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class))
|
assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class))
|
||||||
.hasSize(2);
|
.hasSize(2);
|
||||||
|
|
@ -122,7 +122,7 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void deviceDelegatingThymeleafViewResolver() throws Exception {
|
public void deviceDelegatingThymeleafViewResolver() throws Exception {
|
||||||
load(Collections.<Class<?>>singletonList(ThymeleafAutoConfiguration.class),
|
load(Collections.singletonList(ThymeleafAutoConfiguration.class),
|
||||||
"spring.mobile.devicedelegatingviewresolver.enabled:true");
|
"spring.mobile.devicedelegatingviewresolver.enabled:true");
|
||||||
assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class))
|
assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class))
|
||||||
.hasSize(2);
|
.hasSize(2);
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ import org.springframework.boot.cli.command.run.RunCommand;
|
||||||
*/
|
*/
|
||||||
public class DefaultCommandFactory implements CommandFactory {
|
public class DefaultCommandFactory implements CommandFactory {
|
||||||
|
|
||||||
private static final List<Command> defaultCommands = Arrays.<Command>asList(
|
private static final List<Command> defaultCommands = Arrays.asList(
|
||||||
new VersionCommand(), new RunCommand(), new GrabCommand(), new JarCommand(),
|
new VersionCommand(), new RunCommand(), new GrabCommand(), new JarCommand(),
|
||||||
new WarCommand(), new InstallCommand(), new UninstallCommand(),
|
new WarCommand(), new InstallCommand(), new UninstallCommand(),
|
||||||
new InitCommand());
|
new InitCommand());
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ public final class Dependency {
|
||||||
* @param version the version
|
* @param version the version
|
||||||
*/
|
*/
|
||||||
public Dependency(String groupId, String artifactId, String version) {
|
public Dependency(String groupId, String artifactId, String version) {
|
||||||
this(groupId, artifactId, version, Collections.<Exclusion>emptyList());
|
this(groupId, artifactId, version, Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ public abstract class GroovyTemplate {
|
||||||
|
|
||||||
public static String template(String name)
|
public static String template(String name)
|
||||||
throws IOException, CompilationFailedException, ClassNotFoundException {
|
throws IOException, CompilationFailedException, ClassNotFoundException {
|
||||||
return template(name, Collections.<String, Object>emptyMap());
|
return template(name, Collections.emptyMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String template(String name, Map<String, ?> model)
|
public static String template(String name, Map<String, ?> model)
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ public class CustomCommandFactory implements CommandFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<Command> getCommands() {
|
public Collection<Command> getCommands() {
|
||||||
return Collections.<Command>singleton(new CustomCommand());
|
return Collections.singleton(new CustomCommand());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||||
public class ProjectGenerationRequestTests {
|
public class ProjectGenerationRequestTests {
|
||||||
|
|
||||||
public static final Map<String, String> EMPTY_TAGS = Collections
|
public static final Map<String, String> EMPTY_TAGS = Collections
|
||||||
.<String, String>emptyMap();
|
.emptyMap();
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public final ExpectedException thrown = ExpectedException.none();
|
public final ExpectedException thrown = ExpectedException.none();
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ final class ChangeableUrls implements Iterable<URL> {
|
||||||
private static List<URL> getUrlsFromClassPathOfJarManifestIfPossible(URL url) {
|
private static List<URL> getUrlsFromClassPathOfJarManifestIfPossible(URL url) {
|
||||||
JarFile jarFile = getJarFileIfPossible(url);
|
JarFile jarFile = getJarFileIfPossible(url);
|
||||||
if (jarFile == null) {
|
if (jarFile == null) {
|
||||||
return Collections.<URL>emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return getUrlsFromManifestClassPathAttribute(url, jarFile);
|
return getUrlsFromManifestClassPathAttribute(url, jarFile);
|
||||||
|
|
@ -152,7 +152,7 @@ final class ChangeableUrls implements Iterable<URL> {
|
||||||
JarFile jarFile) throws IOException {
|
JarFile jarFile) throws IOException {
|
||||||
Manifest manifest = jarFile.getManifest();
|
Manifest manifest = jarFile.getManifest();
|
||||||
if (manifest == null) {
|
if (manifest == null) {
|
||||||
return Collections.<URL>emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
String classPath = manifest.getMainAttributes()
|
String classPath = manifest.getMainAttributes()
|
||||||
.getValue(Attributes.Name.CLASS_PATH);
|
.getValue(Attributes.Name.CLASS_PATH);
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@ import org.springframework.boot.autoconfigure.web.ResourceProperties;
|
||||||
import org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration;
|
import org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration;
|
||||||
import org.springframework.boot.devtools.classpath.ClassPathChangedEvent;
|
import org.springframework.boot.devtools.classpath.ClassPathChangedEvent;
|
||||||
import org.springframework.boot.devtools.classpath.ClassPathFileSystemWatcher;
|
import org.springframework.boot.devtools.classpath.ClassPathFileSystemWatcher;
|
||||||
import org.springframework.boot.devtools.filewatch.ChangedFiles;
|
|
||||||
import org.springframework.boot.devtools.livereload.LiveReloadServer;
|
import org.springframework.boot.devtools.livereload.LiveReloadServer;
|
||||||
import org.springframework.boot.devtools.restart.FailureHandler;
|
import org.springframework.boot.devtools.restart.FailureHandler;
|
||||||
import org.springframework.boot.devtools.restart.MockRestartInitializer;
|
import org.springframework.boot.devtools.restart.MockRestartInitializer;
|
||||||
|
|
@ -146,7 +145,7 @@ public class LocalDevToolsAutoConfigurationTests {
|
||||||
LiveReloadServer server = this.context.getBean(LiveReloadServer.class);
|
LiveReloadServer server = this.context.getBean(LiveReloadServer.class);
|
||||||
reset(server);
|
reset(server);
|
||||||
ClassPathChangedEvent event = new ClassPathChangedEvent(this.context,
|
ClassPathChangedEvent event = new ClassPathChangedEvent(this.context,
|
||||||
Collections.<ChangedFiles>emptySet(), false);
|
Collections.emptySet(), false);
|
||||||
this.context.publishEvent(event);
|
this.context.publishEvent(event);
|
||||||
verify(server).triggerReload();
|
verify(server).triggerReload();
|
||||||
}
|
}
|
||||||
|
|
@ -157,7 +156,7 @@ public class LocalDevToolsAutoConfigurationTests {
|
||||||
LiveReloadServer server = this.context.getBean(LiveReloadServer.class);
|
LiveReloadServer server = this.context.getBean(LiveReloadServer.class);
|
||||||
reset(server);
|
reset(server);
|
||||||
ClassPathChangedEvent event = new ClassPathChangedEvent(this.context,
|
ClassPathChangedEvent event = new ClassPathChangedEvent(this.context,
|
||||||
Collections.<ChangedFiles>emptySet(), true);
|
Collections.emptySet(), true);
|
||||||
this.context.publishEvent(event);
|
this.context.publishEvent(event);
|
||||||
verify(server, never()).triggerReload();
|
verify(server, never()).triggerReload();
|
||||||
}
|
}
|
||||||
|
|
@ -175,7 +174,7 @@ public class LocalDevToolsAutoConfigurationTests {
|
||||||
public void restartTriggeredOnClassPathChangeWithRestart() throws Exception {
|
public void restartTriggeredOnClassPathChangeWithRestart() throws Exception {
|
||||||
this.context = initializeAndRun(Config.class);
|
this.context = initializeAndRun(Config.class);
|
||||||
ClassPathChangedEvent event = new ClassPathChangedEvent(this.context,
|
ClassPathChangedEvent event = new ClassPathChangedEvent(this.context,
|
||||||
Collections.<ChangedFiles>emptySet(), true);
|
Collections.emptySet(), true);
|
||||||
this.context.publishEvent(event);
|
this.context.publishEvent(event);
|
||||||
verify(this.mockRestarter.getMock()).restart(any(FailureHandler.class));
|
verify(this.mockRestarter.getMock()).restart(any(FailureHandler.class));
|
||||||
}
|
}
|
||||||
|
|
@ -184,7 +183,7 @@ public class LocalDevToolsAutoConfigurationTests {
|
||||||
public void restartNotTriggeredOnClassPathChangeWithRestart() throws Exception {
|
public void restartNotTriggeredOnClassPathChangeWithRestart() throws Exception {
|
||||||
this.context = initializeAndRun(Config.class);
|
this.context = initializeAndRun(Config.class);
|
||||||
ClassPathChangedEvent event = new ClassPathChangedEvent(this.context,
|
ClassPathChangedEvent event = new ClassPathChangedEvent(this.context,
|
||||||
Collections.<ChangedFiles>emptySet(), false);
|
Collections.emptySet(), false);
|
||||||
this.context.publishEvent(event);
|
this.context.publishEvent(event);
|
||||||
verify(this.mockRestarter.getMock(), never()).restart();
|
verify(this.mockRestarter.getMock(), never()).restart();
|
||||||
}
|
}
|
||||||
|
|
@ -251,7 +250,7 @@ public class LocalDevToolsAutoConfigurationTests {
|
||||||
|
|
||||||
private ConfigurableApplicationContext initializeAndRun(Class<?> config,
|
private ConfigurableApplicationContext initializeAndRun(Class<?> config,
|
||||||
String... args) {
|
String... args) {
|
||||||
return initializeAndRun(config, Collections.<String, Object>emptyMap(), args);
|
return initializeAndRun(config, Collections.emptyMap(), args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ConfigurableApplicationContext initializeAndRun(Class<?> config,
|
private ConfigurableApplicationContext initializeAndRun(Class<?> config,
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ public class DevToolPropertiesIntegrationTests {
|
||||||
SpringApplication application = new SpringApplication(
|
SpringApplication application = new SpringApplication(
|
||||||
BeanConditionConfiguration.class);
|
BeanConditionConfiguration.class);
|
||||||
application.setWebApplicationType(WebApplicationType.NONE);
|
application.setWebApplicationType(WebApplicationType.NONE);
|
||||||
application.setDefaultProperties(Collections.<String, Object>singletonMap(
|
application.setDefaultProperties(Collections.singletonMap(
|
||||||
"spring.devtools.remote.secret", "donttell"));
|
"spring.devtools.remote.secret", "donttell"));
|
||||||
this.context = application.run();
|
this.context = application.run();
|
||||||
this.context.getBean(MyBean.class);
|
this.context.getBean(MyBean.class);
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ public class DispatcherTests {
|
||||||
public void accessManagerMustNotBeNull() throws Exception {
|
public void accessManagerMustNotBeNull() throws Exception {
|
||||||
this.thrown.expect(IllegalArgumentException.class);
|
this.thrown.expect(IllegalArgumentException.class);
|
||||||
this.thrown.expectMessage("AccessManager must not be null");
|
this.thrown.expectMessage("AccessManager must not be null");
|
||||||
new Dispatcher(null, Collections.<HandlerMapper>emptyList());
|
new Dispatcher(null, Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,7 @@ class ImportsContextCustomizer implements ContextCustomizer {
|
||||||
Set<Class<?>> seen = new HashSet<>();
|
Set<Class<?>> seen = new HashSet<>();
|
||||||
collectClassAnnotations(testClass, annotations, seen);
|
collectClassAnnotations(testClass, annotations, seen);
|
||||||
Set<Object> determinedImports = determineImports(annotations, testClass);
|
Set<Object> determinedImports = determineImports(annotations, testClass);
|
||||||
this.key = Collections.<Object>unmodifiableSet(
|
this.key = Collections.unmodifiableSet(
|
||||||
determinedImports != null ? determinedImports : annotations);
|
determinedImports != null ? determinedImports : annotations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -321,7 +321,7 @@ class ImportsContextCustomizer implements ContextCustomizer {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// The source itself is the import
|
// The source itself is the import
|
||||||
return Collections.<Object>singleton(source.getName());
|
return Collections.singleton(source.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ class DefinitionsParser {
|
||||||
private final Map<Definition, Field> definitionFields;
|
private final Map<Definition, Field> definitionFields;
|
||||||
|
|
||||||
DefinitionsParser() {
|
DefinitionsParser() {
|
||||||
this(Collections.<Definition>emptySet());
|
this(Collections.emptySet());
|
||||||
}
|
}
|
||||||
|
|
||||||
DefinitionsParser(Collection<? extends Definition> existing) {
|
DefinitionsParser(Collection<? extends Definition> existing) {
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ public class ImportsContextCustomizerTests {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<Object> determineImports(AnnotationMetadata metadata) {
|
public Set<Object> determineImports(AnnotationMetadata metadata) {
|
||||||
return Collections.<Object>singleton(TestConfig.class.getName());
|
return Collections.singleton(TestConfig.class.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ public class JsonReaderTests extends AbstractConfigurationMetadataTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void invalidMetadata() throws IOException {
|
public void invalidMetadata() throws IOException {
|
||||||
this.thrown.expectCause(CoreMatchers.<Throwable>instanceOf(JSONException.class));
|
this.thrown.expectCause(CoreMatchers.instanceOf(JSONException.class));
|
||||||
readFor("invalid");
|
readFor("invalid");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ public class ItemHint implements Comparable<ItemHint> {
|
||||||
|
|
||||||
public static ItemHint newHint(String name, ValueHint... values) {
|
public static ItemHint newHint(String name, ValueHint... values) {
|
||||||
return new ItemHint(name, Arrays.asList(values),
|
return new ItemHint(name, Arrays.asList(values),
|
||||||
Collections.<ValueProvider>emptyList());
|
Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -819,10 +819,10 @@ public class ConfigurationMetadataAnnotationProcessorTests {
|
||||||
@Test
|
@Test
|
||||||
public void mergingOfHintWithProvider() throws Exception {
|
public void mergingOfHintWithProvider() throws Exception {
|
||||||
writeAdditionalHints(new ItemHint("simple.theName",
|
writeAdditionalHints(new ItemHint("simple.theName",
|
||||||
Collections.<ItemHint.ValueHint>emptyList(),
|
Collections.emptyList(),
|
||||||
Arrays.asList(
|
Arrays.asList(
|
||||||
new ItemHint.ValueProvider("first",
|
new ItemHint.ValueProvider("first",
|
||||||
Collections.<String, Object>singletonMap("target",
|
Collections.singletonMap("target",
|
||||||
"org.foo")),
|
"org.foo")),
|
||||||
new ItemHint.ValueProvider("second", null))));
|
new ItemHint.ValueProvider("second", null))));
|
||||||
ConfigurationMetadata metadata = compile(SimpleProperties.class);
|
ConfigurationMetadata metadata = compile(SimpleProperties.class);
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ public class JsonMarshallerTests {
|
||||||
metadata.add(new ItemHint("d", null,
|
metadata.add(new ItemHint("d", null,
|
||||||
Arrays.asList(
|
Arrays.asList(
|
||||||
new ItemHint.ValueProvider("first",
|
new ItemHint.ValueProvider("first",
|
||||||
Collections.<String, Object>singletonMap("target",
|
Collections.singletonMap("target",
|
||||||
"foo")),
|
"foo")),
|
||||||
new ItemHint.ValueProvider("second", null))));
|
new ItemHint.ValueProvider("second", null))));
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ public class DependencyFilterMojoTests {
|
||||||
@Test
|
@Test
|
||||||
public void filterDependencies() throws MojoExecutionException {
|
public void filterDependencies() throws MojoExecutionException {
|
||||||
TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(
|
TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(
|
||||||
Collections.<Exclude>emptyList(), "com.foo", "exclude-id");
|
Collections.emptyList(), "com.foo", "exclude-id");
|
||||||
|
|
||||||
Artifact artifact = createArtifact("com.bar", "one");
|
Artifact artifact = createArtifact("com.bar", "one");
|
||||||
Set<Artifact> artifacts = mojo.filterDependencies(
|
Set<Artifact> artifacts = mojo.filterDependencies(
|
||||||
|
|
@ -56,7 +56,7 @@ public class DependencyFilterMojoTests {
|
||||||
@Test
|
@Test
|
||||||
public void filterGroupIdExactMatch() throws MojoExecutionException {
|
public void filterGroupIdExactMatch() throws MojoExecutionException {
|
||||||
TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(
|
TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(
|
||||||
Collections.<Exclude>emptyList(), "com.foo", "");
|
Collections.emptyList(), "com.foo", "");
|
||||||
|
|
||||||
Artifact artifact = createArtifact("com.foo.bar", "one");
|
Artifact artifact = createArtifact("com.foo.bar", "one");
|
||||||
Set<Artifact> artifacts = mojo.filterDependencies(
|
Set<Artifact> artifacts = mojo.filterDependencies(
|
||||||
|
|
@ -69,7 +69,7 @@ public class DependencyFilterMojoTests {
|
||||||
@Test
|
@Test
|
||||||
public void filterScopeKeepOrder() throws MojoExecutionException {
|
public void filterScopeKeepOrder() throws MojoExecutionException {
|
||||||
TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(
|
TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(
|
||||||
Collections.<Exclude>emptyList(), "", "",
|
Collections.emptyList(), "", "",
|
||||||
new ScopeFilter(null, Artifact.SCOPE_SYSTEM));
|
new ScopeFilter(null, Artifact.SCOPE_SYSTEM));
|
||||||
Artifact one = createArtifact("com.foo", "one");
|
Artifact one = createArtifact("com.foo", "one");
|
||||||
Artifact two = createArtifact("com.foo", "two", Artifact.SCOPE_SYSTEM);
|
Artifact two = createArtifact("com.foo", "two", Artifact.SCOPE_SYSTEM);
|
||||||
|
|
@ -81,7 +81,7 @@ public class DependencyFilterMojoTests {
|
||||||
@Test
|
@Test
|
||||||
public void filterArtifactIdKeepOrder() throws MojoExecutionException {
|
public void filterArtifactIdKeepOrder() throws MojoExecutionException {
|
||||||
TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(
|
TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(
|
||||||
Collections.<Exclude>emptyList(), "", "one,three");
|
Collections.emptyList(), "", "one,three");
|
||||||
Artifact one = createArtifact("com.foo", "one");
|
Artifact one = createArtifact("com.foo", "one");
|
||||||
Artifact two = createArtifact("com.foo", "two");
|
Artifact two = createArtifact("com.foo", "two");
|
||||||
Artifact three = createArtifact("com.foo", "three");
|
Artifact three = createArtifact("com.foo", "three");
|
||||||
|
|
@ -93,7 +93,7 @@ public class DependencyFilterMojoTests {
|
||||||
@Test
|
@Test
|
||||||
public void filterGroupIdKeepOrder() throws MojoExecutionException {
|
public void filterGroupIdKeepOrder() throws MojoExecutionException {
|
||||||
TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(
|
TestableDependencyFilterMojo mojo = new TestableDependencyFilterMojo(
|
||||||
Collections.<Exclude>emptyList(), "com.foo", "");
|
Collections.emptyList(), "com.foo", "");
|
||||||
Artifact one = createArtifact("com.foo", "one");
|
Artifact one = createArtifact("com.foo", "one");
|
||||||
Artifact two = createArtifact("com.bar", "two");
|
Artifact two = createArtifact("com.bar", "two");
|
||||||
Artifact three = createArtifact("com.bar", "three");
|
Artifact three = createArtifact("com.bar", "three");
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ public abstract class MockServletWebServer {
|
||||||
given(this.servletContext.getInitParameter(anyString())).willAnswer(
|
given(this.servletContext.getInitParameter(anyString())).willAnswer(
|
||||||
(invocation) -> initParameters.get(invocation.getArgument(0)));
|
(invocation) -> initParameters.get(invocation.getArgument(0)));
|
||||||
given(this.servletContext.getAttributeNames())
|
given(this.servletContext.getAttributeNames())
|
||||||
.willReturn(MockServletWebServer.<String>emptyEnumeration());
|
.willReturn(MockServletWebServer.emptyEnumeration());
|
||||||
given(this.servletContext.getNamedDispatcher("default"))
|
given(this.servletContext.getNamedDispatcher("default"))
|
||||||
.willReturn(mock(RequestDispatcher.class));
|
.willReturn(mock(RequestDispatcher.class));
|
||||||
for (Initializer initializer : this.initializers) {
|
for (Initializer initializer : this.initializers) {
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ public class ResourceBanner implements Banner {
|
||||||
private PropertyResolver getTitleResolver(Class<?> sourceClass) {
|
private PropertyResolver getTitleResolver(Class<?> sourceClass) {
|
||||||
MutablePropertySources sources = new MutablePropertySources();
|
MutablePropertySources sources = new MutablePropertySources();
|
||||||
String applicationTitle = getApplicationTitle(sourceClass);
|
String applicationTitle = getApplicationTitle(sourceClass);
|
||||||
Map<String, Object> titleMap = Collections.<String, Object>singletonMap(
|
Map<String, Object> titleMap = Collections.singletonMap(
|
||||||
"application.title", (applicationTitle == null ? "" : applicationTitle));
|
"application.title", (applicationTitle == null ? "" : applicationTitle));
|
||||||
sources.addFirst(new MapPropertySource("title", titleMap));
|
sources.addFirst(new MapPropertySource("title", titleMap));
|
||||||
return new PropertySourcesPropertyResolver(sources);
|
return new PropertySourcesPropertyResolver(sources);
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ public class CompositeDataSourcePoolMetadataProvider
|
||||||
public CompositeDataSourcePoolMetadataProvider(
|
public CompositeDataSourcePoolMetadataProvider(
|
||||||
Collection<? extends DataSourcePoolMetadataProvider> providers) {
|
Collection<? extends DataSourcePoolMetadataProvider> providers) {
|
||||||
this.providers = (providers == null
|
this.providers = (providers == null
|
||||||
? Collections.<DataSourcePoolMetadataProvider>emptyList()
|
? Collections.emptyList()
|
||||||
: Collections.unmodifiableList(new ArrayList<>(providers)));
|
: Collections.unmodifiableList(new ArrayList<>(providers)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ public class AtomikosDependsOnBeanFactoryPostProcessor
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> asList(String[] array) {
|
private List<String> asList(String[] array) {
|
||||||
return (array == null ? Collections.<String>emptyList() : Arrays.asList(array));
|
return (array == null ? Collections.emptyList() : Arrays.asList(array));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -111,8 +111,8 @@ public class RestTemplateBuilder {
|
||||||
this.basicAuthorization = null;
|
this.basicAuthorization = null;
|
||||||
this.restTemplateCustomizers = Collections
|
this.restTemplateCustomizers = Collections
|
||||||
.unmodifiableSet(new LinkedHashSet<>(Arrays.asList(customizers)));
|
.unmodifiableSet(new LinkedHashSet<>(Arrays.asList(customizers)));
|
||||||
this.requestFactoryCustomizers = Collections.<RequestFactoryCustomizer>emptySet();
|
this.requestFactoryCustomizers = Collections.emptySet();
|
||||||
this.interceptors = Collections.<ClientHttpRequestInterceptor>emptySet();
|
this.interceptors = Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
private RestTemplateBuilder(boolean detectRequestFactory, String rootUri,
|
private RestTemplateBuilder(boolean detectRequestFactory, String rootUri,
|
||||||
|
|
@ -597,14 +597,14 @@ public class RestTemplateBuilder {
|
||||||
|
|
||||||
private <T> Set<T> append(Set<T> set, T addition) {
|
private <T> Set<T> append(Set<T> set, T addition) {
|
||||||
Set<T> result = new LinkedHashSet<>(
|
Set<T> result = new LinkedHashSet<>(
|
||||||
set == null ? Collections.<T>emptySet() : set);
|
set == null ? Collections.emptySet() : set);
|
||||||
result.add(addition);
|
result.add(addition);
|
||||||
return Collections.unmodifiableSet(result);
|
return Collections.unmodifiableSet(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> Set<T> append(Set<T> set, Collection<? extends T> additions) {
|
private <T> Set<T> append(Set<T> set, Collection<? extends T> additions) {
|
||||||
Set<T> result = new LinkedHashSet<>(
|
Set<T> result = new LinkedHashSet<>(
|
||||||
set == null ? Collections.<T>emptySet() : set);
|
set == null ? Collections.emptySet() : set);
|
||||||
result.addAll(additions);
|
result.addAll(additions);
|
||||||
return Collections.unmodifiableSet(result);
|
return Collections.unmodifiableSet(result);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ public class ResourceBannerTests {
|
||||||
ResourceBanner banner = new MockResourceBanner(resource, bootVersion,
|
ResourceBanner banner = new MockResourceBanner(resource, bootVersion,
|
||||||
applicationVersion, applicationTitle);
|
applicationVersion, applicationTitle);
|
||||||
ConfigurableEnvironment environment = new MockEnvironment();
|
ConfigurableEnvironment environment = new MockEnvironment();
|
||||||
Map<String, Object> source = Collections.<String, Object>singletonMap("a", "1");
|
Map<String, Object> source = Collections.singletonMap("a", "1");
|
||||||
environment.getPropertySources().addLast(new MapPropertySource("map", source));
|
environment.getPropertySources().addLast(new MapPropertySource("map", source));
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
banner.printBanner(environment, getClass(), new PrintStream(out));
|
banner.printBanner(environment, getClass(), new PrintStream(out));
|
||||||
|
|
|
||||||
|
|
@ -485,7 +485,7 @@ public class SpringApplicationTests {
|
||||||
application.setWebApplicationType(WebApplicationType.NONE);
|
application.setWebApplicationType(WebApplicationType.NONE);
|
||||||
ConfigurableEnvironment environment = new StandardEnvironment();
|
ConfigurableEnvironment environment = new StandardEnvironment();
|
||||||
environment.getPropertySources().addFirst(new MapPropertySource("commandLineArgs",
|
environment.getPropertySources().addFirst(new MapPropertySource("commandLineArgs",
|
||||||
Collections.<String, Object>singletonMap("foo", "original")));
|
Collections.singletonMap("foo", "original")));
|
||||||
application.setEnvironment(environment);
|
application.setEnvironment(environment);
|
||||||
this.context = application.run("--foo=bar", "--bar=foo");
|
this.context = application.run("--foo=bar", "--bar=foo");
|
||||||
assertThat(environment).has(
|
assertThat(environment).has(
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ public class SpringApplicationBuilderTests {
|
||||||
public void propertiesAsMap() throws Exception {
|
public void propertiesAsMap() throws Exception {
|
||||||
SpringApplicationBuilder application = new SpringApplicationBuilder()
|
SpringApplicationBuilder application = new SpringApplicationBuilder()
|
||||||
.sources(ExampleConfig.class).contextClass(StaticApplicationContext.class)
|
.sources(ExampleConfig.class).contextClass(StaticApplicationContext.class)
|
||||||
.properties(Collections.<String, Object>singletonMap("bar", "foo"));
|
.properties(Collections.singletonMap("bar", "foo"));
|
||||||
this.context = application.run();
|
this.context = application.run();
|
||||||
assertThat(this.context.getEnvironment().getProperty("bar")).isEqualTo("foo");
|
assertThat(this.context.getEnvironment().getProperty("bar")).isEqualTo("foo");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -738,7 +738,7 @@ public class ConfigFileApplicationListenerTests {
|
||||||
@Test
|
@Test
|
||||||
public void addBeforeDefaultProperties() throws Exception {
|
public void addBeforeDefaultProperties() throws Exception {
|
||||||
MapPropertySource defaultSource = new MapPropertySource("defaultProperties",
|
MapPropertySource defaultSource = new MapPropertySource("defaultProperties",
|
||||||
Collections.<String, Object>singletonMap("the.property",
|
Collections.singletonMap("the.property",
|
||||||
"fromdefaultproperties"));
|
"fromdefaultproperties"));
|
||||||
this.environment.getPropertySources().addFirst(defaultSource);
|
this.environment.getPropertySources().addFirst(defaultSource);
|
||||||
this.initializer.setSearchNames("testproperties");
|
this.initializer.setSearchNames("testproperties");
|
||||||
|
|
|
||||||
|
|
@ -211,7 +211,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests {
|
||||||
assertThat(first.getOne()).isEqualTo("foo");
|
assertThat(first.getOne()).isEqualTo("foo");
|
||||||
source.put("example.one", "bar");
|
source.put("example.one", "bar");
|
||||||
sources.addFirst(new MapPropertySource("extra",
|
sources.addFirst(new MapPropertySource("extra",
|
||||||
Collections.<String, Object>singletonMap("example.two", "baz")));
|
Collections.singletonMap("example.two", "baz")));
|
||||||
PrototypeBean second = this.context.getBean(PrototypeBean.class);
|
PrototypeBean second = this.context.getBean(PrototypeBean.class);
|
||||||
assertThat(second.getOne()).isEqualTo("bar");
|
assertThat(second.getOne()).isEqualTo("bar");
|
||||||
assertThat(second.getTwo()).isEqualTo("baz");
|
assertThat(second.getTwo()).isEqualTo("baz");
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ public class EnableConfigurationPropertiesTests {
|
||||||
this.context.register(ExceptionIfInvalidTestConfiguration.class);
|
this.context.register(ExceptionIfInvalidTestConfiguration.class);
|
||||||
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context,
|
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context,
|
||||||
"name:foo");
|
"name:foo");
|
||||||
this.thrown.expectCause(Matchers.<Throwable>instanceOf(BindException.class));
|
this.thrown.expectCause(Matchers.instanceOf(BindException.class));
|
||||||
this.context.refresh();
|
this.context.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,9 +46,9 @@ public class ConfigurationPropertySourcesTests {
|
||||||
ConfigurableEnvironment environment = new StandardEnvironment();
|
ConfigurableEnvironment environment = new StandardEnvironment();
|
||||||
MutablePropertySources sources = environment.getPropertySources();
|
MutablePropertySources sources = environment.getPropertySources();
|
||||||
sources.addLast(new SystemEnvironmentPropertySource("system",
|
sources.addLast(new SystemEnvironmentPropertySource("system",
|
||||||
Collections.<String, Object>singletonMap("SERVER_PORT", "1234")));
|
Collections.singletonMap("SERVER_PORT", "1234")));
|
||||||
sources.addLast(new MapPropertySource("config",
|
sources.addLast(new MapPropertySource("config",
|
||||||
Collections.<String, Object>singletonMap("server.port", "4568")));
|
Collections.singletonMap("server.port", "4568")));
|
||||||
int size = sources.size();
|
int size = sources.size();
|
||||||
ConfigurationPropertySources.attach(environment);
|
ConfigurationPropertySources.attach(environment);
|
||||||
assertThat(sources.size()).isEqualTo(size + 1);
|
assertThat(sources.size()).isEqualTo(size + 1);
|
||||||
|
|
@ -67,7 +67,7 @@ public class ConfigurationPropertySourcesTests {
|
||||||
ConfigurableEnvironment environment = new StandardEnvironment();
|
ConfigurableEnvironment environment = new StandardEnvironment();
|
||||||
MutablePropertySources sources = environment.getPropertySources();
|
MutablePropertySources sources = environment.getPropertySources();
|
||||||
sources.addFirst(new MapPropertySource("test",
|
sources.addFirst(new MapPropertySource("test",
|
||||||
Collections.<String, Object>singletonMap("a", "b")));
|
Collections.singletonMap("a", "b")));
|
||||||
int expectedSize = sources.size();
|
int expectedSize = sources.size();
|
||||||
ConfigurationPropertySources.attach(environment);
|
ConfigurationPropertySources.attach(environment);
|
||||||
assertThat(ConfigurationPropertySources.get(environment)).hasSize(expectedSize);
|
assertThat(ConfigurationPropertySources.get(environment)).hasSize(expectedSize);
|
||||||
|
|
@ -89,7 +89,7 @@ public class ConfigurationPropertySourcesTests {
|
||||||
public void fromPropertySourceShouldReturnSpringConfigurationPropertySource()
|
public void fromPropertySourceShouldReturnSpringConfigurationPropertySource()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
PropertySource<?> source = new MapPropertySource("foo",
|
PropertySource<?> source = new MapPropertySource("foo",
|
||||||
Collections.<String, Object>singletonMap("foo", "bar"));
|
Collections.singletonMap("foo", "bar"));
|
||||||
ConfigurationPropertySource configurationPropertySource = ConfigurationPropertySources
|
ConfigurationPropertySource configurationPropertySource = ConfigurationPropertySources
|
||||||
.from(source).iterator().next();
|
.from(source).iterator().next();
|
||||||
assertThat(configurationPropertySource)
|
assertThat(configurationPropertySource)
|
||||||
|
|
@ -100,9 +100,9 @@ public class ConfigurationPropertySourcesTests {
|
||||||
public void fromPropertySourceShouldFlattenPropertySources() throws Exception {
|
public void fromPropertySourceShouldFlattenPropertySources() throws Exception {
|
||||||
StandardEnvironment environment = new StandardEnvironment();
|
StandardEnvironment environment = new StandardEnvironment();
|
||||||
environment.getPropertySources().addFirst(new MapPropertySource("foo",
|
environment.getPropertySources().addFirst(new MapPropertySource("foo",
|
||||||
Collections.<String, Object>singletonMap("foo", "bar")));
|
Collections.singletonMap("foo", "bar")));
|
||||||
environment.getPropertySources().addFirst(new MapPropertySource("far",
|
environment.getPropertySources().addFirst(new MapPropertySource("far",
|
||||||
Collections.<String, Object>singletonMap("far", "far")));
|
Collections.singletonMap("far", "far")));
|
||||||
MutablePropertySources sources = new MutablePropertySources();
|
MutablePropertySources sources = new MutablePropertySources();
|
||||||
sources.addFirst(new PropertySource<Environment>("env", environment) {
|
sources.addFirst(new PropertySource<Environment>("env", environment) {
|
||||||
|
|
||||||
|
|
@ -113,7 +113,7 @@ public class ConfigurationPropertySourcesTests {
|
||||||
|
|
||||||
});
|
});
|
||||||
sources.addLast(new MapPropertySource("baz",
|
sources.addLast(new MapPropertySource("baz",
|
||||||
Collections.<String, Object>singletonMap("baz", "barf")));
|
Collections.singletonMap("baz", "barf")));
|
||||||
Iterable<ConfigurationPropertySource> configurationSources = ConfigurationPropertySources
|
Iterable<ConfigurationPropertySource> configurationSources = ConfigurationPropertySources
|
||||||
.from(sources);
|
.from(sources);
|
||||||
assertThat(configurationSources.iterator()).hasSize(5);
|
assertThat(configurationSources.iterator()).hasSize(5);
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ public class SpringConfigurationPropertySourcesTests {
|
||||||
public void shouldAdaptPropertySource() throws Exception {
|
public void shouldAdaptPropertySource() throws Exception {
|
||||||
MutablePropertySources sources = new MutablePropertySources();
|
MutablePropertySources sources = new MutablePropertySources();
|
||||||
sources.addFirst(new MapPropertySource("test",
|
sources.addFirst(new MapPropertySource("test",
|
||||||
Collections.<String, Object>singletonMap("a", "b")));
|
Collections.singletonMap("a", "b")));
|
||||||
Iterator<ConfigurationPropertySource> iterator = new SpringConfigurationPropertySources(
|
Iterator<ConfigurationPropertySource> iterator = new SpringConfigurationPropertySources(
|
||||||
sources).iterator();
|
sources).iterator();
|
||||||
ConfigurationPropertyName name = ConfigurationPropertyName.of("a");
|
ConfigurationPropertyName name = ConfigurationPropertyName.of("a");
|
||||||
|
|
@ -67,7 +67,7 @@ public class SpringConfigurationPropertySourcesTests {
|
||||||
public void shouldAdaptSystemEnvironmentPropertySource() throws Exception {
|
public void shouldAdaptSystemEnvironmentPropertySource() throws Exception {
|
||||||
MutablePropertySources sources = new MutablePropertySources();
|
MutablePropertySources sources = new MutablePropertySources();
|
||||||
sources.addLast(new SystemEnvironmentPropertySource("system",
|
sources.addLast(new SystemEnvironmentPropertySource("system",
|
||||||
Collections.<String, Object>singletonMap("SERVER_PORT", "1234")));
|
Collections.singletonMap("SERVER_PORT", "1234")));
|
||||||
Iterator<ConfigurationPropertySource> iterator = new SpringConfigurationPropertySources(
|
Iterator<ConfigurationPropertySource> iterator = new SpringConfigurationPropertySources(
|
||||||
sources).iterator();
|
sources).iterator();
|
||||||
ConfigurationPropertyName name = ConfigurationPropertyName.of("server.port");
|
ConfigurationPropertyName name = ConfigurationPropertyName.of("server.port");
|
||||||
|
|
@ -80,11 +80,11 @@ public class SpringConfigurationPropertySourcesTests {
|
||||||
public void shouldAdaptMultiplePropertySources() throws Exception {
|
public void shouldAdaptMultiplePropertySources() throws Exception {
|
||||||
MutablePropertySources sources = new MutablePropertySources();
|
MutablePropertySources sources = new MutablePropertySources();
|
||||||
sources.addLast(new SystemEnvironmentPropertySource("system",
|
sources.addLast(new SystemEnvironmentPropertySource("system",
|
||||||
Collections.<String, Object>singletonMap("SERVER_PORT", "1234")));
|
Collections.singletonMap("SERVER_PORT", "1234")));
|
||||||
sources.addLast(new MapPropertySource("test1",
|
sources.addLast(new MapPropertySource("test1",
|
||||||
Collections.<String, Object>singletonMap("server.po-rt", "4567")));
|
Collections.singletonMap("server.po-rt", "4567")));
|
||||||
sources.addLast(new MapPropertySource("test2",
|
sources.addLast(new MapPropertySource("test2",
|
||||||
Collections.<String, Object>singletonMap("a", "b")));
|
Collections.singletonMap("a", "b")));
|
||||||
Iterator<ConfigurationPropertySource> iterator = new SpringConfigurationPropertySources(
|
Iterator<ConfigurationPropertySource> iterator = new SpringConfigurationPropertySources(
|
||||||
sources).iterator();
|
sources).iterator();
|
||||||
ConfigurationPropertyName name = ConfigurationPropertyName.of("server.port");
|
ConfigurationPropertyName name = ConfigurationPropertyName.of("server.port");
|
||||||
|
|
@ -102,9 +102,9 @@ public class SpringConfigurationPropertySourcesTests {
|
||||||
public void shouldFlattenEnvironment() throws Exception {
|
public void shouldFlattenEnvironment() throws Exception {
|
||||||
StandardEnvironment environment = new StandardEnvironment();
|
StandardEnvironment environment = new StandardEnvironment();
|
||||||
environment.getPropertySources().addFirst(new MapPropertySource("foo",
|
environment.getPropertySources().addFirst(new MapPropertySource("foo",
|
||||||
Collections.<String, Object>singletonMap("foo", "bar")));
|
Collections.singletonMap("foo", "bar")));
|
||||||
environment.getPropertySources().addFirst(new MapPropertySource("far",
|
environment.getPropertySources().addFirst(new MapPropertySource("far",
|
||||||
Collections.<String, Object>singletonMap("far", "far")));
|
Collections.singletonMap("far", "far")));
|
||||||
MutablePropertySources sources = new MutablePropertySources();
|
MutablePropertySources sources = new MutablePropertySources();
|
||||||
sources.addFirst(new PropertySource<Environment>("env", environment) {
|
sources.addFirst(new PropertySource<Environment>("env", environment) {
|
||||||
|
|
||||||
|
|
@ -115,7 +115,7 @@ public class SpringConfigurationPropertySourcesTests {
|
||||||
|
|
||||||
});
|
});
|
||||||
sources.addLast(new MapPropertySource("baz",
|
sources.addLast(new MapPropertySource("baz",
|
||||||
Collections.<String, Object>singletonMap("baz", "barf")));
|
Collections.singletonMap("baz", "barf")));
|
||||||
SpringConfigurationPropertySources configurationSources = new SpringConfigurationPropertySources(
|
SpringConfigurationPropertySources configurationSources = new SpringConfigurationPropertySources(
|
||||||
sources);
|
sources);
|
||||||
assertThat(configurationSources.iterator()).hasSize(5);
|
assertThat(configurationSources.iterator()).hasSize(5);
|
||||||
|
|
@ -125,10 +125,10 @@ public class SpringConfigurationPropertySourcesTests {
|
||||||
public void shouldTrackChanges() throws Exception {
|
public void shouldTrackChanges() throws Exception {
|
||||||
MutablePropertySources sources = new MutablePropertySources();
|
MutablePropertySources sources = new MutablePropertySources();
|
||||||
sources.addLast(new MapPropertySource("test1",
|
sources.addLast(new MapPropertySource("test1",
|
||||||
Collections.<String, Object>singletonMap("a", "b")));
|
Collections.singletonMap("a", "b")));
|
||||||
assertThat(new SpringConfigurationPropertySources(sources).iterator()).hasSize(1);
|
assertThat(new SpringConfigurationPropertySources(sources).iterator()).hasSize(1);
|
||||||
sources.addLast(new MapPropertySource("test2",
|
sources.addLast(new MapPropertySource("test2",
|
||||||
Collections.<String, Object>singletonMap("b", "c")));
|
Collections.singletonMap("b", "c")));
|
||||||
assertThat(new SpringConfigurationPropertySources(sources).iterator()).hasSize(2);
|
assertThat(new SpringConfigurationPropertySources(sources).iterator()).hasSize(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,7 @@ public class RestTemplateBuilderTests {
|
||||||
@Test
|
@Test
|
||||||
public void defaultMessageConvertersShouldSetDefaultList() throws Exception {
|
public void defaultMessageConvertersShouldSetDefaultList() throws Exception {
|
||||||
RestTemplate template = new RestTemplate(
|
RestTemplate template = new RestTemplate(
|
||||||
Collections.<HttpMessageConverter<?>>singletonList(
|
Collections.singletonList(
|
||||||
new StringHttpMessageConverter()));
|
new StringHttpMessageConverter()));
|
||||||
this.builder.defaultMessageConverters().configure(template);
|
this.builder.defaultMessageConverters().configure(template);
|
||||||
assertThat(template.getMessageConverters())
|
assertThat(template.getMessageConverters())
|
||||||
|
|
@ -195,7 +195,7 @@ public class RestTemplateBuilderTests {
|
||||||
@Test
|
@Test
|
||||||
public void defaultMessageConvertersShouldClearExisting() throws Exception {
|
public void defaultMessageConvertersShouldClearExisting() throws Exception {
|
||||||
RestTemplate template = new RestTemplate(
|
RestTemplate template = new RestTemplate(
|
||||||
Collections.<HttpMessageConverter<?>>singletonList(
|
Collections.singletonList(
|
||||||
new StringHttpMessageConverter()));
|
new StringHttpMessageConverter()));
|
||||||
this.builder.additionalMessageConverters(this.messageConverter)
|
this.builder.additionalMessageConverters(this.messageConverter)
|
||||||
.defaultMessageConverters().configure(template);
|
.defaultMessageConverters().configure(template);
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ public class SpringBootServletInitializerTests {
|
||||||
given(servletContext.getInitParameter("spring.profiles.active"))
|
given(servletContext.getInitParameter("spring.profiles.active"))
|
||||||
.willReturn("from-servlet-context");
|
.willReturn("from-servlet-context");
|
||||||
given(servletContext.getAttributeNames())
|
given(servletContext.getAttributeNames())
|
||||||
.willReturn(Collections.enumeration(Collections.<String>emptyList()));
|
.willReturn(Collections.enumeration(Collections.emptyList()));
|
||||||
try (ConfigurableApplicationContext context = (ConfigurableApplicationContext) new PropertySourceVerifyingSpringBootServletInitializer()
|
try (ConfigurableApplicationContext context = (ConfigurableApplicationContext) new PropertySourceVerifyingSpringBootServletInitializer()
|
||||||
.createRootApplicationContext(servletContext)) {
|
.createRootApplicationContext(servletContext)) {
|
||||||
assertThat(context.getEnvironment().getActiveProfiles())
|
assertThat(context.getEnvironment().getActiveProfiles())
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ public class SampleAtmosphereApplication {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStartup(ServletContext servletContext) throws ServletException {
|
public void onStartup(ServletContext servletContext) throws ServletException {
|
||||||
onStartup(Collections.<Class<?>>emptySet(), servletContext);
|
onStartup(Collections.emptySet(), servletContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue