BiopetPipeTest.scala 2.1 KB
Newer Older
Peter van 't Hof's avatar
Peter van 't Hof committed
1
2
3
4
5
6
7
8
9
10
/**
 * Biopet is built on top of GATK Queue for building bioinformatic
 * pipelines. It is mainly intended to support LUMC SHARK cluster which is running
 * SGE. But other types of HPC that are supported by GATK Queue (such as PBS)
 * should also be able to execute Biopet tools and pipelines.
 *
 * Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
 *
 * Contact us at: sasc@lumc.nl
 *
11
 * A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
Peter van 't Hof's avatar
Peter van 't Hof committed
12
13
14
 * license; For commercial users or users who do not want to follow the AGPL
 * license, please contact us to obtain a separate license.
 */
Peter van 't Hof's avatar
Peter van 't Hof committed
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package nl.lumc.sasc.biopet.core

import org.scalatest.Matchers
import org.scalatest.testng.TestNGSuite
import org.testng.annotations.Test

/**
 * Created by pjvanthof on 09/09/15.
 */
class BiopetPipeTest extends TestNGSuite with Matchers {
  class Pipe1 extends BiopetCommandLineFunction {
    val root = null
    def cmdLine = "pipe1" +
      (if (!inputAsStdin) " input1 " else "") +
      (if (!outputAsStsout) " output1 " + "")
  }

  class Pipe2 extends BiopetCommandLineFunction {
    val root = null
    def cmdLine = "pipe2" +
      (if (!inputAsStdin) " input2 " else "") +
      (if (!outputAsStsout) " output2 " + "")
  }

  @Test def testPipeCommands: Unit = {
    val pipe1 = new Pipe1
    val pipe2 = new Pipe2
    pipe1.commandLine.contains("pipe1") shouldBe true
    pipe1.commandLine.contains("input1") shouldBe true
    pipe1.commandLine.contains("output1") shouldBe true
    pipe2.commandLine.contains("pipe2") shouldBe true
    pipe2.commandLine.contains("input2") shouldBe true
    pipe2.commandLine.contains("output2") shouldBe true
  }

  @Test def testPipe: Unit = {
    val pipe = new Pipe1 | new Pipe2
    pipe.commandLine.contains("pipe1") shouldBe true
    pipe.commandLine.contains("input1") shouldBe true
    pipe.commandLine.contains("output1") shouldBe false
    pipe.commandLine.contains("pipe2") shouldBe true
    pipe.commandLine.contains("input2") shouldBe false
    pipe.commandLine.contains("output2") shouldBe true
  }
}