@@ -30,7 +30,8 @@ class DatasetLocatorImplSpec extends Specification {
30
30
def " Given a relative path, when a DatasetLocator is created then an IllegalArgumentException is thrown" () {
31
31
when :
32
32
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 > ()))
34
35
35
36
then :
36
37
thrown(IllegalArgumentException . class)
@@ -39,7 +40,8 @@ class DatasetLocatorImplSpec extends Specification {
39
40
def " Given an absolute path, when a DatasetLocator is created then an instance of this class is returned" () {
40
41
when :
41
42
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 > ()))
43
45
44
46
then :
45
47
noExceptionThrown()
@@ -48,7 +50,9 @@ class DatasetLocatorImplSpec extends Specification {
48
50
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" () {
49
51
given :
50
52
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 > ()))
52
56
53
57
when :
54
58
String datasetPath = locator. getPathToDataset()
@@ -60,7 +64,9 @@ class DatasetLocatorImplSpec extends Specification {
60
64
def " Given a flat structure, when the path to the dataset folder is requested, return the given path" () {
61
65
given :
62
66
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 > ()))
64
70
65
71
when :
66
72
String datasetPath = locator. getPathToDataset()
@@ -70,19 +76,15 @@ class DatasetLocatorImplSpec extends Specification {
70
76
}
71
77
72
78
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()
78
80
79
- multiFileContainer = dataFolders . getAbsolutePath()
81
+ multiFileContainer = tempDir . getAbsolutePath() + File . separator + " data "
80
82
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()
84
86
85
- multiFileDataStructureExample = file . getAbsolutePath()
87
+ multiFileDataStructureExample = tempDir . getAbsolutePath()
86
88
}
87
89
88
90
def setupRelativePathExample () {
@@ -91,18 +93,15 @@ class DatasetLocatorImplSpec extends Specification {
91
93
}
92
94
93
95
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()
98
97
99
- File singleFile = new File (dataFolders . getAbsolutePath() + File . separator + " NGSQABCD006AO-25838529214608.fastq" )
98
+ File singleFile = new File (tempDir . getAbsolutePath() + File . separator + " NGSQABCD006AO-25838529214608.fastq" )
100
99
singleFile. createNewFile()
101
100
singleDatasetFile = singleFile. getAbsolutePath()
102
101
103
- new File (file . getAbsolutePath() + File . separator + " provenance.json" ). createNewFile()
102
+ new File (tempDir . getAbsolutePath() + File . separator + " provenance.json" ). createNewFile()
104
103
105
- flatDataStructureExample = file . getAbsolutePath()
104
+ flatDataStructureExample = tempDir . getAbsolutePath()
106
105
}
107
106
108
107
}
0 commit comments