|
|
@ -79,7 +79,8 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests {
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void deviceDelegatingJspResourceViewResolver() throws Exception {
|
|
|
|
public void deviceDelegatingJspResourceViewResolver() throws Exception {
|
|
|
|
load("spring.mobile.devicedelegatingviewresolver.enabled:true");
|
|
|
|
load("spring.mobile.devicedelegatingviewresolver.enabled:true");
|
|
|
|
assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class)).hasSize(1);
|
|
|
|
assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class))
|
|
|
|
|
|
|
|
.hasSize(1);
|
|
|
|
InternalResourceViewResolver internalResourceViewResolver = this.context
|
|
|
|
InternalResourceViewResolver internalResourceViewResolver = this.context
|
|
|
|
.getBean(InternalResourceViewResolver.class);
|
|
|
|
.getBean(InternalResourceViewResolver.class);
|
|
|
|
assertLiteDeviceDelegatingViewResolver(internalResourceViewResolver,
|
|
|
|
assertLiteDeviceDelegatingViewResolver(internalResourceViewResolver,
|
|
|
@ -90,8 +91,10 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests {
|
|
|
|
public void deviceDelegatingFreemarkerViewResolver() throws Exception {
|
|
|
|
public void deviceDelegatingFreemarkerViewResolver() throws Exception {
|
|
|
|
load(Collections.<Class<?>>singletonList(FreeMarkerAutoConfiguration.class),
|
|
|
|
load(Collections.<Class<?>>singletonList(FreeMarkerAutoConfiguration.class),
|
|
|
|
"spring.mobile.devicedelegatingviewresolver.enabled:true");
|
|
|
|
"spring.mobile.devicedelegatingviewresolver.enabled:true");
|
|
|
|
assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class)).hasSize(2);
|
|
|
|
assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class))
|
|
|
|
assertLiteDeviceDelegatingViewResolver(this.context.getBean(FreeMarkerViewResolver.class),
|
|
|
|
.hasSize(2);
|
|
|
|
|
|
|
|
assertLiteDeviceDelegatingViewResolver(
|
|
|
|
|
|
|
|
this.context.getBean(FreeMarkerViewResolver.class),
|
|
|
|
"deviceDelegatingFreemarkerViewResolver");
|
|
|
|
"deviceDelegatingFreemarkerViewResolver");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -99,8 +102,10 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests {
|
|
|
|
public void deviceDelegatingGroovyMarkupViewResolver() throws Exception {
|
|
|
|
public void deviceDelegatingGroovyMarkupViewResolver() throws Exception {
|
|
|
|
load(Collections.<Class<?>>singletonList(GroovyTemplateAutoConfiguration.class),
|
|
|
|
load(Collections.<Class<?>>singletonList(GroovyTemplateAutoConfiguration.class),
|
|
|
|
"spring.mobile.devicedelegatingviewresolver.enabled:true");
|
|
|
|
"spring.mobile.devicedelegatingviewresolver.enabled:true");
|
|
|
|
assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class)).hasSize(2);
|
|
|
|
assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class))
|
|
|
|
assertLiteDeviceDelegatingViewResolver(this.context.getBean(GroovyMarkupViewResolver.class),
|
|
|
|
.hasSize(2);
|
|
|
|
|
|
|
|
assertLiteDeviceDelegatingViewResolver(
|
|
|
|
|
|
|
|
this.context.getBean(GroovyMarkupViewResolver.class),
|
|
|
|
"deviceDelegatingGroovyMarkupViewResolver");
|
|
|
|
"deviceDelegatingGroovyMarkupViewResolver");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -108,8 +113,10 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests {
|
|
|
|
public void deviceDelegatingMustacheViewResolver() throws Exception {
|
|
|
|
public void deviceDelegatingMustacheViewResolver() throws Exception {
|
|
|
|
load(Collections.<Class<?>>singletonList(MustacheAutoConfiguration.class),
|
|
|
|
load(Collections.<Class<?>>singletonList(MustacheAutoConfiguration.class),
|
|
|
|
"spring.mobile.devicedelegatingviewresolver.enabled:true");
|
|
|
|
"spring.mobile.devicedelegatingviewresolver.enabled:true");
|
|
|
|
assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class)).hasSize(2);
|
|
|
|
assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class))
|
|
|
|
assertLiteDeviceDelegatingViewResolver(this.context.getBean(MustacheViewResolver.class),
|
|
|
|
.hasSize(2);
|
|
|
|
|
|
|
|
assertLiteDeviceDelegatingViewResolver(
|
|
|
|
|
|
|
|
this.context.getBean(MustacheViewResolver.class),
|
|
|
|
"deviceDelegatingMustacheViewResolver");
|
|
|
|
"deviceDelegatingMustacheViewResolver");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -117,26 +124,30 @@ public class DeviceDelegatingViewResolverAutoConfigurationTests {
|
|
|
|
public void deviceDelegatingThymeleafViewResolver() throws Exception {
|
|
|
|
public void deviceDelegatingThymeleafViewResolver() throws Exception {
|
|
|
|
load(Collections.<Class<?>>singletonList(ThymeleafAutoConfiguration.class),
|
|
|
|
load(Collections.<Class<?>>singletonList(ThymeleafAutoConfiguration.class),
|
|
|
|
"spring.mobile.devicedelegatingviewresolver.enabled:true");
|
|
|
|
"spring.mobile.devicedelegatingviewresolver.enabled:true");
|
|
|
|
assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class)).hasSize(2);
|
|
|
|
assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class))
|
|
|
|
assertLiteDeviceDelegatingViewResolver(this.context.getBean(ThymeleafViewResolver.class),
|
|
|
|
.hasSize(2);
|
|
|
|
|
|
|
|
assertLiteDeviceDelegatingViewResolver(
|
|
|
|
|
|
|
|
this.context.getBean(ThymeleafViewResolver.class),
|
|
|
|
"deviceDelegatingThymeleafViewResolver");
|
|
|
|
"deviceDelegatingThymeleafViewResolver");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void assertLiteDeviceDelegatingViewResolver(ViewResolver delegate, String delegatingBeanName) {
|
|
|
|
public void assertLiteDeviceDelegatingViewResolver(ViewResolver delegate,
|
|
|
|
|
|
|
|
String delegatingBeanName) {
|
|
|
|
LiteDeviceDelegatingViewResolver deviceDelegatingViewResolver = this.context
|
|
|
|
LiteDeviceDelegatingViewResolver deviceDelegatingViewResolver = this.context
|
|
|
|
.getBean(delegatingBeanName, LiteDeviceDelegatingViewResolver.class);
|
|
|
|
.getBean(delegatingBeanName, LiteDeviceDelegatingViewResolver.class);
|
|
|
|
assertThat(deviceDelegatingViewResolver.getViewResolver())
|
|
|
|
assertThat(deviceDelegatingViewResolver.getViewResolver()).isSameAs(delegate);
|
|
|
|
.isSameAs(delegate);
|
|
|
|
|
|
|
|
assertThat(deviceDelegatingViewResolver.getOrder())
|
|
|
|
assertThat(deviceDelegatingViewResolver.getOrder())
|
|
|
|
.isEqualTo(((Ordered) delegate).getOrder() - 1);
|
|
|
|
.isEqualTo(((Ordered) delegate).getOrder() - 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void deviceDelegatingViewResolverDisabled() throws Exception {
|
|
|
|
public void deviceDelegatingViewResolverDisabled() throws Exception {
|
|
|
|
load(Arrays.asList(FreeMarkerAutoConfiguration.class, GroovyTemplateAutoConfiguration.class,
|
|
|
|
load(Arrays.asList(FreeMarkerAutoConfiguration.class,
|
|
|
|
MustacheAutoConfiguration.class, ThymeleafAutoConfiguration.class),
|
|
|
|
GroovyTemplateAutoConfiguration.class, MustacheAutoConfiguration.class,
|
|
|
|
|
|
|
|
ThymeleafAutoConfiguration.class),
|
|
|
|
"spring.mobile.devicedelegatingviewresolver.enabled:false");
|
|
|
|
"spring.mobile.devicedelegatingviewresolver.enabled:false");
|
|
|
|
assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class)).hasSize(0);
|
|
|
|
assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class))
|
|
|
|
|
|
|
|
.hasSize(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|