Class |
Line # |
Actions |
|||
---|---|---|---|---|---|
EnsemblRestClientTest | 34 | 11 | 9 |
1 | /* | |
2 | * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) | |
3 | * Copyright (C) $$Year-Rel$$ The Jalview Authors | |
4 | * | |
5 | * This file is part of Jalview. | |
6 | * | |
7 | * Jalview is free software: you can redistribute it and/or | |
8 | * modify it under the terms of the GNU General Public License | |
9 | * as published by the Free Software Foundation, either version 3 | |
10 | * of the License, or (at your option) any later version. | |
11 | * | |
12 | * Jalview is distributed in the hope that it will be useful, but | |
13 | * WITHOUT ANY WARRANTY; without even the implied warranty | |
14 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR | |
15 | * PURPOSE. See the GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with Jalview. If not, see <http://www.gnu.org/licenses/>. | |
19 | * The Jalview Authors are detailed in the 'AUTHORS' file. | |
20 | */ | |
21 | package jalview.ext.ensembl; | |
22 | ||
23 | import static org.testng.Assert.assertTrue; | |
24 | ||
25 | import jalview.datamodel.AlignmentI; | |
26 | ||
27 | import java.net.MalformedURLException; | |
28 | import java.net.URL; | |
29 | import java.util.List; | |
30 | ||
31 | import org.testng.annotations.BeforeMethod; | |
32 | import org.testng.annotations.Test; | |
33 | ||
34 | public class EnsemblRestClientTest | |
35 | { | |
36 | private EnsemblRestClient sf; | |
37 | ||
38 | 0 | @Test(suiteName = "live") |
39 | public void testIsEnsemblAvailable() | |
40 | { | |
41 | 0 | boolean isAvailable = sf.isEnsemblAvailable(); |
42 | 0 | if (isAvailable) |
43 | { | |
44 | 0 | System.out.println("Ensembl is UP!"); |
45 | } | |
46 | else | |
47 | { | |
48 | 0 | System.err.println( |
49 | "Ensembl is DOWN or unreachable ******************* BAD!"); | |
50 | } | |
51 | } | |
52 | ||
53 | 0 | @BeforeMethod(alwaysRun = true) |
54 | protected void setUp() | |
55 | { | |
56 | 0 | sf = new EnsemblRestClient() |
57 | { | |
58 | ||
59 | 0 | @Override |
60 | public String getDbName() | |
61 | { | |
62 | 0 | return null; |
63 | } | |
64 | ||
65 | 0 | @Override |
66 | public AlignmentI getSequenceRecords(String queries) throws Exception | |
67 | { | |
68 | 0 | return null; |
69 | } | |
70 | ||
71 | 0 | @Override |
72 | protected URL getUrl(List<String> ids) throws MalformedURLException | |
73 | { | |
74 | 0 | return null; |
75 | } | |
76 | ||
77 | 0 | @Override |
78 | protected boolean useGetRequest() | |
79 | { | |
80 | 0 | return false; |
81 | } | |
82 | }; | |
83 | } | |
84 | ||
85 | 0 | @Test(groups = "Network") |
86 | public void testCheckEnsembl_overload() | |
87 | { | |
88 | 0 | for (int i = 0; i < 20; i++) |
89 | { | |
90 | 0 | assertTrue(sf.checkEnsembl(), "Error on " + (i + 1) + "th ping"); |
91 | } | |
92 | } | |
93 | } |