Unify method visibility of private classes
Apply checkstyle rule to ensure that private and package private classes do not have unnecessary public methods. Test classes have also been unified as much as possible to use default scoped inner-classes. Closes gh-7316
This commit is contained in:
@@ -68,7 +68,7 @@ abstract class DiscoveredOperationsFactory<O extends Operation> {
|
||||
this.invokerAdvisors = invokerAdvisors;
|
||||
}
|
||||
|
||||
public Collection<O> createOperations(EndpointId id, Object target) {
|
||||
Collection<O> createOperations(EndpointId id, Object target) {
|
||||
return MethodIntrospector
|
||||
.selectMethods(target.getClass(), (MetadataLookup<O>) (method) -> createOperation(id, target, method))
|
||||
.values();
|
||||
|
||||
@@ -415,11 +415,11 @@ public abstract class EndpointDiscoverer<E extends ExposableEndpoint<O>, O exten
|
||||
this.filter = getFilter(this.bean.getClass());
|
||||
}
|
||||
|
||||
public void addExtension(ExtensionBean extensionBean) {
|
||||
void addExtension(ExtensionBean extensionBean) {
|
||||
this.extensions.add(extensionBean);
|
||||
}
|
||||
|
||||
public Set<ExtensionBean> getExtensions() {
|
||||
Set<ExtensionBean> getExtensions() {
|
||||
return this.extensions;
|
||||
}
|
||||
|
||||
@@ -428,23 +428,23 @@ public abstract class EndpointDiscoverer<E extends ExposableEndpoint<O>, O exten
|
||||
.getValue(MergedAnnotation.VALUE, Class.class).orElse(null);
|
||||
}
|
||||
|
||||
public String getBeanName() {
|
||||
String getBeanName() {
|
||||
return this.beanName;
|
||||
}
|
||||
|
||||
public Object getBean() {
|
||||
Object getBean() {
|
||||
return this.bean;
|
||||
}
|
||||
|
||||
public EndpointId getId() {
|
||||
EndpointId getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public boolean isEnabledByDefault() {
|
||||
boolean isEnabledByDefault() {
|
||||
return this.enabledByDefault;
|
||||
}
|
||||
|
||||
public Class<?> getFilter() {
|
||||
Class<?> getFilter() {
|
||||
return this.filter;
|
||||
}
|
||||
|
||||
@@ -477,19 +477,19 @@ public abstract class EndpointDiscoverer<E extends ExposableEndpoint<O>, O exten
|
||||
this.filter = extensionAnnotation.getClass("filter");
|
||||
}
|
||||
|
||||
public String getBeanName() {
|
||||
String getBeanName() {
|
||||
return this.beanName;
|
||||
}
|
||||
|
||||
public Object getBean() {
|
||||
Object getBean() {
|
||||
return this.bean;
|
||||
}
|
||||
|
||||
public EndpointId getEndpointId() {
|
||||
EndpointId getEndpointId() {
|
||||
return this.endpointId;
|
||||
}
|
||||
|
||||
public Class<?> getFilter() {
|
||||
Class<?> getFilter() {
|
||||
return this.filter;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
* Copyright 2012-2019 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.
|
||||
@@ -114,11 +114,11 @@ public class CachingOperationInvoker implements OperationInvoker {
|
||||
this.creationTime = creationTime;
|
||||
}
|
||||
|
||||
public boolean isStale(long accessTime, long timeToLive) {
|
||||
boolean isStale(long accessTime, long timeToLive) {
|
||||
return (accessTime - this.creationTime) >= timeToLive;
|
||||
}
|
||||
|
||||
public Object getResponse() {
|
||||
Object getResponse() {
|
||||
return this.response;
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ public class EndpointMBean implements DynamicMBean {
|
||||
|
||||
private static class ReactiveHandler {
|
||||
|
||||
public static Object handle(Object result) {
|
||||
static Object handle(Object result) {
|
||||
if (result instanceof Mono) {
|
||||
return ((Mono<?>) result).block();
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ class MBeanInfoFactory {
|
||||
this.responseMapper = responseMapper;
|
||||
}
|
||||
|
||||
public MBeanInfo getMBeanInfo(ExposableJmxEndpoint endpoint) {
|
||||
MBeanInfo getMBeanInfo(ExposableJmxEndpoint endpoint) {
|
||||
String className = EndpointMBean.class.getName();
|
||||
String description = getDescription(endpoint);
|
||||
ModelMBeanOperationInfo[] operations = getMBeanOperations(endpoint);
|
||||
|
||||
@@ -184,7 +184,7 @@ class DiscoveredJmxOperation extends AbstractDiscoveredOperation implements JmxO
|
||||
*/
|
||||
private static class JmxType {
|
||||
|
||||
public static Class<?> get(Class<?> source) {
|
||||
static Class<?> get(Class<?> source) {
|
||||
if (source.isEnum()) {
|
||||
return String.class;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ class RequestPredicateFactory {
|
||||
this.endpointMediaTypes = endpointMediaTypes;
|
||||
}
|
||||
|
||||
public WebOperationRequestPredicate getRequestPredicate(EndpointId endpointId, String rootPath,
|
||||
WebOperationRequestPredicate getRequestPredicate(EndpointId endpointId, String rootPath,
|
||||
DiscoveredOperationMethod operationMethod) {
|
||||
Method method = operationMethod.getMethod();
|
||||
String path = getPath(rootPath, method);
|
||||
|
||||
@@ -299,13 +299,13 @@ public abstract class AbstractWebFluxEndpointHandlerMapping extends RequestMappi
|
||||
return this::emptySecurityContext;
|
||||
}
|
||||
|
||||
public Mono<? extends SecurityContext> springSecurityContext() {
|
||||
Mono<? extends SecurityContext> springSecurityContext() {
|
||||
return ReactiveSecurityContextHolder.getContext()
|
||||
.map((securityContext) -> new ReactiveSecurityContext(securityContext.getAuthentication()))
|
||||
.switchIfEmpty(Mono.just(new ReactiveSecurityContext(null)));
|
||||
}
|
||||
|
||||
public Mono<SecurityContext> emptySecurityContext() {
|
||||
Mono<SecurityContext> emptySecurityContext() {
|
||||
return Mono.just(SecurityContext.NONE);
|
||||
}
|
||||
|
||||
@@ -369,7 +369,7 @@ public abstract class AbstractWebFluxEndpointHandlerMapping extends RequestMappi
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
public Publisher<ResponseEntity<Object>> handle(ServerWebExchange exchange,
|
||||
Publisher<ResponseEntity<Object>> handle(ServerWebExchange exchange,
|
||||
@RequestBody(required = false) Map<String, String> body) {
|
||||
return this.operation.handle(exchange, body);
|
||||
}
|
||||
@@ -388,7 +388,7 @@ public abstract class AbstractWebFluxEndpointHandlerMapping extends RequestMappi
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
public Publisher<ResponseEntity<Object>> handle(ServerWebExchange exchange) {
|
||||
Publisher<ResponseEntity<Object>> handle(ServerWebExchange exchange) {
|
||||
return this.operation.handle(exchange, null);
|
||||
}
|
||||
|
||||
|
||||
@@ -335,7 +335,7 @@ public abstract class AbstractWebMvcEndpointHandlerMapping extends RequestMappin
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
public Object handle(HttpServletRequest request, @RequestBody(required = false) Map<String, String> body) {
|
||||
Object handle(HttpServletRequest request, @RequestBody(required = false) Map<String, String> body) {
|
||||
return this.operation.handle(request, body);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public class JmsHealthIndicator extends AbstractHealthIndicator {
|
||||
this.connection = connection;
|
||||
}
|
||||
|
||||
public void start() throws JMSException {
|
||||
void start() throws JMSException {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
if (!this.latch.await(5, TimeUnit.SECONDS)) {
|
||||
|
||||
@@ -94,8 +94,7 @@ public class DataSourcePoolMetrics implements MeterBinder {
|
||||
this.metadataProvider = metadataProvider;
|
||||
}
|
||||
|
||||
public <N extends Number> Function<DataSource, N> getValueFunction(
|
||||
Function<DataSourcePoolMetadata, N> function) {
|
||||
<N extends Number> Function<DataSource, N> getValueFunction(Function<DataSourcePoolMetadata, N> function) {
|
||||
return (dataSource) -> function.apply(getDataSourcePoolMetadata(dataSource));
|
||||
}
|
||||
|
||||
|
||||
@@ -195,15 +195,15 @@ public class WebMvcMetricsFilter extends OncePerRequestFilter {
|
||||
this.timerSample = timerSample;
|
||||
}
|
||||
|
||||
public Timer.Sample getTimerSample() {
|
||||
Timer.Sample getTimerSample() {
|
||||
return this.timerSample;
|
||||
}
|
||||
|
||||
public void attachTo(HttpServletRequest request) {
|
||||
void attachTo(HttpServletRequest request) {
|
||||
request.setAttribute(ATTRIBUTE, this);
|
||||
}
|
||||
|
||||
public static TimingContext get(HttpServletRequest request) {
|
||||
static TimingContext get(HttpServletRequest request) {
|
||||
return (TimingContext) request.getAttribute(ATTRIBUTE);
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ public class AuthenticationAuditListener extends AbstractAuthenticationAuditList
|
||||
|
||||
private static class WebAuditListener {
|
||||
|
||||
public void process(AuthenticationAuditListener listener, AbstractAuthenticationEvent input) {
|
||||
void process(AuthenticationAuditListener listener, AbstractAuthenticationEvent input) {
|
||||
if (listener != null) {
|
||||
AuthenticationSwitchUserEvent event = (AuthenticationSwitchUserEvent) input;
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
@@ -109,7 +109,7 @@ public class AuthenticationAuditListener extends AbstractAuthenticationAuditList
|
||||
|
||||
}
|
||||
|
||||
public boolean accepts(AbstractAuthenticationEvent event) {
|
||||
boolean accepts(AbstractAuthenticationEvent event) {
|
||||
return event instanceof AuthenticationSwitchUserEvent;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ final class DispatcherServletHandlerMappings {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
public List<HandlerMapping> getHandlerMappings() {
|
||||
List<HandlerMapping> getHandlerMappings() {
|
||||
List<HandlerMapping> handlerMappings = this.dispatcherServlet.getHandlerMappings();
|
||||
if (handlerMappings == null) {
|
||||
initializeDispatcherServletIfPossible();
|
||||
@@ -79,7 +79,7 @@ final class DispatcherServletHandlerMappings {
|
||||
}
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate;
|
||||
|
||||
import org.springframework.boot.testsupport.context.AbstractConfigurationClassTests;
|
||||
|
||||
/**
|
||||
* Tests for the actuator module's {@code @Configuration} classes.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public class ActuatorConfigurationClassTests extends AbstractConfigurationClassTests {
|
||||
|
||||
}
|
||||
@@ -66,10 +66,10 @@ class AuditEventsEndpointWebIntegrationTests {
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
protected static class TestConfiguration {
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public AuditEventRepository auditEventsRepository() {
|
||||
AuditEventRepository auditEventsRepository() {
|
||||
AuditEventRepository repository = new InMemoryAuditEventRepository(3);
|
||||
repository.add(createEvent("2016-11-01T11:00:00Z", "admin", "login"));
|
||||
repository.add(createEvent("2016-11-01T12:00:00Z", "admin", "logout"));
|
||||
@@ -78,7 +78,7 @@ class AuditEventsEndpointWebIntegrationTests {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AuditEventsEndpoint auditEventsEndpoint(AuditEventRepository auditEventRepository) {
|
||||
AuditEventsEndpoint auditEventsEndpoint(AuditEventRepository auditEventRepository) {
|
||||
return new AuditEventsEndpoint(auditEventRepository);
|
||||
}
|
||||
|
||||
|
||||
@@ -104,10 +104,10 @@ class BeansEndpointTests {
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public static class EndpointConfiguration {
|
||||
static class EndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public BeansEndpoint endpoint(ConfigurableApplicationContext context) {
|
||||
BeansEndpoint endpoint(ConfigurableApplicationContext context) {
|
||||
return new BeansEndpoint(context);
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ class BeansEndpointTests {
|
||||
static class BeanConfiguration {
|
||||
|
||||
@Bean
|
||||
public String bean() {
|
||||
String bean() {
|
||||
return "bean";
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ class BeansEndpointTests {
|
||||
|
||||
@Lazy
|
||||
@Bean
|
||||
public String lazyBean() {
|
||||
String lazyBean() {
|
||||
return "lazyBean";
|
||||
}
|
||||
|
||||
|
||||
@@ -86,22 +86,22 @@ class CachesEndpointWebIntegrationTests {
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public CacheManager one() {
|
||||
CacheManager one() {
|
||||
return new ConcurrentMapCacheManager("a", "b");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CacheManager two() {
|
||||
CacheManager two() {
|
||||
return new ConcurrentMapCacheManager("a", "c");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CachesEndpoint endpoint(Map<String, CacheManager> cacheManagers) {
|
||||
CachesEndpoint endpoint(Map<String, CacheManager> cacheManagers) {
|
||||
return new CachesEndpoint(cacheManagers);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CachesEndpointWebExtension cachesEndpointWebExtension(CachesEndpoint endpoint) {
|
||||
CachesEndpointWebExtension cachesEndpointWebExtension(CachesEndpoint endpoint) {
|
||||
return new CachesEndpointWebExtension(endpoint);
|
||||
}
|
||||
|
||||
|
||||
@@ -89,20 +89,20 @@ class ShutdownEndpointTests {
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public static class EndpointConfig {
|
||||
static class EndpointConfig {
|
||||
|
||||
private final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
private volatile ClassLoader threadContextClassLoader;
|
||||
|
||||
@Bean
|
||||
public ShutdownEndpoint endpoint() {
|
||||
ShutdownEndpoint endpoint() {
|
||||
ShutdownEndpoint endpoint = new ShutdownEndpoint();
|
||||
return endpoint;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ApplicationListener<ContextClosedEvent> listener() {
|
||||
ApplicationListener<ContextClosedEvent> listener() {
|
||||
return (event) -> {
|
||||
EndpointConfig.this.threadContextClassLoader = Thread.currentThread().getContextClassLoader();
|
||||
EndpointConfig.this.latch.countDown();
|
||||
@@ -112,12 +112,12 @@ class ShutdownEndpointTests {
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public static class EmptyConfig {
|
||||
static class EmptyConfig {
|
||||
|
||||
private final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
@Bean
|
||||
public ApplicationListener<ContextClosedEvent> listener() {
|
||||
ApplicationListener<ContextClosedEvent> listener() {
|
||||
return (event) -> EmptyConfig.this.latch.countDown();
|
||||
}
|
||||
|
||||
|
||||
@@ -75,22 +75,22 @@ class ConfigurationPropertiesReportEndpointMethodAnnotationsTests {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableConfigurationProperties
|
||||
public static class Config {
|
||||
static class Config {
|
||||
|
||||
@Bean
|
||||
public ConfigurationPropertiesReportEndpoint endpoint() {
|
||||
ConfigurationPropertiesReportEndpoint endpoint() {
|
||||
return new ConfigurationPropertiesReportEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties(prefix = "first")
|
||||
public Foo foo() {
|
||||
Foo foo() {
|
||||
return new Foo();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties(prefix = "other")
|
||||
public Foo other() {
|
||||
Foo other() {
|
||||
return new Foo();
|
||||
}
|
||||
|
||||
@@ -98,16 +98,16 @@ class ConfigurationPropertiesReportEndpointMethodAnnotationsTests {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableConfigurationProperties
|
||||
public static class OverriddenPrefix {
|
||||
static class OverriddenPrefix {
|
||||
|
||||
@Bean
|
||||
public ConfigurationPropertiesReportEndpoint endpoint() {
|
||||
ConfigurationPropertiesReportEndpoint endpoint() {
|
||||
return new ConfigurationPropertiesReportEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties(prefix = "other")
|
||||
public Bar bar() {
|
||||
Bar bar() {
|
||||
return new Bar();
|
||||
}
|
||||
|
||||
|
||||
@@ -71,10 +71,10 @@ class ConfigurationPropertiesReportEndpointParentTests {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableConfigurationProperties
|
||||
public static class Parent {
|
||||
static class Parent {
|
||||
|
||||
@Bean
|
||||
public TestProperties testProperties() {
|
||||
TestProperties testProperties() {
|
||||
return new TestProperties();
|
||||
}
|
||||
|
||||
@@ -82,15 +82,15 @@ class ConfigurationPropertiesReportEndpointParentTests {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableConfigurationProperties
|
||||
public static class ClassConfigurationProperties {
|
||||
static class ClassConfigurationProperties {
|
||||
|
||||
@Bean
|
||||
public ConfigurationPropertiesReportEndpoint endpoint() {
|
||||
ConfigurationPropertiesReportEndpoint endpoint() {
|
||||
return new ConfigurationPropertiesReportEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TestProperties someProperties() {
|
||||
TestProperties someProperties() {
|
||||
return new TestProperties();
|
||||
}
|
||||
|
||||
@@ -98,35 +98,35 @@ class ConfigurationPropertiesReportEndpointParentTests {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableConfigurationProperties
|
||||
public static class BeanMethodConfigurationProperties {
|
||||
static class BeanMethodConfigurationProperties {
|
||||
|
||||
@Bean
|
||||
public ConfigurationPropertiesReportEndpoint endpoint() {
|
||||
ConfigurationPropertiesReportEndpoint endpoint() {
|
||||
return new ConfigurationPropertiesReportEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties(prefix = "other")
|
||||
public OtherProperties otherProperties() {
|
||||
OtherProperties otherProperties() {
|
||||
return new OtherProperties();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class OtherProperties {
|
||||
static class OtherProperties {
|
||||
|
||||
}
|
||||
|
||||
@ConfigurationProperties(prefix = "test")
|
||||
public static class TestProperties {
|
||||
static class TestProperties {
|
||||
|
||||
private String myTestProperty = "654321";
|
||||
|
||||
public String getMyTestProperty() {
|
||||
String getMyTestProperty() {
|
||||
return this.myTestProperty;
|
||||
}
|
||||
|
||||
public void setMyTestProperty(String myTestProperty) {
|
||||
void setMyTestProperty(String myTestProperty) {
|
||||
this.myTestProperty = myTestProperty;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,38 +63,38 @@ class ConfigurationPropertiesReportEndpointProxyTests {
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableTransactionManagement(proxyTargetClass = false)
|
||||
@EnableConfigurationProperties
|
||||
public static class Config {
|
||||
static class Config {
|
||||
|
||||
@Bean
|
||||
public ConfigurationPropertiesReportEndpoint endpoint() {
|
||||
ConfigurationPropertiesReportEndpoint endpoint() {
|
||||
return new ConfigurationPropertiesReportEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public PlatformTransactionManager transactionManager(DataSource dataSource) {
|
||||
PlatformTransactionManager transactionManager(DataSource dataSource) {
|
||||
return new DataSourceTransactionManager(dataSource);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DataSource dataSource() {
|
||||
DataSource dataSource() {
|
||||
return new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.HSQL).build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public interface Executor {
|
||||
interface Executor {
|
||||
|
||||
void execute();
|
||||
|
||||
}
|
||||
|
||||
public abstract static class AbstractExecutor implements Executor {
|
||||
abstract static class AbstractExecutor implements Executor {
|
||||
|
||||
}
|
||||
|
||||
@Component
|
||||
@ConfigurationProperties("executor.sql")
|
||||
public static class SqlExecutor extends AbstractExecutor {
|
||||
static class SqlExecutor extends AbstractExecutor {
|
||||
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||
|
||||
@@ -240,10 +240,10 @@ class ConfigurationPropertiesReportEndpointSerializationTests {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableConfigurationProperties
|
||||
public static class Base {
|
||||
static class Base {
|
||||
|
||||
@Bean
|
||||
public ConfigurationPropertiesReportEndpoint endpoint() {
|
||||
ConfigurationPropertiesReportEndpoint endpoint() {
|
||||
return new ConfigurationPropertiesReportEndpoint();
|
||||
}
|
||||
|
||||
@@ -251,11 +251,11 @@ class ConfigurationPropertiesReportEndpointSerializationTests {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@Import(Base.class)
|
||||
public static class FooConfig {
|
||||
static class FooConfig {
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties(prefix = "foo")
|
||||
public Foo foo() {
|
||||
Foo foo() {
|
||||
return new Foo();
|
||||
}
|
||||
|
||||
@@ -263,11 +263,11 @@ class ConfigurationPropertiesReportEndpointSerializationTests {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@Import(Base.class)
|
||||
public static class SelfReferentialConfig {
|
||||
static class SelfReferentialConfig {
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties(prefix = "foo")
|
||||
public SelfReferential foo() {
|
||||
SelfReferential foo() {
|
||||
return new SelfReferential();
|
||||
}
|
||||
|
||||
@@ -275,11 +275,11 @@ class ConfigurationPropertiesReportEndpointSerializationTests {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@Import(Base.class)
|
||||
public static class MetadataCycleConfig {
|
||||
static class MetadataCycleConfig {
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties(prefix = "bar")
|
||||
public SelfReferential foo() {
|
||||
SelfReferential foo() {
|
||||
return new SelfReferential();
|
||||
}
|
||||
|
||||
@@ -287,11 +287,11 @@ class ConfigurationPropertiesReportEndpointSerializationTests {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@Import(Base.class)
|
||||
public static class MapConfig {
|
||||
static class MapConfig {
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties(prefix = "foo")
|
||||
public MapHolder foo() {
|
||||
MapHolder foo() {
|
||||
return new MapHolder();
|
||||
}
|
||||
|
||||
@@ -299,11 +299,11 @@ class ConfigurationPropertiesReportEndpointSerializationTests {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@Import(Base.class)
|
||||
public static class ListConfig {
|
||||
static class ListConfig {
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties(prefix = "foo")
|
||||
public ListHolder foo() {
|
||||
ListHolder foo() {
|
||||
return new ListHolder();
|
||||
}
|
||||
|
||||
@@ -311,11 +311,11 @@ class ConfigurationPropertiesReportEndpointSerializationTests {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@Import(Base.class)
|
||||
public static class MetadataMapConfig {
|
||||
static class MetadataMapConfig {
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties(prefix = "spam")
|
||||
public MapHolder foo() {
|
||||
MapHolder foo() {
|
||||
return new MapHolder();
|
||||
}
|
||||
|
||||
@@ -323,11 +323,11 @@ class ConfigurationPropertiesReportEndpointSerializationTests {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@Import(Base.class)
|
||||
public static class AddressedConfig {
|
||||
static class AddressedConfig {
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties(prefix = "foo")
|
||||
public Addressed foo() {
|
||||
Addressed foo() {
|
||||
return new Addressed();
|
||||
}
|
||||
|
||||
@@ -335,11 +335,11 @@ class ConfigurationPropertiesReportEndpointSerializationTests {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@Import(Base.class)
|
||||
public static class InitializedMapAndListPropertiesConfig {
|
||||
static class InitializedMapAndListPropertiesConfig {
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties(prefix = "foo")
|
||||
public InitializedMapAndListProperties foo() {
|
||||
InitializedMapAndListProperties foo() {
|
||||
return new InitializedMapAndListProperties();
|
||||
}
|
||||
|
||||
@@ -464,7 +464,7 @@ class ConfigurationPropertiesReportEndpointSerializationTests {
|
||||
|
||||
}
|
||||
|
||||
static class Cycle {
|
||||
public static class Cycle {
|
||||
|
||||
private final Alpha alpha = new Alpha(this);
|
||||
|
||||
@@ -472,7 +472,7 @@ class ConfigurationPropertiesReportEndpointSerializationTests {
|
||||
return this.alpha;
|
||||
}
|
||||
|
||||
static class Alpha {
|
||||
public static class Alpha {
|
||||
|
||||
private final Cycle cycle;
|
||||
|
||||
@@ -495,7 +495,7 @@ class ConfigurationPropertiesReportEndpointSerializationTests {
|
||||
@Bean
|
||||
// gh-11037
|
||||
@ConfigurationProperties(prefix = "cycle")
|
||||
public Cycle cycle() {
|
||||
Cycle cycle() {
|
||||
return new Cycle();
|
||||
}
|
||||
|
||||
@@ -506,13 +506,13 @@ class ConfigurationPropertiesReportEndpointSerializationTests {
|
||||
static class HikariDataSourceConfig {
|
||||
|
||||
@Bean
|
||||
public ConfigurationPropertiesReportEndpoint endpoint() {
|
||||
ConfigurationPropertiesReportEndpoint endpoint() {
|
||||
return new ConfigurationPropertiesReportEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties(prefix = "test.datasource")
|
||||
public HikariDataSource hikariDataSource() {
|
||||
HikariDataSource hikariDataSource() {
|
||||
return new HikariDataSource();
|
||||
}
|
||||
|
||||
|
||||
@@ -212,10 +212,10 @@ class ConfigurationPropertiesReportEndpointTests {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableConfigurationProperties
|
||||
public static class Parent {
|
||||
static class Parent {
|
||||
|
||||
@Bean
|
||||
public TestProperties testProperties() {
|
||||
TestProperties testProperties() {
|
||||
return new TestProperties();
|
||||
}
|
||||
|
||||
@@ -223,15 +223,15 @@ class ConfigurationPropertiesReportEndpointTests {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableConfigurationProperties
|
||||
public static class Config {
|
||||
static class Config {
|
||||
|
||||
@Bean
|
||||
public ConfigurationPropertiesReportEndpoint endpoint() {
|
||||
ConfigurationPropertiesReportEndpoint endpoint() {
|
||||
return new ConfigurationPropertiesReportEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TestProperties testProperties() {
|
||||
TestProperties testProperties() {
|
||||
return new TestProperties();
|
||||
}
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ class ElasticsearchHealthIndicatorTests {
|
||||
|
||||
}
|
||||
|
||||
private static class TestActionFuture extends PlainActionFuture<ClusterHealthResponse> {
|
||||
static class TestActionFuture extends PlainActionFuture<ClusterHealthResponse> {
|
||||
|
||||
private long getTimeout = -1L;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class DiscoveredOperationMethodTests {
|
||||
assertThat(discovered.getProducesMediaTypes()).containsExactly("application/json");
|
||||
}
|
||||
|
||||
public void example() {
|
||||
void example() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ class DiscoveredOperationsFactoryTests {
|
||||
static class ExampleRead {
|
||||
|
||||
@ReadOperation
|
||||
public String read() {
|
||||
String read() {
|
||||
return "read";
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ class DiscoveredOperationsFactoryTests {
|
||||
static class ExampleWrite {
|
||||
|
||||
@WriteOperation
|
||||
public String write() {
|
||||
String write() {
|
||||
return "write";
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ class DiscoveredOperationsFactoryTests {
|
||||
static class ExampleDelete {
|
||||
|
||||
@DeleteOperation
|
||||
public String delete() {
|
||||
String delete() {
|
||||
return "delete";
|
||||
}
|
||||
|
||||
@@ -155,12 +155,12 @@ class DiscoveredOperationsFactoryTests {
|
||||
static class ExampleMultiple {
|
||||
|
||||
@ReadOperation
|
||||
public String read() {
|
||||
String read() {
|
||||
return "read";
|
||||
}
|
||||
|
||||
@WriteOperation
|
||||
public String write() {
|
||||
String write() {
|
||||
return "write";
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ class DiscoveredOperationsFactoryTests {
|
||||
static class ExampleWithParams {
|
||||
|
||||
@ReadOperation
|
||||
public String read(String name) {
|
||||
String read(String name) {
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -215,15 +215,15 @@ class DiscoveredOperationsFactoryTests {
|
||||
return invoker;
|
||||
}
|
||||
|
||||
public EndpointId getEndpointId() {
|
||||
EndpointId getEndpointId() {
|
||||
return this.endpointId;
|
||||
}
|
||||
|
||||
public OperationType getOperationType() {
|
||||
OperationType getOperationType() {
|
||||
return this.operationType;
|
||||
}
|
||||
|
||||
public OperationParameters getParameters() {
|
||||
OperationParameters getParameters() {
|
||||
return this.parameters;
|
||||
}
|
||||
|
||||
|
||||
@@ -331,7 +331,7 @@ class EndpointDiscovererTests {
|
||||
static class TestEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public TestEndpoint testEndpoint() {
|
||||
TestEndpoint testEndpoint() {
|
||||
return new TestEndpoint();
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ class EndpointDiscovererTests {
|
||||
static class TestEndpointSubclassConfiguration {
|
||||
|
||||
@Bean
|
||||
public TestEndpointSubclass testEndpointSubclass() {
|
||||
TestEndpointSubclass testEndpointSubclass() {
|
||||
return new TestEndpointSubclass();
|
||||
}
|
||||
|
||||
@@ -351,12 +351,12 @@ class EndpointDiscovererTests {
|
||||
static class ClashingEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public TestEndpoint testEndpointTwo() {
|
||||
TestEndpoint testEndpointTwo() {
|
||||
return new TestEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TestEndpoint testEndpointOne() {
|
||||
TestEndpoint testEndpointOne() {
|
||||
return new TestEndpoint();
|
||||
}
|
||||
|
||||
@@ -366,12 +366,12 @@ class EndpointDiscovererTests {
|
||||
static class ScopedTargetEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public TestEndpoint testEndpoint() {
|
||||
TestEndpoint testEndpoint() {
|
||||
return new TestEndpoint();
|
||||
}
|
||||
|
||||
@Bean(name = "scopedTarget.testEndpoint")
|
||||
public TestEndpoint scopedTargetTestEndpoint() {
|
||||
TestEndpoint scopedTargetTestEndpoint() {
|
||||
return new TestEndpoint();
|
||||
}
|
||||
|
||||
@@ -391,26 +391,26 @@ class EndpointDiscovererTests {
|
||||
static class TestEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public Object getAll() {
|
||||
Object getAll() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ReadOperation
|
||||
public Object getOne(@Selector String id) {
|
||||
Object getOne(@Selector String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@WriteOperation
|
||||
public void update(String foo, String bar) {
|
||||
void update(String foo, String bar) {
|
||||
|
||||
}
|
||||
|
||||
@DeleteOperation
|
||||
public void deleteOne(@Selector String id) {
|
||||
void deleteOne(@Selector String id) {
|
||||
|
||||
}
|
||||
|
||||
public void someOtherMethod() {
|
||||
void someOtherMethod() {
|
||||
|
||||
}
|
||||
|
||||
@@ -419,7 +419,7 @@ class EndpointDiscovererTests {
|
||||
static class TestEndpointSubclass extends TestEndpoint {
|
||||
|
||||
@WriteOperation
|
||||
public void updateWithMoreArguments(String foo, String bar, String baz) {
|
||||
void updateWithMoreArguments(String foo, String bar, String baz) {
|
||||
|
||||
}
|
||||
|
||||
@@ -430,7 +430,7 @@ class EndpointDiscovererTests {
|
||||
@Documented
|
||||
@Endpoint
|
||||
@FilteredEndpoint(SpecializedEndpointFilter.class)
|
||||
public @interface SpecializedEndpoint {
|
||||
@interface SpecializedEndpoint {
|
||||
|
||||
@AliasFor(annotation = Endpoint.class)
|
||||
String id();
|
||||
@@ -438,10 +438,10 @@ class EndpointDiscovererTests {
|
||||
}
|
||||
|
||||
@EndpointExtension(endpoint = SpecializedTestEndpoint.class, filter = SpecializedEndpointFilter.class)
|
||||
public static class SpecializedExtension {
|
||||
static class SpecializedExtension {
|
||||
|
||||
@ReadOperation
|
||||
public Object getSpecial() {
|
||||
Object getSpecial() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -459,7 +459,7 @@ class EndpointDiscovererTests {
|
||||
static class SpecializedTestEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public Object getAll() {
|
||||
Object getAll() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ class EndpointDiscovererTests {
|
||||
static class SubSpecializedTestEndpoint extends SpecializedTestEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public Object getSpecialOne(@Selector String id) {
|
||||
Object getSpecialOne(@Selector String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -575,7 +575,7 @@ class EndpointDiscovererTests {
|
||||
this.invoker = invoker;
|
||||
}
|
||||
|
||||
public OperationInvoker getInvoker() {
|
||||
OperationInvoker getInvoker() {
|
||||
return this.invoker;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ class ConversionServiceParameterValueMapperTests {
|
||||
.mapParameterValue(new TestOperationParameter(OffsetDateTime.class), "2011-12-03T10:15:30+01:00"));
|
||||
}
|
||||
|
||||
private static class TestOperationParameter implements OperationParameter {
|
||||
static class TestOperationParameter implements OperationParameter {
|
||||
|
||||
private final Class<?> type;
|
||||
|
||||
|
||||
@@ -134,21 +134,21 @@ class CachingOperationInvokerAdvisorTests {
|
||||
return new OperationMethod(method, OperationType.READ);
|
||||
}
|
||||
|
||||
public static class TestOperations {
|
||||
static class TestOperations {
|
||||
|
||||
public String get() {
|
||||
String get() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getWithParameters(@Nullable String foo, String bar) {
|
||||
String getWithParameters(@Nullable String foo, String bar) {
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getWithAllOptionalParameters(@Nullable String foo, @Nullable String bar) {
|
||||
String getWithAllOptionalParameters(@Nullable String foo, @Nullable String bar) {
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getWithSecurityContext(SecurityContext securityContext, @Nullable String bar) {
|
||||
String getWithSecurityContext(SecurityContext securityContext, @Nullable String bar) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ class JmxEndpointExporterTests {
|
||||
/**
|
||||
* Test {@link EndpointObjectNameFactory}.
|
||||
*/
|
||||
private static class TestEndpointObjectNameFactory implements EndpointObjectNameFactory {
|
||||
static class TestEndpointObjectNameFactory implements EndpointObjectNameFactory {
|
||||
|
||||
@Override
|
||||
public ObjectName getObjectName(ExposableJmxEndpoint endpoint) throws MalformedObjectNameException {
|
||||
|
||||
@@ -281,17 +281,17 @@ class JmxEndpointDiscovererTests {
|
||||
static class MultipleEndpointsConfiguration {
|
||||
|
||||
@Bean
|
||||
public TestEndpoint testEndpoint() {
|
||||
TestEndpoint testEndpoint() {
|
||||
return new TestEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TestJmxEndpoint testJmxEndpoint() {
|
||||
TestJmxEndpoint testJmxEndpoint() {
|
||||
return new TestJmxEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public NonJmxEndpoint nonJmxEndpoint() {
|
||||
NonJmxEndpoint nonJmxEndpoint() {
|
||||
return new NonJmxEndpoint();
|
||||
}
|
||||
|
||||
@@ -301,12 +301,12 @@ class JmxEndpointDiscovererTests {
|
||||
static class OverriddenOperationJmxEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public TestEndpoint testEndpoint() {
|
||||
TestEndpoint testEndpoint() {
|
||||
return new TestEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TestJmxEndpointExtension testJmxEndpointExtension() {
|
||||
TestJmxEndpointExtension testJmxEndpointExtension() {
|
||||
return new TestJmxEndpointExtension();
|
||||
}
|
||||
|
||||
@@ -316,12 +316,12 @@ class JmxEndpointDiscovererTests {
|
||||
static class AdditionalOperationJmxEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public TestEndpoint testEndpoint() {
|
||||
TestEndpoint testEndpoint() {
|
||||
return new TestEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AdditionalOperationJmxEndpointExtension additionalOperationJmxEndpointExtension() {
|
||||
AdditionalOperationJmxEndpointExtension additionalOperationJmxEndpointExtension() {
|
||||
return new AdditionalOperationJmxEndpointExtension();
|
||||
}
|
||||
|
||||
@@ -331,12 +331,12 @@ class JmxEndpointDiscovererTests {
|
||||
static class AdditionalClashingOperationsConfiguration {
|
||||
|
||||
@Bean
|
||||
public TestEndpoint testEndpoint() {
|
||||
TestEndpoint testEndpoint() {
|
||||
return new TestEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ClashingOperationsJmxEndpointExtension clashingOperationsJmxEndpointExtension() {
|
||||
ClashingOperationsJmxEndpointExtension clashingOperationsJmxEndpointExtension() {
|
||||
return new ClashingOperationsJmxEndpointExtension();
|
||||
}
|
||||
|
||||
@@ -346,17 +346,17 @@ class JmxEndpointDiscovererTests {
|
||||
static class ClashingJmxEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public TestEndpoint testEndpoint() {
|
||||
TestEndpoint testEndpoint() {
|
||||
return new TestEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TestJmxEndpointExtension testExtensionOne() {
|
||||
TestJmxEndpointExtension testExtensionOne() {
|
||||
return new TestJmxEndpointExtension();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TestJmxEndpointExtension testExtensionTwo() {
|
||||
TestJmxEndpointExtension testExtensionTwo() {
|
||||
return new TestJmxEndpointExtension();
|
||||
}
|
||||
|
||||
@@ -366,12 +366,12 @@ class JmxEndpointDiscovererTests {
|
||||
static class ClashingStandardEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public TestEndpoint testEndpointTwo() {
|
||||
TestEndpoint testEndpointTwo() {
|
||||
return new TestEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TestEndpoint testEndpointOne() {
|
||||
TestEndpoint testEndpointOne() {
|
||||
return new TestEndpoint();
|
||||
}
|
||||
|
||||
@@ -381,58 +381,58 @@ class JmxEndpointDiscovererTests {
|
||||
static class InvalidJmxExtensionConfiguration {
|
||||
|
||||
@Bean
|
||||
public NonJmxEndpoint nonJmxEndpoint() {
|
||||
NonJmxEndpoint nonJmxEndpoint() {
|
||||
return new NonJmxEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public NonJmxJmxEndpointExtension nonJmxJmxEndpointExtension() {
|
||||
NonJmxJmxEndpointExtension nonJmxJmxEndpointExtension() {
|
||||
return new NonJmxJmxEndpointExtension();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Endpoint(id = "test")
|
||||
private static class TestEndpoint {
|
||||
static class TestEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public Object getAll() {
|
||||
Object getAll() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ReadOperation
|
||||
public String getSomething(TimeUnit timeUnit) {
|
||||
String getSomething(TimeUnit timeUnit) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@WriteOperation
|
||||
public void update(String foo, String bar) {
|
||||
void update(String foo, String bar) {
|
||||
|
||||
}
|
||||
|
||||
@DeleteOperation
|
||||
public void deleteSomething(TimeUnit timeUnit) {
|
||||
void deleteSomething(TimeUnit timeUnit) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@JmxEndpoint(id = "jmx")
|
||||
private static class TestJmxEndpoint {
|
||||
static class TestJmxEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public Object getAll() {
|
||||
Object getAll() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EndpointJmxExtension(endpoint = TestEndpoint.class)
|
||||
private static class TestJmxEndpointExtension {
|
||||
static class TestJmxEndpointExtension {
|
||||
|
||||
@ManagedOperation(description = "Get all the things")
|
||||
@ReadOperation
|
||||
public Object getAll() {
|
||||
Object getAll() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -440,7 +440,7 @@ class JmxEndpointDiscovererTests {
|
||||
@ManagedOperation(description = "Get something based on a timeUnit")
|
||||
@ManagedOperationParameters({
|
||||
@ManagedOperationParameter(name = "unitMs", description = "Number of milliseconds") })
|
||||
public String getSomething(Long timeUnit) {
|
||||
String getSomething(Long timeUnit) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -448,7 +448,7 @@ class JmxEndpointDiscovererTests {
|
||||
@ManagedOperation(description = "Update something based on bar")
|
||||
@ManagedOperationParameters({ @ManagedOperationParameter(name = "foo", description = "Foo identifier"),
|
||||
@ManagedOperationParameter(name = "bar", description = "Bar value") })
|
||||
public void update(String foo, String bar) {
|
||||
void update(String foo, String bar) {
|
||||
|
||||
}
|
||||
|
||||
@@ -456,18 +456,18 @@ class JmxEndpointDiscovererTests {
|
||||
@ManagedOperation(description = "Delete something based on a timeUnit")
|
||||
@ManagedOperationParameters({
|
||||
@ManagedOperationParameter(name = "unitMs", description = "Number of milliseconds") })
|
||||
public void deleteSomething(Long timeUnit) {
|
||||
void deleteSomething(Long timeUnit) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EndpointJmxExtension(endpoint = TestEndpoint.class)
|
||||
private static class AdditionalOperationJmxEndpointExtension {
|
||||
static class AdditionalOperationJmxEndpointExtension {
|
||||
|
||||
@ManagedOperation(description = "Get another thing")
|
||||
@ReadOperation
|
||||
public Object getAnother() {
|
||||
Object getAnother() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -477,12 +477,12 @@ class JmxEndpointDiscovererTests {
|
||||
static class ClashingOperationsEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public Object getAll() {
|
||||
Object getAll() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ReadOperation
|
||||
public Object getAll(String param) {
|
||||
Object getAll(String param) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -492,32 +492,32 @@ class JmxEndpointDiscovererTests {
|
||||
static class ClashingOperationsJmxEndpointExtension {
|
||||
|
||||
@ReadOperation
|
||||
public Object getAll() {
|
||||
Object getAll() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ReadOperation
|
||||
public Object getAll(String param) {
|
||||
Object getAll(String param) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@WebEndpoint(id = "nonjmx")
|
||||
private static class NonJmxEndpoint {
|
||||
static class NonJmxEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public Object getData() {
|
||||
Object getData() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EndpointJmxExtension(endpoint = NonJmxEndpoint.class)
|
||||
private static class NonJmxJmxEndpointExtension {
|
||||
static class NonJmxJmxEndpointExtension {
|
||||
|
||||
@ReadOperation
|
||||
public Object getSomething() {
|
||||
Object getSomething() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ class EndpointServletTests {
|
||||
assertThat(endpointServlet.getLoadOnStartup()).isEqualTo(3);
|
||||
}
|
||||
|
||||
private static class TestServlet extends GenericServlet {
|
||||
static class TestServlet extends GenericServlet {
|
||||
|
||||
@Override
|
||||
public void service(ServletRequest req, ServletResponse res) {
|
||||
|
||||
@@ -137,11 +137,11 @@ class PathMappedEndpointsTests {
|
||||
return endpoint;
|
||||
}
|
||||
|
||||
interface TestEndpoint extends ExposableEndpoint<Operation> {
|
||||
public interface TestEndpoint extends ExposableEndpoint<Operation> {
|
||||
|
||||
}
|
||||
|
||||
interface TestPathMappedEndpoint extends ExposableEndpoint<Operation>, PathMappedEndpoint {
|
||||
public interface TestPathMappedEndpoint extends ExposableEndpoint<Operation>, PathMappedEndpoint {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ class ServletEndpointRegistrarTests {
|
||||
return endpoint;
|
||||
}
|
||||
|
||||
public static class TestServlet extends GenericServlet {
|
||||
static class TestServlet extends GenericServlet {
|
||||
|
||||
@Override
|
||||
public void service(ServletRequest req, ServletResponse res) {
|
||||
|
||||
@@ -423,7 +423,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
static class QueryEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public QueryEndpoint queryEndpoint() {
|
||||
QueryEndpoint queryEndpoint() {
|
||||
return new QueryEndpoint();
|
||||
}
|
||||
|
||||
@@ -434,7 +434,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
static class QueryWithListEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public QueryWithListEndpoint queryEndpoint() {
|
||||
QueryWithListEndpoint queryEndpoint() {
|
||||
return new QueryWithListEndpoint();
|
||||
}
|
||||
|
||||
@@ -445,7 +445,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
static class VoidWriteResponseEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public VoidWriteResponseEndpoint voidWriteResponseEndpoint(EndpointDelegate delegate) {
|
||||
VoidWriteResponseEndpoint voidWriteResponseEndpoint(EndpointDelegate delegate) {
|
||||
return new VoidWriteResponseEndpoint(delegate);
|
||||
}
|
||||
|
||||
@@ -456,7 +456,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
static class VoidDeleteResponseEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public VoidDeleteResponseEndpoint voidDeleteResponseEndpoint(EndpointDelegate delegate) {
|
||||
VoidDeleteResponseEndpoint voidDeleteResponseEndpoint(EndpointDelegate delegate) {
|
||||
return new VoidDeleteResponseEndpoint(delegate);
|
||||
}
|
||||
|
||||
@@ -467,7 +467,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
static class NullWriteResponseEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public NullWriteResponseEndpoint nullWriteResponseEndpoint(EndpointDelegate delegate) {
|
||||
NullWriteResponseEndpoint nullWriteResponseEndpoint(EndpointDelegate delegate) {
|
||||
return new NullWriteResponseEndpoint(delegate);
|
||||
}
|
||||
|
||||
@@ -478,7 +478,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
static class NullReadResponseEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public NullReadResponseEndpoint nullResponseEndpoint() {
|
||||
NullReadResponseEndpoint nullResponseEndpoint() {
|
||||
return new NullReadResponseEndpoint();
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
static class NullDeleteResponseEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public NullDeleteResponseEndpoint nullDeleteResponseEndpoint() {
|
||||
NullDeleteResponseEndpoint nullDeleteResponseEndpoint() {
|
||||
return new NullDeleteResponseEndpoint();
|
||||
}
|
||||
|
||||
@@ -511,7 +511,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
static class ResourceWebEndpointResponseEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public ResourceWebEndpointResponseEndpoint resourceEndpoint() {
|
||||
ResourceWebEndpointResponseEndpoint resourceEndpoint() {
|
||||
return new ResourceWebEndpointResponseEndpoint();
|
||||
}
|
||||
|
||||
@@ -522,7 +522,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
static class MonoResponseEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public MonoResponseEndpoint testEndpoint(EndpointDelegate endpointDelegate) {
|
||||
MonoResponseEndpoint testEndpoint(EndpointDelegate endpointDelegate) {
|
||||
return new MonoResponseEndpoint();
|
||||
}
|
||||
|
||||
@@ -533,7 +533,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
static class CustomMediaTypesEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public CustomMediaTypesEndpoint customMediaTypesEndpoint() {
|
||||
CustomMediaTypesEndpoint customMediaTypesEndpoint() {
|
||||
return new CustomMediaTypesEndpoint();
|
||||
}
|
||||
|
||||
@@ -544,7 +544,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
static class RequiredParameterEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public RequiredParametersEndpoint requiredParametersEndpoint() {
|
||||
RequiredParametersEndpoint requiredParametersEndpoint() {
|
||||
return new RequiredParametersEndpoint();
|
||||
}
|
||||
|
||||
@@ -552,10 +552,10 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@Import(BaseConfiguration.class)
|
||||
protected static class PrincipalEndpointConfiguration {
|
||||
static class PrincipalEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public PrincipalEndpoint principalEndpoint() {
|
||||
PrincipalEndpoint principalEndpoint() {
|
||||
return new PrincipalEndpoint();
|
||||
}
|
||||
|
||||
@@ -563,10 +563,10 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@Import(BaseConfiguration.class)
|
||||
protected static class PrincipalQueryEndpointConfiguration {
|
||||
static class PrincipalQueryEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public PrincipalQueryEndpoint principalQueryEndpoint() {
|
||||
PrincipalQueryEndpoint principalQueryEndpoint() {
|
||||
return new PrincipalQueryEndpoint();
|
||||
}
|
||||
|
||||
@@ -574,10 +574,10 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@Import(BaseConfiguration.class)
|
||||
protected static class SecurityContextEndpointConfiguration {
|
||||
static class SecurityContextEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public SecurityContextEndpoint securityContextEndpoint() {
|
||||
SecurityContextEndpoint securityContextEndpoint() {
|
||||
return new SecurityContextEndpoint();
|
||||
}
|
||||
|
||||
@@ -585,10 +585,10 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@Import(BaseConfiguration.class)
|
||||
protected static class UserInRoleEndpointConfiguration {
|
||||
static class UserInRoleEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public UserInRoleEndpoint userInRoleEndpoint() {
|
||||
UserInRoleEndpoint userInRoleEndpoint() {
|
||||
return new UserInRoleEndpoint();
|
||||
}
|
||||
|
||||
@@ -604,22 +604,22 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
}
|
||||
|
||||
@ReadOperation
|
||||
public Map<String, Object> readAll() {
|
||||
Map<String, Object> readAll() {
|
||||
return Collections.singletonMap("All", true);
|
||||
}
|
||||
|
||||
@ReadOperation
|
||||
public Map<String, Object> readPart(@Selector String part) {
|
||||
Map<String, Object> readPart(@Selector String part) {
|
||||
return Collections.singletonMap("part", part);
|
||||
}
|
||||
|
||||
@WriteOperation
|
||||
public void write(@Nullable String foo, @Nullable String bar) {
|
||||
void write(@Nullable String foo, @Nullable String bar) {
|
||||
this.endpointDelegate.write(foo, bar);
|
||||
}
|
||||
|
||||
@DeleteOperation
|
||||
public Map<String, Object> deletePart(@Selector String part) {
|
||||
Map<String, Object> deletePart(@Selector String part) {
|
||||
return Collections.singletonMap("part", part);
|
||||
}
|
||||
|
||||
@@ -629,12 +629,12 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
static class QueryEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public Map<String, String> query(String one, Integer two) {
|
||||
Map<String, String> query(String one, Integer two) {
|
||||
return Collections.singletonMap("query", one + " " + two);
|
||||
}
|
||||
|
||||
@ReadOperation
|
||||
public Map<String, String> queryWithParameterList(@Selector String list, String one, List<String> two) {
|
||||
Map<String, String> queryWithParameterList(@Selector String list, String one, List<String> two) {
|
||||
return Collections.singletonMap("query", list + " " + one + " " + two);
|
||||
}
|
||||
|
||||
@@ -644,7 +644,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
static class QueryWithListEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public Map<String, String> queryWithParameterList(String one, List<String> two) {
|
||||
Map<String, String> queryWithParameterList(String one, List<String> two) {
|
||||
return Collections.singletonMap("query", one + " " + two);
|
||||
}
|
||||
|
||||
@@ -660,7 +660,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
}
|
||||
|
||||
@WriteOperation
|
||||
public void write() {
|
||||
void write() {
|
||||
this.delegate.write();
|
||||
}
|
||||
|
||||
@@ -676,7 +676,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
}
|
||||
|
||||
@DeleteOperation
|
||||
public void delete() {
|
||||
void delete() {
|
||||
this.delegate.delete();
|
||||
}
|
||||
|
||||
@@ -692,7 +692,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
}
|
||||
|
||||
@WriteOperation
|
||||
public Object write() {
|
||||
Object write() {
|
||||
this.delegate.write();
|
||||
return null;
|
||||
}
|
||||
@@ -703,7 +703,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
static class NullReadResponseEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public String readReturningNull() {
|
||||
String readReturningNull() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -713,7 +713,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
static class NullDeleteResponseEndpoint {
|
||||
|
||||
@DeleteOperation
|
||||
public String deleteReturningNull() {
|
||||
String deleteReturningNull() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -723,7 +723,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
static class ResourceEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public Resource read() {
|
||||
Resource read() {
|
||||
return new ByteArrayResource(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 });
|
||||
}
|
||||
|
||||
@@ -733,7 +733,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
static class ResourceWebEndpointResponseEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public WebEndpointResponse<Resource> read() {
|
||||
WebEndpointResponse<Resource> read() {
|
||||
return new WebEndpointResponse<>(new ByteArrayResource(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }), 200);
|
||||
}
|
||||
|
||||
@@ -753,7 +753,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
static class CustomMediaTypesEndpoint {
|
||||
|
||||
@ReadOperation(produces = "text/plain")
|
||||
public String read() {
|
||||
String read() {
|
||||
return "read";
|
||||
}
|
||||
|
||||
@@ -763,7 +763,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
static class RequiredParametersEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public String read(String foo, @Nullable String bar) {
|
||||
String read(String foo, @Nullable String bar) {
|
||||
return foo;
|
||||
}
|
||||
|
||||
@@ -773,7 +773,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
static class PrincipalEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public String read(@Nullable Principal principal) {
|
||||
String read(@Nullable Principal principal) {
|
||||
return (principal != null) ? principal.getName() : "None";
|
||||
}
|
||||
|
||||
@@ -783,7 +783,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
static class PrincipalQueryEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public String read(String principal) {
|
||||
String read(String principal) {
|
||||
return principal;
|
||||
}
|
||||
|
||||
@@ -793,7 +793,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
static class SecurityContextEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public String read(SecurityContext securityContext) {
|
||||
String read(SecurityContext securityContext) {
|
||||
Principal principal = securityContext.getPrincipal();
|
||||
return (principal != null) ? principal.getName() : "None";
|
||||
}
|
||||
@@ -804,13 +804,13 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||
static class UserInRoleEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public String read(SecurityContext securityContext, String role) {
|
||||
String read(SecurityContext securityContext, String role) {
|
||||
return role + ": " + securityContext.isUserInRole(role);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public interface EndpointDelegate {
|
||||
interface EndpointDelegate {
|
||||
|
||||
void write();
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ import static org.mockito.Mockito.mock;
|
||||
class BaseConfiguration {
|
||||
|
||||
@Bean
|
||||
public AbstractWebEndpointIntegrationTests.EndpointDelegate endpointDelegate() {
|
||||
AbstractWebEndpointIntegrationTests.EndpointDelegate endpointDelegate() {
|
||||
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
||||
if (classLoader instanceof TomcatEmbeddedWebappClassLoader) {
|
||||
Thread.currentThread().setContextClassLoader(classLoader.getParent());
|
||||
@@ -55,13 +55,13 @@ class BaseConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public EndpointMediaTypes endpointMediaTypes() {
|
||||
EndpointMediaTypes endpointMediaTypes() {
|
||||
List<String> mediaTypes = Arrays.asList("application/vnd.test+json", "application/json");
|
||||
return new EndpointMediaTypes(mediaTypes, mediaTypes);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public WebEndpointDiscoverer webEndpointDiscoverer(EndpointMediaTypes endpointMediaTypes,
|
||||
WebEndpointDiscoverer webEndpointDiscoverer(EndpointMediaTypes endpointMediaTypes,
|
||||
ApplicationContext applicationContext) {
|
||||
ParameterValueMapper parameterMapper = new ConversionServiceParameterValueMapper(
|
||||
DefaultConversionService.getSharedInstance());
|
||||
@@ -70,7 +70,7 @@ class BaseConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
|
||||
PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
|
||||
return new PropertySourcesPlaceholderConfigurer();
|
||||
}
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ class ControllerEndpointDiscovererTests {
|
||||
static class TestControllerWithOperation {
|
||||
|
||||
@ReadOperation
|
||||
public String read() {
|
||||
String read() {
|
||||
return "error";
|
||||
}
|
||||
|
||||
|
||||
@@ -186,13 +186,13 @@ class ServletEndpointDiscovererTests {
|
||||
}
|
||||
|
||||
@ReadOperation
|
||||
public String read() {
|
||||
String read() {
|
||||
return "error";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class TestServlet extends GenericServlet {
|
||||
static class TestServlet extends GenericServlet {
|
||||
|
||||
@Override
|
||||
public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
|
||||
|
||||
@@ -271,12 +271,12 @@ class WebEndpointDiscovererTests {
|
||||
static class MultipleEndpointsConfiguration {
|
||||
|
||||
@Bean
|
||||
public TestEndpoint testEndpoint() {
|
||||
TestEndpoint testEndpoint() {
|
||||
return new TestEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public NonWebEndpoint nonWebEndpoint() {
|
||||
NonWebEndpoint nonWebEndpoint() {
|
||||
return new NonWebEndpoint();
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ class WebEndpointDiscovererTests {
|
||||
static class TestWebEndpointExtensionConfiguration {
|
||||
|
||||
@Bean
|
||||
public TestWebEndpointExtension endpointExtension() {
|
||||
TestWebEndpointExtension endpointExtension() {
|
||||
return new TestWebEndpointExtension();
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ class WebEndpointDiscovererTests {
|
||||
static class ClashingOperationsEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public ClashingOperationsEndpoint clashingOperationsEndpoint() {
|
||||
ClashingOperationsEndpoint clashingOperationsEndpoint() {
|
||||
return new ClashingOperationsEndpoint();
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ class WebEndpointDiscovererTests {
|
||||
static class ClashingOperationsWebEndpointExtensionConfiguration {
|
||||
|
||||
@Bean
|
||||
public ClashingOperationsWebEndpointExtension clashingOperationsExtension() {
|
||||
ClashingOperationsWebEndpointExtension clashingOperationsExtension() {
|
||||
return new ClashingOperationsWebEndpointExtension();
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ class WebEndpointDiscovererTests {
|
||||
static class OverriddenOperationWebEndpointExtensionConfiguration {
|
||||
|
||||
@Bean
|
||||
public OverriddenOperationWebEndpointExtension overriddenOperationExtension() {
|
||||
OverriddenOperationWebEndpointExtension overriddenOperationExtension() {
|
||||
return new OverriddenOperationWebEndpointExtension();
|
||||
}
|
||||
|
||||
@@ -328,7 +328,7 @@ class WebEndpointDiscovererTests {
|
||||
static class AdditionalOperationWebEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public AdditionalOperationWebEndpointExtension additionalOperationExtension() {
|
||||
AdditionalOperationWebEndpointExtension additionalOperationExtension() {
|
||||
return new AdditionalOperationWebEndpointExtension();
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ class WebEndpointDiscovererTests {
|
||||
static class TestEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public TestEndpoint testEndpoint() {
|
||||
TestEndpoint testEndpoint() {
|
||||
return new TestEndpoint();
|
||||
}
|
||||
|
||||
@@ -348,17 +348,17 @@ class WebEndpointDiscovererTests {
|
||||
static class ClashingWebEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public TestEndpoint testEndpoint() {
|
||||
TestEndpoint testEndpoint() {
|
||||
return new TestEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TestWebEndpointExtension testExtensionOne() {
|
||||
TestWebEndpointExtension testExtensionOne() {
|
||||
return new TestWebEndpointExtension();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TestWebEndpointExtension testExtensionTwo() {
|
||||
TestWebEndpointExtension testExtensionTwo() {
|
||||
return new TestWebEndpointExtension();
|
||||
}
|
||||
|
||||
@@ -368,12 +368,12 @@ class WebEndpointDiscovererTests {
|
||||
static class ClashingStandardEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public TestEndpoint testEndpointTwo() {
|
||||
TestEndpoint testEndpointTwo() {
|
||||
return new TestEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TestEndpoint testEndpointOne() {
|
||||
TestEndpoint testEndpointOne() {
|
||||
return new TestEndpoint();
|
||||
}
|
||||
|
||||
@@ -383,12 +383,12 @@ class WebEndpointDiscovererTests {
|
||||
static class ClashingSelectorsWebEndpointExtensionConfiguration {
|
||||
|
||||
@Bean
|
||||
public TestEndpoint testEndpoint() {
|
||||
TestEndpoint testEndpoint() {
|
||||
return new TestEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ClashingSelectorsWebEndpointExtension clashingSelectorsExtension() {
|
||||
ClashingSelectorsWebEndpointExtension clashingSelectorsExtension() {
|
||||
return new ClashingSelectorsWebEndpointExtension();
|
||||
}
|
||||
|
||||
@@ -398,12 +398,12 @@ class WebEndpointDiscovererTests {
|
||||
static class InvalidWebExtensionConfiguration {
|
||||
|
||||
@Bean
|
||||
public NonWebEndpoint nonWebEndpoint() {
|
||||
NonWebEndpoint nonWebEndpoint() {
|
||||
return new NonWebEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public NonWebWebEndpointExtension nonWebWebEndpointExtension() {
|
||||
NonWebWebEndpointExtension nonWebWebEndpointExtension() {
|
||||
return new NonWebWebEndpointExtension();
|
||||
}
|
||||
|
||||
@@ -413,7 +413,7 @@ class WebEndpointDiscovererTests {
|
||||
static class VoidWriteOperationEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public VoidWriteOperationEndpoint voidWriteOperationEndpoint() {
|
||||
VoidWriteOperationEndpoint voidWriteOperationEndpoint() {
|
||||
return new VoidWriteOperationEndpoint();
|
||||
}
|
||||
|
||||
@@ -424,7 +424,7 @@ class WebEndpointDiscovererTests {
|
||||
static class ResourceEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public ResourceEndpoint resourceEndpoint() {
|
||||
ResourceEndpoint resourceEndpoint() {
|
||||
return new ResourceEndpoint();
|
||||
}
|
||||
|
||||
@@ -435,7 +435,7 @@ class WebEndpointDiscovererTests {
|
||||
static class CustomMediaTypesEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public CustomMediaTypesEndpoint customMediaTypesEndpoint() {
|
||||
CustomMediaTypesEndpoint customMediaTypesEndpoint() {
|
||||
return new CustomMediaTypesEndpoint();
|
||||
}
|
||||
|
||||
@@ -445,21 +445,21 @@ class WebEndpointDiscovererTests {
|
||||
static class TestWebEndpointExtension {
|
||||
|
||||
@ReadOperation
|
||||
public Object getAll() {
|
||||
Object getAll() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ReadOperation
|
||||
public Object getOne(@Selector String id) {
|
||||
Object getOne(@Selector String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@WriteOperation
|
||||
public void update(String foo, String bar) {
|
||||
void update(String foo, String bar) {
|
||||
|
||||
}
|
||||
|
||||
public void someOtherMethod() {
|
||||
void someOtherMethod() {
|
||||
|
||||
}
|
||||
|
||||
@@ -469,7 +469,7 @@ class WebEndpointDiscovererTests {
|
||||
static class TestEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public Object getAll() {
|
||||
Object getAll() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -479,7 +479,7 @@ class WebEndpointDiscovererTests {
|
||||
static class OverriddenOperationWebEndpointExtension {
|
||||
|
||||
@ReadOperation
|
||||
public Object getAll() {
|
||||
Object getAll() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ class WebEndpointDiscovererTests {
|
||||
static class AdditionalOperationWebEndpointExtension {
|
||||
|
||||
@ReadOperation
|
||||
public Object getOne(@Selector String id) {
|
||||
Object getOne(@Selector String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -499,12 +499,12 @@ class WebEndpointDiscovererTests {
|
||||
static class ClashingOperationsEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public Object getAll() {
|
||||
Object getAll() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ReadOperation
|
||||
public Object getAgain() {
|
||||
Object getAgain() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -514,12 +514,12 @@ class WebEndpointDiscovererTests {
|
||||
static class ClashingOperationsWebEndpointExtension {
|
||||
|
||||
@ReadOperation
|
||||
public Object getAll() {
|
||||
Object getAll() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ReadOperation
|
||||
public Object getAgain() {
|
||||
Object getAgain() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -529,12 +529,12 @@ class WebEndpointDiscovererTests {
|
||||
static class ClashingSelectorsWebEndpointExtension {
|
||||
|
||||
@ReadOperation
|
||||
public Object readOne(@Selector String oneA, @Selector String oneB) {
|
||||
Object readOne(@Selector String oneA, @Selector String oneB) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ReadOperation
|
||||
public Object readTwo(@Selector String twoA, @Selector String twoB) {
|
||||
Object readTwo(@Selector String twoA, @Selector String twoB) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -544,7 +544,7 @@ class WebEndpointDiscovererTests {
|
||||
static class NonWebEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public Object getData() {
|
||||
Object getData() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -554,7 +554,7 @@ class WebEndpointDiscovererTests {
|
||||
static class NonWebWebEndpointExtension {
|
||||
|
||||
@ReadOperation
|
||||
public Object getSomething(@Selector String name) {
|
||||
Object getSomething(@Selector String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -564,7 +564,7 @@ class WebEndpointDiscovererTests {
|
||||
static class VoidWriteOperationEndpoint {
|
||||
|
||||
@WriteOperation
|
||||
public void write(String foo, String bar) {
|
||||
void write(String foo, String bar) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -573,7 +573,7 @@ class WebEndpointDiscovererTests {
|
||||
static class ResourceEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public Resource read() {
|
||||
Resource read() {
|
||||
return new ByteArrayResource(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 });
|
||||
}
|
||||
|
||||
@@ -583,18 +583,18 @@ class WebEndpointDiscovererTests {
|
||||
static class CustomMediaTypesEndpoint {
|
||||
|
||||
@ReadOperation(produces = "text/plain")
|
||||
public String read() {
|
||||
String read() {
|
||||
return "read";
|
||||
}
|
||||
|
||||
@WriteOperation(produces = { "a/b", "c/d" })
|
||||
public String write() {
|
||||
String write() {
|
||||
return "write";
|
||||
|
||||
}
|
||||
|
||||
@DeleteOperation(produces = "text/plain")
|
||||
public String delete() {
|
||||
String delete() {
|
||||
return "delete";
|
||||
}
|
||||
|
||||
@@ -614,12 +614,12 @@ class WebEndpointDiscovererTests {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public RequestPredicateMatcher produces(String... mediaTypes) {
|
||||
RequestPredicateMatcher produces(String... mediaTypes) {
|
||||
this.produces = Arrays.asList(mediaTypes);
|
||||
return this;
|
||||
}
|
||||
|
||||
public RequestPredicateMatcher consumes(String... mediaTypes) {
|
||||
RequestPredicateMatcher consumes(String... mediaTypes) {
|
||||
this.consumes = Arrays.asList(mediaTypes);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -93,17 +93,17 @@ public class JerseyWebEndpointIntegrationTests
|
||||
static class JerseyConfiguration {
|
||||
|
||||
@Bean
|
||||
public TomcatServletWebServerFactory tomcat() {
|
||||
TomcatServletWebServerFactory tomcat() {
|
||||
return new TomcatServletWebServerFactory(0);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean<ServletContainer> servletContainer(ResourceConfig resourceConfig) {
|
||||
ServletRegistrationBean<ServletContainer> servletContainer(ResourceConfig resourceConfig) {
|
||||
return new ServletRegistrationBean<>(new ServletContainer(resourceConfig), "/*");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ResourceConfig resourceConfig(Environment environment, WebEndpointDiscoverer endpointDiscoverer,
|
||||
ResourceConfig resourceConfig(Environment environment, WebEndpointDiscoverer endpointDiscoverer,
|
||||
EndpointMediaTypes endpointMediaTypes) {
|
||||
ResourceConfig resourceConfig = new ResourceConfig();
|
||||
Collection<Resource> resources = new JerseyEndpointResourceFactory().createEndpointResources(
|
||||
@@ -121,7 +121,7 @@ public class JerseyWebEndpointIntegrationTests
|
||||
static class AuthenticatedConfiguration {
|
||||
|
||||
@Bean
|
||||
public Filter securityFilter() {
|
||||
Filter securityFilter() {
|
||||
return new OncePerRequestFilter() {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -107,23 +107,22 @@ class ControllerEndpointHandlerMappingIntegrationTests {
|
||||
static class EndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public NettyReactiveWebServerFactory netty() {
|
||||
NettyReactiveWebServerFactory netty() {
|
||||
return new NettyReactiveWebServerFactory(0);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HttpHandler httpHandler(ApplicationContext applicationContext) {
|
||||
HttpHandler httpHandler(ApplicationContext applicationContext) {
|
||||
return WebHttpHandlerBuilder.applicationContext(applicationContext).build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ControllerEndpointDiscoverer webEndpointDiscoverer(ApplicationContext applicationContext) {
|
||||
ControllerEndpointDiscoverer webEndpointDiscoverer(ApplicationContext applicationContext) {
|
||||
return new ControllerEndpointDiscoverer(applicationContext, null, Collections.emptyList());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ControllerEndpointHandlerMapping webEndpointHandlerMapping(
|
||||
ControllerEndpointsSupplier endpointsSupplier) {
|
||||
ControllerEndpointHandlerMapping webEndpointHandlerMapping(ControllerEndpointsSupplier endpointsSupplier) {
|
||||
return new ControllerEndpointHandlerMapping(new EndpointMapping("actuator"),
|
||||
endpointsSupplier.getEndpoints(), null);
|
||||
}
|
||||
@@ -131,15 +130,15 @@ class ControllerEndpointHandlerMappingIntegrationTests {
|
||||
}
|
||||
|
||||
@RestControllerEndpoint(id = "example")
|
||||
public static class ExampleWebFluxEndpoint {
|
||||
static class ExampleWebFluxEndpoint {
|
||||
|
||||
@GetMapping(path = "one", produces = MediaType.TEXT_PLAIN_VALUE)
|
||||
public String one() {
|
||||
String one() {
|
||||
return "One";
|
||||
}
|
||||
|
||||
@PostMapping("/two")
|
||||
public ResponseEntity<String> two(@RequestBody Map<String, Object> content) {
|
||||
ResponseEntity<String> two(@RequestBody Map<String, Object> content) {
|
||||
return ResponseEntity.created(URI.create("/example/" + content.get("id"))).build();
|
||||
}
|
||||
|
||||
|
||||
@@ -133,30 +133,30 @@ class ControllerEndpointHandlerMappingTests {
|
||||
}
|
||||
|
||||
@ControllerEndpoint(id = "first")
|
||||
private static class FirstTestMvcEndpoint {
|
||||
static class FirstTestMvcEndpoint {
|
||||
|
||||
@GetMapping("/")
|
||||
public String get() {
|
||||
String get() {
|
||||
return "test";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ControllerEndpoint(id = "second")
|
||||
private static class SecondTestMvcEndpoint {
|
||||
static class SecondTestMvcEndpoint {
|
||||
|
||||
@PostMapping("/")
|
||||
public void save() {
|
||||
void save() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ControllerEndpoint(id = "pathless")
|
||||
private static class PathlessControllerEndpoint {
|
||||
static class PathlessControllerEndpoint {
|
||||
|
||||
@GetMapping
|
||||
public String get() {
|
||||
String get() {
|
||||
return "test";
|
||||
}
|
||||
|
||||
|
||||
@@ -107,17 +107,17 @@ class WebFluxEndpointIntegrationTests
|
||||
private int port;
|
||||
|
||||
@Bean
|
||||
public NettyReactiveWebServerFactory netty() {
|
||||
NettyReactiveWebServerFactory netty() {
|
||||
return new NettyReactiveWebServerFactory(0);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HttpHandler httpHandler(ApplicationContext applicationContext) {
|
||||
HttpHandler httpHandler(ApplicationContext applicationContext) {
|
||||
return WebHttpHandlerBuilder.applicationContext(applicationContext).build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public WebFluxEndpointHandlerMapping webEndpointHandlerMapping(Environment environment,
|
||||
WebFluxEndpointHandlerMapping webEndpointHandlerMapping(Environment environment,
|
||||
WebEndpointDiscoverer endpointDiscoverer, EndpointMediaTypes endpointMediaTypes) {
|
||||
CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||
corsConfiguration.setAllowedOrigins(Arrays.asList("https://example.com"));
|
||||
@@ -128,7 +128,7 @@ class WebFluxEndpointIntegrationTests
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ApplicationListener<ReactiveWebServerInitializedEvent> serverInitializedListener() {
|
||||
ApplicationListener<ReactiveWebServerInitializedEvent> serverInitializedListener() {
|
||||
return (event) -> this.port = event.getWebServer().getPort();
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ class WebFluxEndpointIntegrationTests
|
||||
static class AuthenticatedConfiguration {
|
||||
|
||||
@Bean
|
||||
public WebFilter webFilter() {
|
||||
WebFilter webFilter() {
|
||||
return (exchange, chain) -> chain.filter(exchange).subscriberContext(
|
||||
ReactiveSecurityContextHolder.withAuthentication(new UsernamePasswordAuthenticationToken("Alice",
|
||||
"secret", Arrays.asList(new SimpleGrantedAuthority("ROLE_ACTUATOR")))));
|
||||
|
||||
@@ -105,18 +105,17 @@ class ControllerEndpointHandlerMappingIntegrationTests {
|
||||
static class EndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public TomcatServletWebServerFactory tomcat() {
|
||||
TomcatServletWebServerFactory tomcat() {
|
||||
return new TomcatServletWebServerFactory(0);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ControllerEndpointDiscoverer webEndpointDiscoverer(ApplicationContext applicationContext) {
|
||||
ControllerEndpointDiscoverer webEndpointDiscoverer(ApplicationContext applicationContext) {
|
||||
return new ControllerEndpointDiscoverer(applicationContext, null, Collections.emptyList());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ControllerEndpointHandlerMapping webEndpointHandlerMapping(
|
||||
ControllerEndpointsSupplier endpointsSupplier) {
|
||||
ControllerEndpointHandlerMapping webEndpointHandlerMapping(ControllerEndpointsSupplier endpointsSupplier) {
|
||||
return new ControllerEndpointHandlerMapping(new EndpointMapping("actuator"),
|
||||
endpointsSupplier.getEndpoints(), null);
|
||||
}
|
||||
@@ -124,15 +123,15 @@ class ControllerEndpointHandlerMappingIntegrationTests {
|
||||
}
|
||||
|
||||
@RestControllerEndpoint(id = "example")
|
||||
public static class ExampleMvcEndpoint {
|
||||
static class ExampleMvcEndpoint {
|
||||
|
||||
@GetMapping(path = "one", produces = MediaType.TEXT_PLAIN_VALUE)
|
||||
public String one() {
|
||||
String one() {
|
||||
return "One";
|
||||
}
|
||||
|
||||
@PostMapping("/two")
|
||||
public ResponseEntity<String> two(@RequestBody Map<String, Object> content) {
|
||||
ResponseEntity<String> two(@RequestBody Map<String, Object> content) {
|
||||
return ResponseEntity.created(URI.create("/example/" + content.get("id"))).build();
|
||||
}
|
||||
|
||||
|
||||
@@ -127,30 +127,30 @@ class ControllerEndpointHandlerMappingTests {
|
||||
}
|
||||
|
||||
@ControllerEndpoint(id = "first")
|
||||
private static class FirstTestMvcEndpoint {
|
||||
static class FirstTestMvcEndpoint {
|
||||
|
||||
@GetMapping("/")
|
||||
public String get() {
|
||||
String get() {
|
||||
return "test";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ControllerEndpoint(id = "second")
|
||||
private static class SecondTestMvcEndpoint {
|
||||
static class SecondTestMvcEndpoint {
|
||||
|
||||
@PostMapping("/")
|
||||
public void save() {
|
||||
void save() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ControllerEndpoint(id = "pathless")
|
||||
private static class PathlessControllerEndpoint {
|
||||
static class PathlessControllerEndpoint {
|
||||
|
||||
@GetMapping
|
||||
public String get() {
|
||||
String get() {
|
||||
return "test";
|
||||
}
|
||||
|
||||
|
||||
@@ -135,12 +135,12 @@ class MvcWebEndpointIntegrationTests
|
||||
static class WebMvcConfiguration {
|
||||
|
||||
@Bean
|
||||
public TomcatServletWebServerFactory tomcat() {
|
||||
TomcatServletWebServerFactory tomcat() {
|
||||
return new TomcatServletWebServerFactory(0);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public WebMvcEndpointHandlerMapping webEndpointHandlerMapping(Environment environment,
|
||||
WebMvcEndpointHandlerMapping webEndpointHandlerMapping(Environment environment,
|
||||
WebEndpointDiscoverer endpointDiscoverer, EndpointMediaTypes endpointMediaTypes) {
|
||||
CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||
corsConfiguration.setAllowedOrigins(Arrays.asList("https://example.com"));
|
||||
@@ -156,7 +156,7 @@ class MvcWebEndpointIntegrationTests
|
||||
static class AuthenticatedConfiguration {
|
||||
|
||||
@Bean
|
||||
public Filter securityFilter() {
|
||||
Filter securityFilter() {
|
||||
return new OncePerRequestFilter() {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2019 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.
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.boot.actuate.endpoint.web.test;
|
||||
|
||||
class PortHolder {
|
||||
public class PortHolder {
|
||||
|
||||
private int port;
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ class WebEndpointTestInvocationContextProvider implements TestTemplateInvocation
|
||||
|
||||
}
|
||||
|
||||
private static class WebEndpointsInvocationContext
|
||||
static class WebEndpointsInvocationContext
|
||||
implements TestTemplateInvocationContext, BeforeEachCallback, AfterEachCallback, ParameterResolver {
|
||||
|
||||
private static final Duration TIMEOUT = Duration.ofMinutes(6);
|
||||
@@ -219,17 +219,17 @@ class WebEndpointTestInvocationContextProvider implements TestTemplateInvocation
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TomcatServletWebServerFactory tomcat() {
|
||||
TomcatServletWebServerFactory tomcat() {
|
||||
return new TomcatServletWebServerFactory(0);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ResourceConfig resourceConfig() {
|
||||
ResourceConfig resourceConfig() {
|
||||
return new ResourceConfig();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ResourceConfigCustomizer webEndpointRegistrar() {
|
||||
ResourceConfigCustomizer webEndpointRegistrar() {
|
||||
return this::customize;
|
||||
}
|
||||
|
||||
@@ -261,12 +261,12 @@ class WebEndpointTestInvocationContextProvider implements TestTemplateInvocation
|
||||
}
|
||||
|
||||
@Bean
|
||||
public NettyReactiveWebServerFactory netty() {
|
||||
NettyReactiveWebServerFactory netty() {
|
||||
return new NettyReactiveWebServerFactory(0);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public PortHolder portHolder() {
|
||||
PortHolder portHolder() {
|
||||
return this.portHolder;
|
||||
}
|
||||
|
||||
@@ -276,12 +276,12 @@ class WebEndpointTestInvocationContextProvider implements TestTemplateInvocation
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HttpHandler httpHandler(ApplicationContext applicationContext) {
|
||||
HttpHandler httpHandler(ApplicationContext applicationContext) {
|
||||
return WebHttpHandlerBuilder.applicationContext(applicationContext).build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public WebFluxEndpointHandlerMapping webEndpointReactiveHandlerMapping() {
|
||||
WebFluxEndpointHandlerMapping webEndpointReactiveHandlerMapping() {
|
||||
List<String> mediaTypes = Arrays.asList(MediaType.APPLICATION_JSON_VALUE, ActuatorMediaType.V2_JSON);
|
||||
EndpointMediaTypes endpointMediaTypes = new EndpointMediaTypes(mediaTypes, mediaTypes);
|
||||
WebEndpointDiscoverer discoverer = new WebEndpointDiscoverer(this.applicationContext,
|
||||
@@ -305,12 +305,12 @@ class WebEndpointTestInvocationContextProvider implements TestTemplateInvocation
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TomcatServletWebServerFactory tomcat() {
|
||||
TomcatServletWebServerFactory tomcat() {
|
||||
return new TomcatServletWebServerFactory(0);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public WebMvcEndpointHandlerMapping webEndpointServletHandlerMapping() {
|
||||
WebMvcEndpointHandlerMapping webEndpointServletHandlerMapping() {
|
||||
List<String> mediaTypes = Arrays.asList(MediaType.APPLICATION_JSON_VALUE, ActuatorMediaType.V2_JSON);
|
||||
EndpointMediaTypes endpointMediaTypes = new EndpointMediaTypes(mediaTypes, mediaTypes);
|
||||
WebEndpointDiscoverer discoverer = new WebEndpointDiscoverer(this.applicationContext,
|
||||
|
||||
@@ -285,7 +285,7 @@ class EnvironmentEndpointTests {
|
||||
static class Config {
|
||||
|
||||
@Bean
|
||||
public EnvironmentEndpoint environmentEndpoint(Environment environment) {
|
||||
EnvironmentEndpoint environmentEndpoint(Environment environment) {
|
||||
return new EnvironmentEndpoint(environment);
|
||||
}
|
||||
|
||||
|
||||
@@ -128,12 +128,12 @@ class EnvironmentEndpointWebIntegrationTests {
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public EnvironmentEndpoint endpoint(Environment environment) {
|
||||
EnvironmentEndpoint endpoint(Environment environment) {
|
||||
return new EnvironmentEndpoint(environment);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public EnvironmentEndpointWebExtension environmentEndpointWebExtension(EnvironmentEndpoint endpoint) {
|
||||
EnvironmentEndpointWebExtension environmentEndpointWebExtension(EnvironmentEndpoint endpoint) {
|
||||
return new EnvironmentEndpointWebExtension(endpoint);
|
||||
}
|
||||
|
||||
|
||||
@@ -141,16 +141,16 @@ class HealthEndpointWebIntegrationTests {
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public static class TestConfiguration {
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public HealthIndicatorRegistry healthIndicatorFactory(Map<String, HealthIndicator> healthIndicators) {
|
||||
HealthIndicatorRegistry healthIndicatorFactory(Map<String, HealthIndicator> healthIndicators) {
|
||||
return new HealthIndicatorRegistryFactory().createHealthIndicatorRegistry(healthIndicators);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnWebApplication(type = Type.REACTIVE)
|
||||
public ReactiveHealthIndicatorRegistry reactiveHealthIndicatorRegistry(
|
||||
ReactiveHealthIndicatorRegistry reactiveHealthIndicatorRegistry(
|
||||
Map<String, ReactiveHealthIndicator> reactiveHealthIndicators,
|
||||
Map<String, HealthIndicator> healthIndicators) {
|
||||
return new ReactiveHealthIndicatorRegistryFactory()
|
||||
@@ -158,21 +158,21 @@ class HealthEndpointWebIntegrationTests {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HealthEndpoint healthEndpoint(HealthIndicatorRegistry registry) {
|
||||
HealthEndpoint healthEndpoint(HealthIndicatorRegistry registry) {
|
||||
return new HealthEndpoint(new CompositeHealthIndicator(new OrderedHealthAggregator(), registry));
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnWebApplication(type = Type.SERVLET)
|
||||
public HealthEndpointWebExtension healthWebEndpointExtension(HealthEndpoint healthEndpoint) {
|
||||
HealthEndpointWebExtension healthWebEndpointExtension(HealthEndpoint healthEndpoint) {
|
||||
return new HealthEndpointWebExtension(healthEndpoint, new HealthWebEndpointResponseMapper(
|
||||
new HealthStatusHttpMapper(), ShowDetails.ALWAYS, new HashSet<>(Arrays.asList("ACTUATOR"))));
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnWebApplication(type = Type.REACTIVE)
|
||||
public ReactiveHealthEndpointWebExtension reactiveHealthWebEndpointExtension(
|
||||
ReactiveHealthIndicatorRegistry registry, HealthEndpoint healthEndpoint) {
|
||||
ReactiveHealthEndpointWebExtension reactiveHealthWebEndpointExtension(ReactiveHealthIndicatorRegistry registry,
|
||||
HealthEndpoint healthEndpoint) {
|
||||
return new ReactiveHealthEndpointWebExtension(
|
||||
new CompositeReactiveHealthIndicator(new OrderedHealthAggregator(), registry),
|
||||
new HealthWebEndpointResponseMapper(new HealthStatusHttpMapper(), ShowDetails.ALWAYS,
|
||||
@@ -180,12 +180,12 @@ class HealthEndpointWebIntegrationTests {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HealthIndicator alphaHealthIndicator() {
|
||||
HealthIndicator alphaHealthIndicator() {
|
||||
return () -> Health.up().build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HealthIndicator bravoHealthIndicator() {
|
||||
HealthIndicator bravoHealthIndicator() {
|
||||
return () -> Health.up().build();
|
||||
}
|
||||
|
||||
|
||||
@@ -47,15 +47,15 @@ class InfoEndpointWebIntegrationTests {
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public static class TestConfiguration {
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public InfoEndpoint endpoint(ObjectProvider<InfoContributor> infoContributors) {
|
||||
InfoEndpoint endpoint(ObjectProvider<InfoContributor> infoContributors) {
|
||||
return new InfoEndpoint(infoContributors.orderedStream().collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
@Bean
|
||||
public InfoContributor beanName1() {
|
||||
InfoContributor beanName1() {
|
||||
return (builder) -> {
|
||||
Map<String, Object> content = new LinkedHashMap<>();
|
||||
content.put("key11", "value11");
|
||||
@@ -65,7 +65,7 @@ class InfoEndpointWebIntegrationTests {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public InfoContributor beanName2() {
|
||||
InfoContributor beanName2() {
|
||||
return (builder) -> {
|
||||
Map<String, Object> content = new LinkedHashMap<>();
|
||||
content.put("key21", "value21");
|
||||
|
||||
@@ -48,15 +48,15 @@ class IntegrationGraphEndpointWebIntegrationTests {
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableIntegration
|
||||
public static class TestConfiguration {
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public IntegrationGraphEndpoint endpoint(IntegrationGraphServer integrationGraphServer) {
|
||||
IntegrationGraphEndpoint endpoint(IntegrationGraphServer integrationGraphServer) {
|
||||
return new IntegrationGraphEndpoint(integrationGraphServer);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public IntegrationGraphServer integrationGraphServer() {
|
||||
IntegrationGraphServer integrationGraphServer() {
|
||||
return new IntegrationGraphServer();
|
||||
}
|
||||
|
||||
|
||||
@@ -99,10 +99,10 @@ class LiquibaseEndpointTests {
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public static class Config {
|
||||
static class Config {
|
||||
|
||||
@Bean
|
||||
public LiquibaseEndpoint endpoint(ApplicationContext context) {
|
||||
LiquibaseEndpoint endpoint(ApplicationContext context) {
|
||||
return new LiquibaseEndpoint(context);
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ class LogFileWebEndpointWebIntegrationTests {
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public LogFileWebEndpoint logFileEndpoint(Environment environment) {
|
||||
LogFileWebEndpoint logFileEndpoint(Environment environment) {
|
||||
return new LogFileWebEndpoint(environment);
|
||||
}
|
||||
|
||||
|
||||
@@ -150,12 +150,12 @@ class LoggersEndpointWebIntegrationTests {
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public LoggingSystem loggingSystem() {
|
||||
LoggingSystem loggingSystem() {
|
||||
return mock(LoggingSystem.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public LoggersEndpoint endpoint(LoggingSystem loggingSystem) {
|
||||
LoggersEndpoint endpoint(LoggingSystem loggingSystem) {
|
||||
return new LoggersEndpoint(loggingSystem);
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ class MailHealthIndicatorTests {
|
||||
assertThat(errorMessage.toString().contains("A test exception")).isTrue();
|
||||
}
|
||||
|
||||
public static class SuccessTransport extends Transport {
|
||||
static class SuccessTransport extends Transport {
|
||||
|
||||
SuccessTransport(Session session, URLName urlName) {
|
||||
super(session, urlName);
|
||||
|
||||
@@ -72,16 +72,16 @@ class HeapDumpWebEndpointWebIntegrationTests {
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public static class TestConfiguration {
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public HeapDumpWebEndpoint endpoint() {
|
||||
HeapDumpWebEndpoint endpoint() {
|
||||
return new TestHeapDumpWebEndpoint();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class TestHeapDumpWebEndpoint extends HeapDumpWebEndpoint {
|
||||
static class TestHeapDumpWebEndpoint extends HeapDumpWebEndpoint {
|
||||
|
||||
private boolean available;
|
||||
|
||||
@@ -94,7 +94,7 @@ class HeapDumpWebEndpointWebIntegrationTests {
|
||||
reset();
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
void reset() {
|
||||
this.available = true;
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ class HeapDumpWebEndpointWebIntegrationTests {
|
||||
};
|
||||
}
|
||||
|
||||
public void setAvailable(boolean available) {
|
||||
void setAvailable(boolean available) {
|
||||
this.available = available;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,17 +71,17 @@ class MetricsEndpointWebIntegrationTests {
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public MeterRegistry registry() {
|
||||
MeterRegistry registry() {
|
||||
return registry;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MetricsEndpoint metricsEndpoint(MeterRegistry meterRegistry) {
|
||||
MetricsEndpoint metricsEndpoint(MeterRegistry meterRegistry) {
|
||||
return new MetricsEndpoint(meterRegistry);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public JvmMemoryMetrics jvmMemoryMetrics(MeterRegistry meterRegistry) {
|
||||
JvmMemoryMetrics jvmMemoryMetrics(MeterRegistry meterRegistry) {
|
||||
JvmMemoryMetrics memoryMetrics = new JvmMemoryMetrics();
|
||||
memoryMetrics.bindTo(meterRegistry);
|
||||
return memoryMetrics;
|
||||
|
||||
@@ -45,17 +45,17 @@ class PrometheusScrapeEndpointIntegrationTests {
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public PrometheusScrapeEndpoint prometheusScrapeEndpoint(CollectorRegistry collectorRegistry) {
|
||||
PrometheusScrapeEndpoint prometheusScrapeEndpoint(CollectorRegistry collectorRegistry) {
|
||||
return new PrometheusScrapeEndpoint(collectorRegistry);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CollectorRegistry collectorRegistry() {
|
||||
CollectorRegistry collectorRegistry() {
|
||||
return new CollectorRegistry(true);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MeterRegistry registry(CollectorRegistry registry) {
|
||||
MeterRegistry registry(CollectorRegistry registry) {
|
||||
return new PrometheusMeterRegistry((k) -> null, registry, Clock.SYSTEM);
|
||||
}
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ class LongTaskTimingHandlerInterceptorTests {
|
||||
@Timed
|
||||
@Timed(value = "my.long.request", extraTags = { "region", "test" }, longTask = true)
|
||||
@GetMapping("/callable/{id}")
|
||||
public Callable<String> asyncCallable(@PathVariable Long id) throws Exception {
|
||||
Callable<String> asyncCallable(@PathVariable Long id) throws Exception {
|
||||
this.callableBarrier.await();
|
||||
return () -> {
|
||||
try {
|
||||
|
||||
@@ -99,7 +99,7 @@ class WebMvcMetricsFilterAutoTimedTests {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public WebMvcMetricsFilter webMetricsFilter(WebApplicationContext context, MeterRegistry registry) {
|
||||
WebMvcMetricsFilter webMetricsFilter(WebApplicationContext context, MeterRegistry registry) {
|
||||
return new WebMvcMetricsFilter(registry, new DefaultWebMvcTagsProvider(), "http.server.requests",
|
||||
(builder) -> builder.publishPercentiles(0.5, 0.95).publishPercentileHistogram(true));
|
||||
}
|
||||
@@ -111,7 +111,7 @@ class WebMvcMetricsFilterAutoTimedTests {
|
||||
static class Controller {
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public String successful(@PathVariable Long id) {
|
||||
String successful(@PathVariable Long id) {
|
||||
return id.toString();
|
||||
}
|
||||
|
||||
|
||||
@@ -291,7 +291,7 @@ class WebMvcMetricsFilterTests {
|
||||
@Target({ ElementType.METHOD })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Timed(percentiles = 0.95)
|
||||
public @interface Timed95 {
|
||||
@interface Timed95 {
|
||||
|
||||
}
|
||||
|
||||
@@ -375,14 +375,14 @@ class WebMvcMetricsFilterTests {
|
||||
|
||||
@Timed(extraTags = { "public", "true" })
|
||||
@GetMapping("/{id}")
|
||||
public String successfulWithExtraTags(@PathVariable Long id) {
|
||||
String successfulWithExtraTags(@PathVariable Long id) {
|
||||
return id.toString();
|
||||
}
|
||||
|
||||
@Timed
|
||||
@Timed(value = "my.long.request", extraTags = { "region", "test" }, longTask = true)
|
||||
@GetMapping("/callable/{id}")
|
||||
public Callable<String> asyncCallable(@PathVariable Long id) throws Exception {
|
||||
Callable<String> asyncCallable(@PathVariable Long id) throws Exception {
|
||||
this.callableBarrier.await();
|
||||
return () -> {
|
||||
try {
|
||||
@@ -420,31 +420,31 @@ class WebMvcMetricsFilterTests {
|
||||
}
|
||||
|
||||
@GetMapping("/untimed/{id}")
|
||||
public String successfulButUntimed(@PathVariable Long id) {
|
||||
String successfulButUntimed(@PathVariable Long id) {
|
||||
return id.toString();
|
||||
}
|
||||
|
||||
@Timed
|
||||
@GetMapping("/error/{id}")
|
||||
public String alwaysThrowsException(@PathVariable Long id) {
|
||||
String alwaysThrowsException(@PathVariable Long id) {
|
||||
throw new IllegalStateException("Boom on " + id + "!");
|
||||
}
|
||||
|
||||
@Timed
|
||||
@GetMapping("/anonymousError/{id}")
|
||||
public String alwaysThrowsAnonymousException(@PathVariable Long id) throws Exception {
|
||||
String alwaysThrowsAnonymousException(@PathVariable Long id) throws Exception {
|
||||
throw new Exception("this exception won't have a simple class name") {
|
||||
};
|
||||
}
|
||||
|
||||
@Timed
|
||||
@GetMapping("/unhandledError/{id}")
|
||||
public String alwaysThrowsUnhandledException(@PathVariable Long id) {
|
||||
String alwaysThrowsUnhandledException(@PathVariable Long id) {
|
||||
throw new RuntimeException("Boom on " + id + "!");
|
||||
}
|
||||
|
||||
@GetMapping("/streamingError")
|
||||
public ResponseBodyEmitter streamingError() {
|
||||
ResponseBodyEmitter streamingError() {
|
||||
ResponseBodyEmitter emitter = new ResponseBodyEmitter();
|
||||
emitter.completeWithError(new IOException("error while writing to the response"));
|
||||
return emitter;
|
||||
@@ -452,25 +452,25 @@ class WebMvcMetricsFilterTests {
|
||||
|
||||
@Timed
|
||||
@GetMapping("/regex/{id:\\.[a-z]+}")
|
||||
public String successfulRegex(@PathVariable String id) {
|
||||
String successfulRegex(@PathVariable String id) {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Timed(percentiles = { 0.50, 0.95 })
|
||||
@GetMapping("/percentiles/{id}")
|
||||
public String percentiles(@PathVariable String id) {
|
||||
String percentiles(@PathVariable String id) {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Timed(histogram = true)
|
||||
@GetMapping("/histogram/{id}")
|
||||
public String histogram(@PathVariable String id) {
|
||||
String histogram(@PathVariable String id) {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Timed95
|
||||
@GetMapping("/metaTimed/{id}")
|
||||
public String meta(@PathVariable String id) {
|
||||
String meta(@PathVariable String id) {
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -488,7 +488,7 @@ class WebMvcMetricsFilterTests {
|
||||
static class Controller2 {
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public String successful(@PathVariable Long id) {
|
||||
String successful(@PathVariable Long id) {
|
||||
return id.toString();
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ class WebMvcMetricsIntegrationTests {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public WebMvcMetricsFilter webMetricsFilter(MeterRegistry registry, WebApplicationContext ctx) {
|
||||
WebMvcMetricsFilter webMetricsFilter(MeterRegistry registry, WebApplicationContext ctx) {
|
||||
return new WebMvcMetricsFilter(registry, new DefaultWebMvcTagsProvider(), "http.server.requests",
|
||||
AutoTimer.ENABLED);
|
||||
}
|
||||
@@ -117,17 +117,17 @@ class WebMvcMetricsIntegrationTests {
|
||||
static class Controller1 {
|
||||
|
||||
@Bean
|
||||
public CustomExceptionHandler controllerAdvice() {
|
||||
CustomExceptionHandler controllerAdvice() {
|
||||
return new CustomExceptionHandler();
|
||||
}
|
||||
|
||||
@GetMapping("/handledError")
|
||||
public String handledError() {
|
||||
String handledError() {
|
||||
throw new Exception1();
|
||||
}
|
||||
|
||||
@GetMapping("/rethrownError")
|
||||
public String rethrownError() {
|
||||
String rethrownError() {
|
||||
throw new Exception2();
|
||||
}
|
||||
|
||||
|
||||
@@ -159,40 +159,40 @@ class ScheduledTasksEndpointTests {
|
||||
static class BaseConfiguration {
|
||||
|
||||
@Bean
|
||||
public ScheduledTasksEndpoint endpoint(Collection<ScheduledTaskHolder> scheduledTaskHolders) {
|
||||
ScheduledTasksEndpoint endpoint(Collection<ScheduledTaskHolder> scheduledTaskHolders) {
|
||||
return new ScheduledTasksEndpoint(scheduledTaskHolders);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class FixedDelayScheduledMethod {
|
||||
static class FixedDelayScheduledMethod {
|
||||
|
||||
@Scheduled(fixedDelay = 1, initialDelay = 2)
|
||||
public void fixedDelay() {
|
||||
void fixedDelay() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class FixedRateScheduledMethod {
|
||||
static class FixedRateScheduledMethod {
|
||||
|
||||
@Scheduled(fixedRate = 3, initialDelay = 4)
|
||||
public void fixedRate() {
|
||||
void fixedRate() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class CronScheduledMethod {
|
||||
static class CronScheduledMethod {
|
||||
|
||||
@Scheduled(cron = "0 0 0/3 1/1 * ?")
|
||||
public void cron() {
|
||||
void cron() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class FixedDelayTriggerTask implements SchedulingConfigurer {
|
||||
static class FixedDelayTriggerTask implements SchedulingConfigurer {
|
||||
|
||||
@Override
|
||||
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
|
||||
@@ -203,7 +203,7 @@ class ScheduledTasksEndpointTests {
|
||||
|
||||
}
|
||||
|
||||
private static class FixedRateTriggerTask implements SchedulingConfigurer {
|
||||
static class FixedRateTriggerTask implements SchedulingConfigurer {
|
||||
|
||||
@Override
|
||||
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
|
||||
@@ -215,7 +215,7 @@ class ScheduledTasksEndpointTests {
|
||||
|
||||
}
|
||||
|
||||
private static class CronTriggerTask implements SchedulingConfigurer {
|
||||
static class CronTriggerTask implements SchedulingConfigurer {
|
||||
|
||||
@Override
|
||||
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
|
||||
@@ -224,7 +224,7 @@ class ScheduledTasksEndpointTests {
|
||||
|
||||
}
|
||||
|
||||
private static class CustomTriggerTask implements SchedulingConfigurer {
|
||||
static class CustomTriggerTask implements SchedulingConfigurer {
|
||||
|
||||
private static final Trigger trigger = (context) -> new Date();
|
||||
|
||||
@@ -235,7 +235,7 @@ class ScheduledTasksEndpointTests {
|
||||
|
||||
}
|
||||
|
||||
private static class CronTriggerRunnable implements Runnable {
|
||||
static class CronTriggerRunnable implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -244,7 +244,7 @@ class ScheduledTasksEndpointTests {
|
||||
|
||||
}
|
||||
|
||||
private static class FixedDelayTriggerRunnable implements Runnable {
|
||||
static class FixedDelayTriggerRunnable implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -253,7 +253,7 @@ class ScheduledTasksEndpointTests {
|
||||
|
||||
}
|
||||
|
||||
private static class FixedRateTriggerRunnable implements Runnable {
|
||||
static class FixedRateTriggerRunnable implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -262,7 +262,7 @@ class ScheduledTasksEndpointTests {
|
||||
|
||||
}
|
||||
|
||||
private static class CustomTriggerRunnable implements Runnable {
|
||||
static class CustomTriggerRunnable implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -73,10 +73,10 @@ class SessionsEndpointWebIntegrationTests {
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
protected static class TestConfiguration {
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public SessionsEndpoint sessionsEndpoint() {
|
||||
SessionsEndpoint sessionsEndpoint() {
|
||||
return new SessionsEndpoint(repository);
|
||||
}
|
||||
|
||||
|
||||
@@ -309,7 +309,7 @@ class HttpExchangeTracerTests {
|
||||
return output.toString();
|
||||
}
|
||||
|
||||
private static class RequestHeadersFilterHttpExchangeTracer extends HttpExchangeTracer {
|
||||
static class RequestHeadersFilterHttpExchangeTracer extends HttpExchangeTracer {
|
||||
|
||||
RequestHeadersFilterHttpExchangeTracer() {
|
||||
super(EnumSet.of(Include.REQUEST_HEADERS));
|
||||
|
||||
@@ -92,23 +92,23 @@ class HttpTraceWebFilterIntegrationTests {
|
||||
static class Config {
|
||||
|
||||
@Bean
|
||||
public HttpTraceWebFilter httpTraceWebFilter(HttpTraceRepository repository) {
|
||||
HttpTraceWebFilter httpTraceWebFilter(HttpTraceRepository repository) {
|
||||
Set<Include> includes = EnumSet.allOf(Include.class);
|
||||
return new HttpTraceWebFilter(repository, new HttpExchangeTracer(includes), includes);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HttpTraceRepository httpTraceRepository() {
|
||||
HttpTraceRepository httpTraceRepository() {
|
||||
return new InMemoryHttpTraceRepository();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HttpHandler httpHandler(ApplicationContext applicationContext) {
|
||||
HttpHandler httpHandler(ApplicationContext applicationContext) {
|
||||
return WebHttpHandlerBuilder.applicationContext(applicationContext).build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RouterFunction<ServerResponse> router() {
|
||||
RouterFunction<ServerResponse> router() {
|
||||
return route(GET("/mono-error"), (request) -> Mono.error(new RuntimeException())).andRoute(GET("/thrown"),
|
||||
(HandlerFunction<ServerResponse>) (request) -> {
|
||||
throw new RuntimeException();
|
||||
|
||||
@@ -158,7 +158,7 @@ class MappingsEndpointTests {
|
||||
static class EndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public MappingsEndpoint mappingsEndpoint(Collection<MappingDescriptionProvider> descriptionProviders,
|
||||
MappingsEndpoint mappingsEndpoint(Collection<MappingDescriptionProvider> descriptionProviders,
|
||||
ApplicationContext context) {
|
||||
return new MappingsEndpoint(descriptionProviders, context);
|
||||
}
|
||||
@@ -171,18 +171,18 @@ class MappingsEndpointTests {
|
||||
static class ReactiveWebConfiguration {
|
||||
|
||||
@Bean
|
||||
public DispatcherHandlersMappingDescriptionProvider dispatcherHandlersMappingDescriptionProvider() {
|
||||
DispatcherHandlersMappingDescriptionProvider dispatcherHandlersMappingDescriptionProvider() {
|
||||
return new DispatcherHandlersMappingDescriptionProvider();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RouterFunction<ServerResponse> routerFunction() {
|
||||
RouterFunction<ServerResponse> routerFunction() {
|
||||
return route(GET("/one"), (request) -> ServerResponse.ok().build()).andRoute(POST("/two"),
|
||||
(request) -> ServerResponse.ok().build());
|
||||
}
|
||||
|
||||
@RequestMapping("/three")
|
||||
public void three() {
|
||||
void three() {
|
||||
|
||||
}
|
||||
|
||||
@@ -194,29 +194,29 @@ class MappingsEndpointTests {
|
||||
static class ServletWebConfiguration {
|
||||
|
||||
@Bean
|
||||
public DispatcherServletsMappingDescriptionProvider dispatcherServletsMappingDescriptionProvider() {
|
||||
DispatcherServletsMappingDescriptionProvider dispatcherServletsMappingDescriptionProvider() {
|
||||
return new DispatcherServletsMappingDescriptionProvider();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ServletsMappingDescriptionProvider servletsMappingDescriptionProvider() {
|
||||
ServletsMappingDescriptionProvider servletsMappingDescriptionProvider() {
|
||||
return new ServletsMappingDescriptionProvider();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public FiltersMappingDescriptionProvider filtersMappingDescriptionProvider() {
|
||||
FiltersMappingDescriptionProvider filtersMappingDescriptionProvider() {
|
||||
return new FiltersMappingDescriptionProvider();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DispatcherServlet dispatcherServlet(WebApplicationContext context) throws ServletException {
|
||||
DispatcherServlet dispatcherServlet(WebApplicationContext context) throws ServletException {
|
||||
DispatcherServlet dispatcherServlet = new DispatcherServlet(context);
|
||||
dispatcherServlet.init(new MockServletConfig());
|
||||
return dispatcherServlet;
|
||||
}
|
||||
|
||||
@RequestMapping("/three")
|
||||
public void three() {
|
||||
void three() {
|
||||
|
||||
}
|
||||
|
||||
@@ -226,8 +226,7 @@ class MappingsEndpointTests {
|
||||
static class CustomDispatcherServletConfiguration {
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean<DispatcherServlet> customDispatcherServletRegistration(
|
||||
WebApplicationContext context) {
|
||||
ServletRegistrationBean<DispatcherServlet> customDispatcherServletRegistration(WebApplicationContext context) {
|
||||
ServletRegistrationBean<DispatcherServlet> registration = new ServletRegistrationBean<>(
|
||||
createTestDispatcherServlet(context));
|
||||
registration.setName("customDispatcherServletRegistration");
|
||||
@@ -235,12 +234,12 @@ class MappingsEndpointTests {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DispatcherServlet anotherDispatcherServlet(WebApplicationContext context) {
|
||||
DispatcherServlet anotherDispatcherServlet(WebApplicationContext context) {
|
||||
return createTestDispatcherServlet(context);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean<DispatcherServlet> anotherDispatcherServletRegistration(
|
||||
ServletRegistrationBean<DispatcherServlet> anotherDispatcherServletRegistration(
|
||||
DispatcherServlet dispatcherServlet, WebApplicationContext context) {
|
||||
ServletRegistrationBean<DispatcherServlet> registrationBean = new ServletRegistrationBean<>(
|
||||
anotherDispatcherServlet(context));
|
||||
|
||||
Reference in New Issue
Block a user