Now passing in the path to the GATK directory to tests.

Changed tests and scripts to use gatkdir full path instead of relative testdata/qscripts symbolic links.
Although symlinks not created, left the symlink deletion script execution with a comment about future removal.
Re-enabled example UG pipeline queue test.
Replaced all hardcoded strings of {public,private}/testdata with BaseTest variables.
Refactored temp list creation method from ListFileUtilsUnitTest to BaseTest.createTempListFile.
Removed list files with hardcoded paths, now using createTempListFile instead with private test dir variable.
This commit is contained in:
Khalid Shakir 2014-09-01 18:15:19 +08:00
parent 9477a6ab1a
commit fcb0eca203
34 changed files with 172 additions and 632 deletions

175
pom.xml
View File

@ -412,131 +412,10 @@
</executions>
</plugin>
<!-- TODO: Remove temporary symbolic link creation, after fixing test paths to use local resources. -->
<plugin>
<groupId>com.pyx4j</groupId>
<artifactId>maven-junction-plugin</artifactId>
<executions>
<execution>
<id>link-public-testdata</id>
<goals>
<goal>link</goal>
</goals>
<phase>none</phase>
<configuration>
<links>
<link>
<dst>${basedir}/public/testdata</dst>
<src>${gatk.basedir}/public/gatk-engine/src/test/resources</src>
</link>
</links>
</configuration>
</execution>
<execution>
<id>unlink-public-testdata</id>
<goals>
<goal>unlink</goal>
</goals>
<phase>none</phase>
<configuration>
<links>
<link>
<dst>${basedir}/public/testdata</dst>
<src>${gatk.basedir}/public/gatk-engine/src/test/resources</src>
</link>
</links>
</configuration>
</execution>
<execution>
<id>link-private-testdata</id>
<goals>
<goal>link</goal>
</goals>
<phase>none</phase>
<configuration>
<links>
<link>
<dst>${basedir}/private/testdata</dst>
<src>${gatk.basedir}/private/gatk-tools-private/src/test/resources</src>
</link>
</links>
</configuration>
</execution>
<execution>
<id>unlink-private-testdata</id>
<goals>
<goal>unlink</goal>
</goals>
<phase>none</phase>
<configuration>
<links>
<link>
<dst>${basedir}/private/testdata</dst>
<src>${gatk.basedir}/private/gatk-tools-private/src/test/resources</src>
</link>
</links>
</configuration>
</execution>
<execution>
<id>link-public-qscript</id>
<goals>
<goal>link</goal>
</goals>
<phase>none</phase>
<configuration>
<links>
<link>
<dst>${basedir}/public/scala/qscript</dst>
<src>${gatk.basedir}/public/gatk-queue-extensions-public/src/main/qscripts</src>
</link>
</links>
</configuration>
</execution>
<execution>
<id>unlink-public-qscript</id>
<goals>
<goal>unlink</goal>
</goals>
<phase>none</phase>
<configuration>
<links>
<link>
<dst>${basedir}/public/scala/qscript</dst>
<src>${gatk.basedir}/public/gatk-queue-extensions-public/src/main/qscripts</src>
</link>
</links>
</configuration>
</execution>
<execution>
<id>link-private-qscript</id>
<goals>
<goal>link</goal>
</goals>
<phase>none</phase>
<configuration>
<links>
<link>
<dst>${basedir}/private/scala/qscript</dst>
<src>${gatk.basedir}/private/gatk-queue-extensions-internal/src/main/qscripts</src>
</link>
</links>
</configuration>
</execution>
<execution>
<id>unlink-private-qscript</id>
<goals>
<goal>unlink</goal>
</goals>
<phase>none</phase>
<configuration>
<links>
<link>
<dst>${basedir}/private/scala/qscript</dst>
<src>${gatk.basedir}/private/gatk-queue-extensions-internal/src/main/qscripts</src>
</link>
</links>
</configuration>
</execution>
<!--
HACK: Adding the source directory via build-helper-maven-plugin doesn't work with IntelliJ.
Add compatibility link from public's extensions source code to target/generated-sources.
@ -746,6 +625,11 @@
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<!--
TODO: Remove after 3.3+ release.
Until then, will clean out symbolic links from users who download public/protected.
Perhaps leave the script even longer.
-->
<id>delete-mavens-links</id>
<goals>
<goal>exec</goal>
@ -762,28 +646,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.pyx4j</groupId>
<artifactId>maven-junction-plugin</artifactId>
<executions>
<execution>
<id>link-public-testdata</id>
<phase>process-test-resources</phase>
</execution>
<execution>
<id>unlink-public-testdata</id>
<phase>clean</phase>
</execution>
<execution>
<id>link-public-qscript</id>
<phase>process-test-resources</phase>
</execution>
<execution>
<id>unlink-public-qscript</id>
<phase>clean</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
@ -869,33 +731,6 @@
<modules>
<module>private</module>
</modules>
<build>
<plugins>
<!-- TODO: All tests require access to private. For now. -->
<plugin>
<groupId>com.pyx4j</groupId>
<artifactId>maven-junction-plugin</artifactId>
<executions>
<execution>
<id>link-private-testdata</id>
<phase>process-test-resources</phase>
</execution>
<execution>
<id>unlink-private-testdata</id>
<phase>clean</phase>
</execution>
<execution>
<id>link-private-qscript</id>
<phase>process-test-resources</phase>
</execution>
<execution>
<id>unlink-private-qscript</id>
<phase>clean</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- Collection of properties for use during package testing -->

View File

@ -231,33 +231,6 @@
</build>
<profiles>
<profile>
<id>private-testdata</id>
<activation>
<file>
<exists>${basedir}/../../private/pom.xml</exists>
</file>
</activation>
<build>
<plugins>
<!-- TODO: All tests require access to private. For now. -->
<plugin>
<groupId>com.pyx4j</groupId>
<artifactId>maven-junction-plugin</artifactId>
<executions>
<execution>
<id>link-private-testdata</id>
<phase>process-test-resources</phase>
</execution>
<execution>
<id>unlink-private-testdata</id>
<phase>clean</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>packagetests-enabled</id>
<activation>

View File

@ -134,24 +134,6 @@
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.pyx4j</groupId>
<artifactId>maven-junction-plugin</artifactId>
<executions>
<execution>
<id>link-public-qscript</id>
<phase>process-test-resources</phase>
</execution>
<execution>
<id>unlink-public-qscript</id>
<phase>clean</phase>
</execution>
<execution>
<id>link-extensions-sources</id>
<phase>generate-sources</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
@ -176,42 +158,4 @@
</plugins>
</build>
<profiles>
<profile>
<id>private-testdata</id>
<activation>
<file>
<exists>${basedir}/../../private/pom.xml</exists>
</file>
</activation>
<build>
<plugins>
<!-- TODO: All tests require access to private. For now. -->
<plugin>
<groupId>com.pyx4j</groupId>
<artifactId>maven-junction-plugin</artifactId>
<executions>
<execution>
<id>link-private-testdata</id>
<phase>process-test-resources</phase>
</execution>
<execution>
<id>unlink-private-testdata</id>
<phase>clean</phase>
</execution>
<execution>
<id>link-private-qscript</id>
<phase>process-test-resources</phase>
</execution>
<execution>
<id>unlink-private-qscript</id>
<phase>clean</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -50,18 +50,19 @@ import org.testng.annotations.{DataProvider, Test}
import org.broadinstitute.gatk.queue.pipeline.{QueueTest, QueueTestSpec}
import org.broadinstitute.gatk.utils.BaseTest
/*
* TODO: Tests are all currently disabled until we fix the paths to use the qscript directory, or as a patch the gatk.basedir as a passed in variable.
*/
class ExampleUnifiedGenotyperQueueTest {
@Test(timeOut=36000000, enabled=false)
private final val exampleUGQScript = QueueTest.protectedQScriptsPackageDir + "examples/ExampleUnifiedGenotyper.scala"
private final val exampleFasta = BaseTest.publicTestDir + "exampleFASTA.fasta"
private final val exampleBam = BaseTest.publicTestDir + "exampleBAM.bam"
@Test(timeOut=36000000)
def testUnifiedGenotyper() {
val spec = new QueueTestSpec
spec.name = "unifiedgenotyper"
spec.args = Array(
" -S public/scala/qscript/org/broadinstitute/gatk/queue/qscripts/examples/ExampleUnifiedGenotyper.scala",
" -R " + BaseTest.publicTestDir + "exampleFASTA.fasta",
" -I " + BaseTest.publicTestDir + "exampleBAM.bam",
" -S " + exampleUGQScript,
" -R " + exampleFasta,
" -I " + exampleBam,
" -filter QD",
" -filterExpression 'QD < 2.0'").mkString
spec.jobRunners = QueueTest.allJobRunners
@ -76,27 +77,27 @@ class ExampleUnifiedGenotyperQueueTest {
Array("vcf_intervals", BaseTest.validationDataLocation + "intervalTest.1.vcf")
).asInstanceOf[Array[Array[Object]]]
@Test(dataProvider = "ugIntervals", timeOut=36000000, enabled=false)
@Test(dataProvider = "ugIntervals", timeOut=36000000)
def testUnifiedGenotyperWithIntervals(intervalsName: String, intervalsPath: String) {
val spec = new QueueTestSpec
spec.name = "unifiedgenotyper_with_" + intervalsName
spec.args = Array(
" -S public/scala/qscript/org/broadinstitute/gatk/queue/qscripts/examples/ExampleUnifiedGenotyper.scala",
" -I " + BaseTest.validationDataLocation + "OV-0930.normal.chunk.bam",
" -S " + exampleUGQScript,
" -R " + BaseTest.hg18Reference,
" -I " + BaseTest.validationDataLocation + "OV-0930.normal.chunk.bam",
" -L " + intervalsPath).mkString
spec.jobRunners = Seq("Lsf706")
QueueTest.executeTest(spec)
}
@Test(timeOut=36000000, enabled=false)
@Test(timeOut=36000000)
def testUnifiedGenotyperNoGCOpt() {
val spec = new QueueTestSpec
spec.name = "unifiedgenotyper_no_gc_opt"
spec.args = Array(
" -S public/scala/qscript/org/broadinstitute/gatk/queue/qscripts/examples/ExampleUnifiedGenotyper.scala",
" -R " + BaseTest.publicTestDir + "exampleFASTA.fasta",
" -I " + BaseTest.publicTestDir + "exampleBAM.bam",
" -S " + exampleUGQScript,
" -R " + exampleFasta,
" -I " + exampleBam,
" -noGCOpt").mkString
spec.jobRunners = QueueTest.allJobRunners
QueueTest.executeTest(spec)
@ -105,27 +106,27 @@ class ExampleUnifiedGenotyperQueueTest {
@DataProvider(name="resMemReqParams")
def getResMemReqParam = Array(Array("mem_free"), Array("virtual_free")).asInstanceOf[Array[Array[Object]]]
@Test(dataProvider = "resMemReqParams", timeOut=36000000, enabled=false)
@Test(dataProvider = "resMemReqParams", timeOut=36000000)
def testUnifiedGenotyperResMemReqParam(reqParam: String) {
val spec = new QueueTestSpec
spec.name = "unifiedgenotyper_" + reqParam
spec.args = Array(
" -S public/scala/qscript/org/broadinstitute/gatk/queue/qscripts/examples/ExampleUnifiedGenotyper.scala",
" -R " + BaseTest.publicTestDir + "exampleFASTA.fasta",
" -I " + BaseTest.publicTestDir + "exampleBAM.bam",
" -S " + exampleUGQScript,
" -R " + exampleFasta,
" -I " + exampleBam,
" -resMemReqParam " + reqParam).mkString
spec.jobRunners = Seq("GridEngine")
QueueTest.executeTest(spec)
}
@Test(timeOut=36000000, enabled=false)
@Test(timeOut=36000000)
def testUnifiedGenotyperLogDirectory() {
val spec = new QueueTestSpec
spec.name = "unifiedgenotyper_with_log_directory"
spec.args = Array(
" -S public/scala/qscript/org/broadinstitute/gatk/queue/qscripts/examples/ExampleUnifiedGenotyper.scala",
" -R " + BaseTest.publicTestDir + "exampleFASTA.fasta",
" -I " + BaseTest.publicTestDir + "exampleBAM.bam",
" -S " + exampleUGQScript,
" -R " + exampleFasta,
" -I " + exampleBam,
" -logDir exampleUGLogDir").mkString
spec.jobRunners = QueueTest.allJobRunners
spec.expectedFilePaths :+= "exampleUGLogDir/exampleBAM.unfiltered.vcf.out"

View File

@ -238,41 +238,6 @@
</build>
<profiles>
<profile>
<id>private-testdata</id>
<activation>
<file>
<exists>${basedir}/../../private/pom.xml</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.pyx4j</groupId>
<artifactId>maven-junction-plugin</artifactId>
<executions>
<!-- TODO: All tests require access to private. For now. -->
<execution>
<id>link-private-testdata</id>
<phase>process-test-resources</phase>
</execution>
<execution>
<id>unlink-private-testdata</id>
<phase>clean</phase>
</execution>
<execution>
<id>link-private-qscript</id>
<phase>process-test-resources</phase>
</execution>
<execution>
<id>unlink-private-qscript</id>
<phase>clean</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>packagetests-enabled</id>
<activation>

View File

@ -107,34 +107,4 @@
</plugins>
</build>
<profiles>
<profile>
<id>private-testdata</id>
<activation>
<file>
<exists>${basedir}/../../private/pom.xml</exists>
</file>
</activation>
<build>
<plugins>
<!-- TODO: All tests require access to private. For now. -->
<plugin>
<groupId>com.pyx4j</groupId>
<artifactId>maven-junction-plugin</artifactId>
<executions>
<execution>
<id>link-private-testdata</id>
<phase>process-test-resources</phase>
</execution>
<execution>
<id>unlink-private-testdata</id>
<phase>clean</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -47,6 +47,7 @@
package org.broadinstitute.gatk.engine.walkers.diffengine;
import org.broadinstitute.gatk.engine.walkers.WalkerTest;
import org.broadinstitute.gatk.utils.BaseTest;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -84,7 +85,7 @@ public class DiffObjectsIntegrationTest extends WalkerTest {
@Test(enabled = true, dataProvider = "data")
public void testDiffs(TestParams params) {
WalkerTestSpec spec = new WalkerTestSpec(
"-T DiffObjects -R public/testdata/exampleFASTA.fasta "
"-T DiffObjects -R " + publicTestDir + "exampleFASTA.fasta "
+ " -m " + params.master
+ " -t " + params.test
+ (params.doPairwise ? " -doPairwise " : "")

View File

@ -59,11 +59,11 @@ import java.util.Arrays;
public class PairHMMProbabilityBugIntegrationTest extends WalkerTest {
private static final File REFERENCE = new File("/humgen/gsa-hpprojects/GATK/bundle/current/hg19/ucsc.hg19.fasta").getAbsoluteFile();
private static final File BAM = new File ("private/testdata", "pairhmm_prob_bug.bam").getAbsoluteFile();
private static final File INTERVAL = new File ("private/testdata", "pairhmm_prob_bug.interval.bed").getAbsoluteFile();
private static final File BAM = new File (privateTestDir, "pairhmm_prob_bug.bam").getAbsoluteFile();
private static final File INTERVAL = new File (privateTestDir, "pairhmm_prob_bug.interval.bed").getAbsoluteFile();
private static final File UG_BAM = new File("private/testdata", "pairhmm_prob_bug.ug.bam").getAbsoluteFile();
private static final File UG_INTERVAL = new File("private/testdata", "pairhmm_prob_bug.ug.intervals.bed").getAbsoluteFile();
private static final File UG_BAM = new File(privateTestDir, "pairhmm_prob_bug.ug.bam").getAbsoluteFile();
private static final File UG_INTERVAL = new File(privateTestDir, "pairhmm_prob_bug.ug.intervals.bed").getAbsoluteFile();
@Test

View File

@ -185,6 +185,7 @@
<failIfNoTests>false</failIfNoTests>
<!-- Pass various system properties -->
<systemPropertyVariables>
<gatkdir>${gatk.basedir}</gatkdir>
<java.io.tmpdir>${java.io.tmpdir}</java.io.tmpdir>
</systemPropertyVariables>
</configuration>
@ -204,6 +205,9 @@
<includes>
<include>**/*UnitTest.class</include>
</includes>
<systemPropertyVariables>
<testType>unit</testType>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
@ -220,6 +224,7 @@
<failIfNoTests>false</failIfNoTests>
<!-- Pass various system properties -->
<systemPropertyVariables>
<gatkdir>${gatk.basedir}</gatkdir>
<java.io.tmpdir>${java.io.tmpdir}</java.io.tmpdir>
</systemPropertyVariables>
</configuration>
@ -236,6 +241,9 @@
<includes>
<include>**/*IntegrationTest.class</include>
</includes>
<systemPropertyVariables>
<testType>integrationtest</testType>
</systemPropertyVariables>
</configuration>
</execution>
</executions>

View File

@ -91,35 +91,4 @@
</plugins>
</build>
<profiles>
<profile>
<id>private-testdata</id>
<activation>
<file>
<exists>${basedir}/../../private/pom.xml</exists>
</file>
</activation>
<build>
<plugins>
<!-- TODO: All tests require access to private. For now. -->
<plugin>
<groupId>com.pyx4j</groupId>
<artifactId>maven-junction-plugin</artifactId>
<executions>
<execution>
<id>link-private-testdata</id>
<phase>process-test-resources</phase>
</execution>
<execution>
<id>unlink-private-testdata</id>
<phase>clean</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -141,20 +141,6 @@
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.pyx4j</groupId>
<artifactId>maven-junction-plugin</artifactId>
<executions>
<execution>
<id>link-public-qscript</id>
<phase>process-test-resources</phase>
</execution>
<execution>
<id>unlink-public-qscript</id>
<phase>clean</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
@ -179,42 +165,4 @@
</plugins>
</build>
<profiles>
<profile>
<id>private-testdata</id>
<activation>
<file>
<exists>${basedir}/../../private/pom.xml</exists>
</file>
</activation>
<build>
<plugins>
<!-- TODO: All tests require access to private. For now. -->
<plugin>
<groupId>com.pyx4j</groupId>
<artifactId>maven-junction-plugin</artifactId>
<executions>
<execution>
<id>link-private-testdata</id>
<phase>process-test-resources</phase>
</execution>
<execution>
<id>unlink-private-testdata</id>
<phase>clean</phase>
</execution>
<execution>
<id>link-private-qscript</id>
<phase>process-test-resources</phase>
</execution>
<execution>
<id>unlink-private-qscript</id>
<phase>clean</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -36,7 +36,7 @@ class ExampleCountLociQueueTest {
val spec = new QueueTestSpec
spec.name = "countloci"
spec.args = Array(
" -S public/scala/qscript/org/broadinstitute/gatk/queue/qscripts/examples/ExampleCountLoci.scala",
" -S " + QueueTest.publicQScriptsPackageDir + "examples/ExampleCountLoci.scala",
" -R " + BaseTest.publicTestDir + "exampleFASTA.fasta",
" -I " + BaseTest.publicTestDir + "exampleBAM.bam",
" -o " + testOut).mkString

View File

@ -35,7 +35,7 @@ class ExampleCountReadsQueueTest {
val spec = new QueueTestSpec
spec.name = "countreads"
spec.args = Array(
" -S public/scala/qscript/org/broadinstitute/gatk/queue/qscripts/examples/ExampleCountReads.scala",
" -S " + QueueTest.publicQScriptsPackageDir + "examples/ExampleCountReads.scala",
" -R " + BaseTest.publicTestDir + "exampleFASTA.fasta",
" -I " + BaseTest.publicTestDir + "exampleBAM.bam").mkString
QueueTest.executeTest(spec)

View File

@ -59,7 +59,7 @@ class ExamplePrintReadsQueueTest {
val spec = new QueueTestSpec
spec.name = "devnulloutput"
spec.args = Array(
" -S public/scala/qscript/org/broadinstitute/gatk/queue/qscripts/examples/ExamplePrintReads.scala",
" -S " + QueueTest.publicQScriptsPackageDir + "examples/ExamplePrintReads.scala",
" -R " + BaseTest.publicTestDir + "exampleFASTA.fasta",
" -I " + BaseTest.publicTestDir + "exampleBAM.bam",
" -out /dev/null").mkString
@ -72,7 +72,7 @@ class ExamplePrintReadsQueueTest {
val spec = new QueueTestSpec
spec.name = "cleanupbai"
spec.args = Array(
" -S public/scala/qscript/org/broadinstitute/gatk/queue/qscripts/examples/ExamplePrintReads.scala",
" -S " + QueueTest.publicQScriptsPackageDir + "examples/ExamplePrintReads.scala",
" -R " + BaseTest.publicTestDir + "exampleFASTA.fasta",
" -I " + BaseTest.publicTestDir + "exampleBAM.bam",
" -out exampleOut.bam").mkString

View File

@ -83,7 +83,7 @@ class ExampleReadFilterQueueTest {
val spec = new QueueTestSpec
spec.name = "examplereadfilter"
spec.args = Array(
" -S public/scala/qscript/org/broadinstitute/gatk/queue/qscripts/examples/ExampleReadFilter.scala",
" -S " + QueueTest.publicQScriptsPackageDir + "examples/ExampleReadFilter.scala",
" -R " + BaseTest.publicTestDir + "exampleFASTA.fasta",
" -I " + BaseTest.publicTestDir + "exampleBAM.bam").mkString
QueueTest.executeTest(spec)

View File

@ -37,7 +37,7 @@ class ExampleRetryMemoryLimitQueueTest {
val spec = new QueueTestSpec
spec.name = "RetryMemoryLimit"
spec.args = Array(
" -S public/scala/qscript/org/broadinstitute/gatk/queue/qscripts/examples/ExampleRetryMemoryLimit.scala",
" -S " + QueueTest.publicQScriptsPackageDir + "examples/ExampleRetryMemoryLimit.scala",
" -R " + BaseTest.publicTestDir + "exampleFASTA.fasta",
" -I " + BaseTest.publicTestDir + "exampleBAM.bam",
" -retry 1").mkString

View File

@ -33,7 +33,7 @@ class HelloWorldQueueTest {
def testHelloWorld() {
val spec = new QueueTestSpec
spec.name = "HelloWorld"
spec.args = "-S public/scala/qscript/org/broadinstitute/gatk/queue/qscripts/examples/HelloWorld.scala"
spec.args = "-S " + QueueTest.publicQScriptsPackageDir + "examples/HelloWorld.scala"
spec.jobRunners = QueueTest.allJobRunners
QueueTest.executeTest(spec)
}
@ -42,7 +42,7 @@ class HelloWorldQueueTest {
def testHelloWorldWithRunName() {
val spec = new QueueTestSpec
spec.name = "HelloWorldWithRunName"
spec.args = "-S public/scala/qscript/org/broadinstitute/gatk/queue/qscripts/examples/HelloWorld.scala" +
spec.args = "-S " + QueueTest.publicQScriptsPackageDir + "examples/HelloWorld.scala" +
" -runName HelloWorld"
spec.jobRunners = QueueTest.allJobRunners
QueueTest.executeTest(spec)
@ -52,7 +52,7 @@ class HelloWorldQueueTest {
def testHelloWorldWithMemoryLimit() {
val spec = new QueueTestSpec
spec.name = "HelloWorldMemoryLimit"
spec.args = "-S public/scala/qscript/org/broadinstitute/gatk/queue/qscripts/examples/HelloWorld.scala" +
spec.args = "-S " + QueueTest.publicQScriptsPackageDir + "examples/HelloWorld.scala" +
" -memLimit 1.25"
spec.jobRunners = QueueTest.allJobRunners
QueueTest.executeTest(spec)
@ -62,7 +62,7 @@ class HelloWorldQueueTest {
def testHelloWorldWithPriority() {
val spec = new QueueTestSpec
spec.name = "HelloWorldWithPriority"
spec.args = "-S public/scala/qscript/org/broadinstitute/gatk/queue/qscripts/examples/HelloWorld.scala" +
spec.args = "-S " + QueueTest.publicQScriptsPackageDir + "examples/HelloWorld.scala" +
" -jobPriority 100"
spec.jobRunners = QueueTest.allJobRunners
QueueTest.executeTest(spec)
@ -72,7 +72,7 @@ class HelloWorldQueueTest {
def testHelloWorldWithLsfResource() {
val spec = new QueueTestSpec
spec.name = "HelloWorldWithLsfResource"
spec.args = "-S public/scala/qscript/org/broadinstitute/gatk/queue/qscripts/examples/HelloWorld.scala" +
spec.args = "-S " + QueueTest.publicQScriptsPackageDir + "examples/HelloWorld.scala" +
" -jobResReq rusage[iodine_io=1] -jobResReq select[swp>0] -jobResReq order[swp]"
spec.jobRunners = Seq("Lsf706")
QueueTest.executeTest(spec)
@ -82,7 +82,7 @@ class HelloWorldQueueTest {
def testHelloWorldWithLsfResourceAndMemoryLimit() {
val spec = new QueueTestSpec
spec.name = "HelloWorldWithLsfResourceAndMemoryLimit"
spec.args = "-S public/scala/qscript/org/broadinstitute/gatk/queue/qscripts/examples/HelloWorld.scala" +
spec.args = "-S " + QueueTest.publicQScriptsPackageDir + "examples/HelloWorld.scala" +
" -memLimit 1.25 -jobResReq rusage[iodine_io=1] -jobResReq select[swp>0] -jobResReq order[swp]"
spec.jobRunners = Seq("Lsf706")
QueueTest.executeTest(spec)
@ -92,7 +92,7 @@ class HelloWorldQueueTest {
def testHelloWorldWithLsfEnvironment() {
val spec = new QueueTestSpec
spec.name = "HelloWorldWithLsfEnvironment"
spec.args = "-S public/scala/qscript/org/broadinstitute/gatk/queue/qscripts/examples/HelloWorld.scala" +
spec.args = "-S " + QueueTest.publicQScriptsPackageDir + "examples/HelloWorld.scala" +
" -jobEnv tv"
spec.jobRunners = Seq("Lsf706")
QueueTest.executeTest(spec)
@ -102,7 +102,7 @@ class HelloWorldQueueTest {
def testHelloWorldWithGridEngineResource() {
val spec = new QueueTestSpec
spec.name = "HelloWorldWithGridEngineResource"
spec.args = "-S public/scala/qscript/org/broadinstitute/gatk/queue/qscripts/examples/HelloWorld.scala" +
spec.args = "-S " + QueueTest.publicQScriptsPackageDir + "examples/HelloWorld.scala" +
" -jobResReq s_core=1000M"
spec.jobRunners = Seq("GridEngine")
QueueTest.executeTest(spec)
@ -112,7 +112,7 @@ class HelloWorldQueueTest {
def testHelloWorldWithGridEngineResourceAndMemoryLimit() {
val spec = new QueueTestSpec
spec.name = "HelloWorldWithGridEngineResourceAndMemoryLimit"
spec.args = "-S public/scala/qscript/org/broadinstitute/gatk/queue/qscripts/examples/HelloWorld.scala" +
spec.args = "-S " + QueueTest.publicQScriptsPackageDir + "examples/HelloWorld.scala" +
" -memLimit 1.25 -jobResReq s_core=1000M"
spec.jobRunners = Seq("GridEngine")
QueueTest.executeTest(spec)
@ -122,7 +122,7 @@ class HelloWorldQueueTest {
def testHelloWorldWithGridEngineEnvironment() {
val spec = new QueueTestSpec
spec.name = "HelloWorldWithGridEngineEnvironment"
spec.args = "-S public/scala/qscript/org/broadinstitute/gatk/queue/qscripts/examples/HelloWorld.scala" +
spec.args = "-S " + QueueTest.publicQScriptsPackageDir + "examples/HelloWorld.scala" +
" -jobEnv \"make 1\""
spec.jobRunners = Seq("GridEngine")
QueueTest.executeTest(spec)
@ -133,7 +133,7 @@ class HelloWorldQueueTest {
def testHelloWorldWithWalltime() {
val spec = new QueueTestSpec
spec.name = "HelloWorldWithWalltime"
spec.args = "-S public/scala/qscript/org/broadinstitute/gatk/queue/qscripts/examples/HelloWorld.scala" +
spec.args = "-S " + QueueTest.publicQScriptsPackageDir + "examples/HelloWorld.scala" +
" -wallTime 100"
spec.jobRunners = QueueTest.allJobRunners
QueueTest.executeTest(spec)
@ -143,7 +143,7 @@ class HelloWorldQueueTest {
def testHelloWorldWithLogDirectory() {
val spec = new QueueTestSpec
spec.name = "HelloWorldWithLogDirectory"
spec.args = "-S public/scala/qscript/org/broadinstitute/gatk/queue/qscripts/examples/HelloWorld.scala" +
spec.args = "-S " + QueueTest.publicQScriptsPackageDir + "examples/HelloWorld.scala" +
" -logDir pipelineLogDir"
spec.jobRunners = QueueTest.allJobRunners
spec.expectedFilePaths = Seq("pipelineLogDir/HelloWorld-1.out")

View File

@ -60,20 +60,6 @@
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.pyx4j</groupId>
<artifactId>maven-junction-plugin</artifactId>
<executions>
<execution>
<id>link-public-qscript</id>
<phase>process-test-resources</phase>
</execution>
<execution>
<id>unlink-public-qscript</id>
<phase>clean</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
@ -118,42 +104,4 @@
</plugins>
</build>
<profiles>
<profile>
<id>private-testdata</id>
<activation>
<file>
<exists>${basedir}/../../private/pom.xml</exists>
</file>
</activation>
<build>
<plugins>
<!-- TODO: All tests require access to private. For now. -->
<plugin>
<groupId>com.pyx4j</groupId>
<artifactId>maven-junction-plugin</artifactId>
<executions>
<execution>
<id>link-private-testdata</id>
<phase>process-test-resources</phase>
</execution>
<execution>
<id>unlink-private-testdata</id>
<phase>clean</phase>
</execution>
<execution>
<id>link-private-qscript</id>
<phase>process-test-resources</phase>
</execution>
<execution>
<id>unlink-private-qscript</id>
<phase>clean</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -41,6 +41,12 @@ import org.apache.commons.io.filefilter.WildcardFileFilter
object QueueTest extends BaseTest with Logging {
private final val qscriptsSrcDir = "src/main/qscripts/"
private final val qscriptsPackageDir = qscriptsSrcDir + "org/broadinstitute/gatk/queue/qscripts/"
final val publicQScriptsPackageDir = BaseTest.gatkDirectory + "public/gatk-queue-extensions-public/" + qscriptsPackageDir
final val protectedQScriptsPackageDir = BaseTest.gatkDirectory + "protected/gatk-queue-extensions-distribution/" + qscriptsPackageDir
final val privateQScriptsPackageDir = BaseTest.gatkDirectory + "private/gatk-queue-extensions-internal/" + qscriptsPackageDir
private val validationReportsDataLocation = "/humgen/gsa-hpprojects/GATK/validationreports/submitted/"
private val md5DB = new MD5DB()

View File

@ -401,6 +401,7 @@
</property>
</properties>
<systemPropertyVariables>
<gatkdir>${gatk.basedir}</gatkdir>
<clover.pertest.coverage>diff</clover.pertest.coverage>
<java.awt.headless>true</java.awt.headless>
<java.io.tmpdir>${java.io.tmpdir}</java.io.tmpdir>
@ -424,6 +425,9 @@
<includes>
<include>**/*UnitTest.class</include>
</includes>
<systemPropertyVariables>
<testType>unit</testType>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
@ -451,6 +455,7 @@
</property>
</properties>
<systemPropertyVariables>
<gatkdir>${gatk.basedir}</gatkdir>
<clover.pertest.coverage>diff</clover.pertest.coverage>
<java.awt.headless>true</java.awt.headless>
<!-- TODO: Fix BaseTest to not error out if this property is missing. -->
@ -474,6 +479,9 @@
<includes>
<include>**/*IntegrationTest.class</include>
</includes>
<systemPropertyVariables>
<testType>integration</testType>
</systemPropertyVariables>
</configuration>
</execution>
<execution>
@ -491,6 +499,9 @@
<includes>
<include>**/*QueueTest.class</include>
</includes>
<systemPropertyVariables>
<testType>queue</testType>
</systemPropertyVariables>
</configuration>
</execution>
<execution>
@ -507,6 +518,9 @@
<includes>
<include>**/*LargeScaleTest.class</include>
</includes>
<systemPropertyVariables>
<testType>largescale</testType>
</systemPropertyVariables>
</configuration>
</execution>
<execution>
@ -523,6 +537,9 @@
<includes>
<include>**/*KnowledgeBaseTest.class</include>
</includes>
<systemPropertyVariables>
<testType>knowledgebasetests</testType>
</systemPropertyVariables>
</configuration>
</execution>
</executions>

View File

@ -78,34 +78,4 @@
</plugins>
</build>
<profiles>
<profile>
<id>private-testdata</id>
<activation>
<file>
<exists>${basedir}/../../private/pom.xml</exists>
</file>
</activation>
<build>
<plugins>
<!-- TODO: All tests require access to private. For now. -->
<plugin>
<groupId>com.pyx4j</groupId>
<artifactId>maven-junction-plugin</artifactId>
<executions>
<execution>
<id>link-private-testdata</id>
<phase>process-test-resources</phase>
</execution>
<execution>
<id>unlink-private-testdata</id>
<phase>clean</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -207,7 +207,7 @@ public class EngineFeaturesIntegrationTest extends WalkerTest {
}
private void testBadCompressArgument(final int compress) {
WalkerTestSpec spec = new WalkerTestSpec("-T PrintReads -R " + b37KGReference + " -I private/testdata/NA12878.1_10mb_2_10mb.bam -o %s -compress " + compress,
WalkerTestSpec spec = new WalkerTestSpec("-T PrintReads -R " + b37KGReference + " -I " + privateTestDir + "NA12878.1_10mb_2_10mb.bam -o %s -compress " + compress,
1, UserException.class);
executeTest("badCompress " + compress, spec);
}

View File

@ -74,8 +74,8 @@ public class GenomeAnalysisEngineUnitTest extends BaseTest {
GenomeAnalysisEngine testEngine = new GenomeAnalysisEngine();
Collection<SAMReaderID> samFiles = new ArrayList<SAMReaderID>();
samFiles.add(new SAMReaderID(new File("public/testdata/exampleBAM.bam"), new Tags()));
samFiles.add(new SAMReaderID(new File("public/testdata/exampleBAM.bam"), new Tags()));
samFiles.add(new SAMReaderID(new File(publicTestDir + "exampleBAM.bam"), new Tags()));
samFiles.add(new SAMReaderID(new File(publicTestDir + "exampleBAM.bam"), new Tags()));
testEngine.setSAMFileIDs(samFiles);
testEngine.checkForDuplicateSamFiles();
@ -86,10 +86,10 @@ public class GenomeAnalysisEngineUnitTest extends BaseTest {
GenomeAnalysisEngine testEngine = new GenomeAnalysisEngine();
Collection<SAMReaderID> samFiles = new ArrayList<SAMReaderID>();
samFiles.add(new SAMReaderID(new File("public/testdata/exampleBAM.bam"), new Tags()));
samFiles.add(new SAMReaderID(new File("public/testdata/exampleNORG.bam"), new Tags()));
samFiles.add(new SAMReaderID(new File("public/testdata/exampleBAM.bam"), new Tags()));
samFiles.add(new SAMReaderID(new File("public/testdata/exampleNORG.bam"), new Tags()));
samFiles.add(new SAMReaderID(new File(publicTestDir + "exampleBAM.bam"), new Tags()));
samFiles.add(new SAMReaderID(new File(publicTestDir + "exampleNORG.bam"), new Tags()));
samFiles.add(new SAMReaderID(new File(publicTestDir + "exampleBAM.bam"), new Tags()));
samFiles.add(new SAMReaderID(new File(publicTestDir + "exampleNORG.bam"), new Tags()));
testEngine.setSAMFileIDs(samFiles);
testEngine.checkForDuplicateSamFiles();
@ -99,7 +99,7 @@ public class GenomeAnalysisEngineUnitTest extends BaseTest {
public void testDuplicateSamFileHandlingAbsoluteVsRelativePath() {
GenomeAnalysisEngine testEngine = new GenomeAnalysisEngine();
final File relativePathToBAMFile = new File("public/testdata/exampleBAM.bam");
final File relativePathToBAMFile = new File(publicTestDir + "exampleBAM.bam");
final File absolutePathToBAMFile = new File(relativePathToBAMFile.getAbsolutePath());
Collection<SAMReaderID> samFiles = new ArrayList<SAMReaderID>();
samFiles.add(new SAMReaderID(relativePathToBAMFile, new Tags()));

View File

@ -38,7 +38,7 @@ public class SAMReaderIDUnitTest extends BaseTest {
public void testSAMReaderIDHashingAndEquality() {
// Test to make sure that two SAMReaderIDs that point at the same file via an absolute vs. relative
// path are equal according to equals() and have the same hash code
final File relativePathToBAMFile = new File("public/testdata/exampleBAM.bam");
final File relativePathToBAMFile = new File(publicTestDir + "exampleBAM.bam");
final File absolutePathToBAMFile = new File(relativePathToBAMFile.getAbsolutePath());
final SAMReaderID relativePathSAMReaderID = new SAMReaderID(relativePathToBAMFile, new Tags());
final SAMReaderID absolutePathSAMReaderID = new SAMReaderID(absolutePathToBAMFile, new Tags());

View File

@ -43,6 +43,10 @@ import java.io.IOException;
public class CatVariantsIntegrationTest {
private final MD5DB md5db = new MD5DB();
private final File CatVariantsDir = new File(BaseTest.privateTestDir, "CatVariants");
private final File CatVariantsVcf1 = new File(CatVariantsDir, "CatVariantsTest1.vcf");
private final File CatVariantsVcf2 = new File(CatVariantsDir, "CatVariantsTest2.vcf");
private final File CatVariantsBcf1 = new File(CatVariantsDir, "CatVariantsTest1.bcf");
private final File CatVariantsBcf2 = new File(CatVariantsDir, "CatVariantsTest2.bcf");
private class CatVariantsTestProvider extends BaseTest.TestDataProvider {
private final File file1;
@ -50,11 +54,11 @@ public class CatVariantsIntegrationTest {
public final File outputFile;
public final String md5;
private CatVariantsTestProvider(final String file1, final String file2, final File outputFile, final String md5) {
private CatVariantsTestProvider(final File file1, final File file2, final File outputFile, final String md5) {
super(CatVariantsTestProvider.class);
this.file1 = new File(CatVariantsDir, file1);
this.file2 = new File(CatVariantsDir, file2);
this.file1 = file1;
this.file2 = file2;
this.outputFile = outputFile;
this.md5 = md5;
}
@ -72,16 +76,23 @@ public class CatVariantsIntegrationTest {
@DataProvider(name = "ExtensionsTest")
public Object[][] makeExtensionsTestProvider() {
new CatVariantsTestProvider("CatVariantsTest1.vcf", "CatVariantsTest2.vcf", BaseTest.createTempFile("CatVariantsTest", ".vcf"), "d0d81eb7fd3905256c4ac7c0fc480094");
new CatVariantsTestProvider("CatVariantsTest1.bcf", "CatVariantsTest2.bcf", BaseTest.createTempFile("CatVariantsTest", ".bcf"), "6a57fcbbf3cae490896d13a288670d83");
final File catVariantsTempList1 = BaseTest.createTempListFile("CatVariantsTest1", CatVariantsVcf1.getAbsolutePath());
final File catVariantsTempList2 = BaseTest.createTempListFile("CatVariantsTest2", CatVariantsVcf2.getAbsolutePath());
for (String extension : AbstractFeatureReader.BLOCK_COMPRESSED_EXTENSIONS)
new CatVariantsTestProvider("CatVariantsTest1.vcf" + extension, "CatVariantsTest2.vcf" + extension, BaseTest.createTempFile("CatVariantsTest", ".vcf" + extension), "33f728ac5c70ce2994f3619a27f47088");
new CatVariantsTestProvider(CatVariantsVcf1, CatVariantsVcf2, BaseTest.createTempFile("CatVariantsTest", ".vcf"), "d0d81eb7fd3905256c4ac7c0fc480094");
new CatVariantsTestProvider(CatVariantsBcf1, CatVariantsBcf2, BaseTest.createTempFile("CatVariantsTest", ".bcf"), "6a57fcbbf3cae490896d13a288670d83");
for (String extension : AbstractFeatureReader.BLOCK_COMPRESSED_EXTENSIONS) {
final File file1 = new File(CatVariantsDir, "CatVariantsTest1.vcf" + extension);
final File file2 = new File(CatVariantsDir, "CatVariantsTest2.vcf" + extension);
final File outputFile = BaseTest.createTempFile("CatVariantsTest", ".vcf" + extension);
new CatVariantsTestProvider(file1, file2, outputFile, "33f728ac5c70ce2994f3619a27f47088");
}
//Test list parsing functionality
new CatVariantsTestProvider("CatVariantsTest1.list", "CatVariantsTest2.vcf", BaseTest.createTempFile("CatVariantsTest", ".vcf"), "d0d81eb7fd3905256c4ac7c0fc480094");
new CatVariantsTestProvider("CatVariantsTest1.vcf", "CatVariantsTest2.list", BaseTest.createTempFile("CatVariantsTest", ".vcf"), "d0d81eb7fd3905256c4ac7c0fc480094");
new CatVariantsTestProvider("CatVariantsTest1.list", "CatVariantsTest2.list", BaseTest.createTempFile("CatVariantsTest", ".vcf"), "d0d81eb7fd3905256c4ac7c0fc480094");
new CatVariantsTestProvider(catVariantsTempList1, CatVariantsVcf2, BaseTest.createTempFile("CatVariantsTest", ".vcf"), "d0d81eb7fd3905256c4ac7c0fc480094");
new CatVariantsTestProvider(CatVariantsVcf1, catVariantsTempList2, BaseTest.createTempFile("CatVariantsTest", ".vcf"), "d0d81eb7fd3905256c4ac7c0fc480094");
new CatVariantsTestProvider(catVariantsTempList1, catVariantsTempList2, BaseTest.createTempFile("CatVariantsTest", ".vcf"), "d0d81eb7fd3905256c4ac7c0fc480094");
return CatVariantsTestProvider.getTests(CatVariantsTestProvider.class);
}
@ -107,8 +118,8 @@ public class CatVariantsIntegrationTest {
StringUtils.join(RuntimeUtils.getAbsoluteClassPaths(), File.pathSeparatorChar),
CatVariants.class.getCanonicalName(),
BaseTest.b37KGReference,
new File(CatVariantsDir, "CatVariantsTest1.vcf"),
new File(CatVariantsDir, "CatVariantsTest2.vcf"),
CatVariantsVcf1,
CatVariantsVcf2,
BaseTest.createTempFile("CatVariantsTest", ".bcf"));
ProcessController pc = ProcessController.getThreadLocal();
@ -123,8 +134,8 @@ public class CatVariantsIntegrationTest {
StringUtils.join(RuntimeUtils.getAbsoluteClassPaths(), File.pathSeparatorChar),
CatVariants.class.getCanonicalName(),
BaseTest.b37KGReference,
new File(CatVariantsDir, "CatVariantsTest1.vcf"),
new File(CatVariantsDir, "CatVariantsTest2.bcf"),
CatVariantsVcf1,
CatVariantsBcf2,
BaseTest.createTempFile("CatVariantsTest", ".vcf"));
ProcessController pc = ProcessController.getThreadLocal();

View File

@ -32,7 +32,6 @@ import java.util.Arrays;
public class CallableLociIntegrationTest extends WalkerTest {
final static String commonArgs = "-R " + b36KGReference + " -T CallableLoci -I " + validationDataLocation + "/NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -o %s";
final static String reduceReadArgs = "-R " + b37KGReference + " -T CallableLoci -I " + " private/testdata/NA12878.HiSeq.b37.chr20.10_11mb.reduced.bam -o %s";
final static String SUMMARY_MD5 = "a6f5963669f19d9d137ced87d65834b0";

View File

@ -53,6 +53,7 @@ import org.testng.SkipException;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;
/**
@ -87,6 +88,12 @@ public abstract class BaseTest {
/** our log, which we want to capture anything from org.broadinstitute.sting */
public static final Logger logger = CommandLineUtils.getStingLogger();
private static final String CURRENT_DIRECTORY = System.getProperty("user.dir");
public static final String gatkDirectory = System.getProperty("gatkdir", CURRENT_DIRECTORY) + "/";
public static final String baseDirectory = System.getProperty("basedir", CURRENT_DIRECTORY) + "/";
public static final String testType = System.getProperty("testType"); // May be null
public static final String testTypeSubDirectory = testType == null ? "" : ("/" + testType); // May be empty
public static final String hg18Reference = "/seq/references/Homo_sapiens_assembly18/v0/Homo_sapiens_assembly18.fasta";
public static final String hg19Reference = "/seq/references/Homo_sapiens_assembly19/v1/Homo_sapiens_assembly19.fasta";
public static final String b36KGReference = "/humgen/1kg/reference/human_b36_both.fasta";
@ -123,12 +130,12 @@ public abstract class BaseTest {
private static final boolean networkTempDirRootExists = new File(networkTempDirRoot).exists();
private static final File networkTempDirFile;
private static final String privateTestDirRelative = "private/testdata/";
public static final String privateTestDir = new File(privateTestDirRelative).getAbsolutePath() + "/";
private static final String privateTestDirRelative = "private/gatk-tools-private/src/test/resources/";
public static final String privateTestDir = new File(gatkDirectory, privateTestDirRelative).getAbsolutePath() + "/";
protected static final String privateTestDirRoot = privateTestDir.replace(privateTestDirRelative, "");
private static final String publicTestDirRelative = "public/testdata/";
public static final String publicTestDir = new File(publicTestDirRelative).getAbsolutePath() + "/";
private static final String publicTestDirRelative = "public/gatk-engine/src/test/resources/";
public static final String publicTestDir = new File(gatkDirectory, publicTestDirRelative).getAbsolutePath() + "/";
protected static final String publicTestDirRoot = publicTestDir.replace(publicTestDirRelative, "");
public static final String keysDataLocation = validationDataLocation + "keys/";
@ -307,6 +314,28 @@ public abstract class BaseTest {
}
}
/**
* Creates a temp list file that will be deleted on exit after tests are complete.
* @param tempFilePrefix Prefix of the file.
* @param lines lines to write to the file.
* @return A list file in the temporary directory starting with tempFilePrefix, which will be deleted after the program exits.
*/
public static File createTempListFile(final String tempFilePrefix, final String... lines) {
try {
final File tempListFile = createTempFile(tempFilePrefix, ".list");
final PrintWriter out = new PrintWriter(tempListFile);
for (final String line : lines) {
out.println(line);
}
out.close();
return tempListFile;
} catch (IOException ex) {
throw new ReviewedGATKException("Cannot create temp file: " + ex.getMessage(), ex);
}
}
/**
* Creates a temp file that will be deleted on exit after tests are complete.
* @param name Name of the file.

View File

@ -302,7 +302,7 @@ public class MD5DB {
if ( success ) {
diffEngineOutput = baos.toString();
BaseTest.log(diffEngineOutput);
System.out.printf("Note that the above list is not comprehensive. At most 20 lines of output, and 10 specific differences will be listed. Please use -T DiffObjects -R public/testdata/exampleFASTA.fasta -m %s -t %s to explore the differences more freely%n",
System.out.printf("Note that the above list is not comprehensive. At most 20 lines of output, and 10 specific differences will be listed. Please use -T DiffObjects -R " + BaseTest.publicTestDir + "exampleFASTA.fasta -m %s -t %s to explore the differences more freely%n",
pathToExpectedMD5File, pathToFileMD5File);
}
ps.close();

View File

@ -176,7 +176,7 @@ public class ArgumentTypeDescriptorUnitTest extends BaseTest {
final ParsingEngine parser = new ParsingEngine(new ATDTestCommandLineProgram());
//A list file containing a single VCF
final File listFile = new File(privateTestDir+"oneVCF.list");
final File listFile = createTempListFile("oneVCF", privateTestDir + "empty.vcf");
try {
Object result = ArgumentTypeDescriptor.getRodBindingsCollection(listFile,
@ -197,8 +197,7 @@ public class ArgumentTypeDescriptorUnitTest extends BaseTest {
}
//The same file, now with an extra blank line
final File listFileWithBlank = new File(privateTestDir+"oneVCFwithBlankLine.list");
final File listFileWithBlank = createTempListFile("oneVCFwithBlankLine", privateTestDir + "empty.vcf", "");
try {
Object result = ArgumentTypeDescriptor.getRodBindingsCollection(listFileWithBlank,
parser,

View File

@ -933,9 +933,8 @@ public class ParsingEngineUnitTest extends BaseTest {
@Test
public void argumentListTest() throws IOException {
File argsFile = BaseTest.createTempFile("args.", ".list");
File argsFile = BaseTest.createTempListFile("args.", "-I na12878.bam");
try {
FileUtils.write(argsFile, "-I na12878.bam");
final String[] commandLine = new String[] {"-args", argsFile.getPath()};
parsingEngine.addArgumentSource(InputFileArgProvider.class);
parsingEngine.parse(commandLine);

View File

@ -44,7 +44,7 @@ public class RodBindingCollectionUnitTest extends BaseTest {
private static final String defaultTagString = "VCF";
private static final String testVCFFileName = privateTestDir + "empty.vcf";
private static final String testListFileName = privateTestDir + "oneVCF.list";
private static final String testListFileName = createTempListFile("oneVCF", testVCFFileName).getAbsolutePath();
@BeforeMethod
public void setUp() {
@ -84,16 +84,13 @@ public class RodBindingCollectionUnitTest extends BaseTest {
final RodBindingCollectionArgProvider argProvider = new RodBindingCollectionArgProvider();
parsingEngine.loadArgumentsIntoObject( argProvider );
Assert.assertEquals(argProvider.input.getRodBindings().iterator().next().getSource(), "private/testdata/empty.vcf", "Argument is not correctly initialized");
Assert.assertEquals(argProvider.input.getRodBindings().iterator().next().getSource(), testVCFFileName, "Argument is not correctly initialized");
}
@Test
public void testDefaultTagsInFile() throws IOException {
final File testFile = createTempFile("RodBindingCollectionUnitTest.defaultTags", ".list");
final FileWriter writer = new FileWriter(testFile);
writer.write(testVCFFileName, 0, testVCFFileName.length());
writer.close();
final File testFile = createTempListFile("RodBindingCollectionUnitTest.defaultTags", testVCFFileName);
ArgumentTypeDescriptor.getRodBindingsCollection(testFile, parsingEngine, VariantContext.class, "foo", mytags, "input");
@ -108,29 +105,21 @@ public class RodBindingCollectionUnitTest extends BaseTest {
@Test(expectedExceptions = UserException.BadArgumentValue.class)
public void testDuplicateEntriesInFile() throws IOException {
final File testFile = createTempFile("RodBindingCollectionUnitTest.variantListWithDuplicates", ".list");
final FileWriter writer = new FileWriter(testFile);
writer.write(testVCFFileName + "\n");
writer.write(testVCFFileName + "\n");
writer.close();
final File testFile = createTempListFile("RodBindingCollectionUnitTest.variantListWithDuplicates", testVCFFileName, testVCFFileName);
ArgumentTypeDescriptor.getRodBindingsCollection(testFile, parsingEngine, VariantContext.class, "foo", mytags, "input");
}
@Test(expectedExceptions = UserException.BadArgumentValue.class)
public void testValidateEmptyFile() throws IOException {
final File testFile = createTempFile("RodBindingCollectionUnitTest.emptyVCFList", ".list");
final File testFile = createTempListFile("RodBindingCollectionUnitTest.emptyVCFList");
ArgumentTypeDescriptor.getRodBindingsCollection(testFile, parsingEngine, VariantContext.class, "foo", mytags, "input");
}
@Test
public void testOverrideTagsInFile() throws IOException {
final File testFile = createTempFile("RodBindingCollectionUnitTest.overrideTags", ".list");
final FileWriter writer = new FileWriter(testFile);
final String textToWrite = "foo " + testVCFFileName;
writer.write(textToWrite, 0, textToWrite.length());
writer.close();
final File testFile = createTempListFile("RodBindingCollectionUnitTest.overrideTags", "foo " + testVCFFileName);
ArgumentTypeDescriptor.getRodBindingsCollection(testFile, parsingEngine, VariantContext.class, "foo", mytags, "input");

View File

@ -1043,7 +1043,7 @@ public class IntervalUtilsUnitTest extends BaseTest {
@DataProvider(name="invalidIntervalTestData")
public Object[][] invalidIntervalDataProvider() throws Exception {
GATKArgumentCollection argCollection = new GATKArgumentCollection();
File fastaFile = new File("public/testdata/exampleFASTA.fasta");
File fastaFile = new File(publicTestDir + "exampleFASTA.fasta");
GenomeLocParser genomeLocParser = new GenomeLocParser(new IndexedFastaSequenceFile(fastaFile));
return new Object[][] {

View File

@ -47,12 +47,12 @@ public class ListFileUtilsUnitTest extends BaseTest {
public void testIgnoreBlankLinesInBAMListFiles() throws Exception {
File tempListFile = createTempListFile("testIgnoreBlankLines",
"",
"public/testdata/exampleBAM.bam",
publicTestDir + "exampleBAM.bam",
" "
);
List<SAMReaderID> expectedBAMFileListAfterUnpacking = new ArrayList<SAMReaderID>();
expectedBAMFileListAfterUnpacking.add(new SAMReaderID(new File("public/testdata/exampleBAM.bam"), new Tags()));
expectedBAMFileListAfterUnpacking.add(new SAMReaderID(new File(publicTestDir + "exampleBAM.bam"), new Tags()));
performBAMListFileUnpackingTest(tempListFile, expectedBAMFileListAfterUnpacking);
}
@ -61,30 +61,30 @@ public class ListFileUtilsUnitTest extends BaseTest {
public void testCommentSupportInBAMListFiles() throws Exception {
File tempListFile = createTempListFile("testCommentSupport",
"#",
"public/testdata/exampleBAM.bam",
"#public/testdata/foo.bam",
" # public/testdata/bar.bam"
publicTestDir + "exampleBAM.bam",
"#" + publicTestDir + "foo.bam",
" # " + publicTestDir + "bar.bam"
);
List<SAMReaderID> expectedBAMFileListAfterUnpacking = new ArrayList<SAMReaderID>();
expectedBAMFileListAfterUnpacking.add(new SAMReaderID(new File("public/testdata/exampleBAM.bam"), new Tags()));
expectedBAMFileListAfterUnpacking.add(new SAMReaderID(new File(publicTestDir + "exampleBAM.bam"), new Tags()));
performBAMListFileUnpackingTest(tempListFile, expectedBAMFileListAfterUnpacking);
}
@Test
public void testUnpackSet() throws Exception {
Set<String> expected = new HashSet<String>(Arrays.asList("public/testdata/exampleBAM.bam"));
Set<String> expected = new HashSet<String>(Arrays.asList(publicTestDir + "exampleBAM.bam"));
Set<String> actual;
actual = ListFileUtils.unpackSet(Arrays.asList("public/testdata/exampleBAM.bam"));
actual = ListFileUtils.unpackSet(Arrays.asList(publicTestDir + "exampleBAM.bam"));
Assert.assertEquals(actual, expected);
File tempListFile = createTempListFile("testUnpackSet",
"#",
"public/testdata/exampleBAM.bam",
"#public/testdata/foo.bam",
" # public/testdata/bar.bam"
publicTestDir + "exampleBAM.bam",
"#" + publicTestDir + "foo.bam",
" # " + publicTestDir + "bar.bam"
);
actual = ListFileUtils.unpackSet(Arrays.asList(tempListFile.getAbsolutePath()));
Assert.assertEquals(actual, expected);
@ -142,18 +142,6 @@ public class ListFileUtilsUnitTest extends BaseTest {
return new HashSet<T>(Arrays.asList(args));
}
private File createTempListFile( String tempFilePrefix, String... lines ) throws Exception {
File tempListFile = createTempFile(tempFilePrefix, ".list");
PrintWriter out = new PrintWriter(tempListFile);
for ( String line : lines ) {
out.println(line);
}
out.close();
return tempListFile;
}
private void performBAMListFileUnpackingTest( File tempListFile, List<SAMReaderID> expectedUnpackedFileList ) throws Exception {
List<String> bamFiles = new ArrayList<String>();
bamFiles.add(tempListFile.getAbsolutePath());

View File

@ -189,33 +189,4 @@
</plugins>
</build>
<profiles>
<profile>
<id>private-testdata</id>
<activation>
<file>
<exists>${basedir}/../../private/pom.xml</exists>
</file>
</activation>
<build>
<plugins>
<!-- TODO: All tests require access to private. For now. -->
<plugin>
<groupId>com.pyx4j</groupId>
<artifactId>maven-junction-plugin</artifactId>
<executions>
<execution>
<id>link-private-testdata</id>
<phase>process-test-resources</phase>
</execution>
<execution>
<id>unlink-private-testdata</id>
<phase>clean</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>