Using another gradle file for integTest task
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Thu, 29 Dec 2016 14:17:06 +0000 (15:17 +0100)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Thu, 29 Dec 2016 14:17:06 +0000 (15:17 +0100)
SpringJava/Gradle/spring-jpa-persistence/build-integTest.gradle [new file with mode: 0644]
SpringJava/Gradle/spring-jpa-persistence/build.gradle

diff --git a/SpringJava/Gradle/spring-jpa-persistence/build-integTest.gradle b/SpringJava/Gradle/spring-jpa-persistence/build-integTest.gradle
new file mode 100644 (file)
index 0000000..e5fa060
--- /dev/null
@@ -0,0 +1,45 @@
+sourceSets {
+    integTest {
+        compileClasspath += main.output + test.output
+        runtimeClasspath += main.output + test.output
+    }
+}
+
+configurations {
+  integTestCompile.extendsFrom testCompile
+  integTestRuntime.extendsFrom testRuntime
+}
+
+
+task integTest(type: Test) {
+    // dependsOn startApp
+    // finalizedBy stopApp
+
+    testClassesDir = sourceSets.integTest.output.classesDir
+    classpath = sourceSets.integTest.runtimeClasspath
+
+    testLogging {
+        events "PASSED", "FAILED", "SKIPPED"
+    }
+
+    // mustRunAfter test
+}
+
+
+integTest.doFirst {
+    // It is required in order to run data bases in random ports.
+    // We need it for running tests from IDE and from command console but
+    // also it will be required by systems like Travis where we do not control
+    // the available ports.
+    def mysqlInfo = dockerCompose.servicesInfos.mysql
+    systemProperty 'DATABASE_PORT', mysqlInfo.ports[3306]
+}
+
+dockerCompose.isRequiredBy(integTest)
+dockerCompose {
+    useComposeFiles = ['src/integTest/resources/docker/docker-compose.yml']
+    captureContainersOutput = false
+    stopContainers = true
+    removeContainers = true
+    buildBeforeUp = false
+}
index abcc14c..c9c25f3 100644 (file)
@@ -20,6 +20,8 @@ apply plugin: 'jacoco'
 apply plugin: 'com.ewerk.gradle.plugins.querydsl'
 apply plugin: 'docker-compose'
 
+apply from: 'build-integTest.gradle'
+
 
 targetCompatibility = 1.8
 sourceCompatibility = 1.8
@@ -145,58 +147,6 @@ test {
 }
 
 
-// ****************** CUSTOM TASK FOR INTEGRATION TESTS (something like  maven-failsafe-plugin) *********************
-
-sourceSets {
-       integTest {
-       compileClasspath += main.output + test.output
-       runtimeClasspath += main.output + test.output
-       }
-}
-
-configurations {
-  integTestCompile.extendsFrom testCompile
-  integTestRuntime.extendsFrom testRuntime
-}
-
-
-task integTest(type: Test) {
-       // dependsOn startApp
-       // finalizedBy stopApp
-
-       testClassesDir = sourceSets.integTest.output.classesDir
-       classpath = sourceSets.integTest.runtimeClasspath
-
-    testLogging {
-        events "PASSED", "FAILED", "SKIPPED"
-    }
-    
-    // mustRunAfter test
-}
-
-
-integTest.doFirst {
-       // It is required in order to run data bases in random ports.
-       // We need it for running tests from IDE and from command console but
-       // also it will be required by systems like Travis where we do not control
-       // the available ports.
-       def mysqlInfo = dockerCompose.servicesInfos.mysql
-       systemProperty 'DATABASE_PORT', mysqlInfo.ports[3306]
-}
-
-dockerCompose.isRequiredBy(integTest)
-dockerCompose {
-    useComposeFiles = ['src/integTest/resources/docker/docker-compose.yml']
-    captureContainersOutput = false
-    stopContainers = true
-    removeContainers = true
-    buildBeforeUp = false
-}
-
-// ************************************************************************************************************************
-
-
-
 querydsl {
   library = 'com.querydsl:querydsl-apt:4.1.3'
   querydslSourcesDir = "$buildDir/generated-sources/querydsl"