@@ -216,7 +216,6 @@ abstract public static class AbstractPipelineTestCase extends Assert
216216
217217 protected Container _project ;
218218 protected TestContext _context ;
219- protected File _pipelineRoot ;
220219 protected File _sampleData ;
221220
222221 protected Boolean _isExternalPipelineEnabled = null ;
@@ -269,9 +268,7 @@ public void setUp() throws Exception
269268 {
270269 _context = TestContext .get ();
271270 _sampleData = getSampleDataDir ();
272-
273271 _project = ContainerManager .getForPath (getProjectName ());
274- _pipelineRoot = PipelineService .get ().getPipelineRootSetting (_project ).getRootPath ();
275272
276273 String path = PipelineJobService .get ().getConfigProperties ().getSoftwarePackagePath (SequencePipelineService .SEQUENCE_TOOLS_PARAM );
277274 path = StringUtils .trimToNull (path );
@@ -396,14 +393,16 @@ protected void decompressAndCleanFastq(File input, File output)
396393 }
397394 }
398395
399- protected void verifyFileInputs (File basedir , String [] fileNames , JSONObject config , String prefix )
396+ protected void verifyFileInputs (File basedir , String [] fileNames , JSONObject config , String prefix , Container jobContainer )
400397 {
398+ File pipelineRoot = PipelineService .get ().findPipelineRoot (jobContainer ).getRootPath ();
399+
401400 String handling = config .getString ("inputFileTreatment" );
402401 if ("none" .equals (handling ))
403402 {
404403 for (String fn : fileNames )
405404 {
406- File input = FileUtil .appendName (_pipelineRoot , prefix + fn );
405+ File input = FileUtil .appendName (pipelineRoot , prefix + fn );
407406 Assert .assertTrue ("Input file missing: " + input .getPath (), input .exists ());
408407 }
409408 }
@@ -413,7 +412,7 @@ else if ("compress".equals(handling))
413412
414413 for (String fn : fileNames )
415414 {
416- File input = FileUtil .appendName (_pipelineRoot , prefix + fn );
415+ File input = FileUtil .appendName (pipelineRoot , prefix + fn );
417416 Assert .assertFalse ("Input file still exists: " + input .getPath (), input .exists ());
418417
419418 File compressed ;
@@ -429,7 +428,7 @@ else if ("delete".equals(handling))
429428 {
430429 for (String fn : fileNames )
431430 {
432- File input = FileUtil .appendName (_pipelineRoot , prefix + fn );
431+ File input = FileUtil .appendName (pipelineRoot , prefix + fn );
433432 Assert .assertFalse ("Input file still present: " + input .getPath (), input .exists ());
434433 }
435434 }
@@ -738,6 +737,11 @@ protected static void doCleanup(String projectName)
738737 ContainerManager .deleteAll (project , TestContext .get ().getUser ());
739738 }
740739 }
740+
741+ protected File getPipelineRoot (Container c )
742+ {
743+ return PipelineService .get ().getPipelineRootSetting (c ).getRootPath ();
744+ }
741745 }
742746
743747 public static class SequenceImportPipelineTestCase extends AbstractPipelineTestCase
@@ -799,7 +803,7 @@ public void basicTest() throws Exception
799803 try
800804 {
801805 verifyFileOutputs (basedir , expectedOutputs );
802- verifyFileInputs (basedir , fileNames , config , prefix );
806+ verifyFileInputs (basedir , fileNames , config , prefix , workbook );
803807 validateReadsets (jobs , config );
804808
805809 Assert .assertEquals ("Incorrect read number" , 3260L , FastqUtils .getSequenceCount (fq ));
@@ -836,7 +840,7 @@ public void leaveInPlaceTest() throws Exception
836840 Set <File > expectedOutputs = new HashSet <>();
837841 File basedir = getBaseDir (jobs .iterator ().next ());
838842 Assert .assertFalse ("Unexpected file found" , FileUtil .appendName (basedir , prefix + PAIRED_FILENAME1 ).exists ());
839- File fq = FileUtil .appendName (_pipelineRoot , prefix + PAIRED_FILENAME1 );
843+ File fq = FileUtil .appendName (getPipelineRoot ( c ) , prefix + PAIRED_FILENAME1 );
840844 Assert .assertTrue ("File not found" , fq .exists ());
841845 expectedOutputs .add (FileUtil .appendName (basedir , "sequenceImport.json" ));
842846 expectedOutputs .add (FileUtil .appendName (basedir , "sequenceSupport.json.gz" ));
@@ -846,7 +850,7 @@ public void leaveInPlaceTest() throws Exception
846850 try
847851 {
848852 verifyFileOutputs (basedir , expectedOutputs );
849- verifyFileInputs (basedir , fileNames , config , prefix );
853+ verifyFileInputs (basedir , fileNames , config , prefix , c );
850854 validateReadsets (jobs , config );
851855
852856 Assert .assertEquals ("Incorrect read number" , 211L , FastqUtils .getSequenceCount (fq ));
@@ -950,7 +954,7 @@ private void runMergePipelineJob(String jobName, boolean deleteIntermediates, St
950954 expectedOutputs .add (FileUtil .appendName (basedir , prefix + PAIRED_FILENAME2_L1b ));
951955 }
952956
953- verifyJob (basedir , jobName , expectedOutputs , new String []{PAIRED_FILENAME_L1a , PAIRED_FILENAME2_L1a , PAIRED_FILENAME_L1b , PAIRED_FILENAME2_L1b , PAIRED_FILENAME_L2 , PAIRED_FILENAME2_L2 }, prefix , config );
957+ verifyJob (basedir , jobName , expectedOutputs , new String []{PAIRED_FILENAME_L1a , PAIRED_FILENAME2_L1a , PAIRED_FILENAME_L1b , PAIRED_FILENAME2_L1b , PAIRED_FILENAME_L2 , PAIRED_FILENAME2_L2 }, prefix , config , _project );
954958
955959 Assert .assertEquals ("Incorrect read number" , 422L , FastqUtils .getSequenceCount (merge1 ));
956960 Assert .assertEquals ("Incorrect read number" , 422L , FastqUtils .getSequenceCount (merge2 ));
@@ -967,7 +971,7 @@ private void runMergePipelineJob(String jobName, boolean deleteIntermediates, St
967971 expectedOutputs .add (FileUtil .appendName (basedir , prefix + FileUtil .getBaseName (FileUtil .getBaseName (PAIRED_FILENAME2 )) + "_fastqc.html.gz" ));
968972 expectedOutputs .add (FileUtil .appendName (basedir , prefix + FileUtil .getBaseName (FileUtil .getBaseName (PAIRED_FILENAME2 )) + "_fastqc.zip" ));
969973
970- verifyJob (basedir , jobName , expectedOutputs , new String []{PAIRED_FILENAME1 , PAIRED_FILENAME2 }, prefix , config );
974+ verifyJob (basedir , jobName , expectedOutputs , new String []{PAIRED_FILENAME1 , PAIRED_FILENAME2 }, prefix , config , _project );
971975
972976 //job3: g3
973977 expectedOutputs = new HashSet <>();
@@ -976,11 +980,11 @@ private void runMergePipelineJob(String jobName, boolean deleteIntermediates, St
976980 expectedOutputs .add (FileUtil .appendName (basedir , prefix + FileUtil .getBaseName (FileUtil .getBaseName (UNPAIRED_FILENAME )) + "_fastqc.html.gz" ));
977981 expectedOutputs .add (FileUtil .appendName (basedir , prefix + FileUtil .getBaseName (FileUtil .getBaseName (UNPAIRED_FILENAME )) + "_fastqc.zip" ));
978982
979- verifyJob (basedir , jobName , expectedOutputs , new String []{UNPAIRED_FILENAME }, prefix , config );
983+ verifyJob (basedir , jobName , expectedOutputs , new String []{UNPAIRED_FILENAME }, prefix , config , _project );
980984 validateReadsets (jobs , config , 1 ); //we expect one per job, total of 3
981985 }
982986
983- private void verifyJob (File basedir , String jobName , Set <File > expectedOutputs , String [] fileNames , String prefix , JSONObject config ) throws Exception
987+ private void verifyJob (File basedir , String jobName , Set <File > expectedOutputs , String [] fileNames , String prefix , JSONObject config , Container c ) throws Exception
984988 {
985989 expectedOutputs .add (FileUtil .appendName (basedir , basedir .getName () + ".pipe.xar.xml" ));
986990 expectedOutputs .add (FileUtil .appendName (basedir , "sequenceImport.json" ));
@@ -991,7 +995,7 @@ private void verifyJob(File basedir, String jobName, Set<File> expectedOutputs,
991995 try
992996 {
993997 verifyFileOutputs (basedir , expectedOutputs );
994- verifyFileInputs (basedir , fileNames , config , prefix );
998+ verifyFileInputs (basedir , fileNames , config , prefix , c );
995999 }
9961000 catch (Exception e )
9971001 {
@@ -1129,7 +1133,7 @@ public void barcodeTest() throws Exception
11291133 try
11301134 {
11311135 verifyFileOutputs (basedir , expectedOutputs );
1132- verifyFileInputs (basedir , fileNames , config , prefix );
1136+ verifyFileInputs (basedir , fileNames , config , prefix , workbook );
11331137 validateReadsets (jobs , config , 4 );
11341138 validateBarcodeFastqs (expectedOutputs );
11351139 }
@@ -1175,7 +1179,7 @@ public void barcodeTestDeletingIntermediates() throws Exception
11751179 try
11761180 {
11771181 verifyFileOutputs (basedir , expectedOutputs );
1178- verifyFileInputs (basedir , fileNames , config , prefix );
1182+ verifyFileInputs (basedir , fileNames , config , prefix , _project );
11791183 validateReadsets (jobs , config , 4 );
11801184 validateBarcodeFastqs (expectedOutputs );
11811185 }
@@ -1245,7 +1249,7 @@ public void pairedEndTest() throws Exception
12451249 try
12461250 {
12471251 verifyFileOutputs (basedir , expectedOutputs );
1248- verifyFileInputs (basedir , fileNames , config , prefix );
1252+ verifyFileInputs (basedir , fileNames , config , prefix , c );
12491253 validateReadsets (jobs , config );
12501254 }
12511255 catch (Exception e )
@@ -1303,7 +1307,7 @@ public void pairedEndTestMovingInputs() throws Exception
13031307 try
13041308 {
13051309 verifyFileOutputs (basedir , expectedOutputs );
1306- verifyFileInputs (basedir , fileNames , config , prefix );
1310+ verifyFileInputs (basedir , fileNames , config , prefix , _project );
13071311 validateReadsets (jobs , config );
13081312 }
13091313 catch (Exception e )
@@ -1361,7 +1365,7 @@ public void pairedEndTestDeletingInputs() throws Exception
13611365 try
13621366 {
13631367 verifyFileOutputs (basedir , expectedOutputs );
1364- verifyFileInputs (basedir , fileNames , config , prefix );
1368+ verifyFileInputs (basedir , fileNames , config , prefix , workbook );
13651369 validateReadsets (jobs , config );
13661370 }
13671371 catch (Exception e )
@@ -1508,7 +1512,7 @@ protected void validateAlignmentJob(Set<PipelineJob> jobs, Collection<String> ad
15081512
15091513 for (String fn : additionalFiles )
15101514 {
1511- expectedOutputs .add (FileUtil .appendName (basedir , fn ));
1515+ expectedOutputs .add (FileUtil .appendPath (basedir , Path . parse ( fn ) ));
15121516 }
15131517
15141518 File bam = FileUtil .appendPath (basedir , Path .parse (outDir + "/Alignment/" + rs .getName () + ".bam" ));
@@ -1572,21 +1576,22 @@ public void setUp() throws Exception
15721576
15731577 protected void copyInputFiles () throws Exception
15741578 {
1575- File file3 = FileUtil .appendName (_pipelineRoot , PAIRED_FILENAME1 );
1579+ File pipelineRoot = getPipelineRoot (_project );
1580+ File file3 = FileUtil .appendName (pipelineRoot , PAIRED_FILENAME1 );
15761581 if (!file3 .exists ())
15771582 FileUtils .copyFile (FileUtil .appendName (_sampleData , PAIRED_FILENAME1 ), file3 );
15781583
1579- File file4 = FileUtil .appendName (_pipelineRoot , PAIRED_FILENAME2 );
1584+ File file4 = FileUtil .appendName (pipelineRoot , PAIRED_FILENAME2 );
15801585 if (!file4 .exists ())
15811586 FileUtils .copyFile (FileUtil .appendName (_sampleData , PAIRED_FILENAME2 ), file4 );
15821587
1583- File file5 = FileUtil .appendName (_pipelineRoot , UNZIPPED_PAIRED_FILENAME1 );
1588+ File file5 = FileUtil .appendName (pipelineRoot , UNZIPPED_PAIRED_FILENAME1 );
15841589 if (!file5 .exists ())
15851590 {
15861591 decompressAndCleanFastq (FileUtil .appendName (_sampleData , PAIRED_FILENAME1 ), file5 );
15871592 }
15881593
1589- File file6 = FileUtil .appendName (_pipelineRoot , UNZIPPED_PAIRED_FILENAME2 );
1594+ File file6 = FileUtil .appendName (pipelineRoot , UNZIPPED_PAIRED_FILENAME2 );
15901595 if (!file6 .exists ())
15911596 {
15921597 decompressAndCleanFastq (FileUtil .appendName (_sampleData , PAIRED_FILENAME2 ), file6 );
@@ -1596,16 +1601,16 @@ protected void copyInputFiles() throws Exception
15961601 protected List <SequenceReadsetImpl > createReadsets () throws Exception
15971602 {
15981603 List <SequenceReadsetImpl > models = new ArrayList <>();
1599-
1600- File file1 = FileUtil .appendName (_pipelineRoot , PAIRED_FILENAME1 );
1601- File file2 = FileUtil .appendName (_pipelineRoot , PAIRED_FILENAME2 );
1604+ File pipelineRoot = getPipelineRoot ( _project );
1605+ File file1 = FileUtil .appendName (pipelineRoot , PAIRED_FILENAME1 );
1606+ File file2 = FileUtil .appendName (pipelineRoot , PAIRED_FILENAME2 );
16021607 models .add (createReadset ("TestReadset1" , List .of (Pair .of (file1 , file2 )), false ));
16031608
16041609
1605- File file3 = FileUtil .appendName (_pipelineRoot , UNZIPPED_PAIRED_FILENAME1 );
1610+ File file3 = FileUtil .appendName (pipelineRoot , UNZIPPED_PAIRED_FILENAME1 );
16061611 models .add (createReadset ("TestReadset2" , List .of (Pair .of (file3 , null )), true ));
16071612
1608- File file4 = FileUtil .appendName (_pipelineRoot , UNZIPPED_PAIRED_FILENAME2 );
1613+ File file4 = FileUtil .appendName (pipelineRoot , UNZIPPED_PAIRED_FILENAME2 );
16091614 models .add (createReadset ("TestReadset3" , List .of (Pair .of (file4 , null )), true ));
16101615
16111616 return models ;
@@ -1677,17 +1682,17 @@ protected void appendSamplesForAlignment(JSONObject config, List<SequenceReadset
16771682 protected void validateInputs ()
16781683 {
16791684 //all files have 204 reads
1680-
1681- File file1 = FileUtil .appendName (_pipelineRoot , PAIRED_FILENAME1 );
1685+ File pipelineRoot = getPipelineRoot ( _project );
1686+ File file1 = FileUtil .appendName (pipelineRoot , PAIRED_FILENAME1 );
16821687 Assert .assertTrue ("Unable to find input: " + file1 .getPath (), file1 .exists ());
16831688
1684- File file2 = FileUtil .appendName (_pipelineRoot , PAIRED_FILENAME2 );
1689+ File file2 = FileUtil .appendName (pipelineRoot , PAIRED_FILENAME2 );
16851690 Assert .assertTrue ("Unable to find input: " + file2 .getPath (), file2 .exists ());
16861691
1687- File file3 = FileUtil .appendName (_pipelineRoot , UNZIPPED_PAIRED_FILENAME1 );
1692+ File file3 = FileUtil .appendName (pipelineRoot , UNZIPPED_PAIRED_FILENAME1 );
16881693 Assert .assertTrue ("Unable to find input: " + file3 .getPath (), file3 .exists ());
16891694
1690- File file4 = FileUtil .appendName (_pipelineRoot , UNZIPPED_PAIRED_FILENAME2 );
1695+ File file4 = FileUtil .appendName (pipelineRoot , UNZIPPED_PAIRED_FILENAME2 );
16911696 Assert .assertTrue ("Unable to find input: " + file4 .getPath (), file4 .exists ());
16921697 }
16931698
@@ -2654,25 +2659,26 @@ public void testMergedAlignments() throws Exception
26542659 JSONObject config = substituteParams (FileUtil .appendName (_sampleData , ALIGNMENT_JOB ), jobName );
26552660 config .put ("alignment" , "BWA-Mem" );
26562661
2662+ File pipelineRoot = getPipelineRoot (_project );
26572663 for (String fn : Arrays .asList (PAIRED_FILENAME_L1a , PAIRED_FILENAME_L2 ))
26582664 {
2659- File file3 = FileUtil .appendName (_pipelineRoot , fn );
2665+ File file3 = FileUtil .appendName (pipelineRoot , fn );
26602666 if (!file3 .exists ())
26612667 FileUtils .copyFile (FileUtil .appendName (_sampleData , PAIRED_FILENAME1 ), file3 );
26622668 }
26632669
26642670 for (String fn : Arrays .asList (PAIRED_FILENAME2_L1a , PAIRED_FILENAME2_L2 ))
26652671 {
2666- File file4 = FileUtil .appendName (_pipelineRoot , fn );
2672+ File file4 = FileUtil .appendName (pipelineRoot , fn );
26672673 if (!file4 .exists ())
26682674 FileUtils .copyFile (FileUtil .appendName (_sampleData , PAIRED_FILENAME2 ), file4 );
26692675 }
26702676
26712677 List <SequenceReadsetImpl > models = new ArrayList <>();
26722678
26732679 models .add (createReadset ("TestMergedReadset" , Arrays .asList (
2674- Pair .of (FileUtil .appendName (_pipelineRoot , PAIRED_FILENAME_L1a ), FileUtil .appendName (_pipelineRoot , PAIRED_FILENAME2_L1a )),
2675- Pair .of (FileUtil .appendName (_pipelineRoot , PAIRED_FILENAME_L2 ), FileUtil .appendName (_pipelineRoot , PAIRED_FILENAME2_L2 ))
2680+ Pair .of (FileUtil .appendName (pipelineRoot , PAIRED_FILENAME_L1a ), FileUtil .appendName (pipelineRoot , PAIRED_FILENAME2_L1a )),
2681+ Pair .of (FileUtil .appendName (pipelineRoot , PAIRED_FILENAME_L2 ), FileUtil .appendName (pipelineRoot , PAIRED_FILENAME2_L2 ))
26762682 ), true ));
26772683
26782684 appendSamplesForAlignment (config , models );
0 commit comments