Remove code deprecated in 2.1

See gh-16013
pull/16053/head
Mehmed Baždar 6 years ago committed by Stephane Nicoll
parent 5e4418973e
commit 246111cd84

@ -41,17 +41,6 @@ public interface PathMapper {
*/ */
String getRootPath(EndpointId endpointId); String getRootPath(EndpointId endpointId);
/**
* Returns an {@link PathMapper} that uses the endpoint ID as the path.
* @return an {@link PathMapper} that uses the lowercase endpoint ID as the path
* @deprecated since 2.1.0 in favor of {@link #getRootPath(List, EndpointId)} with a
* {@code null} list
*/
@Deprecated
static PathMapper useEndpointId() {
return EndpointId::toString;
}
/** /**
* Resolve the root path for the specified {@code endpointId} from the given path * Resolve the root path for the specified {@code endpointId} from the given path
* mappers. If no mapper matches then the ID itself is returned. * mappers. If no mapper matches then the ID itself is returned.

@ -33,17 +33,6 @@ public class CompositeHealthIndicator implements HealthIndicator {
private final HealthAggregator aggregator; private final HealthAggregator aggregator;
/**
* Create a new {@link CompositeHealthIndicator}.
* @param healthAggregator the health aggregator
* @deprecated since 2.1.0 in favor of
* {@link #CompositeHealthIndicator(HealthAggregator, HealthIndicatorRegistry)}
*/
@Deprecated
public CompositeHealthIndicator(HealthAggregator healthAggregator) {
this(healthAggregator, new DefaultHealthIndicatorRegistry());
}
/** /**
* Create a new {@link CompositeHealthIndicator} from the specified indicators. * Create a new {@link CompositeHealthIndicator} from the specified indicators.
* @param healthAggregator the health aggregator * @param healthAggregator the health aggregator
@ -67,20 +56,6 @@ public class CompositeHealthIndicator implements HealthIndicator {
this.registry = registry; this.registry = registry;
} }
/**
* Adds the given {@code healthIndicator}, associating it with the given {@code name}.
* @param name the name of the indicator
* @param indicator the indicator
* @throws IllegalStateException if an indicator with the given {@code name} is
* already registered.
* @deprecated since 2.1.0 in favor of
* {@link HealthIndicatorRegistry#register(String, HealthIndicator)}
*/
@Deprecated
public void addHealthIndicator(String name, HealthIndicator indicator) {
this.registry.register(name, indicator);
}
/** /**
* Return the {@link HealthIndicatorRegistry} of this instance. * Return the {@link HealthIndicatorRegistry} of this instance.
* @return the registry of nested {@link HealthIndicator health indicators} * @return the registry of nested {@link HealthIndicator health indicators}

@ -1,64 +0,0 @@
/*
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://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.health;
import java.util.Map;
import java.util.function.Function;
import org.springframework.util.Assert;
/**
* Factory to create a {@link CompositeHealthIndicator}.
*
* @author Stephane Nicoll
* @since 2.0.0
* @deprecated since 2.1.0 in favor of
* {@link CompositeHealthIndicator#CompositeHealthIndicator(HealthAggregator, HealthIndicatorRegistry)}
*/
@Deprecated
public class CompositeHealthIndicatorFactory {
private final Function<String, String> healthIndicatorNameFactory;
public CompositeHealthIndicatorFactory() {
this(new HealthIndicatorNameFactory());
}
public CompositeHealthIndicatorFactory(
Function<String, String> healthIndicatorNameFactory) {
this.healthIndicatorNameFactory = healthIndicatorNameFactory;
}
/**
* Create a {@link CompositeHealthIndicator} based on the specified health indicators.
* @param healthAggregator the {@link HealthAggregator}
* @param healthIndicators the {@link HealthIndicator} instances mapped by name
* @return a {@link HealthIndicator} that delegates to the specified
* {@code healthIndicators}.
*/
public CompositeHealthIndicator createHealthIndicator(
HealthAggregator healthAggregator,
Map<String, HealthIndicator> healthIndicators) {
Assert.notNull(healthAggregator, "HealthAggregator must not be null");
Assert.notNull(healthIndicators, "HealthIndicators must not be null");
HealthIndicatorRegistryFactory factory = new HealthIndicatorRegistryFactory(
this.healthIndicatorNameFactory);
return new CompositeHealthIndicator(healthAggregator,
factory.createHealthIndicatorRegistry(healthIndicators));
}
}

@ -45,32 +45,6 @@ public class CompositeReactiveHealthIndicator implements ReactiveHealthIndicator
private final Function<Mono<Health>, Mono<Health>> timeoutCompose; private final Function<Mono<Health>, Mono<Health>> timeoutCompose;
/**
* Create a new {@link CompositeReactiveHealthIndicator}.
* @param healthAggregator the health aggregator
* @deprecated since 2.1.0 in favor of
* {@link #CompositeReactiveHealthIndicator(HealthAggregator, ReactiveHealthIndicatorRegistry)}
*/
@Deprecated
public CompositeReactiveHealthIndicator(HealthAggregator healthAggregator) {
this(healthAggregator, new LinkedHashMap<>());
}
/**
* Create a new {@link CompositeReactiveHealthIndicator} from the specified
* indicators.
* @param healthAggregator the health aggregator
* @param indicators a map of {@link ReactiveHealthIndicator HealthIndicators} with
* the key being used as an indicator name.
* @deprecated since 2.1.0 in favor of
* {@link #CompositeReactiveHealthIndicator(HealthAggregator, ReactiveHealthIndicatorRegistry)}
*/
@Deprecated
public CompositeReactiveHealthIndicator(HealthAggregator healthAggregator,
Map<String, ReactiveHealthIndicator> indicators) {
this(healthAggregator, new DefaultReactiveHealthIndicatorRegistry(indicators));
}
/** /**
* Create a new {@link CompositeReactiveHealthIndicator} from the indicators in the * Create a new {@link CompositeReactiveHealthIndicator} from the indicators in the
@ -86,23 +60,6 @@ public class CompositeReactiveHealthIndicator implements ReactiveHealthIndicator
Duration.ofMillis(this.timeout), Mono.just(this.timeoutHealth)) : mono; Duration.ofMillis(this.timeout), Mono.just(this.timeoutHealth)) : mono;
} }
/**
* Add a {@link ReactiveHealthIndicator} with the specified name.
* @param name the name of the health indicator
* @param indicator the health indicator to add
* @return this instance
* @throws IllegalStateException if an indicator with the given {@code name} is
* already registered.
* @deprecated since 2.1.0 in favor of
* {@link ReactiveHealthIndicatorRegistry#register(String, ReactiveHealthIndicator)}
*/
@Deprecated
public CompositeReactiveHealthIndicator addHealthIndicator(String name,
ReactiveHealthIndicator indicator) {
this.registry.register(name, indicator);
return this;
}
/** /**
* Specify an alternative timeout {@link Health} if a {@link HealthIndicator} failed * Specify an alternative timeout {@link Health} if a {@link HealthIndicator} failed
* to reply after specified {@code timeout}. * to reply after specified {@code timeout}.

@ -48,20 +48,6 @@ public class MetricsWebFilter implements WebFilter {
private final boolean autoTimeRequests; private final boolean autoTimeRequests;
/**
* Create a new {@code MetricsWebFilter}.
* @param registry the registry to which metrics are recorded
* @param tagsProvider provider for metrics tags
* @param metricName name of the metric to record
* @deprecated since 2.0.6 in favor of
* {@link #MetricsWebFilter(MeterRegistry, WebFluxTagsProvider, String, boolean)}
*/
@Deprecated
public MetricsWebFilter(MeterRegistry registry, WebFluxTagsProvider tagsProvider,
String metricName) {
this(registry, tagsProvider, metricName, true);
}
public MetricsWebFilter(MeterRegistry registry, WebFluxTagsProvider tagsProvider, public MetricsWebFilter(MeterRegistry registry, WebFluxTagsProvider tagsProvider,
String metricName, boolean autoTimeRequests) { String metricName, boolean autoTimeRequests) {
this.registry = registry; this.registry = registry;

@ -61,23 +61,6 @@ public class WebMvcMetricsFilter extends OncePerRequestFilter {
private final boolean autoTimeRequests; private final boolean autoTimeRequests;
/**
* Create a new {@link WebMvcMetricsFilter} instance.
* @param context the source application context
* @param registry the meter registry
* @param tagsProvider the tags provider
* @param metricName the metric name
* @param autoTimeRequests if requests should be automatically timed
* @deprecated since 2.0.7 in favor of
* {@link #WebMvcMetricsFilter(MeterRegistry, WebMvcTagsProvider, String, boolean)}
*/
@Deprecated
public WebMvcMetricsFilter(ApplicationContext context, MeterRegistry registry,
WebMvcTagsProvider tagsProvider, String metricName,
boolean autoTimeRequests) {
this(registry, tagsProvider, metricName, autoTimeRequests);
}
/** /**
* Create a new {@link WebMvcMetricsFilter} instance. * Create a new {@link WebMvcMetricsFilter} instance.
* @param registry the meter registry * @param registry the meter registry

@ -55,18 +55,6 @@ public class DiskSpaceHealthIndicator extends AbstractHealthIndicator {
this.threshold = threshold; this.threshold = threshold;
} }
/**
* Create a new {@code DiskSpaceHealthIndicator} instance.
* @param path the Path used to compute the available disk space
* @param threshold the minimum disk space that should be available (in bytes)
* @deprecated since 2.1.0 in favor of
* {@link #DiskSpaceHealthIndicator(File, DataSize)}
*/
@Deprecated
public DiskSpaceHealthIndicator(File path, long threshold) {
this(path, DataSize.ofBytes(threshold));
}
@Override @Override
protected void doHealthCheck(Health.Builder builder) throws Exception { protected void doHealthCheck(Health.Builder builder) throws Exception {
long diskFreeInBytes = this.path.getUsableSpace(); long diskFreeInBytes = this.path.getUsableSpace();

@ -1,70 +0,0 @@
/*
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://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.health;
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link CompositeHealthIndicatorFactory}.
*
* @author Phillip Webb
* @author Christian Dupuis
* @author Andy Wilkinson
*/
@Deprecated
public class CompositeHealthIndicatorFactoryTests {
@Test
public void upAndUpIsAggregatedToUp() {
Map<String, HealthIndicator> healthIndicators = new HashMap<>();
healthIndicators.put("up", () -> new Health.Builder().status(Status.UP).build());
healthIndicators.put("upAgain",
() -> new Health.Builder().status(Status.UP).build());
HealthIndicator healthIndicator = createHealthIndicator(healthIndicators);
assertThat(healthIndicator.health().getStatus()).isEqualTo(Status.UP);
}
@Test
public void upAndDownIsAggregatedToDown() {
Map<String, HealthIndicator> healthIndicators = new HashMap<>();
healthIndicators.put("up", () -> new Health.Builder().status(Status.UP).build());
healthIndicators.put("down",
() -> new Health.Builder().status(Status.DOWN).build());
HealthIndicator healthIndicator = createHealthIndicator(healthIndicators);
assertThat(healthIndicator.health().getStatus()).isEqualTo(Status.DOWN);
}
@Test
public void unknownStatusMapsToUnknown() {
Map<String, HealthIndicator> healthIndicators = new HashMap<>();
healthIndicators.put("status", () -> new Health.Builder().status("FINE").build());
HealthIndicator healthIndicator = createHealthIndicator(healthIndicators);
assertThat(healthIndicator.health().getStatus()).isEqualTo(Status.UNKNOWN);
}
private HealthIndicator createHealthIndicator(
Map<String, HealthIndicator> healthIndicators) {
return new CompositeHealthIndicatorFactory()
.createHealthIndicator(new OrderedHealthAggregator(), healthIndicators);
}
}

@ -93,23 +93,6 @@ public class JobLauncherCommandLineRunner
private ApplicationEventPublisher publisher; private ApplicationEventPublisher publisher;
/**
* Create a new {@link JobLauncherCommandLineRunner}.
* @param jobLauncher to launch jobs
* @param jobExplorer to check the job repository for previous executions
* @deprecated since 2.0.7 in favor of
* {@link #JobLauncherCommandLineRunner(JobLauncher, JobExplorer, JobRepository)}. A
* job repository is required to check if a job instance exists with the given
* parameters when running a job (which is not possible with the job explorer).
*/
@Deprecated
public JobLauncherCommandLineRunner(JobLauncher jobLauncher,
JobExplorer jobExplorer) {
this.jobLauncher = jobLauncher;
this.jobExplorer = jobExplorer;
this.jobRepository = null;
}
/** /**
* Create a new {@link JobLauncherCommandLineRunner}. * Create a new {@link JobLauncherCommandLineRunner}.
* @param jobLauncher to launch jobs * @param jobLauncher to launch jobs

@ -1,36 +0,0 @@
/*
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://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.autoconfigure.web.servlet;
import org.springframework.web.servlet.DispatcherServlet;
/**
* Interface that provides the paths that the {@link DispatcherServlet} in an application
* context is mapped to.
*
* @author Madhura Bhave
* @since 2.0.2
* @deprecated since 2.0.4 in favor of {@link DispatcherServletPath} and
* {@link DispatcherServletRegistrationBean}
*/
@Deprecated
@FunctionalInterface
public interface DispatcherServletPathProvider {
String getServletPath();
}

@ -370,20 +370,6 @@ public class RestTemplateBuilder {
this.interceptors); this.interceptors);
} }
/**
* Add HTTP basic authentication to requests. See
* {@link BasicAuthenticationInterceptor} for details.
* @param username the user name
* @param password the password
* @return a new builder instance
* @deprecated since 2.1.0 in favor of
* {@link #basicAuthentication(String username, String password)}
*/
@Deprecated
public RestTemplateBuilder basicAuthorization(String username, String password) {
return basicAuthentication(username, password);
}
/** /**
* Add HTTP basic authentication to requests. See * Add HTTP basic authentication to requests. See
* {@link BasicAuthenticationInterceptor} for details. * {@link BasicAuthenticationInterceptor} for details.
@ -486,18 +472,6 @@ public class RestTemplateBuilder {
this.interceptors); this.interceptors);
} }
/**
* Sets the connection timeout in milliseconds on the underlying
* {@link ClientHttpRequestFactory}.
* @param connectTimeout the connection timeout in milliseconds
* @return a new builder instance.
* @deprecated since 2.1.0 in favor of {@link #setConnectTimeout(Duration)}
*/
@Deprecated
public RestTemplateBuilder setConnectTimeout(int connectTimeout) {
return setConnectTimeout(Duration.ofMillis(connectTimeout));
}
/** /**
* Sets the read timeout on the underlying {@link ClientHttpRequestFactory}. * Sets the read timeout on the underlying {@link ClientHttpRequestFactory}.
* @param readTimeout the read timeout * @param readTimeout the read timeout
@ -513,18 +487,6 @@ public class RestTemplateBuilder {
this.interceptors); this.interceptors);
} }
/**
* Sets the read timeout in milliseconds on the underlying
* {@link ClientHttpRequestFactory}.
* @param readTimeout the read timeout in milliseconds
* @return a new builder instance.
* @deprecated since 2.1.0 in favor of {@link #setReadTimeout(Duration)}
*/
@Deprecated
public RestTemplateBuilder setReadTimeout(int readTimeout) {
return setReadTimeout(Duration.ofMillis(readTimeout));
}
/** /**
* Build a new {@link RestTemplate} instance and configure it using this builder. * Build a new {@link RestTemplate} instance and configure it using this builder.
* @return a configured {@link RestTemplate} instance. * @return a configured {@link RestTemplate} instance.

@ -44,14 +44,6 @@ import org.springframework.util.StringUtils;
public abstract class AbstractFilterRegistrationBean<T extends Filter> public abstract class AbstractFilterRegistrationBean<T extends Filter>
extends DynamicRegistrationBean<Dynamic> { extends DynamicRegistrationBean<Dynamic> {
/**
* Filters that wrap the servlet request should be ordered less than or equal to this.
* @deprecated since 2.1.0 in favor of
* {@code OrderedFilter.REQUEST_WRAPPER_FILTER_MAX_ORDER}
*/
@Deprecated
protected static final int REQUEST_WRAPPER_FILTER_MAX_ORDER = 0;
private static final String[] DEFAULT_URL_MAPPINGS = { "/*" }; private static final String[] DEFAULT_URL_MAPPINGS = { "/*" };
private Set<ServletRegistrationBean<?>> servletRegistrationBeans = new LinkedHashSet<>(); private Set<ServletRegistrationBean<?>> servletRegistrationBeans = new LinkedHashSet<>();

@ -43,14 +43,6 @@ import org.springframework.util.Assert;
public class FilterRegistrationBean<T extends Filter> public class FilterRegistrationBean<T extends Filter>
extends AbstractFilterRegistrationBean<T> { extends AbstractFilterRegistrationBean<T> {
/**
* Filters that wrap the servlet request should be ordered less than or equal to this.
* @deprecated since 2.1.0 in favor of
* {@code OrderedFilter.REQUEST_WRAPPER_FILTER_MAX_ORDER}
*/
@Deprecated
public static final int REQUEST_WRAPPER_FILTER_MAX_ORDER = AbstractFilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER;
private T filter; private T filter;
/** /**

@ -54,27 +54,6 @@ public class MultipartConfigFactory {
this.maxFileSize = maxFileSize; this.maxFileSize = maxFileSize;
} }
/**
* Sets the maximum size in bytes allowed for uploaded files.
* @param maxFileSize the maximum file size
* @deprecated since 2.1.0 in favor of {@link #setMaxFileSize(DataSize)}
*/
@Deprecated
public void setMaxFileSize(long maxFileSize) {
setMaxFileSize(DataSize.ofBytes(maxFileSize));
}
/**
* Sets the maximum size allowed for uploaded files. Values can use the suffixed "MB"
* or "KB" to indicate a Megabyte or Kilobyte size.
* @param maxFileSize the maximum file size
* @deprecated since 2.1.0 in favor of {@link #setMaxFileSize(DataSize)}
*/
@Deprecated
public void setMaxFileSize(String maxFileSize) {
setMaxFileSize(DataSize.parse(maxFileSize));
}
/** /**
* Sets the maximum {@link DataSize} allowed for multipart/form-data requests. * Sets the maximum {@link DataSize} allowed for multipart/form-data requests.
* @param maxRequestSize the maximum request size * @param maxRequestSize the maximum request size
@ -83,27 +62,6 @@ public class MultipartConfigFactory {
this.maxRequestSize = maxRequestSize; this.maxRequestSize = maxRequestSize;
} }
/**
* Sets the maximum size allowed in bytes for multipart/form-data requests.
* @param maxRequestSize the maximum request size
* @deprecated since 2.1.0 in favor of {@link #setMaxRequestSize(DataSize)}
*/
@Deprecated
public void setMaxRequestSize(long maxRequestSize) {
setMaxRequestSize(DataSize.ofBytes(maxRequestSize));
}
/**
* Sets the maximum size allowed for multipart/form-data requests. Values can use the
* suffixed "MB" or "KB" to indicate a Megabyte or Kilobyte size.
* @param maxRequestSize the maximum request size
* @deprecated since 2.1.0 in favor of {@link #setMaxRequestSize(DataSize)}
*/
@Deprecated
public void setMaxRequestSize(String maxRequestSize) {
setMaxRequestSize(DataSize.parse(maxRequestSize));
}
/** /**
* Sets the {@link DataSize size} threshold after which files will be written to disk. * Sets the {@link DataSize size} threshold after which files will be written to disk.
* @param fileSizeThreshold the file size threshold * @param fileSizeThreshold the file size threshold
@ -112,27 +70,6 @@ public class MultipartConfigFactory {
this.fileSizeThreshold = fileSizeThreshold; this.fileSizeThreshold = fileSizeThreshold;
} }
/**
* Sets the size threshold in bytes after which files will be written to disk.
* @param fileSizeThreshold the file size threshold
* @deprecated since 2.1.0 in favor of {@link #setFileSizeThreshold(DataSize)}
*/
@Deprecated
public void setFileSizeThreshold(int fileSizeThreshold) {
setFileSizeThreshold(DataSize.ofBytes(fileSizeThreshold));
}
/**
* Sets the size threshold after which files will be written to disk. Values can use
* the suffixed "MB" or "KB" to indicate a Megabyte or Kilobyte size.
* @param fileSizeThreshold the file size threshold
* @deprecated since 2.1.0 in favor of {@link #setFileSizeThreshold(DataSize)}
*/
@Deprecated
public void setFileSizeThreshold(String fileSizeThreshold) {
setFileSizeThreshold(DataSize.parse(fileSizeThreshold));
}
/** /**
* Create a new {@link MultipartConfigElement} instance. * Create a new {@link MultipartConfigElement} instance.
* @return the multipart config element * @return the multipart config element

@ -332,16 +332,6 @@ public class RestTemplateBuilderTests {
assertThat(interceptor).extracting("password").containsExactly("boot"); assertThat(interceptor).extracting("password").containsExactly("boot");
} }
@Test
@Deprecated
public void basicAuthorizationShouldApply() {
RestTemplate template = this.builder.basicAuthorization("spring", "boot").build();
ClientHttpRequestInterceptor interceptor = template.getInterceptors().get(0);
assertThat(interceptor).isInstanceOf(BasicAuthenticationInterceptor.class);
assertThat(interceptor).extracting("username").containsExactly("spring");
assertThat(interceptor).extracting("password").containsExactly("boot");
}
@Test @Test
public void customizersWhenCustomizersAreNullShouldThrowException() { public void customizersWhenCustomizersAreNullShouldThrowException() {
assertThatIllegalArgumentException() assertThatIllegalArgumentException()
@ -559,7 +549,7 @@ public class RestTemplateBuilderTests {
public void connectTimeoutCanBeSetWithInteger() { public void connectTimeoutCanBeSetWithInteger() {
ClientHttpRequestFactory requestFactory = this.builder ClientHttpRequestFactory requestFactory = this.builder
.requestFactory(SimpleClientHttpRequestFactory.class) .requestFactory(SimpleClientHttpRequestFactory.class)
.setConnectTimeout(1234).build().getRequestFactory(); .setConnectTimeout(Duration.ofMillis(1234)).build().getRequestFactory();
assertThat(requestFactory).hasFieldOrPropertyWithValue("connectTimeout", 1234); assertThat(requestFactory).hasFieldOrPropertyWithValue("connectTimeout", 1234);
} }
@ -567,7 +557,7 @@ public class RestTemplateBuilderTests {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void readTimeoutCanBeSetWithInteger() { public void readTimeoutCanBeSetWithInteger() {
ClientHttpRequestFactory requestFactory = this.builder ClientHttpRequestFactory requestFactory = this.builder
.requestFactory(SimpleClientHttpRequestFactory.class).setReadTimeout(1234) .requestFactory(SimpleClientHttpRequestFactory.class).setReadTimeout(Duration.ofMillis(1234))
.build().getRequestFactory(); .build().getRequestFactory();
assertThat(requestFactory).hasFieldOrPropertyWithValue("readTimeout", 1234); assertThat(requestFactory).hasFieldOrPropertyWithValue("readTimeout", 1234);
} }

@ -42,34 +42,6 @@ public class MultipartConfigFactoryTests {
assertThat(config.getFileSizeThreshold()).isEqualTo(0); assertThat(config.getFileSizeThreshold()).isEqualTo(0);
} }
@Test
@Deprecated
public void create() {
MultipartConfigFactory factory = new MultipartConfigFactory();
factory.setLocation("loc");
factory.setMaxFileSize(1);
factory.setMaxRequestSize(2);
factory.setFileSizeThreshold(3);
MultipartConfigElement config = factory.createMultipartConfig();
assertThat(config.getLocation()).isEqualTo("loc");
assertThat(config.getMaxFileSize()).isEqualTo(1L);
assertThat(config.getMaxRequestSize()).isEqualTo(2L);
assertThat(config.getFileSizeThreshold()).isEqualTo(3);
}
@Test
@Deprecated
public void createWithStringSizes() {
MultipartConfigFactory factory = new MultipartConfigFactory();
factory.setMaxFileSize("1");
factory.setMaxRequestSize("2KB");
factory.setFileSizeThreshold("3MB");
MultipartConfigElement config = factory.createMultipartConfig();
assertThat(config.getMaxFileSize()).isEqualTo(1L);
assertThat(config.getMaxRequestSize()).isEqualTo(2 * 1024L);
assertThat(config.getFileSizeThreshold()).isEqualTo(3 * 1024 * 1024);
}
@Test @Test
public void createWithDataSizes() { public void createWithDataSizes() {
MultipartConfigFactory factory = new MultipartConfigFactory(); MultipartConfigFactory factory = new MultipartConfigFactory();

Loading…
Cancel
Save