Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mirrors
biopet.biopet
Commits
0db87187
Commit
0db87187
authored
May 09, 2016
by
Peter van 't Hof
Browse files
Added tests for deps
parent
e73db7bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
biopet-core/src/test/scala/nl/lumc/sasc/biopet/core/WriteDependenciesTest.scala
View file @
0db87187
...
...
@@ -3,6 +3,7 @@ package nl.lumc.sasc.biopet.core
import
java.io.File
import
java.nio.file.Files
import
nl.lumc.sasc.biopet.utils.ConfigUtils
import
org.broadinstitute.gatk.queue.function.QFunction
import
org.scalatest.Matchers
import
org.scalatest.testng.TestNGSuite
...
...
@@ -26,11 +27,27 @@ class WriteDependenciesTest extends TestNGSuite with Matchers {
}
@Test
def
test
:
Unit
=
{
def
test
Deps
:
Unit
=
{
val
outputFile
=
File
.
createTempFile
(
"deps."
,
".json"
)
outputFile
.
deleteOnExit
()
WriteDependencies
.
writeDependencies
(
Qfunc
(
file1
::
Nil
,
file2
::
Nil
)
::
Qfunc
(
file2
::
Nil
,
file3
::
Nil
)
::
Nil
,
outputFile
)
println
(
Source
.
fromFile
(
outputFile
).
getLines
().
mkString
(
"\n"
))
val
func1
=
Qfunc
(
file1
::
Nil
,
file2
::
Nil
)
val
func2
=
Qfunc
(
file2
::
Nil
,
file3
::
Nil
)
WriteDependencies
.
writeDependencies
(
func1
::
func2
::
Nil
,
outputFile
)
val
deps
=
ConfigUtils
.
fileToConfigMap
(
outputFile
)
deps
(
"jobs"
)
shouldBe
a
[
Map
[
_
,
_
]]
val
jobs
=
deps
(
"jobs"
).
asInstanceOf
[
Map
[
String
,
Map
[
String
,
Any
]]]
jobs
.
count
(
_
.
_1
.
contains
(
"Qfunc"
))
shouldBe
2
deps
(
"files"
)
shouldBe
a
[
List
[
_
]]
val
files
=
deps
(
"files"
).
asInstanceOf
[
List
[
Map
[
String
,
Any
]]]
val
paths
=
files
.
map
(
x
=>
x
.
get
(
"path"
)).
flatten
assert
(
paths
.
contains
(
file1
.
toString
))
assert
(
paths
.
contains
(
file2
.
toString
))
assert
(
paths
.
contains
(
file3
.
toString
))
files
.
find
(
_
.
get
(
"path"
)
==
Some
(
file1
.
toString
)).
flatMap
(
_
.
get
(
"pipeline_input"
))
shouldBe
Some
(
true
)
files
.
find
(
_
.
get
(
"path"
)
==
Some
(
file2
.
toString
)).
flatMap
(
_
.
get
(
"pipeline_input"
))
shouldBe
Some
(
false
)
files
.
find
(
_
.
get
(
"path"
)
==
Some
(
file3
.
toString
)).
flatMap
(
_
.
get
(
"pipeline_input"
))
shouldBe
Some
(
false
)
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment