commit
483da2615b
|
|
@ -31,8 +31,8 @@ import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||||
public interface Jackson2ObjectMapperBuilderCustomizer {
|
public interface Jackson2ObjectMapperBuilderCustomizer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Customize the jacksonObjectMapperBuilder.
|
* Customize the JacksonObjectMapperBuilder.
|
||||||
* @param jacksonObjectMapperBuilder the jacksonObjectMapperBuilder to customize
|
* @param jacksonObjectMapperBuilder the JacksonObjectMapperBuilder to customize
|
||||||
*/
|
*/
|
||||||
void customize(Jackson2ObjectMapperBuilder jacksonObjectMapperBuilder);
|
void customize(Jackson2ObjectMapperBuilder jacksonObjectMapperBuilder);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ public class WebClientAutoConfigurationTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void restTemplateWhenHasCustomMesssageConvertersShouldHaveMessageConverters() {
|
public void restTemplateWhenHasCustomMessageConvertersShouldHaveMessageConverters() {
|
||||||
load(CustomHttpMessageConverter.class,
|
load(CustomHttpMessageConverter.class,
|
||||||
HttpMessageConvertersAutoConfiguration.class, RestTemplateConfig.class);
|
HttpMessageConvertersAutoConfiguration.class, RestTemplateConfig.class);
|
||||||
RestTemplate restTemplate = this.context.getBean(RestTemplate.class);
|
RestTemplate restTemplate = this.context.getBean(RestTemplate.class);
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ the underlying `HazelcastInstance`.
|
||||||
|
|
||||||
|
|
||||||
=== Infinispan
|
=== Infinispan
|
||||||
Add the org.infinispan:infinispan-spring4-embedded` dependency to enable support for
|
Add the `org.infinispan:infinispan-spring4-embedded` dependency to enable support for
|
||||||
Infinispan. There is no default location that Infinispan uses to look for a config file
|
Infinispan. There is no default location that Infinispan uses to look for a config file
|
||||||
so if you don't specify anything it will bootstrap on a hardcoded default. You can set
|
so if you don't specify anything it will bootstrap on a hardcoded default. You can set
|
||||||
the `spring.cache.infinispan.config` property to use the provided `infinispan.xml`
|
the `spring.cache.infinispan.config` property to use the provided `infinispan.xml`
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ import org.springframework.web.client.RestTemplate;
|
||||||
* <strong>only</strong> on beans that use {@link RestTemplateBuilder}.
|
* <strong>only</strong> on beans that use {@link RestTemplateBuilder}.
|
||||||
* <p>
|
* <p>
|
||||||
* Using this annotation will disable full auto-configuration and instead apply only
|
* Using this annotation will disable full auto-configuration and instead apply only
|
||||||
* configuration relevant to rest client tests (i.e. Jackson or GSON auto-configureation
|
* configuration relevant to rest client tests (i.e. Jackson or GSON auto-configuration
|
||||||
* and {@code @JsonComponent} beans, but not regular {@link Component @Component} beans).
|
* and {@code @JsonComponent} beans, but not regular {@link Component @Component} beans).
|
||||||
* <p>
|
* <p>
|
||||||
* By default, tests annotated with {@code RestClientTest} will also auto-configure a
|
* By default, tests annotated with {@code RestClientTest} will also auto-configure a
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ public class MockServerRestTemplateCustomizer implements RestTemplateCustomizer
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void customize(RestTemplate restTemplate) {
|
public void customize(RestTemplate restTemplate) {
|
||||||
RequestExpectationManager expectationManager = createExpecationManager();
|
RequestExpectationManager expectationManager = createExpectationManager();
|
||||||
if (this.detectRootUri) {
|
if (this.detectRootUri) {
|
||||||
expectationManager = RootUriRequestExpectationManager
|
expectationManager = RootUriRequestExpectationManager
|
||||||
.forRestTemplate(restTemplate, expectationManager);
|
.forRestTemplate(restTemplate, expectationManager);
|
||||||
|
|
@ -93,7 +93,7 @@ public class MockServerRestTemplateCustomizer implements RestTemplateCustomizer
|
||||||
this.servers.put(restTemplate, server);
|
this.servers.put(restTemplate, server);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected RequestExpectationManager createExpecationManager() {
|
protected RequestExpectationManager createExpectationManager() {
|
||||||
return BeanUtils.instantiate(this.expectationManager);
|
return BeanUtils.instantiate(this.expectationManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ public class MockServerRestTemplateCustomizerTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void createShouldUseExpectationMangerClass() throws Exception {
|
public void createShouldUseExpectationManagerClass() throws Exception {
|
||||||
MockServerRestTemplateCustomizer customizer = new MockServerRestTemplateCustomizer(
|
MockServerRestTemplateCustomizer customizer = new MockServerRestTemplateCustomizer(
|
||||||
UnorderedRequestExpectationManager.class);
|
UnorderedRequestExpectationManager.class);
|
||||||
customizer.customize(new RestTemplate());
|
customizer.customize(new RestTemplate());
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ public class RootUriRequestExpectationManagerTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void expectRequestShouldDelegateToExpecationManager() throws Exception {
|
public void expectRequestShouldDelegateToExpectationManager() throws Exception {
|
||||||
ExpectedCount count = mock(ExpectedCount.class);
|
ExpectedCount count = mock(ExpectedCount.class);
|
||||||
RequestMatcher requestMatcher = mock(RequestMatcher.class);
|
RequestMatcher requestMatcher = mock(RequestMatcher.class);
|
||||||
this.manager.expectRequest(count, requestMatcher);
|
this.manager.expectRequest(count, requestMatcher);
|
||||||
|
|
@ -128,7 +128,7 @@ public class RootUriRequestExpectationManagerTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void resetRequestShouldDelegateToExpecationManager() throws Exception {
|
public void resetRequestShouldDelegateToExpectationManager() throws Exception {
|
||||||
this.manager.reset();
|
this.manager.reset();
|
||||||
verify(this.delegate).reset();
|
verify(this.delegate).reset();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ import org.springframework.context.ApplicationContextAware;
|
||||||
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link BeanPostProcessor} that apply all {@link EmbeddedServletContainerCustomizer}s
|
* {@link BeanPostProcessor} that applies all {@link EmbeddedServletContainerCustomizer}s
|
||||||
* from the bean factory to {@link ConfigurableEmbeddedServletContainer} beans.
|
* from the bean factory to {@link ConfigurableEmbeddedServletContainer} beans.
|
||||||
*
|
*
|
||||||
* @author Dave Syer
|
* @author Dave Syer
|
||||||
|
|
|
||||||
|
|
@ -260,7 +260,7 @@ public class RestTemplateBuilder {
|
||||||
/**
|
/**
|
||||||
* Set the {@link ResponseErrorHandler} that should be used with the
|
* Set the {@link ResponseErrorHandler} that should be used with the
|
||||||
* {@link RestTemplate}.
|
* {@link RestTemplate}.
|
||||||
* @param errorHandler the error hander to use
|
* @param errorHandler the error handler to use
|
||||||
* @return a new builder instance
|
* @return a new builder instance
|
||||||
*/
|
*/
|
||||||
public RestTemplateBuilder errorHandler(ResponseErrorHandler errorHandler) {
|
public RestTemplateBuilder errorHandler(ResponseErrorHandler errorHandler) {
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ import org.springframework.context.ApplicationContextAware;
|
||||||
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link BeanPostProcessor} that apply all {@link ErrorPageRegistrar}s from the bean
|
* {@link BeanPostProcessor} that applies all {@link ErrorPageRegistrar}s from the bean
|
||||||
* factory to {@link ErrorPageRegistry} beans.
|
* factory to {@link ErrorPageRegistry} beans.
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ public class RestTemplateBuilderTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void messageConvertersShouldRepalceExisting() throws Exception {
|
public void messageConvertersShouldReplaceExisting() throws Exception {
|
||||||
RestTemplate template = this.builder
|
RestTemplate template = this.builder
|
||||||
.messageConverters(new ResourceHttpMessageConverter())
|
.messageConverters(new ResourceHttpMessageConverter())
|
||||||
.messageConverters(Collections.singleton(this.messageConverter)).build();
|
.messageConverters(Collections.singleton(this.messageConverter)).build();
|
||||||
|
|
@ -308,7 +308,7 @@ public class RestTemplateBuilderTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void customizersShouldRepalceExisting() throws Exception {
|
public void customizersShouldReplaceExisting() throws Exception {
|
||||||
RestTemplateCustomizer customizer1 = mock(RestTemplateCustomizer.class);
|
RestTemplateCustomizer customizer1 = mock(RestTemplateCustomizer.class);
|
||||||
RestTemplateCustomizer customizer2 = mock(RestTemplateCustomizer.class);
|
RestTemplateCustomizer customizer2 = mock(RestTemplateCustomizer.class);
|
||||||
RestTemplate template = this.builder.customizers(customizer1)
|
RestTemplate template = this.builder.customizers(customizer1)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue