From fcb0eca203eee27a81e2c39767458950d17570ba Mon Sep 17 00:00:00 2001 From: Khalid Shakir Date: Mon, 1 Sep 2014 18:15:19 +0800 Subject: [PATCH] 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. --- pom.xml | 175 +----------------- protected/gatk-package-distribution/pom.xml | 27 --- .../pom.xml | 56 ------ .../ExampleUnifiedGenotyperQueueTest.scala | 45 ++--- .../gatk-queue-package-distribution/pom.xml | 35 ---- protected/gatk-tools-protected/pom.xml | 30 --- .../DiffObjectsIntegrationTest.java | 3 +- .../PairHMMProbabilityBugIntegrationTest.java | 8 +- public/external-example/pom.xml | 8 + public/gatk-engine/pom.xml | 31 ---- public/gatk-queue-extensions-public/pom.xml | 52 ------ .../examples/ExampleCountLociQueueTest.scala | 2 +- .../examples/ExampleCountReadsQueueTest.scala | 2 +- .../examples/ExamplePrintReadsQueueTest.scala | 4 +- .../examples/ExampleReadFilterQueueTest.scala | 2 +- .../ExampleRetryMemoryLimitQueueTest.scala | 2 +- .../examples/HelloWorldQueueTest.scala | 24 +-- public/gatk-queue/pom.xml | 52 ------ .../gatk/queue/pipeline/QueueTest.scala | 6 + public/gatk-root/pom.xml | 17 ++ public/gatk-tools-public/pom.xml | 30 --- .../engine/EngineFeaturesIntegrationTest.java | 2 +- .../engine/GenomeAnalysisEngineUnitTest.java | 14 +- .../reads/SAMReaderIDUnitTest.java | 2 +- .../tools/CatVariantsIntegrationTest.java | 39 ++-- .../coverage/CallableLociIntegrationTest.java | 1 - .../broadinstitute/gatk/utils/BaseTest.java | 37 +++- .../org/broadinstitute/gatk/utils/MD5DB.java | 2 +- .../ArgumentTypeDescriptorUnitTest.java | 5 +- .../commandline/ParsingEngineUnitTest.java | 3 +- .../RodBindingCollectionUnitTest.java | 23 +-- .../utils/interval/IntervalUtilsUnitTest.java | 2 +- .../utils/text/ListFileUtilsUnitTest.java | 34 ++-- public/gatk-utils/pom.xml | 29 --- 34 files changed, 172 insertions(+), 632 deletions(-) diff --git a/pom.xml b/pom.xml index 9b38f6aca..c09fdf4be 100644 --- a/pom.xml +++ b/pom.xml @@ -412,131 +412,10 @@ - com.pyx4j maven-junction-plugin - - link-public-testdata - - link - - none - - - - ${basedir}/public/testdata - ${gatk.basedir}/public/gatk-engine/src/test/resources - - - - - - unlink-public-testdata - - unlink - - none - - - - ${basedir}/public/testdata - ${gatk.basedir}/public/gatk-engine/src/test/resources - - - - - - link-private-testdata - - link - - none - - - - ${basedir}/private/testdata - ${gatk.basedir}/private/gatk-tools-private/src/test/resources - - - - - - unlink-private-testdata - - unlink - - none - - - - ${basedir}/private/testdata - ${gatk.basedir}/private/gatk-tools-private/src/test/resources - - - - - - link-public-qscript - - link - - none - - - - ${basedir}/public/scala/qscript - ${gatk.basedir}/public/gatk-queue-extensions-public/src/main/qscripts - - - - - - unlink-public-qscript - - unlink - - none - - - - ${basedir}/public/scala/qscript - ${gatk.basedir}/public/gatk-queue-extensions-public/src/main/qscripts - - - - - - link-private-qscript - - link - - none - - - - ${basedir}/private/scala/qscript - ${gatk.basedir}/private/gatk-queue-extensions-internal/src/main/qscripts - - - - - - unlink-private-qscript - - unlink - - none - - - - ${basedir}/private/scala/qscript - ${gatk.basedir}/private/gatk-queue-extensions-internal/src/main/qscripts - - - - delete-mavens-links exec @@ -762,28 +646,6 @@ org.apache.maven.plugins maven-failsafe-plugin - - com.pyx4j - maven-junction-plugin - - - link-public-testdata - process-test-resources - - - unlink-public-testdata - clean - - - link-public-qscript - process-test-resources - - - unlink-public-qscript - clean - - - org.apache.maven.plugins maven-clean-plugin @@ -869,33 +731,6 @@ private - - - - - com.pyx4j - maven-junction-plugin - - - link-private-testdata - process-test-resources - - - unlink-private-testdata - clean - - - link-private-qscript - process-test-resources - - - unlink-private-qscript - clean - - - - - diff --git a/protected/gatk-package-distribution/pom.xml b/protected/gatk-package-distribution/pom.xml index b2bc401b6..b08906f74 100644 --- a/protected/gatk-package-distribution/pom.xml +++ b/protected/gatk-package-distribution/pom.xml @@ -231,33 +231,6 @@ - - private-testdata - - - ${basedir}/../../private/pom.xml - - - - - - - com.pyx4j - maven-junction-plugin - - - link-private-testdata - process-test-resources - - - unlink-private-testdata - clean - - - - - - packagetests-enabled diff --git a/protected/gatk-queue-extensions-distribution/pom.xml b/protected/gatk-queue-extensions-distribution/pom.xml index a6f503445..dffe2a6f5 100644 --- a/protected/gatk-queue-extensions-distribution/pom.xml +++ b/protected/gatk-queue-extensions-distribution/pom.xml @@ -134,24 +134,6 @@ org.scala-tools maven-scala-plugin - - com.pyx4j - maven-junction-plugin - - - link-public-qscript - process-test-resources - - - unlink-public-qscript - clean - - - link-extensions-sources - generate-sources - - - org.apache.maven.plugins maven-invoker-plugin @@ -176,42 +158,4 @@ - - - private-testdata - - - ${basedir}/../../private/pom.xml - - - - - - - com.pyx4j - maven-junction-plugin - - - link-private-testdata - process-test-resources - - - unlink-private-testdata - clean - - - link-private-qscript - process-test-resources - - - unlink-private-qscript - clean - - - - - - - - diff --git a/protected/gatk-queue-extensions-distribution/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/ExampleUnifiedGenotyperQueueTest.scala b/protected/gatk-queue-extensions-distribution/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/ExampleUnifiedGenotyperQueueTest.scala index ad3ded3b0..65fc7e66e 100644 --- a/protected/gatk-queue-extensions-distribution/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/ExampleUnifiedGenotyperQueueTest.scala +++ b/protected/gatk-queue-extensions-distribution/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/ExampleUnifiedGenotyperQueueTest.scala @@ -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" diff --git a/protected/gatk-queue-package-distribution/pom.xml b/protected/gatk-queue-package-distribution/pom.xml index 770c39755..c5c038b0d 100644 --- a/protected/gatk-queue-package-distribution/pom.xml +++ b/protected/gatk-queue-package-distribution/pom.xml @@ -238,41 +238,6 @@ - - private-testdata - - - ${basedir}/../../private/pom.xml - - - - - - com.pyx4j - maven-junction-plugin - - - - link-private-testdata - process-test-resources - - - unlink-private-testdata - clean - - - link-private-qscript - process-test-resources - - - unlink-private-qscript - clean - - - - - - packagetests-enabled diff --git a/protected/gatk-tools-protected/pom.xml b/protected/gatk-tools-protected/pom.xml index ab5072d3a..4cd7dc54f 100644 --- a/protected/gatk-tools-protected/pom.xml +++ b/protected/gatk-tools-protected/pom.xml @@ -107,34 +107,4 @@ - - - private-testdata - - - ${basedir}/../../private/pom.xml - - - - - - - com.pyx4j - maven-junction-plugin - - - link-private-testdata - process-test-resources - - - unlink-private-testdata - clean - - - - - - - - diff --git a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/engine/walkers/diffengine/DiffObjectsIntegrationTest.java b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/engine/walkers/diffengine/DiffObjectsIntegrationTest.java index 7cc7a28a0..dbaf95bec 100644 --- a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/engine/walkers/diffengine/DiffObjectsIntegrationTest.java +++ b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/engine/walkers/diffengine/DiffObjectsIntegrationTest.java @@ -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 " : "") diff --git a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/utils/pairhmm/PairHMMProbabilityBugIntegrationTest.java b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/utils/pairhmm/PairHMMProbabilityBugIntegrationTest.java index 383ecf1e7..de893a515 100644 --- a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/utils/pairhmm/PairHMMProbabilityBugIntegrationTest.java +++ b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/utils/pairhmm/PairHMMProbabilityBugIntegrationTest.java @@ -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 diff --git a/public/external-example/pom.xml b/public/external-example/pom.xml index 8c50c6651..2cd81be69 100644 --- a/public/external-example/pom.xml +++ b/public/external-example/pom.xml @@ -185,6 +185,7 @@ false + ${gatk.basedir} ${java.io.tmpdir} @@ -204,6 +205,9 @@ **/*UnitTest.class + + unit + @@ -220,6 +224,7 @@ false + ${gatk.basedir} ${java.io.tmpdir} @@ -236,6 +241,9 @@ **/*IntegrationTest.class + + integrationtest + diff --git a/public/gatk-engine/pom.xml b/public/gatk-engine/pom.xml index 4d837a4db..bff4f9cbd 100644 --- a/public/gatk-engine/pom.xml +++ b/public/gatk-engine/pom.xml @@ -91,35 +91,4 @@ - - - - private-testdata - - - ${basedir}/../../private/pom.xml - - - - - - - com.pyx4j - maven-junction-plugin - - - link-private-testdata - process-test-resources - - - unlink-private-testdata - clean - - - - - - - - diff --git a/public/gatk-queue-extensions-public/pom.xml b/public/gatk-queue-extensions-public/pom.xml index 6a106439c..3d838f777 100644 --- a/public/gatk-queue-extensions-public/pom.xml +++ b/public/gatk-queue-extensions-public/pom.xml @@ -141,20 +141,6 @@ org.scala-tools maven-scala-plugin - - com.pyx4j - maven-junction-plugin - - - link-public-qscript - process-test-resources - - - unlink-public-qscript - clean - - - org.apache.maven.plugins maven-invoker-plugin @@ -179,42 +165,4 @@ - - - private-testdata - - - ${basedir}/../../private/pom.xml - - - - - - - com.pyx4j - maven-junction-plugin - - - link-private-testdata - process-test-resources - - - unlink-private-testdata - clean - - - link-private-qscript - process-test-resources - - - unlink-private-qscript - clean - - - - - - - - diff --git a/public/gatk-queue-extensions-public/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/ExampleCountLociQueueTest.scala b/public/gatk-queue-extensions-public/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/ExampleCountLociQueueTest.scala index d9abf68bc..f6cc7465f 100644 --- a/public/gatk-queue-extensions-public/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/ExampleCountLociQueueTest.scala +++ b/public/gatk-queue-extensions-public/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/ExampleCountLociQueueTest.scala @@ -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 diff --git a/public/gatk-queue-extensions-public/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/ExampleCountReadsQueueTest.scala b/public/gatk-queue-extensions-public/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/ExampleCountReadsQueueTest.scala index 7ee48d5fb..e79ea8a9f 100644 --- a/public/gatk-queue-extensions-public/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/ExampleCountReadsQueueTest.scala +++ b/public/gatk-queue-extensions-public/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/ExampleCountReadsQueueTest.scala @@ -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) diff --git a/public/gatk-queue-extensions-public/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/ExamplePrintReadsQueueTest.scala b/public/gatk-queue-extensions-public/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/ExamplePrintReadsQueueTest.scala index 68df21f6b..fcaf0d7cf 100644 --- a/public/gatk-queue-extensions-public/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/ExamplePrintReadsQueueTest.scala +++ b/public/gatk-queue-extensions-public/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/ExamplePrintReadsQueueTest.scala @@ -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 diff --git a/public/gatk-queue-extensions-public/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/ExampleReadFilterQueueTest.scala b/public/gatk-queue-extensions-public/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/ExampleReadFilterQueueTest.scala index 73d62b76f..af701740e 100644 --- a/public/gatk-queue-extensions-public/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/ExampleReadFilterQueueTest.scala +++ b/public/gatk-queue-extensions-public/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/ExampleReadFilterQueueTest.scala @@ -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) diff --git a/public/gatk-queue-extensions-public/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/ExampleRetryMemoryLimitQueueTest.scala b/public/gatk-queue-extensions-public/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/ExampleRetryMemoryLimitQueueTest.scala index 6a6258eef..dddccaa83 100644 --- a/public/gatk-queue-extensions-public/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/ExampleRetryMemoryLimitQueueTest.scala +++ b/public/gatk-queue-extensions-public/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/ExampleRetryMemoryLimitQueueTest.scala @@ -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 diff --git a/public/gatk-queue-extensions-public/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/HelloWorldQueueTest.scala b/public/gatk-queue-extensions-public/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/HelloWorldQueueTest.scala index 5423ba124..093050aa9 100644 --- a/public/gatk-queue-extensions-public/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/HelloWorldQueueTest.scala +++ b/public/gatk-queue-extensions-public/src/test/scala/org/broadinstitute/gatk/queue/pipeline/examples/HelloWorldQueueTest.scala @@ -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") diff --git a/public/gatk-queue/pom.xml b/public/gatk-queue/pom.xml index d0b463db4..7f5848ee3 100644 --- a/public/gatk-queue/pom.xml +++ b/public/gatk-queue/pom.xml @@ -60,20 +60,6 @@ org.scala-tools maven-scala-plugin - - com.pyx4j - maven-junction-plugin - - - link-public-qscript - process-test-resources - - - unlink-public-qscript - clean - - - org.apache.maven.plugins maven-resources-plugin @@ -118,42 +104,4 @@ - - - private-testdata - - - ${basedir}/../../private/pom.xml - - - - - - - com.pyx4j - maven-junction-plugin - - - link-private-testdata - process-test-resources - - - unlink-private-testdata - clean - - - link-private-qscript - process-test-resources - - - unlink-private-qscript - clean - - - - - - - - diff --git a/public/gatk-queue/src/test/scala/org/broadinstitute/gatk/queue/pipeline/QueueTest.scala b/public/gatk-queue/src/test/scala/org/broadinstitute/gatk/queue/pipeline/QueueTest.scala index c5bd554c1..62ac8e1fe 100644 --- a/public/gatk-queue/src/test/scala/org/broadinstitute/gatk/queue/pipeline/QueueTest.scala +++ b/public/gatk-queue/src/test/scala/org/broadinstitute/gatk/queue/pipeline/QueueTest.scala @@ -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() diff --git a/public/gatk-root/pom.xml b/public/gatk-root/pom.xml index af9b7ef80..456098bcd 100644 --- a/public/gatk-root/pom.xml +++ b/public/gatk-root/pom.xml @@ -401,6 +401,7 @@ + ${gatk.basedir} diff true ${java.io.tmpdir} @@ -424,6 +425,9 @@ **/*UnitTest.class + + unit + @@ -451,6 +455,7 @@ + ${gatk.basedir} diff true @@ -474,6 +479,9 @@ **/*IntegrationTest.class + + integration + @@ -491,6 +499,9 @@ **/*QueueTest.class + + queue + @@ -507,6 +518,9 @@ **/*LargeScaleTest.class + + largescale + @@ -523,6 +537,9 @@ **/*KnowledgeBaseTest.class + + knowledgebasetests + diff --git a/public/gatk-tools-public/pom.xml b/public/gatk-tools-public/pom.xml index 4534be411..6fdea07f2 100644 --- a/public/gatk-tools-public/pom.xml +++ b/public/gatk-tools-public/pom.xml @@ -78,34 +78,4 @@ - - - private-testdata - - - ${basedir}/../../private/pom.xml - - - - - - - com.pyx4j - maven-junction-plugin - - - link-private-testdata - process-test-resources - - - unlink-private-testdata - clean - - - - - - - - diff --git a/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/engine/EngineFeaturesIntegrationTest.java b/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/engine/EngineFeaturesIntegrationTest.java index bdd81e7a3..7f8b3bc5d 100644 --- a/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/engine/EngineFeaturesIntegrationTest.java +++ b/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/engine/EngineFeaturesIntegrationTest.java @@ -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); } diff --git a/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/engine/GenomeAnalysisEngineUnitTest.java b/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/engine/GenomeAnalysisEngineUnitTest.java index 161bb41d1..ff60ae30c 100644 --- a/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/engine/GenomeAnalysisEngineUnitTest.java +++ b/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/engine/GenomeAnalysisEngineUnitTest.java @@ -74,8 +74,8 @@ public class GenomeAnalysisEngineUnitTest extends BaseTest { GenomeAnalysisEngine testEngine = new GenomeAnalysisEngine(); Collection samFiles = new ArrayList(); - 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 samFiles = new ArrayList(); - 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 samFiles = new ArrayList(); samFiles.add(new SAMReaderID(relativePathToBAMFile, new Tags())); diff --git a/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/engine/datasources/reads/SAMReaderIDUnitTest.java b/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/engine/datasources/reads/SAMReaderIDUnitTest.java index 982b1aad7..bb1cd7521 100644 --- a/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/engine/datasources/reads/SAMReaderIDUnitTest.java +++ b/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/engine/datasources/reads/SAMReaderIDUnitTest.java @@ -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()); diff --git a/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/tools/CatVariantsIntegrationTest.java b/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/tools/CatVariantsIntegrationTest.java index 07ac8ab5d..f1b8d6ef3 100644 --- a/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/tools/CatVariantsIntegrationTest.java +++ b/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/tools/CatVariantsIntegrationTest.java @@ -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(); diff --git a/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/tools/walkers/coverage/CallableLociIntegrationTest.java b/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/tools/walkers/coverage/CallableLociIntegrationTest.java index b7d85ab58..b59794740 100644 --- a/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/tools/walkers/coverage/CallableLociIntegrationTest.java +++ b/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/tools/walkers/coverage/CallableLociIntegrationTest.java @@ -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"; diff --git a/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/BaseTest.java b/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/BaseTest.java index 16e566230..ca579223e 100644 --- a/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/BaseTest.java +++ b/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/BaseTest.java @@ -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. diff --git a/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/MD5DB.java b/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/MD5DB.java index 81c532434..d7c992906 100644 --- a/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/MD5DB.java +++ b/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/MD5DB.java @@ -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(); diff --git a/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/commandline/ArgumentTypeDescriptorUnitTest.java b/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/commandline/ArgumentTypeDescriptorUnitTest.java index a23c5c53e..1dfffa359 100644 --- a/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/commandline/ArgumentTypeDescriptorUnitTest.java +++ b/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/commandline/ArgumentTypeDescriptorUnitTest.java @@ -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, diff --git a/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/commandline/ParsingEngineUnitTest.java b/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/commandline/ParsingEngineUnitTest.java index b12d9506b..d3c85b6bc 100644 --- a/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/commandline/ParsingEngineUnitTest.java +++ b/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/commandline/ParsingEngineUnitTest.java @@ -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); diff --git a/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/commandline/RodBindingCollectionUnitTest.java b/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/commandline/RodBindingCollectionUnitTest.java index f8aa1efbe..a846384dc 100644 --- a/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/commandline/RodBindingCollectionUnitTest.java +++ b/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/commandline/RodBindingCollectionUnitTest.java @@ -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"); diff --git a/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/interval/IntervalUtilsUnitTest.java b/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/interval/IntervalUtilsUnitTest.java index b991087bd..d21424bc3 100644 --- a/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/interval/IntervalUtilsUnitTest.java +++ b/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/interval/IntervalUtilsUnitTest.java @@ -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[][] { diff --git a/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/text/ListFileUtilsUnitTest.java b/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/text/ListFileUtilsUnitTest.java index 39be4582a..086cefed7 100644 --- a/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/text/ListFileUtilsUnitTest.java +++ b/public/gatk-tools-public/src/test/java/org/broadinstitute/gatk/utils/text/ListFileUtilsUnitTest.java @@ -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 expectedBAMFileListAfterUnpacking = new ArrayList(); - 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 expectedBAMFileListAfterUnpacking = new ArrayList(); - 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 expected = new HashSet(Arrays.asList("public/testdata/exampleBAM.bam")); + Set expected = new HashSet(Arrays.asList(publicTestDir + "exampleBAM.bam")); Set 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(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 expectedUnpackedFileList ) throws Exception { List bamFiles = new ArrayList(); bamFiles.add(tempListFile.getAbsolutePath()); diff --git a/public/gatk-utils/pom.xml b/public/gatk-utils/pom.xml index e05bfc02e..922679304 100644 --- a/public/gatk-utils/pom.xml +++ b/public/gatk-utils/pom.xml @@ -189,33 +189,4 @@ - - - private-testdata - - - ${basedir}/../../private/pom.xml - - - - - - - com.pyx4j - maven-junction-plugin - - - link-private-testdata - process-test-resources - - - unlink-private-testdata - clean - - - - - - -