Browse Source

Improvements in up-to-date checking and use of parallel tests where possible.

Luke Taylor 15 years ago
parent
commit
413b2a06e3

+ 16 - 2
config/config.gradle

@@ -16,12 +16,12 @@ dependencies {
 
     provided "javax.servlet:servlet-api:2.5"
 
-    groovy group: 'org.codehaus.groovy', name: 'groovy', version: '1.7.2'
+    groovy group: 'org.codehaus.groovy', name: 'groovy', version: '1.7.3'
 
     testCompile project(':spring-security-ldap'),
                 project(':spring-security-openid'),
                 'org.openid4java:openid4java-nodeps:0.9.5',
-                files(this.project(':spring-security-core').sourceSets.test.classesDir),
+                project(':spring-security-core').sourceSets.test.classes,
                 'javax.annotation:jsr250-api:1.0',
                 "org.springframework.ldap:spring-ldap-core:$springLdapVersion",
                 "org.springframework:spring-jdbc:$springVersion",
@@ -32,3 +32,17 @@ dependencies {
     testRuntime "hsqldb:hsqldb:$hsqlVersion",
                 "cglib:cglib-nodep:2.2"
 }
+
+task ldapTests(type: Test) {
+    include ("**/ldap/**")
+    maxParallelForks = 1
+   // GRADLE-1090
+    testClassesDir = sourceSets.test.classesDir
+    classpath = sourceSets.test.runtimeClasspath
+    testReport = false
+}
+
+test {
+    dependsOn ldapTests
+    exclude ("**/ldap/**")
+}

+ 0 - 8
config/src/test/java/org/springframework/security/config/ldap/LdapProviderBeanDefinitionParserTests.java

@@ -117,14 +117,6 @@ public class LdapProviderBeanDefinitionParserTests {
         provider.authenticate(new UsernamePasswordAuthenticationToken("ben", "ben"));
     }
 
-    @Test
-    public void detectsNonStandardServerId() {
-        setContext("<ldap-server id='myServer'/> " +
-                "<authentication-manager>" +
-                "  <ldap-authentication-provider />" +
-                "</authentication-manager>");
-    }
-
     @Test
     public void inetOrgContextMapperIsSupported() throws Exception {
         setContext(

+ 7 - 4
gradle/aspectj.gradle

@@ -13,22 +13,25 @@ dependencies {
 task compileJava(overwrite: true, description: 'Compiles AspectJ Source', type: Ajc) {
     dependsOn processResources
     sourceSet = sourceSets.main
+    outputs.dir(sourceSet.classesDir)
     aspectPath = configurations.aspectpath
 }
 
 task compileTestJava(overwrite: true, description: 'Compiles AspectJ Test Source', type: Ajc) {
     dependsOn processTestResources, compileJava, jar
     sourceSet = sourceSets.test
+    outputs.dir(sourceSet.classesDir)
     aspectPath = files(configurations.aspectpath, jar.archivePath)
 }
 
 class Ajc extends DefaultTask {
-    @Input
     SourceSet sourceSet
-
-    @Input
     FileCollection aspectPath
 
+    Ajc() {
+        logging.captureStandardOutput(LogLevel.INFO)
+    }
+
     @TaskAction
     def compile() {
         println "Running ajc ..."
@@ -44,4 +47,4 @@ class Ajc extends DefaultTask {
             }
         }
     }
-}
+}

+ 10 - 4
gradle/javaprojects.gradle

@@ -47,10 +47,16 @@ dependencies {
 
 sourceSets.main.compileClasspath += configurations.compileOnly
 
+System.setProperty('apacheDSWorkDir', "${buildDir}/apacheDSWork")
+
 test {
-    onlyIf {
-        !project.hasProperty('skipTests')
-    }
-    jvmArgs = ['-ea', '-Xms128m', '-Xmx500m', '-XX:MaxPermSize=128m']
+    jvmArgs = ['-ea', '-Xmx500m']
+    maxParallelForks = guessMaxForks()
+    testReport = false
+}
+
+def guessMaxForks() {
+    int processors = Runtime.runtime.availableProcessors()
+    return Math.max(2, (int) (processors / 2))
 }
 

+ 2 - 1
itest/web/itest-web.gradle

@@ -27,4 +27,5 @@ test {
         jvmArgs = ["-ea", '-Xms128m', '-Xmx500m']
         systemProperties = ['webapp.dir': "$projectDir/src/main/webapp"]
     }
-}
+    maxParallelForks = 1
+}

+ 4 - 1
ldap/ldap.gradle

@@ -1,6 +1,9 @@
 // Ldap build file
 
-test.exclude('**/OpenLDAPIntegrationTestSuite.class')
+test {
+    exclude('**/OpenLDAPIntegrationTestSuite.class')
+    maxParallelForks = 1
+}
 
 apacheds_libs = [
          "org.apache.directory.server:apacheds-core:$apacheDsVersion",

+ 1 - 1
samples/contacts/src/test/resources/logback-test.xml

@@ -5,7 +5,7 @@
     </encoder>
   </appender>
 
-  <root level="INFO">
+  <root level="WARN">
     <appender-ref ref="STDOUT" />
   </root>
 

+ 12 - 0
samples/dms/src/test/resources/logback-test.xml

@@ -0,0 +1,12 @@
+<configuration>
+  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+    <encoder>
+      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+    </encoder>
+  </appender>
+
+  <root level="WARN">
+    <appender-ref ref="STDOUT" />
+  </root>
+
+</configuration>