@@ -30,7 +30,8 @@ class DatasetLocatorImplSpec extends Specification {
3030    def  " Given a relative path, when a DatasetLocator is created then an IllegalArgumentException is thrown"  () {
3131        when :
3232        DatasetLocator  locator =  DatasetLocatorImpl . of(relativePathExample,
33-                 new  Provenance (" origin"  ," user"  ," id"  ,new  ArrayList<String > ()))
33+                 new  Provenance (" origin"  ," user"  ," id"  ,new  ArrayList<String > (),
34+                         new  ArrayList<String > ()))
3435
3536        then :
3637        thrown(IllegalArgumentException . class)
@@ -39,7 +40,8 @@ class DatasetLocatorImplSpec extends Specification {
3940    def  " Given an absolute path, when a DatasetLocator is created then an instance of this class is returned"  () {
4041        when :
4142        DatasetLocator  locator =  DatasetLocatorImpl . of(flatDataStructureExample,
42-                 new  Provenance (" origin"  ," user"  ," id"  , new  ArrayList<String > ()))
43+                 new  Provenance (" origin"  ," user"  ," id"  , new  ArrayList<String > (),
44+                         new  ArrayList<String > ()))
4345
4446        then :
4547        noExceptionThrown()
@@ -48,7 +50,9 @@ class DatasetLocatorImplSpec extends Specification {
4850    def  " Given a structure with more than one file, when the path to the dataset folder is requested, return the absolute path to the parent folder"  () {
4951        given :
5052        DatasetLocator  locator =  DatasetLocatorImpl . of(multiFileDataStructureExample,
51-                 new  Provenance (" origin"  ," user"  ," NGSQABCD006AO-25838529214608"  ,new  ArrayList<String > ()))
53+                 new  Provenance (" origin"  ," user"  ," NGSQABCD006AO-25838529214608"  ,
54+                         new  ArrayList<String > (Arrays . asList(" NGSQABCD006AO_left.fastq"  ,
55+                                 " NGSQABCD006AO_right.fastq"  )),new  ArrayList<String > ()))
5256
5357        when :
5458        String  datasetPath =  locator. getPathToDataset()
@@ -60,7 +64,9 @@ class DatasetLocatorImplSpec extends Specification {
6064    def  " Given a flat structure, when the path to the dataset folder is requested, return the given path"  () {
6165        given :
6266        DatasetLocator  locator =  DatasetLocatorImpl . of(flatDataStructureExample,
63-                 new  Provenance (" origin"  ," user"  ," NGSQABCD006AO-25838529214608"  ,new  ArrayList<String > ()))
67+                 new  Provenance (" origin"  ," user"  ," NGSQABCD006AO-25838529214608"  ,
68+                         new  ArrayList<String > (Arrays . asList(" NGSQABCD006AO-25838529214608.fastq"  )),
69+                         new  ArrayList<String > ()))
6470
6571        when :
6672        String  datasetPath =  locator. getPathToDataset()
@@ -70,19 +76,15 @@ class DatasetLocatorImplSpec extends Specification {
7076    }
7177
7278    def  setupMultiFileDataset () {
73-         File  file =  File . createTempDir()
74- 
75-         File  dataFolders =  new  File (file. getAbsolutePath()+ 
76-                 ' /NGSQABCD006AO-25838529214608/NGSQABCD006AO-25838529214608_dataset'  )
77-         dataFolders. mkdirs()
79+         File  tempDir =  File . createTempDir()
7880
79-         multiFileContainer =  dataFolders . getAbsolutePath()
81+         multiFileContainer =  tempDir . getAbsolutePath()  +   File . separator  +   " data " 
8082
81-         new  File (dataFolders . getAbsolutePath() +  File . separator +  " NGSQABCD006AO_left.fastq"  ). createNewFile()
82-         new  File (dataFolders . getAbsolutePath() +  File . separator +  " NGSQABCD006AO_right.fastq"  ). createNewFile()
83-         new  File (file . getAbsolutePath() +  File . separator +  " provenance.json"  ). createNewFile()
83+                  new  File (tempDir . getAbsolutePath() +  File . separator +  " NGSQABCD006AO_left.fastq"  ). createNewFile()
84+         new  File (tempDir . getAbsolutePath() +  File . separator +  " NGSQABCD006AO_right.fastq"  ). createNewFile()
85+         new  File (tempDir . getAbsolutePath() +  File . separator +  " provenance.json"  ). createNewFile()
8486
85-         multiFileDataStructureExample =  file . getAbsolutePath()
87+         multiFileDataStructureExample =  tempDir . getAbsolutePath()
8688    }
8789
8890    def  setupRelativePathExample () {
@@ -91,18 +93,15 @@ class DatasetLocatorImplSpec extends Specification {
9193    }
9294
9395    def  setupFlatDatasetExample () {
94-         File  file =  File . createTempDir()
95- 
96-         File  dataFolders =  new  File (file. getAbsolutePath()+ ' /NGSQABCD006AO-25838529214608.fastq_dataset'  )
97-         dataFolders. mkdirs()
96+         File  tempDir =  File . createTempDir()
9897
99-         File  singleFile =  new  File (dataFolders . getAbsolutePath() +  File . separator +  " NGSQABCD006AO-25838529214608.fastq"  )
98+         File  singleFile =  new  File (tempDir . getAbsolutePath() +  File . separator +  " NGSQABCD006AO-25838529214608.fastq"  )
10099        singleFile. createNewFile()
101100        singleDatasetFile =  singleFile. getAbsolutePath()
102101
103-         new  File (file . getAbsolutePath() +  File . separator +  " provenance.json"  ). createNewFile()
102+         new  File (tempDir . getAbsolutePath() +  File . separator +  " provenance.json"  ). createNewFile()
104103
105-         flatDataStructureExample =  file . getAbsolutePath()
104+         flatDataStructureExample =  tempDir . getAbsolutePath()
106105    }
107106
108107}
0 commit comments