81466072dbbe7fd3f02f4ac707d1b587ae8cb3f3
[jalview.git] / test / jalview / ext / cipres / CipresJobTest.java
1 package jalview.ext.cipres;
2
3 import static org.testng.Assert.assertFalse;
4 import static org.testng.Assert.assertNull;
5 import static org.testng.Assert.assertTrue;
6
7 import jalview.gui.JvOptionPane;
8
9 import java.util.Arrays;
10
11 import org.testng.annotations.BeforeClass;
12 import org.testng.annotations.Test;
13
14 public class CipresJobTest
15 {
16   @BeforeClass(
17     alwaysRun = true
18   )
19   public void setUpJvOptionPane()
20   {
21     JvOptionPane.setInteractiveMode(false);
22     JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
23   }
24
25   @Test(
26     groups = "Functional"
27   )
28   public void testSettingJobParameters()
29   {
30     CipresJob testJob = new CipresJob("examples/plantfdx.fa");
31     testJob.addToolParameters("runtime_", Arrays.asList("0.3"));
32     testJob.addInputParameter("test", "hoi");
33     testJob.addMetadata("hennepin", "crawler");
34     assertFalse(testJob.areParamsValidated());
35
36     testJob.clearAllParameters();
37     assertNull(testJob.getvParams().get("runtime_"));
38
39
40   }
41
42   @Test(
43     groups =
44     { "External" }
45   )
46   public void testValidatingParameters()
47   {
48     CipresJob testJob = new CipresJob("examples/plantfdx.fa", "CLUSTALW");
49     testJob.addToolParameters("runtime_", Arrays.asList("0.2"));
50     testJob.addMetadata("clientJobId", "101");
51     testJob.validateJobParams();
52     assertTrue(testJob.areParamsValidated());
53
54   }
55
56   @Test(
57     groups =
58     { "External" }
59   )
60   public void testJobSubmission()
61   {
62     CipresJob testJob = new CipresJob("examples/plantfdx.fa", "CLUSTALW");
63     testJob.addToolParameters("runtime_", Arrays.asList("0.2"));
64     testJob.addMetadata("clientJobId", "102");
65     testJob.addMetadata("statusEmail", "false");
66     testJob.addMetadata("clientJobName", "test_job");
67     testJob.submitJob();
68     assertTrue(testJob.areParamsValidated());
69
70   }
71 }