Re-run Tests against Spring 3

Fixes gh-120
This commit is contained in:
Rob Winch
2015-07-29 11:18:51 -05:00
parent 916a5cb7dd
commit 3a17a84434
4 changed files with 34 additions and 2 deletions

View File

@@ -15,6 +15,7 @@ group = 'org.springframework.session'
ext.springBootVersion = '1.2.3.RELEASE' ext.springBootVersion = '1.2.3.RELEASE'
ext.JAVA_GRADLE = "$rootDir/gradle/java.gradle" ext.JAVA_GRADLE = "$rootDir/gradle/java.gradle"
ext.SPRING3_GRADLE = "$rootDir/gradle/spring3.gradle"
ext.MAVEN_GRADLE = "$rootDir/gradle/publish-maven.gradle" ext.MAVEN_GRADLE = "$rootDir/gradle/publish-maven.gradle"
ext.TOMCAT_GRADLE = "$rootDir/gradle/tomcat.gradle" ext.TOMCAT_GRADLE = "$rootDir/gradle/tomcat.gradle"
ext.TOMCAT_6_GRADLE = "$rootDir/gradle/tomcat6.gradle" ext.TOMCAT_6_GRADLE = "$rootDir/gradle/tomcat6.gradle"

24
gradle/spring3.gradle Normal file
View File

@@ -0,0 +1,24 @@
configurations {
spring3TestRuntime.extendsFrom testRuntime
}
configurations.spring3TestRuntime {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.springframework'
&& details.requested.name != 'spring-websocket'
&& details.requested.name != 'spring-messaging') {
details.useVersion '3.2.14.RELEASE'
}
}
}
task spring3Test(type: Test) {
jvmArgs = ['-ea', '-Xmx500m', '-XX:MaxPermSize=128M']
classpath = sourceSets.test.output + sourceSets.main.output + configurations.spring3TestRuntime
exclude "org/springframework/session/web/socket/**"
reports {
html.destination = project.file("$buildDir/spring3-test-results/")
junitXml.destination = project.file("$buildDir/reports/spring3-tests/")
}
}
check.dependsOn spring3Test

View File

@@ -1,4 +1,5 @@
apply from: JAVA_GRADLE apply from: JAVA_GRADLE
apply from: SPRING3_GRADLE
apply from: MAVEN_GRADLE apply from: MAVEN_GRADLE
apply plugin: 'spring-io' apply plugin: 'spring-io'

View File

@@ -50,7 +50,7 @@ import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.core.Ordered; import org.springframework.core.Ordered;
import org.springframework.core.annotation.OrderUtils; import org.springframework.core.annotation.AnnotationAwareOrderComparator;
import org.springframework.mock.web.MockFilterChain; import org.springframework.mock.web.MockFilterChain;
import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.mock.web.MockHttpServletResponse;
@@ -1169,7 +1169,7 @@ public class SessionRepositoryFilterTests {
@Test @Test
public void order() { public void order() {
assertThat(OrderUtils.getOrder(filter.getClass())).isEqualTo(SessionRepositoryFilter.DEFAULT_ORDER); assertThat(AnnotationAwareOrderComparator.INSTANCE.compare(filter, new SessionRepositoryFilterDefaultOrder()));
} }
// We want the filter to work without any dependencies on Spring // We want the filter to work without any dependencies on Spring
@@ -1257,4 +1257,10 @@ public class SessionRepositoryFilterTests {
} }
void doFilter(HttpServletRequest wrappedRequest) {} void doFilter(HttpServletRequest wrappedRequest) {}
} }
static class SessionRepositoryFilterDefaultOrder implements Ordered {
public int getOrder() {
return SessionRepositoryFilter.DEFAULT_ORDER;
}
}
} }