diff --git a/public/gentrap/pom.xml b/public/gentrap/pom.xml index f2efa47b09848825b1821e9f118d4693bf4e20d0..46330da31d0dea1a19440144f092855e36bbd0c7 100644 --- a/public/gentrap/pom.xml +++ b/public/gentrap/pom.xml @@ -44,5 +44,17 @@ <artifactId>Mapping</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <version>6.8</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.scalatest</groupId> + <artifactId>scalatest_2.11</artifactId> + <version>2.2.1</version> + <scope>test</scope> + </dependency> </dependencies> </project> diff --git a/public/gentrap/src/test/scala/nl/lumc/sasc/biopet/pipelines/gentrap/GentrapTest.scala b/public/gentrap/src/test/scala/nl/lumc/sasc/biopet/pipelines/gentrap/GentrapTest.scala new file mode 100644 index 0000000000000000000000000000000000000000..c5c9decac9d540ab99675d6bd84ff7fe16ae3bf2 --- /dev/null +++ b/public/gentrap/src/test/scala/nl/lumc/sasc/biopet/pipelines/gentrap/GentrapTest.scala @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2015 Leiden University Medical Center - Sequencing Analysis Support Core <sasc@lumc.nl> + * @author Wibowo Arindrarto <w.arindrarto@lumc.nl> + */ +package nl.lumc.sasc.biopet.pipelines.gentrap + +import org.scalatest.Matchers +import org.scalatest.testng.TestNGSuite +import org.testng.annotations.Test + +import nl.lumc.sasc.biopet.core.config.Config + +class GentrapTest extends TestNGSuite with Matchers { + + /** Method to set test config */ + // since the pipeline Config is a global value, we first store the + // initial config into a value, store the supplied value, then return + // the initial config for restoring later + private def setConfig(map: Map[String, Any]): Map[String, Any] = { + val oldMap: Map[String, Any] = Config.global.map.toMap + Config.global.map = map + oldMap + } + + /** Method to set the global config */ + private def restoreConfig(initConfig: Map[String, Any]): Unit = Config.global.map = initConfig + + /** Minimum config required for Gentrap */ + private val minimumConfig = Map( + "output_dir" -> "/tmp", + "aligner" -> "gsnap", + "reference" -> "mock", + "gsnap" -> Map("db" -> "fixt_gentrap_hg19"), + "samples" -> Map( + "sample_1" -> Map( + "libraries" -> Map( + "lib_1" -> Map( + "R1" -> "/tmp/mock.fq" + ) + ) + ) + ) + ) + + // Test pipeline initialization with minimum config -- there should be no exceptions raised + @Test def testInitMinimumConfig() = { + val initialConfig = setConfig(minimumConfig) + val gentrap = new Gentrap() + restoreConfig(initialConfig) + } +}